/* Crocodile Chomp. Portrait only (R0.1): a river running away from the camera
   is a tall picture. */
:root {
  --sky: #08313a;
  --ink: #eaf2f8;
  --dim: #9fb6c9;
  --card: #0c3f49;
  --line: #186371;
  --hot: #e0a83c;
  --good: #4fd6a0;
}
:root {
  --card: #0c3f49;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--sky); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none; overflow: hidden;
  -webkit-text-size-adjust: 100%;
}
#app { display: flex; flex-direction: column; height: 100%; }

#hdr {
  display: flex; align-items: center; gap: 6px;
  padding: calc(env(safe-area-inset-top, 0px) + 6px) 8px 6px;
  background: #052730; border-bottom: 1px solid #125460;
}
#hdrTitle { font-weight: 700; font-size: 15px; }
/* The shared header shelf is a seventh child, and at 320 px the row was 355 px
   wide: the ❓ ran off the right edge where nothing could reach it. The title
   is the one thing in there that repeats what the tab already says. */
@media (max-width: 380px) { #hdrTitle { display: none; } }
#hud { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
#hud::before { content: "🪙 "; }
.pill {
  min-width: 44px; min-height: 44px; border: 0; border-radius: 12px;
  background: #104652; color: var(--ink); font-size: 18px; cursor: pointer;
}
.pill:active { background: #13525f; }

.scr { display: none; flex: 1; overflow-y: auto; padding: 12px; }
.scr.on { display: block; }
#scr-play.on { display: flex; padding: 0; }

h1 { font-size: 26px; margin: 8px 0 4px; }
.sub { color: var(--dim); font-size: 14px; line-height: 1.45; margin-bottom: 12px; }
.stat { color: var(--dim); font-size: 13px; }

#barWrap {
  height: 12px; background: #052730; border-radius: 99px; overflow: hidden;
}
#barFill {
  height: 100%; width: 100%; background: linear-gradient(90deg, #d9534f, #e0a83c 45%, var(--good));
  transition: width .25s ease;
}
.big {
  display: block; width: 100%; min-height: 52px; margin: 8px 0;
  border: 1px solid #186371; border-radius: 14px; background: #104652;
  color: var(--ink); font-size: 17px; font-weight: 600; cursor: pointer;
}
.big.primary { background: var(--hot); border-color: #ff9e6b; color: #2a1206; }

#custom {
  margin: 10px 0; border: 1px solid #13525f; border-radius: 14px; background: #0b3b45;
}
#custom > summary { list-style: none; }
#custom > summary::-webkit-details-marker { display: none; }
#custom > summary::after { content: "▾"; margin-left: auto; color: var(--dim); }
#custom[open] > summary::after { content: "▴"; }
details { margin: 10px 0; border: 1px solid #13525f; border-radius: 14px; background: #0b3b45; }
summary { min-height: 48px; display: flex; align-items: center; padding: 0 12px; cursor: pointer; font-weight: 600; }
.setBody { padding: 10px 12px 14px; }
.setRow { display: flex; align-items: center; gap: 10px; margin: 10px 0; flex-wrap: wrap; }
.setLbl { flex: 1 1 120px; font-size: 14px; }
.setNote { color: var(--dim); font-size: 12px; line-height: 1.4; }
.knob { display: flex; gap: 6px; flex-shrink: 0; }
.knobBtn {
  min-height: 44px; min-width: 56px; border-radius: 10px;
  border: 1px solid #186371; background: #0a2740; color: var(--dim);
  font-size: 13px; cursor: pointer;
}
.knobBtn.on { background: var(--hot); color: #2a1206; border-color: #ff9e6b; font-weight: 700; }

.upRow { display: flex; align-items: center; gap: 10px; margin: 8px 0; }

.upName { flex: 1; font-size: 14px; }

#stage { position: relative; flex: 1; width: 100%; touch-action: none; }
#cvs { display: block; width: 100%; height: 100%; }
#glFail {
  position: absolute; inset: 20% 12% auto; padding: 14px; border-radius: 12px;
  background: #052730; color: var(--ink); font-size: 14px; line-height: 1.5;
}

#playHud { position: absolute; top: 8px; left: 10px; right: 10px; pointer-events: none; }
#meters { display: flex; gap: 12px; margin-top: 6px; font-size: 13px; font-variant-numeric: tabular-nums; }
#meters b { margin-left: 3px; }
#holdHint {
  position: absolute; left: 50%; bottom: 14%; transform: translateX(-50%);
  background: rgba(6, 25, 43, .85); padding: 10px 16px; border-radius: 99px;
  font-size: 15px; pointer-events: none; white-space: nowrap; animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { #holdHint { animation: none; opacity: .9; } }

/* R-C15a: an overlay is a SCROLL REGION, not a centring box. The card centres
   while it fits and pins to the top and scrolls when it does not, so its top
   is never permanently out of reach on a short screen. */
.ovl {
  position: absolute; inset: 0; display: none;
  align-items: flex-start; justify-content: center; overflow-y: auto;
  background: rgba(4, 16, 28, .72); padding: 16px;
}
.ovl.on { display: flex; }
.ovlCard {
  width: 100%; max-width: 340px; margin: auto; background: #0b3b45;
  border: 1px solid #186371; border-radius: 16px; padding: 16px; text-align: center;
}
.ovlCard h2 { margin: 4px 0 8px; font-size: 20px; }
.ovlCard p { color: var(--dim); font-size: 14px; line-height: 1.45; }
.big-score { font-size: 30px; font-weight: 800; color: var(--ink); margin: 6px 0; }

.card {
  background: #0b3b45; border: 1px solid #13525f; border-radius: 14px;
  padding: 12px; margin-bottom: 10px; font-size: 14px; line-height: 1.5; color: var(--dim);
}
.card h2 { margin: 0 0 6px; font-size: 16px; color: var(--ink); }

footer { padding: 6px 10px calc(env(safe-area-inset-bottom, 0px) + 6px); text-align: center; }
.toast-host { position: fixed; left: 0; right: 0; bottom: 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
