/* ============================================================================
   DEEP OCEAN EXPLORER (pages/coral-reef)  ·  stylesheet
   ----------------------------------------------------------------------------
   Deep-water shell. Type comes from lib/sci.css. The control panel, its
   sections and controls, the phone dock and sheet and the glass cards come
   from lib/sn-panel.css (loaded last): this file only sets the page tokens
   and the parts that are not the panel. The WebGL canvas fills the frame.
   The readout (#read) is at the upper right, the legend under it, the
   SSTV feed card (#feed) at the lower right, the camera bar at the top
   centre, and the explainer (#about) a drawer at the right.
     grep -n 'FEED'       the camera feed card (phone: small, a tap makes it large)
     grep -n 'CAMERA'     the camera bar and the tour menu (camera.js, input.js)
     grep -n 'READOUT'    the squad stats card and the legend
     grep -n 'ABOUT'      the explainer drawer
     grep -n 'PHONE'      the phone places of the cards (sn-panel.css has the dock)
     grep -n 'LANDSCAPE'  the landscape overrides
     grep -n 'sn-saver'   the screensaver mode
   Text is 12 px or more everywhere (tests/panel.test.mjs reads this file).
   ========================================================================== */
[hidden]{display:none!important}
:root{
  --bg:#02101a; --bg2:#06202c; --ink:#d4ecef; --dim:#93b1b7; --faint:#24414b;
  --line:rgba(160,215,225,0.13); --line-b:rgba(160,215,225,0.26);
  --warm:#ffc4a3; --accent:#7fe0cf; --panel-w:300px;
  --gg-accent:#7fe0cf; --gg-dim:#93b1b7}
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html,body{width:100%;height:100%;overflow:hidden;background:var(--bg);overscroll-behavior:none}
body{font-family:var(--sci-sans);color:var(--ink);-webkit-font-smoothing:antialiased}
button{touch-action:manipulation;-webkit-tap-highlight-color:transparent;font-family:inherit}
a{color:var(--accent)}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}

.topbar{position:fixed;top:0;left:0;right:0;height:52px;z-index:30;display:flex;align-items:center;gap:16px;padding:0 20px;pointer-events:none}
.brand{font-family:var(--sci-serif);font-size:1.125rem;color:#e8f6f8;display:flex;align-items:center;gap:8px}
.pagetitle{font-size:0.8125rem;color:var(--dim);margin-left:auto}
html.in-frame .topbar{display:none}

#view{position:fixed;inset:0;width:100%;height:100%;display:block;touch-action:none;outline:none}
#nogl{position:fixed;left:50%;top:45%;transform:translate(-50%,-50%);z-index:50;padding:16px 20px;border:1px solid var(--line-b);border-radius:12px;background:rgba(2,16,26,0.95);max-width:min(420px,90vw);font-size:0.875rem}

/* READOUT: the squad stats (sn-panel.css .snp-read) and the legend */
#read{position:fixed;top:12px;right:12px;z-index:22;min-width:184px}
html:not(.in-frame) #read{top:56px}
#hint{position:fixed;left:50%;bottom:16px;transform:translateX(-50%);z-index:20;font-size:0.75rem;color:var(--dim);pointer-events:none;transition:opacity 0.6s;text-align:center;text-shadow:0 1px 6px rgba(0,0,0,0.8)}
#hint.gone{opacity:0}
#legend{position:fixed;right:12px;top:200px;z-index:20;padding:8px 12px;pointer-events:none}
#legend.off{display:none}
.lg-title{font-size:0.75rem;color:var(--dim);margin-bottom:4px}
#lgBar{width:180px;height:8px;border-radius:4px}
.lg-ticks{display:flex;justify-content:space-between;font-size:0.75rem;color:var(--ink);margin-top:4px}

/* ABOUT: the explainer drawer */
#about{position:fixed;top:0;right:0;bottom:0;width:min(440px,92vw);z-index:60;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;padding:0 24px 32px;background:rgba(4,17,25,0.97);border-left:1px solid var(--line);font-size:0.875rem;line-height:1.6;color:var(--ink);box-shadow:-12px 0 40px rgba(0,0,0,0.45)}
#about h2{font-weight:600;font-size:0.9375rem;margin:24px 0 8px;color:#eef8f8}
#about h2:first-of-type{margin-top:8px}
.ab-head{position:sticky;top:0;z-index:2;display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 -24px 4px;padding:8px 12px 8px 24px;background:rgba(4,17,25,0.98);border-bottom:1px solid var(--line);font-size:0.875rem;font-weight:600;color:var(--ink)}
#about p{color:#b9d0d4;margin-bottom:8px}
#about .cap{font-size:0.75rem;color:var(--dim)}
#about .cr{font-size:0.8125rem}
#diag{display:block;width:100%;height:220px;border-radius:8px;border:1px solid var(--line);margin:12px 0 4px}

/* FEED: the SSTV camera card of the lead ROV (rov/ draws the canvas). */
#feed{position:fixed;right:12px;bottom:12px;z-index:24;width:352px;max-width:calc(100vw - 24px);border:1px solid var(--line-b);border-radius:12px;overflow:hidden;background:#000;box-shadow:0 8px 32px rgba(0,0,0,0.6)}
#feedSlot canvas{display:block;width:100%;height:auto;image-rendering:auto}
#feedCycle{position:absolute;inset:0;z-index:1;width:100%;height:100%;border:0;background:transparent;cursor:pointer;padding:0}
#feedSize{position:absolute;top:4px;right:4px;z-index:2;display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:0;border-radius:8px;background:rgba(4,12,16,0.6);color:var(--ink);cursor:zoom-in;padding:0}
#feedSize svg{width:16px;height:16px}
#feed.big #feedSize{cursor:zoom-out}
#feed.big{width:min(704px,calc(100vw - 24px))}
#feed.live{background:transparent}
#feed.live #feedSlot canvas{background:transparent}

/* CAMERA: the camera bar (camera.js, input.js) and the tour menu. The
   camera modes live only here (not in the panel). */
#camBar{position:fixed;top:12px;left:50%;transform:translateX(-50%);z-index:26;display:flex;gap:2px;padding:4px;
  background:var(--snp-bg);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);border:1px solid var(--line);border-radius:12px;box-shadow:0 6px 24px rgba(0,0,0,0.35)}
