/* TrueRecord Sports — Dive mockup. Tokens from the live XC app. */
:root {
  --tr-green-700: #15803d;
  --tr-green-600: #1f9e45;
  --tr-green-500: #2fb755;
  --tr-neon: #4be07a;
  --tr-forest-900: #0b2417;
  --tr-forest-800: #0e2e1c;
  --tr-forest-700: #13402a;
  --tr-pale: #f6f4ef;
  --tr-pale-alt: #efede6;
  --tr-surface-alt: #eef6ef;
  --tr-sheet: #f3f8f4;
  --tr-track: #dcebe1;
  --tr-surface: #fff;
  --tr-text: #12251a;
  --tr-muted: #5b6b60;
  --tr-faint: #5d6c61;
  --tr-hairline: #e0e6dd;
  --tr-border-strong: #c8d4c9;
  --tr-amber: #e0a030;
  --tr-danger: #b4362c;
  --tr-pending: #8a6410;
  --tr-pocket-muted: #a8c4b2;
  --tr-rail: 212px;
  --tr-header: 88px;
  --tr-bottom-nav: 64px;
  --tr-gutter: 20px;
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Archivo", "Inter", ui-sans-serif, system-ui, sans-serif;
  --shadow: 0 1px 0 #12251a0a, 0 8px 24px #12251a0f, 0 18px 40px #12251a0a;
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--tr-pale);
  color: var(--tr-text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--tr-green-700); text-decoration: none; }
a:hover { color: var(--tr-green-600); }
button, .btn { font-family: inherit; }

.skip {
  position: absolute; left: -999px; top: 0;
}
.skip:focus { left: 12px; top: 12px; background: #fff; padding: 8px 12px; z-index: 80; }

/* Layout */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
@media (min-width: 960px) {
  .app { flex-direction: row; }
}

.rail {
  display: none;
  background: var(--tr-forest-900);
  color: var(--tr-surface-alt);
  width: var(--tr-rail);
  flex: 0 0 var(--tr-rail);
  min-height: 100vh;
  position: sticky;
  top: 0;
  align-self: flex-start;
  padding: 18px 14px 20px;
  background-image:
    url("../assets/shell-speed-lines.svg"),
    repeating-linear-gradient(102deg, #4be07a1a 0 2px, transparent 2px 26px);
  background-size: cover, auto;
  background-position: center top, 0 0;
}
@media (min-width: 960px) {
  .rail {
    display: flex; flex-direction: column;
    position: fixed; left: 0; top: 0; bottom: 0;
    height: 100vh; min-height: 100vh;
  }
  .main { margin-left: var(--tr-rail); }
}
.rail-brand {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px 16px;
}
.rail-brand img.wordmark { height: 18px; width: auto; }
.badge-beta {
  background: #c2410c; color: #fff;
  font-size: 9px; font-weight: 700; letter-spacing: 0.08em;
  padding: 2px 6px; border-radius: 4px;
}
.rail-kicker {
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--tr-pocket-muted); padding: 0 10px 8px;
}
.rail nav a, .bottom-nav a {
  display: flex; align-items: center; gap: 10px;
  color: #d7eadc; text-decoration: none;
  padding: 9px 12px; border-radius: 999px;
  font-weight: 550; font-size: 14px;
}
.rail nav a:hover { background: #13402a; color: #fff; }
.rail nav a.active {
  background: var(--tr-neon); color: var(--tr-forest-900);
  box-shadow: 0 0 0 1px #4be07a73, 0 0 14px 2px #4be07a9e;
  font-weight: 700;
}
.rail-spacer { flex: 1; }
.rail-foot {
  padding: 16px 10px 0; font-size: 12px; color: var(--tr-pocket-muted);
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--tr-bottom-nav) + 16px);
}
@media (min-width: 960px) {
  .main { padding-bottom: 0; }
}

.topbar {
  display: flex; align-items: center; gap: 14px;
  min-height: 72px;
  padding: 14px var(--tr-gutter) 12px;
}
.topbar-mark {
  width: 48px; height: 48px; object-fit: contain; flex: 0 0 auto;
}
.topbar h1 {
  font-family: var(--font-display);
  font-size: 1.45rem; font-weight: 700; letter-spacing: -0.02em;
  margin: 0; line-height: 1.15;
}
.topbar .sub {
  margin: 2px 0 0; font-size: 13px; color: var(--tr-muted);
}
.topbar-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.content {
  padding: 0 var(--tr-gutter) 32px;
  max-width: 1120px;
  width: 100%;
}
@media (min-width: 960px) {
  .content, .topbar { max-width: 1120px; }
}

