/* Golf Trip Scorer. Palette from the old app's golf-theme.css: dark green, gold, cream. */

:root {
  --dark: #1a3c28;
  --green: #2d6a4f;
  --light: #40916c;
  --gold: #d4a843;
  --gold-light: #e8c96a;
  --cream: #f5f2eb;
  --white: #fefcf7;
  --text: #2c2c2c;
  --muted: #6b6b60;
  --border: #ddd8cc;
  --red: #c0392b;
  --birdie: #27ae60;

  --ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  --tap: 44px;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--cream);
  color: var(--text);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.45;
  padding-bottom: env(safe-area-inset-bottom);
}

h1, h2, h3 { font-family: var(--serif); color: var(--dark); line-height: 1.2; }
h1 { font-size: 1.4rem; margin: 0 0 0.75rem; }
h2 { font-size: 1.15rem; margin: 0 0 0.5rem; }

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

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* --- Top bar --- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--dark);
  border-bottom: 3px solid var(--gold);
  padding: calc(8px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) 8px
    calc(16px + env(safe-area-inset-left));
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gold);
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: bold;
  text-decoration: none;
}
.brand img { border-radius: 50%; }
/* Triple-tap target (app.js): no double-tap zoom, text selection or image menu. */
img[data-logo] { touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* --- Menu: left sidebar on wide screens, slide-out drawer on phones --- */
.menu-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  margin: -6px 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
.menu-button:hover, .menu-button:focus-visible { background: rgba(255, 255, 255, 0.1); }
.topbar .nav-open { color: var(--gold-light); margin-left: -10px; }
.icon { flex: none; }

.sidebar { display: none; }

.nav-drawer {
  position: fixed;
  inset: 0 auto 0 0;
  width: min(300px, calc(100vw - 56px));
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: calc(12px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom))
    calc(12px + env(safe-area-inset-left));
  border: none;
  background: var(--dark);
  color: #fff;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
  transition: transform 220ms cubic-bezier(0.2, 0, 0, 1), display 220ms allow-discrete,
    overlay 220ms allow-discrete;
}
.nav-drawer[open] { display: flex; flex-direction: column; }
@starting-style { .nav-drawer[open] { transform: translateX(-100%); } }
.nav-drawer::backdrop { background: rgba(0, 0, 0, 0.4); }
.nav-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 12px 6px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(232, 201, 106, 0.35);
}

.nav-list { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 48px;
  padding: 6px 14px;
  border: none;
  border-radius: 999px;
  background: none;
  color: rgba(255, 255, 255, 0.88);
  font: inherit;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}
.nav-item .icon { color: var(--gold-light); opacity: 0.85; }
.nav-item:hover, .nav-item:focus-visible { background: rgba(255, 255, 255, 0.08); }
.nav-item[aria-current="page"] { background: var(--gold); color: var(--dark); }
.nav-item[aria-current="page"] .icon { color: var(--dark); opacity: 1; }
.nav-label { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.nav-label small {
  font-weight: 400;
  font-size: 0.78rem;
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-section {
  margin: 14px 14px 4px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-foot {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(232, 201, 106, 0.35);
}
.nav-who { display: block; padding: 0 14px 4px; font-size: 0.85rem; color: rgba(255, 255, 255, 0.7); }
.nav-who strong { color: #fff; }

@media (min-width: 900px) {
  .has-nav .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 11;
    width: 240px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 12px calc(12px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left));
    background: var(--dark);
    color: #fff;
    border-right: 3px solid var(--gold);
  }
  .sidebar > .brand { padding: 0 6px 12px; border-bottom: 1px solid rgba(232, 201, 106, 0.35); }
  .has-nav .shell-main { margin-left: 240px; }
  .has-nav .topbar { display: none; }
  .has-nav .offline-bar, .has-nav .sync-bar { top: 0; }
  .nav-drawer { display: none !important; }
}

/* --- Page --- */
.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px calc(16px + env(safe-area-inset-right)) 24px calc(16px + env(safe-area-inset-left));
}

.page-header { margin: 4px 0 12px; }

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
}

.empty { text-align: center; padding: 24px 0; }

/* --- Flash messages --- */
.flash {
  border-radius: var(--radius);
  padding: 10px 14px;
  margin: 0 0 12px;
  background: #e7f3ec;
  border: 1px solid #b7dcc6;
}
.flash-error { background: #fbeaea; border-color: #f0bcbc; color: #7a1f1f; }

/* --- Forms --- */
label { display: block; font-weight: 600; font-size: 0.9rem; color: var(--dark); }

input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  min-height: var(--tap);
  padding: 8px 10px;
  font: inherit;
  font-size: 16px; /* stops iOS zooming on focus */
  color: var(--text);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.18);
}

