/* Dragon Swim Races: frosted slate over live water, sea-foam type, racing-buoy orange for the one thing that matters. */
:root {
  --slate: rgba(12, 22, 28, 0.56);
  --slate-solid: #0e1a20;
  --foam: #eef7f5;
  --muted: #a9c2c6;
  --buoy: #ff6a2b;
  --buoy-deep: #d9481a;
  --good: #bff3e4;
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--slate-solid); color: var(--foam);
  font-family: "Avenir Next", "Avenir", "Segoe UI", system-ui, sans-serif; -webkit-user-select: none; user-select: none; touch-action: none; overscroll-behavior: none; }
#view { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
[hidden] { display: none !important; }
.panel { background: var(--slate); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid rgba(238, 247, 245, 0.12); border-radius: 14px; }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; }
#standing { position: absolute; left: calc(16px + var(--safe-l)); top: calc(14px + var(--safe-t)); padding: 8px 16px 10px; min-width: 150px; }
#place { font-size: 44px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
#of { font-size: 16px; color: var(--muted); margin-left: 6px; }
#lapline { display: flex; gap: 14px; font-size: 16px; margin-top: 4px; font-variant-numeric: tabular-nums; }
#clock { color: var(--muted); }
#minimap { position: absolute; right: calc(76px + var(--safe-r)); top: calc(14px + var(--safe-t)); width: 150px; height: 150px; }
#pause-btn { position: absolute; right: calc(16px + var(--safe-r)); top: calc(14px + var(--safe-t)); pointer-events: auto; }
.round { width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgba(238, 247, 245, 0.2); background: var(--slate); color: var(--foam); font-weight: 700; font-size: 15px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
#message { position: absolute; left: 50%; top: calc(18% + var(--safe-t)); transform: translateX(-50%); font-size: 30px; font-weight: 700; text-align: center; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55); opacity: 0; transition: opacity 0.25s; width: min(90%, 620px); }
#message.show { opacity: 1; }
#message.warn { color: #ffd1b8; }
#pointer { position: absolute; left: 50%; top: calc(62px + var(--safe-t)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; opacity: 0; transition: opacity 0.3s; }
#pointer.show { opacity: 1; }
#pointer svg { width: 44px; height: 44px; fill: var(--buoy); filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5)); transition: transform 0.08s linear; }
#pointer span { font-size: 13px; color: var(--foam); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6); }
#tags { position: absolute; left: 50%; bottom: calc(26px + var(--safe-b)); transform: translateX(-50%); display: flex; gap: 10px; }
.tag { background: var(--slate); padding: 7px 14px; border-radius: 999px; font-size: 16px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border: 1px solid rgba(238, 247, 245, 0.14); }
.tag.hot { border-color: var(--buoy); color: #ffe2d4; }
.tag.penalty { border-color: var(--buoy); color: #ffe2d4; background: rgba(112,48,24,0.82); }

#steer-zone { position: absolute; left: 0; bottom: 0; width: 50%; height: 60%; }
#steer-base, #steer-knob { position: absolute; border-radius: 50%; transform: translate(-50%, -50%); opacity: 0; transition: opacity 0.15s; }
#steer-base { width: 150px; height: 150px; border: 2px solid rgba(238, 247, 245, 0.35); background: rgba(12, 22, 28, 0.25); }
#steer-knob { width: 64px; height: 64px; background: rgba(238, 247, 245, 0.85); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4); }
#steer-zone.active #steer-base, #steer-zone.active #steer-knob { opacity: 1; }
#steer-hint { position: absolute; left: calc(40px + var(--safe-l)); bottom: calc(44px + var(--safe-b)); font-size: 16px; color: var(--foam); background: var(--slate); padding: 8px 14px; border-radius: 999px; transition: opacity 0.4s; }
#steer-zone.active #steer-hint, #steer-zone.learned #steer-hint { opacity: 0; }

#stroke { position: absolute; right: calc(34px + var(--safe-r)); bottom: calc(30px + var(--safe-b)); width: 150px; height: 150px; }
#race-moves { position: absolute; right: calc(42px + var(--safe-r)); bottom: calc(194px + var(--safe-b)); display: flex; gap: 8px; align-items: stretch; pointer-events: auto; }
#super-boost { pointer-events: auto; min-width: 138px; padding: 11px 16px; border-radius: 18px; border: 1px solid rgba(238,247,245,.22); background: rgba(12,22,28,.65); color: rgba(238,247,245,.5); text-align: center; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: transform .12s, opacity .12s, box-shadow .12s; }
#super-boost, #take-flight { min-width: 132px; padding: 11px 14px; border-radius: 18px; border: 1px solid rgba(238,247,245,.22); background: rgba(12,22,28,.65); color: rgba(238,247,245,.6); text-align: center; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: transform .12s, opacity .12s, box-shadow .12s; }
#super-boost strong, #super-boost span, #take-flight strong, #take-flight span { display: block; }
#super-boost strong, #take-flight strong { font-size: 14px; letter-spacing: .08em; }
#super-boost span, #take-flight span { margin-top: 3px; font-size: 11px; }
#take-flight { color: #e6f7ff; border-color: rgba(159,233,238,.55); }
#take-flight.active { color: #fff; background: rgba(44,98,138,.92); border-color: #bdeaff; box-shadow: 0 0 28px rgba(143,214,255,.28); transform: translateY(-2px); }
#super-boost.ready { color: #fff7e9; border-color: var(--buoy); background: rgba(169,65,21,.88); box-shadow: 0 0 24px rgba(255,106,43,.36); animation: boostPulse 1s ease-in-out infinite alternate; }
#super-boost.active { color: #fff; background: rgba(22,126,137,.9); border-color: #9fe9ee; transform: scale(1.05); }
#super-boost:disabled, #take-flight:disabled { cursor: default; opacity: .55; }
@keyframes boostPulse { from { transform: scale(1); } to { transform: scale(1.04); } }
#stroke svg { width: 100%; height: 100%; transform: rotate(-90deg); }
#stroke .track { fill: rgba(12, 22, 28, 0.45); stroke: rgba(238, 247, 245, 0.18); stroke-width: 8; }
#ring { fill: none; stroke: var(--foam); stroke-width: 8; stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: 326.7; }
#stroke.ready #ring { stroke: var(--buoy); stroke-width: 11; }
#stroke.ready .track { fill: rgba(255, 106, 43, 0.22); }
#stroke.hit svg { transform: rotate(-90deg) scale(0.92); transition: transform 0.06s; }
#draft-ring { fill: none; stroke: #9fe6f4; stroke-width: 4; stroke-dasharray: 364.4; stroke-dashoffset: 364.4; opacity: 0.9; }
#stroke-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 19px; font-weight: 700; }
#feedback { position: absolute; bottom: 160px; right: 0; font-size: 24px; font-weight: 700; white-space: nowrap; opacity: 0; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6); transition: opacity 0.2s; }
#feedback.show { opacity: 1; }
#feedback.perfect { color: #ffd9c4; }
#feedback.early { color: #c9d6d8; }
#countdown { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); font-size: 120px; font-weight: 800; text-shadow: 0 4px 24px rgba(0, 0, 0, 0.5); }

/* Overlays sit on the live scene, not on a flat card. */
.overlay { position: fixed; inset: 0; display: flex; align-items: flex-end; justify-content: flex-start; padding: calc(24px + var(--safe-t)) calc(28px + var(--safe-r)) calc(28px + var(--safe-b)) calc(28px + var(--safe-l)); background: linear-gradient(90deg, rgba(8, 14, 18, 0.72) 0%, rgba(8, 14, 18, 0.25) 46%, rgba(8, 14, 18, 0) 70%); }
#paused, #fatal { align-items: center; justify-content: center; background: rgba(8, 14, 18, 0.55); }
.sheet { max-width: 470px; }
h1 { font-size: 52px; line-height: 1.02; margin: 0 0 10px; letter-spacing: -0.02em; }
h2 { font-size: 38px; margin: 0 0 8px; }
.lede { font-size: 20px; margin: 0 0 16px; color: var(--foam); }
.how { list-style: none; padding: 0; margin: 0 0 20px; font-size: 17px; line-height: 1.4; color: #d9e8e7; }
.how li { margin: 0 0 6px; padding-left: 16px; position: relative; }
.how li::before { content: ""; position: absolute; left: 0; top: 0.55em; width: 7px; height: 7px; border-radius: 50%; background: var(--buoy); }
button { font: inherit; cursor: pointer; }
.primary { background: var(--buoy); color: #1d0b03; border: 0; border-radius: 14px; padding: 16px 44px; font-size: 22px; font-weight: 800; box-shadow: 0 6px 18px rgba(255, 106, 43, 0.35); }
.primary:active { background: var(--buoy-deep); transform: translateY(1px); }
.quiet { background: rgba(238, 247, 245, 0.1); color: var(--foam); border: 1px solid rgba(238, 247, 245, 0.2); border-radius: 12px; padding: 11px 18px; font-size: 16px; text-decoration: none; display: inline-block; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.small { font-size: 15px; margin: 12px 0 0; }
.muted { color: var(--muted); }
.keys { margin-top: 6px; }
#result-table { border-collapse: collapse; margin: 6px 0 4px; font-size: 18px; font-variant-numeric: tabular-nums; }
#result-table td { padding: 5px 18px 5px 0; }
#result-table tr.you td { color: #ffe0cf; font-weight: 700; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 8px; vertical-align: -1px; }
@media (max-height: 600px) { h1 { font-size: 40px; } .how { font-size: 15px; } #stroke { width: 120px; height: 120px; } #race-moves { right: calc(25px + var(--safe-r)); bottom: calc(156px + var(--safe-b)); gap: 5px; } #super-boost, #take-flight { min-width: 112px; padding: 8px 10px; } #feedback { bottom: 128px; } }

@media (max-height: 600px) { .overlay { overflow-y: auto; align-items: flex-start; } .sheet { margin-top: auto; } }
