/* Golden Hour Open — warm paper, ink and honey. */

/* The two typefaces ship with the game (SIL Open Font License 1.1, assets/fonts/LICENSE-FONTS.txt):
   Cinzel for titles and labels, Inter for interface text, so it looks the same on every computer. */
@font-face { font-family: "Cinzel"; font-weight: 500; font-style: normal; font-display: swap; src: url("./assets/fonts/cinzel-latin-500.woff2") format("woff2"); }
@font-face { font-family: "Cinzel"; font-weight: 700; font-style: normal; font-display: swap; src: url("./assets/fonts/cinzel-latin-700.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 100 900; font-style: normal; font-display: swap; src: url("./assets/fonts/inter-latin-variable.woff2") format("woff2"); }

:root {
  --ink: #2e241a;
  --ink-soft: #5b4a38;
  --paper: #f7eedb;
  --paper-2: #efe1c3;
  --paper-edge: rgba(94, 70, 40, 0.28);
  --honey: #e0a44a;
  /* Every use is text on the cream paper: #b87a2a was 3.0:1 there, this deep honey is 6.0:1 (5.1:1 on the darkest paper). */
  --honey-deep: #7a4f12;
  --green: #45613a;
  --green-soft: #7c9a5e;
  --rose: #c9705a;
  --sky: #9fb8c8;
  --shadow: 0 10px 30px rgba(40, 26, 10, 0.28), 0 2px 6px rgba(40, 26, 10, 0.2);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: "Inter", "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  --display: "Cinzel", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-back: cubic-bezier(0.34, 1.56, 0.64, 1);
  /* The painted interface kit (assets/ui/kit, cut from painted sheets by scripts/prepare-golden-ui-kit.py). */
  --kit-paper: url("./assets/ui/paper.webp");
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #2d2419; color: var(--ink); font-family: var(--serif); -webkit-font-smoothing: antialiased; }
body { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
#app { position: fixed; inset: 0; overflow: hidden; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--honey); outline-offset: 3px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- loading */
.loading { position: absolute; inset: 0; display: grid; place-content: center; gap: 22px; justify-items: center; background: url("./assets/ui/loading-backdrop.webp") center / cover no-repeat, #2d2419; color: var(--paper); transition: opacity 0.8s var(--ease-out); z-index: 50; }
.loading.done { opacity: 0; pointer-events: none; }
.loading-note { max-width: min(420px, 80vw); text-align: center; font-family: var(--sans); font-size: 14px; line-height: 1.45; color: var(--honey); }
.loading-logo { width: min(440px, 74vw); height: auto; filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.45)); }
/* The bar is the painted slider: groove and fill (assets/ui/kit). */
.loading-bar { --cap: 9px; position: relative; width: min(340px, 62vw); height: 18px;
  background: url("./assets/ui/kit/slider-groove-cap-l.webp") left / var(--cap) 100% no-repeat, url("./assets/ui/kit/slider-groove-cap-r.webp") right / var(--cap) 100% no-repeat, url("./assets/ui/kit/slider-groove-mid.webp") var(--cap) 0 / calc(100% - 2 * var(--cap)) 100% no-repeat; }
.loading-bar i { --cap: 9px; position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--p, 0) * 100%); transition: width 0.3s;
  background: url("./assets/ui/kit/slider-fill-cap-l.webp") left / var(--cap) 100% no-repeat, url("./assets/ui/kit/slider-fill-cap-r.webp") right / var(--cap) 100% no-repeat, url("./assets/ui/kit/slider-fill-mid.webp") var(--cap) 0 / calc(100% - 2 * var(--cap)) 100% no-repeat; }

/* On a big screen the cards' type was the size it is on a laptop (12 px on 1920 x 1080): --ui grows the HUD's type and its
   badge, steps and map with the window (verifier N8). Small screens keep their own rules below (--ui stays 1). */
.hud { --ui: 1; }
@media (min-width: 1600px) and (min-height: 860px) { .hud { --ui: 1.25; } }
@media (min-width: 2200px) and (min-height: 1200px) { .hud { --ui: 1.55; } }
/* ---------------------------------------------------------------- HUD cards */
.hud { position: absolute; inset: 0; pointer-events: none; }
.hud[hidden] { display: none; }
.hud-card {
  position: absolute; pointer-events: auto;
  /* A painted frame (nine-sliced) around the parchment; the paper is clipped to the frame's rounded outer edge. */
  border: 11px solid transparent; border-image: url("./assets/ui/kit/card-frame.webp") 16 / 11px stretch; border-radius: 13px;
  background: var(--kit-paper) center / 512px repeat, #f6ecd2; background-blend-mode: multiply;
  filter: drop-shadow(0 6px 10px rgba(40, 26, 10, 0.3));
}
.hole-card { top: max(14px, env(safe-area-inset-top)); left: max(14px, env(safe-area-inset-left)); padding: 2px 8px 2px 2px; min-width: calc(230px * var(--ui, 1)); }
.hc-top { display: flex; align-items: center; gap: 12px; }
.hc-no { font-size: calc(36px * var(--ui, 1)); line-height: 1; width: calc(52px * var(--ui, 1)); height: calc(52px * var(--ui, 1)); display: grid; place-items: center; background: url("./assets/ui/kit/badge-hole.webp") center / 100% 100% no-repeat; color: var(--paper); font-weight: 600; text-shadow: 0 1px 2px rgba(20, 30, 10, 0.55); }
.hc-no[data-icon]::before { content: ""; display: block; width: 66%; height: 66%; background: var(--icon) center / contain no-repeat; filter: drop-shadow(0 1px 1px rgba(20, 30, 10, 0.5)); }
.hc-meta { display: grid; }
.hc-name { font-size: calc(19px * var(--ui, 1)); font-style: italic; }
.hc-par { font-family: var(--sans); font-size: calc(12px * var(--ui, 1)); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.hc-bottom { display: flex; gap: 12px; margin-top: 8px; padding-top: 7px; border-top: 1px dashed var(--paper-edge); font-family: var(--sans); font-size: calc(13px * var(--ui, 1)); color: var(--ink-soft); }
.hc-player { font-weight: 600; color: var(--ink); }
.hc-score { margin-left: auto; font-weight: 700; color: var(--green); }

.map-card {
  top: max(14px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right)); padding: 0;
  /* Painted brass corner brackets on the map plate. */
  background:
    url("./assets/ui/kit/corner-bracket.webp") left 0 top 0 / 22px auto no-repeat,
    url("./assets/ui/kit/corner-bracket-tr.webp") right 0 top 0 / 22px auto no-repeat,
    url("./assets/ui/kit/corner-bracket-bl.webp") left 0 bottom 0 / 22px auto no-repeat,
    url("./assets/ui/kit/corner-bracket-br.webp") right 0 bottom 0 / 22px auto no-repeat,
    var(--kit-paper) center / 512px repeat, #f6ecd2;
  background-blend-mode: normal, normal, normal, normal, multiply, normal;
}
/* The map card fits its picture: as wide as --map-w, but no taller than --map-cap (a long narrow hole is a narrow card). */
.map-canvas { display: block; width: min(calc(var(--map-w, 120px) * var(--ui, 1)), calc(var(--map-cap, 34vh) * var(--map-aspect, 0.6))); height: auto; border-radius: 9px; }

/* The lower-left column: yardage pill above the club card. The golfer stands bottom centre, clear of it. */
.hud-stack { position: absolute; left: max(14px, env(safe-area-inset-left)); bottom: max(14px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: flex-start; gap: 10px; pointer-events: none; }
.hud-stack > .hud-card { position: relative; }
.club-card { padding: 0 2px; }
.club-row { display: flex; align-items: center; gap: 8px; }
.club-step { width: calc(38px * var(--ui, 1)); height: calc(38px * var(--ui, 1)); padding: 0; border: 0; background: var(--glyph) center / 15px auto no-repeat, url("./assets/ui/kit/round-button.webp") center / 100% 100% no-repeat; font-size: 0; }
.club-step.up { --glyph: url("./assets/ui/kit/triangle-up.webp"); }
.club-step.down { --glyph: url("./assets/ui/kit/triangle-down.webp"); }
.club-step:active { background: var(--glyph) center 55% / 15px auto no-repeat, url("./assets/ui/kit/round-button-pressed.webp") center / 100% 100% no-repeat; }
.club-text { display: grid; min-width: calc(132px * var(--ui, 1)); text-align: center; }
.club-name { font-family: var(--display); font-weight: 700; font-size: calc(18px * var(--ui, 1)); letter-spacing: 0.03em; }
.club-carry { font-family: var(--sans); font-size: calc(12px * var(--ui, 1)); color: var(--ink-soft); letter-spacing: 0.04em; }
.traj-row { display: flex; gap: 4px; margin-top: 6px; }
.traj {
  --cap: 11px;
  flex: 1; border: 0; border-radius: 5px; padding: 4px 10px; font-family: var(--sans); font-size: calc(12px * var(--ui, 1)); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft);
  background: url("./assets/ui/kit/plate-small-cap-l.webp") left / var(--cap, 26px) 100% no-repeat, url("./assets/ui/kit/plate-small-cap-r.webp") right / var(--cap, 26px) 100% no-repeat, url("./assets/ui/kit/plate-small-mid.webp") var(--cap, 26px) 0 / calc(100% - 2 * var(--cap, 26px)) 100% no-repeat;
}
.traj.on {
  color: var(--paper);
  background: url("./assets/ui/kit/green-cap-l.webp") left / var(--cap, 26px) 100% no-repeat, url("./assets/ui/kit/green-cap-r.webp") right / var(--cap, 26px) 100% no-repeat, url("./assets/ui/kit/green-mid.webp") var(--cap, 26px) 0 / calc(100% - 2 * var(--cap, 26px)) 100% no-repeat;
}
.hud.putting .traj-row { display: none; }

.info-card {
  --cap: 27px;
  display: flex; align-items: center; gap: 18px; padding: 8px 30px; border: 0; border-image: none; border-radius: 999px;
  /* A painted capsule: both round ends at their own size, the middle stretched. */
  background: url("./assets/ui/kit/pill-frame-cap-l.webp") left / var(--cap, 26px) 100% no-repeat, url("./assets/ui/kit/pill-frame-cap-r.webp") right / var(--cap, 26px) 100% no-repeat, url("./assets/ui/kit/pill-frame-mid.webp") var(--cap, 26px) 0 / calc(100% - 2 * var(--cap, 26px)) 100% no-repeat, var(--kit-paper) center / 512px repeat, #f6ecd2;
  background-blend-mode: normal, normal, normal, multiply, normal;
}
.info-dist { display: grid; text-align: center; }
.to-pin { font-family: var(--display); font-weight: 700; font-size: calc(24px * var(--ui, 1)); line-height: 1.05; letter-spacing: 0.02em; }
.info-sub { font-family: var(--sans); font-size: calc(12px * var(--ui, 1)); text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-soft); }
.info-lie { display: grid; font-family: var(--sans); font-size: calc(13px * var(--ui, 1)); }
.lie { font-weight: 700; }
.lie[data-lie="bunker"], .lie[data-lie="deep-rough"] { color: var(--rose); }
.plays { color: var(--ink-soft); font-size: calc(12px * var(--ui, 1)); }
.wind { display: flex; align-items: center; gap: 6px; font-family: var(--sans); font-size: calc(13px * var(--ui, 1)); }
.wind-arrow { position: relative; width: calc(28px * var(--ui, 1)); height: calc(28px * var(--ui, 1)); background: url("./assets/ui/kit/wind-disc.webp") center / 100% 100% no-repeat; transition: transform 0.4s var(--ease-out); }
.wind-arrow::after { content: ""; position: absolute; inset: 5px 7px; background: url("./assets/ui/kit/wind-arrow.webp") center / contain no-repeat; }