.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 12px; }
.handicaps { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.handicaps legend { padding: 0; margin-bottom: 4px; font-weight: 600; }
.handicaps input { width: 100%; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.row > * { flex: 1; min-width: 0; }

.field-error { color: var(--red); margin: 6px 0 0; font-weight: 600; }

/* --- Buttons --- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 8px 18px;
  font: inherit;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}
.button-primary { background: var(--green); border-color: var(--green); color: #fff; }
.button-primary:active { background: var(--dark); }
.button-gold { background: var(--gold); border-color: var(--gold); color: var(--dark); }
.button-block { width: 100%; margin-top: 16px; }

.link-button {
  background: none;
  border: none;
  padding: 8px;
  font: inherit;
  color: var(--green);
  text-decoration: underline;
  cursor: pointer;
}

/* --- Login --- */
.login { text-align: center; max-width: 360px; margin: 24px auto; }
.login-logo { border-radius: 50%; margin: 0 auto 8px; display: block; }
.login label { text-align: left; }
.player-pick {
  border: 0;
  padding: 0;
  margin: 0 0 12px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.player-pick legend { font-weight: 600; margin-bottom: 6px; text-align: left; padding: 0; }
/* The radio stays in the page (for keyboards and screen readers) but out of sight. */
.player-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.login .player-pick label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  margin: 0;
  font-weight: 600;
  text-align: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--cream);
  color: var(--dark);
  cursor: pointer;
  touch-action: manipulation;
}
.player-pick input:checked + label { background: var(--green); border-color: var(--green); color: #fff; }
.player-pick input:focus-visible + label { outline: 3px solid var(--gold); outline-offset: 2px; }
.pin-input { text-align: center; font-size: 1.6rem; letter-spacing: 0.4em; }

/* --- Trips (Admin) --- */
.trip-switch { align-items: flex-end; }
.trip-switch > .button { flex: none; }

.new-trip summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--green);
  min-height: var(--tap);
  display: flex;
  align-items: center;
}
.new-trip[open] summary { margin-bottom: 8px; }

/* --- Install card --- */
.install-card {
  position: relative;
  background: var(--dark);
  color: #fff;
  border-radius: var(--radius);
  border-bottom: 3px solid var(--gold);
  padding: 14px 44px 14px 16px;
  margin-bottom: 16px;
}
.install-card h2 { color: var(--gold); margin-bottom: 4px; }
.install-card p { margin: 0 0 10px; }
.install-steps { margin: 0; padding-left: 20px; }
.install-steps li + li { margin-top: 6px; }
.share-icon { width: 1.2em; height: 1.2em; vertical-align: -0.2em; color: var(--gold-light); }
.install-dismiss {
  position: absolute;
  top: 4px;
  right: 4px;
  width: var(--tap);
  height: var(--tap);
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.6rem;
  cursor: pointer;
}

/* --- Shared bits --- */
.card > summary,
details > summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--green);
  min-height: var(--tap);
  display: flex;
  align-items: center;
}
details[open] > summary { margin-bottom: 8px; }

.section-title { margin: 20px 0 10px; }

.note {
  margin: 0;
  padding: 8px 10px;
  border-radius: 6px;
  background: #f3efe2;
  border: 1px solid var(--border);
  font-size: 0.9rem;
}
.warning {
  margin: 8px 0 0;
  padding: 8px 10px;
  border-radius: 6px;
  background: #fff4dc;
  border: 1px solid var(--gold-light);
  font-size: 0.9rem;
}

.button-danger { background: var(--red); border-color: var(--red); color: #fff; }
.danger-link { color: var(--red); }

.icon-button {
  min-width: var(--tap);
  min-height: 36px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--gold-light);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
}
.icon-button:disabled { opacity: 0.3; cursor: default; }

label.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 400;
  color: var(--text);
}
label.check input { width: auto; min-height: 0; margin-top: 3px; flex: none; }
.confirm-form > * + * { margin-top: 10px; }

select:disabled { background: #eeebe3; color: var(--muted); }

/* --- Round cards (setup) --- */
.round-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 14px;
  scroll-margin-top: 72px;
}
.round-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--dark);
  color: #fff;
  padding: 8px 10px 8px 12px;
}
.round-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--dark);
  font-weight: 700;
  flex: none;
}
.round-title { flex: 1; min-width: 0; font-weight: 600; }
.round-move form { display: flex; gap: 6px; }
.round-card-body { padding: 14px; }
.round-card-footer { padding: 0 14px 10px; border-top: 1px solid var(--border); }

.segments { border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px 12px; margin: 0; }
.segments legend { font-weight: 600; font-size: 0.9rem; color: var(--dark); padding: 0 4px; }
.segments label + label { margin-top: 10px; }

