/* ============================================================
   Blaze Mazer's Amazeing Golf — brand stylesheet  (v3)
   Mobile-first. "Championship clubhouse" look: deep fairway
   green + gold, cream scorecard cards, big confident type.
   Colorblind-safe: state is shown by LUMINANCE contrast +
   shape + text — never by hue alone.
   NOTE: assets are cached for a year — when you edit this file,
   bump the ?v= number on every <link rel="stylesheet"> tag.
   ============================================================ */

:root {
  /* Brand palette */
  --green:        #0a5c2e;   /* tournament green */
  --green-2:      #0e4424;   /* panel green */
  --green-deep:   #07351d;
  --green-bright: #2ecc71;   /* accent */
  --gold:         #ffd66b;   /* highlight / CTA */
  --gold-deep:    #e3b53d;
  --muted:        #93a89b;
  --ink:          #14201a;
  --paper:        #f3f5f0;
  --cream:        #fffaf0;
  --white:        #ffffff;
  --line:         #e2e8e0;

  /* Score category colors (ALWAYS shown with a text label too) */
  --cat-eagle:  #7b5cff;
  --cat-birdie: #2ecc71;
  --cat-par:    #3aa0ff;
  --cat-bogey:  #ffb340;
  --cat-double: #ff7a45;
  --cat-triple: #e54848;

  --radius: 16px;
  --shadow:    0 10px 30px rgba(7, 32, 17, 0.10);
  --shadow-lg: 0 14px 40px rgba(7, 32, 17, 0.28);
  --maxw: 560px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

body { line-height: 1.5; }

img { max-width: 100%; display: block; }

a { color: var(--green); font-weight: 600; }

/* visible keyboard/tap focus everywhere */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--gold-deep);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- Layout ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 18px; }

.page { min-height: 100svh; display: flex; flex-direction: column; }

