/* Dfive Regatta — the game's own look. The sign-in card is signin.css's. */
:root {
  --navy: #0f2a4a;
  --ink: #0b1a2a;
  --paper: #f5f2ec;
  --glass: rgba(8, 24, 40, 0.52);
  --glass-strong: rgba(8, 24, 40, 0.78);
  --line: rgba(255, 255, 255, 0.22);
  --good: #7ee2a8;
  --warn: #ffd23f;
  --bad: #ff7a59;
  --sans: -apple-system, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --serif: "Cormorant", Georgia, "Times New Roman", serif;
}
html, body { margin: 0; height: 100%; background: #1d5a86; color: #fff; font-family: var(--sans); }
body { overflow: hidden; overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
body.signing-in { background: var(--paper); color: var(--ink); overflow: auto; }
#app { position: fixed; inset: 0; }
body.signing-in #app { position: static; min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px 16px; box-sizing: border-box; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; font-size: 18px; letter-spacing: 0.01em; }

canvas.scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* ── the HUD ──────────────────────────────────────────────────────────── */
.hud { position: absolute; inset: 0; pointer-events: none; user-select: none; -webkit-user-select: none;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) calc(env(safe-area-inset-right, 0px) + 10px)
           calc(env(safe-area-inset-bottom, 0px) + 10px) calc(env(safe-area-inset-left, 0px) + 10px); }
.hud button { pointer-events: auto; }
.top { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.clock { font-family: var(--serif); font-size: 34px; line-height: 1; font-weight: 500; font-variant-numeric: tabular-nums;
  background: var(--glass); padding: 6px 12px; border-radius: 12px; }
.status { font-size: 13px; line-height: 1.25; background: var(--glass); padding: 8px 10px; border-radius: 12px; min-height: 18px; }
.btns { display: flex; gap: 8px; }
.iconbtn { width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--glass); color: #fff; font-size: 22px; line-height: 1; cursor: pointer; }
.iconbtn:active { background: var(--glass-strong); }

.stack { position: absolute; display: flex; flex-direction: column; gap: 8px; width: 108px; }
.stack.left { left: calc(env(safe-area-inset-left, 0px) + 10px); top: calc(env(safe-area-inset-top, 0px) + 74px); }
.stack.right { right: calc(env(safe-area-inset-right, 0px) + 10px); top: calc(env(safe-area-inset-top, 0px) + 74px); align-items: flex-end; }
.tile { background: var(--glass); border-radius: 12px; padding: 7px 10px 6px; width: 108px; box-sizing: border-box; }
.tile .v { font-family: var(--serif); font-size: 26px; line-height: 1; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tile .l { font-size: 11px; opacity: 0.8; margin-top: 3px; letter-spacing: 0.02em; }
.stack.right .tile .v { font-size: 17px; padding-top: 4px; }
.tile.good .v { color: var(--good); } .tile.warn .v { color: var(--warn); } .tile.bad .v { color: var(--bad); }
.map { width: 108px; height: 108px; border-radius: 12px; background: var(--glass); }
.tells { width: 108px; height: 50px; border-radius: 12px; background: var(--glass); }

/* ── the controls ─────────────────────────────────────────────────────── */
.controls { position: absolute; left: calc(env(safe-area-inset-left, 0px) + 12px); right: calc(env(safe-area-inset-right, 0px) + 12px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 14px); display: grid; grid-template-columns: 1fr 64px; gap: 12px; align-items: end; }
.tiller, .sheet { pointer-events: auto; touch-action: none; position: relative; background: var(--glass); border-radius: 18px; }
.tiller { height: 76px; }
.tiller .track { position: absolute; left: 28px; right: 28px; top: 50%; height: 4px; margin-top: -2px; background: var(--line); border-radius: 2px; }
.tiller .track::before { content: ""; position: absolute; left: 50%; top: -8px; width: 2px; height: 20px; margin-left: -1px; background: var(--line); }
.knob { position: absolute; top: 50%; left: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 10px rgba(0,0,0,0.35); }
.sheet { width: 64px; height: 220px; }
.sheet .rail { position: absolute; top: 22px; bottom: 22px; left: 50%; width: 4px; margin-left: -2px; background: var(--line); border-radius: 2px; }
.thumb { position: absolute; left: 50%; top: 8%; width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 10px rgba(0,0,0,0.35); }
.hint { position: absolute; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.7; }
.tiller .hint { left: 12px; top: 6px; }
.sheet .hint { left: 50%; transform: translateX(-50%); bottom: 4px; }

/* ── overlays: menu, pause, finish ───────────────────────────────────── */
.overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(6, 20, 36, 0.45); padding: 16px; box-sizing: border-box; overflow: auto; }
.overlay[hidden] { display: none; }
.card { width: min(420px, 100%); background: var(--paper); color: var(--ink); border-radius: 18px; padding: 22px 20px; box-sizing: border-box;
  box-shadow: 0 16px 40px rgba(0,0,0,0.35); display: flex; flex-direction: column; gap: 10px; }
.card h1 { font-family: var(--serif); font-weight: 500; font-size: 34px; line-height: 1.05; margin: 0 0 4px; color: var(--navy); display: flex; align-items: center; gap: 10px; }
.beta { font-family: var(--sans); font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  background: #fff3d6; color: #7a4b00; border-radius: 99px; padding: 3px 8px; }
.card p { margin: 0; line-height: 1.4; }
.card .sub { font-size: 15px; }
.card .lbl { font-size: 13px; opacity: 0.75; margin-top: 2px; }
.card .big { font-family: var(--serif); font-size: 56px; line-height: 1; color: var(--navy); font-variant-numeric: tabular-nums; }
.card .notice { background: #fff3d6; border-radius: 10px; padding: 8px 10px; font-size: 14px; }
.seg { display: flex; gap: 6px; }
.segbtn { flex: 1; border: 1px solid rgba(15, 42, 74, 0.25); background: #fff; color: var(--navy); border-radius: 10px; padding: 10px 0; font-size: 15px; cursor: pointer; }
.segbtn.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn { border: 0; border-radius: 12px; padding: 14px 16px; font-size: 16px; background: #e4ded2; color: var(--ink); cursor: pointer; }
.btn.primary { background: var(--navy); color: #fff; }
.btn.ghost { background: transparent; color: var(--navy); text-decoration: underline; padding: 8px; }
.how, .log { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.45; }
.how li + li, .log li + li { margin-top: 6px; }
.log { font-variant-numeric: tabular-nums; max-height: 30vh; overflow: auto; }

@media (min-width: 700px) {
  .tiller { height: 88px; max-width: 520px; }
  .controls { grid-template-columns: 1fr 72px; justify-content: center; max-width: 620px; margin: 0 auto; }
  .stack { width: 124px; } .tile { width: 124px; } .map { width: 124px; height: 124px; } .tells { width: 124px; height: 57px; }
}
@media (max-height: 560px) {
  .sheet { height: 150px; }
  .stack.right .tile:last-child { display: none; }
}
