/* ==========================================================================
   opendiscgolf.no — design system (open-base)
   Ultra-minimal: light neutral background, white borderless surfaces, pills,
   near-monochrome. Geist for content, Geist Mono for numbers and micro labels.
   The accent color is reserved for alarm/critical states only.
   ========================================================================== */

@font-face {
  font-family: "Geist";
  src: url("fonts/Geist-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: optional;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Geist";
  src: url("fonts/Geist-var-ext.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: optional;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+1E00-1EFF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Geist Mono";
  src: url("fonts/GeistMono-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: optional;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Geist Mono";
  src: url("fonts/GeistMono-var-ext.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: optional;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+1E00-1EFF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #f4f4f2;
  --surface: #ffffff;
  --surface-2: #f4f4f2;
  --surface-3: #e9e9e6;
  --text: #171717;
  --text-2: #666666;
  --text-3: #6f6f6f;
  --border: rgba(0, 0, 0, 0.05);
  --border-strong: rgba(0, 0, 0, 0.1);

  --accent: #d92d20;
  --accent-soft: rgba(217, 45, 32, 0.08);

  --ok: #157f3d;
  --ok-soft: rgba(21, 127, 61, 0.1);

  --inverse-bg: #171717;
  --inverse-text: #fafafa;

  --ring: rgba(0, 0, 0, 0.1);
  --shadow-overlay: 0 4px 12px rgba(0, 0, 0, 0.04), 0 24px 60px rgba(0, 0, 0, 0.1);

  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --chevron: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236f6f6f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0e0e0e;
  --surface: #191919;
  --surface-2: #0e0e0e;
  --surface-3: #262626;
  --text: #ededed;
  --text-2: #a3a3a3;
  --text-3: #9a9a9a;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);

  --accent: #f4645a;
  --accent-soft: rgba(244, 100, 90, 0.12);

  --ok: #6ccb8b;
  --ok-soft: rgba(108, 203, 139, 0.14);

  --inverse-bg: #fafafa;
  --inverse-text: #171717;

  --ring: rgba(255, 255, 255, 0.16);
  --shadow-overlay: 0 4px 12px rgba(0, 0, 0, 0.4), 0 24px 60px rgba(0, 0, 0, 0.55);

  --chevron: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a9a9a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");

  color-scheme: dark;
}

/* System dark mode applies unless the user explicitly chose light */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e0e;
    --surface: #191919;
    --surface-2: #0e0e0e;
    --surface-3: #262626;
    --text: #ededed;
    --text-2: #a3a3a3;
    --text-3: #9a9a9a;
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.14);

    --accent: #f4645a;
    --accent-soft: rgba(244, 100, 90, 0.12);

    --ok: #6ccb8b;
    --ok-soft: rgba(108, 203, 139, 0.14);

    --inverse-bg: #fafafa;
    --inverse-text: #171717;

    --ring: rgba(255, 255, 255, 0.16);
    --shadow-overlay: 0 4px 12px rgba(0, 0, 0, 0.4), 0 24px 60px rgba(0, 0, 0, 0.55);

    --chevron: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a9a9a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");

    color-scheme: dark;
  }
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  /* Live pages rebuild equal-sized DOM in place; anchoring would jump */
  overflow-anchor: none;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Numbers and data: mono with tabular digits so nothing jumps */
.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
  border-radius: 6px;
}

::selection { background: var(--surface-3); }

/* UI chrome must not be text-selectable (iOS long-press etc.).
   Real content/data the user may want to copy stays selectable. */
button, .site-header, .site-footer, .menu, .toast {
  -webkit-user-select: none;
  user-select: none;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header { background: transparent; }

.header-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 20px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand-tld { color: var(--text-3); font-weight: 500; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  background: var(--surface);
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.icon-btn:hover { background: var(--surface-3); }
.icon-btn:active { transform: scale(0.94); }

.icon-btn.open { background: var(--inverse-bg); color: var(--inverse-text); }

/* Toggle buttons (on/off states) invert when active */
.toggle-btn.on { background: var(--inverse-bg); color: var(--inverse-text); }
.toggle-btn.on:hover { opacity: 0.85; background: var(--inverse-bg); }

.pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 22px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease,
              transform 0.15s ease, opacity 0.15s ease;
}

.pill-btn:active { transform: scale(0.97); }

.pill-btn.primary { background: var(--inverse-bg); color: var(--inverse-text); }
.pill-btn.primary:hover { opacity: 0.85; }

.pill-btn.ghost {
  border: 1px solid var(--border-strong);
  color: var(--text);
  background: var(--surface);
}

.pill-btn.ghost:hover { background: var(--surface-2); }
.pill-btn[disabled] { opacity: 0.4; pointer-events: none; }

/* --------------------------------------------------------------------------
   Settings menu
   -------------------------------------------------------------------------- */

.settings-wrap { position: relative; }

.menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 296px;
  max-height: min(560px, calc(100dvh - 90px));
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-overlay);
  padding: 20px;
  z-index: 60;
  transform-origin: top right;
  animation: menu-in 0.16s cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes menu-in {
  from { opacity: 0; transform: scale(0.96) translateY(-4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.menu-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin-bottom: 10px;
}

/* Options share the row evenly when they fit; locales with long words
   («Pantalla completa», «Бегущая строка») wrap to their own row rather
   than wrapping inside the button. gap applies both ways, so the spacing
   between wrapped rows equals the spacing within a row */
.menu-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.menu-grid .opt-btn { flex: 1 1 auto; white-space: nowrap; }

.menu-select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background-color: var(--surface-2);
  background-image: var(--chevron);
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 15px;
  border: none;
  border-radius: 12px;
  padding: 11px 44px 11px 14px;
  cursor: pointer;
}

.opt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 8px;
  border: none;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 13.5px;
  font-weight: 500;
  text-align: center;
  color: var(--text-2);
  transition: background-color 0.13s ease, color 0.13s ease, transform 0.13s ease;
}

.opt-btn .icon { width: 14px; height: 14px; }

.opt-btn:hover { background: var(--surface-3); color: var(--text); }
.opt-btn:active { transform: scale(0.97); }

.opt-btn.active {
  background: var(--inverse-bg);
  color: var(--inverse-text);
  font-weight: 600;
}

.opt-btn.wide { width: 100%; }
.opt-btn.copied { background: var(--ok); color: #fff; }

.menu-divider {
  height: 1px;
  background: var(--border);
  margin: 18px -20px;
}

.menu-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 14px;
  line-height: 1.35;
  cursor: pointer;
  user-select: none;
}

.switch {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  width: 40px;
  height: 23px;
  border-radius: 999px;
  background: var(--surface-3);
  position: relative;
  cursor: pointer;
  transition: background-color 0.18s ease;
  margin: 0;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2.5px;
  left: 2.5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  transition: transform 0.18s ease;
}

.switch:checked { background: var(--inverse-bg); }
.switch:checked::after { transform: translateX(17px); background: var(--inverse-text); }

.menu-info {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.7;
  color: var(--text-3);
}

.menu-info a { color: var(--text-2); text-decoration: none; }
.menu-info a:hover { text-decoration: underline; }

.menu-year { margin-top: 6px; }

/* --------------------------------------------------------------------------
   THE TOOL — product styles go here
   -------------------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px 32px;
  flex: 1;
}

.container.narrow { max-width: 560px; }

/* Entrance: starts at .01 (never 0 — an element at exactly 0 is never
   painted and Lighthouse charges the fade to LCP) */
@keyframes rise-in {
  from { opacity: 0.01; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.view { animation: rise-in 0.3s cubic-bezier(0.2, 0.9, 0.3, 1); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 14px;
}

.card-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin-bottom: 12px;
}

.hint {
  margin: 8px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-3);
}

.err {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--accent);
}

