/* ============================================================
   BEFORE THE SHIFT - pre-dawn industrial HUD
   Local font stacks only (dependable fonts, no CDN).
   ============================================================ */

:root {
  --ink:        #131820;
  --panel:      #1c242e;
  --panel-2:    #242e3a;
  --panel-3:    #2d3945;
  --line:       #3a4756;
  --line-soft:  #2e3a47;
  --text:       #eef3f8;
  --text-dim:   #a9b7c4;
  --text-faint: #7b8894;
  --amber:      #ffb020;
  --amber-deep: #e08900;
  --amber-dim:  rgba(255,176,32,.14);
  --green:      #3fbf7f;
  --green-dim:  rgba(63,191,127,.14);
  --red:        #ff5d49;
  --red-dim:    rgba(255,93,73,.13);
  --cyan:       #58c7e0;
  --cyan-dim:   rgba(88,199,224,.12);
  --display: 'Haettenschweiler', 'Impact', 'Arial Narrow', 'Franklin Gothic Medium', sans-serif;
  --body: 'Avenir Next', 'Avenir', 'Trebuchet MS', 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Menlo', 'Consolas', monospace;
  --stripe: repeating-linear-gradient(-45deg, var(--amber) 0 14px, #14171b 14px 28px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; overflow: hidden; }

body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body::after { /* grain */
  content: ''; position: fixed; inset: 0; pointer-events: none; opacity: .05; z-index: 999;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}

.app { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

.hidden { display: none !important; }

h1, h2, h3, .display {
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: .04em;
  text-transform: uppercase;
}

button { font-family: inherit; color: inherit; cursor: pointer; background: none; border: none; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* ---------- shared chrome ---------- */

.hazstripe { height: 8px; background: var(--stripe); flex: none; }

.topbar {
  flex: none; display: flex; align-items: center; gap: 18px;
  padding: 10px 22px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.topbar .brand { font-family: var(--display); font-size: 22px; letter-spacing: .08em; text-transform: uppercase; }
.topbar .brand em { color: var(--amber); font-style: normal; }
.topbar .spacer { flex: 1; }

.chip {
  font-family: var(--mono); font-size: 13px; letter-spacing: .04em;
  padding: 4px 12px; border: 1px solid var(--line); border-radius: 4px; color: var(--text-dim);
  display: inline-flex; align-items: center; gap: 8px;
}
.chip.amber  { color: var(--amber); border-color: rgba(255,176,32,.4); background: var(--amber-dim); }
.chip.green  { color: var(--green); border-color: rgba(63,191,127,.4); background: var(--green-dim); }
.chip.red    { color: var(--red);   border-color: rgba(255,93,73,.4);  background: var(--red-dim); }
.chip.cyan   { color: var(--cyan);  border-color: rgba(88,199,224,.4); background: var(--cyan-dim); }

.timer { font-family: var(--mono); font-size: 20px; font-weight: 700; letter-spacing: .06em; }
.timer.low { color: var(--red); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .45; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 26px; border-radius: 6px; font-size: 16px; font-weight: 600;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--panel-3); border-color: var(--amber-deep); transform: translateY(-1px); }
.btn.primary { background: var(--amber); border-color: var(--amber); color: #14161a; }
.btn.primary:hover { background: #ffc14d; }
.btn.ghost { background: transparent; }
.btn.danger { border-color: rgba(255,93,73,.5); color: var(--red); }
.btn.big { font-size: 19px; padding: 16px 34px; }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.kbd {
  font-family: var(--mono); font-size: 12px; border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 4px; padding: 1px 7px; color: var(--text-dim); background: var(--panel);
}

/* ---------- toasts / keybar ---------- */

.toasts { position: fixed; top: 74px; right: 22px; z-index: 300; display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.toast {
  background: var(--panel-2); border: 1px solid var(--line); border-left: 4px solid var(--amber);
  padding: 12px 16px; border-radius: 6px; font-size: 15px; box-shadow: 0 8px 30px rgba(0,0,0,.5);
  animation: slidein .25s ease;
}
.toast.green { border-left-color: var(--green); }
.toast.red { border-left-color: var(--red); }
.toast.verify, .toast.radio {
  background: #46391f;
  border-color: rgba(255,176,32,.55);
  border-left-color: var(--amber);
  color: #ffedc9;
  font-weight: 600;
  box-shadow: 0 8px 30px rgba(0,0,0,.5), 0 0 20px rgba(255,176,32,.22);
}
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }

.keybar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 90;
  display: flex; gap: 26px; justify-content: center; padding: 8px 20px;
  background: rgba(13,16,19,.92); border-top: 1px solid var(--line-soft);
  font-size: 14px; color: var(--text-dim);
}
.keybar span { display: inline-flex; gap: 8px; align-items: center; }

/* ---------- overlay / modal ---------- */

.overlay {
  position: fixed; inset: 0; z-index: 200; background: rgba(8,10,13,.78);
  display: flex; align-items: center; justify-content: center; padding: 30px;
  backdrop-filter: blur(3px);
}
.modal {
  width: min(880px, 94vw); max-height: 88vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6); animation: modalin .22s ease;
}
@keyframes modalin { from { transform: translateY(16px) scale(.985); opacity: 0; } }
.modal-head {
  padding: 20px 28px 14px; border-bottom: 1px solid var(--line-soft);
  display: flex; flex-wrap: wrap; align-items: center; column-gap: 14px; row-gap: 5px;
  position: sticky; top: 0; background: var(--panel); z-index: 2;
}
/* the tag is an eyebrow on its own line; avatar, title and close share the row below */
.modal-head .step-tag { flex-basis: 100%; }
.modal-head h3 { font-size: 26px; flex: 1; min-width: 0; }
.modal-body { padding: 22px 28px 28px; }
.modal .step-tag { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; color: var(--amber); text-transform: uppercase; }

.desc-block {
  background: var(--panel-2); border: 1px solid var(--line-soft); border-left: 4px solid var(--amber);
  border-radius: 6px; padding: 16px 20px; margin-bottom: 20px; font-size: 16.5px;
}
.desc-block.speech { border-left-color: var(--cyan); font-style: italic; }
.desc-block.finding { border-left-color: var(--green); }
.desc-block.verify-note { background: rgba(255,176,32,.24); border-color: var(--amber); color: #ffedc9; font-weight: 600; }
.desc-block.warn { border-left-color: var(--red); }

.options { display: flex; flex-direction: column; gap: 10px; }
.opt {
  display: grid; grid-template-columns: 26px 1fr; column-gap: 14px; row-gap: 2px;
  align-items: start; text-align: left;
  padding: 14px 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2);
  font-size: 16px; line-height: 1.45; transition: border-color .15s, background .15s, transform .1s;
}
.opt:hover { border-color: var(--amber-deep); background: var(--panel-3); transform: translateX(3px); }
.opt .num {
  grid-column: 1; grid-row: 1; font-family: var(--mono); font-size: 13px; font-weight: 700;
  width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 5px; color: var(--amber); margin-top: 1px;
}
/* label and micro copy stack in the text column, never side by side */
.opt .sub { grid-column: 2; display: block; color: var(--text-dim); font-size: 14px; }
.opt.picked-best { border-color: var(--green); background: var(--green-dim); }
.opt.picked-partial { border-color: var(--amber); background: var(--amber-dim); }
.opt.picked-poor { border-color: var(--red); background: var(--red-dim); }
.opt:disabled { opacity: .55; transform: none; cursor: default; }
.opt:disabled:hover { border-color: var(--line); background: var(--panel-2); }

.wrap-left { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.wrap-left li {
  background: var(--panel-2); border: 1px solid var(--line-soft); border-left: 3px solid var(--amber);
  border-radius: 6px; padding: 10px 14px; font-size: 15px;
}

.feedback {
  margin-top: 16px; padding: 14px 18px; border-radius: 6px; font-size: 15.5px;
  border: 1px solid var(--line);
}
.feedback.best { border-color: rgba(63,191,127,.5); background: var(--green-dim); }
.feedback.partial { border-color: rgba(255,176,32,.5); background: var(--amber-dim); }
.feedback.poor { border-color: rgba(255,93,73,.5); background: var(--red-dim); }
.feedback .tag { font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; display: block; margin-bottom: 4px; }
.feedback.best .tag { color: var(--green); } .feedback.partial .tag { color: var(--amber); } .feedback.poor .tag { color: var(--red); }

.modal-foot { display: flex; justify-content: flex-end; gap: 12px; margin-top: 22px; }

/* risk classifier */
.risk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-bottom: 6px; }
.risk-col h4 { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 10px; }
.risk-col .opt { padding: 10px 16px; }

/* ---------- HOME ---------- */

.home { flex: 1; display: flex; overflow: hidden; }
.home-left {
  flex: 1.15; padding: 54px 60px; display: flex; flex-direction: column; justify-content: center;
  position: relative; overflow: hidden;
  background:
    radial-gradient(1000px 500px at 85% -10%, rgba(255,176,32,.09), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(88,199,224,.05), transparent 60%),
    var(--ink);
}
.home-left::before {
  content: ''; position: absolute; inset: 0; opacity: .35; pointer-events: none;
  background-image: linear-gradient(var(--line-soft) 1px, transparent 1px), linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(700px 520px at 30% 40%, #000, transparent 75%);
  -webkit-mask-image: radial-gradient(700px 520px at 30% 40%, #000, transparent 75%);
}
.home-kicker { font-family: var(--mono); letter-spacing: .28em; font-size: 13px; color: var(--amber); text-transform: uppercase; margin-bottom: 18px; animation: rise .6s ease both; }
.home-title {
  font-size: clamp(64px, 8.4vw, 118px); line-height: .92; margin-bottom: 8px; animation: rise .6s .08s ease both;
}
.home-title .row2 { color: var(--amber); display: block; }
.home-sub { font-size: 19px; color: var(--text-dim); max-width: 560px; margin: 22px 0 8px; animation: rise .6s .16s ease both; }
.home-sub strong { color: var(--text); }
.home-role { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; animation: rise .6s .22s ease both; }
@keyframes rise { from { transform: translateY(18px); opacity: 0; } }

.home-right {
  flex: 1; border-left: 1px solid var(--line); background: var(--panel);
  padding: 48px 52px; display: flex; flex-direction: column; justify-content: center; gap: 16px; overflow-y: auto;
}
.home-right h2 { font-size: 20px; color: var(--text-dim); letter-spacing: .1em; }

.mode-btn {
  display: flex; flex-direction: column; gap: 6px; text-align: left;
  border: 1px solid var(--line); border-radius: 8px; padding: 20px 24px; background: var(--panel-2);
  transition: border-color .15s, background .15s, transform .12s;
  animation: rise .5s ease both;
}
.mode-btn:hover { border-color: var(--amber); background: var(--panel-3); transform: translateY(-2px); }
.mode-btn .mode-name { font-family: var(--display); font-size: 27px; letter-spacing: .05em; text-transform: uppercase; display: flex; align-items: center; gap: 12px; }
.mode-btn .mode-name .kbd { margin-left: auto; }
.mode-btn .mode-desc { color: var(--text-dim); font-size: 15.5px; }
.mode-btn.challenge .mode-name { color: var(--amber); }
.mode-btn.resume { border-left: 4px solid var(--green); }
.mode-btn.resume .mode-name { color: var(--green); font-size: 22px; }
.mode-btn.resume .mode-name .ic svg { width: 20px; height: 20px; display: block; }

.home-foot { margin-top: 12px; display: flex; gap: 10px; flex-wrap: wrap; }
.attempt-note { font-family: var(--mono); font-size: 13px; color: var(--text-faint); margin-top: 6px; }
.attempt-note b { color: var(--amber); }

/* onboarding */
.onboard-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 18px 0 8px; }
.ob-step { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.ob-step .n { font-family: var(--display); font-size: 34px; color: var(--amber); }
.ob-step h4 { font-family: var(--display); font-size: 19px; letter-spacing: .05em; text-transform: uppercase; margin: 4px 0 6px; }
.ob-step p { font-size: 14px; color: var(--text-dim); }

/* ---------- MAP ---------- */

.mapwrap { flex: 1; display: flex; overflow: hidden; }
.mapmain { flex: 1.6; padding: 26px 34px; display: flex; flex-direction: column; overflow: hidden; }
.map-conditions { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.sitemap { flex: 1; position: relative; min-height: 0; }
.sitemap svg { width: 100%; height: 100%; }
.map-area { cursor: pointer; }
.map-area .bldg { fill: var(--panel-2); stroke: var(--line); stroke-width: 2; transition: fill .15s, stroke .15s; }
.map-area:hover .bldg { fill: var(--panel-3); stroke: var(--amber-deep); }
.map-area.done .bldg { stroke: var(--green); }
.map-area.done .area-stat { fill: var(--green); }
.map-area.locked .bldg { stroke: var(--red); }
.map-area text { fill: var(--text); font-family: var(--display); letter-spacing: .06em; text-transform: uppercase; }
.map-area .area-tag { fill: var(--text-dim); font-family: var(--body); font-size: 12.5px; text-transform: none; letter-spacing: 0; }
.map-area .area-stat { fill: var(--amber); font-family: var(--mono); font-size: 12px; }
.map-area .area-stat.done { fill: var(--green); }
.map-area .stat-check { fill: none; stroke: var(--green); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }

.mapside {
  flex: 1; border-left: 1px solid var(--line); background: var(--panel);
  padding: 24px 28px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px;
}
.mapside h3 { font-size: 19px; color: var(--text-dim); letter-spacing: .1em; }

.area-card { border: 1px solid var(--line); border-radius: 8px; padding: 14px 18px; background: var(--panel-2); display: flex; align-items: center; gap: 16px; }
.area-card .ring { flex: none; }
.area-card .ac-name { font-family: var(--display); font-size: 19px; letter-spacing: .05em; text-transform: uppercase; }
/* the tagline appears on the card only where the site plan is hidden (phones) */
.area-card .ac-tag { display: none; font-size: 14.5px; color: var(--text-dim); margin: 2px 0 5px; line-height: 1.4; }
.area-card .ac-sub { font-size: 14px; color: var(--text-dim); font-family: var(--mono); }
.area-card .ac-sub.done { color: var(--green); }
.ring { width: 52px; height: 52px; transform: rotate(-90deg); }
.ring .bg { fill: none; stroke: var(--line); stroke-width: 5; }
.ring .fg { fill: none; stroke: var(--amber); stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset .4s; }
.ring.full .fg { stroke: var(--green); }
.ring .ring-check { fill: none; stroke: var(--green); stroke-width: 4.6; stroke-linecap: round; stroke-linejoin: round; }
.ring.full text { fill: var(--green); font-size: 20px; }
.ring text { transform: rotate(90deg); transform-origin: center; fill: var(--text); font-family: var(--mono); font-size: 13px; font-weight: 700; }

.shiftlog { border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.shiftlog h4 { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--amber); padding: 12px 16px 8px; }
.shiftlog ul { list-style: none; max-height: 200px; overflow-y: auto; padding: 0 16px 12px; }
.shiftlog li { font-size: 14px; color: var(--text-dim); padding: 6px 0; border-top: 1px solid var(--line-soft); }
.shiftlog li b { color: var(--text); font-weight: 600; }
.shiftlog .empty { color: var(--text-faint); font-style: italic; }

/* ---------- AREA ---------- */

.areawrap { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.taskstrip {
  flex: none; display: flex; align-items: center; gap: 0; padding: 10px 26px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.taskstep { display: flex; align-items: center; gap: 10px; padding: 6px 18px; color: var(--text-faint); font-size: 15px; font-weight: 600; }
.taskstep .tn {
  font-family: var(--mono); font-size: 12px; width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--line); display: flex; align-items: center; justify-content: center;
}
.taskstep.active { color: var(--amber); }
.taskstep.active .tn { border-color: var(--amber); background: var(--amber-dim); color: var(--amber); }
.taskstep.done { color: var(--green); }
.taskstep.done .tn { border-color: var(--green); color: var(--green); }
.taskstep .tn .ic { width: 15px; height: 15px; }
.taskarrow { color: var(--text-faint); font-size: 15px; }
.taskstrip .spacer { flex: 1; }

.areabody { flex: 1; display: flex; overflow: hidden; min-height: 0; }
.scenewrap { flex: 1.7; position: relative; min-width: 0; background: #1b222c; overflow: hidden; }
.scenewrap > svg.scene { position: absolute; inset: 0; width: 100%; height: 100%; }
.scenewrap .scene-note {
  position: absolute; left: 18px; bottom: 14px; font-family: var(--mono); font-size: 14px;
  color: var(--text-dim); background: rgba(13,16,19,.8); padding: 6px 12px; border-radius: 5px; border: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: 10px;
}
.scene-note .note-x {
  flex: none; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 4px; color: var(--text-dim);
}
.scene-note .note-x svg { width: 13px; height: 13px; }
.scene-note .note-x:hover { color: var(--text); border-color: var(--amber-deep); }

.hotspot {
  position: absolute; width: 40px; height: 56px;
  transform: translate(-50%, -100%); z-index: 5;
}
.hotspot .pulse {
  position: absolute; top: 2px; left: 50%; margin-left: -17px;
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--amber); animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(1.8); opacity: 0; } }
.hotspot .core {
  position: absolute; top: 2px; left: 50%; transform: translateX(-50%);
  width: 34px; height: 34px; border-radius: 50%; background: var(--amber); opacity: .92;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 13px; font-weight: 700; color: #14161a;
  box-shadow: 0 2px 10px rgba(0,0,0,.45);
  transition: transform .12s ease, opacity .12s ease;
}
.hotspot .core .ic { width: 19px; height: 19px; }
.hotspot .stem {
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 0; height: 0; border: 6px solid transparent; border-top: 16px solid var(--amber); opacity: .88;
}
.hotspot:hover .core { transform: translateX(-50%) scale(1.14); opacity: 1; }
.hotspot.held .core { background: #ffd166; }
.hotspot.held .stem { border-top-color: #ffd166; }
.hotspot.done .pulse { display: none; }
.hotspot.done .core { background: var(--green); color: #fff; opacity: .95; }
.hotspot.done .stem { border-top-color: var(--green); opacity: .95; }
.hotspot:disabled { opacity: .45; cursor: default; }

.areaside {
  flex: 1; min-width: 380px; max-width: 520px; border-left: 1px solid var(--line); background: var(--panel);
  display: flex; flex-direction: column; overflow: hidden;
}
.side-tabs { flex: none; display: flex; border-bottom: 1px solid var(--line); }
.side-tab {
  flex: 1; padding: 12px 6px; font-family: var(--display); font-size: 17px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-faint); border-bottom: 3px solid transparent;
}
.side-tab:hover { color: var(--text-dim); }
.side-tab.active { color: var(--amber); border-bottom-color: var(--amber); }
.side-tab .cnt { font-family: var(--mono); font-size: 11px; color: var(--text-dim); margin-left: 5px; }
.side-tab .dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--amber); margin-left: 6px; vertical-align: 1px;
}
.side-tab .cnt.attn {
  color: #131820; background: var(--amber); font-weight: 700;
  border-radius: 9px; padding: 1px 7px;
  animation: attnPulse 1.6s ease-in-out infinite;
}
@keyframes attnPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,176,32,.55); }
  50%      { box-shadow: 0 0 0 6px rgba(255,176,32,0); }
}
.side-panel { flex: 1; overflow-y: auto; padding: 18px 20px 80px; }

.sp-item {
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2);
  padding: 14px 16px; margin-bottom: 12px;
}
.sp-item h4 { font-size: 16px; font-weight: 700; margin-bottom: 3px; }
.sp-item .meta { font-family: var(--mono); font-size: 14px; color: var(--text-dim); margin-bottom: 8px; }
.sp-item p { font-size: 14.5px; color: var(--text-dim); }
.sp-item .row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
/* the do-something-now control is a real button, never a pill */
.sp-item .sp-act { margin-left: auto; padding: 8px 16px; font-size: 14.5px; }
.sp-item.clickable { cursor: pointer; transition: border-color .15s; }
.sp-item.clickable:hover { border-color: var(--amber-deep); }

.status-pill {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 10px; border-radius: 20px; border: 1px solid var(--line); color: var(--text-dim);
}
.status-pill.open { color: var(--amber); border-color: rgba(255,176,32,.45); background: var(--amber-dim); }
.status-pill.await { color: var(--cyan); border-color: rgba(88,199,224,.45); background: var(--cyan-dim); }
.status-pill.released { color: var(--green); border-color: rgba(63,191,127,.45); background: var(--green-dim); }
.status-pill.held { color: var(--red); border-color: rgba(255,93,73,.45); background: var(--red-dim); }

.sp-note { font-size: 13.5px; color: var(--text-faint); font-style: italic; margin: 4px 0 14px; }

/* notes */
.notebox textarea {
  width: 100%; min-height: 90px; background: var(--panel-3); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px; padding: 12px; font-family: var(--body); font-size: 15px; resize: vertical;
}
.note-entry { border-top: 1px solid var(--line-soft); padding: 10px 2px; font-size: 14.5px; }
.note-entry .nt { font-family: var(--mono); font-size: 11px; color: var(--amber); text-transform: uppercase; letter-spacing: .08em; }

/* ---------- FINAL ---------- */

.finalwrap { flex: 1; overflow-y: auto; padding: 40px 60px; }
.finalwrap .inner { max-width: 1060px; margin: 0 auto; }
.final-title { font-size: 52px; margin-bottom: 6px; }
.final-sub { color: var(--text-dim); font-size: 18px; margin-bottom: 30px; max-width: 760px; }

.final-area {
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
  padding: 22px 26px; margin-bottom: 20px;
}
.final-area .fa-head { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.final-area h3 { font-size: 25px; }
.final-area .fa-stats { font-family: var(--mono); font-size: 13px; color: var(--text-dim); display: flex; gap: 16px; flex-wrap: wrap; }
.final-area .fa-notes { margin: 10px 0 14px; }
.final-area .fa-notes label {
  display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; color: var(--text-dim);
  padding: 7px 10px; border: 1px solid var(--line-soft); border-radius: 6px; margin-bottom: 6px; cursor: pointer;
}
.final-area .fa-notes label:hover { border-color: var(--amber-deep); }
.final-area .fa-notes input { accent-color: var(--amber); margin-top: 3px; }
.final-decide { display: flex; gap: 10px; flex-wrap: wrap; }
.fd-btn { padding: 12px 22px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel-2); font-weight: 700; font-size: 15.5px; }
.fd-btn:hover { border-color: var(--amber); }
.fd-btn.sel-release { background: var(--green-dim); border-color: var(--green); color: var(--green); }
.fd-btn.sel-restrict { background: var(--amber-dim); border-color: var(--amber); color: var(--amber); }
.fd-btn.sel-hold { background: var(--red-dim); border-color: var(--red); color: var(--red); }

/* ---------- OUTCOME ---------- */

.outwrap { flex: 1; overflow-y: auto; padding: 40px 60px; }
.outwrap .inner { max-width: 1060px; margin: 0 auto; }
.grade-row { display: flex; gap: 34px; align-items: center; margin-bottom: 30px; flex-wrap: wrap; }
.grade-badge {
  width: 130px; height: 130px; border-radius: 14px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-size: 84px; color: #14161a; background: var(--amber);
  box-shadow: 0 12px 40px rgba(255,176,32,.25);
}
.grade-badge.gA { background: var(--green); box-shadow: 0 12px 40px rgba(63,191,127,.25); }
.grade-badge.gD { background: var(--red); box-shadow: 0 12px 40px rgba(255,93,73,.25); }
.grade-text h2 { font-size: 44px; }
.grade-text p { color: var(--text-dim); font-size: 17px; max-width: 640px; }

.event-card {
  border: 1px solid var(--line); border-left: 5px solid var(--red); border-radius: 8px;
  background: var(--panel); padding: 18px 24px; margin-bottom: 14px;
}
.event-card.good { border-left-color: var(--green); }
.event-card h4 { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 6px; color: var(--red); }
.event-card.good h4 { color: var(--green); }
.event-card p { font-size: 16px; }

.dims { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 26px 0; }
.dim-card { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 16px 20px; }
.dim-card h4 { font-family: var(--display); font-size: 19px; letter-spacing: .05em; text-transform: uppercase; display: flex; justify-content: space-between; align-items: baseline; }
.dim-card h4 .pct { font-family: var(--mono); font-size: 14px; color: var(--amber); }
.dim-card .bar { height: 8px; background: var(--panel-3); border-radius: 4px; margin: 10px 0 8px; overflow: hidden; }
.dim-card .bar i { display: block; height: 100%; background: var(--amber); border-radius: 4px; transition: width .8s ease; }
.dim-card .bar i.hi { background: var(--green); } .dim-card .bar i.lo { background: var(--red); }
.dim-card p { font-size: 13.5px; color: var(--text-dim); }

.moments { margin: 8px 0 26px; }
.moment { display: flex; gap: 12px; padding: 10px 4px; border-top: 1px solid var(--line-soft); font-size: 15px; color: var(--text-dim); }
.moment .m-ic { flex: none; width: 20px; display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.moment .m-ic .ic { width: 16px; height: 16px; }
.moment.good .m-ic { color: var(--green); } .moment.bad .m-ic { color: var(--red); }

/* ---------- misc ---------- */

.scroll-thin::-webkit-scrollbar, .side-panel::-webkit-scrollbar, .modal::-webkit-scrollbar, .mapside::-webkit-scrollbar,
.finalwrap::-webkit-scrollbar, .outwrap::-webkit-scrollbar, .shiftlog ul::-webkit-scrollbar { width: 8px; }
.side-panel::-webkit-scrollbar-thumb, .modal::-webkit-scrollbar-thumb, .mapside::-webkit-scrollbar-thumb,
.finalwrap::-webkit-scrollbar-thumb, .outwrap::-webkit-scrollbar-thumb, .shiftlog ul::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

@media (max-width: 1100px) {
  .home { flex-direction: column; overflow-y: auto; }
  .home-left { padding: 40px; }
  .onboard-steps { grid-template-columns: repeat(2, 1fr); }
  .dims { grid-template-columns: repeat(2, 1fr); }
  .areaside { min-width: 320px; }
}

/* ---------- avatars & modal close ---------- */

.avatar {
  width: 46px; height: 46px; border-radius: 50%; overflow: hidden; flex: none;
  border: 2px solid var(--line); background: var(--panel-3);
}
.avatar svg { display: block; width: 100%; height: 100%; }
.modal-head .avatar { width: 42px; height: 42px; align-self: center; }
.worker-item { display: flex; gap: 14px; align-items: center; }

.modal-x {
  margin-left: auto; align-self: center; flex: none;
  width: 34px; height: 34px; border-radius: 6px;
  border: 1px solid var(--line); color: var(--text-dim); font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.modal-x:hover { color: var(--text); border-color: var(--amber-deep); }

/* ---------- live charging cables ---------- */
@keyframes cableflow  { to { stroke-dashoffset: -42; } }
@keyframes cableflow2 { to { stroke-dashoffset: -38; } }
.cable-live  { animation: cableflow  1.1s linear infinite; }
.cable-live2 { animation: cableflow2 1.4s linear infinite; }
@media (prefers-reduced-motion: reduce) { .cable-live, .cable-live2 { animation: none; } }

/* ---------- info / shortcuts ---------- */
.icon-btn {
  padding: 8px 12px; font-size: 19px; line-height: 1;
  border-radius: 8px; color: var(--text-dim);
}
.icon-btn:hover { color: var(--amber); }
.shortcut-grid {
  display: grid; grid-template-columns: auto 1fr; gap: 12px 20px; align-items: center;
  margin-bottom: 4px;
}
.shortcut-grid > div:nth-child(odd) { white-space: nowrap; }
.shortcut-grid > div:nth-child(even) { color: var(--text-dim); font-size: 15.5px; }

/* ---------- language picker ---------- */
.lang-picker { display: flex; gap: 8px; margin-bottom: 22px; flex-wrap: wrap; }
.lang-btn {
  padding: 8px 16px; border-radius: 20px; font-size: 14px; font-weight: 600;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text-dim);
  transition: border-color .15s, color .15s, background .15s;
}
.lang-btn:hover { border-color: var(--amber-deep); color: var(--text); }
.lang-btn.on { background: var(--amber); border-color: var(--amber); color: #14161a; }

/* ============================================================
   Language dropdown, audio, and side-panel legibility
   ============================================================ */

.lang-dd { position: relative; }
.lang-dd-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 8px; font-size: 14.5px; font-weight: 600;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
}
.lang-dd-btn:hover { border-color: var(--amber); }
.lang-dd-btn .globe { font-size: 15px; }
.lang-dd-btn .caret { color: var(--text-dim); font-size: 11px; }
.lang-dd-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 120;
  min-width: 170px; padding: 6px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 14px 40px rgba(0,0,0,.55);
}
.lang-dd-item {
  display: block; width: 100%; text-align: left;
  padding: 10px 14px; border-radius: 6px; font-size: 15px; color: var(--text-dim);
}
.lang-dd-item:hover { background: var(--panel-3); color: var(--text); }
.lang-dd-item.on { background: var(--amber); color: #14161a; font-weight: 700; }

/* ---- side panel: lift it off the dark, make signal visible ---- */

.areaside { background: #202a35; }
.side-tabs { background: #1a232c; }
.side-panel { background: #202a35; }

.side-panel .sp-item {
  background: #2a3542;
  border: 1px solid #3d4a59;
  border-left: 4px solid #4b5a6b;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.side-panel .sp-item h4 { color: #f4f8fb; font-size: 16.5px; }
.side-panel .sp-item p { color: #c3d0dc; }
.side-panel .sp-item .meta { color: #9fb0c0; }
.side-panel .sp-note { color: #a9bcca; font-size: 14px; }

/* status drives the accent so importance reads at a glance */
.side-panel .sp-item:has(.status-pill.open)     { border-left-color: var(--amber); background: #33322a; }
.side-panel .sp-item:has(.status-pill.await)    { border-left-color: var(--cyan);  background: #23323a; }
.side-panel .sp-item:has(.status-pill.held)     { border-left-color: var(--red);   background: #33272a; }
.side-panel .sp-item:has(.status-pill.released) { border-left-color: var(--green); background: #24332c; }

.side-panel .sp-item.clickable:hover {
  border-color: var(--amber); background: #33404e; transform: translateX(2px);
}

/* new items pulse once so the player notices them */
@keyframes newItem {
  0%   { box-shadow: 0 0 0 0 rgba(255,176,32,.55); }
  70%  { box-shadow: 0 0 0 12px rgba(255,176,32,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,176,32,0); }
}
.side-panel .sp-item:has(.status-pill.open) { animation: newItem 2s ease-out 2; }

.status-pill { font-weight: 700; }
.status-pill.open     { color: #ffc75a; border-color: rgba(255,176,32,.7); background: rgba(255,176,32,.2); }
.status-pill.await    { color: #7fd8ee; border-color: rgba(88,199,224,.7); background: rgba(88,199,224,.2); }
.status-pill.held     { color: #ff8878; border-color: rgba(255,93,73,.7);  background: rgba(255,93,73,.2); }
.status-pill.released { color: #63d79b; border-color: rgba(63,191,127,.7); background: rgba(63,191,127,.2); }

/* worker + record rows read clearly in any language */
.side-panel .worker-item { background: #2a3542; }
.side-panel .note-entry { color: #cfdae4; border-top-color: #3a4756; }
.side-panel .note-entry .nt { color: #ffc75a; }
.notebox textarea { background: #1a232c; color: #eef3f8; border-color: #46566a; }
.notebox textarea::placeholder { color: #8598a8; }

/* long non-English strings must not clip */
.side-tab { font-size: 15px; letter-spacing: .03em; }


/* ============================================================
   Flat vector icons and volume control
   ============================================================ */

.ic {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; flex: none;
}
.ic svg { width: 100%; height: 100%; display: block; }

.icon-btn { padding: 8px; width: 38px; height: 38px; color: var(--text-dim); }
.icon-btn:hover { color: var(--amber); border-color: var(--amber-deep); }
.icon-btn .ic { width: 20px; height: 20px; }

.btn .ic { margin-right: 2px; }

.modal-x {
  display: flex; align-items: center; justify-content: center;
  padding: 0; width: 34px; height: 34px;
}
.modal-x svg { width: 18px; height: 18px; }

/* sound: icon plus slider, slider reveals on hover or focus */
.snd { display: inline-flex; align-items: center; gap: 0; }
.snd .vol {
  width: 0; opacity: 0; margin-left: 0; padding: 0;
  transition: width .2s ease, opacity .2s ease, margin-left .2s ease;
  -webkit-appearance: none; appearance: none;
  height: 4px; border-radius: 3px; background: var(--line); cursor: pointer;
}
.snd:hover .vol, .snd .vol:focus, .snd .vol:active {
  width: 92px; opacity: 1; margin-left: 10px;
}
.snd .vol::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--amber); border: 2px solid #14161a; cursor: pointer;
}
.snd .vol::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--amber); border: 2px solid #14161a; cursor: pointer;
}

/* language dropdown with vector globe */
.lang-dd-btn .lang-name { line-height: 1; }
.lang-dd-btn .ic { width: 17px; height: 17px; }
.lang-dd-btn .ic:last-child { width: 14px; height: 14px; color: var(--text-faint); }

@media (max-width: 1200px) {
  .snd:hover .vol, .snd .vol:focus { width: 70px; }
  .lang-dd-btn .lang-name { display: none; }
}

/* ============================================================
   Header fit: never stack or wrap. If a language runs long,
   shrink type for THAT language only. English keeps full size.
   ============================================================ */

/* clip only sideways spill; dropdowns must be free to hang below the bar */
.topbar { flex-wrap: nowrap; gap: 12px; overflow-x: clip; overflow-y: visible; }
.topbar .brand,
.topbar .chip,
.topbar .btn,
.taskstrip .taskstep,
.taskstrip .chip,
.side-tab,
.lang-dd-btn { white-space: nowrap; }

.topbar .brand { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.topbar .chip { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.topbar .btn { flex: none; }
.taskstrip { flex-wrap: nowrap; overflow: hidden; }

/* isiZulu and Setswana run noticeably longer than English */
:root[data-lang="zu"] .topbar .brand,
:root[data-lang="tn"] .topbar .brand { font-size: 18px; letter-spacing: .05em; }

:root[data-lang="zu"] .topbar .chip,
:root[data-lang="tn"] .topbar .chip { font-size: 11px; padding: 4px 9px; letter-spacing: .02em; }

:root[data-lang="zu"] .topbar .btn,
:root[data-lang="tn"] .topbar .btn { font-size: 14px; padding: 10px 14px; }

:root[data-lang="zu"] .taskstrip .taskstep,
:root[data-lang="tn"] .taskstrip .taskstep { font-size: 13.5px; padding: 6px 12px; }

:root[data-lang="zu"] .taskstrip .chip,
:root[data-lang="tn"] .taskstrip .chip { font-size: 11px; }

:root[data-lang="zu"] .side-tab,
:root[data-lang="tn"] .side-tab { font-size: 13px; letter-spacing: .01em; }

:root[data-lang="zu"] .timer,
:root[data-lang="tn"] .timer { font-size: 18px; }

:root[data-lang="zu"] .mode-btn .mode-name,
:root[data-lang="tn"] .mode-btn .mode-name { font-size: 23px; }

:root[data-lang="zu"] .fd-btn,
:root[data-lang="tn"] .fd-btn { font-size: 14px; padding: 11px 16px; }

/* narrow screens tighten further, in every language */
@media (max-width: 1280px) {
  .topbar .brand { font-size: 18px; }
  .topbar .chip { font-size: 11.5px; }
  :root[data-lang="zu"] .topbar .brand,
  :root[data-lang="tn"] .topbar .brand { font-size: 16px; }
  :root[data-lang="zu"] .topbar .chip,
  :root[data-lang="tn"] .topbar .chip { font-size: 10.5px; }
}

/* ============================================================
   Legibility pass. Nothing user facing sits below 14px.
   The site map descriptions were the worst offenders.
   ============================================================ */

/* site map cards */
.map-area .area-tag  { font-size: 16px; fill: #c3d0dc; }
.map-area .area-stat { font-size: 14.5px; }
.map-area text:first-of-type { font-size: 27px; }

/* everywhere else that was too small */
.attempt-note            { font-size: 14.5px; }
.area-card .ac-sub       { font-size: 15px; }
.side-tab .cnt           { font-size: 12.5px; }
.sp-item .meta           { font-size: 14px; }
.sp-note,
.side-panel .sp-note     { font-size: 15px; }
.note-entry              { font-size: 15.5px; }
.note-entry .nt          { font-size: 12.5px; }
.final-area .fa-stats    { font-size: 14.5px; }
.dim-card p              { font-size: 15px; }
.moment                  { font-size: 16px; }
.chip                    { font-size: 14px; }
.status-pill             { font-size: 12.5px; }
.opt .sub                { font-size: 15px; }
.ob-step p               { font-size: 15.5px; }
.shiftlog li             { font-size: 15px; }
.shiftlog h4             { font-size: 13px; }
.final-area .fa-notes label { font-size: 15.5px; }
.scene-note              { font-size: 14px; }
.kbd                     { font-size: 13px; }
.shortcut-grid > div:nth-child(even) { font-size: 16px; }

/* the long languages still shrink, but never below the floor */
:root[data-lang="zu"] .topbar .chip,
:root[data-lang="tn"] .topbar .chip { font-size: 12.5px; }
:root[data-lang="zu"] .taskstrip .chip,
:root[data-lang="tn"] .taskstrip .chip { font-size: 12.5px; }
:root[data-lang="zu"] .side-tab,
:root[data-lang="tn"] .side-tab { font-size: 14px; }

@media (max-width: 1280px) {
  .topbar .chip { font-size: 13px; }
  :root[data-lang="zu"] .topbar .chip,
  :root[data-lang="tn"] .topbar .chip { font-size: 12px; }
}

/* ============================================================
   Controls tour, shown once on entering the first area
   ============================================================ */

.tour { position: fixed; inset: 0; z-index: 400; }
.tour.hidden { display: none; }

/* dim everything except the highlighted control */
.tour-mask {
  position: fixed; inset: 0;
  background: rgba(8, 11, 15, .74);
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  clip-path: polygon(
    0 0, 100% 0, 100% 100%, 0 100%, 0 0,
    var(--x) var(--y),
    var(--x) calc(var(--y) + var(--h)),
    calc(var(--x) + var(--w)) calc(var(--y) + var(--h)),
    calc(var(--x) + var(--w)) var(--y),
    var(--x) var(--y)
  );
}
.tour-ring {
  position: fixed; border: 2px solid var(--amber); border-radius: 10px;
  box-shadow: 0 0 0 3px rgba(255,176,32,.25), 0 0 26px rgba(255,176,32,.35);
  pointer-events: none; animation: tourPulse 2s ease-in-out infinite;
}
@keyframes tourPulse {
  0%,100% { box-shadow: 0 0 0 3px rgba(255,176,32,.25), 0 0 26px rgba(255,176,32,.35); }
  50%     { box-shadow: 0 0 0 6px rgba(255,176,32,.12), 0 0 34px rgba(255,176,32,.5); }
}

.tour-card {
  position: fixed; width: min(400px, 92vw);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 20px 22px 18px; box-shadow: 0 22px 60px rgba(0,0,0,.6);
  animation: tourIn .22s ease;
}
@keyframes tourIn { from { transform: translateY(8px); opacity: 0; } }
.tour-card .tour-count {
  font-family: var(--mono); font-size: 12.5px; letter-spacing: .1em;
  color: var(--amber); margin-bottom: 8px;
}
.tour-card h4 {
  font-family: var(--display); font-size: 23px; letter-spacing: .04em;
  text-transform: uppercase; margin-bottom: 8px; color: var(--text);
}
.tour-card p { font-size: 16px; line-height: 1.55; color: #c3d0dc; margin-bottom: 16px; }
.tour-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tour-nav { display: flex; gap: 8px; }
.tour-foot .btn { padding: 10px 18px; font-size: 15px; }

:root[data-lang="zu"] .tour-card h4,
:root[data-lang="tn"] .tour-card h4 { font-size: 20px; }

/* ============================================================
   RESPONSIVE
   Desktop is a fixed viewport app. Tablet and phone become a
   scrolling document, because a shift inspection has to work
   on the device people actually carry.
   ============================================================ */

/* ---------- tablet and below ---------- */
@media (max-width: 900px) {

  html, body { overflow: auto; height: auto; }
  .app { height: auto; min-height: 100dvh; }

  /* top bar may take two rows here, that is expected on small screens */
  .topbar {
    flex-wrap: wrap; gap: 8px 10px; padding: 10px 14px;
    position: sticky; top: 0; z-index: 100;
    overflow: visible;          /* it wraps here, so there is nothing to clip */
  }
  /* The bar wraps, so the language button can land anywhere along it. Anchor the
     menu to the BAR, not the button, so it can never hang off either edge. */
  .lang-dd { position: static; }
  .lang-dd-menu { left: 12px; right: 12px; top: calc(100% + 6px); min-width: 0; }
  .lang-dd-item { padding: 13px 14px; }
  .topbar .brand { font-size: 19px; width: 100%; order: -1; }
  .topbar .spacer { display: none; }
  .topbar .btn { padding: 10px 14px; font-size: 14.5px; }
  .hazstripe { height: 6px; }

  /* home stacks */
  .home { flex-direction: column; overflow: visible; }
  .home-left { padding: 32px 22px 26px; flex: none; }
  .home-right { border-left: 0; border-top: 1px solid var(--line); padding: 26px 22px 40px; flex: none; }
  .home-title { font-size: clamp(46px, 15vw, 78px); }
  .home-sub { font-size: 17px; }

  /* map stacks: plan first, then the area list */
  .mapwrap { flex-direction: column; overflow: visible; }
  .mapmain { padding: 18px 16px 0; overflow: visible; }
  .sitemap { min-height: 300px; }
  .mapside {
    border-left: 0; border-top: 1px solid var(--line);
    padding: 20px 16px 40px; overflow: visible;
  }

  /* area stacks: scene on top, panel underneath */
  .areawrap { overflow: visible; }
  .areabody { flex-direction: column; overflow: visible; }
  .scenewrap { flex: none; width: 100%; aspect-ratio: 16 / 10; min-height: 260px; }
  .areaside {
    flex: none; width: 100%; max-width: none; min-width: 0;
    border-left: 0; border-top: 1px solid var(--line); overflow: visible;
  }
  .side-panel { overflow: visible; padding: 16px 16px 40px; }

  /* the four step strip scrolls sideways rather than squashing */
  .taskstrip {
    overflow-x: auto; padding: 8px 14px; gap: 2px;
    scrollbar-width: none;
  }
  .taskstrip::-webkit-scrollbar { display: none; }
  .taskstrip .chip { display: none; }

  /* modals go nearly full bleed */
  .overlay { padding: 0; align-items: flex-end; }
  .modal {
    width: 100%; max-width: none; max-height: 92dvh;
    border-radius: 16px 16px 0 0; border-bottom: 0;
  }
  .modal-head { padding: 18px 18px 12px; }
  .modal-head h3 { font-size: 21px; }
  .modal-body { padding: 16px 18px 26px; }
  .risk-grid { grid-template-columns: 1fr; gap: 16px; }
  .modal-foot { flex-direction: column-reverse; align-items: stretch; }
  .modal-foot .btn { width: 100%; }

  /* final and debrief */
  .finalwrap, .outwrap { padding: 24px 16px 40px; }
  .dims { grid-template-columns: 1fr; }
  .final-decide { flex-direction: column; }
  .fd-btn { width: 100%; }
  .grade-badge { width: 92px; height: 92px; font-size: 58px; }
  .grade-text h2 { font-size: 30px; }
  .final-title { font-size: 34px; }

  /* onboarding cards */
  .onboard-steps { grid-template-columns: 1fr 1fr; }

  /* tour anchors to whichever edge keeps the highlighted target visible:
     bottom by default, top when the target itself sits in the bottom half */
  .tour-card {
    left: 12px !important; right: 12px;
    width: auto; max-width: none;
    top: auto !important; bottom: 14px;
  }
  #tour.pin-top .tour-card {
    top: 14px !important; bottom: auto;
  }

  .toasts { top: auto; bottom: 14px; left: 12px; right: 12px; max-width: none; }
}

/* ---------- phone ---------- */
@media (max-width: 600px) {

  body { font-size: 16px; }

  .topbar { padding: 9px 12px; }
  .topbar .brand { font-size: 17px; }
  .topbar .chip { font-size: 12px; padding: 3px 8px; }
  .topbar .btn { padding: 9px 12px; font-size: 14px; }
  .icon-btn { width: 40px; height: 40px; padding: 9px; }
  .lang-dd-btn .lang-name { display: none; }

  .home-left { padding: 26px 16px 22px; }
  .home-right { padding: 22px 16px 36px; }
  .home-kicker { font-size: 11.5px; letter-spacing: .18em; }
  .home-sub { font-size: 16px; }
  .home-role { gap: 8px; }
  .mode-btn { padding: 16px 18px; }
  .mode-btn .mode-name { font-size: 24px; }
  .mode-btn .mode-desc { font-size: 15px; }

  /* the plan is unreadable at phone width; the four area cards ARE the map here.
     One list: conditions, four cards with progress and Inspect, actions, then the log. */
  .sitemap { display: none; }
  .mapmain { padding: 14px 16px 0; }
  .mapside { padding-top: 6px; border-top: 0; }
  .mapside > h3 { display: none; }
  .mapside .shiftlog { order: 5; }
  /* the cards wear the site plan's building look: amber roofline, state coloured outline */
  .area-card { padding: 14px; gap: 12px; align-items: flex-start; border-top: 5px solid rgba(255,176,32,.85); }
  .area-card.done { border-color: var(--green); border-top-color: rgba(255,176,32,.85); }
  .area-card.locked { border-color: var(--red); border-top-color: rgba(255,176,32,.85); }
  .area-card .ac-tag { display: block; }
  .area-card .ac-sub { color: var(--amber); }
  .area-card .ring { margin-top: 2px; }
  .area-card .ac-name { font-size: 17px; }
  .ring { width: 44px; height: 44px; }

  .scenewrap { aspect-ratio: 4 / 3; min-height: 220px; }

  /* comfortable thumb targets */
  .side-tab { padding: 14px 4px; font-size: 13px; }
  .opt { padding: 14px 14px; font-size: 15.5px; }
  .btn { padding: 13px 18px; }
  .btn.big { font-size: 17px; padding: 15px 22px; }
  .hotspot { width: 46px; height: 62px; }
  .hotspot .core { width: 38px; height: 38px; font-size: 14px; }
  .hotspot .core .ic { width: 21px; height: 21px; }
  .hotspot .pulse { width: 38px; height: 38px; margin-left: -19px; }

  .onboard-steps { grid-template-columns: 1fr; }
  .ob-step { padding: 14px; }

  .shortcut-grid { grid-template-columns: auto 1fr; gap: 10px 12px; }
  .snd .vol { width: 70px; opacity: 1; margin-left: 8px; }   /* always visible on touch */

  .tour-card { padding: 16px 18px 14px; }
  .tour-card h4 { font-size: 20px; }
  .tour-card p { font-size: 15.5px; }
  .tour-foot { flex-direction: column-reverse; align-items: stretch; gap: 8px; }
  .tour-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .tour-foot .btn { width: 100%; }
}

/* landscape phone: keep the scene usable */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 520px) {
  .scenewrap { aspect-ratio: auto; height: 62dvh; min-height: 0; }
  .topbar .brand { width: auto; order: 0; }
}

/* pointer is coarse: no hover tricks, bigger hit areas */
@media (hover: none) {
  .snd .vol { width: 76px; opacity: 1; margin-left: 8px; }
  .opt:hover { transform: none; }
  .btn:hover { transform: none; }
  .sp-item.clickable:hover { transform: none; }
}

.attempt-note .ver { float: right; color: var(--text-faint); font-size: 12px; }
