/* ============================================================
   GTGolfSquad – Styles  v1.1  (mobile-first)
   Fonts: Playfair Display + DM Sans
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ---- CSS variables (Classic) ------------------------------ */
:root {
  --bg:          #f4f1eb;
  --bg2:         #ece8df;
  --bg3:         #ffffff;
  --surface:     #ffffff;
  --surface2:    #f8f6f0;
  --border:      #d4cfc4;
  --text:        #1a1a18;
  --text2:       #5a564e;
  --text3:       #9a9488;
  --accent:      #2a6e3f;
  --accent2:     #1e5230;
  --accent3:     #d4edda;
  --gold:        #b8922a;
  --danger:      #c0392b;
  --danger-bg:   #fdecea;
  --birdie:      #1a6e3f;
  --eagle:       #b8922a;
  --ace:         #8b0000;
  --bogey:       #c0392b;
  --shadow:      0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.14);
  --radius:      12px;
  --radius-lg:   20px;
  --font-display:'Playfair Display', Georgia, serif;
  --font-body:   'DM Sans', sans-serif;
  --transition:  0.2s ease;
  --tap-min:     52px;   /* minimum touch target height */
}

[data-theme="dark"] {
  --bg:#0f1a14; --bg2:#162010; --bg3:#1e2d1a;
  --surface:#1e2d1a; --surface2:#243521; --border:#2e4228;
  --text:#e8e4d8; --text2:#a8a498; --text3:#6a6660;
  --accent:#4caf72; --accent2:#3d9660; --accent3:#1a3320;
  --gold:#d4a832; --danger:#e74c3c; --danger-bg:#2a1010;
  --shadow:0 2px 12px rgba(0,0,0,.4); --shadow-lg:0 8px 32px rgba(0,0,0,.6);
}
[data-theme="hc"] {
  --bg:#000; --bg2:#0a0a0a; --bg3:#111; --surface:#111;
  --surface2:#1a1a1a; --border:#fff; --text:#fff; --text2:#ccc; --text3:#999;
  --accent:#00ff88; --accent2:#00cc66; --accent3:#003322;
  --gold:#ffdd00; --danger:#ff4444; --danger-bg:#2a0000;
}
[data-color="blue"]   { --accent:#1a5276; --accent2:#154360; --accent3:#d6eaf8; }
[data-color="purple"] { --accent:#6c3483; --accent2:#5b2c6f; --accent3:#e8daef; }
[data-color="red"]    { --accent:#922b21; --accent2:#7b241c; --accent3:#fadbd8; }
[data-color="teal"]   { --accent:#1a7b6e; --accent2:#148a7a; --accent3:#d0ece7; }

/* ---- Reset ------------------------------------------------ */
*,*::before,*::after { box-sizing:border-box; margin:0; padding:0; }
html { font-size:16px; -webkit-tap-highlight-color:transparent; }
body {
  font-family:var(--font-body);
  background:var(--bg); color:var(--text);
  min-height:100vh; line-height:1.5;
  transition:background var(--transition), color var(--transition);
  overscroll-behavior:none;
}

/* ---- App shell -------------------------------------------- */
#app { display:flex; flex-direction:column; min-height:100vh; }

/* ---- Header ----------------------------------------------- */
header {
  background:var(--surface);
  border-bottom:1px solid var(--border);
  padding:0 16px;
  display:flex; align-items:center; justify-content:space-between;
  height:56px;
  box-shadow:var(--shadow);
  position:sticky; top:0; z-index:100;
  gap:8px;
}
.logo {
  display:flex; align-items:center; gap:8px;
  font-family:var(--font-display);
  font-size:1.15rem; font-weight:900; color:var(--accent);
  letter-spacing:-0.02em; white-space:nowrap;
}
.logo svg { width:24px; height:24px; flex-shrink:0; }
.header-right { display:flex; align-items:center; gap:8px; }

/* ---- Main content ----------------------------------------- */
main {
  flex:1; padding:16px;
  max-width:680px; margin:0 auto; width:100%;
}

/* ---- Screen system ---------------------------------------- */
/* Only one .screen is visible at a time */
.screen { display:none; }
.screen.active { display:block; }

/* ---- Landing page ----------------------------------------- */
.landing-hero {
  text-align:center;
  padding:28px 0 20px;
}
.landing-title {
  font-family:var(--font-display);
  font-size:2rem; font-weight:900;
  color:var(--accent); line-height:1.1;
  margin-bottom:6px;
}
.landing-sub {
  color:var(--text2); font-size:0.95rem;
  margin-bottom:24px;
}
.landing-date {
  display:flex; align-items:center; justify-content:center; gap:8px;
  margin-bottom:24px;
}
.landing-date input[type="date"] {
  padding:10px 14px; border:1.5px solid var(--border);
  border-radius:var(--radius); background:var(--surface);
  color:var(--text); font-family:var(--font-body); font-size:0.95rem;
}

/* Big action buttons */
.round-btns { display:flex; flex-direction:column; gap:12px; margin-bottom:28px; }
.round-btn {
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:4px; padding:20px 16px;
  border:none; border-radius:var(--radius-lg);
  cursor:pointer; font-family:var(--font-body);
  transition:all var(--transition);
  min-height:var(--tap-min);
  text-align:center;
}
.round-btn-official {
  background:var(--accent); color:#fff;
  box-shadow:0 4px 20px rgba(42,110,63,0.35);
}
.round-btn-official:hover { background:var(--accent2); transform:translateY(-2px); }
.round-btn-official:disabled {
  background:var(--border); color:var(--text3);
  box-shadow:none; cursor:not-allowed; transform:none;
}
.round-btn-unofficial {
  background:var(--surface); color:var(--accent);
  border:2px solid var(--accent);
}
.round-btn-unofficial:hover { background:var(--accent3); }
.round-btn-label {
  font-size:1.1rem; font-weight:700;
  font-family:var(--font-display);
}
.round-btn-sub { font-size:0.8rem; opacity:0.85; }

.holes-row {
  display:flex; align-items:center; justify-content:center;
  gap:12px; margin-bottom:24px;
}
.holes-row label { font-weight:600; font-size:0.95rem; }
.holes-toggle {
  display:flex; background:var(--bg2); border-radius:var(--radius); padding:3px;
}
.holes-opt {
  padding:8px 20px; border:none; background:transparent;
  border-radius:calc(var(--radius) - 2px);
  cursor:pointer; font-family:var(--font-body);
  font-size:0.9rem; font-weight:600; color:var(--text2);
  transition:all var(--transition);
}
.holes-opt.active {
  background:var(--surface); color:var(--accent); box-shadow:var(--shadow);
}

/* Today's scorecards list */
.section-title {
  font-family:var(--font-display);
  font-size:1rem; font-weight:700;
  margin-bottom:12px; color:var(--text);
}
.scorecard-list { display:flex; flex-direction:column; gap:10px; }
.scorecard-preview {
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); padding:14px 16px;
  display:flex; align-items:center; justify-content:space-between;
  gap:10px; cursor:pointer;
  transition:all var(--transition);
}
.scorecard-preview:hover { border-color:var(--accent); background:var(--accent3); }
.scorecard-preview-left { flex:1; min-width:0; }
.scorecard-preview-title {
  font-weight:600; font-size:0.9rem;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.scorecard-preview-sub { font-size:0.78rem; color:var(--text2); margin-top:2px; }
.scorecard-preview-badge {
  flex-shrink:0;
  font-size:0.72rem; font-weight:700;
  padding:4px 10px; border-radius:20px;
}
.badge-setup   { background:#fff3cd; color:#856404; }
.badge-active  { background:var(--accent3); color:var(--accent); }
.badge-official{ background:var(--accent3); color:var(--accent); }
.badge-unofficial{ background:var(--bg2); color:var(--text2); }

/* ---- Group Setup screen ----------------------------------- */
.setup-header {
  display:flex; align-items:center; gap:12px;
  margin-bottom:20px; padding-bottom:14px;
  border-bottom:1px solid var(--border);
}
.back-btn {
  width:40px; height:40px; border-radius:50%; border:1px solid var(--border);
  background:var(--surface); color:var(--text);
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; font-size:1.1rem; flex-shrink:0;
  transition:all var(--transition);
}
.back-btn:hover { background:var(--accent3); border-color:var(--accent); }
.setup-title { font-family:var(--font-display); font-size:1.2rem; font-weight:700; }

/* Identity select */
.identity-card {
  background:var(--accent); color:#fff;
  border-radius:var(--radius-lg); padding:16px;
  margin-bottom:16px;
}
.identity-card.chosen {
  background:var(--accent3); color:var(--accent);
  border:2px solid var(--accent);
}
.identity-label { font-size:0.78rem; font-weight:600; opacity:0.85; margin-bottom:6px; }
.identity-name  { font-family:var(--font-display); font-size:1.3rem; font-weight:700; }
.identity-change{ font-size:0.78rem; opacity:0.75; text-decoration:underline; cursor:pointer; margin-top:4px; }

/* Player search + grid */
.player-search-wrap { position:relative; margin-bottom:12px; }
.player-search {
  width:100%; padding:12px 16px;
  border:1.5px solid var(--border); border-radius:var(--radius);
  background:var(--surface); color:var(--text);
  font-family:var(--font-body); font-size:1rem;
}
.player-search:focus { outline:none; border-color:var(--accent); }

.player-grid {
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(140px,1fr));
  gap:8px; max-height:300px; overflow-y:auto; padding:2px;
}
.player-chip {
  display:flex; align-items:center; gap:8px;
  padding:12px; border:1.5px solid var(--border);
  border-radius:var(--radius); cursor:pointer;
  background:var(--surface); transition:all var(--transition);
  user-select:none; min-height:var(--tap-min);
}
.player-chip:hover { border-color:var(--accent); background:var(--accent3); }
.player-chip.selected { border-color:var(--accent); background:var(--accent3); color:var(--accent); }
.player-chip.is-me    { border-color:var(--accent); background:var(--accent); color:#fff; cursor:default; }
.player-chip.in-group { opacity:0.4; cursor:not-allowed; border-style:dashed; }
.player-chip.in-group:hover { border-color:var(--border); background:var(--surface); color:var(--text); }
.player-avatar {
  width:30px; height:30px; border-radius:50%;
  background:var(--accent); color:#fff;
  display:flex; align-items:center; justify-content:center;
  font-size:0.7rem; font-weight:700; flex-shrink:0;
}
.player-chip.selected .player-avatar,
.player-chip.in-group .player-avatar { background:var(--accent2); }
.player-chip.is-me .player-avatar { background:rgba(255,255,255,0.3); }
.player-chip-name { font-size:0.82rem; font-weight:600; line-height:1.2; }
.player-chip-short{ font-size:0.72rem; color:var(--text3); }
.player-chip.selected .player-chip-short,
.player-chip.is-me .player-chip-short { color:inherit; opacity:0.75; }

.selected-bar {
  background:var(--surface2); border:1px solid var(--border);
  border-radius:var(--radius); padding:12px 14px;
  margin-top:12px; font-size:0.85rem; color:var(--text2);
}
.selected-bar strong { color:var(--text); }

.setup-actions { display:flex; flex-direction:column; gap:10px; margin-top:16px; }

/* In-progress groups (lobby view) */
.lobby-groups { margin-top:20px; }
.lobby-group-item {
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); padding:14px;
  margin-bottom:8px;
}
.lobby-group-item.my-group { border-color:var(--accent); border-width:2px; }
.lobby-group-players { font-size:0.85rem; color:var(--text2); margin-top:4px; }

/* Alert banner */
.alert-banner {
  background:#fff3cd; border:1px solid #ffc107;
  border-radius:var(--radius); padding:14px 16px;
  margin-bottom:16px; font-size:0.9rem; color:#856404;
  display:flex; gap:10px; align-items:flex-start;
}
.alert-banner.info  { background:var(--accent3); border-color:var(--accent); color:var(--accent); }
.alert-banner.error { background:var(--danger-bg); border-color:var(--danger); color:var(--danger); }

/* ---- Scorecard screen ------------------------------------- */
.scorecard-screen {
  display:none; flex-direction:column;
  min-height:100vh; background:var(--bg);
}
.scorecard-screen.active { display:flex; }

.scorecard-topbar {
  background:var(--accent); color:#fff;
  padding:12px 16px;
  display:flex; align-items:center; justify-content:space-between;
  gap:10px; position:sticky; top:0; z-index:50;
}
.scorecard-topbar-left { display:flex; align-items:center; gap:10px; flex:1; min-width:0; }
.scorecard-course {
  font-family:var(--font-display);
  font-size:1rem; font-weight:700;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.scorecard-meta { font-size:0.75rem; opacity:0.85; }
.scorecard-topbar-right { display:flex; align-items:center; gap:8px; flex-shrink:0; }

/* Conflict warning bar */
.conflict-bar {
  background:var(--danger); color:#fff;
  padding:10px 16px; font-size:0.85rem; font-weight:600;
  display:flex; align-items:center; gap:8px;
  animation:conflictPulse 1.5s infinite;
}
@keyframes conflictPulse { 0%,100%{opacity:1} 50%{opacity:0.7} }
.conflict-bar.hidden { display:none; }

/* Scorecard table */
.scorecard-scroll { overflow-x:auto; flex:1; }
.scorecard {
  border-collapse:collapse; width:100%;
  font-size:0.8rem; min-width:520px;
}
.scorecard th, .scorecard td {
  border:1px solid var(--border);
  text-align:center; padding:0;
  min-width:34px;
}
/* Portrait overrides the global min-width */
.scorecard-portrait th,
.scorecard-portrait td { min-width: 0; }
.scorecard th {
  background:var(--surface2); color:var(--text2);
  font-weight:600; padding:6px 4px; font-size:0.72rem;
  position:sticky; top:0;
}
.th-player {
  text-align:left; padding-left:10px !important;
  min-width:80px; max-width:100px;
  position:sticky; left:0; z-index:10;
  background:var(--surface2) !important;
}
.th-total { background:var(--accent3) !important; color:var(--accent) !important; font-weight:700 !important; }
.par-row td { background:var(--bg2); color:var(--text2); font-size:0.72rem; }
.par-row .td-par { cursor:pointer; }
.par-row .td-par:hover { background:var(--accent3); }
.td-player-name {
  text-align:left; padding-left:8px !important;
  font-weight:600; font-size:0.8rem;
  position:sticky; left:0; z-index:5;
  background:var(--surface);
  max-width:100px; white-space:nowrap;
  overflow:hidden; text-overflow:ellipsis;
}
.td-player-name.is-me { color:var(--accent); }

/* Score cells */
.score-cell {
  cursor:pointer; height:44px; position:relative;
  transition:background var(--transition);
}
.score-cell:active { background:var(--accent3) !important; transform:scale(0.95); }
.score-val {
  display:flex; align-items:center; justify-content:center;
  height:100%; gap:2px; font-weight:500;
}
.penalty-pip {
  position:absolute; top:2px; right:2px;
  width:6px; height:6px; border-radius:50%;
  background:var(--danger);
}

/* Score colours — green shades, black text */
.s-ace    { background:#1a6e3f !important; color:#fff !important; font-weight:900; }
.s-eagle  { background:#2e8b57 !important; color:#fff !important; font-weight:800; }
.s-birdie { background:#a8d5b5 !important; color:#1a1a1a !important; font-weight:700; }
.s-par    { background:transparent; }
.s-bogey  { background:#d9ead3 !important; color:#1a1a1a !important; }
.s-double { background:#b7d4ac !important; color:#1a1a1a !important; font-weight:600; }

@keyframes conflictFlash { 0%,100%{background:var(--danger-bg)} 50%{background:#ffa0a0} }
.s-conflict { animation:conflictFlash 0.8s infinite; color:var(--danger) !important; font-weight:700; }

/* Scorecard footer */
.scorecard-footer {
  padding:12px 16px;
  display:flex; gap:10px; flex-wrap:wrap;
  background:var(--surface); border-top:1px solid var(--border);
}

/* ---- Score popup ------------------------------------------ */
.popup-overlay {
  position:fixed; inset:0;
  background:rgba(0,0,0,0.6);
  display:flex; align-items:center; justify-content:center;
  z-index:200; backdrop-filter:blur(4px);
  padding:16px;
}
.popup {
  background:var(--surface); border-radius:var(--radius-lg);
  padding:24px; width:100%; max-width:320px;
  box-shadow:var(--shadow-lg); text-align:center;
}
.popup-title  { font-family:var(--font-display); font-size:1.1rem; font-weight:700; margin-bottom:4px; }
.popup-sub    { color:var(--text2); font-size:0.85rem; margin-bottom:16px; }
.score-big    {
  font-family:var(--font-display); font-size:4rem; font-weight:900;
  color:var(--accent); line-height:1; margin:12px 0;
  min-height:1.1em; transition:color 0.15s;
}
.score-big.empty { color:var(--text3); }
.stepper { display:flex; align-items:center; justify-content:center; gap:16px; margin-bottom:12px; }
.step-btn {
  width:56px; height:56px; border-radius:50%; border:none;
  font-size:1.8rem; font-weight:300; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  background:var(--bg2); color:var(--text);
  transition:all 0.15s; -webkit-tap-highlight-color:transparent;
}
.step-btn:hover  { background:var(--accent); color:#fff; }
.step-btn:active { transform:scale(0.9); background:var(--accent2); color:#fff; }
.step-label { font-size:0.78rem; color:var(--text3); }

.penalty-row {
  display:flex; align-items:center; justify-content:space-between;
  background:var(--bg2); border-radius:var(--radius);
  padding:10px 14px; margin-bottom:16px;
}
.penalty-row-label { font-size:0.85rem; color:var(--text2); font-weight:500; }
.penalty-stepper   { display:flex; align-items:center; gap:10px; }
.pen-btn {
  width:34px; height:34px; border-radius:50%; border:1px solid var(--border);
  background:var(--surface); color:var(--text);
  display:flex; align-items:center; justify-content:center;
  font-size:1rem; cursor:pointer; transition:all 0.15s;
}
.pen-btn:hover  { background:var(--danger); color:#fff; border-color:var(--danger); }
.pen-btn:active { transform:scale(0.9); }
.pen-val { font-size:1.1rem; font-weight:700; color:var(--danger); min-width:24px; text-align:center; }

.popup-actions { display:flex; gap:8px; }
.popup-actions .btn { flex:1; justify-content:center; }

/* ---- Buttons --------------------------------------------- */
.btn {
  display:inline-flex; align-items:center; gap:6px;
  padding:12px 18px; border:none; border-radius:var(--radius);
  font-family:var(--font-body); font-size:0.9rem; font-weight:600;
  cursor:pointer; transition:all var(--transition);
  min-height:var(--tap-min); white-space:nowrap;
  -webkit-tap-highlight-color:transparent;
}
.btn-primary   { background:var(--accent); color:#fff; }
.btn-primary:hover { background:var(--accent2); }
.btn-secondary { background:var(--bg2); color:var(--text); border:1px solid var(--border); }
.btn-secondary:hover { background:var(--bg3); }
.btn-danger    { background:var(--danger); color:#fff; }
.btn-danger:hover { opacity:0.85; }
.btn-ghost     { background:transparent; color:var(--accent); border:1.5px solid var(--accent); }
.btn-ghost:hover { background:var(--accent3); }
.btn-sm { padding:8px 14px; font-size:0.82rem; min-height:38px; }
.btn-full { width:100%; justify-content:center; }
.btn:disabled { opacity:0.45; cursor:not-allowed; transform:none !important; }

/* ---- Course search --------------------------------------- */
.course-wrap { position:relative; }
.course-input {
  width:100%; padding:12px 16px;
  border:1.5px solid var(--border); border-radius:var(--radius);
  background:var(--surface); color:var(--text);
  font-family:var(--font-body); font-size:1rem;
}
.course-input:focus { outline:none; border-color:var(--accent); }
.autocomplete-list {
  position:absolute; top:calc(100% + 4px); left:0; right:0;
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); box-shadow:var(--shadow-lg);
  z-index:60; max-height:200px; overflow-y:auto;
}
.autocomplete-item {
  padding:12px 16px; cursor:pointer; font-size:0.88rem;
  border-bottom:1px solid var(--border); transition:background var(--transition);
}
.autocomplete-item:last-child { border-bottom:none; }
.autocomplete-item:hover { background:var(--accent3); color:var(--accent); }

/* ---- Toast ----------------------------------------------- */
#toast-container {
  position:fixed; bottom:20px; left:50%; transform:translateX(-50%);
  display:flex; flex-direction:column; gap:8px;
  z-index:300; pointer-events:none; width:calc(100% - 32px); max-width:400px;
}
.toast {
  padding:12px 18px; border-radius:var(--radius);
  background:var(--surface); border-left:4px solid var(--accent);
  box-shadow:var(--shadow-lg); font-size:0.87rem;
  animation:slideUp 0.25s ease; pointer-events:auto;
  text-align:center;
}
.toast.error   { border-color:var(--danger); }
.toast.success { border-color:#27ae60; }
@keyframes slideUp { from{transform:translateY(20px);opacity:0} to{transform:translateY(0);opacity:1} }

/* ---- Theme picker ---------------------------------------- */
.theme-row { display:flex; gap:6px; flex-wrap:wrap; }
.theme-btn {
  padding:7px 14px; border:1.5px solid var(--border);
  border-radius:20px; background:var(--bg2);
  color:var(--text2); font-size:0.8rem; font-weight:600;
  cursor:pointer; transition:all var(--transition); min-height:36px;
}
.theme-btn.active { border-color:var(--accent); background:var(--accent3); color:var(--accent); }
.color-swatch {
  width:24px; height:24px; border-radius:50%;
  border:2px solid transparent; cursor:pointer;
  transition:transform 0.15s;
}
.color-swatch:hover,.color-swatch.active { border-color:var(--text); transform:scale(1.2); }

/* ---- Sync dot -------------------------------------------- */
.sync-dot {
  width:8px; height:8px; border-radius:50%;
  background:#27ae60; display:inline-block; flex-shrink:0;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.2} }
.sync-dot.syncing { animation:blink 1s infinite; background:var(--gold); }
.sync-dot.error   { background:var(--danger); }

/* ---- History tab ----------------------------------------- */
.history-list { display:flex; flex-direction:column; gap:8px; }
.history-item {
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 16px; border:1px solid var(--border);
  border-radius:var(--radius); background:var(--surface);
  cursor:pointer; transition:all var(--transition);
}
.history-item:hover { border-color:var(--accent); background:var(--accent3); }

/* ---- Misc ------------------------------------------------ */
.divider   { height:1px; background:var(--border); margin:14px 0; }
.text-sm   { font-size:0.82rem; }
.text-muted{ color:var(--text3); }
.text-bold { font-weight:700; }
.hidden    { display:none !important; }
.mt-12     { margin-top:12px; }
.mt-16     { margin-top:16px; }
.mt-20     { margin-top:20px; }
.flex-between { display:flex; align-items:center; justify-content:space-between; }
.flex-gap  { display:flex; align-items:center; gap:8px; }

/* Scrollbar */
::-webkit-scrollbar { width:4px; height:4px; }
::-webkit-scrollbar-track { background:var(--bg2); }
::-webkit-scrollbar-thumb { background:var(--border); border-radius:2px; }

/* Desktop tweaks */
@media (min-width:640px) {
  main { padding:20px; }
  .landing-title { font-size:2.4rem; }
  .round-btns { flex-direction:row; }
  .round-btn  { flex:1; min-height:120px; }
  header { height:60px; }
  .logo { font-size:1.25rem; }
}

/* ---- Join request banner ---------------------------------- */
.join-request-bar {
  background:#fff8e1; border-bottom:1px solid #ffe082;
  padding:10px 16px;
  display:flex; align-items:center; justify-content:space-between;
  gap:10px; flex-wrap:wrap;
  font-size:0.88rem; color:#5d4037;
}
[data-theme="dark"] .join-request-bar {
  background:#2a2200; border-color:#5a4a00; color:#ffe082;
}

/* ---- Orientation modes ------------------------------------ */

/* Portrait: players as columns, holes as rows */
.scorecard-portrait {
  width: 100%;
  min-width: 0 !important;   /* override base .scorecard min-width:520px */
  table-layout: auto;        /* auto respects th width for column sizing  */
}

/* Hole col: shrink-wrap to content */
.scorecard-portrait thead th.th-hole-hdr:first-child,
.scorecard-portrait tbody th.th-hole,
.scorecard-portrait tbody th.th-section-lbl {
  width: 1px;            /* auto layout: shrink to content */
  white-space: nowrap;
  padding: 4px 4px !important;
  text-align: center;
  font-size: 0.72rem !important;
  font-weight: 600;
  background: var(--surface2);
  color: var(--text2);
  position: sticky; left: 0; z-index: 5;
}

/* Par col: shrink-wrap to content */
.scorecard-portrait thead th.th-hole-hdr:nth-child(2),
.scorecard-portrait tbody td.par-row {
  width: 1px;
  white-space: nowrap;
  padding: 4px 4px !important;
  text-align: center;
  font-size: 0.72rem !important;
  font-weight: 600;
  background: var(--bg2);
}

/* Yards col: same as par but slightly wider for 3-digit numbers */
.scorecard-portrait thead th.th-hole-hdr:nth-child(3),
.scorecard-portrait tbody td.td-yards {
  width: 1px;
  white-space: nowrap;
  padding: 4px 4px !important;
  text-align: center;
  font-size: 0.68rem !important;
  color: var(--text2);
  background: var(--bg2);
}

/* Section label spans both cols */
.scorecard-portrait .th-section-lbl {
  text-align: right;
  padding-right: 4px;
  background: var(--bg2);
}

/* Player columns: width set dynamically by JS via inline style */
/* Player col headers: JS sets width via inline style */
.scorecard-portrait thead th:not(.th-hole-hdr) {
  font-size: 0.68rem !important;
  font-weight: 700;
  padding: 4px 2px !important;
  text-align: center;
  white-space: normal;
  word-break: break-word;
  line-height: 1.15;
  overflow: hidden;
  background: var(--surface2);
}

/* Score cells must NOT override column width */
.scorecard-portrait .score-cell {
  height: 40px;
  padding: 0;
  overflow: hidden;
}
.scorecard-portrait .score-val {
  font-size: 0.8rem;
}
.scorecard-portrait .th-total {
  padding: 4px 2px;
  font-size: 0.72rem;
  overflow: hidden;
}

/* Landscape: original layout */
[data-orientation="landscape"] .scorecard-scroll {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
[data-orientation="landscape"] .scorecard    { font-size: 0.82rem; }
[data-orientation="landscape"] .scorecard th,
[data-orientation="landscape"] .scorecard td { min-width: 36px; }
[data-orientation="landscape"] .score-cell   { height: 46px; }

/* Portrait scroll */
[data-orientation="portrait"] .scorecard-scroll,
:root:not([data-orientation="landscape"]) .scorecard-scroll {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}

.rotate-hint { display: none !important; }

/* ---- Score decorations (portrait only) -------------------- */
/* Shared decoration base — centered within score-val flex container */
.deco-circle, .deco-rect, .deco-double-rect {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.deco-circle {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
}
.deco-rect {
  min-width: 24px; height: 20px;
  padding: 0 3px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}
.deco-double-rect {
  min-width: 24px; height: 20px;
  padding: 0 3px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  outline: 1.5px solid currentColor;
  outline-offset: 2px;
}

/* ---- Course match picker ---------------------------------- */
.course-match-option:hover {
  border-color: var(--accent) !important;
  background: var(--accent3);
}

/* ---- Round closing banner -------------------------------- */
.round-closed-banner {
  background: var(--accent3);
  color: var(--accent);
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}

.player-chip.played-today { opacity:0.45; cursor:not-allowed; background:var(--bg); border-style:dashed; }

.scorecard-preview-badge.badge-closed  { background:#e0e0e0; color:#666; }
.scorecard-preview-badge.badge-closing { background:#fff3cd; color:#856404; }

/* ---- Quick score buttons ---------------------------------- */
.quick-score-row {
  display: flex; gap: 8px; margin: 10px 0 4px;
}
.quick-score-btn {
  flex: 1; padding: 8px 4px; border: 2px solid var(--border);
  border-radius: var(--radius); background: var(--surface);
  font-family: var(--font); font-size: 0.78rem; font-weight: 700;
  cursor: pointer; text-align: center; transition: all 0.15s;
  line-height: 1.3; min-width: 0; box-sizing: border-box;
  height: 58px; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.quick-score-btn span { font-size: 1.1rem; font-weight: 900; display: block; }
.quick-score-btn.birdie { border-color: #2e8b57; color: #2e8b57; }
.quick-score-btn.par    { border-color: var(--text2); color: var(--text); }
.quick-score-btn.bogey  { border-color: #888; color: #555; }
.quick-score-btn.active,
.quick-score-btn.birdie.active { background: #2e8b57; color: #fff; border-color: #2e8b57; }
.quick-score-btn.par.active    { background: var(--text); color: var(--surface); }
.quick-score-btn.bogey.active  { background: #888; color: #fff; }