/* ------------------------------------------------------------ hero (home) */

.hero { text-align: center; padding: 28px 0 8px; }

.hero h2 {
  margin: 0 0 8px;
  font-size: clamp(26px, 6vw, 34px);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.hero p {
  margin: 0 auto;
  max-width: 480px;
  color: var(--text-2);
  font-size: 15.5px;
}

.how { margin-top: 8px; }

.how ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.how li {
  display: flex;
  gap: 12px;
  align-items: baseline;
  font-size: 14.5px;
  color: var(--text-2);
}

.how .step-n {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
  flex-shrink: 0;
}

/* ---------------------------------------------------------------- inputs */

.text-input {
  width: 100%;
  font: inherit;
  font-size: 16px; /* < 16 zooms the page on iOS focus */
  color: var(--text);
  background: var(--surface-2);
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
}

.text-input:focus-visible { outline: 2px solid var(--text); outline-offset: 0; }
.text-input::placeholder { color: var(--text-3); }

textarea.text-input { resize: vertical; min-height: 110px; line-height: 1.6; }

.code-input {
  font-family: var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: lowercase;
}

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 550;
  color: var(--text-2);
  margin-bottom: 6px;
}

.row-btns { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* --------------------------------------------------------------- stepper */

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 3px;
}

.stepper button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 500;
  color: var(--text-2);
  transition: background-color 0.13s ease, transform 0.13s ease;
}