/* ---------- Top bar ---------- */
.topbar {
  background: linear-gradient(180deg, var(--green-deep) 0%, var(--green) 100%);
  color: var(--white);
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 14px rgba(7, 32, 17, 0.35);
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brandmark { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; font-weight: 800; letter-spacing: .2px; }
.brandmark a { color: var(--white); text-decoration: none; display: flex; align-items: center; gap: 9px; }
.brandmark .logo { height: 40px; width: auto; display: block; filter: drop-shadow(0 1px 2px rgba(0,0,0,.28)); }
.brandmark .up-link { font-size: .72rem; font-weight: 700; color: var(--gold); opacity: .9; letter-spacing: .3px; }
.brandmark .up-link:hover { opacity: 1; }
.navlinks { display: flex; gap: 16px; font-size: .92rem; }
.navlinks a { color: var(--white); opacity: .9; text-decoration: none; font-weight: 700; padding: 4px 0; }
.navlinks a:hover { opacity: 1; }
.navlinks a[aria-current="page"] {
  opacity: 1; color: var(--gold);
  text-decoration: underline; text-decoration-thickness: 3px;
  text-decoration-color: var(--gold-deep); text-underline-offset: 7px;
}

/* ---------- Hero — fairway stripes + spotlight ---------- */
.hero {
  background:
    repeating-linear-gradient(90deg,
      rgba(255,255,255,.030) 0 64px, rgba(255,255,255,0) 64px 128px),
    radial-gradient(130% 90% at 50% 0%, var(--green) 0%, var(--green-deep) 78%);
  color: var(--white);
  text-align: center;
  padding: 38px 0 44px;
  border-bottom: 4px solid var(--gold-deep);
}
.hero h1 {
  font-size: clamp(1.9rem, 7vw, 2.6rem);
  font-weight: 900; letter-spacing: -.5px;
  margin: 0 0 10px; line-height: 1.08;
  text-shadow: 0 2px 14px rgba(0,0,0,.28);
}
.hero .tag {
  color: var(--gold); font-weight: 800; text-transform: uppercase;
  letter-spacing: 2.5px; font-size: .76rem; margin-bottom: 12px;
}
.hero p { color: rgba(255,255,255,.92); max-width: 34ch; margin: 0 auto 22px; font-size: .98rem; }

/* ---------- Two-door hero (home) ---------- */
.doors { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 430px; margin: 0 auto; }
.door {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  text-decoration: none;
  border-radius: 18px; padding: 20px 12px 16px;
  box-shadow: var(--shadow-lg);
  transition: transform .08s ease, box-shadow .15s ease;
}
.door:active { transform: translateY(2px); }
.door:hover { transform: translateY(-2px); }
/* Door A — the headline action: solid GOLD */
.door-gold { background: linear-gradient(180deg, var(--gold) 0%, #f6c64f 100%); color: var(--green-deep); border: 2px solid var(--gold-deep); }
/* Door B — solid WHITE */
.door-white { background: var(--white); color: var(--ink); border: 2px solid #e8e2cf; }
.door-ic { font-size: 2.5rem; line-height: 1; margin-bottom: 10px; }
.door-t { font-weight: 900; font-size: 1.02rem; letter-spacing: -.2px; }
.door-d { font-weight: 600; font-size: .84rem; opacity: .82; margin-top: 3px; min-height: 2.4em; }
.door-go {
  margin-top: 10px; font-weight: 900; font-size: .85rem;
  padding: 8px 16px; border-radius: 999px;
}
.door-gold .door-go { background: var(--green-deep); color: var(--gold); }
.door-white .door-go { background: var(--green); color: var(--white); }

/* returning-player quick chips in the hero ("Your tournaments") */
.quickrow { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; max-width: 430px; margin: 18px auto 0; }
.quickrow .qlabel { width: 100%; font-size: .72rem; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; color: var(--gold); }
.qchip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--white); color: var(--green-deep);
  font-weight: 800; font-size: .88rem; text-decoration: none;
  padding: 10px 16px; border-radius: 999px;
  border: 2px solid var(--gold-deep); box-shadow: 0 4px 14px rgba(0,0,0,.28);
  transition: transform .06s ease;
}
.qchip:active { transform: translateY(1px); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; flex-direction: row; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-weight: 800; font-size: 1rem;
  min-height: 52px; padding: 13px 20px; border-radius: 14px; border: 2px solid transparent;
  text-decoration: none; cursor: pointer; width: 100%;
  transition: transform .06s ease, filter .15s ease, box-shadow .15s ease;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 3px 10px rgba(7,32,17,.14);
}
.btn:active { transform: translateY(1px); box-shadow: 0 1px 4px rgba(7,32,17,.18); }
.btn-primary { background: linear-gradient(180deg, var(--gold) 0%, #f6c64f 100%); color: var(--green-deep); border-color: var(--gold-deep); }
.btn-primary:hover { filter: brightness(1.04); }
.btn-green   { background: var(--green); color: var(--white); border-color: var(--green-deep); }
.btn-outline { background: rgba(7,32,17,.25); color: var(--white); border-color: rgba(255,255,255,.8); box-shadow: none; }
.btn-ghost   { background: var(--white); color: var(--green); border-color: #d3ddd3; }
.btn-outline2 { background: transparent; color: var(--green); border-color: var(--green); box-shadow: none; }
.btn-tiktok { background: #111; color: #fff; border-color: #000; }
.btn-tiktok:hover { filter: brightness(1.15); }
.btn-ig { background: linear-gradient(95deg, #7b2ff7 0%, #e1306c 50%, #ff9f45 100%); color: #fff; border-color: #c52f73; }
.btn-ig:hover { filter: brightness(1.06); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; pointer-events: none; box-shadow: none; }
.btn .sub { font-weight: 600; font-size: .76rem; opacity: .8; margin-left: 2px; }

.btn-row { display: grid; gap: 12px; margin: 14px 0; }

/* ---------- Cards / sections ---------- */
.card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); margin: 16px 0;
}
.section { padding: 28px 0 8px; }
.section h2 {
  font-size: 1.3rem; font-weight: 900; letter-spacing: -.2px;
  margin: 0 0 14px; color: var(--green-deep);
  position: relative; padding-bottom: 10px;
}
.section h2::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 34px; height: 4px; border-radius: 2px; background: var(--gold-deep);
}
.section.center h2 { text-align: center; }
.section.center h2::after { left: 50%; transform: translateX(-50%); }
.section .lead { color: #46564b; margin-top: -6px; }

/* funnel steps */
.steps { display: grid; gap: 16px; margin: 8px 0; }
.step { display: flex; gap: 13px; align-items: flex-start; }
.step .n {
  flex: 0 0 34px; height: 34px; border-radius: 50%;
  background: var(--green); color: #fff; font-weight: 800;
  display: flex; align-items: center; justify-content: center; font-size: 1rem;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.18);
}
.step .t { font-weight: 800; color: var(--green-deep); }
.step .d { color: #4c5b50; font-size: .94rem; margin-top: 1px; }

/* book block — cover stacks above the buttons on phones, sits beside them on wider screens */
.book { display: flex; flex-direction: column; align-items: stretch; gap: 16px; }
.book img { width: 160px; margin: 0 auto; border-radius: 10px; box-shadow: var(--shadow-lg); }
@media (min-width: 540px) {
  .book { flex-direction: row; align-items: center; gap: 18px; }
  .book img { width: 130px; margin: 0; }
}

/* ---------- Footer ---------- */
.foot { margin-top: auto; background: var(--green-deep); color: rgba(255,255,255,.88); text-align: center; padding: 24px 0; font-size: .86rem; border-top: 4px solid var(--gold-deep); }
.foot a { color: var(--gold); }

/* ============================================================
   Colorblind-safe badges — shape/letter + text label, never color alone
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 800; font-size: .8rem; line-height: 1;
  padding: 5px 10px 5px 6px; border-radius: 999px;
  border: 2px solid currentColor; background: #fff;
}
.badge .glyph {
  width: 18px; height: 18px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .72rem; color: #fff; font-weight: 900;
}
/* category badges: distinct shape-letter in the glyph so they read without color */
.cat-ACE    { color: var(--gold-deep);  }
.cat-EAGLE  { color: var(--cat-eagle);  }
.cat-BIRDIE { color: var(--cat-birdie); }
.cat-PAR    { color: var(--cat-par);    }
.cat-BOGEY  { color: var(--cat-bogey);  }
.cat-DOUBLE { color: var(--cat-double); }
.cat-TRIPLE { color: var(--cat-triple); }
.cat-ACE    .glyph { background: transparent; font-size: .9rem; }  /* 🎉 emoji — let it show, no circle */
.cat-EAGLE  .glyph { background: var(--cat-eagle);  }
.cat-BIRDIE .glyph { background: var(--cat-birdie); }
.cat-PAR    .glyph { background: var(--cat-par);    }
.cat-BOGEY  .glyph { background: var(--cat-bogey);  }
.cat-DOUBLE .glyph { background: var(--cat-double); }
.cat-TRIPLE .glyph { background: var(--cat-triple); }

/* status notes (success / warn / error) — icon + label, not color only */
/* block (NOT flex): flex made every text run + <b> its own item → words stacked into
   unreadable columns. Block lets the message flow as a normal sentence; .ic just leads it. */
.note { display: block; padding: 12px 14px; border-radius: 12px; font-size: .92rem; line-height: 1.45; border: 1px solid; }
.note .ic { font-weight: 900; margin-right: 6px; }
.note-ok   { background: #eafaf0; border-color: #9fd9b5; color: #14532d; }
.note-warn { background: #fff7e6; border-color: #f0c97a; color: #7a5200; }
.note-err  { background: #fdecea; border-color: #f0a89f; color: #8a1c10; }
.note-info { background: #eaf3fd; border-color: #9cc4ef; color: #11406e; }

/* ============================================================
   Pill tabs (hero) + segmented time control
   Active state = solid gold / solid green (big luminance jump),
   never a hue-only change.
   ============================================================ */
.pillrow { display: flex; gap: 9px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.pill {
  font-family: inherit; font-weight: 800; font-size: .88rem; cursor: pointer;
  padding: 10px 14px; border-radius: 999px;
  background: rgba(7,32,17,.45); color: var(--white); border: 2px solid rgba(255,255,255,.55);
  -webkit-tap-highlight-color: transparent;
  transition: transform .06s ease;
}
.pill:active { transform: translateY(1px); }
.pill[aria-pressed="true"] {
  background: linear-gradient(180deg, var(--gold) 0%, #f6c64f 100%);
  color: var(--green-deep); border-color: var(--gold-deep);
  box-shadow: 0 4px 14px rgba(0,0,0,.3);
}

/* segmented control (time windows, inside a light card) */
.pillrow-sub {
  display: inline-flex; gap: 0; justify-content: flex-start; flex-wrap: nowrap;
  margin: 0 0 14px; padding: 4px;
  background: #ebefe9; border: 1px solid #d8e0d8; border-radius: 999px;
}
.pill-sm {
  font-family: inherit; font-weight: 700; font-size: .85rem; cursor: pointer;
  padding: 8px 16px; border-radius: 999px; border: none;
  background: transparent; color: #44544a;
  -webkit-tap-highlight-color: transparent;
}
.pill-sm[aria-pressed="true"] {
  background: var(--green); color: var(--white); font-weight: 800;
  box-shadow: 0 2px 8px rgba(7,32,17,.3);
}

/* light-background select/input (cards on light pages) — doubled class beats
   the maker's dark .input rule that appears later in this file */
.input.input-light, select.input.input-light { background: #fff; color: var(--ink); border-color: #cfdacf; }

/* ---------- Maker UI (dark theater) ---------- */
.maker { background: #0c1710; color: #fff; }
.maker a { color: var(--gold); }
.maker .wrap { padding-top: 14px; padding-bottom: 28px; }

.stepblock { background: #16251b; border: 1px solid #2a4232; border-radius: var(--radius); padding: 18px; margin: 14px 0; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.stepblock.is-locked { opacity: .42; pointer-events: none; }
.stephead { display: flex; align-items: center; gap: 11px; margin: 0 0 12px; }
.stephead .n { flex: 0 0 28px; height: 28px; border-radius: 50%; background: linear-gradient(180deg, var(--gold) 0%, #f6c64f 100%); color: var(--green-deep); font-weight: 900; display: flex; align-items: center; justify-content: center; font-size: .92rem; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.stephead h3 { margin: 0; font-size: 1.1rem; font-weight: 800; letter-spacing: -.2px; }

.field { margin: 13px 0; }
.field label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 6px; }
.input, select.input {
  width: 100%; font-family: inherit; font-size: 1rem; padding: 12px;
  border-radius: 12px; border: 2px solid #35523f; background: #0b1810; color: #fff;
}
.input:focus { border-color: var(--gold-deep); outline: none; }
.input.input-light:focus, select.input.input-light:focus { border-color: var(--green); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* video + timeline — compact (46svh) so video + scrub + buttons share one screen */
.stage { position: relative; width: 100%; aspect-ratio: 9 / 16; max-height: 46svh; background: #000; border-radius: 14px; overflow: hidden; margin: 0 auto; border: 1px solid #2a4232; }
.stage video, .stage canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
/* result video keeps the big view */
#result .stage { max-height: 56svh; }

/* ---- marking buttons ON the video (no scroll between watching & tapping) ---- */
.stagebtns {
  position: absolute; left: 0; right: 0; bottom: 8px; z-index: 5;
  display: flex; justify-content: center; gap: 6px;
  pointer-events: none;              /* gaps still pan the video */
}
.sbtn {
  pointer-events: auto;
  flex: 0 0 auto;
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.2rem; line-height: 1; cursor: pointer;
  background: rgba(8, 20, 12, .78); color: #fff;
  border: 2px solid rgba(255, 255, 255, .45);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .45);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  transition: transform .06s ease;
}
.sbtn:active { transform: scale(.92); background: rgba(8, 20, 12, .95); }
.sbtn-stroke { border-color: var(--gold); }
/* mouseover / keyboard-focus tooltip (+1 · +2 Tree · +2 Water · +2 Sand …) */
.sbtn::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 9px); left: 50%; transform: translateX(-50%);
  background: #0b1810; color: #fff; border: 1px solid var(--gold-deep);
  font-size: .72rem; font-weight: 800; white-space: nowrap;
  padding: 5px 9px; border-radius: 8px;
  opacity: 0; pointer-events: none; transition: opacity .12s ease; z-index: 6;
}
.sbtn:hover::after, .sbtn:focus-visible::after { opacity: 1; }
/* keep edge tooltips on-screen */
.stagebtns .sbtn:first-child::after { left: 0; transform: none; }
.stagebtns .sbtn:last-child::after { left: auto; right: 0; transform: none; }
.markhint { text-align: center; margin: 6px 0 2px; }

/* ---- the hole chip (auto-set; tap to fix) ---- */
.holechip {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #0b1810; border: 1px solid #35523f; border-radius: 12px;
  padding: 10px 12px; font-size: .92rem; line-height: 1.35;
}
.holechip b { color: var(--gold); }
.chip-ok { color: var(--green-bright); font-weight: 800; font-size: .78rem; white-space: nowrap; }
.maker .linkbtn { background: #15231b; border-color: #35523f; color: var(--gold); flex: 0 0 auto; }
.timeline { position: relative; height: 46px; margin: 14px 0 4px; border-radius: 9px; background: #0b1810; border: 1px solid #35523f; }
.timeline .progress { position: absolute; top: 0; left: 0; height: 100%; background: rgba(46,204,113,.18); border-right: 2px solid var(--green-bright); }
.timeline .mark { position: absolute; top: -7px; width: 2px; height: calc(100% + 14px); background: var(--gold); }
.timeline .mark .pin { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); background: var(--gold); color: var(--green-deep); font-weight: 900; font-size: .68rem; padding: 1px 5px; border-radius: 6px; white-space: nowrap; }
.timeline .startmark { position: absolute; top: -7px; width: 3px; height: calc(100% + 14px); background: var(--green-bright); }
.timeline .startmark .pin { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); background: var(--green-bright); color: #06381f; font-weight: 900; font-size: .62rem; padding: 1px 5px; border-radius: 6px; white-space: nowrap; }

.marklist { display: grid; gap: 8px; margin: 10px 0; }
.markrow { display: flex; align-items: center; gap: 8px; background: #0b1810; border: 1px solid #35523f; border-radius: 12px; padding: 8px 10px; }
.markrow .when { font-variant-numeric: tabular-nums; font-weight: 800; min-width: 60px; color: var(--gold); }
.markrow select { flex: 1; }
.markrow .del { background: transparent; border: 1px solid #5a3030; color: #ffb0a8; border-radius: 8px; padding: 7px 10px; font-weight: 800; cursor: pointer; }

/* Scrub slider (marking) — big, high-contrast gold thumb so it's unmistakable + touch-friendly */
#scrub { -webkit-appearance: none; appearance: none; width: 100%; height: 34px; background: transparent; cursor: pointer; }
#scrub::-webkit-slider-runnable-track { height: 12px; border-radius: 7px; background: #20382a; border: 1px solid #4a6b54; }
#scrub::-moz-range-track { height: 12px; border-radius: 7px; background: #20382a; border: 1px solid #4a6b54; }
#scrub::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 32px; height: 32px; margin-top: -11px; border-radius: 50%; background: var(--gold, #ffd66b); border: 3px solid var(--green-deep, #06381f); box-shadow: 0 2px 6px rgba(0,0,0,.55); }
#scrub::-moz-range-thumb { width: 32px; height: 32px; border-radius: 50%; background: var(--gold, #ffd66b); border: 3px solid var(--green-deep, #06381f); box-shadow: 0 2px 6px rgba(0,0,0,.55); }

.controls { display: flex; gap: 9px; flex-wrap: wrap; margin: 12px 0; }
.controls .btn { width: auto; flex: 1; padding: 12px 14px; min-height: 50px; }
.btn-mark { background: linear-gradient(180deg, var(--gold) 0%, #f6c64f 100%); color: var(--green-deep); border-color: var(--gold-deep); }

/* Frame-the-page tools (flip / zoom / reset) under the marking preview */
.frametools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0 2px; }
.frametools .btn { width: auto; flex: 0 0 auto; min-height: 44px; padding: 9px 13px; }
.frametools #flip[aria-pressed="true"] { background: var(--gold); color: var(--green-deep); border-color: var(--gold-deep); }
.zoomwrap { flex: 1 1 150px; min-width: 140px; }
.zoomwrap label { display: block; font-weight: 700; font-size: .82rem; margin-bottom: 2px; color: #cfe8d8; }
.zoomwrap #zoomval { color: var(--gold); }
#zoom { -webkit-appearance: none; appearance: none; width: 100%; height: 30px; background: transparent; cursor: pointer; }
#zoom::-webkit-slider-runnable-track { height: 10px; border-radius: 6px; background: #20382a; border: 1px solid #4a6b54; }
#zoom::-moz-range-track { height: 10px; border-radius: 6px; background: #20382a; border: 1px solid #4a6b54; }
#zoom::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 26px; height: 26px; margin-top: -9px; border-radius: 50%; background: var(--gold); border: 3px solid var(--green-deep); box-shadow: 0 2px 5px rgba(0,0,0,.5); }
#zoom::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: var(--gold); border: 3px solid var(--green-deep); box-shadow: 0 2px 5px rgba(0,0,0,.5); }
#preview { cursor: grab; }
#preview:active { cursor: grabbing; }

/* "or" divider before the photo-entry path */
.orline { display: flex; align-items: center; gap: 12px; margin: 22px 2px 6px; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: 2px; font-size: .74rem; }
.orline::before, .orline::after { content: ""; flex: 1; height: 1px; background: #2a4232; }

.scoreline { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.05rem; margin-top: 6px; }

/* progress bar (text % always shown alongside) */
.bar { height: 16px; background: #0b1810; border: 1px solid #35523f; border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--green-bright), #6fe3a1); transition: width .2s; }
.barwrap { margin: 10px 0; }
.barwrap .pct { font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- Leaderboard ---------- */
.lb { display: grid; gap: 9px; }
.lbrow {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center;
  background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 11px 13px;
  box-shadow: 0 3px 12px rgba(7,32,17,.06);
}
.lbrow .rank {
  width: 32px; height: 32px; border-radius: 50%;
  background: #eef3ee; color: var(--green-deep); font-weight: 900; font-size: .92rem;
  display: flex; align-items: center; justify-content: center;
}
.lbrow .rank.medal { background: transparent; font-size: 1.5rem; }
.lbrow .who { font-weight: 800; color: var(--green-deep); }
.lbrow .who small { display: block; color: #69786d; font-weight: 600; margin-top: 1px; }
.lbrow .who small .tourtag { color: var(--green-deep); font-weight: 800; }
.lbrow .sc { text-align: right; }
/* the prominent running score (±par) — the headline number on each standings row */
.lbrow .sc .scorechip {
  display: inline-block; font-weight: 900; font-size: 1.02rem; color: var(--green-deep);
  background: var(--cream); border: 1px solid #cfe0d2; border-radius: 8px;
  padding: 2px 9px; vertical-align: middle;
}
.lbrow.is-blaze { border-left: 6px solid var(--gold-deep); background: var(--cream); }

/* entry/player badges on rows */
.lbrow .sc .badge { margin: 2px 0 2px 4px; }
.bdg { font-size: .72rem; padding: 4px 8px 4px 5px; }
.bdg .glyph { width: 16px; height: 16px; font-size: .64rem; }
.bdg-posted   { color: #6d28d9; } .bdg-posted .glyph   { background: #6d28d9; }
.bdg-verified { color: #14532d; } .bdg-verified .glyph { background: #14532d; }
.bdg-beat     { color: #9a3412; } .bdg-beat .glyph     { background: #9a3412; }
.bdg-proof    { color: #0e7490; } .bdg-proof .glyph    { background: #0e7490; }
.bdg-snap     { color: #b45309; } .bdg-snap .glyph     { background: #b45309; }
.bdg-blaze    { color: #92660a; } .bdg-blaze .glyph    { background: #92660a; }
.bdg-front9   { color: #1d4ed8; } .bdg-front9 .glyph   { background: #1d4ed8; }
.bdg-round    { color: #be185d; } .bdg-round .glyph    { background: #be185d; }
.bdg-complete { color: #14532d; } .bdg-complete .glyph { background: #14532d; }

/* watch-links: a player's name links to their posted run. Underlined + the ▶︎ glyph
   so it reads as a link by shape, not color (colorblind-safe); gold on hover/focus. */
.lbrow .who a { color: var(--green-deep); text-decoration: underline; text-underline-offset: 2px; }
.lbrow .who a:hover, .lbrow .who a:focus-visible { color: var(--gold-deep); }

/* small inline action buttons in list rows (groups page) */
.gactions { display: flex; gap: 6px; align-items: center; }
.linkbtn {
  background: #fff; border: 1.5px solid #cfdacf; color: var(--green);
  font-family: inherit; font-weight: 700; font-size: .78rem;
  padding: 8px 11px; border-radius: 9px; cursor: pointer;
}
.linkbtn-x { color: #8a1c10; border-color: #f0a89f; }

/* ---------- Post-link row (maker) + join row (groups) ---------- */
.postrow { display: flex; gap: 8px; align-items: stretch; }
.postrow .input { flex: 1; min-width: 0; }
.postrow .btn { width: auto; flex: 0 0 auto; padding: 12px 14px; white-space: nowrap; }

/* ---------- Proof snapshot strip (the non-poster entry path) ---------- */
.proofstrip { display: flex; gap: 9px; overflow-x: auto; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
.proofstrip .proof { margin: 0; flex: 0 0 auto; }
.proofstrip img { width: 92px; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 9px; border: 2px solid #3a5a47; display: block; }
.proofstrip figcaption { text-align: center; font-size: .7rem; font-weight: 700; color: var(--muted); margin-top: 4px; }

/* ---------- "Prop your phone" guide (modal + inline) ---------- */
.modal {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(7, 32, 17, .62); backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0; animation: modalfade .15s ease;
}
@media (min-width: 600px) { .modal { align-items: center; padding: 24px; } }
@keyframes modalfade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  position: relative; width: 100%; max-width: var(--maxw);
  max-height: 92svh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--line); border-top: 5px solid var(--gold-deep);
  border-radius: 20px 20px 0 0; padding: 18px 18px 22px;
  box-shadow: var(--shadow-lg);
}
@media (min-width: 600px) { .modal-card { border-radius: 18px; } }
.modal-x {
  position: absolute; top: 12px; right: 12px; z-index: 1;
  width: 38px; height: 38px; border-radius: 50%;
  background: #fff; border: 1.5px solid var(--line); color: var(--green-deep);
  font-size: 1.05rem; font-weight: 900; cursor: pointer;
}
.modal-h { margin: 2px 0 6px; font-size: 1.3rem; font-weight: 900; color: var(--green-deep); padding-right: 40px; }
.modal-done { margin-top: 16px; }

.rig-intro { color: #46564b; margin: 4px 0 16px; }
.rig { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 12px 0; box-shadow: var(--shadow); }
.rig-head { display: flex; align-items: flex-start; gap: 11px; margin-bottom: 10px; }
.rig-n { flex: 0 0 30px; height: 30px; border-radius: 50%; background: var(--green); color: #fff; font-weight: 900; display: flex; align-items: center; justify-content: center; }
.rig-title { font-weight: 900; color: var(--green-deep); line-height: 1.2; }
.rig-tag { font-weight: 700; font-size: .82rem; color: var(--gold-deep); margin-top: 2px; }
.rig-figure { margin: 0 0 10px; background: linear-gradient(180deg, #f7faf6, #eef3ec); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.rig-svg { width: 100%; height: auto; display: block; }
.rig-steps { margin: 0; padding-left: 20px; }
.rig-steps li { margin: 5px 0; color: #3c4a40; font-size: .92rem; }
.rig-steps li b { color: var(--green-deep); }

/* ---------- PWA install banner ---------- */
.install-banner {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 200;
  display: flex; align-items: center; gap: 10px;
  background: var(--green); color: #fff; border: 2px solid var(--green-deep);
  border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow-lg);
  max-width: var(--maxw); margin: 0 auto; font-size: .92rem;
}
.install-banner .ib-txt { flex: 1; }
.install-banner .ib-go { background: var(--gold); color: var(--green-deep); border: none; font-weight: 900; padding: 9px 14px; border-radius: 10px; font-family: inherit; }
.install-banner .ib-x { background: transparent; color: #fff; border: none; font-size: 1.1rem; font-weight: 900; padding: 4px 6px; }

/* stale result (player edited their run after rendering) */
#result.is-stale #out { opacity: .5; filter: grayscale(.4); }

.hide { display: none !important; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.spinner { display:inline-block; width:16px; height:16px; border:2px solid rgba(255,255,255,.35); border-top-color:#fff; border-radius:50%; animation:spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
