/* A quiet optional island visit: no swimming HUD or large opaque panels. */
.island-rest{position:fixed;z-index:12;bottom:max(20px,env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);width:min(440px,calc(100% - 28px));text-align:center;color:#082f3d;text-shadow:0 1px 3px #ffffffd9}
.island-rest[hidden]{display:none}
.island-rest h2{font-size:clamp(25px,4vw,34px);line-height:1.1;margin:0 0 8px}
.island-rest p{font-size:16px;line-height:1.45;margin:8px 0}
.island-rest .primary-btn{min-height:50px;margin:8px 0}
.island-rest small{display:block;font-size:13px;line-height:1.4}
.island-rest summary{cursor:pointer;font-size:15px;font-weight:700;min-height:44px;display:grid;place-content:center;text-decoration:underline}
.island-rest details[open]{padding:10px 14px;border-radius:16px;background:#f5fff6f2;text-shadow:none;max-height:30vh;overflow:auto}
.island-rest a{color:inherit}
.on-island .vignette,.on-island .grain{display:none}
.on-island #eventToast{display:none}
.on-island .topbar{color:#123b46}
.air-readout {
  display: flex;
  gap: 8px;
  align-items: center;
  max-width: calc(100vw - 22px);
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 10px;
  background: rgba(230,251,242,.9);
  color: #124754;
  font-size: 14px;
  line-height: 1.3;
  pointer-events: none;
}
.air-readout b { font-variant-numeric: tabular-nums; }
.air-readout.low-air { background: #fff0bd; color: #683600; border-color: #c88b22; }
.air-readout.breathing { background: #d4fff0; color: #124754; }
#hud .hud-summary { position: absolute; top: 0; left: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; pointer-events: none; }
#hud .hud-summary .hud-toggle { position: static; pointer-events: auto; }
.air-science { margin-block: 18px; padding: 14px; border: 1px solid #92d7cf; border-radius: 12px; }
body:not(.hud-condensed) #hud .mission-card,
body:not(.hud-condensed) #hud .nav-card { margin-top: 102px; }
@media (max-width: 760px), (max-height: 500px) and (orientation: landscape) {
  body:not(.hud-condensed) #hud .hud-details { margin-top: 102px; }
  body:not(.hud-condensed) #hud .hud-details .mission-card,
  body:not(.hud-condensed) #hud .hud-details .nav-card { margin-top: 0; }
}
:root {
  color-scheme: dark;
  --deep: #062c43;
  --abyss: #031c31;
  --lagoon: #24c5c2;
  --foam: #b8fff0;
  --coral: #ff9d91;
  --sun: #ffe08a;
  --lavender: #c9b8ff;
  --glass: rgba(5, 32, 51, .78);
  --line: rgba(183, 245, 239, .28);
  --display: "Avenir Next", "Trebuchet MS", sans-serif;
  --body: "Avenir Next", "Trebuchet MS", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; min-height: 100%; background: var(--abyss); color: #effffd; font-family: var(--body); }
body { min-height: 100dvh; overflow-x: hidden; }
button, a { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; }
#ocean { position: fixed; inset: 0; z-index: 0; }
#ocean canvas { display: block; width: 100%; height: 100%; }
body.on-beach #airReadout { display: none; }
.vignette { position: fixed; z-index: 1; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 35%, rgba(1, 18, 32, .18) 78%, rgba(1, 15, 29, .62)); }
.grain { position: fixed; z-index: 2; inset: 0; pointer-events: none; opacity: .09; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E"); }
.topbar { position: fixed; z-index: 5; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: max(18px,env(safe-area-inset-top)) 26px 18px; background: linear-gradient(180deg, rgba(2,22,39,.74), transparent); }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.brand-mark { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid rgba(184,255,240,.52); border-radius: 50%; color: var(--foam); background: rgba(9,75,91,.5); }
.brand-mark svg { width: 22px; height: 22px; }
.brand-copy { line-height: 1.03; }
.brand-copy strong { display: block; font-family: var(--display); font-size: 14px; letter-spacing: .01em; }
.brand-copy small { color: #a7d8d8; font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.top-actions { display: flex; gap: 8px; }
.icon-btn, .soft-btn { min-height: 42px; padding: 0 13px; border: 1px solid var(--line); border-radius: 13px; background: rgba(4,33,52,.62); color: #e7fffb; cursor: pointer; transition: background .18s, transform .18s; }
.icon-btn:hover, .soft-btn:hover { background: rgba(29,114,125,.7); transform: translateY(-1px); }
.icon-btn { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.icon-btn svg { width: 17px; height: 17px; }
.hud { position: fixed; z-index: 4; inset: 82px 18px auto; display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none; }
.hud > * { pointer-events: auto; }
.mission-card, .nav-card { border: 1px solid rgba(183,245,239,.24); background: rgba(5,32,51,.58); box-shadow: 0 12px 32px rgba(0,16,27,.14); backdrop-filter: blur(10px); }
.mission-card { width: min(350px, 36vw); padding: 16px 18px; border-radius: 18px; }
.kicker { color: var(--foam); font: 500 12px var(--mono); letter-spacing: .15em; text-transform: uppercase; }
.mission-card h2 { margin: 8px 0 7px; font: 600 22px/1.12 var(--display); }
.mission-card p { margin: 0; color: #d5eeea; font-size: 16px; line-height: 1.5; }
.progress-row { display: flex; justify-content: space-between; margin-top: 14px; color: #b8dedc; font: 12px var(--mono); }
.progress-track { height: 4px; margin-top: 7px; border-radius: 8px; background: rgba(228,255,252,.17); overflow: hidden; }
.progress-fill { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--lagoon),var(--sun)); transition: width .35s; }
.nav-card { display: flex; align-items: center; gap: 12px; min-width: 226px; padding: 12px 15px; border-radius: 16px; }
.compass { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid rgba(255,224,138,.5); border-radius: 50%; color: var(--sun); }
.compass svg { width: 22px; height: 22px; transition: transform .2s; }
.nav-text { min-width: 0; }
.nav-text small { display: block; color: #bce4df; font: 12px var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.nav-text strong { display: block; max-width: 190px; margin-top: 3px; overflow: hidden; color: #fff8dd; font: 600 14px var(--display); text-overflow: ellipsis; white-space: nowrap; }
.nav-text span { display: block; margin-top: 2px; color: #d0e8e5; font: 12px var(--mono); }
.bottom-hud { position: fixed; z-index: 7; left: 50%; bottom: calc(174px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 9px; transform: translateX(-50%); }
.hud-pill { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border: 1px solid rgba(183,245,239,.24); border-radius: 99px; background: rgba(4,30,48,.62); color: #e9fffb; backdrop-filter: blur(10px); font: 12px var(--mono); white-space: nowrap; }
.hud-pill b { color: var(--sun); font-weight: 500; }
.energy-track { width: 54px; height: 5px; overflow: hidden; border-radius: 8px; background: rgba(219,255,246,.2); }
.energy-track i { display: block; width: 100%; height: 100%; border-radius: inherit; background: var(--foam); transition: width .18s; }
.event-toast { position: fixed; z-index: 7; left: 50%; top: 48%; max-width: min(480px, 84vw); padding: 14px 20px; border: 1px solid rgba(190,255,235,.55); border-radius: 14px; background: rgba(3,31,49,.9); color: #f5ffed; font-size: 15px; text-align: center; opacity: 0; transform: translate(-50%, 15px); transition: opacity .2s, transform .2s; pointer-events: none; }
.event-toast.show { opacity: 1; transform: translate(-50%, 0); }
.event-toast.collection-success { border: 2px solid #78ffcf; background: #063e35f5; color: #fff3ac; font-size: 20px; font-weight: 700; }
.sponge-tracker { margin-top: 12px; padding-top: 10px; border-top: 1px solid #78ffcf77; }
.sponge-tracker[hidden] { display:none; }
.sponge-tracker strong { display:block; color:#fff0a8; font-size:17px; }
.sponge-checks { display:flex; gap:7px; margin:8px 0; }
.sponge-checks span { display:grid; place-items:center; width:30px; height:28px; border:1px solid #ffe090; border-radius:8px; color:#ffe090; font-size:20px; }
.sponge-checks span.found { color:#063b32; background:#78ffcf; border-color:#78ffcf; font-weight:800; }
.sponge-tracker p { font-size:14px; line-height:1.4; margin:5px 0 0; }
.sponge-tracker #collectionReceipt { color:#a0ffdb; font-weight:700; }
.sponge-tracker #collectionReceipt:empty { display:none; }
.touch-buttons button.ready-to-forage { background:#86ffd0; color:#073f33; outline:3px solid #ffe090; }
.screen { position: fixed; z-index: 10; inset: 0; display: grid; place-items: center; padding: 24px; background: linear-gradient(90deg,rgba(1,22,39,.72),rgba(1,22,39,.16) 70%), linear-gradient(0deg,rgba(2,22,38,.34),transparent 55%); }
.screen#startScreen { pointer-events: none; }
.screen.hidden { display: none; }
.intro-copy { width: min(600px, 92vw); margin: 0 auto 0 max(4vw, 20px); pointer-events: auto; }
.intro-copy .eyebrow { color: #aaffed; font: 500 12px var(--mono); letter-spacing: .15em; text-transform: uppercase; }
.intro-copy h1 { max-width: 650px; margin: 16px 0 12px; color: #fff9e9; font: 700 clamp(48px, 7.5vw, 92px)/.91 var(--display); letter-spacing: -.065em; text-wrap: balance; text-shadow: 0 4px 40px rgba(0,24,40,.3); }
.intro-copy h1 span { color: #9cf1df; }
.intro-copy p { max-width: 450px; margin: 0; color: #e1f3ef; font-size: clamp(16px, 1.5vw, 18px); line-height: 1.65; }
.intro-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 25px; }
.start-guidance { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px 16px; max-width: 550px; margin-top: 20px; padding: 15px 17px; border: 1px solid rgba(186,246,237,.3); border-radius: 15px; background: rgba(3,31,48,.72); color: #e0f4f0; font: 14px/1.5 var(--mono); }
.start-guidance span { display: flex; gap: 8px; }
.start-guidance b { min-width: 76px; color: var(--sun); font-size: 14px; font-weight: 600; letter-spacing: .06em; }
.intro-copy .intro-safety { max-width: 555px; margin: 14px 0 0; font-size: 14px; line-height: 1.55; }
.intro-foot { margin-top: 17px; }
.primary-btn { display: inline-flex; min-height: 52px; align-items: center; gap: 12px; padding: 0 22px; border: 0; border-radius: 99px; background: var(--sun); color: #153a47; box-shadow: 0 9px 28px rgba(255,208,106,.22); font-weight: 800; cursor: pointer; transition: transform .18s, background .18s; }
.primary-btn:hover { transform: translateY(-2px); background: #fff0b8; }
.primary-btn svg { width: 19px; height: 19px; }
.subtle-link { display: inline-flex; min-height: 48px; align-items: center; padding: 0 13px; color: #e5fffc; font-size: 14px; text-decoration: none; }
.intro-foot { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 24px; color: #c0e0df; font: 12px var(--mono); letter-spacing: .05em; }
.intro-foot span { display: inline-flex; align-items: center; gap: 7px; }
.intro-foot i { width: 5px; height: 5px; border-radius: 50%; background: var(--coral); }
.dialog { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(0,16,29,.68); backdrop-filter: blur(8px); }
.dialog[hidden] { display: none; }
.dialog-panel { position: relative; width: min(510px, 100%); max-height: min(86dvh, 760px); overflow: auto; padding: clamp(22px,4vw,34px); border: 1px solid rgba(182,240,231,.38); border-radius: 24px; background: linear-gradient(145deg,rgba(11,62,79,.97),rgba(6,36,57,.98)); box-shadow: 0 25px 90px rgba(0,10,22,.45); }
.dialog-panel h2 { margin: 8px 42px 8px 0; font: 600 27px/1.08 var(--display); }
.dialog-panel p { color: #d1e9e6; font-size: 18px; line-height: 1.6; }
.dialog-close { position: absolute; top: 14px; right: 14px; display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: rgba(4,32,48,.6); cursor: pointer; }
.dialog-close svg { width: 18px; }
.choice-list { display: grid; gap: 10px; margin: 22px 0 0; }
.choice { min-height: 54px; padding: 13px 16px; border: 1px solid rgba(182,240,231,.32); border-radius: 13px; background: rgba(182,240,231,.08); color: #effffc; font-size: 16px; text-align: left; cursor: pointer; }
.choice:hover { background: rgba(36,197,194,.22); }
.choice.correct { border-color: #8ff0ca; background: rgba(46,172,132,.26); }
.choice.wrong { border-color: #ffb3a3; background: rgba(202,75,85,.24); }
.answer-feedback { min-height: 28px; margin-top: 12px; color: var(--sun); font-size: 15px; }
.notebook-panel { width: min(850px,100%); }
.field-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-top: 20px; }
.field-card { overflow: hidden; border: 1px solid rgba(182,240,231,.28); border-radius: 16px; background: rgba(1,22,37,.45); }
.field-card img { display: block; width: 100%; height: 150px; object-fit: cover; background: #0d5974; }
.field-card .field-copy { padding: 12px 14px 14px; }
.field-card h3 { margin: 0 0 7px; font: 600 17px var(--display); }
.field-card p { margin: 0; color: #d4e8e5; font-size: 16px; line-height: 1.55; }
.field-card small { display: block; margin-top: 10px; color: #b8dfda; font: 12px/1.5 var(--mono); }
.field-card small a { color: #a8eadf; text-underline-offset: 2px; }
.field-card small a:hover { color: var(--sun); }
.settings-list { display: grid; gap: 11px; margin-top: 20px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: rgba(0,22,38,.34); }
.setting-row label { font-size: 16px; font-weight: 700; }
.setting-row select { max-width: 190px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #0c4054; color: white; font-size: 15px; }
.setting-row input { width: 20px; height: 20px; accent-color: #70dbcd; }
.pause-card { width: min(410px,100%); text-align: center; }
.pause-card h2 { margin: 10px 0; }
.pause-card .intro-actions { justify-content: center; }
.game-notice { max-width: 520px; padding: 13px 15px; border-left: 3px solid var(--sun); border-radius: 5px 12px 12px 5px; background: rgba(255,224,138,.12); color: #fff0c4 !important; font-size: 14px !important; line-height: 1.55; }
.controls-hint { position: fixed; z-index: 4; bottom: 16px; right: 18px; max-width: 250px; color: rgba(230,251,246,.92); font: 12px/1.55 var(--mono); text-align: right; text-shadow: 0 1px 8px rgba(0,20,32,.9); pointer-events: none; }
.mobile-controls { display: block; position: fixed; z-index: 6; inset: 0; pointer-events: none; }
.swim-controls{position:fixed;z-index:7;bottom:max(16px,env(safe-area-inset-bottom));left:18px;width:230px;padding:10px;border:1px solid #b7f5ef66;border-radius:18px;background:rgba(4,40,59,.62);box-shadow:0 8px 22px #00182533;backdrop-filter:blur(8px);touch-action:none}
.swim-controls p{margin:0 0 8px;color:#e9fff9;font-size:14px;line-height:1.4}
/* Safari needs the prefixed rules too: holding a swim control must not
   select its label or open the native Copy / Look Up callout. */
.swim-controls, .swim-controls *,
.touch-buttons, .touch-buttons * {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.swim-controls button{min-height:46px;cursor:pointer;border:1px solid #b8fff08c;border-radius:12px;background:rgba(23,76,96,.78);color:white;font-size:14px;font-weight:700;touch-action:none;user-select:none}
.swim-controls .swim-forward{display:flex;align-items:center;justify-content:center;gap:12px;width:100%;background:#ffe08a;color:#123949;font-size:15px}
.swim-forward span{font-size:26px;line-height:1}
.swim-turns{display:grid;grid-template-columns:1fr 1fr 1fr;gap:5px;margin-top:6px}
.swim-controls button.active,.swim-controls button:active{background:#92f3dd;color:#073844}
.camera-switch{cursor:pointer;border-color:#ffe08a;color:#fff4ce;font-size:14px;font-weight:bold;touch-action:manipulation}
@media(max-width:700px){.swim-controls{left:12px;width:210px;padding:9px}.swim-controls p{font-size:14px}.swim-controls button{min-height:44px}.swim-controls .swim-forward{font-size:14px}.swim-controls .swim-turns button{font-size:14px}}
.look-zone { display:none;position: absolute; right: 0; top: 200px; bottom: 0; width: 55%; pointer-events: auto; touch-action: none; }
.nav-text .depth-readout{font-size:14px;color:#fff1b5;font-weight:bold;margin-top:6px}
.touch-buttons { position: absolute; right: 14px; bottom: max(16px,env(safe-area-inset-bottom)); display: grid; grid-template-columns: 58px 58px; gap: 7px; pointer-events: auto; }
.touch-buttons button { width: 58px; height: 54px; border: 1px solid rgba(199,255,245,.55); border-radius: 15px; background: rgba(4,37,54,.72); font: 14px var(--mono); font-weight: 700; touch-action: none; }
.touch-buttons button:active, .touch-buttons button.active { background: rgba(38,154,155,.8); }
.webgl-error { max-width: 470px; padding: 28px; border: 1px solid rgba(255,190,171,.6); border-radius: 20px; background: rgba(37,30,42,.94); }
.webgl-error h2 { margin: 0 0 8px; font: 600 26px var(--display); }
.webgl-error p { color: #eadfdf; line-height: 1.6; }
.hidden-ui { display: none !important; }
@media (max-width: 760px) {
  .topbar { padding: max(12px,env(safe-area-inset-top)) 13px 12px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-copy strong { font-size: 12px; }
  .brand-copy small { font-size: 12px; letter-spacing: .06em; }
  .icon-btn { width: 42px; min-width: 42px; justify-content: center; padding: 0; }
  .icon-btn span { display: none; }
  .hud { inset: 62px 11px auto; gap: 7px; }
  .mission-card { width: min(220px,58vw); padding: 12px 12px; border-radius: 15px; }
  .mission-card h2 { font-size: 20px; }
  .mission-card p { font-size: 16px; }
  .nav-card { width: 138px; min-width: 0; gap: 7px; padding: 8px 7px; border-radius: 13px; }
  .compass { width: 30px; height: 30px; flex: 0 0 30px; }
  .nav-text { flex: 1 1 auto; }
  .nav-text strong { max-width: 91px; font-size: 14px; }
  .nav-text small,.nav-text span { font-size: 12px; }
  .bottom-hud { bottom: calc(184px + env(safe-area-inset-bottom)); gap: 4px; }
  .hud-pill { min-height: 38px; padding: 0 8px; font-size: 12px; }
  .controls-hint { display: none; }
  .mobile-controls { display: block; }
  .look-zone { display:block;top:280px }
  .intro-copy { width: 100%; margin: 0; }
  .screen { align-items: center; padding: max(76px,env(safe-area-inset-top)) 22px max(26px,env(safe-area-inset-bottom)); overflow-y: auto; background: linear-gradient(90deg,rgba(1,22,39,.84),rgba(1,22,39,.3)),linear-gradient(0deg,rgba(2,22,38,.3),transparent); }
  .screen#startScreen:not(.hidden) { display: block; }
  .intro-copy h1 { margin-top: 10px; font-size: clamp(43px,11vw,68px); }
  .intro-copy p { max-width: 390px; font-size: 16px; }
  .intro-actions { margin-top: 16px; }
  .start-guidance { grid-template-columns: 1fr; gap: 6px; margin-top: 13px; padding: 12px; font-size: 14px; }
  .intro-copy .intro-safety { margin-top: 10px; font-size: 14px; }
  .intro-foot { display: none; }
  .field-grid { grid-template-columns: 1fr; }
  .field-card { display: grid; grid-template-columns: 108px minmax(0,1fr); }
  .field-card img { height: 100%; min-height: 114px; }
  .dialog-panel { border-radius: 20px; }
}
@media (max-width: 380px) {
  .mission-card { width: 54vw; }
  .mission-card p { display: block; }
  .nav-card { width: 132px; }
  .nav-text strong { max-width: 78px; }
  .bottom-hud .hud-pill { padding: 0 6px; }
  .energy-track { width: 34px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Theodore’s compact, explicitly framed 2D companion. */
.theodore-companion {
  position: fixed;
  z-index: 7;
  top: 290px;
  right: 24px;
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 13px;
  width: min(318px, calc(100vw - 32px));
  padding: 10px;
  border: 1px solid rgba(255, 173, 139, .72);
  border-radius: 18px;
  background: rgba(4, 35, 51, .96);
  box-shadow: 0 14px 36px rgba(0, 15, 28, .36), inset 0 0 0 1px rgba(255, 224, 138, .14);
  color: #f0fffa;
  /* Artwork and reaction text must not steal the reef's drag-to-look area. */
  pointer-events: none;
}
.companion-art {
  position: relative;
  min-width: 0;
  min-height: 112px;
  overflow: hidden;
  border: 2px solid #ffc28f;
  border-radius: 12px;
  background: #07566a url("./assets/hawaiian-reef.jpg") center / cover no-repeat;
  box-shadow: inset 0 0 0 2px rgba(4, 36, 48, .75);
}
.companion-art[data-media="framed"]::after {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 242, 192, .6);
  border-radius: 9px;
  content: "";
  pointer-events: none;
}
.companion-art img,
.companion-art video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.companion-art video[hidden], .companion-art img[hidden] { display: none; }
.companion-error { display: block; margin-top: 6px; font-size: 14px; line-height: 1.35; color: #ffe0b9; }
.companion-error[hidden] { display: none; }
.companion-copy { min-width: 0; align-self: center; }
.companion-heading h2 {
  margin: 0;
  color: #fff0c8;
  font: 700 19px/1.15 var(--display);
  letter-spacing: -.025em;
}
.companion-heading span {
  display: block;
  margin-top: 3px;
  color: #9de8dd;
  font: 11px/1.3 var(--mono);
}
#companionMessage {
  margin: 8px 0 9px;
  color: #e5f5ec;
  font-size: 14px;
  line-height: 1.35;
}
#companionToggle {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(255, 224, 138, .72);
  border-radius: 11px;
  background: #f3d982;
  color: #193c48;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
  touch-action: manipulation;
  pointer-events: auto;
}
#companionToggle:hover { background: #ffe8a5; }
#companionToggle:focus-visible { outline: 3px solid #ffad8b; outline-offset: 3px; }
.companion-explanation {
  max-width: 555px !important;
  margin: 11px 0 0 !important;
  padding: 10px 12px;
  border-left: 3px solid #ffad8b;
  border-radius: 4px 10px 10px 4px;
  background: rgba(255, 173, 139, .11);
  color: #f1e9d5 !important;
  font-size: 14px !important;
  line-height: 1.45 !important;
}
.settings-companion-note { margin-top: 16px !important; }
@media (max-width: 760px) {
  .theodore-companion {
    top: 254px;
    right: 12px;
    left: auto;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    width: 138px;
    padding: 8px;
    border-radius: 15px;
  }
  .companion-art {
    min-height: 36px;
    height: clamp(36px, calc(100dvh - 740px), 110px);
  }
  .companion-heading h2 { font-size: 18px; }
  .companion-heading span { font-size: 10px; }
  #companionMessage { margin: 6px 0 7px; }
  #companionToggle { min-height: 44px; padding: 3px 6px; width: 100%; }
  .event-toast { top: auto; bottom: 250px; }
}
@media (max-width: 380px) {
  .mission-card { width: calc(100vw - 166px); }
  .theodore-companion { width: 132px; }
}
@media (max-width: 760px) and (max-height: 775px) and (orientation: portrait) {
  .mission-card { max-height: 100px; overflow-y: auto; }
  .theodore-companion {
    top: 176px; left: 12px; right: auto; width: calc(100vw - 166px);
    grid-template-columns: 38px minmax(0,1fr); gap: 4px; padding: 7px;
  }
  .companion-art { min-height: 36px; height: 36px; }
  .companion-copy { display: contents; }
  .companion-heading { grid-column: 2; align-self: center; }
  .companion-heading h2 { font-size: 16px; }
  .companion-heading span { display: none; }
  #companionMessage { grid-column: 1 / -1; max-height: 38px; overflow-y: auto; margin: 0; pointer-events: auto; }
  #companionToggle { grid-column: 1 / -1; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .mission-card { width: 240px; max-height: 104px; overflow-y: auto; }
  .nav-card { min-width: 0; width: 150px; }
  .theodore-companion {
    top: max(76px, env(safe-area-inset-top));
    right: auto;
    left: 50%;
    grid-template-columns: 60px minmax(0, 1fr);
    gap: 9px;
    width: min(260px, 34vw);
    padding: 7px;
    transform: translateX(-50%);
  }
  .companion-art { min-height: 82px; height: 100%; }
  .companion-heading { display: none; }
  #companionMessage { margin: 0 0 5px; max-height: 38px; overflow-y: auto; pointer-events: auto; }
  #companionToggle { min-height: 44px; width: 100%; padding: 3px; }
  .bottom-hud { bottom: 146px; }
  .event-toast { top: auto; bottom: 8px; max-width: 270px; padding: 8px; }
}

/* Reef-first HUD: information can tuck away without hiding the controls or voice access. */
.hud { z-index: 8; }
.hud-details { display: contents; }
.hud-toggle {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  border: 1px solid rgba(221, 252, 238, .8);
  border-radius: 14px;
  background: rgba(230, 251, 242, .84);
  color: #124754;
  box-shadow: 0 4px 14px rgba(0, 22, 36, .16);
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
  touch-action: manipulation;
}
.hud-toggle:hover { background: rgba(255,244,202,.94); }
.hud-toggle-mark { display: grid; width: 20px; height: 20px; place-items: center; border-radius: 50%; background: #d0f2e9; font-size: 20px; line-height: 1; }
.hud-condensed .hud-toggle { background: #fff0bd; }
.hud-condensed .hud-toggle-label { font-size: 14px; }
.hud-toggle-copy { display: grid; gap: 2px; min-width: 0; text-align: left; }
#compactObjective { display: none; max-width: 260px; font-size: 13px; font-weight: 500; line-height: 1.3; }
.hud-condensed #compactObjective { display: block; }
.hud-condensed .controls-hint { display: none !important; }
body:not(.hud-condensed) .mission-card,
body:not(.hud-condensed) .nav-card { margin-top: 56px; }
.hud-condensed .hud-details { display: contents; }
.hud-condensed .mission-card,
.hud-condensed .bottom-hud { display: none !important; }
.hud-condensed .nav-card {
  position: absolute;
  top: 0;
  right: 0;
  display: block;
  min-width: 0;
}
.hud-condensed .nav-card > .compass,
.hud-condensed .nav-card > .nav-text { display: none; }
.hud-condensed .nav-card > .theodore-quick {
  position: absolute;
  top: 0;
  right: 0;
  width: 112px;
  min-height: 54px;
  margin: 0;
}
.hud-condensed .hud-toggle { width: auto; max-width: min(320px, calc(100vw - 150px)); min-height: 54px; padding: 6px 10px; }
.hud-condensed .theodore-companion {
  top: 150px;
  left: 22px;
  right: auto;
  width: min(440px, calc(100vw - 28px));
  min-height: 0;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  padding: 7px 12px;
  border-color: rgba(255, 255, 255, .88);
  border-radius: 14px;
  background: rgba(230, 250, 241, .88);
  box-shadow: 0 5px 18px rgba(0, 22, 36, .2);
  color: #16464f;
}
.hud-condensed .theodore-companion:not([data-reaction="concern"]) { display: none !important; }
.hud-condensed .companion-art,
.hud-condensed .companion-heading,
.hud-condensed #companionToggle,
.hud-condensed .companion-error { display: none !important; }
.hud-condensed .companion-copy { display: block; }
.hud-condensed #companionMessage {
  margin: 0;
  color: #16464f;
  font-size: 14px;
  line-height: 1.35;
}
.hud-condensed .event-toast { z-index: 8; }
@media (max-width: 760px), (max-height: 500px) and (orientation: landscape) {
  .hud:not(.hidden-ui) { inset: max(68px, calc(env(safe-area-inset-top) + 56px)) 11px auto; }
  .hud-toggle { min-height: 44px; padding-inline: 11px; }
  body:not(.hud-condensed) .hud-details {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 12px;
    margin-top: 54px;
    padding: 14px;
    max-height: calc(100dvh - 280px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    background: rgba(3, 30, 47, .78);
    border: 1px solid rgba(183,245,239,.25);
    border-radius: 15px;
    backdrop-filter: blur(10px);
  }
  body:not(.hud-condensed) .mission-card,
  body:not(.hud-condensed) .nav-card {
    width: 100%;
    max-height: none;
    overflow: visible;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: none;
    backdrop-filter: none;
  }
  body:not(.hud-condensed) .nav-card { flex-wrap: wrap; }
  body:not(.hud-condensed) .nav-text strong { max-width: none; }
  body:not(.hud-condensed) .theodore-quick { position: static; width: auto; }
  body:not(.hud-condensed) .theodore-companion {
    position: static;
    flex-shrink: 0;
    width: 100%;
    transform: none;
    grid-template-columns: 68px minmax(0, 1fr);
    pointer-events: auto;
  }
  body:not(.hud-condensed) .companion-art { height: 96px; }
  body:not(.hud-condensed) .companion-copy { display: block; }
  body:not(.hud-condensed) #companionMessage { max-height: none; }
  body:not(.hud-condensed) .bottom-hud { position: static; transform: none; flex-wrap: wrap; }
  .hud-condensed .theodore-companion {
    top: max(136px, calc(env(safe-area-inset-top) + 124px));
    right: auto;
    left: 11px;
    width: calc(100vw - 22px);
    grid-template-columns: minmax(0, 1fr);
    padding: 7px 10px;
  }
  .swim-controls {
    width: min(210px, calc(100vw - 154px));
    left: 11px;
    bottom: max(12px, env(safe-area-inset-bottom));
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
  }
  .swim-controls p { display: none; }
  .swim-controls button { background: rgba(4, 37, 54, .62); }
  .touch-buttons { right: 11px; bottom: max(12px, env(safe-area-inset-bottom)); }
  .touch-buttons button { background: rgba(4, 37, 54, .62); }
  .look-zone { top: 135px; bottom: 135px; width: 100%; }
  .hud-condensed .event-toast { bottom: calc(142px + env(safe-area-inset-bottom)); }
}
@media (max-height: 500px) and (orientation: landscape) {
  .hud:not(.hidden-ui) { inset: 68px max(11px, env(safe-area-inset-right)) auto max(11px, env(safe-area-inset-left)); }
  .controls-hint { display: none; }
  .hud-toggle { top: 0; }
  .hud-condensed .hud-toggle { max-width: 330px; }
  .hud-condensed .theodore-companion {
    top: 130px;
    left: max(11px, env(safe-area-inset-left));
    right: auto;
    width: min(330px, 50vw);
    transform: none;
  }
  .swim-controls p { display: none; }
  .swim-controls { padding: 0; background: none; border: 0; box-shadow: none; }
  .hud-condensed .event-toast { top: 50%; bottom: auto; }
}