.stepper button:hover { background: var(--surface-3); color: var(--text); }
.stepper button:active { transform: scale(0.92); }

.stepper .step-val {
  min-width: 34px;
  text-align: center;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  font-weight: 600;
}

.stepper .step-val.unset { color: var(--text-3); font-weight: 400; }

/* ------------------------------------------------------- setup (new + td) */

.par-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 8px;
}

.par-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 2px;
  border-radius: 12px;
  background: var(--surface-2);
  transition: background-color 0.13s ease, transform 0.13s ease;
}

.par-cell:active { transform: scale(0.95); }

.par-cell .hole-n {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
}

.par-cell .hole-par {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
}

.par-cell.par-alt { background: var(--surface-3); }

.player-assign {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.player-assign:last-child { border-bottom: none; }

.player-assign .p-name {
  flex: 1;
  font-size: 14.5px;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-assign select {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  background-color: var(--surface-2);
  background-image: var(--chevron);
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 13px;
  border: none;
  border-radius: 999px;
  padding: 7px 30px 7px 14px;
  cursor: pointer;
}

.group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0 4px;
  font-size: 13.5px;
  color: var(--text-2);
}

/* ------------------------------------------------------------ leaderboard */

.lb-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 2px 12px;
}

.lb-meta h2 {
  margin: 0;
  font-size: clamp(20px, 5vw, 26px);
  font-weight: 650;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  white-space: nowrap;
}

.live-chip .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
}

.live-chip.stale .dot { background: var(--text-3); }
.live-chip.final .dot { background: var(--text); }

.lb-head, .lb-row {
  display: grid;
  grid-template-columns: 30px 1fr 52px 44px 48px;
  align-items: center;
  gap: 8px;
}

.lb-head {
  padding: 0 16px 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
}

.lb-row {
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 16px;
  margin-bottom: 8px;
  transition: background-color 0.13s ease;
}

.lb-row:hover { background: var(--surface-2); }

.lb-row .pos {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-3);
}

.lb-row .p-name {
  font-weight: 550;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.lb-row .to-par {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  font-weight: 650;
  text-align: right;
}

.lb-row .to-par.under { color: var(--ok); }

.lb-row .thru, .lb-row .tot {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--text-2);
  text-align: right;
}

.conf-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.hot {
  font-size: 12px;
  line-height: 1;
}

.lb-expand {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  margin: -4px 0 8px;
}

/* ------------------------------------------------- hole cells (scorecard) */

