/* Layout: one column, thumb-reachable buttons at the bottom of each step.
   Built for bright sun: high contrast ink on a pale fairway-tinted paper. */
:root {
  --paper: #f3f5ef;
  --card: #ffffff;
  --ink: #12170f;
  --muted: #55604f;
  --line: #cfd6c7;
  --fairway: #1f6b3a;
  --fairway-ink: #ffffff;
  --fairway-soft: #dcebdc;
  --flag: #c2410c;
  --flag-soft: #fde4d6;
  --corridor: rgba(31, 107, 58, 0.22);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --font-num: "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f140e;
    --card: #182016;
    --ink: #eef3ea;
    --muted: #a5b19e;
    --line: #2d3829;
    --fairway: #5fbf7d;
    --fairway-ink: #0b1309;
    --fairway-soft: #1d3322;
    --flag: #fb923c;
    --flag-soft: #3a2215;
    --corridor: rgba(95, 191, 125, 0.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.45 var(--font);
  -webkit-text-size-adjust: 100%;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; }
h1, h2 { text-wrap: balance; margin: 0; line-height: 1.15; }
h1 { font-size: 2.2rem; letter-spacing: -0.02em; }
h2 { font-size: 1.5rem; }
:focus-visible { outline: 3px solid var(--fairway); outline-offset: 2px; }

.screen { min-height: 100%; }
.pad {
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 16px;
}
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.row.wrap { flex-wrap: wrap; }
.row.wrap > * { flex: 1 1 140px; }
.grow { flex: 2 1 160px; }
.center { text-align: center; align-self: center; }

.eyebrow { margin: 0; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.lede { margin: 0; color: var(--muted); }
.label { margin: 0 0 6px; font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.hint { margin: 0; font-size: 0.88rem; color: var(--muted); }
.error { margin: 0; color: var(--flag); font-weight: 600; }

.btn {
  min-height: 48px; padding: 10px 16px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--card); font-weight: 600;
}
.btn.primary { background: var(--fairway); border-color: var(--fairway); color: var(--fairway-ink); }
.btn.ghost { background: transparent; }
.btn.big { min-height: 58px; font-size: 1.1rem; }
.btn.huge { min-height: 96px; font-size: 1.5rem; border-radius: 20px; }
.btn:disabled { opacity: 0.45; }
.link { background: none; border: 0; padding: 10px 4px; color: var(--fairway); font-weight: 600; min-height: 44px; }
.link.danger { color: var(--flag); }
.link.light { color: #fff; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; color: var(--muted); font-weight: 600; }
.field input {
  min-height: 48px; padding: 8px 12px; border-radius: 10px;
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink); font-weight: 500;
}
.field.small { flex: 1 1 90px; }

/* Start */
.start-card { max-width: 34rem; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; padding-top: 24px; }
.needs { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: 6px; }

/* Header bar */
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px max(12px, env(safe-area-inset-right, 0px)) 8px max(12px, env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--line);
}
.status { display: flex; gap: 6px; flex-wrap: wrap; }
.bar-links { display: flex; }
.pill {
  font-size: 0.8rem; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  background: var(--flag-soft); color: var(--flag); font-variant-numeric: tabular-nums;
}
.pill.ok { background: var(--fairway-soft); color: var(--fairway); }

/* Home */
.hole-row { display: flex; align-items: center; justify-content: space-between; }
.stepper { display: flex; align-items: center; gap: 8px; }
.step { width: 48px; height: 48px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); font-size: 1.4rem; }
.hole-num { min-width: 2.2ch; text-align: center; font: 700 1.8rem var(--font-num); font-variant-numeric: tabular-nums; }
.club-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.club-grid button {
  min-height: 48px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--card);
  font-weight: 700; font-variant-numeric: tabular-nums;
}
.club-grid button.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.tally { display: flex; justify-content: center; gap: 16px; color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; }

.timer { font: 700 3rem var(--font-num); font-variant-numeric: tabular-nums; text-align: center; }

/* Chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.col { flex-direction: column; }
.chip {
  flex: 1 1 auto; min-height: 50px; padding: 8px 14px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--card); font-weight: 600;
}
.chip.on { border-color: var(--fairway); background: var(--fairway-soft); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--fairway); }

/* Aim */
.aim { position: fixed; inset: 0; background: #000; color: #fff; }
.aim video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.aim-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) max(16px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 16px) max(16px, env(safe-area-inset-left, 0px));
}
.aim-instr { margin: 0; font-weight: 700; font-size: 1.1rem; text-align: center; text-shadow: 0 1px 4px #000; background: rgba(0,0,0,0.35); border-radius: 12px; padding: 10px; }
.crosshair { position: absolute; left: 50%; top: 45%; width: 120px; height: 120px; transform: translate(-50%, -50%); pointer-events: none; }
.crosshair::before, .crosshair::after { content: ""; position: absolute; background: #fff; box-shadow: 0 0 3px #000; }
.crosshair::before { left: 50%; top: 0; bottom: 0; width: 2px; transform: translateX(-1px); }
.crosshair::after { top: 50%; left: 0; right: 0; height: 2px; transform: translateY(-1px); }
.aim-bottom { display: flex; flex-direction: column; gap: 10px; }
.heading-read { text-align: center; font: 700 2.4rem var(--font-num); font-variant-numeric: tabular-nums; text-shadow: 0 1px 4px #000; }
.heading-read small { display: block; font-size: 0.95rem; font-weight: 600; }
.aim-warn { margin: 0; background: #c2410c; color: #fff; border-radius: 10px; padding: 8px 12px; font-weight: 600; text-align: center; }

/* Find */
.find-top { display: flex; align-items: center; gap: 16px; padding: 12px max(16px, env(safe-area-inset-right, 0px)) 4px max(16px, env(safe-area-inset-left, 0px)); }
.arrow-wrap { flex: 0 0 132px; height: 132px; border-radius: 50%; background: var(--card); border: 1.5px solid var(--line); display: grid; place-items: center; }
#arrow { width: 104px; height: 104px; fill: var(--fairway); transition: transform 0.25s ease-out; }
.find-read { min-width: 0; }
.yards { font: 800 3.6rem/1 var(--font-num); font-variant-numeric: tabular-nums; }
.yards small { font-size: 1.1rem; font-weight: 700; margin-left: 4px; color: var(--muted); }
.find-status { margin: 6px 0 0; font-weight: 700; }
.find-status.in { color: var(--fairway); }
.find-timer { margin: 4px 0 0; font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.map { display: block; width: calc(100% - 32px); max-width: 100%; height: 42vh; margin: 8px auto; border-radius: 14px; background: var(--card); border: 1.5px solid var(--line); }

/* Result + results */
.facts { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-variant-numeric: tabular-nums; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 700; }
.verdict-in { color: var(--fairway); }
.verdict-out { color: var(--flag); }

.gate { display: flex; flex-direction: column; gap: 8px; }
.gate-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.gate-big { font: 800 2.6rem/1 var(--font-num); font-variant-numeric: tabular-nums; }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); }
.checks li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.checks li:first-child { border-top: 0; }
.mark { font-weight: 800; }
.mark.pass { color: var(--fairway); }
.mark.fail { color: var(--flag); }
.note { background: var(--fairway-soft); border-radius: 12px; padding: 12px; font-size: 0.95rem; }
.note p { margin: 0 0 6px; }
.note p:last-child { margin: 0; }

.table-wrap { overflow-x: auto; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); }
table { border-collapse: collapse; width: 100%; font-size: 0.88rem; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 10px; text-align: left; border-top: 1px solid var(--line); white-space: nowrap; }
th { border-top: 0; color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; }
td .link { min-height: 0; padding: 0; }
.club-table input { width: 4.5em; min-height: 40px; padding: 4px 8px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); }

.sim {
  position: fixed; right: 8px; top: 30%; z-index: 50; opacity: 0.92; display: flex; flex-direction: column; gap: 6px;
  background: var(--card); border: 1.5px solid var(--flag); border-radius: 12px; padding: 10px; font-size: 0.85rem;
}
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 20px); transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 12px; font-weight: 600; z-index: 60; max-width: calc(100% - 32px);
}

/* Prop + swing */
.prop-overlay { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.prop-ui { pointer-events: none; }
.prop-ui button { pointer-events: auto; }
.prop-top { display: flex; gap: 10px; align-items: flex-start; }
.prop-msgs { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.prop-cancel { flex: 0 0 auto; background: rgba(0,0,0,0.45); color: #fff; border-color: rgba(255,255,255,0.5); }
.prop-status { margin: 0; text-align: center; font-weight: 700; font-size: 1.15rem; text-shadow: 0 1px 4px #000; background: rgba(0,0,0,0.35); border-radius: 12px; padding: 10px; }
.prop-status:empty { display: none; }
.swing-frame, .swing-clip { width: 100%; max-width: 100%; border-radius: 12px; background: #000; display: block; }
.map-switch { display: flex; justify-content: center; }
.leaflet-container { font: inherit; }

@media (prefers-reduced-motion: reduce) { #arrow { transition: none; } }
