/* Hazard Hunt website: styles. Brand colours come from the config file and are set on :root by app.js. */

:root {
  --red: #FF2801;
  --red-dark: #D92000;
  --dark: #253238;
  --dark2: #1B262B;
  --grey: #657378;
  --light: #F7F8F8;
  --line: #E1E5E7;
  --green: #1DA862;
  --amber: #FFB400;
  --white: #FFFFFF;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overscroll-behavior: none; }
body {
  position: fixed; inset: 0; width: 100%; height: 100%; overflow: hidden;
  font-family: var(--font); color: var(--dark); background: var(--dark2);
  -webkit-text-size-adjust: 100%; -webkit-user-select: none; user-select: none; touch-action: manipulation;
}
input, textarea, select { -webkit-user-select: text; user-select: text; font-family: var(--font); }
#app { position: absolute; inset: 0; overflow: hidden; background: var(--white); }
.screen { position: absolute; inset: 0; display: none; flex-direction: column; background: var(--white); }
.screen.active { display: flex; }
.screen.dark { background: var(--dark); color: var(--white); }
.scrolls { overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.column { flex: 1 1 auto; width: 100%; max-width: 560px; margin: 0 auto; padding: calc(20px + var(--safe-top)) 20px calc(28px + var(--safe-bottom)); }
.column.wide { max-width: 780px; padding-left: 0; padding-right: 0; padding-top: 0; }
.lead { font-size: 16px; line-height: 1.45; color: #3B474D; margin: 6px 0 0; }
.hp { position: absolute; left: -9999px; top: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: block; width: 100%; min-height: 54px; padding: 0 18px; border: 0; border-radius: 14px;
  font: 700 17px/1.2 var(--font); cursor: pointer; text-align: center; text-decoration: none;
  transition: transform .08s ease, background .15s ease;
}
.btn:active { transform: scale(.985); }
.btn.primary { background: var(--red); color: var(--white); }
.btn.primary:active { background: var(--red-dark); }
.btn.secondary { background: var(--white); color: var(--dark); border: 2px solid var(--dark); }
.btn.big { min-height: 60px; font-size: 19px; }
.btn.link { background: transparent; color: var(--dark); text-decoration: underline; min-height: 44px; font-weight: 600; }
.btn.link.light { color: rgba(255,255,255,.85); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.option { display: flex; align-items: center; justify-content: center; line-height: 1.25; padding: 12px 18px; }

/* ---------- Brand ---------- */
.brand { display: inline-block; font-weight: 900; font-size: 22px; letter-spacing: .12em; color: var(--white); text-decoration: none; }
.brand span { position: relative; padding-bottom: 4px; }
.brand span::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 4px; background: var(--red); border-radius: 2px; }

/* ---------- 1. Start ---------- */
.start-inner {
  flex: 1 1 auto; padding: calc(32px + var(--safe-top)) 24px calc(28px + var(--safe-bottom));
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  width: 100%; max-width: 520px; margin: 0 auto;
}
.eyebrow { margin-top: 36px; font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.72); }
h1 { margin: 8px 0 0; font-size: 44px; line-height: 1.05; letter-spacing: -.01em; }
.tagline { margin: 14px 0 0; font-size: 18px; line-height: 1.4; color: rgba(255,255,255,.85); }
#btn-start { margin-top: 24px; max-width: 360px; }
.picker-label { margin-top: 26px; font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.72); }
.scene-picker { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 360px; margin-top: 10px; }
.scene-btn {
  min-height: 48px; border-radius: 12px; border: 2px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08);
  color: var(--white); font: 700 16px var(--font); cursor: pointer; padding: 0 14px; text-align: left; display: flex; align-items: center; gap: 10px;
}
.scene-btn::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255,255,255,.6); flex: 0 0 14px; }
.scene-btn.selected { border-color: var(--red); background: rgba(255,40,1,.18); }
.scene-btn.selected::before { background: var(--red); border-color: var(--red); }
.fine { font-size: 13px; line-height: 1.45; color: var(--grey); margin: 18px 0 0; text-align: center; }
.fine.light { color: rgba(255,255,255,.7); }
#open-full { margin-top: 6px; width: auto; }