.hole-cells {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 4px;
}

.hole-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 4px 0 5px;
  border-radius: 8px;
  background: var(--surface-2);
}

.hole-cell .hc-n {
  font-family: var(--font-mono);
  font-size: 8.5px;
  color: var(--text-3);
}

.hole-cell .hc-s {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}

.hole-cell.sc-eagle .hc-s, .hole-cell.sc-birdie .hc-s { color: var(--ok); }
.hole-cell.sc-eagle { background: var(--ok-soft); box-shadow: inset 0 0 0 1.5px var(--ok); }
.hole-cell.sc-birdie { background: var(--ok-soft); }
.hole-cell.sc-bogey { background: var(--surface-3); }
.hole-cell.sc-double { background: var(--surface-3); box-shadow: inset 0 0 0 1.5px var(--border-strong); }
.hole-cell.conflict { box-shadow: inset 0 0 0 1.5px var(--accent); }

/* --------------------------------------------------------------- stats */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}

.stat-tile {
  background: var(--surface-2);
  border-radius: 12px;
  padding: 10px 12px;
}

.stat-tile .st-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
  display: block;
  margin-bottom: 2px;
}

.stat-tile .st-val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 17px;
  font-weight: 650;
}

.stat-tile .st-sub {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-3);
  margin-left: 4px;
}

/* ------------------------------------------------------------ score page */

.score-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 2px 10px;
}

.score-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--text-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  white-space: nowrap;
}

.sync-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.sync-chip.pending .dot { background: var(--text-3); }
.sync-chip.offline .dot { background: var(--accent); }

.hole-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  scrollbar-width: none;
}

.hole-strip::-webkit-scrollbar { display: none; }

.hole-chip {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 550;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  transition: background-color 0.13s ease, color 0.13s ease, transform 0.13s ease;
}

.hole-chip:active { transform: scale(0.94); }
.hole-chip.done { background: var(--surface-3); color: var(--text); }
.hole-chip.current { background: var(--inverse-bg); color: var(--inverse-text); border-color: var(--inverse-bg); }

.hole-chip.flag::after {
  content: "";
  position: absolute;
  top: 1px;
  right: 1px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  border: 1.5px solid var(--bg);
}

.hole-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 4px 2px 10px;
}

.hole-title .ht-hole { font-size: 19px; font-weight: 650; }

.hole-title .ht-par {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-3);
}

.hole-nav {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

/* Landing pads: the six big buttons that build the throw sequence */
.pad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.pad {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 58px;
  border-radius: 16px;
  background: var(--surface-2);
  font-size: 14.5px;
  font-weight: 600;
  transition: background-color 0.13s ease, transform 0.13s ease;
}

.pad:hover { background: var(--surface-3); }
.pad:active { transform: scale(0.96); }

.pad .pad-sub {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 400;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pad.pad-basket { background: var(--inverse-bg); color: var(--inverse-text); }
.pad.pad-basket .pad-sub { color: var(--inverse-text); opacity: 0.6; }
.pad.pad-ob { color: var(--accent); }

.throw-seq {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 0 10px;
}

.throw-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 550;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 6px 10px;
}

.throw-chip.ob { background: var(--accent-soft); color: var(--accent); }
.throw-chip.basket { background: var(--inverse-bg); color: var(--inverse-text); }
.throw-chip .tc-dist { font-size: 10px; color: var(--text-3); }
.throw-chip.basket .tc-dist { color: var(--inverse-text); opacity: 0.6; }

.seq-empty { font-size: 13px; color: var(--text-3); }

.own-total {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 0 2px;
}

.own-total .ot-n {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
}

.own-total .ot-word { font-size: 13.5px; color: var(--text-2); }

.dist-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 0 10px;
}

.dist-row .dist-label {
  font-size: 12.5px;
  color: var(--text-2);
  margin-right: 2px;
}

.dist-chip {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 550;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 7px 12px;
  transition: background-color 0.13s ease, transform 0.13s ease;
}

