/* Teivovo Golf — fairway green, sand and a coral flag. Deliberately its own look. */
:root {
  /* Colours taken from the Teivovo Golf logo: deep navy, ocean blues, sea green, leaf green and coral. */
  --ink: #12283a;
  --muted: #566b78;
  --green-900: #103351;   /* navy: headings, wordmark, dark bars */
  --green-800: #125a71;   /* deep teal-blue: primary buttons */
  --green-700: #216e89;   /* ocean blue: links, focus */
  --green-100: #e2f0f4;   /* pale ocean tint */
  --sand: #f3f6f6;
  --sand-dark: #dfe9ea;
  --paper: #ffffff;
  --line: #d6e2e4;
  --coral: #df6d62;
  --coral-dark: #c4524a;
  --leaf: #779b5b;
  --sea: #1f7068;
  --danger: #b3261e;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 51, 81, .08), 0 6px 20px rgba(16, 51, 81, .07);
  --font-body: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-head: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--sand); color: var(--ink);
  font: 16px/1.5 var(--font-body);
  min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; }
h1, h2, h3, h4 { font-family: var(--font-head); color: var(--green-900); line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }
a { color: var(--green-700); text-underline-offset: 2px; }
a:hover { color: var(--coral-dark); }
p { margin: 0 0 1em; }
.text-muted { color: var(--muted); }
.skip { position: absolute; left: -999px; top: 0; background: var(--paper); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; top: 8px; }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.section { padding-top: 32px; padding-bottom: 40px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 28px; }
.section.two-col { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.two-col > .field { margin-bottom: 0; }
@media (max-width: 800px) { .two-col, .section.two-col { grid-template-columns: 1fr; } }

/* ── Header ───────────────────────────────────────────── */
.tv-header { background: #fff; color: var(--green-900); border-bottom: 1px solid var(--line); position: relative; }
.tv-header::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 4px; background: linear-gradient(90deg, #216e89 0 28%, #1f7068 28% 56%, #779b5b 56% 78%, #df6d62 78% 100%); }
.tv-header-in { max-width: 1180px; margin: 0 auto; padding: 8px 16px 10px; display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.tv-brand { display: inline-flex; align-items: center; gap: 12px; color: var(--green-900); text-decoration: none; }
.tv-brand:hover { color: var(--green-800); }
.tv-mark { flex: none; width: 56px; height: 56px; display: block; }
.tv-word { font-weight: 800; font-size: 1.5rem; letter-spacing: .02em; text-transform: uppercase; display: inline-flex; flex-direction: column; line-height: 1; }
.tv-word small { font-size: .62rem; font-weight: 700; letter-spacing: .5em; color: var(--coral-dark); margin-top: 5px; }
.tv-nav { display: flex; gap: 4px; margin-right: auto; }
.tv-nav a { color: var(--green-900); text-decoration: none; padding: 8px 14px; border-radius: 999px; font-weight: 700; }
.tv-nav a:hover { background: var(--green-100); color: var(--green-800); }
.tv-club { display: inline-flex; align-items: center; gap: 10px; color: var(--green-900); text-decoration: none; }
.tv-club-logo { height: 44px; width: auto; max-width: 130px; object-fit: contain; border-radius: 6px; }
.tv-club-name { font-weight: 800; }
.tv-club form { margin: 0; }
.tv-link { background: none; border: 0; color: var(--green-700); font: inherit; cursor: pointer; text-decoration: underline; padding: 4px; }
.tv-link:hover { color: var(--coral-dark); }
.tv-header-public .tv-club-lead { margin-right: auto; font-size: 1.3rem; }
.tv-header-public .tv-club-logo { height: 56px; }
.tv-live { font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 800; color: var(--coral-dark); display: inline-flex; align-items: center; gap: 8px; }
.tv-live::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 0 rgba(223, 109, 98, .7); animation: tv-pulse 1.8s infinite; }
@keyframes tv-pulse { 70% { box-shadow: 0 0 0 9px rgba(223, 109, 98, 0); } 100% { box-shadow: 0 0 0 0 rgba(223, 109, 98, 0); } }
@media (prefers-reduced-motion: reduce) { .tv-live::before { animation: none; } }
.tv-footer { padding: 22px 16px; text-align: center; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); background: var(--paper); }
.tv-brand-small { color: var(--muted); gap: 8px; }
.tv-brand-small .tv-mark { width: 30px; height: 30px; }
.tv-brand-small:hover { color: var(--green-700); }

/* ── Landing and sign-in ──────────────────────────────── */
.tv-hero { background: linear-gradient(160deg, #103351 0%, #125a71 60%, #1f7068 100%); color: #eaf3f5; padding: 64px 0 72px; position: relative; overflow: hidden; }
.tv-hero .container { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 32px; align-items: center; }
.tv-hero h1 { color: #fff; font-size: clamp(2rem, 5vw, 3.1rem); max-width: 16em; }
.tv-eyebrow { color: #f3b3ab; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; font-size: .8rem; }
.tv-lede { font-size: 1.15rem; max-width: 36em; color: #d6e6ea; }
.tv-hero-logo { justify-self: center; width: min(100%, 340px); background: #fff; border-radius: 28px; padding: 14px; box-shadow: 0 18px 50px rgba(0, 0, 0, .25); }
.tv-cta { padding: 14px 26px; font-size: 1.05rem; margin: 6px 10px 0 0; }
.tv-hero .btn-primary { background: var(--coral); color: #fff; }
.tv-hero .btn-primary:hover { background: var(--coral-dark); }
.tv-features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.tv-feature { background: var(--paper); border: 1px solid var(--line); border-top: 4px solid var(--coral); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.tv-feature:nth-child(2) { border-top-color: var(--green-700); }
.tv-feature:nth-child(3) { border-top-color: var(--sea); }
.tv-feature:nth-child(4) { border-top-color: var(--leaf); }
.tv-feature p { color: var(--muted); margin: 0; }
@media (max-width: 900px) { .tv-features { grid-template-columns: 1fr 1fr; } .tv-hero .container { grid-template-columns: 1fr; } .tv-hero-logo { width: 200px; order: -1; justify-self: start; } }
@media (max-width: 560px) { .tv-features { grid-template-columns: 1fr; } .tv-hero { padding: 40px 0 48px; } .tv-word { font-size: 1.25rem; } }
.tv-auth { display: flex; justify-content: center; padding: 48px 16px; }
.tv-auth-card { width: 100%; max-width: 440px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 32px; box-shadow: var(--shadow); }
.tv-auth-logo { display: block; width: 120px; height: 120px; margin: -8px auto 8px; }
.tv-page-title { margin-bottom: .2em; }
.tv-list { list-style: none; padding: 0; margin: 0; }
.tv-list li { padding: 14px 0; border-bottom: 1px solid var(--line); display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; }
.tv-logo-preview { max-height: 90px; max-width: 240px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px; }

/* ── Forms and buttons ────────────────────────────────── */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 5px; }
.input {
  width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1.5px solid #b9cbd0;
  border-radius: 8px; padding: 9px 11px; min-height: 42px;
}
textarea.input { resize: vertical; }
.input:focus { border-color: var(--green-700); outline: 3px solid rgba(33, 110, 137, .25); outline-offset: 0; }
select.input { padding-right: 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 700;
  padding: 10px 18px; border-radius: 999px; border: 1.5px solid transparent; cursor: pointer; text-decoration: none;
  min-height: 42px; line-height: 1.2; transition: background .15s, border-color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .4; cursor: default; }
.btn-primary { background: var(--green-800); color: #fff; }
.btn-primary:hover { background: var(--green-900); color: #fff; }
.btn-secondary { background: var(--paper); color: var(--green-900); border-color: var(--green-700); }
.btn-secondary:hover { background: var(--green-100); color: var(--green-900); }
.btn-ghost { background: transparent; color: var(--green-800); padding-left: 10px; padding-right: 10px; }
.btn-ghost:hover { background: rgba(28, 107, 79, .1); color: var(--green-900); }
.btn-block { display: flex; width: 100%; }
.form-error { background: #fdecea; color: var(--danger); border: 1px solid #f3c1bc; border-radius: 8px; padding: 9px 12px; margin: 0 0 12px; }
.comp-notice { background: var(--green-100); color: var(--green-900); border: 1px solid #b7d6df; border-radius: 8px; padding: 9px 12px; margin: 0 0 12px; }
.comp-warn { background: #fff4d6; color: #5c4400; border: 1px solid #f0d98c; border-radius: 8px; padding: 9px 12px; margin: 0 0 14px; }

.radio { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.radio input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.radio .dot { width: 22px; height: 22px; border: 2px solid #9aa89f; border-radius: 6px; background: #fff; display: inline-block; flex: none; position: relative; }
.radio input:checked + .dot { background: var(--green-800); border-color: var(--green-800); }
.radio input:checked + .dot::after { content: ""; position: absolute; left: 6px; top: 2px; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.radio input:focus-visible + .dot { outline: 3px solid var(--coral); outline-offset: 2px; }

.tag { display: inline-block; font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 2px 9px; border-radius: 999px; vertical-align: middle; }
.tag-accent { background: var(--coral); color: #fff; }
.tag-neutral { background: var(--sand-dark); color: #4b5a51; }

.aside-panel { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 22px; box-shadow: var(--shadow); }
details.aside-panel > summary { list-style-position: inside; }

/* ── Tables ───────────────────────────────────────────── */
.comp-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
.table { width: 100%; border-collapse: collapse; background: var(--paper); font-size: .95rem; }
.comp-scroll > .table { border: 0; }
.table th { text-align: left; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 800; padding: 11px 12px; background: #f1f6f7; border-bottom: 2px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid #e4edee; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #f7fbfb; }
.comp-num { text-align: right; font-variant-numeric: tabular-nums; }
.table th.comp-num { text-align: right; }
.comp-muted td, .comp-muted { color: #8b968f; }
.comp-flag td { background: #fff4d6 !important; }
.comp-edit .input { min-height: 36px; padding: 6px 8px; }
.comp-score { text-align: center; font-weight: 700; font-size: 1.05rem; }
.comp-missing { color: var(--danger); font-weight: 700; }
.comp-state { white-space: nowrap; font-size: .85rem; min-width: 90px; color: var(--muted); }
.comp-state.ok { color: var(--green-700); font-weight: 700; }
.comp-state.bad { color: var(--danger); font-weight: 700; white-space: normal; }
.comp-state.saving { color: var(--muted); }
.nett { font-weight: 700; color: var(--green-800); min-width: 52px; }
.comp-tick { font-size: 1.3rem; text-align: center; width: 90px; }
.comp-group-start td { border-top: 3px solid var(--sand-dark); }

/* ── Competition screens ──────────────────────────────── */
.comp-head { padding-bottom: 0; }
.comp-head h2 { font-size: 2rem; }
.comp-sub, .comp-days { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 2px solid var(--line); margin: 14px 0 18px; }
.comp-sub a, .comp-days a {
  padding: 10px 16px; text-decoration: none; font-weight: 700; color: var(--muted); border-radius: 8px 8px 0 0;
  border-bottom: 4px solid transparent; margin-bottom: -2px;
}
.comp-sub a:hover, .comp-days a:hover { color: var(--green-900); background: rgba(28, 107, 79, .08); }
.comp-sub a[aria-current="page"], .comp-days a[aria-current="page"] { color: var(--green-900); border-bottom-color: var(--coral); background: var(--paper); }
.comp-days { margin-top: 0; }
.comp-days a { padding: 8px 14px; }
.comp-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 20px; align-items: center; }
.comp-finish { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; background: var(--green-900); color: #eaf3f5; border-radius: 12px; padding: 14px 18px; margin: 0 0 20px; }
.comp-finish p { margin: 0; flex: 1; min-width: 220px; }
.comp-finish .btn { background: var(--coral); color: #fff; }
.comp-finish .btn:hover { background: var(--coral-dark); }
.comp-board { margin-bottom: 30px; }
.comp-board h3 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.comp-filter { display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: flex-end; margin-bottom: 8px; }
.comp-filter .field { min-width: 150px; }
.comp-print-head { margin-bottom: 18px; }

/* ── Printing ─────────────────────────────────────────── */
.print-only { display: none; }
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; color: #000; font-size: 11pt; display: block; }
  .no-print, .tv-header, .tv-footer, .skip { display: none !important; }
  .print-only { display: block; }
  th.print-only, td.print-only { display: table-cell; }
  .container { max-width: none; padding: 0; }
  .section { padding: 0; }
  .two-col, .section.two-col { display: block; }
  .comp-scroll { border: 0; overflow: visible; border-radius: 0; background: none; }
  .table { font-size: 10pt; }
  .table th { background: #eee !important; color: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .table td, .table th { border-bottom: 1px solid #999; padding: 5px 6px; }
  .table tbody tr:hover td { background: none; }
  .comp-flag td { background: none !important; font-weight: 700; }
  .comp-board, .comp-winners tr { break-inside: avoid; }
  .comp-group-start td { border-top: 2px solid #000; }
  h1, h2, h3 { color: #000; }
  a { color: #000; text-decoration: none; }
  .comp-print-head { display: flex !important; align-items: center; gap: 14px; border-bottom: 3px solid #000; padding-bottom: 8px; }
  .comp-print-head img { max-height: 60px; }
  .comp-print-head h2 { margin: 0; }
  .comp-print-head p { margin: 0; }
}

/* Owner stepping into a club */
.tv-acting { background: var(--coral); color: #fff; padding: 8px 16px; display: flex; gap: 16px; align-items: center; justify-content: center; flex-wrap: wrap; font-size: .95rem; }
.tv-acting form { margin: 0; }
.tv-acting-btn { background: #fff; color: var(--green-900); border: 0; border-radius: 999px; padding: 5px 14px; font: inherit; font-weight: 800; cursor: pointer; }
.tv-acting-btn:hover { background: var(--green-100); }

/* Score sheet on a phone: keep the boxes people type in on screen, drop the columns they don't need */
@media (max-width: 640px) {
  .comp-scores .hide-sm { display: none; }
  .comp-scores th, .comp-scores td { padding-left: 6px; padding-right: 6px; }
}

/* Draw batches */
.batch-row { border: 1px solid var(--line, #d3dde3); border-radius: 12px; padding: 14px 16px 4px; margin-bottom: 14px; background: #fff; }
.batch-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.batch-tools { display: flex; gap: 4px; }