/* ---------- 2. Play ---------- */
.screen.play { background: #0f1416; touch-action: none; }
.hh-pano { position: absolute; inset: 0; touch-action: none; }
.hh-pano .pnlm-container { background: #0f1416; }
.hh-pano .pnlm-grab, .hh-pano .pnlm-grabbing { cursor: grab; }
.hh-pano .pnlm-grabbing { cursor: grabbing; }
.hh-pano .pnlm-load-box, .hh-pano .pnlm-about-msg, .hh-pano .pnlm-controls-container { display: none !important; }
.hh-pano .pnlm-container * { box-sizing: border-box; }
.loading {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: rgba(27,38,43,.9); color: var(--white); font-size: 15px; font-weight: 700; padding: 12px 18px; border-radius: 999px; pointer-events: none;
}
.loading[hidden] { display: none; }

/* Markers: Pannellum hot spots, so they stay fixed to the scene */
.pnlm-hotspot-base.hh-marker {
  width: 34px; height: 34px; margin: 0; border-radius: 50%;
  background: var(--white); color: var(--dark); border: 3px solid var(--dark);
  box-shadow: 0 2px 8px rgba(0,0,0,.45), 0 0 0 2px rgba(255,255,255,.35);
  font: 800 15px/28px var(--font); text-align: center; pointer-events: none;
}
.pnlm-hotspot-base.hh-marker::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px;
  border-radius: 50%; background: var(--red); opacity: 0; 
}
.pnlm-hotspot-base.hh-marker.result { width: 26px; height: 26px; font-size: 12px; line-height: 20px; border-width: 2px; }

/* Box outlines on the results viewer */
.hh-outlines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; overflow: visible; }
.hh-box { fill: none; stroke-width: 3; stroke-linejoin: round; }
.hh-box.found { stroke: var(--green); fill: rgba(29,168,98,.14); }
.hh-box.missed { stroke: var(--red); fill: rgba(255,40,1,.14); }
.hh-box.edit { stroke: var(--amber); fill: rgba(255,180,0,.14); stroke-width: 2; }
.hh-box.edit.selected { stroke: var(--white); stroke-width: 3; fill: rgba(255,255,255,.12); }

/* HUD */
.hud { position: absolute; left: 12px; right: 12px; top: calc(12px + var(--safe-top)); display: flex; gap: 8px; align-items: center; pointer-events: none; z-index: 5; }
.pill {
  background: rgba(27,38,43,.9); color: var(--white); font-size: 15px; font-weight: 700; padding: 9px 13px; border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0,0,0,.3); white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; font-variant-numeric: tabular-nums;
}
.pill.timer { min-width: 76px; justify-content: center; }
.pill.timer i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid rgba(255,255,255,.9); display: inline-block; }
.pill.timer.urgent { background: var(--red); animation: pulse 1s ease-in-out infinite; }
.pill.markers { flex: 1; justify-content: center; }
.pill.markers.flash { animation: bump .4s ease-out; }
.compass { width: 56px; height: 56px; flex: 0 0 56px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.5)); }
.compass .sector { fill: rgba(255,255,255,.22); }
.compass .sector.seen { fill: var(--white); }
.compass .wedge { fill: var(--red); opacity: .95; }
.compass .dot { fill: var(--white); }
@keyframes pulse { 50% { transform: scale(1.04); } }
@keyframes bump { 30% { transform: scale(1.1); background: var(--red); } }