.danger-zone { border-color: #e7c1bc; }
.danger-zone h2 { color: var(--red); }
.danger-zone details + details, .danger-zone h2 + details { margin-top: 8px; }
.admin-list { list-style: none; margin: 8px 0 0; padding: 0; }
.admin-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); }
.admin-list li > span { display: flex; flex-direction: column; min-width: 0; }

/* --- Hole summary (caddie line) --- */
.caddie { display: flex; align-items: flex-start; gap: 8px; margin: 8px 0 12px; padding: 10px 12px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); }
.caddie-body { flex: 1; min-width: 0; }
.caddie-text { flex: 1; margin: 0; font-size: 0.95rem; color: var(--dark); }
.caddie-neville { margin: 6px 0 0; font-style: italic; color: var(--text); }
.caddie-neville strong { font-style: normal; color: var(--green); }
.caddie-neville[hidden] { display: none; }
/* The faces under his line: each player's verdict. */
.caddie-rate { display: flex; gap: 6px; margin-top: 8px; }
.caddie-rate[hidden] { display: none; }
.caddie-rate-button { display: inline-flex; align-items: center; gap: 4px; min-width: 52px; min-height: 36px; padding: 4px 10px; background: none; border: 1px solid var(--border); border-radius: 18px; font-size: 1.1rem; line-height: 1; cursor: pointer; filter: grayscale(0.6); opacity: 0.75; }
.caddie-rate-button[aria-pressed="true"] { border-color: var(--green); background: var(--cream, transparent); filter: none; opacity: 1; box-shadow: inset 0 0 0 1px var(--green); }
.caddie-rate-count { font-size: 0.8rem; color: var(--muted); }
/* Which model wrote his line: a faint (i), tapped to show it. */
.caddie-info { display: inline-flex; vertical-align: middle; padding: 4px; margin: -4px 0 -4px 2px; background: none; border: 0; color: var(--muted); opacity: 0.5; cursor: pointer; }
.caddie-info .icon { width: 14px; height: 14px; }
.caddie-info[aria-expanded="true"] { opacity: 1; }
.caddie-info[hidden], .caddie-source[hidden] { display: none; }
.caddie-source { display: block; margin-top: 2px; font-style: normal; font-size: 0.75rem; color: var(--muted); }
/* Neville at work (writing, recording): a thin bar, eased towards 90% over his usual time. */
.caddie-progress { height: 2px; margin-top: 8px; background: var(--border); border-radius: 1px; overflow: hidden; transition: opacity 0.4s; }
.caddie-progress[hidden] { display: block; opacity: 0; }
.caddie-progress span { display: block; height: 100%; width: 0; background: var(--green); opacity: 0.7; }
/* Before Neville speaks on a new hole: a tap when they're on the tee. */
.tee-cover { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--dark); }
.tee-cover[hidden] { display: none; }
.tee-cover-card { width: 100%; max-width: 360px; text-align: center; color: var(--white); }
.tee-cover-kicker { margin: 0; font-size: 0.85rem; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.75; }
.tee-cover h2 { margin: 4px 0 6px; font-size: 2.6rem; color: var(--white); }
.tee-cover-sub { margin: 0 0 24px; opacity: 0.9; }
.tee-cover .button-primary { min-height: 56px; font-size: 1.1rem; background: var(--white); color: var(--dark); border-color: var(--white); }
.tee-cover .button-primary .icon { vertical-align: -0.2em; }
.tee-cover-progress { margin: 18px auto 0; width: 60%; background: rgba(255, 255, 255, 0.12); }
.tee-cover-progress span { background: var(--white); opacity: 0.45; }
.tee-cover-skip { margin-top: 10px; background: none; border-color: transparent; color: var(--white); opacity: 0.8; }
.caddie-speak { flex: none; display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); margin: -8px -6px -8px 0; background: none; border: 0; border-radius: 50%; color: var(--muted); cursor: pointer; }
.caddie-speak[hidden] { display: none; }
.caddie-speak[aria-pressed="true"] { color: var(--green); }
.caddie-speak .speak-on, .caddie-speak[aria-pressed="true"] .speak-off { display: none; }
.caddie-speak[aria-pressed="true"] .speak-on { display: inline; }


