/* My SimGolfBoss — phone review surface.
   Phone-first, one column, big numbers, graphics over tables (spec).
   Dark theme to match simgolfboss.com. */

:root {
  --bg: #0a1a13;
  --bg-raise: #10241b;
  --bg-card: #132b20;
  --line: #21402f;
  --ink: #eef5f0;
  --ink-dim: #9db8a8;
  --ink-faint: #6d8a7a;
  --accent: #46d17c;
  --accent-ink: #06230f;
  --warn: #e8b93e;
  --danger: #e4574d;
  --chip-sim: #2e6fd8;
  --chip-tracker: #8a5fd6;
  --chip-phone: #d17f2e;
  /* Desktop palette — per-sim brand colours + On-Course violet */
  --pureplay: #3ee06f;
  --gspro: #57a8ff;
  --muni: #1e9e6a;
  --shotforge: #ff8a3d;
  --oncourse: #b18cff;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.offline-banner {
  background: var(--warn);
  color: #231a02;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  padding: 6px 12px;
}

.app-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  background: rgba(10, 26, 19, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; }
.brand-icon { width: 28px; height: 28px; border-radius: 7px; }
.sync-pill {
  font-size: 12px; color: var(--ink-dim);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 10px; white-space: nowrap;
  background: var(--bg-raise);
}
.sync-pill.stale { color: var(--warn); border-color: var(--warn); }

.view {
  max-width: 600px; margin: 0 auto;
  padding: 18px 16px calc(96px + env(safe-area-inset-bottom));
}
.view.signed-out { padding-bottom: 32px; }

h1 { font-size: 24px; margin: 4px 0 6px; }
h2 { font-size: 18px; margin: 22px 0 10px; }
.subtle { color: var(--ink-dim); }
.small { font-size: 13px; }
.muted { color: var(--ink-faint); }

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0 0 12px;
}
.stat-row { display: flex; gap: 12px; }
.stat {
  flex: 1; background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
}
.stat .num { font-size: 34px; font-weight: 800; line-height: 1.05; }
.stat .lbl { color: var(--ink-dim); font-size: 13px; margin-top: 2px; }

