/* ============================================================
   Blaze Mazer's Amazeing Golf — brand stylesheet
   Mobile-first. Colorblind-safe: status never relies on color
   alone — always pair with an icon/shape + text label.
   ============================================================ */

:root {
  /* Brand palette */
  --green:        #0a5c2e;   /* tournament green */
  --green-deep:   #074021;
  --green-bright: #2ecc71;   /* accent */
  --gold:         #ffd66b;   /* highlight / CTA */
  --gold-deep:    #e3b53d;
  --muted:        #93a89b;
  --ink:          #0e1a12;
  --paper:        #f6f8f5;
  --white:        #ffffff;

  /* 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: 14px;
  --shadow: 0 6px 24px rgba(7, 32, 17, 0.18);
  --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.45; }

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

a { color: var(--green); }

/* ---------- 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: var(--green);
  color: var(--white);
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 10px rgba(7, 32, 17, 0.25);
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brandmark { display: flex; align-items: center; font-weight: 800; letter-spacing: .2px; }
.brandmark a { color: var(--white); text-decoration: none; display: flex; align-items: center; gap: 9px; }
.brandmark .logo { height: 42px; width: auto; display: block; filter: drop-shadow(0 1px 2px rgba(0,0,0,.28)); }
.navlinks { display: flex; gap: 14px; font-size: .92rem; }
.navlinks a { color: var(--white); opacity: .92; text-decoration: none; font-weight: 600; }
.navlinks a:hover, .navlinks a[aria-current="page"] { opacity: 1; text-decoration: underline; }

/* ---------- Hero ---------- */
.hero {
  background: radial-gradient(120% 80% at 50% 0%, var(--green) 0%, var(--green-deep) 100%);
  color: var(--white);
  text-align: center;
  padding: 34px 0 40px;
}
.hero h1 { font-size: clamp(1.7rem, 6vw, 2.4rem); margin: 0 0 8px; line-height: 1.1; }
.hero .tag { color: var(--gold); font-weight: 800; text-transform: uppercase; letter-spacing: 1.5px; font-size: .8rem; margin-bottom: 12px; }
.hero p { color: rgba(255,255,255,.9); max-width: 30ch; margin: 0 auto 20px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-weight: 800; font-size: 1.02rem;
  padding: 15px 20px; border-radius: var(--radius); border: 2px solid transparent;
  text-decoration: none; cursor: pointer; width: 100%;
  transition: transform .06s ease, filter .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--gold); 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: transparent; color: var(--white); border-color: rgba(255,255,255,.65); }
.btn-ghost   { background: var(--white); color: var(--green); border-color: #d8e3da; }
.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: .5; pointer-events: none; }
.btn .sub { font-weight: 600; font-size: .78rem; opacity: .8; }

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

/* ---------- Cards / sections ---------- */
.card {
  background: var(--white); border: 1px solid #e3eae4; border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); margin: 16px 0;
}
.section { padding: 26px 0; }
.section h2 { font-size: 1.25rem; margin: 0 0 6px; color: var(--green-deep); }
.section .lead { color: #46564b; margin-top: 0; }

/* funnel steps */
.steps { display: grid; gap: 12px; margin: 8px 0; }
.step { display: flex; gap: 12px; align-items: flex-start; }
.step .n {
  flex: 0 0 30px; height: 30px; border-radius: 50%;
  background: var(--green); color: #fff; font-weight: 800;
  display: flex; align-items: center; justify-content: center; font-size: .95rem;
}
.step .t { font-weight: 700; }
.step .d { color: #51604f; font-size: .94rem; }

/* book block */
.book { display: flex; gap: 16px; align-items: center; }
.book img { width: 116px; border-radius: 8px; box-shadow: var(--shadow); }

/* ---------- Footer ---------- */
.foot { margin-top: auto; background: var(--green-deep); color: rgba(255,255,255,.85); text-align: center; padding: 22px 0; font-size: .85rem; }
.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: .82rem; line-height: 1;
  padding: 5px 9px 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-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-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 */
.note { display: flex; gap: 9px; align-items: flex-start; padding: 11px 13px; border-radius: 10px; font-size: .9rem; border: 1px solid; }
.note .ic { font-weight: 900; }
.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; }

/* ---------- Maker UI ---------- */
.maker { background: var(--ink); color: #fff; }
.maker .wrap { padding-top: 14px; padding-bottom: 28px; }

.stepblock { background: #15231a; border: 1px solid #24382b; border-radius: var(--radius); padding: 16px; margin: 14px 0; }
.stepblock.is-locked { opacity: .45; pointer-events: none; }
.stephead { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.stephead .n { flex: 0 0 26px; height: 26px; border-radius: 50%; background: var(--gold); color: var(--green-deep); font-weight: 900; display: flex; align-items: center; justify-content: center; font-size: .9rem; }
.stephead h3 { margin: 0; font-size: 1.05rem; }

.field { margin: 12px 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: 10px; border: 2px solid #2f4a39; background: #0e1a12; color: #fff;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* video + timeline */
.stage { position: relative; width: 100%; aspect-ratio: 9 / 16; max-height: 64svh; background: #000; border-radius: 12px; overflow: hidden; margin: 0 auto; }
.stage video, .stage canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
.timeline { position: relative; height: 46px; margin: 12px 0 4px; border-radius: 8px; background: #0e1a12; border: 1px solid #2f4a39; }
.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: #0e1a12; border: 1px solid #2f4a39; border-radius: 10px; padding: 8px 10px; }
.markrow .when { font-variant-numeric: tabular-nums; font-weight: 800; min-width: 60px; }
.markrow select { flex: 1; }
.markrow .del { background: transparent; border: 1px solid #5a3030; color: #ffb0a8; border-radius: 8px; padding: 7px 10px; font-weight: 800; }

.controls { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.controls .btn { width: auto; flex: 1; padding: 13px 14px; }
.btn-mark { background: var(--gold); color: var(--green-deep); border-color: var(--gold-deep); }

.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: 14px; background: #0e1a12; border: 1px solid #2f4a39; border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0%; background: var(--green-bright); transition: width .2s; }
.barwrap { margin: 10px 0; }
.barwrap .pct { font-weight: 800; font-variant-numeric: tabular-nums; }

/* leaderboard */
.lb { display: grid; gap: 8px; }
.lbrow { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; background: #fff; border: 1px solid #e3eae4; border-radius: 10px; padding: 10px 12px; }
.lbrow .rank { font-weight: 900; color: var(--green); text-align: center; }
.lbrow .who { font-weight: 700; }
.lbrow .who small { display: block; color: #6a796d; font-weight: 600; }
.lbrow .sc { text-align: right; }

/* 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);
  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); } }