/* --- Voice entry --- */
.voice { margin: 0 0 12px; }
.voice[hidden] { display: none; }
.voice-start { gap: 8px; margin-top: 0; }
.voice-start.is-listening { background: var(--red); border-color: var(--red); color: #fff; }
.voice-status:empty { display: none; }
.voice-fallback { margin-top: 8px; }
.voice-fallback[hidden] { display: none; }
.voice-status { margin: 6px 0 0; }
.voice-panel { margin-top: 8px; }
.voice-panel > p:first-child { margin-top: 0; }
.voice-panel[hidden] { display: none; }
.voice-list { list-style: none; margin: 8px 0; padding: 0; font-size: 1.05rem; }
.voice-list li { padding: 4px 0; border-top: 1px solid var(--border); }
.voice-list li:first-child { border-top: 0; }
.voice-missed { color: var(--red); margin: 4px 0 8px; }
.voice-missed:empty { display: none; }
.voice-panel [hidden] { display: none; }

/* --- Telling Neville what happened on a hole --- */
.tell { margin: 0 0 12px; }
.tell-start { gap: 8px; margin-top: 0; list-style: none; cursor: pointer; }
.tell-start::-webkit-details-marker { display: none; }
.tell-form { margin-top: 0; }
.tell-form label { display: block; margin-bottom: 4px; }
.tell-form textarea { width: 100%; box-sizing: border-box; font: inherit; }
.tell-form .row { flex-wrap: wrap; margin-top: 8px; }
.tell-say { gap: 6px; }
.tell-say[hidden] { display: none; }
.tell-say.is-listening { background: var(--red); border-color: var(--red); color: #fff; }
.hole-notes-head { margin: 8px 0 2px; }
.hole-notes-list { list-style: none; margin: 0; padding: 0; }
.hole-notes-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 0; }
.hole-notes-list form { flex: none; margin: 0; }
.hole-note-delete { background: none; border: 0; color: var(--muted); cursor: pointer; min-width: 32px; min-height: 32px; font-size: 1rem; }

/* --- Neville setup --- */
.caddie-notes { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.caddie-notes textarea { width: 100%; }
.lab-models { border: 0; padding: 0; margin: 0; }
.lab-models legend { font-weight: 600; padding: 0; margin-bottom: 4px; }
.lab-line { display: block; font-style: italic; margin-top: 4px; white-space: normal; }
.lab-results li > span { white-space: normal; }
.lab-play { margin-top: 6px; min-height: 36px; padding: 4px 12px; }
#voices textarea { width: 100%; }
.lab-facts { white-space: pre-wrap; font-size: 0.85rem; margin: 8px 0 0; }

/* --- Courses --- */
.course-holes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.course-table { width: 100%; border-collapse: collapse; }
.course-table th, .course-table td { padding: 2px 4px; text-align: center; }
.course-table thead th { font-size: 0.85em; color: var(--muted); font-weight: 600; }
.course-table input { width: 100%; min-width: 0; text-align: center; padding-left: 4px; padding-right: 4px; }
.course-table input[readonly] { background: transparent; border-color: transparent; }
.flash ul { margin: 4px 0 0; padding-left: 20px; }
.pin-reveal { font-size: 2.6rem; font-weight: 700; letter-spacing: 0.3em; text-align: center; margin: 12px 0; font-variant-numeric: tabular-nums; }

/* --- Status bars --- */
.offline-bar,
.sync-bar {
  position: sticky;
  top: calc(55px + env(safe-area-inset-top));
  z-index: 9;
  margin: 0;
  padding: 8px 16px;
  font-size: 0.85rem;
  text-align: center;
}
.offline-bar { background: #3b3b33; color: #fff; }
.sync-bar { background: #fff4dc; border-bottom: 1px solid var(--gold-light); }
.sync-bar a { font-weight: 700; }

/* --- Rounds list --- */
.round-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
}
.round-tile.state-in_progress { border-left-color: var(--gold); }
.round-tile.state-complete { border-left-color: var(--green); }
.round-tile-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.round-tile-summary { font-size: 0.9rem; color: var(--dark); }
.round-weather { color: var(--muted); }
.state-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eeebe3;
  color: var(--muted);
  white-space: nowrap;
}
.state-in_progress .state-badge { background: #fff4dc; color: #8a6514; }
.state-complete .state-badge { background: #e7f3ec; color: var(--green); }

/* --- Hole entry --- */
.round-link { display: block; font-size: 0.85rem; margin-bottom: 6px; text-decoration: none; }

.hole-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.hole-head h1 { margin: 0; text-align: center; font-size: 1.6rem; }
.hole-head h1 span {
  display: block;
  font-family: var(--ui);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
  margin-top: 2px;
}
.hole-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--green);
  font-size: 1.8rem;
  text-decoration: none;
  flex: none;
}
span.hole-step { visibility: hidden; }

.hole-strip {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 4px;
  margin-bottom: 12px;
}
.strip-hole {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  border-radius: 6px;
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}
.strip-hole.is-done { background: #e7f3ec; border-color: #b7dcc6; color: var(--green); }
.save-conflict { grid-column: 1 / -1; margin-top: 6px; padding: 8px 10px; border-radius: 8px; background: #fbe6e2; color: #8a2b1f; font-size: 0.85rem; }
.save-conflict .link-button { display: block; margin-top: 4px; font-weight: 700; color: #8a2b1f; }
.is-conflict { box-shadow: 0 0 0 2px #e0604f; }
.strip-hole.is-skipped { background: #fbe6e2; border-color: #e7a497; color: #b23a2a; }
.strip-hole.is-current { background: var(--dark); border-color: var(--dark); color: var(--gold); }
.strip-hole.is-current.is-skipped { box-shadow: inset 0 0 0 2px #e0604f; }
.strip-hole.is-unsaved::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
}

.match-status {
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--dark);
  color: var(--gold-light);
  font-weight: 600;
  text-align: center;
}

.score-rows { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
/* A 4BBB team: its two rows boxed together. */
.score-team {
  display: flex; flex-direction: column; gap: 8px;
  padding: 8px; border: 2px solid #74b091; border-radius: 14px;
}
.score-team + .score-team { margin-top: 4px; }
.score-team-name {
  margin: 0 2px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--muted);
}

.score-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "who points"
    "stepper wipe"
    "status status";
  gap: 8px 10px;
  align-items: center;
  padding: 10px 12px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.score-who { grid-area: who; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.score-name { font-weight: 700; font-size: 1.05rem; color: var(--dark); }
.shot-dots { display: inline-flex; gap: 3px; }
.shot-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); display: inline-block; }
.score-total { width: 100%; font-size: 0.8rem; color: var(--muted); }

.stepper { grid-area: stepper; display: flex; align-items: stretch; gap: 6px; }
.stepper button {
  min-width: 56px;
  height: 56px;
  font: inherit;
  font-size: 1.6rem;
  font-weight: 700;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--cream);
  color: var(--dark);
  cursor: pointer;
  touch-action: manipulation;
}
.stepper .stepper-value { flex: 1; min-width: 72px; background: var(--white); border: 2px solid var(--green); }
.score-row.is-empty .stepper-value { border-style: dashed; border-color: var(--border); color: #b3ad9e; }
.score-row.is-wiped .stepper-value { color: var(--red); border-color: var(--red); }

.wipe-button {
  grid-area: wipe;
  height: 56px;
  padding: 0 14px;
  font: inherit;
  font-weight: 700;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--muted);
  cursor: pointer;
  touch-action: manipulation;
}
.wipe-button[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: #fff; }

.score-points {
  grid-area: points;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 52px;
}
.score-points span { font-size: 1.6rem; font-weight: 800; color: var(--green); line-height: 1; }
.score-points small { font-size: 0.7rem; color: var(--muted); }

.save-status { grid-area: status; font-size: 0.8rem; color: var(--muted); }
.save-status:empty { display: none; }
.is-error .save-status { color: var(--red); font-weight: 600; }
.retry-button {
  width: 100%;
  min-height: 40px;
  font: inherit;
  font-weight: 700;
  color: #7a1f1f;
  background: #fbeaea;
  border: 1px solid #f0bcbc;
  border-radius: 6px;
  cursor: pointer;
}
.score-row.is-unsaved { border-color: #f0bcbc; }

.hole-foot { margin: 8px 0 16px; }
/* Leaderboard: Points so far / As it stands. */
.view-toggle { display: flex; gap: 4px; margin: 0 0 12px; padding: 3px; background: var(--border); border-radius: 999px; }
.view-toggle a { flex: 1; text-align: center; padding: 8px 10px; border-radius: 999px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 0.9rem; }
.view-toggle a[aria-current="page"] { background: var(--white); color: var(--green); box-shadow: var(--shadow); }
.hole-missing { margin: 0 0 8px; padding: 8px 12px; border-radius: var(--radius); background: #fff4d6; color: #6b4e00; font-size: 0.9rem; }
.hole-missing[hidden] { display: none; }
.hole-missing.is-flashing { animation: missing-flash 0.6s ease 2; }
@keyframes missing-flash { 50% { background: #ffd666; } }
.button[data-next-hole].is-warning { background: #b7791f; border-color: #b7791f; }

/* --- Choice forms: NTP and mini matches --- */
.choice-form {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
  margin-bottom: 12px;
}
.choice-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 8px;
}
.choice-buttons { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.choice-buttons button {
  min-height: var(--tap);
  font: inherit;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--cream);
  color: var(--dark);
  cursor: pointer;
  touch-action: manipulation;
}
.choice-buttons .choice-none { grid-column: 1 / -1; }
.choice-buttons button[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }
.segment-buttons { grid-template-columns: 1fr; }
.segment-buttons button { display: flex; flex-direction: column; align-items: center; padding: 6px; }
.segment-buttons small { font-weight: 400; font-size: 0.75rem; opacity: 0.8; }
.choice-foot { display: flex; justify-content: space-between; align-items: center; min-height: 28px; }

/* --- Scorecard --- */
.card-scroll { overflow-x: auto; margin: 12px 0; -webkit-overflow-scrolling: touch; }
.scorecard {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.8rem;
  background: var(--white);
}
.scorecard th:first-child { width: 22%; }
.scorecard th:last-child { width: 11%; }
.scorecard th, .scorecard td { border: 1px solid var(--border); text-align: center; padding: 3px 2px; }
.scorecard thead th { background: var(--green); color: #fff; }
.scorecard thead th a { color: #fff; text-decoration: none; display: block; }
.scorecard .par-row td, .scorecard .si-row td, .scorecard .par-row th, .scorecard .si-row th {
  background: #f3efe2;
  color: var(--muted);
  font-weight: 400;
}
.scorecard tbody th { text-align: left; padding-left: 6px; white-space: nowrap; color: var(--dark); }
.scorecard td a { display: block; color: var(--text); text-decoration: none; min-height: 32px; }
.scorecard td small { display: block; font-size: 0.7rem; color: var(--green); font-weight: 700; }
.scorecard td.is-empty a { color: #c2bcae; }
.scorecard td.total { background: #f3efe2; }

.totals { width: 100%; border-collapse: collapse; }
.totals th, .totals td { padding: 6px 4px; text-align: left; border-bottom: 1px solid var(--border); }

.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.plain-list li:last-child { border-bottom: none; }

/* --- Leaderboard --- */
.standings { list-style: none; margin: 0 0 8px; padding: 0; }
.standing {
  display: grid;
  grid-template-columns: 40px 1fr auto auto auto;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.standing.is-leader { background: var(--dark); border-color: var(--dark); color: #fff; }
.standing-pos {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #e8e5dc;
  color: var(--muted);
  font-weight: 700;
}
.is-leader .standing-pos { background: var(--gold); color: var(--dark); }
.standing-name { font-weight: 700; font-size: 1.1rem; }
.standing-total { text-align: right; }
.standing-total strong { font-size: 1.4rem; }
.is-leader .standing-total strong { color: var(--gold-light); }
.provisional-note { display: block; font-size: 0.7rem; color: #8a6514; }
.is-leader .provisional-note { color: var(--gold-light); opacity: 0.85; }
.standing-gap { min-width: 52px; text-align: right; font-size: 0.85rem; color: var(--muted); }
.is-leader .standing-gap { color: var(--gold-light); }

.breakdown { width: 100%; border-collapse: collapse; background: var(--white); font-size: 0.9rem; }
.breakdown th, .breakdown td { padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: center; }
.breakdown thead th { background: var(--green); color: #fff; font-size: 0.8rem; }
.breakdown tbody th, .breakdown tfoot th { text-align: left; font-weight: 600; font-size: 0.85rem; }
.breakdown tbody th a { color: var(--dark); text-decoration: none; }
.breakdown tfoot tr:first-child { background: #f3efe2; }
.breakdown .state-in_progress td { color: var(--muted); font-style: italic; }
.breakdown td.provisional { color: #8a6514; font-style: italic; }
.albatross { display: block; font-size: 0.7rem; font-weight: 700; color: var(--red); }

.tag {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  font-style: normal;
  vertical-align: 1px;
  white-space: nowrap;
}
.tag-progress { background: #fff4dc; color: #8a6514; }
.tag-provisional { background: #fff4dc; color: #8a6514; border: 1px dashed var(--gold); }

.round-detail summary { font-size: 0.95rem; }
.round-detail .totals { font-size: 0.85rem; }
.round-detail .totals th, .round-detail .totals td { text-align: center; padding: 6px 3px; }
.round-detail .totals tbody th { text-align: left; }

/* --- Rules --- */
.rules ul { margin: 0; padding-left: 20px; }
.rules li + li { margin-top: 6px; }
.rules p { margin: 0 0 8px; }
.rules .totals { margin: 8px 0; font-size: 0.9rem; }

/* --- Who's signed in --- */
.whoami {
  margin-left: auto;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(232, 201, 106, 0.5);
  color: var(--gold-light);
  font-size: 0.85rem;
  font-weight: 600;
}

/* --- You --- */
.you-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--dark);
  font-family: var(--ui);
  font-size: 0.7rem;
  font-weight: 800;
  vertical-align: 2px;
}
.score-row.is-me { border: 2px solid var(--gold); box-shadow: 0 2px 8px rgba(212, 168, 67, 0.25); }
.last-change { grid-column: 1 / -1; font-size: 0.75rem; color: var(--muted); }
.standing.is-me:not(.is-leader) { border: 2px solid var(--gold); }
.you-summary {
  margin: 0 0 10px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: #fff4dc;
  border: 1px solid var(--gold-light);
  font-weight: 700;
  color: var(--dark);
}

.carry-on {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--green), var(--light));
  color: #fff;
  text-decoration: none;
  box-shadow: var(--shadow);
}
.carry-on-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--gold-light); }
.carry-on strong { font-size: 1.2rem; }

/* --- Activity --- */
.activity { list-style: none; margin: 0; padding: 0; }
.activity-item {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.activity-item.is-me { background: #fffaf0; }
.activity-time { color: var(--muted); font-size: 0.8rem; padding-top: 2px; }
.activity-text { min-width: 0; }
.activity-device { margin-top: 2px; font-size: 0.78rem; color: var(--muted); }
.activity-device summary { cursor: pointer; width: fit-content; }
.activity-device dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; margin: 4px 0 0; }
.activity-device dt { font-weight: 600; }
.activity-device dd { margin: 0; overflow-wrap: anywhere; }
.model-ratings td { text-align: center; }
.hole-notes summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.hole-note { display: block; margin-top: 10px; }
.hole-note textarea, .course-form textarea { width: 100%; }

.scorecard td a { position: relative; }
.scorecard .snowman { position: absolute; top: 0; right: 0; font-size: 0.6rem; line-height: 1; pointer-events: none; }

.whiskey { margin: 8px 0; }
.need-list { margin: 0 0 8px; padding-left: 18px; }
.need-list li { margin: 4px 0; }
.award h2 { margin-top: 0; }
.award p { margin: 4px 0; }

/* The hole's drawing (app/holemap.py): tee at the bottom, green at the top. */
.hole-view { position: relative; margin: 0 0 12px; }
.hole-map {
  display: block;
  width: 100%;
  height: 78vh;
  background: #dbe6cf; /* the rough's colour, either side of a narrow hole */
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.hole-view.is-small .hole-map { height: 18vh; }
/* As tall as its width needs: the drawing edge to edge. */
.hole-view.is-full .hole-map { height: auto; }
.hole-view-size {
  position: absolute;
  top: 8px;
  right: 8px;
  width: var(--tap);
  height: var(--tap);
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgba(254, 252, 247, 0.9);
  color: var(--dark);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}
/* Where I am (this phone's own position; see _hole_view.html). */
.hole-locate {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: var(--tap);
  height: var(--tap);
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgba(254, 252, 247, 0.9);
  color: var(--dark);
  cursor: pointer;
}
.hole-locate[hidden] { display: none; }
.hole-locate[aria-pressed="true"] { background: #1a73e8; border-color: #1a73e8; color: #fff; }
.hole-distance {
  position: absolute;
  left: 8px;
  bottom: 8px;
  max-width: calc(100% - 72px);
  margin: 0;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(26, 60, 40, 0.88);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
}
.hm-me { fill: #1a73e8; stroke: #fff; stroke-width: 2; }
/* Off the map: on its nearest edge, hollow. */
.hm-me.is-edge { fill: #fff; stroke: #1a73e8; stroke-width: 3; }
/* Drop pin: the button sits above "where I am"; the pin and its lines are orange. */
.hole-pin {
  position: absolute;
  right: 8px;
  bottom: calc(16px + var(--tap));
  width: var(--tap);
  height: var(--tap);
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgba(254, 252, 247, 0.9);
  color: var(--dark);
  cursor: pointer;
}
.hole-pin[hidden] { display: none; }
.hole-view.is-small .hole-pin { display: none; } /* no room for two buttons */
.hole-pin[aria-pressed="true"] { background: #e8710a; border-color: #e8710a; color: #fff; }
.hole-map.is-pinning { cursor: crosshair; }
.hole-map.is-dragging { cursor: grabbing; }
.hole-map.is-dragging .hm-drop { r: 7px; } /* lifted while dragged */
.hm-drop { fill: #e8710a; stroke: #fff; stroke-width: 1.5; }
.hm-drop-line { fill: none; stroke: #e8710a; stroke-width: 1.6; stroke-dasharray: 4 3; stroke-linecap: round; stroke-linejoin: round; }
.hole-wind-box {
  position: absolute;
  top: 8px;
  left: 8px;
  text-align: center;
  color: var(--dark);
  font-size: 0.7rem;
  line-height: 1.2;
}
.hole-view.is-small .hole-wind-box span { display: none; }
.hm-rough { fill: #dbe6cf; }
.hm-wood { fill: #87a37c; stroke: #87a37c; stroke-width: 1.2; stroke-linejoin: round; }
.hm-water { fill: #8fc4e4; }
.hm-fairway { fill: #a8d08d; }
.hm-tee { fill: #6fa26f; }
.hm-bunker { fill: #f3e6b8; stroke: #d9c88a; stroke-width: 0.6; }
.hm-green { fill: #4f9d5d; stroke: #3b7f49; stroke-width: 0.8; }
.hm-trees { fill: none; stroke: #7f9c72; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.hm-tree { fill: #7f9c72; }
.hm-line { fill: none; stroke: #fff; stroke-width: 1.6; stroke-dasharray: 5 5; stroke-linejoin: round; opacity: 0.9; }
.hm-flag { fill: var(--red); stroke: var(--text); stroke-width: 1; stroke-linejoin: round; }
.hm-pin { fill: var(--text); }
/* The way to the next tee: dark grey, apart from the white line of play. */
.hm-walk { fill: none; stroke: #3d3d3d; stroke-width: 2.6; stroke-dasharray: 0 5; stroke-linecap: round; stroke-linejoin: round; }
.hm-walk-head { fill: #3d3d3d; }
.hm-walk-label { fill: #3d3d3d; stroke: rgba(255, 255, 255, 0.7); stroke-width: 1.2; paint-order: stroke; font-weight: 700; }
.hole-wind { width: 44px; height: 44px; display: block; margin: 0 auto 2px; }
.hole-wind circle { fill: var(--white); stroke: var(--dark); stroke-width: 1.5; }
.hole-wind path { fill: none; stroke: var(--dark); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

/* The course page's holes: a grid of drawings; tap one to enlarge it. */
.course-maps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.course-map { display: block; padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: center; cursor: pointer; }
.course-map-label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; }
.course-map .hole-map { height: 200px; }
.course-map.is-big { grid-column: 1 / -1; }
.course-map.is-big .hole-map { height: 70vh; }

/* Neville's trip preview, top of the rounds page (rounds/_preview.html). */
.preview-title { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 1.1rem; color: var(--green); }
.preview-status { margin: 0 0 6px; }
.preview-status[hidden] { display: none; }
.preview-audio { width: 100%; margin: 4px 0 6px; }
.preview-audio[hidden], .preview-text[hidden], .preview-again[hidden] { display: none; }
.preview-text p { margin: 0 0 10px; }
.preview-again { margin-top: 10px; }

/* Pause Neville (caddie.js): floats above the page while he's talking. */
.caddie-pause {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 50;
  min-height: var(--tap);
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: rgba(26, 60, 40, 0.94);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}
.caddie-pause[hidden] { display: none; }

/* The round so far, at the top of a hole page (rounds/_round_board.html). */
.round-board { margin: 0 0 12px; }
.round-board[hidden] { display: none; }
.round-board caption { text-align: left; font-size: 0.8rem; font-weight: 600; color: var(--muted); padding: 0 6px 2px; }
.round-board table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.round-board th, .round-board td { padding: 4px 6px; text-align: right; }
.round-board th[scope="row"], .round-board thead th:first-child { text-align: left; }
.round-board thead th { font-size: 0.75rem; font-weight: 600; color: var(--muted); }
.round-board tbody tr { border-top: 1px solid var(--border); }
.round-board tr.is-leader th, .round-board tr.is-leader td { font-weight: 700; }
.round-board .board-points { border-left: 1px solid var(--border); }
.round-board .board-total { font-weight: 700; }
/* A custom round's points (rounds/custom.html). */
.custom-points label { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; font-weight: 600; }
.custom-points input { width: 6em; text-align: right; font-size: 1.1rem; min-height: var(--tap); }
.custom-description { white-space: pre-line; margin: 0; }

/* The + on a standing and what it opens (leaderboard/show.html). */
.standing-more {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--border); background: transparent; color: inherit;
  font-size: 1.2rem; line-height: 1; cursor: pointer;
}
.is-leader .standing-more { border-color: var(--gold-light); color: var(--gold-light); }
.standing-parts { grid-column: 1 / -1; }
.standing-parts[hidden] { display: none; }
.standing-parts table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.standing-parts th { text-align: left; font-weight: 600; padding: 4px 0; }
.standing-parts td { text-align: right; padding: 4px 0; vertical-align: top; font-weight: 600; }
.standing-parts tbody tr { border-top: 1px solid rgba(128, 128, 128, 0.25); }
.standing-parts tfoot tr { border-top: 2px solid rgba(128, 128, 128, 0.45); }
.standing-parts-how { display: block; font-weight: 400; opacity: 0.8; }