/* ---------------------------------------------------------------- meter */
.meter { position: absolute; right: max(26px, env(safe-area-inset-right)); top: 50%; transform: translateY(-40%); width: 46px; height: min(46vh, 380px); pointer-events: none; opacity: 0.55; transition: opacity 0.3s; }
.meter.active { opacity: 1; }
/* The track is painted in three parts (brass cap, stretched channel, brass cap); the window, snap line, pointer and pace mark are painted pieces too. */
.meter-track {
  --vcap: 25px;
  position: absolute; inset: 0 6px 26px; overflow: visible; filter: drop-shadow(0 6px 8px rgba(40, 26, 10, 0.32));
  background: url("./assets/ui/kit/meter-track-cap-t.webp") top / 100% var(--vcap) no-repeat, url("./assets/ui/kit/meter-track-cap-b.webp") bottom / 100% var(--vcap) no-repeat, url("./assets/ui/kit/meter-track-mid.webp") 0 var(--vcap) / 100% calc(100% - 2 * var(--vcap)) no-repeat;
}
.meter-fill { position: absolute; left: 6px; right: 6px; border-radius: 9px 9px 3px 3px; background: url("./assets/ui/kit/meter-fill.webp") center bottom / 100% 100% no-repeat; }
.meter.putt .meter-fill { background-image: url("./assets/ui/kit/meter-fill-putt.webp"); }
.meter-window { position: absolute; left: -5px; right: -5px; background: url("./assets/ui/kit/meter-window.webp") center / 100% 100% no-repeat; }
.meter.putt .meter-window, .meter.putt .meter-snap { display: none; }
.meter-snap { position: absolute; left: -9px; right: -9px; bottom: calc(0.32 / 1.32 * 100%); height: 7px; margin-bottom: -3px; background: url("./assets/ui/kit/meter-snap.webp") center / 100% 100% no-repeat; }
.meter-tick { position: absolute; left: 3px; width: 9px; height: 4px; margin-bottom: -2px; background: url("./assets/ui/kit/meter-snap.webp") center / 100% 100% no-repeat; opacity: 0.8; }
.meter-marker { position: absolute; left: -19px; width: 17px; height: 16px; transform: translateY(50%); background: url("./assets/ui/kit/meter-pointer.webp") center / 100% 100% no-repeat; }
.meter-marker.falling { background-image: url("./assets/ui/kit/meter-pointer-fall.webp"); }
.meter-pace { position: absolute; left: -10px; right: -10px; height: 10px; transform: translateY(50%); background: url("./assets/ui/kit/meter-pace.webp") center / 100% 100% no-repeat; pointer-events: none; }
.meter-pace[hidden] { display: none; }
.meter-label { position: absolute; bottom: 0; left: -30px; right: -24px; text-align: center; font-family: var(--sans); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--paper); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
.meter.flash-pure .meter-track { animation: pure 0.6s var(--ease-out); }
.meter.flash-miss .meter-track { animation: miss 0.4s var(--ease-out); }
@keyframes pure { 0% { filter: drop-shadow(0 0 3px rgba(246, 211, 139, 1)) drop-shadow(0 6px 8px rgba(40, 26, 10, 0.32)); } 100% { filter: drop-shadow(0 0 18px rgba(246, 211, 139, 0)) drop-shadow(0 6px 8px rgba(40, 26, 10, 0.32)); } }
@keyframes miss { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* ---------------------------------------------------------------- messages */
/* The caddie's line and the swing coach hang from the top centre, between the hole card and the map. */
.hud-messages { position: absolute; top: max(14px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; width: max-content; max-width: min(calc(560px * var(--ui, 1)), max(240px, calc(100vw - 560px * var(--ui, 1)))); pointer-events: none; }
.caddie-line {
  --cap: 16px;
  max-width: 100%; padding: 6px 26px; border-radius: 999px; color: var(--paper); font-style: italic; font-size: calc(15px * var(--ui, 1)); text-align: center;
  background: url("./assets/ui/kit/pill-frame-cap-l.webp") left / var(--cap, 26px) 100% no-repeat, url("./assets/ui/kit/pill-frame-cap-r.webp") right / var(--cap, 26px) 100% no-repeat, url("./assets/ui/kit/pill-frame-mid.webp") var(--cap, 26px) 0 / calc(100% - 2 * var(--cap, 26px)) 100% no-repeat, rgba(46, 36, 26, 0.78);
}
.caddie-line:empty { display: none; }
.coach {
  --cap: 18px;
  max-width: 100%; padding: 8px 30px; border-radius: 999px; color: var(--ink); font-family: var(--sans); font-size: calc(14px * var(--ui, 1)); text-align: center;
  background: url("./assets/ui/kit/pill-frame-cap-l.webp") left / var(--cap, 26px) 100% no-repeat, url("./assets/ui/kit/pill-frame-cap-r.webp") right / var(--cap, 26px) 100% no-repeat, url("./assets/ui/kit/pill-frame-mid.webp") var(--cap, 26px) 0 / calc(100% - 2 * var(--cap, 26px)) 100% no-repeat, var(--kit-paper) center / 512px repeat, #f6ecd2;
  background-blend-mode: normal, normal, normal, multiply, normal;
  filter: drop-shadow(0 4px 8px rgba(40, 26, 10, 0.3));
}
.coach[hidden] { display: none; }
.caddie-line.fade-in { animation: fadeUp 0.5s var(--ease-out); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.toast { position: absolute; left: 50%; top: 22%; transform: translate(-50%, -10px) scale(0.9); opacity: 0; font-size: clamp(26px, 3.4vw, 40px); font-style: italic; color: var(--paper); text-shadow: 0 2px 10px rgba(40, 20, 0, 0.55); transition: opacity 0.35s, transform 0.35s var(--ease-back); pointer-events: none; white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.toast[data-tone="good"] { color: #ffe3a3; }
.toast[data-tone="bad"] { color: #ffd5c8; }
.score-card { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%) scale(0.6) rotate(-3deg); opacity: 0; display: grid; justify-items: center; gap: 4px; padding: 8px 30px 6px; border: 28px solid transparent; border-image: url("./assets/ui/kit/plate-tab.webp") 38 fill / 28px stretch; filter: drop-shadow(0 18px 30px rgba(40, 20, 0, 0.4)); pointer-events: none; transition: opacity 0.3s, transform 0.5s var(--ease-back); }
.score-card.show { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-1deg); }
.score-card strong { font-size: clamp(34px, 5vw, 60px); font-style: italic; font-weight: 500; }
.score-card span { font-family: var(--sans); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); }
.score-card[data-tone="birdie"] strong, .score-card[data-tone="eagle"] strong, .score-card[data-tone="ace"] strong { color: var(--rose); }
.score-card[data-tone="par"] strong { color: var(--green); }
.putt-reader { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.target-reticle { position: fixed; left: 0; top: 0; width: 64px; height: 64px; background: url("./assets/ui/kit/aim-reticle.webp") center / 100% 100% no-repeat; pointer-events: none; opacity: 0; transition: opacity 0.25s; }

/* ---------------------------------------------------------------- touch */
.swing-pad, .pause-button { display: none; }
.swing-pad { background: url("./assets/ui/kit/swing-pad.webp") center / 100% 100% no-repeat; border: 0; padding: 0; color: var(--ink); font-family: var(--sans); font-weight: 800; letter-spacing: 0.12em; touch-action: none; filter: drop-shadow(0 6px 10px rgba(40, 26, 10, 0.35)); }
.swing-pad:active { background-image: url("./assets/ui/kit/swing-pad-pressed.webp"); transform: scale(0.97); }
/* The mouse swings too: the pad sits left of the power meter (a touch screen has it at the corner, below). */
@media (pointer: fine) and (min-width: 641px) {
  .swing-pad { display: grid; place-items: center; position: absolute; pointer-events: auto; right: calc(max(26px, env(safe-area-inset-right)) + 62px); bottom: 24px; width: 92px; height: 92px; }
  .pause-button { display: block; right: calc(max(14px, env(safe-area-inset-right)) + 160px); }
}
.pause-button { position: absolute; pointer-events: auto; top: max(14px, env(safe-area-inset-top)); right: calc(max(14px, env(safe-area-inset-right)) + 146px); width: 46px; height: 46px; padding: 0; border: 0; background: url("./assets/ui/kit/pause-glyph.webp") center / 12px auto no-repeat, url("./assets/ui/kit/round-button.webp") center / 100% 100% no-repeat; }
.pause-button:active { background: url("./assets/ui/kit/pause-glyph.webp") center 55% / 12px auto no-repeat, url("./assets/ui/kit/round-button-pressed.webp") center / 100% 100% no-repeat; }
/* The pause glyph is painted (kit/pause-glyph.webp) on the round button. */
@media (pointer: coarse) {
  .swing-pad { display: grid; place-items: center; position: absolute; pointer-events: auto; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); width: 104px; height: 104px; }
  .pause-button { display: flex; }
  .meter { right: max(136px, calc(env(safe-area-inset-right) + 128px)); }
}
@media (max-height: 500px) {
  .hole-card { min-width: 0; padding: 0 4px 0 0; }
  .hc-no { width: 36px; height: 36px; font-size: 26px; }
  .hc-name { font-size: 15px; }
  .hc-bottom { margin-top: 4px; padding-top: 4px; font-size: 11px; }
  .map-canvas { --map-w: 78px; }
  .club-card { padding: 0 2px; }
  .club-name { font-size: 16px; }
  .club-text { min-width: 96px; }
  .club-step { width: 30px; height: 30px; }
  .info-card { --cap: 22px; gap: 10px; padding: 4px 24px; }
  .hud-stack { gap: 6px; }
  .to-pin { font-size: 20px; }
  .hud-messages { gap: 5px; }
  .caddie-line { font-size: 12px; padding: 4px 12px; }
  .coach { font-size: 12px; padding: 5px 12px; }
  .meter { height: 56vh; top: 44%; }
  .swing-pad { width: 86px; height: 86px; }
  .pause-button { right: calc(max(14px, env(safe-area-inset-right)) + 100px); }
}
/* Desktop: the power meter hangs from the bottom edge and the map card is held to what is left above it, so the
   tallest map (a long, narrow hole) can never run down across the meter (round 2 verifier, B7). */
@media (pointer: fine) and (min-width: 641px) {
  .hud { --meter-h: min(46vh, 380px); }
  .meter { top: auto; bottom: 24px; transform: none; }
  .map-canvas { --map-cap: min(34vh, calc(100vh - var(--meter-h) - 72px)); }
}
@media (pointer: fine) and (min-width: 641px) and (max-height: 500px) {
  .hud { --meter-h: 56vh; }
}
/* The website adds a "back to the game page" pill at the top left of the demo: keep the cards clear of it. */
body:has(.exit-link) .hole-card { top: max(50px, calc(env(safe-area-inset-top) + 40px)); }
body:has(.exit-link) .menu-column { padding-top: max(52px, env(safe-area-inset-top)); }
/* ...and the panels: the pill sat on the frame's top-left corner of every career card and of the end card. */
body:has(.exit-link) .mode-screen, body:has(.exit-link) .screen.sheet { padding-top: max(52px, env(safe-area-inset-top)); }
/* A sheet's panel then fits under the pill (a taller one centred upward over it on a phone held sideways), and the
   yardage book starts below it. */
body:has(.exit-link) .screen.sheet:not(.mode-screen) > .panel { max-height: calc(100vh - max(52px, env(safe-area-inset-top)) - 16px); }
@media (max-height: 500px) { body:has(.exit-link) .yardage-book { top: calc(50% + 24px); max-height: calc(100vh - 72px); } }

/* Phones held upright: the cards must share a 390 px width without sitting on each other. */
@media (max-width: 640px) and (orientation: portrait) {
  .hole-card { min-width: 0; max-width: calc(100vw - 178px); padding: 0 4px 0 0; }
  .hc-top { gap: 8px; }
  .hc-no { width: 38px; height: 38px; font-size: 26px; }
  .hc-name { font-size: 16px; }
  .hc-par { font-size: 10px; letter-spacing: 0.04em; }
  .hc-bottom { margin-top: 5px; padding-top: 4px; font-size: 12px; }
  .map-canvas { --map-w: 70px; --map-cap: 24vh; }
  .pause-button { right: calc(max(14px, env(safe-area-inset-right)) + 90px); }
  .club-card { padding: 0 2px; }
  .club-row { gap: 6px; }
  .club-step { width: 30px; height: 30px; }
  .club-text { min-width: 84px; }
  .club-name { font-size: 18px; }
  /* Portrait: the yardage pill and the lines sit under the hole card, over the sky; the bottom belongs to the golfer. */
  .hud-stack > .info-card { position: fixed; left: max(14px, env(safe-area-inset-left)); top: calc(max(14px, env(safe-area-inset-top)) + 100px); gap: 12px; padding: 6px 26px; }
  .to-pin { font-size: 22px; }
  .hud-messages { top: calc(max(14px, env(safe-area-inset-top)) + 168px); left: max(14px, env(safe-area-inset-left)); transform: none; align-items: flex-start; max-width: calc(100vw - 120px); }
  .caddie-line, .coach { font-size: 13px; text-align: left; }
  .coach { padding: 6px 14px; }
  .toast { top: 34%; }
  /* The power bar rides the right edge, clear of the putt line in the middle of the view (verifier N6); the swing pad sits below it. */
  .meter { height: min(40vh, 320px); top: 46%; right: max(14px, calc(env(safe-area-inset-right) + 8px)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
/* Touch screens and windows 500 px high or less (a phone on its side): no HUD label under the 12 px touch floor.
   Seen at 844 x 390: "to the pin" was 10 px; the golfer, stroke and score line, the trajectory plates and the meter's
   label 11 px. Larger --ui sizes keep their own. */
@media (pointer: coarse), (max-height: 500px) {
  .info-sub { font-size: max(12px, calc(10px * var(--ui, 1))); }
  .traj { font-size: max(12px, calc(11px * var(--ui, 1))); }
  .meter-label { font-size: 12px; }
}
@media (max-height: 500px) { .hc-bottom { font-size: 12px; } }
/* Touch: the club arrows and the trajectory plates are controls, at least 44 x 44 CSS px (verifier Wave A r2, B2: 30 x 30 and 23 tall). */
@media (pointer: coarse) {
  .club-step { width: max(44px, calc(38px * var(--ui, 1))); height: max(44px, calc(38px * var(--ui, 1))); }
  .traj { min-height: 44px; }
  /* The caddie's line and the swing tips are sentences: body text, 16 px on touch (12 px on a short window before). */
  .caddie-line { font-size: max(16px, calc(15px * var(--ui, 1))); }
  .coach { font-size: max(16px, calc(14px * var(--ui, 1))); }
}
