* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%;
  font-family: system-ui, "Segoe UI", sans-serif;
  background: #17181b; color: #ededed;
  overflow: hidden;
}

/* ===== Themed scrollbars (match the dark UI) — applies to every scroll
   container: #tools, #palette, track/category lists, chat, score card, etc. ===== */
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.18) transparent; } /* Firefox */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.16); border-radius: 8px;
  border: 2px solid transparent; background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.30); background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

.screen { display: none; width: 100%; height: 100%; }
.screen.active { display: flex; }

/* ===== App shell — Geist/Linear minimal: hairline borders, grey-on-grey, one accent ===== */
#menu, #lobby { align-items: stretch; justify-content: flex-start; gap: 0; background: #17181b; }

/* Persistent brand rail (identical on menu + lobby) */
.rail {
  flex-shrink: 0; width: 300px; display: flex; flex-direction: column; gap: 20px;
  padding: 22px 18px; background: #1c1d20; border-right: 1px solid rgba(255,255,255,0.11);
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-logo {
  font-size: 22px; width: 40px; height: 40px; flex-shrink: 0; display: grid; place-items: center;
  background: #26272b; border: 1px solid rgba(255,255,255,0.10); border-radius: 10px;
}
.brand-name { font-size: 18px; font-weight: 600; letter-spacing: -0.3px; color: #ededed; }
.brand-name b { color: #6fd3a6; font-weight: 600; }
.rail-tagline { margin: 0; font-size: 13px; line-height: 1.5; color: #6b7078; }

.rail-section { display: flex; flex-direction: column; min-height: 0; flex: 1; gap: 10px; }
.rail-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: #6b7078;
}
.rail-head button { height: 24px; width: 24px; padding: 0; font-size: 12px; background: #232428; border: 1px solid rgba(255,255,255,0.11); border-radius: 6px; color: #8a8f98; }
.rail-head button:hover { background: #2c2d31; color: #ededed; }
.rail-foot { display: flex; flex-direction: column; gap: 2px; margin-top: auto; }
.rail-foot .ghost { justify-content: flex-start; color: #8a8f98; }
.rail-foot .ghost:hover { color: #ededed; background: rgba(255,255,255,0.04); }

/* Open-games list (menu rail) */
.lobby-list { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; flex: 1; min-height: 0; }
.lobby-row { background: #1f2024; border: 1px solid rgba(255,255,255,0.10); border-radius: 8px; padding: 9px 10px; }
.lobby-row .lr-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.lobby-row .lr-name { font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lobby-row .lr-count { color: #8a8f98; font-size: 12px; white-space: nowrap; }
.lobby-row .lr-sub { color: #62666d; font-size: 12px; margin: 2px 0 8px; }
.lobby-row .lr-sub .live { color: #6fd3a6; }
.lobby-row button { width: 100%; height: 30px; font-size: 12px; }
.lobby-empty { color: #62666d; font-size: 12.5px; text-align: center; padding: 16px 6px; line-height: 1.5; }

/* Focused main column */
/* `safe center`: vertically center when it fits, but fall back to top-aligned (not
   clipped-and-unreachable) the moment content is taller than the viewport. */
.stage-main { flex: 1; min-width: 0; display: flex; align-items: safe center; justify-content: center; padding: 15px 28px; overflow-y: auto; }
.content { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 11px; }
/* Home layout (Clubhouse / Feed) lives in the "Home" section at the end of this file. */
.play-card .screen-title { margin: 0; }
.play-card #singleBtn { height: 50px; font-size: 16px; margin-top: 2px; }

/* Course: hole 1 as a picture (click = preview every hole), then name + Change + Import. */
.course-box { display: flex; flex-direction: column; gap: 8px; }
.course-thumb {
  position: relative; display: block; width: 100%; height: auto; aspect-ratio: 2 / 1; padding: 0; overflow: hidden;
  border-radius: 10px; border: 1px solid rgba(255,255,255,0.10);
  background: radial-gradient(120% 100% at 50% 0%, #2f6b3c, #1d3d25);
}
.course-thumb:hover { border-color: #6fd3a6; background: radial-gradient(120% 100% at 50% 0%, #2f6b3c, #1d3d25); }
.course-thumb canvas {
  display: block; width: 100%; height: 100%; object-fit: contain;
  background: transparent; border-radius: 0; box-shadow: none; cursor: pointer;
  transition: opacity 0.2s, transform 0.3s;
}
.course-thumb.loading canvas { opacity: 0.35; }
.course-thumb.empty canvas { opacity: 0; }
.course-thumb:hover canvas { transform: scale(1.02); }
.course-thumb:disabled { opacity: 1; cursor: default; }
.course-thumb:disabled .ct-peek { display: none; }
.ct-tag, .ct-peek {
  position: absolute; bottom: 8px; padding: 3px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 600; color: #ededed; background: rgba(10,15,22,0.72);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); pointer-events: none;
}
.ct-tag { left: 8px; }
.ct-tag:empty { display: none; }
.course-thumb.empty .ct-tag { left: 50%; bottom: 50%; transform: translate(-50%, 50%); font-size: 13px; background: none; }
.ct-peek { right: 8px; opacity: 0; transition: opacity 0.15s; }
.course-thumb:hover .ct-peek, .course-thumb:focus-visible .ct-peek { opacity: 1; }
@media (pointer: coarse) { .ct-peek { opacity: 1; } }
.import-btn { height: auto; flex-shrink: 0; padding: 0 12px; font-size: 13px; color: #c9ccd1; background: #232428; white-space: nowrap; }
.screen-title { margin: 0 0 4px; font-size: 21px; font-weight: 600; letter-spacing: -0.4px; color: #ededed; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.big { height: 46px; font-size: 15px; }

/* Lobby main specifics */
.lobby-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.eyebrow { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: #6b7078; margin-bottom: 6px; }
.lobby-top #lobbyCode { font-size: 30px; letter-spacing: 7px; color: #ededed; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.lobby-top #copyLink { flex-shrink: 0; white-space: nowrap; }
/* Each lobby section is a card: a lifted surface over the page so the setup reads as
   discrete panels instead of one dense form. */
.block {
  display: flex; flex-direction: column; gap: 7px;
  background: #1f2024; border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px; padding: 11px 14px;
}
.block-head { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: #6b7078; margin-bottom: 1px; }
/* Sub-grouping inside the Rules block: a small muted label with a hairline divider
   so related toggles read as one set (Gameplay vs Lobby & maps). */
.rules-group { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: #5a5f66; margin-top: 3px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.07); }
.rules-group:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }

/* Inside a lobby card, every control row reads as one inline rhythm: label on the
   left, switch/select on the right, comfortable touch height. */
#lobby .block .switch-row, #lobby .block .field {
  flex-direction: row; align-items: center; justify-content: space-between;
  gap: 12px; min-height: 30px; padding: 0;
}
#lobby .block .field > span { color: #c9ccd1; font-weight: 400; font-size: 14px; }
#lobby .block .field select { width: auto; min-width: 128px; height: 33px; }
/* Nested items sit a shade lighter than their card so they stay legible. */
#playerList li { background: #26272b; }

/* Course hero card: the one deliberate green-leak surface (daily-card border
   token) anchored by a real hole-1 canvas — the page's single image panel. */
.course-card { border-color: rgba(111,211,166,0.22); }
#mapThumb {
  display: block; width: 100%; height: auto; background: #46b35a;
  border-radius: 8px; border: 1px solid rgba(255,255,255,0.10);
}
.map-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.map-row .map-info { min-width: 0; flex: 1; }
/* The missing mid type step: 30px code → 18px course name → 14px body. */
.map-name { font-weight: 600; font-size: 18px; letter-spacing: -0.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vote-sec { display: flex; flex-direction: column; gap: 7px; }
.suggest-row { padding-top: 2px; }
.course-msg { text-align: left; min-height: 0; }
.course-msg:empty { display: none; }

/* Bots: a divider-topped sub-section of the Players card (no card of its own). */
#botsBlock { display: flex; flex-direction: column; gap: 7px; border-top: 1px solid rgba(255,255,255,0.07); padding-top: 9px; }

/* Sticky action bar: Start (or the guest waiting status) + the live "Next: …"
   line, pinned to the bottom of .stage-main (the sole scroller) on every device. */
.lobby-actions {
  position: sticky; bottom: 0; z-index: 3;
  display: flex; align-items: center; gap: 14px;
  background: rgba(23,24,27,0.93);
  backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px);
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
}
.lobby-actions .la-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
#lobbyStatus { font-size: 14px; font-weight: 600; color: #ededed; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lobby-actions #startBtn { flex-shrink: 0; min-width: 170px; }
.lobby-actions .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Lobby: stacked on phones, two columns on wide screens so the desktop uses the
   available width instead of a thin centered strip. */
.lobby-cols { display: flex; flex-direction: column; gap: 14px; }
.lobby-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (min-width: 1000px) {
  #lobby .content { max-width: 880px; }
  /* Course hero takes the wider track; Players + Rules stack in the narrower one. */
  .lobby-cols { display: grid; grid-template-columns: 1.15fr 1fr; gap: 22px; align-items: start; }
}
/* 761-999px (e.g. iPad portrait): single column, but a real card width — not the
   380px phone strip the base .content max-width would otherwise impose. */
@media (min-width: 761px) and (max-width: 999px) {
  #lobby .content { max-width: 640px; }
}

@media (max-width: 760px) {
  #menu, #lobby { flex-direction: column; }
  .rail { width: 100%; border-right: none; border-bottom: 1px solid rgba(255,255,255,0.11); max-height: 40vh; }
  /* Lobby on a phone: ONE scrolling page (#lobby is the scroller) — content
     first, chat below it, Leave last — and the action bar pinned to the REAL
     viewport bottom (fixed, since sticky-in-.stage-main would pin mid-screen
     above the rail). The rail's bottom padding keeps Leave clear of the bar. */
  #lobby { overflow-y: auto; }
  #lobby .stage-main { flex: none; overflow: visible; }
  #lobby .rail {
    order: 2; flex: none; max-height: none;
    border-bottom: none; border-top: 1px solid rgba(255,255,255,0.11);
    padding-bottom: calc(86px + env(safe-area-inset-bottom));
  }
  #lobby .rail .chat-log { max-height: 38vh; }
  .lobby-actions { position: fixed; left: 0; right: 0; bottom: 0; padding-left: 14px; padding-right: 14px; }
  .lobby-actions .sub { display: none; }                       /* status line only on phones */
  .lobby-actions #startBtn { min-width: 0; flex: 0 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* Top-align (not vertical-center) so a tall lobby column scrolls cleanly
     instead of having its top clipped by flex centering. */
  .stage-main { padding: 22px; justify-content: flex-start; }
}
.panel {
  background: #1f2024; border: 1px solid rgba(255,255,255,0.10); border-radius: 12px;
  padding: 24px; width: min(360px, 92vw); box-shadow: none;
  display: flex; flex-direction: column; gap: 14px;
}
.panel h1 { margin: 0 0 6px; font-size: 22px; font-weight: 600; text-align: center; display: flex; align-items: center; justify-content: center; gap: 9px; letter-spacing: -0.3px; }
.panel h1 .logo { font-size: 22px; }
.panel h2 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.3px; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field > span { font-size: 12px; letter-spacing: 0; color: #8a8f98; font-weight: 500; }
input, select {
  background: #232428; border: 1px solid rgba(255,255,255,0.10); color: #ededed;
  height: 40px; padding: 0 12px; border-radius: 8px; font-size: 14px; width: 100%;
}
input::placeholder { color: #5b5f66; }
select { cursor: pointer; }
input:focus, select:focus { outline: none; border-color: #6fd3a6; box-shadow: 0 0 0 3px rgba(111,211,166,0.12); }
/* Segmented toggle (aim style) */
.segmented { display: flex; background: #232428; border: 1px solid rgba(255,255,255,0.10); border-radius: 9px; padding: 4px; gap: 4px; }
.segmented input { display: none; }
.segmented label {
  flex: 1; text-align: center; padding: 8px 6px; border-radius: 6px; cursor: pointer;
  font-size: 14px; color: #8a8f98; transition: all 0.12s; user-select: none;
}
.segmented label:hover { color: #ededed; background: rgba(255,255,255,0.04); }
.segmented input:checked + label { background: #6fd3a6; color: #06281a; font-weight: 600; }

/* Toggle switch (sound) */
.switch-row { display: flex; align-items: center; justify-content: space-between; font-size: 14px; color: #c9ccd1; cursor: pointer; }
.switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; background: #3a3b40; border-radius: 24px; transition: 0.18s;
}
.switch .slider::before {
  content: ''; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px;
  background: #ededed; border-radius: 50%; transition: 0.18s;
}
.switch input:checked + .slider { background: #6fd3a6; }
.switch input:checked + .slider::before { transform: translateX(18px); background: #06281a; }

button {
  background: #26272b; border: 1px solid rgba(255,255,255,0.10); color: #ededed; height: 40px; padding: 0 14px;
  border-radius: 8px; font-weight: 500; font-size: 14px; cursor: pointer; transition: background 0.12s, border-color 0.12s;
}
button:hover { background: #2e2f33; border-color: rgba(255,255,255,0.16); }
button.primary { background: #6fd3a6; color: #06281a; border-color: transparent; font-weight: 600; }
button.primary:hover { background: #7fe0b4; }
button:disabled { opacity: 0.4; cursor: not-allowed; }

.menu-buttons { display: flex; flex-direction: column; gap: 10px; }
.course-row { display: flex; gap: 8px; align-items: stretch; }
.icon-btn { width: 40px; flex-shrink: 0; padding: 0; font-size: 16px; background: #232428; border: 1px solid rgba(255,255,255,0.10); display: flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: #2c2d31; border-color: rgba(255,255,255,0.18); }
/* Drop the base button's fixed 40px height so these stretch to the taller
   picker (align-items: stretch) and line up flush with it. */
.course-row .icon-btn { height: auto; }

/* Course picker — opens the gallery; a tidy two-line field with a Change cue. */
.course-pick {
  flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  height: auto; min-height: 48px; padding: 7px 12px; text-align: left;
  background: #232428; border: 1px solid rgba(255,255,255,0.10);
}
.course-pick:hover { background: #2a2b2f; border-color: #6fd3a6; box-shadow: 0 0 0 3px rgba(111,211,166,0.10); }
.course-pick .cp-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.course-pick .cp-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.course-pick .cp-sub { font-size: 12px; color: #8a8f98; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.course-pick .cp-act { flex-shrink: 0; font-size: 12px; font-weight: 600; color: #6fd3a6; white-space: nowrap; }

.join-row { display: flex; gap: 8px; }
.join-row #joinCode { flex: 1; text-transform: uppercase; letter-spacing: 2px; }
.join-row #joinBtn { width: 92px; flex-shrink: 0; }

/* labelled divider */
.divider { display: flex; align-items: center; gap: 10px; color: #5b5f66; font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px; margin: 2px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,0.11); }

.secondary { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 2px; }
.ghost {
  background: transparent; border: none; color: #8a8f98; height: auto; padding: 8px 10px; font-size: 14px;
  font-weight: 500; text-decoration: none; border-radius: 8px; display: inline-flex; align-items: center; gap: 8px;
}
.ghost:hover { color: #ededed; background: rgba(255,255,255,0.05); border: none; }

/* In-game settings button + range */
.hud-btn {
  position: absolute; bottom: 18px; right: 18px; width: 42px; height: 42px; padding: 0;
  background: rgba(10,15,22,0.6); border-radius: 10px; font-size: 20px; line-height: 1;
  backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px);
}
.hud-btn:hover { background: rgba(20,30,44,0.9); }
input[type="range"] { -webkit-appearance: none; appearance: none; height: 6px; background: #3a3b40; border-radius: 3px; padding: 0; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #6fd3a6; cursor: pointer; }
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border: none; border-radius: 50%; background: #6fd3a6; cursor: pointer; }
.join-row input { text-transform: uppercase; letter-spacing: 3px; text-align: center; }
.join-row button { white-space: nowrap; }
.link { color: #6fd3a6; text-decoration: none; text-align: center; font-size: 14px; margin-top: 4px; }
.link:hover { text-decoration: underline; }
.msg { min-height: 18px; font-size: 13px; color: #e0a04a; text-align: center; }
.sub { font-size: 13px; color: #8a8f98; }

.code-box { font-size: 18px; text-align: center; }
/* Wrap into 2 columns when there's room (e.g. a full 8-seat lobby), so a stack of
   bots doesn't run the column twice as long as the rules beside it. 130px keeps
   two columns alive even in the narrower right grid track at ~1000px viewports. */
#playerList { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }
#playerList li { background: #26272b; border: 1px solid rgba(255,255,255,0.08); padding: 8px 10px; border-radius: 8px; display: flex; gap: 9px; align-items: center; font-size: 13px; min-width: 0; }
#playerList li .pname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Empty seats hold the card at full 8-player size so it never resizes as people
   join — and double as the recruiting affordance (tap to copy the invite link). */
#playerList li.seat-empty { background: transparent; border-style: dashed; border-color: rgba(255,255,255,0.09); justify-content: center; cursor: pointer; }
#playerList li.seat-empty .pname { color: #50555d; font-size: 12px; }
#playerList li.seat-empty:hover { border-color: rgba(111,211,166,0.4); }
#playerList li.seat-empty:hover .pname { color: #8a8f98; }
.host-tag { margin-left: auto; font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: #6fd3a6; }
/* Neutral grey — a blue tag × 7 bots out-saturates the single green accent. */
.bot-tag { margin-left: auto; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: #9aa0a8; }
.host-tag + .bot-tag { margin-left: 7px; }
.swatch { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
/* Host-only per-seat kick: small square, pushed to the row's right edge. */
.pkick { margin-left: auto; flex-shrink: 0; width: 26px; height: 26px; padding: 0; font-size: 11px; line-height: 1; color: #8a8f98; background: #232428; border: 1px solid rgba(255,255,255,0.10); border-radius: 6px; cursor: pointer; }
.pkick:hover { background: #3a2326; color: #e8503a; border-color: rgba(232,80,58,0.4); }
@media (pointer: coarse) { .pkick { width: 34px; height: 34px; } }

/* Host-only controls, seen by a joiner: a "Host only" tag on the Rules header
   and a clearly LOCKED (not just faded) look on every disabled control. */
.lock-tag { margin-left: 7px; font-size: 10px; font-weight: 600; letter-spacing: 0.5px; color: #e0a04a; }
.switch-row:has(input:disabled) { cursor: not-allowed; opacity: 0.7; }
.field:has(select:disabled) { opacity: 0.7; }
select:disabled { cursor: not-allowed; }
/* A locked toggle must read inert — muted grey, never the bright accent, even
   when the setting is on (knob still shows the on/off position). */
.switch input:disabled + .slider { background: #34353a; cursor: not-allowed; }
.switch input:disabled:checked + .slider { background: rgba(111,211,166,0.30); }
.switch input:disabled + .slider::before { background: #9aa0a8; }
/* A locked primary button (Start, for a guest) reads grey, not faded green. */
button.primary:disabled { background: #2a2b2f; color: #8a8f98; border-color: rgba(255,255,255,0.08); opacity: 0.9; }

/* ===== Next-map vote board (lobby) ===== */
.vote-actions { display: flex; gap: 6px; }
.mini {
  height: 30px; padding: 0 10px; font-size: 12px; font-weight: 500;
  text-transform: none; letter-spacing: 0; color: #ededed;
  background: #232428; border: 1px solid rgba(255,255,255,0.10);
}
.mini:hover { background: #2c2d31; }
/* No inner scroller: the 12-candidate cap bounds growth and the sticky action
   bar keeps Start reachable, so the list grows and the page scrolls. Full-width
   rows — two 210px columns left no room for the name + tag + vote button. */
.vote-list { display: flex; flex-direction: column; gap: 6px; }
.vote-list:empty { display: none; }
.vote-row {
  display: flex; align-items: center; gap: 10px;
  background: #26272b; border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px; padding: 8px 10px; font-size: 13px;
}
.vote-row.voted { border-color: #6fd3a6; background: #1c2a23; }
.vote-row.lead { border-color: rgba(111,211,166,0.55); }
/* The name always keeps a readable floor; the meta tags shrink/clip first. */
.vote-row .vname { flex: 1; min-width: 64px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vote-row .vmeta { color: #8a8f98; font-size: 12px; white-space: nowrap; display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; }
.vote-row .vtag { color: #6fd3a6; font-size: 10px; text-transform: uppercase; letter-spacing: 0.4px; }
.vote-row .vby { color: #62666d; font-size: 11px; max-width: 84px; overflow: hidden; text-overflow: ellipsis; }
.vote-row .vbtn {
  flex-shrink: 0; height: 30px; min-width: 50px; padding: 0 10px; font-size: 13px;
  font-variant-numeric: tabular-nums; background: #2e2f33; /* one step lighter than the row, so it reads as a control */
}
.vote-row.voted .vbtn { background: #6fd3a6; color: #06281a; border-color: transparent; font-weight: 600; }
.vote-row .vrm { flex-shrink: 0; width: 30px; height: 30px; padding: 0; font-size: 12px; color: #8a8f98; background: #232428; }
.vote-row .vrm:hover { background: #3a2326; color: #e8503a; border-color: rgba(232,80,58,0.4); }
/* Touch: bump the small vote controls to a comfortable tap target. */
@media (pointer: coarse) {
  .mini, .vote-row .vbtn { height: 38px; }
  .vote-row .vrm { width: 38px; height: 38px; }
}

/* ===== Playforia map browser (matches the menu/lobby grey theme) ===== */
#browser { background: #17181b; align-items: stretch; justify-content: center; }
.browser-panel {
  width: 100%; max-width: 1000px; height: 100%; display: flex; flex-direction: column; padding: 18px;
}
.browser-head { display: flex; align-items: center; gap: 14px; }
.browser-head h2 { margin: 0; font-size: 22px; white-space: nowrap; }
.browser-head input { flex: 1; }
.browser-head button { white-space: nowrap; }
.browser-body { flex: 1; min-height: 0; display: flex; gap: 14px; margin-top: 14px; }
.cat-tabs { display: flex; flex-direction: column; gap: 6px; width: 170px; flex-shrink: 0; overflow-y: auto; }
.cat-tab {
  background: #1f2024; border: 1px solid rgba(255,255,255,0.10); border-radius: 8px; padding: 10px 12px;
  cursor: pointer; font-size: 14px; text-align: left; color: #ededed;
}
.cat-tab:hover { background: #26272b; }
.cat-tab.sel { background: #6fd3a6; color: #06281a; font-weight: 600; }
.cat-tab .cnt { float: right; opacity: 0.7; font-size: 12px; }
/* Divider between our gallery and the Playforia import library. Works in the
   vertical sidebar and the horizontal tab strip used on narrow screens. */
.cat-sep {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px;
  color: #5b5f66; padding: 8px 4px 4px; white-space: nowrap; flex-shrink: 0; align-self: center;
}
.track-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding-right: 6px; }
.track-row {
  display: flex; align-items: center; gap: 12px; background: #1f2024; border: 1px solid rgba(255,255,255,0.10);
  border-radius: 8px; padding: 9px 12px; font-size: 14px;
}
.track-row:hover { background: #26272b; }
.track-row .tname { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-row .tauthor { color: #8a8f98; font-size: 12px; white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.track-row .tpar { color: #f0c419; font-size: 12px; min-width: 44px; }
.track-row button { padding: 6px 12px; }
.track-row.set { border-color: #6fd3a6; }
.browser-empty { color: #62666d; padding: 20px; text-align: center; }

/* ===== Game ===== */
#game { background: #17181b; }
#stage { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 20px; }
canvas {
  background: #46b35a;
  border-radius: 12px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.06);
  cursor: crosshair;
  touch-action: none;               /* let pointer capture own drags */
  /* width/height set by JS (fitCanvas) to fill the stage, aspect-preserved */
}
/* Portrait phones (fitCanvas): the board turned a quarter, centred in the stage. */
canvas.rotated { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-90deg); }

.hud {
  position: absolute; top: 14px; padding: 8px 12px;
  background: rgba(10,15,22,0.55); border-radius: 8px; font-size: 14px;
  backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px); /* board reads through */
  pointer-events: none;
}
#hudTopLeft { left: 14px; }
.hud-holename { color: #6fd3a6; font-weight: 700; font-style: italic; }
#shotClock { left: 50%; transform: translateX(-50%); top: 14px; font-size: 16px; font-weight: 700; display: none; }
#shotClock.show { display: block; }
#shotClock.low { color: #e8503a; }
#hudTopRight { right: 14px; color: #8a8f98; }

/* Persistent right-side scoreboard (includes the whose-turn indicator). */
#scorePanel {
  right: 14px; top: 14px; padding: 10px 12px; min-width: 200px; max-width: 260px;
  display: flex; flex-direction: column; gap: 6px;
}
.sp-head { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: #8a8f98; display: flex; justify-content: space-between; align-items: center; }
.sp-head kbd { font-size: 10px; }
#scoreRows { display: flex; flex-direction: column; gap: 3px; }
.sp-row {
  display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 4px 6px;
  border-radius: 6px; opacity: 0.8;
}
.sp-row.turn { opacity: 1; background: rgba(111,211,166,0.16); box-shadow: inset 2px 0 0 #6fd3a6; }
.sp-row .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.sp-row .pturn { width: 8px; color: #6fd3a6; font-weight: 700; }
.sp-row .pname { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-row .pstrokes { color: #c8d4de; font-variant-numeric: tabular-nums; font-size: 12px; }
.sp-row .ptopar { color: #8a8f98; font-variant-numeric: tabular-nums; min-width: 22px; text-align: right; }
.sp-row.sunk .pname { color: #6fd3a6; }
.sp-row.me .pname { font-weight: 700; }
.sp-row .plate { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: #ffcf6b; background: rgba(255,159,92,0.16); border-radius: 4px; padding: 1px 4px; margin-left: 4px; vertical-align: middle; }
kbd { background: #2e2f33; border-radius: 4px; padding: 1px 6px; font-size: 12px; }

.banner {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  font-size: 26px; font-weight: 700; padding: 10px 22px; border-radius: 10px;
  background: rgba(10,15,22,0.6); opacity: 0; transition: opacity 0.25s;
  pointer-events: none; text-align: center;
}
.banner.show { opacity: 1; }

/* First-shot hint (#65): words under the canvas demo, never rotated. */
#shotHint {
  position: absolute; left: 50%; bottom: calc(52px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 6;
  display: flex; align-items: center; gap: 8px; max-width: calc(100% - 24px);
  background: rgba(10,15,22,0.82); border: 1px solid rgba(255,255,255,0.18); border-radius: 12px;
  padding: 8px 8px 8px 14px; font-size: 15px; font-weight: 600; box-shadow: 0 6px 18px rgba(0,0,0,.45);
}
#shotHint[hidden] { display: none; }
#shotHint button { min-height: 36px; border-radius: 9px; border: 1px solid rgba(255,255,255,0.25); background: rgba(255,255,255,0.08); color: inherit; font: inherit; font-size: 13px; padding: 0 10px; white-space: nowrap; }
#shotHintClose { min-width: 36px; padding: 0; }
#shotHintText { white-space: nowrap; }

/* One-time "try the modern look" offer: a small card pinned bottom-centre. */
#visualsOffer {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 40;
  display: flex; align-items: center; gap: 8px; max-width: calc(100% - 24px); flex-wrap: wrap; justify-content: center;
  background: rgba(10,15,22,0.92); border: 1px solid rgba(255,255,255,0.18); border-radius: 12px;
  padding: 10px 12px 10px 14px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
#visualsOffer[hidden] { display: none; }
#visualsOffer .vo-text { color: #c9ccd1; }
#visualsOffer .vo-text b { color: #fff; margin-right: 6px; }
#visualsOffer button { min-height: 34px; border-radius: 9px; border: 1px solid rgba(255,255,255,0.25); background: rgba(255,255,255,0.08); color: inherit; font: inherit; font-size: 13px; font-weight: 600; padding: 0 12px; white-space: nowrap; cursor: pointer; }
#visualsOffer button.primary { background: #6fd3a6; border-color: #6fd3a6; color: #0f1a14; }
/* Phones: the tee usually lands low on the rotated board, so keep the words up top. */
@media (pointer: coarse), (max-width: 760px) {
  #shotHint { top: calc(44px + env(safe-area-inset-top)); bottom: auto; font-size: 14px; gap: 6px; padding: 6px 6px 6px 12px; }
}

#powerbar {
  position: absolute; left: 18px; bottom: 18px; width: 200px; height: 16px;
  background: rgba(0,0,0,0.45); border-radius: 8px; overflow: hidden;
  border: 1px solid rgba(255,255,255,0.2);
}
#powerfill { height: 100%; width: 0%; background: linear-gradient(90deg,#6fd3a6,#f0c419,#e8503a); }

#scoreOverlay {
  position: absolute; inset: 0; display: none;
  align-items: center; justify-content: center;
  background: rgba(8,12,18,0.82);
}
#scoreOverlay.show { display: flex; }
#scoreCard { background: #1f2024; padding: 22px; border-radius: 12px; max-width: 92%; overflow: auto; }

table { border-collapse: collapse; font-size: 14px; }
th, td { padding: 6px 10px; text-align: center; border: 1px solid rgba(255,255,255,0.10); }
th { background: #1c1d20; color: #8a8f98; }
td.name { text-align: left; white-space: nowrap; }
tr.me td { background: #243c2c; }

#gameOverHint { text-align: center; }
.overlay {
  position: absolute; inset: 0; display: none; z-index: 20;
  align-items: center; justify-content: center; background: rgba(8,12,18,0.85);
  overflow-y: auto; overscroll-behavior: contain;
}
.overlay > .panel { margin: auto; }   /* centred, but scrollable when taller than the screen */
.overlay.show { display: flex; }

/* ===== Daily Challenge card (menu) ===== */
.daily-card { background: linear-gradient(180deg, #1d2733, #182029); border: 1px solid rgba(111,211,166,0.25); border-radius: 12px; padding: 12px 13px; margin-bottom: 14px; }
.daily-head { display: flex; align-items: center; justify-content: space-between; font-weight: 600; font-size: 14px; color: #eaf6ef; }
.daily-date { font-size: 12px; font-weight: 500; color: #6fd3a6; font-variant-numeric: tabular-nums; }
.daily-row { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 10px; }
/* height: auto overrides the global `button { height: 40px }` — without it the two-line
   content (title + par) overflows the fixed 40px and the par crashes into the bottom. */
.daily-play { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; height: auto; padding: 11px 13px; border-radius: 9px; background: #232e29; border: 1px solid rgba(111,211,166,0.22); color: #ededed; cursor: pointer; text-align: left; line-height: 1.2; }
.daily-play:hover:not(:disabled) { background: #294036; border-color: #6fd3a6; }
.daily-play:disabled { opacity: 0.5; cursor: default; }
.daily-play .dp-title { font-weight: 600; font-size: 14px; line-height: 1.2; }
.daily-play .dp-sub { font-size: 12px; color: #9aa3ad; line-height: 1.2; font-variant-numeric: tabular-nums; }
.daily-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 9px; }
/* The status gets at least 150px; when Replay + Stats + Board leave less (phones, once
   played) it takes its own line above the buttons instead of wrapping word by word. */
.daily-foot .sub { flex: 1 1 150px; min-width: 0; font-size: 11px; line-height: 1.3; }
#dailyBoardBtn, #dailyStatsBtn { flex-shrink: 0; white-space: nowrap; }            /* buttons keep their size; labels never wrap */
/* Daily leaderboard modal */
.board-panel { width: min(420px, 92vw); }
.board-tabs { display: flex; gap: 6px; margin: 10px 0; }
.board-tab { flex: 1; height: 32px; border-radius: 8px; background: #232428; border: 1px solid rgba(255,255,255,0.10); color: #cfd3d8; cursor: pointer; font-size: 13px; }
.board-tab.active { background: #6fd3a6; color: #06281a; border-color: transparent; font-weight: 600; }
.board-list { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.board-row { display: flex; align-items: center; gap: 10px; background: #26272b; border: 1px solid rgba(255,255,255,0.07); border-radius: 8px; padding: 7px 11px; font-size: 13px; }
.board-row .br-rank { width: 22px; color: #8a8f98; font-variant-numeric: tabular-nums; }
.board-row .br-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-row .br-score { font-weight: 600; font-variant-numeric: tabular-nums; }
.board-empty { color: #8a8f98; font-size: 13px; text-align: center; padding: 18px 0; }

.preview-panel { width: auto; max-width: 92vw; }
.preview-panel h2 { text-align: center; }
#previewCanvas {
  width: min(680px, 84vw); height: auto; background: #46b35a;
  border-radius: 8px; image-rendering: auto; display: block;
}
.preview-panel .menu-buttons { flex-direction: row; flex-wrap: wrap; justify-content: center; }
.preview-panel .menu-buttons button { flex: 1; min-width: 120px; }
.preview-nav { display: flex; align-items: center; justify-content: center; gap: 14px; }
.preview-nav button { padding: 6px 14px; }
.preview-nav span { font-size: 14px; color: #8a8f98; min-width: 130px; text-align: center; }

/* ===== Chat (lives in the lobby rail) ===== */
.chat-log { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex: 1; min-height: 0; }
.chat-log:empty::before { content: 'No messages yet — say hi'; color: #62666d; font-style: italic; font-size: 13px; }
.chat-msg { font-size: 13px; line-height: 1.45; word-break: break-word; color: #c9ccd1; }
.chat-msg .cm-name { font-weight: 600; color: #6fd3a6; margin-right: 4px; }
.chat-msg.system { color: #62666d; font-style: italic; }
.chat-entry { display: flex; gap: 8px; margin-top: 2px; flex-shrink: 0; }
.chat-entry input { flex: 1; min-width: 0; }
.chat-entry button { flex-shrink: 0; padding: 0 14px; }

/* In-game transient feed (bottom-left, fades) + Enter-to-open input bar. */
#chatFeed {
  position: absolute; left: 18px; bottom: 76px; width: min(360px, 42%);
  display: flex; flex-direction: column; gap: 4px; pointer-events: none; z-index: 4;
}
#chatFeed .chat-msg {
  align-self: flex-start; max-width: 100%;
  background: rgba(10,15,22,0.72); border-radius: 8px; padding: 4px 9px;
  opacity: 1; transition: opacity 0.5s;
}
#chatFeed .chat-msg.fade { opacity: 0; }
#chatBar { position: absolute; left: 18px; bottom: 44px; width: min(360px, 42%); z-index: 6; display: flex; gap: 6px; }
#chatBar[hidden] { display: none; }
#chatBar input {
  flex: 1; min-width: 0; height: 38px; background: rgba(10,15,22,0.92);
  border: 1px solid #6fd3a6; border-radius: 8px; color: #ededed; padding: 0 12px; font-size: 14px;
}
#chatBar #chatClose {
  flex-shrink: 0; width: 38px; height: 38px; padding: 0; font-size: 15px;
  background: rgba(10,15,22,0.92); border: 1px solid rgba(255,255,255,0.18); border-radius: 8px;
}

/* ===== Touch / mobile ===== */
/* On-screen controls for touch players (Tab/Enter have no key on a phone). */
#touchControls { position: absolute; right: 70px; bottom: 18px; display: none; gap: 10px; z-index: 6; }
#touchControls button {
  width: 42px; height: 42px; padding: 0; font-size: 19px; line-height: 1;
  background: rgba(10,15,22,0.6); border-radius: 10px;
  backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px);
}
#touchControls button:hover { background: rgba(20,30,44,0.9); }

/* Coarse pointers (touch): reveal touch controls, hide keyboard-only hints. */
@media (pointer: coarse) {
  #touchControls { display: flex; }
  kbd { display: none; }
}

/* Keep bottom-anchored chrome clear of the iOS home indicator / gesture bar.
   env() is 0 on desktop / non-notched devices, so this is a no-op there. */
@supports (padding: env(safe-area-inset-bottom)) {
  .hud-btn { bottom: calc(18px + env(safe-area-inset-bottom)); }
  #touchControls { bottom: calc(18px + env(safe-area-inset-bottom)); }
  #powerbar { bottom: calc(18px + env(safe-area-inset-bottom)); }
  #chatBar { bottom: calc(44px + env(safe-area-inset-bottom)); }
  #chatFeed { bottom: calc(76px + env(safe-area-inset-bottom)); }
}

/* Narrow screens: stop the absolutely-positioned HUD from overlapping, stack
   the lobby share row, and collapse the map-browser sidebar above the list. */
@media (max-width: 760px) {
  .lobby-top { flex-wrap: wrap; }

  .browser-head { flex-wrap: wrap; }
  .browser-head h2 { width: 100%; }
  .browser-body { flex-direction: column; gap: 10px; }
  .cat-tabs { width: 100%; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .cat-tab { white-space: nowrap; flex-shrink: 0; }
  .cat-tab .cnt { float: none; margin-left: 6px; }

  /* Map rows: name gets its own full line and the action buttons split the row
     below it — otherwise name + author + par + 2 buttons collide on a phone and
     the name collapses to an ellipsis. */
  .track-row { flex-wrap: wrap; row-gap: 8px; }
  .track-row .tname { flex: 1 1 100%; }
  .track-row .tauthor { max-width: none; }
  .track-row button { flex: 1 1 calc(50% - 4px); }
}

/* In-game HUD on touch (ANY orientation — incl. landscape phones wider than
   760px) OR narrow screens: tuck the chrome into the corners and make the
   scoreboard a compact, glanceable strip so it covers as little of the board
   as possible. Gated on pointer:coarse so landscape phones actually get it
   (a plain max-width:760px never matches a landscape phone). */
@media (pointer: coarse), (max-width: 760px) {
  #hudTopLeft { left: 10px; top: 10px; font-size: 12px; padding: 6px 9px; }
  #powerbar { left: 10px; width: 40vw; max-width: 200px; }
  #chatFeed, #chatBar { left: 10px; width: min(70vw, 360px); }

  /* Compact scoreboard: drop the header row and the turn-arrow column, cap
     names — whose-turn is still shown by the row highlight. ~half the width. */
  #scorePanel { right: 10px; top: 10px; min-width: 0; width: fit-content; max-width: 40vw; padding: 6px 8px; gap: 2px; }
  .sp-head { display: none; }
  .sp-row { font-size: 11px; padding: 2px 6px; gap: 6px; }
  .sp-row .pturn { display: none; }
  .sp-row .dot { width: 8px; height: 8px; }
  .sp-row .pname { flex: 0 1 auto; max-width: 84px; }
}

@media (orientation: portrait) and (max-width: 760px) {
  #hudTopLeft { max-width: calc(58vw - 20px); line-height: 1.35; }
  #scorePanel { max-width: 40vw; }
}
@media (pointer: coarse) {
  #lobbyListRefresh { width: 36px; height: 36px; }
  .kofi-inline { padding: 12px 0 4px; }
}
.ds-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* ===== Replays ===== */
#replayBar { position: absolute; left: 10px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 7; display: flex; align-items: center; gap: 8px;
  padding: 6px 6px 6px 12px; border-radius: 10px; background: rgba(10,15,22,0.72); backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px);
  font-size: 13px; font-weight: 600; color: #eaf6ef; max-width: calc(100% - 180px); }
#replayBar[hidden] { display: none; }
#replayWho { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#replayExit, #replaySpeed { width: 34px; height: 34px; padding: 0; flex: none; }
#replaySpeed { width: 40px; font-size: 12px; font-variant-numeric: tabular-nums; }
.replaying #powerbar, .replaying #chatBtn, .replaying #chatBar { display: none !important; }
.replaying canvas { cursor: default; }
.br-watch { width: 34px; height: 30px; padding: 0; font-size: 12px; flex: none; }
#dailyBoardMsg:empty { display: none; }
#dailyBoardMsg { margin-top: 8px; text-align: center; }

/* /daily: nothing but a "teeing up" screen until the round (or the menu, if you already
   played or it failed) is ready — the client drops .boot-daily. */
.boot-daily .screen { visibility: hidden; }
.boot-daily body::after { content: "⛳ Teeing up today's daily…"; position: fixed; inset: 0; display: grid; place-items: center; font: 600 16px/1.4 system-ui, sans-serif; color: #9aa3ad; }

/* ===== Daily as the front door ===== */
.daily-sub-row { display: flex; align-items: baseline; gap: 10px; margin-top: 3px; }
.daily-theme { flex: 1; min-width: 0; font-size: 13px; color: #9aa3ad; min-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.daily-next { flex: none; font-size: 12px; color: #6fd3a6; font-variant-numeric: tabular-nums; }
.daily-next-result { font-size: 12px; color: #9aa3ad; margin: 0 0 8px; font-variant-numeric: tabular-nums; }
.daily-next-result:empty { display: none; }
.daily-hero { height: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; width: 100%; margin-top: 10px; padding: 13px 15px; border-radius: 10px; background: #6fd3a6; border: none; color: #10261b; cursor: pointer; text-align: left; }
.daily-hero:hover:not(:disabled) { background: #85e0b7; }
.daily-hero:disabled { opacity: 0.55; cursor: default; }
.daily-hero .dp-title { font-weight: 700; font-size: 16px; }
.daily-hero .dp-sub { font-size: 12px; color: #1f4633; font-variant-numeric: tabular-nums; }
.daily-more { display: contents; }
.daily-foot .mini .dp-sub { color: #9aa3ad; font-size: 11px; }
.board-tabs:empty { display: none; }
.daily-share { margin: 12px 0 4px; padding: 12px; border-radius: 10px; background: #182029; border: 1px solid rgba(111,211,166,0.25); text-align: center; }
.ds-head { font-weight: 600; color: #eaf6ef; margin-bottom: 8px; }
.ds-head b { color: #6fd3a6; }
.ds-text { margin: 0 0 10px; font: 15px/1.5 ui-monospace, monospace; white-space: pre-wrap; color: #ededed; }
/* Phones: the thing you came to do goes first; lobbies and tools go below it. */
@media (max-width: 760px) {
  #menu > .stage-main { order: -1; }
  #menu > .rail { border-bottom: none; border-top: 1px solid rgba(255,255,255,0.11); }
}
.ds-name { display: flex; gap: 8px; margin: 0 0 6px; }
.ds-name[hidden] { display: none; }
.ds-change { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; }   /* display:flex would otherwise beat the hidden attribute */
.ds-name input { flex: 1; min-width: 0; }
#dailyNameMsg { min-height: 0; margin-bottom: 8px; font-size: 12px; }
#dailyNameMsg:empty { display: none; }
.rail-foot .kofi { color: #f0b37e; }
.kofi-inline { display: block; margin-top: 10px; font-size: 12px; color: #9aa3ad; text-decoration: none; }
.kofi-inline:hover { color: #f0b37e; }

/* ---- Your stats (#64): numbers row + vs-par distribution, result card and modal ---- */
.ds-stats { margin: 12px 0 2px; }
.ds-stats[hidden] { display: none; }
.st-nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.st-num { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.st-num b { font-size: 20px; color: #eaf6ef; font-variant-numeric: tabular-nums; }
.st-num span { font-size: 11px; color: #8a8f98; text-align: center; line-height: 1.2; }
.st-dist { display: flex; align-items: stretch; gap: 3px; height: 96px; padding: 0 2px; }
.st-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.st-count { flex-shrink: 0; font-size: 11px; color: #cfd3d8; height: 14px; font-variant-numeric: tabular-nums; }
.st-bar { flex-shrink: 0; width: 100%; max-width: 26px; min-height: 2px; background: #3a3d44; border-radius: 3px 3px 0 0; }   /* px height from statsHtml; never squeezed */
.st-col.today .st-bar { background: #6fd3a6; }
.st-col.today .st-label, .st-col.today .st-count { color: #6fd3a6; font-weight: 700; }
.st-label { flex-shrink: 0; font-size: 10px; color: #8a8f98; margin-top: 3px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.st-foot { font-size: 12px; color: #8a8f98; margin-top: 6px; text-align: center; }
.st-empty { color: #8a8f98; font-size: 13px; text-align: center; padding: 10px 0; }
@media (max-width: 420px) { .st-label { font-size: 9px; } .st-num b { font-size: 17px; } }


/* ===== Home: Clubhouse (desktop) / Feed (phone) =====
   Desktop: top bar, then three columns: open games | the daily | other ways to play.
   Below 1100px: one column, daily first. Phones (<=760px): the daily's button moves
   into a dock pinned to the bottom of the screen, where the thumb is. */
#menu { flex-direction: column; overflow-y: auto; }
#menu > .stage-main { order: 0; flex: none; overflow: visible; align-items: flex-start; padding: 24px 28px 40px; }

.topbar {
  position: sticky; top: 0; z-index: 5; flex-shrink: 0;
  display: flex; align-items: center; gap: 22px; height: 64px; padding: 0 28px;
  background: rgba(26,27,30,0.94); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.topbar .brand-logo { width: 36px; height: 36px; font-size: 19px; }
.topbar-tagline { margin: 0; min-width: 0; font-size: 13px; color: #8a8f98; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-nav { margin-left: auto; display: flex; gap: 2px; flex-shrink: 0; }
.topbar-nav .ghost, .feed-links .ghost { font-size: 13.5px; padding: 8px 10px; }
.topbar-nav .kofi, .feed-links .kofi { color: #f0b37e; }
.name-chip {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0; height: 38px; padding: 0 4px 0 12px;
  border-radius: 19px; background: #1f2024; border: 1px solid rgba(255,255,255,0.10); font-size: 12px; color: #8a8f98; cursor: text;
}
.name-chip:focus-within { border-color: #6fd3a6; }
.name-chip input { width: 132px; height: 30px; padding: 0 11px; border: none; border-radius: 15px; background: #26272b; font-size: 13px; font-weight: 600; }
.name-chip input:focus { box-shadow: none; }

#menu .content.home { max-width: 600px; display: flex; flex-direction: column; gap: 16px; }
.home-card {
  display: flex; flex-direction: column; gap: 12px; min-width: 0;
  background: #1b1c21; border: 1px solid rgba(255,255,255,0.07); border-radius: 16px; padding: 20px;
}
.games-card { order: 0; }
#dailyCard { order: 1; }
.play-card { order: 2; }
.feed-links { order: 3; display: none; justify-content: center; flex-wrap: wrap; gap: 2px; }
.games-card.empty { display: none; }   /* below desktop: no box when there is nothing to join */
@media (max-width: 1099px) { .topbar-tagline { display: none; } }
@media (min-width: 1100px) {
  #menu > .stage-main { padding: 28px 32px 48px; }
  #menu .content.home { max-width: 1320px; display: grid; grid-template-columns: 280px minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
  .games-card.empty { display: flex; }
}
.play-card .screen-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: #8a8f98; }

/* Open games */
.games-card .lobby-list { flex: none; overflow: visible; }
.lobby-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; color: #a3a8b0; }
.lobby-empty .mini { width: auto; height: 32px; padding: 0 14px; }
.lobby-empty .sub { font-size: 12px; color: #8a8f98; }

/* The daily */
.daily-card.home-card { margin: 0; padding: 24px 26px; gap: 0; border-radius: 18px; background: linear-gradient(180deg, #1c2631 0%, #1a2028 50%, #1b1c21 100%); border-color: rgba(111,211,166,0.25); }
.daily-card .daily-head { font-size: 13px; font-weight: 600; color: #9fd9bd; }
.daily-kicker { display: inline-flex; align-items: baseline; gap: 8px; }
.daily-card .daily-date { color: #7d9a8c; font-weight: 500; }
.daily-card .daily-theme { flex: none; margin-top: 8px; min-height: 44px; font-size: 42px; line-height: 1.05; font-weight: 700; letter-spacing: -1.2px; color: #f2f7f4; white-space: normal; }
.daily-info { margin-top: 6px; font-size: 14px; color: #a3a8b0; }
.daily-info:empty, .daily-chips:empty { display: none; }
.daily-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip { padding: 6px 10px; border-radius: 8px; background: rgba(255,255,255,0.05); font-size: 13px; color: #c9ccd1; }
.chip b { color: #ededed; }

.daily-result { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 20px; }
.daily-result[hidden], .daily-strip[hidden], .dt-hint[hidden] { display: none; }
.dr-stat { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 14px 6px 12px; border-radius: 12px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06); }
.dr-stat b { font-size: 38px; line-height: 1; font-weight: 700; letter-spacing: -0.5px; color: #f2f7f4; font-variant-numeric: tabular-nums; }
.dr-stat span { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: #a3a8b0; }
.dr-stat:nth-child(3) b { color: #6fd3a6; }

/* Hole-by-hole strip: blue under par, green par, yellow bogey, orange worse. */
.daily-strip { margin-top: 12px; }
.ds-holes { display: grid; gap: 4px; }
.ds-hole { height: 26px; border-radius: 6px; }
.ds-hole.under, .ds-legend .under::before { background: #7cc4ff; }
.ds-hole.par, .ds-legend .par::before { background: #6fd3a6; }
.ds-hole.bogey, .ds-legend .bogey::before { background: #f0c419; }
.ds-hole.worse, .ds-legend .worse::before { background: #ff8a65; }
.ds-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 12px; color: #a3a8b0; }
.ds-legend span { display: inline-flex; align-items: center; gap: 5px; }
.ds-legend span::before { content: ""; width: 9px; height: 9px; border-radius: 2px; }

.daily-card .daily-hero { margin-top: 20px; }
.daily-card .daily-hero:not(.shared) { padding: 18px 20px; border-radius: 12px; }
.daily-card .daily-hero:not(.shared) .dp-title { font-size: 21px; }
.daily-card .daily-hero:not(.shared) .dp-sub { font-size: 13px; }
/* Once played, Share is a quiet outline: the numbers are the point. */
.daily-hero.shared { flex-direction: row; align-items: baseline; justify-content: space-between; gap: 10px; margin-top: 12px; padding: 12px 16px; background: transparent; border: 1px solid rgba(111,211,166,0.45); color: #6fd3a6; }
.daily-hero.shared:hover:not(:disabled) { background: rgba(111,211,166,0.08); }
.daily-hero.shared .dp-title { font-size: 14px; font-weight: 600; }
.daily-hero.shared .dp-sub { color: #7d9a8c; }
.daily-card .daily-foot { display: flex; flex-wrap: nowrap; gap: 8px; margin-top: 10px; }
.daily-card .daily-foot .mini, .daily-card .daily-more .mini { flex: 1 1 0; min-width: 0; height: 38px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.daily-top { margin-top: 24px; }
.dt-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding-bottom: 8px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: #8a8f98; }
.dt-full { height: auto; padding: 0; background: none; border: none; color: #6fd3a6; font-size: 12.5px; font-weight: 600; text-transform: none; letter-spacing: 0; }
.dt-full:hover { background: none; text-decoration: underline; }
.dt-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; min-height: 30px; }
.dt-list li { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 4px 8px; border-radius: 8px; font-size: 14px; color: #c9ccd1; }
.dt-list li.me { background: rgba(111,211,166,0.10); color: #eaf6ef; font-weight: 600; }
.dt-rank { width: 18px; color: #8a8f98; font-variant-numeric: tabular-nums; }
.dt-list li:nth-child(1) .dt-rank { color: #f0c419; font-weight: 700; }
.dt-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dt-score { font-weight: 600; font-variant-numeric: tabular-nums; }
.dt-watch { flex: none; width: 36px; height: 30px; padding: 0; font-size: 11px; }
.dt-list li.dt-empty { justify-content: center; font-size: 13px; color: #8a8f98; }
.dt-hint { margin-top: 8px; font-size: 12px; color: #a3a8b0; }

/* The dock (phones only). */
.dock { display: none; }
#dockSolo[hidden] { display: none; }

@media (max-width: 760px) {
  .topbar { height: 56px; gap: 10px; padding: 0 16px; }
  .topbar-nav { display: none; }
  .name-chip { margin-left: auto; padding: 0 3px; }
  .name-chip > span { display: none; }
  .name-chip input { width: 124px; }
  .feed-links { display: flex; }
  #menu > .stage-main { padding: 14px 16px calc(104px + env(safe-area-inset-bottom)); }
  #menu .content.home { max-width: none; gap: 14px; }
  .home-card { padding: 16px; }
  .daily-card.home-card { padding: 18px 16px; }
  .daily-card .daily-theme { font-size: 34px; }
  .dr-stat b { font-size: 30px; }
  .daily-card .daily-hero { display: none; }   /* the dock is the button */
  .dock {
    display: flex; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 8;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: rgba(23,24,27,0.94); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    border-top: 1px solid rgba(255,255,255,0.08);
  }
  .dock button { height: 56px; border-radius: 14px; }
  #dockMain { flex: 1.25; font-size: 17px; font-weight: 700; }
  #dockSolo { flex: 1; font-size: 15px; font-weight: 600; }
}

/* ----- Home, matched to the Clubhouse / Feed designs ----- */

/* Course: one card, picture on top, name + Change underneath. */
.course-box { gap: 0; border: 1px solid rgba(255,255,255,0.10); border-radius: 12px; overflow: hidden; background: #232428; }
.course-box .course-thumb { border: none; border-radius: 0; }
.course-box .course-pick { border: none; border-radius: 0; background: transparent; min-height: 56px; padding: 10px 14px; }
.course-box .course-pick:hover { box-shadow: none; background: #2a2b2f; }
.course-box .cp-name { font-size: 15px; }
.import-btn { width: 100%; height: 40px; padding: 0 12px; background: transparent; border: 1px dashed rgba(255,255,255,0.18); color: #a3a8b0; font-size: 13px; }
.import-btn:hover { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.30); }

/* Your round: You / Rank / Streak, label on top, number + suffix. */
.dr-stat { display: block; text-align: left; padding: 14px 16px; }
.dr-label { display: block; margin-bottom: 6px; }
.dr-stat b { font-size: 36px; }
.dr-stat small { font-size: 16px; font-weight: 500; color: #a3a8b0; }
.dr-stat:nth-child(2) b { color: #6fd3a6; }
.dr-stat:nth-child(3) b { color: #f2f7f4; }
.daily-chips[hidden] { display: none; }

/* After playing: Share, Replay, Stats in one row (Board lives behind "Full board"). */
#dailyBoardBtn[hidden] { display: none; }
.daily-card.played .daily-actions { display: flex; gap: 8px; margin-top: 14px; }
.daily-card.played .daily-hero { flex: 1.4 1 0; min-width: 0; margin: 0; height: 42px; padding: 0 14px; align-items: center; justify-content: center; }
.daily-card.played .daily-hero .dp-sub { display: none; }
.daily-card.played .daily-foot { display: contents; }
.daily-card.played .daily-foot .mini { height: 42px; }

.dt-vs { min-width: 24px; text-align: right; font-size: 12px; color: #a3a8b0; font-variant-numeric: tabular-nums; }

/* Open games */
.games-card { gap: 10px; }
.games-count { text-transform: none; letter-spacing: 0; font-weight: 500; }
.games-card .rail-head > span { display: inline-flex; gap: 6px; }
.games-card .lobby-empty { padding: 16px 0; font-size: 13px; }
.games-hint { margin-top: auto; padding: 14px; border-radius: 10px; border: 1px dashed rgba(255,255,255,0.14); text-align: center; font-size: 12px; line-height: 1.5; color: #a3a8b0; }

.dock-sub { margin-left: 6px; font-size: 13px; font-weight: 500; color: #1f4633; }

/* Desktop: the three columns fill the window, no dead space. The board, the open-games
   list and the course picture take whatever height is left; the page scrolls only when
   the window is shorter than the content. */
@media (min-width: 1100px) {
  #menu { overflow: hidden; }
  #menu > .stage-main { flex: 1; min-height: 0; overflow-y: auto; align-items: stretch; padding: 22px 28px; }
  #menu .content.home {
    max-width: none; height: 100%; min-height: 640px; align-items: stretch;
    grid-template-columns: clamp(260px, 19vw, 360px) minmax(0, 1fr) clamp(340px, 25vw, 460px);
  }
  .games-card .lobby-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
  .daily-card .daily-theme { font-size: clamp(42px, 3.4vw, 64px); }
  .daily-card .daily-top { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .daily-card .dt-list { flex: 1; min-height: 0; overflow-y: auto; }
  .play-card .course-box { flex: 1; min-height: 0; }
  .play-card .course-thumb { flex: 1; min-height: 160px; aspect-ratio: auto; }
  .play-card .screen-title { display: none; }
}
@media (max-width: 1099px) { .dt-list li:nth-child(n+6):not(.me) { display: none; } }

/* Phones (Feed) */
@media (max-width: 760px) {
  .course-box { flex-direction: row; }
  .course-box .course-thumb { width: 104px; flex: none; aspect-ratio: auto; min-height: 56px; }
  .course-box .ct-tag, .course-box .ct-peek { display: none; }
  .course-box .course-pick { flex: 1; min-width: 0; }
  /* After playing: the score, big. */
  .daily-result { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dr-stat:first-child { grid-column: 1 / -1; }
  .dr-stat:first-child b { font-size: 64px; letter-spacing: -2px; }
  .dr-stat:first-child small { font-size: 18px; }
  .daily-card.played .daily-actions { margin-top: 12px; }
  /* Open games: a one-line banner, only when there are some. */
  .games-card { padding: 10px 12px; gap: 6px; }
  .games-card .games-hint { display: none; }
  .games-card .lobby-row ~ .lobby-row { display: none; }
  .games-card .lobby-row { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 10px; }
  .games-card .lobby-row .lr-top { flex: 1; min-width: 0; }
  .games-card .lobby-row .lr-sub { display: none; }
  .games-card .lobby-row button { width: auto; height: 36px; padding: 0 16px; }
}
.course-box .course-pick { flex: none; }   /* the picture grows, not the name row */
@media (max-width: 760px) { .course-box .course-pick { flex: 1; } }

/* Course picture: desktop stacks the first three holes down the tall column (no
   letterboxed grass); smaller screens show hole 1. */
.ct-stack { display: block; width: 100%; height: 100%; }
.ct-extra { display: none; }
/* Your dailies (history) under the board: desktop only. */
.daily-mine { margin-top: 18px; }
.daily-mine[hidden] { display: none; }
.daily-mine .ds-stats { margin: 0; }
@media (min-width: 1100px) {
  .course-thumb .ct-stack { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 4px; overflow: hidden; }
  .course-thumb .ct-stack canvas { flex: none; width: 100%; height: auto; object-fit: fill; }
  .course-thumb .ct-extra:not([hidden]) { display: block; }
  .course-thumb .ct-tag { top: 8px; bottom: auto; }
}
@media (max-width: 1099px) { .daily-mine { display: none !important; } }
@media (min-width: 1100px) {
  /* One row that exactly fills the window: cards never grow past it; long lists scroll inside. */
  #menu .content.home { grid-template-rows: minmax(0, 1fr); }
  .home-card { min-height: 0; overflow-y: auto; }
  /* With history showing, the board takes its rows and the history chart takes the rest. */
  .daily-card:has(.daily-mine:not([hidden])) .daily-top { flex: 0 1 auto; }
}
@media (min-width: 1100px) and (max-height: 860px) { .daily-mine { display: none !important; } }

/* ===== Wide screens =====
   The middle column used to soak up all extra width: board names a screen apart from
   their scores, a Play bar 1400px long. Instead, once the daily card itself is wide it
   splits in two (the daily | your history), and very large screens scale the menu up. */
.daily-card { container: daily / inline-size; }
.daily-body, .daily-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.daily-body, .daily-main { flex: 1 1 auto; }
.daily-card:has(.daily-mine:not([hidden])) .daily-main { flex: 0 1 auto; }
@container daily (min-width: 900px) {
  .daily-body { flex-direction: row; gap: 32px; }
  .daily-main, .daily-card:has(.daily-mine:not([hidden])) .daily-main { flex: 1 1 0; }
  .daily-card:has(.daily-mine:not([hidden])) .daily-top { flex: 1 1 auto; }
  .daily-mine { flex: 0 0 clamp(320px, 38%, 620px); margin-top: 0; padding-left: 32px; border-left: 1px solid rgba(255,255,255,0.07); }
}
/* Scale the whole menu on very large screens so type and controls keep their proportion. */
@media (min-width: 2200px) { #menu { zoom: 1.15; } }
@media (min-width: 3000px) { #menu { zoom: 1.3; } }

/* ===== Stats: Leaderboards (/leaderboards), Your history (/me), and the home card's
   stats. One set of tokens so medals, finishes and holes read the same everywhere. ===== */
:root {
  --sx-bg: #17181b; --sx-rail: #1c1d20; --sx-panel: #1f2024; --sx-row: #26272b; --sx-control: #232428;
  --sx-hair: rgba(255,255,255,0.07); --sx-hair-2: rgba(255,255,255,0.10);
  --sx-text: #ededed; --sx-text-2: #c9ccd1; --sx-text-3: #a3a8b0; --sx-muted: #8a8f98; --sx-faint: #62666d;
  --sx-mint: #6fd3a6; --sx-mint-ink: #06281a; --sx-mint-soft: rgba(111,211,166,0.10); --sx-mint-line: rgba(111,211,166,0.25);
  --sx-bright: #eaf6ef; --sx-bad: #ff8a65;
  /* finishes */
  --medal-1: #f0c419; --medal-2: #c0c6cf; --medal-3: #d08a4e; --top10: rgba(111,211,166,0.55); --played: #3a3d44;
  --medal-ink: #1c1f24;
  /* holes (the hole strip's colours, plus eagle) */
  --hole-ace: #c792ff; --hole-eagle: #3d8fe0; --hole-birdie: #7cc4ff; --hole-par: #6fd3a6; --hole-bogey: #f0c419; --hole-double: #ff8a65;
}
a.mini { display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; text-decoration: none; }
.nav-leaders { color: var(--sx-bright); }

.stats-screen { flex-direction: column; overflow-y: auto; background: var(--sx-bg); font-variant-numeric: tabular-nums; }
.sx-wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 24px 64px; display: flex; flex-direction: column; gap: 22px; }
.sx-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--sx-hair); }
.sx-headline { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sx-headline h1 { margin: 0; font-size: 40px; font-weight: 700; letter-spacing: -1.2px; color: #f2f7f4; }
.sx-back, .sx-link { color: var(--sx-mint); text-decoration: none; font-size: 13px; font-weight: 600; }
.sx-back:hover, .sx-link:hover { text-decoration: underline; }
.sx-sub { margin: 0; font-size: 14px; color: var(--sx-text-3); line-height: 1.45; }
.sx-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.sx-seg { display: flex; gap: 4px; background: var(--sx-panel); border: 1px solid var(--sx-hair-2); border-radius: 10px; padding: 3px; }
.sx-seg:empty { display: none; }
.sx-seg button { height: 32px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--sx-text-2); font-size: 13px; }
.sx-seg button:hover { background: #2c2d31; }
.sx-seg button[aria-pressed="true"] { background: var(--sx-mint); color: var(--sx-mint-ink); font-weight: 600; }
.sx-nav { position: sticky; top: 0; z-index: 3; display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; background: var(--sx-rail); border: 1px solid rgba(255,255,255,0.11); border-radius: 12px; }
.sx-nav a { height: 34px; padding: 0 12px; border-radius: 8px; display: inline-flex; align-items: center; font-size: 14px; color: var(--sx-text-3); text-decoration: none; }
.sx-nav a:hover { background: #2c2d31; color: var(--sx-text); }
.sx-body { display: flex; flex-direction: column; gap: 22px; }
.sx-body section { scroll-margin-top: 64px; }
.sx-empty { padding: 40px 12px; text-align: center; color: var(--sx-muted); font-size: 14px; line-height: 1.5; }
.sx-cols { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.sx-cols > * { flex: 1 1 420px; min-width: 0; }
.sx-card { background: var(--sx-panel); border: 1px solid var(--sx-hair); border-radius: 14px; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.sx-card.hero { background: linear-gradient(180deg, #1d2733, #182029); border-color: var(--sx-mint-line); }
.sx-h2 { margin: 0; font-size: 20px; font-weight: 700; }
.sx-label { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--sx-muted); }
.sx-cardhead { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.sx-note { margin: 0; font-size: 12px; color: var(--sx-muted); line-height: 1.45; }
.sx-big { font-size: 20px; font-weight: 700; color: var(--sx-bright); line-height: 1.3; }
.sx-up { color: var(--sx-mint); } .sx-down { color: var(--sx-bad); }
[title] { text-underline-offset: 3px; }
.sx-help { border-bottom: 1px dotted rgba(255,255,255,0.3); cursor: help; }

/* Tiles: number + label + one line of detail */
.sx-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); gap: 10px; }
.sx-tile { background: var(--sx-row); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sx-tile b { font-size: 26px; line-height: 1.1; color: #f2f7f4; }
.sx-tile .k { font-size: 11px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--sx-muted); }
.sx-tile .d { font-size: 12px; color: var(--sx-text-3); }
.sx-tile.mint { background: var(--sx-mint-soft); border: 1px solid rgba(111,211,166,0.22); }

/* Medal dots and counts */
.medal { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; vertical-align: middle; }
.medal.g { background: var(--medal-1); } .medal.s { background: var(--medal-2); } .medal.b { background: var(--medal-3); }
.medal.t { background: var(--top10); border-radius: 3px; }
.medals { display: inline-flex; gap: 12px; align-items: center; font-weight: 700; }
.medals span { display: inline-flex; align-items: center; gap: 5px; }
.medal-badge { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: var(--medal-ink); flex: none; }
.medal-badge.g { background: var(--medal-1); } .medal-badge.s { background: var(--medal-2); } .medal-badge.b { background: var(--medal-3); }

/* Tables */
.sx-tablewrap { overflow-x: auto; margin: 0 -20px; }
.sx-table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 14px; }
.sx-table th, .sx-table td { border: 0; background: none; }
.sx-table th { padding: 8px; font-size: 12px; font-weight: 600; color: var(--sx-muted); text-align: right; white-space: nowrap; }
.sx-table td { padding: 10px 8px; text-align: right; border-top: 1px solid var(--sx-hair); white-space: nowrap; }
.sx-table th:first-child, .sx-table td:first-child { padding-left: 20px; }
.sx-table th:last-child, .sx-table td:last-child { padding-right: 20px; }
.sx-table .l { text-align: left; }
.sx-table .pos { color: var(--sx-muted); width: 28px; }
.sx-table .gold { color: var(--medal-1); font-weight: 700; }
.sx-table .dim { color: var(--sx-faint); }
.sx-table tr.you td { background: var(--sx-mint-soft); color: var(--sx-bright); font-weight: 600; }
.sx-table tr.you a { color: inherit; }
.sx-more { align-self: center; }

/* Rows (champ, records, rivals, best rounds) */
.sx-rows { display: flex; flex-direction: column; gap: 6px; }
.sx-row { display: flex; align-items: center; gap: 12px; padding: 9px 11px; border-radius: 8px; background: var(--sx-row); font-size: 14px; min-width: 0; }
.sx-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sx-row .side { color: var(--sx-text-3); white-space: nowrap; }
.sx-row.you { background: var(--sx-mint-soft); color: var(--sx-bright); font-weight: 600; }
.sx-kv { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.sx-kv > span:first-child { color: var(--sx-text-3); }
.sx-kv > span:last-child { text-align: right; }

/* Bars (finishes, scores vs par) */
.sx-bars { display: flex; align-items: flex-end; gap: 8px; height: 170px; padding-top: 8px; }
.sx-bar { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 5px; }
.sx-bar i { display: block; width: 100%; max-width: 44px; min-height: 3px; border-radius: 4px 4px 0 0; background: var(--played); }
.sx-bar b { font-size: 13px; }
.sx-bar span { font-size: 11px; color: var(--sx-text-3); white-space: nowrap; }
.sx-bar.missed i { background: transparent; border: 1px dashed rgba(255,255,255,0.25); border-bottom: 0; }

/* Calendar */
.sx-months { display: flex; flex-wrap: wrap; gap: 16px; }
.sx-month { flex: 1 1 300px; min-width: 0; background: var(--sx-panel); border: 1px solid var(--sx-hair); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.sx-week, .sx-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.sx-week span { font-size: 10px; color: var(--sx-muted); text-align: center; }
.sx-day { height: 40px; padding: 0; border-radius: 7px; border: 0; background: var(--played); color: var(--sx-text-2); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; font-size: 12px; font-weight: 700; }
.sx-day small { font-size: 9px; font-weight: 500; opacity: .75; }
.sx-day.g { background: var(--medal-1); color: var(--medal-ink); }
.sx-day.s { background: var(--medal-2); color: var(--medal-ink); }
.sx-day.b { background: var(--medal-3); color: var(--medal-ink); }
.sx-day.t { background: var(--top10); color: #10261b; }
.sx-day.m { background: transparent; border: 1px solid rgba(255,255,255,0.14); color: var(--sx-faint); }
.sx-day.x { background: transparent; color: #4a4e55; cursor: default; }
.sx-day.today { outline: 2px dashed var(--sx-bright); outline-offset: -2px; }
.sx-day.sel { box-shadow: 0 0 0 2px var(--sx-mint); }
button.sx-day:hover { filter: brightness(1.12); }
.sx-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--sx-text-3); }
.sx-legend span { display: inline-flex; align-items: center; gap: 5px; }
.sx-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sx-legend .m { border: 1px solid rgba(255,255,255,0.14); }
.sx-detail { background: var(--sx-row); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.sx-detail[hidden] { display: none; }

/* Hole strips (same colours as the daily card's) */
.sx-strip { display: inline-flex; gap: 2px; vertical-align: middle; }
.sx-strip i { width: 9px; height: 14px; border-radius: 2px; display: inline-block; }
.sx-strip.wide { display: grid; gap: 4px; width: 100%; }
.sx-strip.wide i { width: auto; height: 22px; border-radius: 5px; }
.h-ace { background: var(--hole-ace); } .h-eagle { background: var(--hole-eagle); } .h-birdie { background: var(--hole-birdie); }
.h-par { background: var(--hole-par); } .h-bogey { background: var(--hole-bogey); } .h-double { background: var(--hole-double); } .h-unknown { background: var(--played); }

/* Strokes vs field (a centred bar: left = strokes gained, right = lost) */
.sx-diverge { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.sx-diverge .lbl { width: 130px; color: var(--sx-text-2); flex: none; }
.sx-diverge .track { flex: 1; height: 10px; border-radius: 5px; background: var(--sx-row); position: relative; overflow: hidden; }
.sx-diverge .track::after { content: ""; position: absolute; left: 50%; top: 0; width: 1px; height: 100%; background: rgba(255,255,255,0.25); }
.sx-diverge .fill { position: absolute; top: 0; height: 100%; }
.sx-diverge .val { width: 92px; text-align: right; font-weight: 600; flex: none; }

/* Head to head */
.sx-h2h { height: 6px; border-radius: 3px; background: var(--sx-bad); overflow: hidden; display: flex; }
.sx-h2h i { display: block; height: 100%; }
.sx-h2h .w { background: var(--sx-mint); } .sx-h2h .t { background: var(--sx-muted); }

/* Trend chart */
.sx-chart { width: 100%; height: 180px; display: block; }
.sx-chart .grid { stroke: var(--sx-hair); }
.sx-chart .avg { fill: none; stroke: var(--sx-mint); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.sx-chart text { fill: var(--sx-muted); font-size: 10px; }

@media (max-width: 760px) {
  .sx-wrap { padding: 16px 16px 48px; gap: 16px; }
  .sx-headline h1 { font-size: 30px; }
  .sx-card { padding: 16px; }
  .sx-tablewrap { margin: 0 -16px; }
  .sx-table th:first-child, .sx-table td:first-child { padding-left: 16px; }
  .sx-diverge .lbl { width: 92px; }
  .sx-nav { position: static; }
}

/* ---- Today's Leaderboard on the card: the gap before the places around you ---- */
.dt-list li.around { color: var(--sx-text-3); }
.dt-gap { justify-content: center; color: var(--sx-faint) !important; min-height: 20px !important; font-size: 12px !important; }
/* Before you play, Your dailies is a quiet text link under the Play button (like "Full board");
   after you play it's a button beside Share and Replay. */
.daily-card:not(.played) #dailyStatsBtn {
  flex: none; margin-left: auto; height: auto; padding: 4px 0; background: none; border: 0;
  color: var(--sx-mint); font-size: 12.5px; font-weight: 600;
}
.daily-card:not(.played) #dailyStatsBtn:hover { background: none; text-decoration: underline; }

/* ---- Your dailies / result card: the simple stats (statsHtml). Short on purpose: the
   panel takes its natural height and Today's Leaderboard keeps the rest of the card. ---- */
.daily-mine { flex: none; }
.daily-card:has(.daily-mine:not([hidden])) .daily-top { flex: 1 1 auto; }
.st-nums { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.st-num { align-items: flex-start; text-align: left; gap: 3px; }
.st-num b { font-size: 24px; line-height: 1; color: #f2f7f4; display: inline-flex; align-items: center; gap: 2px; }
.st-num.streak b { color: var(--sx-mint); }
.st-flame { font-style: normal; font-size: 17px; }
.st-num span { text-align: left; font-size: 11px; line-height: 1.25; color: var(--sx-text-3); }
.st-chart { display: flex; flex-direction: column; gap: 4px; }
.st-title { font-size: 11px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--sx-muted); }
.st-zones { display: grid; gap: 3px; font-size: 11px; color: var(--sx-text-3); }
.st-zones span { padding-bottom: 3px; border-bottom: 2px solid; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-zones b { color: var(--sx-text); }
.st-zones .under { border-color: var(--hole-birdie); }
.st-zones .par { border-color: var(--hole-par); text-align: center; }
.st-zones .over { border-color: var(--hole-double); text-align: right; }
.st-dist { height: auto; padding: 18px 0 0; gap: 3px; }
.st-col { position: relative; }
.st-bar { max-width: 28px; min-height: 0; border-radius: 3px 3px 0 0; }
.st-col.under .st-bar { background: rgba(124,196,255,0.55); }
.st-col.par .st-bar { background: rgba(111,211,166,0.6); }
.st-col.over .st-bar { background: rgba(255,138,101,0.45); }
.st-col.today .st-bar { background: var(--sx-mint); box-shadow: 0 0 0 2px var(--sx-bright); }
.st-col.today .st-label, .st-col.today .st-count { color: var(--sx-bright); font-weight: 700; }
.st-pin { position: absolute; top: -17px; left: 50%; transform: translateX(-50%); padding: 1px 5px; border-radius: 4px; background: var(--sx-mint); color: var(--sx-mint-ink); font-size: 10px; font-weight: 800; white-space: nowrap; }
.st-label { padding-top: 4px; margin-top: 0; border-top: 1px solid rgba(255,255,255,0.10); width: 100%; text-align: center; }
.st-foot { margin-top: 8px; text-align: left; color: var(--sx-text-3); }
.st-foot b { color: var(--sx-text); }
a.dt-full { text-decoration: none; }
/* Where the Your dailies panel shows (big desktop windows: three columns, tall enough),
   the panel IS your dailies, so the 📊 Your dailies button that opens the same stats in a
   popup steps aside, before and after you play. Smaller layouts hide the panel and keep
   the button. */
@media (min-width: 1100px) and (min-height: 861px) {
  .daily-card:has(.daily-mine:not([hidden])) #dailyStatsBtn { display: none; }
}
.modal-link { display: block; text-align: center; margin: 4px 0 12px; color: var(--sx-mint); font-size: 13px; font-weight: 600; text-decoration: none; }
.modal-link:hover { text-decoration: underline; }
#dailyStatsModal .ds-stats { margin: 12px 0 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