.hint {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: rgba(27,38,43,.94); color: var(--white); font-size: 18px; line-height: 1.4; font-weight: 700; text-align: center;
  padding: 18px 22px; border-radius: 18px; max-width: 320px; width: calc(100% - 48px);
  box-shadow: 0 8px 30px rgba(0,0,0,.45); opacity: 0; pointer-events: none; transition: opacity .3s; z-index: 6;
}
.hint.show { opacity: 1; }
.play-bottom {
  position: absolute; left: 12px; right: 12px; bottom: calc(14px + var(--safe-bottom));
  display: flex; gap: 8px; align-items: center; justify-content: flex-end; z-index: 5;
}
.btn.finish { width: auto; min-width: 128px; min-height: 50px; border-radius: 999px; box-shadow: 0 4px 14px rgba(0,0,0,.4); }
.btn.pill-btn {
  width: auto; min-height: 44px; font-size: 13px; border-radius: 999px; background: rgba(27,38,43,.9); color: var(--white);
  box-shadow: 0 2px 8px rgba(0,0,0,.3); margin-right: auto; padding: 0 14px;
}
.btn.pill-btn.on { background: var(--green); }
.btn.pill-btn[hidden] { display: none; }

/* ---------- 3. Details ---------- */
.details-head h2 { margin: 6px 0 0; font-size: 30px; }
#details-form { display: flex; flex-direction: column; gap: 14px; margin-top: 22px; }
.field { display: block; text-align: left; }
.field span { display: block; font-size: 13px; font-weight: 700; margin: 0 0 6px 2px; color: var(--dark); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 50px; border-radius: 12px; border: 2px solid var(--line); padding: 0 14px;
  font-size: 17px; font-weight: 600; color: var(--dark); background: var(--white); outline: none; appearance: none; -webkit-appearance: none;
}
.field textarea { padding: 12px 14px; min-height: 84px; resize: vertical; }
.field select { background-image: linear-gradient(45deg, transparent 50%, var(--grey) 50%), linear-gradient(135deg, var(--grey) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--red); }
.field input.invalid, .field select.invalid { border-color: var(--red); background: #FFF4F1; }
.field.compact input, .field.compact select { min-height: 42px; font-size: 15px; }
.consent { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.45; color: #3B474D; margin-top: 4px; }
.consent input { width: 22px; height: 22px; flex: 0 0 22px; margin: 1px 0 0; accent-color: var(--red); }
.privacy { margin: 0; font-size: 13px; }
.privacy a { color: var(--grey); }
.turnstile { min-height: 65px; }
.turnstile[hidden] { display: none; }
.form-error { margin: 0; font-size: 14px; font-weight: 700; color: var(--red-dark); }
.form-error[hidden] { display: none; }

/* ---------- 4. Results ---------- */
.topbar { display: flex; align-items: center; gap: 14px; padding: calc(12px + var(--safe-top)) 20px 12px; background: var(--dark); color: var(--white); }
.topbar .brand { font-size: 18px; }
.topbar-title { font-weight: 700; color: rgba(255,255,255,.8); }
.results-head { background: var(--dark); color: var(--white); padding: calc(26px + var(--safe-top)) 24px 24px; }
.results-head .label { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.75); }
.results-head .big { margin-top: 4px; font-size: 54px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.results-head .of { font-size: 22px; font-weight: 600; color: rgba(255,255,255,.7); letter-spacing: 0; }
.results-head .headline { margin-top: 10px; font-size: 20px; font-weight: 700; }
.results-body { padding: 20px 20px calc(30px + var(--safe-bottom)); }
.section-title { margin: 0 0 12px; font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--red); }
section + section { margin-top: 30px; }
.card { background: var(--light); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 12px; }
.card-top { display: flex; gap: 12px; align-items: flex-start; }
.card .rank { flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%; background: var(--red); color: var(--white); font-weight: 800; display: grid; place-items: center; font-size: 15px; }
.card h3 { margin: 3px 0 0; font-size: 18px; line-height: 1.25; }
.card .missed { margin: 4px 0 0; font-size: 14px; color: var(--red-dark); font-weight: 700; }
.card dl { margin: 14px 0 0; }
.card dt { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--grey); margin-top: 10px; }
.card dd { margin: 3px 0 0; font-size: 15px; line-height: 1.45; color: #2B363B; }
.course-link { color: var(--red-dark); font-weight: 700; }
.card.strong p { margin: 8px 0 0; font-size: 15px; line-height: 1.45; }

.scene-sticky { position: sticky; top: 0; z-index: 4; background: var(--white); padding-bottom: 8px; }
.results-pano { position: relative; height: 280px; border-radius: 14px; overflow: hidden; background: #0f1416; }
.results-viewer { position: absolute; inset: 0; }
.legend { position: absolute; left: 10px; bottom: 10px; background: rgba(27,38,43,.9); color: var(--white); font-size: 12px; font-weight: 700; padding: 6px 10px; border-radius: 999px; display: flex; gap: 6px; align-items: center; pointer-events: none; z-index: 4; }
.legend .key { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legend .key.found { background: var(--green); }
.legend .key.missed { background: var(--red); margin-left: 6px; }
.leads { margin-top: 10px; background: var(--dark); color: var(--white); border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.45; }
.leads[hidden] { display: none; }
.leads strong { display: block; margin-bottom: 3px; }
.hazard-groups { margin-top: 18px; }
.group h3 { margin: 16px 0 6px; font-size: 15px; color: var(--grey); }
.hazard-list { list-style: none; margin: 0; padding: 0; }
.hazard-btn {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 10px; border: 0; background: transparent;
  border-bottom: 1px solid var(--line); font: 600 15px/1.3 var(--font); color: var(--dark); text-align: left; cursor: pointer; border-radius: 8px;
}
.hazard-btn.active { background: var(--light); }
.hazard-btn .mark { flex: 0 0 26px; width: 26px; height: 26px; border-radius: 50%; color: var(--white); font-weight: 800; display: grid; place-items: center; font-size: 14px; }
li.found .mark { background: var(--green); }
li.missed .mark { background: var(--red); }
.options { display: flex; flex-direction: column; gap: 10px; }
.options .section-title { margin-bottom: 2px; }
.play-again { display: block; text-align: center; margin-top: 8px; color: var(--grey); font-weight: 700; font-size: 15px; }
.fine.emailed { color: var(--green); font-weight: 700; }
.fine.emailed.warn { color: var(--red-dark); }
.notfound { text-align: center; margin: 60px 20px 20px; }
.loading-text { text-align: center; margin: 60px 20px; }
#results-root > .btn { max-width: 320px; margin: 20px auto; }

/* Toast, overlay and sheet */
.toast {
  position: fixed; left: 50%; bottom: calc(28px + var(--safe-bottom)); transform: translate(-50%, 20px);
  background: var(--dark); color: var(--white); font-size: 14px; font-weight: 700; padding: 11px 16px; border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0,0,0,.35); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 50; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.overlay { position: fixed; inset: 0; background: rgba(27,38,43,.6); display: flex; align-items: flex-end; justify-content: center; z-index: 40; }
.sheet {
  background: var(--white); width: 100%; max-width: 560px; max-height: 92%; overflow-y: auto; overscroll-behavior: contain;
  border-radius: 20px 20px 0 0; padding: 22px 20px calc(20px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 12px;
}
.sheet h2 { margin: 0; font-size: 22px; }
.sheet .lead { margin: -4px 0 4px; }
.copy-text { width: 100%; font: 15px/1.4 var(--font); border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; resize: none; }

/* ---------- Laptop ---------- */
@media (min-width: 760px) {
  .start-inner { max-width: 640px; }
  .scene-picker { flex-direction: row; max-width: 640px; }
  .scene-btn { flex: 1; justify-content: center; text-align: center; }
  h1 { font-size: 60px; }
  .tagline { font-size: 21px; }
  .results-pano { height: 420px; }
  .results-head { padding: 34px 32px 30px; border-radius: 0 0 24px 24px; }
  .results-body { padding: 26px 32px 40px; }
  .column.wide { max-width: 860px; }
  .options { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
  .options .section-title, .options .play-again { grid-column: 1 / -1; }
  .overlay { align-items: center; }
  .sheet { border-radius: 20px; }
  .hint { font-size: 20px; max-width: 420px; }
  .pill.markers { flex: 0 0 auto; min-width: 200px; }
  .compass { margin-left: auto; }
  .play-bottom { left: auto; right: 16px; bottom: 16px; }
  .btn.pill-btn { margin-right: 8px; }
}