.mock-banner, .source-banner, .placeholder-banner, .verify-banner {
  border-radius: 12px; padding: 10px 14px; font-size: 13px; margin: 0 0 16px;
}
.mock-banner {
  background: var(--tr-forest-800); color: #eef6ef;
}
.source-banner { background: var(--tr-surface-alt); color: var(--tr-text); border: 1px solid var(--tr-hairline); }
.placeholder-banner {
  background: #f8ecd0; color: #5a3e08; border: 1px solid #e0a030;
  font-weight: 600;
}
.verify-banner {
  background: #fde8e6; color: #7a1f18; border: 1px solid #b4362c;
  font-weight: 600;
}
.placeholder-pill, .verify-pill, .source-pill, .tba-pill, .round-pill {
  display: inline-flex; align-items: center;
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px; padding: 2px 8px; vertical-align: middle;
  white-space: nowrap;
}
.placeholder-pill { background: #e0a030; color: #1a1204; }
.verify-pill { background: #b4362c; color: #fff; }
.source-pill { background: var(--tr-track); color: var(--tr-forest-800); }
.tba-pill { background: #f3e6c0; color: var(--tr-pending); }
.round-pill { background: var(--tr-surface-alt); color: var(--tr-forest-800); border: 1px solid var(--tr-border-strong); }
.round-pill.F { background: #dcfce7; color: #166534; }
.round-pill.S { background: #e0e7ff; color: #3730a3; }
.round-pill.P { background: #f3e8ff; color: #6b21a8; }

/* Cards */
.grid { display: grid; gap: 16px; }
.grid-2, .grid-3, .grid-2-1 { display: grid; gap: 16px; }
@media (min-width: 720px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-2-1 { grid-template-columns: 1.3fr 1fr; }
}
.card {
  background: var(--tr-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card h2, .card h3 {
  font-family: var(--font-display);
  margin: 0 0 8px; letter-spacing: -0.02em;
}
.card h2 { font-size: 1.15rem; }
.card h3 { font-size: 1rem; }
.muted { color: var(--tr-muted); font-size: 13px; }
.pocket {
  background: var(--tr-forest-800);
  color: #eef6ef;
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.pocket a { color: var(--tr-neon); font-weight: 650; }
.pocket h2, .pocket h3 { color: #fff; margin: 0 0 8px; font-family: var(--font-display); }
.stat-row { display: flex; gap: 10px; flex-wrap: wrap; }
.stat {
  background: #fff;
  border-radius: 14px;
  padding: 12px 16px;
  min-width: 96px;
  flex: 1;
}
.stat .label {
  font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--tr-muted); font-weight: 650;
}
.stat .value {
  font-family: var(--font-display); font-size: 1.7rem; font-weight: 700;
  letter-spacing: -0.03em; line-height: 1.1; margin-top: 2px;
}
.mint { background: var(--tr-surface-alt); border-radius: 14px; padding: 12px 14px; }

/* Toggle */
.toggle {
  display: inline-flex; background: #fff; border-radius: 999px;
  padding: 3px; gap: 2px; border: 1px solid var(--tr-hairline);
}
.toggle button {
  border: 0; background: transparent; color: var(--tr-muted);
  padding: 7px 16px; border-radius: 999px; cursor: pointer; font-weight: 650;
}
.toggle button[aria-pressed="true"] {
  background: var(--tr-green-700); color: #fff;
}

/* Roster cards */
.roster { display: grid; gap: 12px; }
@media (min-width: 620px) { .roster { grid-template-columns: repeat(3, 1fr); } }
.person {
  display: flex; flex-direction: column; gap: 8px;
  background: #fff; border-radius: 16px; padding: 16px;
  box-shadow: var(--shadow); color: inherit; text-decoration: none;
  min-height: 132px;
}
.person:hover { outline: 2px solid var(--tr-neon); }
.avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--tr-green-700); color: #eef6ef;
  display: grid; place-items: center;
  font-weight: 700; font-family: var(--font-display);
}
.person .name { font-weight: 700; font-size: 1.02rem; color: var(--tr-text); }
.person .meta { font-size: 13px; color: var(--tr-muted); }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%; border-collapse: collapse; font-size: 14px;
}
th {
  text-align: left; font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--tr-muted);
  background: var(--tr-surface-alt); padding: 10px 12px;
}
td { padding: 12px; border-bottom: 1px solid var(--tr-hairline); vertical-align: top; }
tr:hover td { background: #f7fbf8; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.mark { font-weight: 700; font-variant-numeric: tabular-nums; }

/* Schedule list */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  display: grid; grid-template-columns: 88px 1fr; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--tr-hairline);
}
.timeline .date { font-weight: 700; font-size: 13px; }
.timeline .when { font-size: 13px; color: var(--tr-muted); }

/* Dive sheet */
.sheet-table td, .sheet-table th { font-size: 13px; white-space: nowrap; }
.judges { display: inline-flex; gap: 4px; }
.judges span {
  min-width: 28px; text-align: center; background: var(--tr-sheet);
  border-radius: 6px; padding: 2px 4px; font-variant-numeric: tabular-nums;
}
.sheet-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.big-score {
  font-family: var(--font-display); font-size: 2.4rem; font-weight: 700;
  letter-spacing: -0.04em; line-height: 1;
}

/* Records */
.record-card .big-score { margin: 6px 0; }
.record-card.conflict { outline: 2px solid var(--tr-danger); }

.footer {
  margin-top: auto;
  background: var(--tr-forest-900); color: #d7eadc;
  padding: 14px var(--tr-gutter);
  display: flex; flex-wrap: wrap; gap: 8px 18px;
  justify-content: space-between; align-items: center;
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
}
.footer strong { color: #fff; letter-spacing: 0.02em; text-transform: none; font-size: 12px; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: var(--tr-bottom-nav);
  background: var(--tr-forest-900);
  display: flex; justify-content: space-around; align-items: center;
  padding: 0 6px env(safe-area-inset-bottom);
  z-index: 40;
  background-image: repeating-linear-gradient(102deg, #4be07a14 0 2px, transparent 2px 22px);
}
.bottom-nav a { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 8px; }
.bottom-nav a.active { background: var(--tr-neon); color: var(--tr-forest-900); }
@media (min-width: 960px) { .bottom-nav { display: none; } }

.mobile-brand {
  display: flex; align-items: center; gap: 8px;
  padding: 10px var(--tr-gutter);
  background: var(--tr-forest-900);
  color: #eef6ef;
}
.mobile-brand img { height: 16px; width: auto; }
@media (min-width: 960px) { .mobile-brand { display: none; } }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin: 8px 0 12px;
}
.section-head h2 { margin: 0; font-family: var(--font-display); font-size: 1.2rem; }

.icon-nav { width: 16px; height: 16px; flex: 0 0 16px; opacity: 0.9; }

.empty { padding: 16px; color: var(--tr-muted); font-size: 14px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; }
.chip {
  background: var(--tr-surface-alt); border-radius: 999px; padding: 6px 10px;
  font-size: 13px;
}
.chip b { font-variant-numeric: tabular-nums; }

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

/* Visual polish after first layout pass */
.record-card .holder, .record-card strong { overflow-wrap: anywhere; }
.sheet-table td, .sheet-table th { white-space: nowrap; }
.sheet-table td:nth-child(3) { white-space: normal; min-width: 120px; }
.section-head { align-items: center; }
.person { flex-direction: row; align-items: flex-start; }
.person .avatar { flex: 0 0 44px; }
.footer { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
ul { margin: 8px 0 0; padding-left: 18px; }
.toggle button { font-size: 13px; }
@media (max-width: 619px) {
  .roster { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 72px 1fr; }
}

/* Mobile-first result / history / dive-attempt cards */
.result-cards, .history-cards, .attempt-cards { display: grid; gap: 10px; }
.result-card, .history-card, .attempt-card {
  background: var(--tr-sheet);
  border-radius: 14px;
  padding: 12px 14px;
}
.result-card {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  align-items: start;
}
.result-card .place, .history-card .score, .attempt-card .awarded {
  font-family: var(--font-display);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.result-card .place { font-size: 1.25rem; padding-top: 2px; }
.result-card .total { font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.result-card .who-name, .history-card .meet-name { font-weight: 700; color: var(--tr-text); }
.history-card { display: grid; gap: 4px; }
.history-card .row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.history-card .score { font-size: 1.2rem; }
.attempt-card { display: grid; gap: 6px; }
.attempt-card .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.attempt-card .dive-id { font-weight: 700; }
.attempt-card .awarded { font-size: 1.15rem; }
.attempt-card .judges { flex-wrap: wrap; }
.desktop-only { display: none; }
.mobile-only { display: block; }

@media (min-width: 800px) {
  .desktop-only { display: block; }
  .mobile-only { display: none; }
  .result-cards, .history-cards, .attempt-cards { display: none; }
}
@media (max-width: 799px) {
  .table-wrap.desktop-only { display: none; }
}

/* Long record attributions stay readable */
.record-card strong { display: block; }
.record-card .holder-note { margin: 4px 0 0; }

/* Keep footer clear of the mobile tab bar */
@media (max-width: 959px) {
  .footer { margin-bottom: 0; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .main { padding-bottom: calc(var(--tr-bottom-nav) + 24px); }
}