html:not(.in-frame) #camBar{top:56px}
#camBar button{display:flex;align-items:center;gap:8px;min-height:32px;padding:4px 12px;border:0;border-radius:8px;background:transparent;color:var(--dim);font-size:0.8125rem;cursor:pointer}
#camBar button svg{width:16px;height:16px}
#camBar button:hover{color:var(--ink)}
#camBar button.on{background:rgba(127,224,207,0.15);color:var(--ink);box-shadow:inset 0 0 0 1px rgba(127,224,207,0.45)}
#tourList{position:fixed;top:100px;left:50%;transform:translateX(-50%);z-index:27;display:flex;flex-wrap:wrap;gap:4px;justify-content:center;width:min(340px,calc(100vw - 24px));padding:8px;
  background:var(--snp-bg);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);border:1px solid var(--line);border-radius:12px}
html.in-frame #tourList{top:56px}
#tourList button{min-height:32px;padding:4px 12px;border:0;border-radius:8px;background:rgba(255,255,255,0.045);color:var(--ink);font-size:0.8125rem;cursor:pointer}
#tourList button.on{background:rgba(127,224,207,0.15);box-shadow:inset 0 0 0 1px rgba(127,224,207,0.45)}
#tourList p{width:100%;margin:4px 0 0;color:var(--dim);font-size:0.75rem;text-align:center}
@media (pointer:coarse){#camBar button,#tourList button{min-height:44px;min-width:44px}#feedSize{width:44px;height:44px}}
html.sn-saver #camBar,html.sn-saver #tourList,html.sn-saver #feedCycle{display:none!important}

/* the tap mark: a ring where a tap lands */
#tapMark{position:fixed;left:0;top:0;width:46px;height:46px;margin:-23px 0 0 -23px;z-index:25;border:2px solid var(--accent);border-radius:50%;pointer-events:none;opacity:0}
#tapMark.go{animation:tapgo 0.7s ease-out}
#tapMark.bad{border-color:var(--warm)}
/* PLANT mode (world/plant.js): a crosshair over the view, the dock button lit */
body.planting #view{cursor:crosshair}
#dockPlant[aria-pressed="true"]{color:var(--accent)}
@keyframes tapgo{0%{opacity:1;transform:scale(0.4)}100%{opacity:0;transform:scale(1.6)}}
@media (prefers-reduced-motion:reduce){#tapMark.go{animation:none}#hint{transition:none}}

@media(min-width:769px){
  .topbar{padding-left:calc(var(--panel-w) + 20px)}
  body.panel-closed .topbar{padding-left:68px}
}

/* TOUCH. Any coarse pointer or narrow window: targets 44px or more. */
@media (pointer:coarse), (max-width:768px){
  #aboutClose{width:44px;height:44px}
}

/* PHONE. The query matches PHONE_Q in main.js. */
@media (max-width:768px), (max-height:500px) and (pointer:coarse){
  :root{--dock-h:var(--snp-dock-h)}
  .topbar{height:calc(46px + env(safe-area-inset-top));padding:env(safe-area-inset-top) 16px 0 calc(16px + env(safe-area-inset-left))}
  .pagetitle{display:none}
  #read,html:not(.in-frame) #read{top:calc(52px + env(safe-area-inset-top));right:calc(8px + env(safe-area-inset-right));min-width:0}
  html.in-frame #read{top:8px}
  #read .rd-more{display:none}
  #legend{right:auto;left:calc(8px + env(safe-area-inset-left));top:calc(52px + env(safe-area-inset-top));padding:8px}
  html.in-frame #legend{top:8px}
  #feed{right:calc(8px + env(safe-area-inset-right));bottom:calc(var(--dock-h) + 8px);width:150px;border-radius:12px}
  #camBar,html:not(.in-frame) #camBar{top:auto;bottom:calc(var(--dock-h) + 8px);left:calc(8px + env(safe-area-inset-left));transform:none;flex-direction:column;padding:4px}
  #camBar button{flex-direction:column;gap:2px;padding:4px;font-size:0.75rem;min-width:56px}
  #tourList,html.in-frame #tourList{top:auto;bottom:calc(var(--dock-h) + 8px);left:calc(76px + env(safe-area-inset-left));right:8px;transform:none;width:auto;max-height:50vh;overflow:auto}
  body:not(.panel-closed) #camBar,body:not(.panel-closed) #tourList{opacity:0;pointer-events:none}
  #feed.big{width:calc(100vw - 16px);max-width:calc(100vw - 16px)}
  body:not(.panel-closed) #feed{opacity:0;pointer-events:none}
  #lgBar{width:110px}
  #hint{bottom:auto;top:calc(52px + env(safe-area-inset-top));left:16px;right:150px;transform:none;line-height:1.5;text-align:left}
  html.in-frame #hint{top:8px}
  body:not(.panel-closed) #hint,body:not(.panel-closed) #legend,body:not(.panel-closed) #read{opacity:0}
  /* the explainer: a full-height sheet over the dock */
  #about{left:0;width:100%;border-left:0;padding:0 calc(16px + env(safe-area-inset-right)) calc(32px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left))}
  .ab-head{margin:0 calc(-16px - env(safe-area-inset-right)) 4px calc(-16px - env(safe-area-inset-left));padding:calc(4px + env(safe-area-inset-top)) calc(8px + env(safe-area-inset-right)) 4px calc(16px + env(safe-area-inset-left))}
  #diag{height:190px}
}

/* LANDSCAPE phone: the panel is a drawer at the right (sn-panel.css). */
@media (max-height:500px) and (orientation:landscape){
  .topbar{display:none}
  #read,html:not(.in-frame) #read{top:8px}
  #legend{bottom:auto;top:8px}
  #feed{width:132px}
  #camBar,html:not(.in-frame) #camBar{bottom:calc(var(--dock-h) + 8px);flex-direction:row}
  #camBar button{min-width:52px}
  #hint,html.in-frame #hint{top:auto;bottom:calc(var(--dock-h) + 64px);left:60vw;right:8px}
  #about{left:auto;width:min(64vw,520px);border-left:1px solid var(--line)}
}

/* screensaver (lib/screensaver.js): the world alone fills the frame */
html.sn-saver #panel,html.sn-saver #dock,html.sn-saver #read,html.sn-saver #legend,html.sn-saver #hint,
html.sn-saver #gear,html.sn-saver .topbar,html.sn-saver #about,html.sn-saver #tapMark{display:none!important}
html.sn-saver #view{cursor:none;transition:opacity 0.8s ease}
html.sn-saver #feed{opacity:1;pointer-events:none;max-width:none;transition:opacity 0.8s ease}
html.sn-saver #feedSize{display:none}