/* Source chips — sim / tracker / phone are always labelled, never blended */
.chip {
  display: inline-block; font-size: 11px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  border-radius: 999px; padding: 2px 8px; vertical-align: middle;
  color: #fff;
}
.chip-sim { background: var(--chip-sim); }
.chip-tracker { background: var(--chip-tracker); }
.chip-phone { background: var(--chip-phone); }
.chip-pureplay { background: var(--pureplay); color: #06230f; }
.chip-gspro { background: var(--gspro); color: #0a1a2e; }
.chip-muni { background: var(--muni); color: #fff; }
.chip-shotforge { background: var(--shotforge); color: #2a1503; }
.chip-oncourse { background: var(--oncourse); color: #1d1030; }

/* The hidden attribute must always win — the header and tab bar set
   display:flex, which otherwise overrides the UA's [hidden] rule and
   leaves the chrome visible on the sign-in screen. */
[hidden] { display: none !important; }

/* Pending-delivery badge on phone-round rows */
.badge-pending {
  display: inline-block; font-size: 11px; font-weight: 700;
  color: var(--warn); border: 1px solid var(--warn); border-radius: 999px;
  padding: 1px 8px; vertical-align: middle; white-space: nowrap;
}

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { margin: 0 0 10px; }
.row-card {
  display: block; width: 100%; text-align: left;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
  color: var(--ink); text-decoration: none; cursor: pointer;
  font: inherit;
}
.row-card:active { background: var(--bg-raise); }
.row-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.row-title { font-weight: 700; font-size: 16px; }
.row-meta { color: var(--ink-dim); font-size: 13px; margin-top: 3px; }
.big-num { font-size: 26px; font-weight: 800; white-space: nowrap; }
.big-num .unit { font-size: 13px; font-weight: 600; color: var(--ink-dim); }

/* Bag table — Sim and On-Course side by side, never blended */
.bag-table { width: 100%; border-collapse: collapse; }
.bag-table th, .bag-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: right; }
.bag-table th:first-child, .bag-table td:first-child { text-align: left; }
.bag-table th { color: var(--ink-dim); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.bag-table td.club { font-weight: 700; }
.bag-table td.carry { font-size: 19px; font-weight: 700; }
.bag-table .missing { color: var(--ink-faint); font-weight: 400; }
.bag-table .oc, .bag-table .oc-head { color: var(--oncourse); }
.bag-table .col-pureplay { color: var(--pureplay); }
.bag-table .col-gspro { color: var(--gspro); }
.bag-table .col-muni { color: var(--muni); }
.bag-table .col-shotforge { color: var(--shotforge); }

/* Bag Combined ⇄ By sim app toggle */
.seg {
  display: flex; gap: 4px; background: var(--bg-raise);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px;
  margin: 0 0 12px;
}
.seg button {
  flex: 1; border: 0; border-radius: 999px; padding: 9px 10px;
  background: transparent; color: var(--ink-dim);
  font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.seg button.active { background: var(--accent); color: var(--accent-ink); }

/* Capture round entry (History) */
.capture-bar { margin: 4px 0 16px; }

/* Scorecard */
.scorecard { overflow-x: auto; }
.scorecard table { border-collapse: collapse; min-width: 100%; }
.scorecard th, .scorecard td {
  border: 1px solid var(--line); padding: 6px 0; text-align: center;
  min-width: 30px; font-size: 14px;
}
.scorecard th { background: var(--bg-raise); color: var(--ink-dim); font-size: 11px; text-transform: uppercase; }
.scorecard td.tot, .scorecard th.tot { font-weight: 800; background: var(--bg-raise); }
.scorecard .under { color: var(--accent); font-weight: 700; }
.scorecard .over { color: var(--warn); }

/* Practice-session per-club totals */
.club-total { padding: 10px 0; border-bottom: 1px solid var(--line); }
.club-total:last-child { border-bottom: 0; }
.ct-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.ct-club { font-weight: 700; font-size: 16px; }
.ct-avg { font-size: 22px; font-weight: 800; }
.ct-avg .unit { font-size: 12px; font-weight: 600; color: var(--ink-dim); }

/* Bars — analytics stat bars + session totals */
.bar-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.bar-label { flex: 0 0 38%; font-size: 14px; color: var(--ink-dim); }
.bar-track {
  flex: 1; height: 10px; border-radius: 999px;
  background: var(--bg-raise); overflow: hidden;
}
.bar-fill { height: 100%; border-radius: 999px; background: var(--accent); }
.bar-value { flex: 0 0 auto; font-weight: 800; font-size: 15px; white-space: nowrap; }
.club-total .bar-track { margin: 6px 0 2px; }

/* Analytics — insight cards, trend, strokes-gained bars */
.insight { border-left: 4px solid var(--accent); }
.insight.warn { border-left-color: var(--warn); }
.insight-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-dim); }
.insight-value { font-size: 30px; font-weight: 800; line-height: 1.15; margin: 2px 0; }
.trend { display: flex; align-items: flex-end; gap: 10px; height: 130px; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.trend-val { font-size: 13px; font-weight: 800; }
.trend-bar { width: 70%; max-width: 44px; border-radius: 6px 6px 0 0; background: var(--accent); }
.trend-lbl { font-size: 12px; color: var(--ink-dim); }
.sg-bar {
  position: relative; height: 12px; border-radius: 999px;
  background: var(--bg-raise); margin: 10px 0 4px; overflow: hidden;
}
.sg-bar::after {
  content: ""; position: absolute; left: 50%; top: 0; bottom: 0;
  width: 2px; background: var(--ink-faint); transform: translateX(-1px);
}
.sg-fill { position: absolute; top: 0; bottom: 0; border-radius: 999px; }
.hero-sg { font-size: 56px; font-weight: 800; line-height: 1; }
.facet-scale { display: flex; justify-content: space-between; color: var(--ink-faint); font-size: 12px; margin-top: 2px; }
a.facet-card { text-decoration: none; }

/* Forms + buttons */
label.field { display: block; margin: 0 0 14px; font-weight: 600; font-size: 14px; }
input[type="email"], input[type="text"], input[type="tel"] {
  display: block; width: 100%; margin-top: 6px;
  background: var(--bg-raise); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 13px 14px; font-size: 17px; font-weight: 400;
}
input.code-input { font-size: 28px; letter-spacing: 0.35em; text-align: center; font-weight: 700; }
.btn {
  display: block; width: 100%; border: 0; border-radius: 12px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 17px; font-weight: 700; padding: 14px 16px; cursor: pointer;
  text-align: center; text-decoration: none;
}
.btn:active { filter: brightness(1.1); }
.btn.secondary { background: var(--bg-raise); color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger.armed { animation: pulse 1s infinite; }
.btn:disabled { opacity: 0.55; cursor: default; }
@keyframes pulse { 50% { filter: brightness(1.25); } }
.link-btn {
  background: none; border: 0; color: var(--accent); font: inherit;
  font-size: 15px; cursor: pointer; padding: 8px 0;
}
.error-box {
  background: rgba(228, 87, 77, 0.14); border: 1px solid var(--danger);
  color: #ffb3ad; border-radius: 10px; padding: 11px 13px; margin: 0 0 14px; font-size: 14px;
}
.empty {
  border: 1.5px dashed var(--line); border-radius: var(--radius);
  padding: 26px 18px; text-align: center; color: var(--ink-dim);
}
.empty .big { font-size: 17px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }

/* Sign-in */
.signin-wrap { max-width: 420px; margin: 6vh auto 0; }
.signin-logo { width: 72px; height: 72px; border-radius: 16px; display: block; margin: 0 auto 14px; }
.signin-wrap h1 { text-align: center; }
.signin-wrap .lede { text-align: center; color: var(--ink-dim); margin: 0 0 22px; }
.signpost {
  border: 1px solid var(--line); border-left: 4px solid var(--accent);
  background: var(--bg-card); border-radius: 10px;
  padding: 11px 13px; margin: 0 0 14px; font-size: 14px; color: var(--ink-dim);
}

/* Toggle (pause sync) */
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.switch { position: relative; width: 52px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; margin: 0; cursor: pointer; }
.switch .track {
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--bg-raise); border: 1px solid var(--line); transition: background 0.15s;
  pointer-events: none;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
  border-radius: 50%; background: var(--ink-dim); transition: all 0.15s;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { left: 25px; background: #fff; }

/* Tab bar */
.tab-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; background: rgba(10, 26, 19, 0.97);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab-bar a {
  flex: 1; text-align: center; padding: 8px 2px 10px;
  color: var(--ink-faint); text-decoration: none; font-size: 11px; font-weight: 600;
}
.tab-bar a .tab-ico { display: block; font-size: 19px; line-height: 1.2; }
.tab-bar a.active { color: var(--accent); }

.notice { border-left: 3px solid var(--warn); padding: 4px 0 4px 12px; color: var(--ink-dim); font-size: 14px; margin: 12px 0; }
.sync-action { margin: 12px 0 4px; }
.kv { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--ink-dim); }