.dist-chip:hover { background: var(--surface-3); }
.dist-chip:active { transform: scale(0.94); }
.dist-chip.active { background: var(--inverse-bg); color: var(--inverse-text); }

/* Group members' total rows */
.mate-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.mate-row:last-child { border-bottom: none; }

.mate-row .p-name {
  flex: 1;
  font-size: 14.5px;
  font-weight: 550;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}

.mate-row .p-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mate-row .m-topar {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-3);
}

.conflict-banner {
  background: var(--accent-soft);
  border-radius: 16px;
  padding: 12px 16px;
  margin-bottom: 14px;
  font-size: 13.5px;
  line-height: 1.5;
}

.conflict-banner .cb-title {
  display: block;
  font-weight: 650;
  color: var(--accent);
  margin-bottom: 2px;
}

.conflict-banner .row-btns { margin-top: 8px; }

.pill-btn.small { height: 34px; padding: 0 14px; font-size: 13px; }
.pill-btn.danger { color: var(--accent); border-color: var(--accent-soft); }
.pill-btn.armed { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ------------------------------------------------------------- claim view */

.claim-list { display: grid; gap: 8px; }

.claim-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface-2);
  border-radius: 14px;
  padding: 13px 16px;
  font-size: 14.5px;
  font-weight: 550;
  text-align: left;
  transition: background-color 0.13s ease, transform 0.13s ease;
}

.claim-btn:hover { background: var(--surface-3); }
.claim-btn:active { transform: scale(0.98); }
.claim-btn[disabled] { opacity: 0.45; pointer-events: none; }

.claim-btn .claimed-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}

/* ---------------------------------------------------------------- TD page */

.share-grid {
  display: flex;
  gap: 16px;
  align-items: center;
}

.qr-box {
  width: 120px;
  height: 120px;
  flex-shrink: 0;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  padding: 6px;
}

.qr-box svg { display: block; width: 100%; height: 100%; }

.share-addr {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  word-break: break-all;
}

.td-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.td-row:last-child { border-bottom: none; }

.td-row .p-name {
  flex: 1;
  min-width: 0;
  font-size: 14.5px;
  font-weight: 550;
  display: flex;
  align-items: center;
  gap: 7px;
}

.td-row .p-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.claim-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--surface-3);
  flex-shrink: 0;
}

.claim-dot.on { background: var(--ok); }

.td-row .num { font-size: 13px; color: var(--text-2); }

.td-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px 0 10px;
}

.mine-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.mine-link {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 16px;
  text-decoration: none;
  font-size: 14.5px;
  transition: background-color 0.13s ease;
}

.mine-link:hover { background: var(--surface-2); }

.mine-link .m-name { flex: 1; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mine-link .m-role {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}

/* --------------------------------------------------------------- states */

.center-view { text-align: center; padding: 48px 0; color: var(--text-2); }

.spin {
  width: 22px;
  height: 22px;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 2px solid var(--surface-3);
  border-top-color: var(--text-2);
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 600px) {
  .hole-cells { grid-template-columns: repeat(9, 1fr); }
  .share-grid { flex-direction: column; align-items: flex-start; }
}

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */

.toast {
  position: fixed;
  inset: auto; /* resets popover UA styling (inset: 0) */
  margin: 0;
  border: 0;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translate(-50%, 16px);
  background: var(--inverse-bg);
  color: var(--inverse-text);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 22px;
  border-radius: 999px;
  box-shadow: var(--shadow-overlay);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 100;
  max-width: calc(100vw - 40px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  text-align: center;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.9;
  letter-spacing: 0.02em;
  color: var(--text-3);
}

.site-footer p { margin: 0; }
.site-footer a { color: var(--text-2); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------
   Mobile
   -------------------------------------------------------------------------- */

@media (max-width: 600px) {
  .menu { width: min(296px, calc(100vw - 32px)); }
}
