/* KandiPlay golf — mobile-first. Greens, white, bright accents. */
:root {
  --g900: #0b3d2e;
  --g800: #0f5a3a;
  --g700: #14804a;
  --g500: #10b981;
  --g300: #6ee7b7;
  --g100: #dcfce7;
  --g50: #f0fdf4;
  --lime: #a3e635;
  --sun: #fbbf24;
  --sun-d: #d97706;
  --sky: #0ea5e9;
  --sky-d: #0369a1;
  --coral: #fb7185;
  --coral-d: #be123c;
  --ink: #10231a;
  --muted: #5b6f64;
  --line: #d7e6dc;
  --paper: #f4faf5;
  --card: #ffffff;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(11, 61, 46, 0.06), 0 8px 24px rgba(11, 61, 46, 0.08);
  --font-body: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-head: 'Fredoka', 'Poppins', system-ui, sans-serif;
  --tab-h: 62px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  background-image: radial-gradient(1200px 400px at 50% -120px, #d6f5e1 0%, rgba(214, 245, 225, 0) 70%);
  line-height: 1.5;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
  min-height: 100vh;
}
h1, h2, h3, h4, .brand, .btn, .pos, .score, .hole-no, .key { font-family: var(--font-head); }
h1 { font-size: 1.7rem; line-height: 1.15; margin: 0 0 0.3rem; color: var(--g900); }
h2 { font-size: 1.3rem; margin: 0 0 0.6rem; color: var(--g900); }
h3 { font-size: 1.1rem; margin: 0 0 0.4rem; }
p { margin: 0 0 0.8rem; }
a { color: var(--g700); }
img, svg, video { max-width: 100%; }
.page, .tile, .card, .tracker-head { overflow-wrap: anywhere; }
code { background: var(--g100); padding: 0.1rem 0.4rem; border-radius: 6px; font-size: 0.9em; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.sr-only, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link:focus { position: fixed; top: 8px; left: 8px; z-index: 100; background: #fff; padding: 0.5rem 1rem; border-radius: 10px; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; border-radius: 6px; }

/* ---------- chrome ---------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.6rem 1rem; padding-top: calc(0.6rem + env(safe-area-inset-top));
  background: linear-gradient(135deg, var(--g800), var(--g700)); color: #fff;
  position: sticky; top: 0; z-index: 20; box-shadow: 0 2px 12px rgba(11, 61, 46, 0.25);
}
.brand { display: flex; align-items: center; gap: 0.5rem; color: #fff; text-decoration: none; font-size: 1.45rem; font-weight: 600; letter-spacing: 0.01em; }
.brand b { color: var(--lime); font-weight: 700; }
.top-nav { display: none; gap: 0.25rem; align-items: center; }
.top-nav a { color: #e6fff0; text-decoration: none; padding: 0.45rem 0.85rem; border-radius: 999px; font-weight: 500; font-size: 0.95rem; }
.top-nav a:hover { background: rgba(255, 255, 255, 0.14); }
.top-nav a.on { background: #fff; color: var(--g800); }
.top-nav .nav-account { margin-left: 0.5rem; border: 1.5px solid rgba(255, 255, 255, 0.55); }
.page { max-width: 1080px; margin: 0 auto; padding: 1rem 1rem 2rem; }
.site-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.6rem; padding: 1.5rem 1rem 2rem; color: var(--muted); font-size: 0.9rem; }
.tab-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(6, 1fr);
  background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -4px 18px rgba(11, 61, 46, 0.1);
}
.tab-bar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: var(--tab-h); color: var(--muted); text-decoration: none; font-size: 0.66rem; font-weight: 500; padding: 4px 2px; }
.tab-bar i { font-style: normal; font-size: 1.3rem; line-height: 1; filter: grayscale(0.7); }
.tab-bar a.on { color: var(--g800); font-weight: 600; }
.tab-bar a.on i { filter: none; transform: translateY(-1px) scale(1.1); }
.tab-bar a.on span { border-bottom: 2px solid var(--g500); }
@media (min-width: 820px) {
  .top-nav { display: flex; }
  .tab-bar { display: none; }
  body { padding-bottom: 0; }
  h1 { font-size: 2.1rem; }
}

.flash { padding: 0.75rem 1rem; border-radius: 14px; margin: 0 0 1rem; font-weight: 500; }
.flash-ok { background: var(--g100); color: var(--g900); border: 1px solid var(--g300); }
.flash-error { background: #fff1f2; color: var(--coral-d); border: 1px solid #fecdd3; }
.note { background: #fffbeb; border: 1px solid #fde68a; color: #78350f; padding: 0.7rem 1rem; border-radius: 12px; margin: 0 0 1rem; font-size: 0.92rem; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; border: 0; cursor: pointer; text-decoration: none;
  padding: 0.65rem 1.1rem; border-radius: 14px; font-size: 1rem; font-weight: 600; min-height: 44px; line-height: 1.1;
  transition: transform 0.08s ease, box-shadow 0.15s ease, filter 0.15s ease; color: #fff; background: var(--g700);
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn[disabled], .btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(180deg, #16a05a, var(--g700)); box-shadow: 0 4px 0 var(--g800); }
.btn-sun { background: linear-gradient(180deg, #fcd34d, var(--sun)); color: #5b3a05; box-shadow: 0 4px 0 var(--sun-d); }
.btn-sky { background: linear-gradient(180deg, #38bdf8, var(--sky)); box-shadow: 0 4px 0 var(--sky-d); }
.btn-gold { background: linear-gradient(180deg, #fbbf24, #f59e0b); color: #4a2a02; box-shadow: 0 4px 0 #b45309; }
.btn-ghost { background: #fff; color: var(--g800); border: 1.5px solid var(--line); }
.btn-danger { background: #fff1f2; color: var(--coral-d); border: 1.5px solid #fecdd3; }
.btn-lg { padding: 0.9rem 1.4rem; font-size: 1.1rem; border-radius: 16px; min-height: 52px; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.88rem; min-height: 36px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-all { display: block; margin: 0.8rem auto 0; background: #fff; color: var(--g800); border: 2px solid var(--g500); padding: 0.8rem 1.4rem; min-height: 48px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.6rem 0; }
.cta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; margin: 1rem 0; }
.cta-compact { grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); }
/* Buttons may wrap on narrow screens; min-width:0 stops long labels from stretching the grid past the viewport. */
.cta-grid .btn { min-width: 0; text-align: center; padding-left: 0.6rem; padding-right: 0.6rem; }
.cta-grid:not(.cta-compact) .btn-lg { font-size: 1rem; }

/* ---------- cards & tiles ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; margin: 0 0 1rem; box-shadow: var(--shadow); }
.card-warn { background: #fffbeb; border-color: #fde68a; }
.card-accent { background: linear-gradient(135deg, #f0fdf4, #ecfeff); border-color: var(--g300); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0.9rem; margin: 0.8rem 0 1.4rem; }
.tile {
  display: flex; flex-direction: column; gap: 0.25rem; padding: 1rem 1.1rem; border-radius: var(--radius); text-decoration: none; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-left: 6px solid var(--g500); box-shadow: var(--shadow); transition: transform 0.12s ease;
  position: relative; min-height: 88px;
}
.tile:hover { transform: translateY(-2px); }
.tile strong { font-family: var(--font-head); font-size: 1.15rem; color: var(--g900); }
.tile small { color: var(--muted); }
.tile .pill { align-self: flex-start; margin-top: 0.2rem; }
.tile-kind { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; color: var(--muted); }
.tile-player { border-left-color: var(--g500); background: linear-gradient(135deg, #fff, #f0fdf4); }
.tile-group { border-left-color: var(--sky); background: linear-gradient(135deg, #fff, #f0f9ff); }
.tile-tournament { border-left-color: var(--sun); background: linear-gradient(135deg, #fff, #fffbeb); }
.tile-course { border-left-color: var(--g800); }
.tile-pending { opacity: 0.75; border-left-style: dashed; }
.avatar { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: linear-gradient(135deg, var(--g500), var(--g800)); color: #fff; font-family: var(--font-head); font-weight: 600; font-size: 1rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.5rem; flex: none; }
.avatar-sky { background: linear-gradient(135deg, #38bdf8, var(--sky-d)); }
.avatar-gold { background: linear-gradient(135deg, #fcd34d, #d97706); }
.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0.4rem 0 1rem; }
.chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.8rem; border-radius: 999px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--g800); font-size: 0.9rem; font-weight: 500; }
a.chip:hover { background: var(--g100); }
.tee-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid rgba(0, 0, 0, 0.25); vertical-align: -2px; }
.pill { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.15rem 0.65rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; background: #e5e7eb; color: #374151; white-space: nowrap; }
.pill-live { background: #fee2e2; color: #b91c1c; }
.pill-live::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #ef4444; animation: pulse 1.4s infinite; }
.pill-live-soft { background: #fff7ed; color: #c2410c; }
.pill-done { background: #eef2f7; color: #475569; }
.pill-final { background: linear-gradient(135deg, #fde68a, #fbbf24); color: #78350f; }
.pill-verified { background: var(--g100); color: var(--g800); }
.topar-under { color: #0f7a43; } .topar-over { color: var(--coral-d); } .topar-even { color: var(--ink); } .topar-none { color: var(--muted); }
.pill.topar { background: #f1f5f9; font-size: 0.95rem; padding: 0.15rem 0.7rem; }
.pill.topar-under { background: var(--g100); } .pill.topar-over { background: #fff1f2; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.35; transform: scale(0.7); } }

/* ---------- sections ---------- */
.page-head { margin: 0.5rem 0 1rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-top: 1.6rem; }
.section-title { margin: 1.3rem 0 0.5rem; font-size: 1.2rem; }
.sub-title { margin: 1rem 0 0.4rem; font-size: 1rem; color: var(--g800); }
.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.empty.big { padding: 3rem 1rem; }
.empty img { margin-bottom: 0.5rem; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: center; margin: 0.4rem 0 1rem; }
.hero-art { width: 100%; height: auto; border-radius: 28px; box-shadow: var(--shadow); order: -1; }
.hero h1 { font-size: 1.9rem; overflow-wrap: anywhere; }
.lead { font-size: 1.05rem; color: #2f4a3c; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.78rem; font-weight: 600; color: var(--g700); margin-bottom: 0.3rem; }
@media (min-width: 820px) { .hero { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 2rem; } .hero-art { order: 0; } .hero h1 { font-size: 3rem; } }
.stats-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; margin: 1rem 0; }
.stats-strip div { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 0.7rem; text-align: center; box-shadow: var(--shadow); }
.stats-strip b { display: block; font-family: var(--font-head); font-size: 1.8rem; color: var(--g700); line-height: 1; }
.stats-strip span { font-size: 0.78rem; color: var(--muted); }
.steps { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.step { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; text-align: center; box-shadow: var(--shadow); }
.step h3 { margin-top: 0.4rem; }

/* ---------- forms ---------- */
.form, .form-grid { display: grid; gap: 0.8rem; }
.form-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: end; }
.form-grid .wide { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: end; }
.field { display: grid; gap: 0.25rem; font-weight: 500; font-size: 0.92rem; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field > legend { color: var(--g900); font-size: 0.88rem; }
input[type='text'], input[type='email'], input[type='password'], input[type='search'], input[type='number'], input[type='date'], select, textarea {
  width: 100%; font: inherit; font-size: 1rem; padding: 0.7rem 0.8rem; min-height: 46px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--g500); outline: 3px solid rgba(16, 185, 129, 0.25); }
.check { display: flex; align-items: center; gap: 0.55rem; font-size: 0.95rem; padding: 0.35rem 0; }
.check input { width: 22px; height: 22px; accent-color: var(--g700); flex: none; }
.checks { display: grid; gap: 0.1rem; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; }
.field input, .field select, .field textarea { min-width: 0; }
input[type='date'] { min-width: 0; -webkit-appearance: none; appearance: none; text-align: left; }
.seg { display: flex; gap: 0.4rem; background: #e7f3ea; padding: 0.3rem; border-radius: 16px; margin: 0 0 1rem; }
.seg-item { flex: 1; text-align: center; padding: 0.6rem 0.4rem; border-radius: 12px; text-decoration: none; color: var(--g800); font-weight: 600; cursor: pointer; font-size: 0.95rem; }
.seg-item input { position: absolute; opacity: 0; pointer-events: none; }
.seg-item.on { background: #fff; box-shadow: var(--shadow); }
.search { display: grid; grid-template-columns: 1fr; gap: 0.5rem; margin: 0 0 1rem; }
@media (min-width: 640px) { .search { grid-template-columns: 1fr 240px auto; } }
.auth-wrap { max-width: 460px; margin: 1rem auto; }
.auth-wrap h1 { text-align: center; }
.auth-art { display: block; margin: 0 auto 0.4rem; }
.formats { display: grid; gap: 0.5rem; }
.format-opt { display: flex; gap: 0.7rem; align-items: flex-start; padding: 0.7rem; border: 1.5px solid var(--line); border-radius: 14px; cursor: pointer; background: #fff; }
.format-opt:has(input:checked) { border-color: var(--g500); background: var(--g50); }
.format-opt input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--g700); }
.format-opt small { display: block; color: var(--muted); font-weight: 400; }
.inline-form { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.inline-form input[type='text'] { width: auto; flex: 1 1 140px; min-height: 38px; padding: 0.4rem 0.6rem; }
.inline-form select { width: auto; min-height: 38px; padding: 0.3rem 0.5rem; }
.manage-list, .plain-list, .archive, .history, .cards-list, .members { list-style: none; margin: 0.6rem 0; padding: 0; }
.manage-list > li { display: flex; flex-wrap: wrap; gap: 0.5rem 0.8rem; align-items: center; justify-content: space-between; padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
.manage-list .who { display: grid; }
.plain-list li { padding: 0.35rem 0; }

/* ---------- tracker pages ---------- */
.tracker-head { display: flex; gap: 1rem; align-items: center; padding: 1rem; margin: 0 0 1rem; border-radius: var(--radius); background: linear-gradient(135deg, #fff, var(--g50)); border: 1px solid var(--line); box-shadow: var(--shadow); }
.tracker-group { background: linear-gradient(135deg, #fff, #f0f9ff); }
.tracker-tournament { background: linear-gradient(135deg, #fff, #fffbeb); }
.tracker-head h1 { margin: 0; }
.tracker-head p { margin: 0.1rem 0; }
.round-meta { display: flex; flex-wrap: wrap; gap: 0.4rem 0.6rem; align-items: center; margin: 0.4rem 0 0.8rem; }
.roster { margin-top: 0; }
.updated { text-align: right; font-size: 0.8rem; margin: 0.6rem 0 0; }
.just-updated { animation: flashbg 0.9s ease; }
@keyframes flashbg { 0% { background: rgba(163, 230, 53, 0.35); } 100% { background: transparent; } }
.archive li a { display: flex; justify-content: space-between; gap: 1rem; padding: 0.8rem 1rem; margin: 0 0 0.5rem; background: #fff; border: 1px solid var(--line); border-radius: 14px; text-decoration: none; color: var(--ink); }
.archive .a-main { display: grid; }
.archive small { color: var(--muted); }
.archive .a-score { font-family: var(--font-head); font-size: 1.15rem; align-self: center; text-align: right; }
.archive em { font-style: normal; }
.history li { font-size: 0.88rem; padding: 0.25rem 0; border-bottom: 1px dashed var(--line); }
.cards-list > li { margin: 0 0 0.5rem; }

/* share */
.share-grid { display: grid; gap: 1rem; align-items: center; justify-items: center; }
.share-grid .qr { background: #fff; padding: 0.5rem; border-radius: 16px; border: 1px solid var(--line); width: 200px; height: 200px; }
.share-actions { width: 100%; }
.copy-status { min-height: 1.3em; color: var(--g700); font-weight: 600; margin: 0; }
@media (min-width: 640px) { .share-grid { grid-template-columns: auto 1fr; justify-items: start; } }

/* ---------- tabs & leaderboards ---------- */
.t-status { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0 0 0.8rem; }
.tabs { display: flex; gap: 0.35rem; overflow-x: auto; padding: 0.3rem; background: #e7f3ea; border-radius: 16px; margin: 0 0 1rem; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.tab { flex: 1 0 auto; border: 0; background: transparent; padding: 0.65rem 0.9rem; border-radius: 12px; font: 600 0.9rem var(--font-head); color: var(--g800); cursor: pointer; white-space: nowrap; min-height: 44px; }
.tab.on { background: #fff; box-shadow: var(--shadow); color: var(--g900); }
.panel[hidden] { display: none; }
.lb { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.lb-item { margin: 0 0 0.45rem; }
.lb:not(.show-all) .lb-item.extra { display: none; }
.lb-detail { background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: 0 1px 2px rgba(11, 61, 46, 0.05); }
.lb-detail > summary { list-style: none; cursor: pointer; }
.lb-detail > summary::-webkit-details-marker { display: none; }
.lb-row { display: grid; grid-template-columns: 2.6rem minmax(0, 1fr) auto auto; gap: 0.1rem 0.6rem; align-items: center; padding: 0.7rem 0.8rem; }
.lb-small .lb-row { background: #fff; border: 1px solid var(--line); border-radius: 14px; margin: 0 0 0.4rem; padding: 0.55rem 0.8rem; grid-template-columns: 2.4rem minmax(0, 1fr) auto auto auto; }
.lb-row .pos { font-size: 1.35rem; font-weight: 700; color: var(--g700); text-align: center; }
.lb-row .who { min-width: 0; display: grid; }
.lb-row .who strong { font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row .who small { color: var(--muted); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row .thru { font-size: 0.78rem; color: var(--muted); text-align: right; }
.lb-row .score { font-size: 1.5rem; font-weight: 700; min-width: 2.6rem; text-align: right; }
.lb-row .strokes { display: none; color: var(--muted); font-size: 0.85rem; min-width: 2.2rem; text-align: right; }
.lb-row .badge-col { display: none; }
.lb-row.lead { background: linear-gradient(90deg, #fffbeb, #fff); }
.lb-row.p1 .pos { color: #b45309; font-size: 1.6rem; }
.lb-row.p2 .pos { color: #64748b; } .lb-row.p3 .pos { color: #a16207; }
.lb-detail[open] > summary { border-bottom: 1px solid var(--line); background: var(--g50); }
.lb-body { padding: 0.8rem; }
.members li { display: grid; grid-template-columns: 1fr auto auto; gap: 0.6rem; padding: 0.3rem 0; border-bottom: 1px dashed var(--line); font-size: 0.92rem; }
@media (min-width: 640px) {
  .lb-row { grid-template-columns: 3rem minmax(0, 1fr) 6rem 4.5rem 3.5rem 2rem; padding: 0.8rem 1rem; }
  .lb-row .strokes, .lb-row .badge-col { display: block; }
  .lb-small .lb-row { grid-template-columns: 2.6rem minmax(0, 1fr) 6rem 4rem 3rem; }
}

/* ---------- scorecards ---------- */
.scorecard-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: #fff; -webkit-overflow-scrolling: touch; margin: 0.4rem 0; }
.scorecard { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 720px; font-size: 0.92rem; text-align: center; }
.scorecard th, .scorecard td { padding: 0.4rem 0.35rem; border-bottom: 1px solid #edf3ee; min-width: 34px; }
.scorecard thead th { background: var(--g800); color: #fff; font-family: var(--font-head); }
.scorecard .rowhead { position: sticky; left: 0; z-index: 2; background: #f4faf5; color: var(--g900); text-align: left; padding-left: 0.7rem; min-width: 88px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-right: 1px solid var(--line); font-weight: 600; }
.scorecard thead .rowhead { background: var(--g900); color: #fff; }
.scorecard .meta td, .scorecard .meta th { color: var(--muted); font-size: 0.8rem; background: #fafdfb; }
.scorecard .sum { background: #eef7f1; font-weight: 600; min-width: 42px; }
.scorecard thead .sum { background: var(--g700); }
.scorecard .tot { background: #dff3e6; }
.scorecard thead .tot { background: var(--g900); }
/* the Par / SI rows sit in the header too but are light rows — keep their totals readable */
.scorecard thead .meta .sum { background: #eef7f1; color: var(--muted); font-weight: 600; }
.scorecard thead .meta .tot { background: #dff3e6; }
.sc { display: inline-grid; place-items: center; min-width: 28px; height: 28px; font-weight: 600; font-family: var(--font-head); position: relative; }
.sc-none { color: #b8c7bd; }
.sc-par { color: var(--ink); }
.sc-plain { color: var(--ink); }
.sc-birdie { border: 2px solid var(--g500); border-radius: 50%; color: #0f7a43; }
.sc-eagle { border: 2px solid var(--sun-d); border-radius: 50%; box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--sun-d); color: #92400e; background: #fffbeb; }
.sc-bogey { border: 2px solid #fda4af; border-radius: 4px; color: var(--coral-d); }
.sc-double { border: 2px solid var(--coral-d); border-radius: 4px; box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--coral-d); color: #fff; background: var(--coral-d); }
.scorecard .sum.topar-under { color: #0f7a43; }
.scorecard .sum.topar-over { color: var(--coral-d); }
.scorecard .sum.topar-even { color: var(--ink); }
.sc-pending { outline: 2px dashed var(--sun-d); outline-offset: 2px; }
.card-foot { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.4rem 0 0.8rem; }
.entry-detail { background: #fff; border: 1px solid var(--line); border-radius: 16px; margin: 0 0 0.6rem; padding: 0.2rem 0.8rem; }
.entry-detail > summary { cursor: pointer; padding: 0.7rem 0; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.pos-mini { color: var(--g700); font-weight: 700; margin-right: 0.3rem; }
.table-wrap { overflow-x: auto; margin: 0.4rem 0 1rem; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.results { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 480px; }
.results th, .results td { padding: 0.55rem 0.7rem; text-align: left; border-bottom: 1px solid #edf3ee; }
.results thead th { background: var(--g800); color: #fff; font-family: var(--font-head); font-weight: 500; }

/* ---------- course admin ---------- */
.course-head { display: grid; gap: 1rem; }
.course-photo { width: 100%; max-height: 240px; object-fit: cover; border-radius: var(--radius); }
.course-photo.thumb { width: 160px; height: 100px; }
@media (min-width: 720px) { .course-head { grid-template-columns: 320px 1fr; align-items: center; } }
.loop { padding: 0.9rem; border: 1px solid var(--line); border-radius: 14px; margin: 0.7rem 0; background: var(--g50); }
.par-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 0.4rem; margin: 0.6rem 0; }
.par-grid label { display: grid; gap: 2px; font-size: 0.78rem; color: var(--muted); text-align: center; }
.par-grid input { text-align: center; padding: 0.5rem 0.2rem; }
.rating-row { display: grid; grid-template-columns: 1fr 90px 90px; gap: 0.5rem; align-items: center; margin: 0.3rem 0; }

/* ---------- score entry ---------- */
.score-page .page { max-width: 640px; }
.score-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.6rem; margin-bottom: 0.6rem; }
.score-course { font-size: 1.3rem; margin: 0; }
.sync-chip { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0.75rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; background: var(--g100); color: var(--g900); max-width: 52%; text-align: left; flex: none; }
.sync-chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--g500); flex: none; }
.sync-chip[data-state='saving'] { background: #e0f2fe; color: var(--sky-d); } .sync-chip[data-state='saving'] i { background: var(--sky); animation: pulse 1s infinite; }
.sync-chip[data-state='offline'] { background: #fff7ed; color: #9a3412; } .sync-chip[data-state='offline'] i { background: #f97316; }
.sync-chip[data-state='error'] { background: #fff1f2; color: var(--coral-d); } .sync-chip[data-state='error'] i { background: #ef4444; }
.entry-picker { display: flex; gap: 0.5rem; overflow-x: auto; padding-bottom: 0.3rem; margin-bottom: 0.6rem; }
.entry-picker select { width: 100%; }
.player-chip { flex: 0 0 auto; display: grid; text-align: left; padding: 0.5rem 0.9rem; border-radius: 14px; border: 2px solid var(--line); background: #fff; cursor: pointer; font: inherit; min-height: 52px; }
.player-chip small { color: var(--muted); font-size: 0.75rem; }
.player-chip.on { border-color: var(--g500); background: var(--g50); box-shadow: 0 2px 0 var(--g500); }
.hole-panel { background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 0.9rem; box-shadow: var(--shadow); margin-bottom: 0.8rem; }
.hole-nav { display: grid; grid-template-columns: 56px 1fr 56px; align-items: center; gap: 0.4rem; }
.nav-btn { height: 56px; border: 0; border-radius: 16px; background: var(--g100); color: var(--g800); font-size: 2rem; cursor: pointer; font-family: var(--font-head); }
.nav-btn:disabled { opacity: 0.35; }
.hole-title { text-align: center; }
.hole-jump { appearance: none; -webkit-appearance: none; border: 0; background: transparent; width: 100%; text-align: center; text-align-last: center; cursor: pointer; padding: 0 1.2rem 0 0; min-height: 0; font-family: var(--font-head); color: var(--g900);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%230f5a3a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.3rem center; }
.hole-no { display: block; font-size: 2.1rem; font-weight: 700; color: var(--g900); line-height: 1; }
.hole-sub { color: var(--muted); font-weight: 500; }
.who-line { text-align: center; margin: 0.6rem 0 0.4rem; font-size: 1rem; }
.keypad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.55rem; margin: 0.6rem 0; }
.key { height: 64px; border-radius: 18px; border: 2px solid var(--line); background: #f8fcf9; font-size: 1.9rem; font-weight: 600; color: var(--g900); cursor: pointer; touch-action: manipulation; transition: transform 0.06s; }
.key:active { transform: scale(0.94); }
.key.par { border-color: var(--g500); background: var(--g50); }
.key.on { background: linear-gradient(180deg, #16a05a, var(--g700)); color: #fff; border-color: var(--g800); box-shadow: 0 4px 0 var(--g800); }
.key:disabled { opacity: 0.4; }
.keypad-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.keypad-actions .auto { margin-left: auto; font-size: 0.88rem; color: var(--muted); display: flex; gap: 0.4rem; align-items: center; }
.result-line { text-align: center; font-weight: 600; min-height: 1.5em; margin: 0.6rem 0 0; color: var(--muted); }
.r-birdie, .r-eagle { color: #0f7a43; } .r-bogey, .r-double { color: var(--coral-d); } .r-par { color: var(--ink); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.start-hole { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.85rem; color: var(--muted); }
.start-hole select { width: auto; min-height: 38px; padding: 0.3rem 0.5rem; }

.scorecard td.jump { cursor: pointer; }
.scorecard td.jump:hover { background: var(--g50); }
.scorecard td.cur { background: var(--g100); box-shadow: inset 0 -3px 0 var(--g500); }

.how-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: 0.5rem; }
.how-list li { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 0.7rem 0.9rem; }

.region-chips .chip-on { background: var(--g700); color: #fff; border-color: var(--g700); }
.region-chips small { opacity: 0.8; }
.region-title { display: flex; align-items: baseline; gap: 0.4rem; }

.coming-list { list-style: none; margin: 0 0 1rem; padding: 0; columns: 2 16rem; column-gap: 1.25rem; }
.coming-list li { break-inside: avoid; padding: 0.35rem 0; border-bottom: 1px dashed var(--line, #d9e2d6); }

.faq details { border-bottom: 1px solid var(--line); padding: 0.6rem 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin: 0.5rem 0 0; }
.site-footer a { margin-left: 0.75rem; }

/* ---- language switcher + Thai typography ---- */
.lang-switch { display: inline-flex; border: 1.5px solid var(--line); border-radius: 999px; overflow: hidden; background: #fff; margin-left: 0.5rem; vertical-align: middle; }
.lang-switch a { padding: 0.25rem 0.7rem; font-size: 0.8rem; font-weight: 600; color: var(--g800); text-decoration: none; line-height: 1.4; }
.lang-switch a.on { background: var(--g700); color: #fff; }
.site-footer .lang-switch { margin-left: 0.75rem; }
html[lang="th"] { --font-body: 'Noto Sans Thai', 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif; --font-head: 'Prompt', 'Noto Sans Thai', 'Fredoka', system-ui, sans-serif; }
html[lang="th"] body { line-height: 1.7; } /* Thai needs more room for its tone marks */
html[lang="th"] h1, html[lang="th"] h2, html[lang="th"] h3 { line-height: 1.35; }

/* header: brand on the left; menu then language switcher hug the right edge (the switcher stays visible on phones) */
.site-header .brand { margin-right: auto; }
.site-header > .lang-switch { margin-left: 0; flex: none; }
