/* ==========================================================================
   Ryder Cup App — styles
   iPhone-first: ~390px target, safe-area aware, tabular nums.
   ========================================================================== */

:root {
  --bg: #F2F0EB;
  --surface: #FFFFFF;
  --surface-2: #FAF8F3;
  --surface-3: #F0EDE5;
  --primary: #0F3D1E;
  --primary-2: #1B5E20;
  --accent: #2E7D32;
  --thunder: #0E4A84;
  --thunder-dk: #072E55;
  --lightning: #B3261E;
  --lightning-dk: #7C140E;
  --ink: #16181A;
  --ink-2: #5B6166;
  --ink-3: #8A8F94;
  --divider: #E8E5DE;
  --divider-2: #F0EDE5;
  --gold: #B8860B;
  --silver: #8C8F93;
  --bronze: #8B5A2B;
  --danger: #B3261E;
  --good: #1B5E20;
  --warn: #C77700;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow: 0 1px 2px rgba(20,30,20,.05), 0 4px 14px rgba(20,30,20,.06);
  --shadow-lg: 0 2px 4px rgba(20,30,20,.07), 0 10px 26px rgba(20,30,20,.09);
  --tap: 44px;
  --tab-h: calc(58px + env(safe-area-inset-bottom));
  --header-h: calc(54px + env(safe-area-inset-top));
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body { min-height: 100vh; overscroll-behavior-y: contain; }
button { font-family: inherit; font-size: inherit; color: inherit; background: none; border: none; cursor: pointer; padding: 0; }
input, textarea, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* App shell --------------------------------------------------------------- */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
}

.header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: calc(env(safe-area-inset-top) + 10px) 12px 10px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--header-h);
}
.header .back, .header .action {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.12);
  flex-shrink: 0;
}
.header .back:active, .header .action:active { background: rgba(255,255,255,.24); }
.header h1 {
  flex: 1;
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-align: center;
}
.header .sub {
  font-size: 12px;
  opacity: .75;
  font-weight: 500;
  margin-top: 1px;
}
.header-spacer { width: 36px; height: 36px; flex-shrink: 0; }

.view {
  padding: 0 14px calc(var(--tab-h) + 24px);
  min-height: calc(100vh - var(--header-h));
}
.view-enter { animation: enter 200ms ease-out both; }
@keyframes enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* Tab bar ----------------------------------------------------------------- */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-width: 480px;
  margin: 0 auto;
  height: var(--tab-h);
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--divider);
  display: flex;
  z-index: 30;
}
.tabbar button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 600;
  min-height: var(--tap);
}
.tabbar button.active { color: var(--primary-2); }
.tabbar button svg { width: 22px; height: 22px; }

/* Typography helpers ------------------------------------------------------ */
.section-title {
  margin: 22px 4px 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.section-title .action-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-2);
  text-transform: none;
  letter-spacing: 0;
}
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.muted { color: var(--ink-2); }
.tiny { font-size: 11px; color: var(--ink-3); }

/* Chips ------------------------------------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  background: var(--surface-2);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-2);
}
.chip.live {
  background: #FFE8E2;
  color: var(--danger);
}
.chip.live::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--danger);
  animation: pulse 1.4s infinite;
}
.chip.thunder { background: rgba(14,74,132,.1); color: var(--thunder); }
.chip.lightning { background: rgba(179,38,30,.1); color: var(--lightning); }
.chip.good { background: #E3F2E6; color: var(--good); }
.chip.warn { background: #FFF3E0; color: var(--warn); }
@keyframes pulse {
  0%,100% { opacity: .4; }
  50% { opacity: 1; }
}

/* You badge --------------------------------------------------------------- */
.you-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  background: var(--primary);
  color: #fff;
  border-radius: 999px;
  margin-left: 6px;
  letter-spacing: 0.03em;
  vertical-align: 1px;
}

/* Card base --------------------------------------------------------------- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card + .card { margin-top: 10px; }
.card-pad { padding: 14px; }

/* Cup hero ---------------------------------------------------------------- */
.cup-hero {
  background: linear-gradient(135deg, var(--primary) 0%, #1B5E20 60%, #2E7D32 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 14px;
  position: relative;
  overflow: hidden;
}
.cup-hero::after {
  content: "";
  position: absolute;
  right: -40px; top: -40px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.15), transparent 70%);
}
.cup-hero .eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: .7;
}
.cup-hero h2 {
  margin: 4px 0 12px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.cup-scoreboard {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}
.cup-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}
.cup-team.a { align-items: flex-start; }
.cup-team.b { align-items: flex-end; }
.cup-team .name { font-size: 13px; font-weight: 700; opacity: .9; }
.cup-team .score {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.cup-vs {
  font-size: 13px;
  font-weight: 700;
  opacity: .6;
  letter-spacing: 0.1em;
}

.cup-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 14px;
  background: rgba(255,255,255,.15);
  position: relative;
}
.cup-bar .a { background: var(--thunder); }
.cup-bar .b { background: var(--lightning); }
.cup-bar .pending { background: rgba(255,255,255,.15); }
.cup-bar .target {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  background: #fff;
  opacity: .5;
}
.cup-caption {
  text-align: center;
  font-size: 11px;
  opacity: .7;
  margin-top: 6px;
  font-weight: 600;
}

.cup-context {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* Leader card (team, player, etc.) --------------------------------------- */
.leader-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  min-height: 62px;
  cursor: pointer;
}
.leader-card:active { background: var(--surface-2); }
.leader-card .rank {
  width: 22px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.leader-card.rank-1 .rank { color: var(--gold); }
.leader-card.rank-2 .rank { color: var(--silver); }
.leader-card.rank-3 .rank { color: var(--bronze); }
.leader-card .stripe {
  width: 4px;
  align-self: stretch;
  border-radius: 2px;
}
.leader-card .info { flex: 1; min-width: 0; }
.leader-card .name {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.leader-card .meta {
  color: var(--ink-2);
  font-size: 12px;
  margin-top: 2px;
}
.leader-card .score {
  text-align: right;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.leader-card .total {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.leader-card .sub {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-2);
}
.chevron {
  color: var(--ink-3);
  font-size: 20px;
  margin-left: 2px;
  flex-shrink: 0;
}

/* Buttons ----------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 16px;
  min-height: var(--tap);
  font-weight: 600;
  font-size: 15px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow);
  transition: transform 80ms;
}
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(15,61,30,.25);
}
.btn.primary:active { background: var(--primary-2); }
.btn.danger { color: var(--danger); }
.btn.full { width: 100%; }
.btn.small { min-height: 36px; font-size: 13px; padding: 0 12px; }

/* Segmented control ------------------------------------------------------- */
.segmented {
  display: flex;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 3px;
  margin: 14px 0 10px;
}
.segmented button {
  flex: 1;
  padding: 7px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  border-radius: 8px;
  min-height: 36px;
}
.segmented button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

/* Avatar ------------------------------------------------------------------ */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
}
.avatar.xl { width: 72px; height: 72px; font-size: 26px; }
.avatar.lg { width: 52px; height: 52px; font-size: 18px; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }

/* Player row -------------------------------------------------------------- */
.player-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  min-height: 58px;
  cursor: pointer;
  border-top: 1px solid var(--divider);
}
.player-row:first-child { border-top: none; }
.player-row:active { background: var(--surface-2); }
.player-row .info { flex: 1; min-width: 0; }
.player-row .name { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-row .meta { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.player-row .score { text-align: right; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.player-row .score .total { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.player-row .score .sub { font-size: 11px; color: var(--ink-2); font-weight: 600; }

/* Detail hero (team, player, match) -------------------------------------- */
.detail-hero {
  padding: 16px;
  color: #fff;
  border-radius: var(--radius);
  margin-top: 14px;
  position: relative;
  overflow: hidden;
}
.detail-hero::after {
  content: "";
  position: absolute;
  right: -50px; top: -50px;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.15), transparent 70%);
}
.detail-hero .eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: .7;
}
.detail-hero .title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 2px;
}
.detail-hero .sub {
  font-size: 13px;
  opacity: .8;
  margin-top: 4px;
}
.detail-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
  position: relative;
  z-index: 1;
}
.detail-stats .stat {
  background: rgba(255,255,255,.14);
  border-radius: 10px;
  padding: 8px 10px;
}
.detail-stats .stat .label { font-size: 10px; opacity: .75; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.detail-stats .stat .val { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.detail-stats .stat .val.small { font-size: 13px; }

/* Match card (list view) ------------------------------------------------- */
.match-card {
  padding: 12px 14px;
  cursor: pointer;
  position: relative;
}
.match-card:active { background: var(--surface-2); }
.match-card .head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.match-card .format-tag {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--ink-2);
}
.match-card .status-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.match-card .status-tag.live { background: #FFE8E2; color: var(--danger); }
.match-card .status-tag.complete { background: #E3F2E6; color: var(--good); }
.match-card .status-tag.pending { background: var(--surface-3); color: var(--ink-3); }
.match-card .sides {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}
.match-card .side {
  min-width: 0;
}
.match-card .side.left { text-align: left; }
.match-card .side.right { text-align: right; }
.match-card .side .team {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.match-card .side.winner .names { font-weight: 700; }
.match-card .side.loser .names { color: var(--ink-2); }
.match-card .side .names {
  font-size: 14px;
  margin-top: 3px;
  font-weight: 600;
  line-height: 1.25;
}
.match-card .middle {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  padding: 4px 8px;
  background: var(--surface-3);
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
  min-width: 46px;
  text-align: center;
}
.match-card .middle.result { color: var(--ink); background: var(--surface-2); }

/* Match hole grid --------------------------------------------------------- */
.match-grid {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px;
  margin-top: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.match-grid table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}
.match-grid th, .match-grid td {
  padding: 6px 4px;
  text-align: center;
  border-bottom: 1px solid var(--divider);
  min-width: 28px;
}
.match-grid th {
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.match-grid .lbl {
  text-align: left;
  padding-left: 8px;
  font-weight: 600;
  font-size: 11px;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-width: 64px;
}
.match-grid .tot { font-weight: 700; background: var(--surface-2); }
.match-grid td.win { color: var(--good); font-weight: 700; }
.match-grid td.lose { color: var(--ink-3); }
.match-grid td.tie { color: var(--ink-2); }
.match-grid tr.status-row td { font-size: 10px; font-weight: 700; color: var(--ink-2); padding: 4px; }
.match-grid tr.status-row td.a-lead { color: var(--thunder); }
.match-grid tr.status-row td.b-lead { color: var(--lightning); }

/* Scorecard (individual) ------------------------------------------------- */
.scorecard {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
  margin-top: 10px;
}
.scorecard h3 {
  margin: 2px 2px 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
}
.card-grid {
  display: grid;
  grid-template-columns: 48px repeat(9, 1fr) 36px;
  gap: 1px;
  background: var(--divider);
  border-radius: 8px;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}
.card-grid > div {
  background: var(--surface);
  padding: 6px 2px;
  text-align: center;
  font-size: 13px;
}
.card-grid .label {
  text-align: left;
  padding-left: 8px;
  font-weight: 600;
  font-size: 10px;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--surface-2);
}
.card-grid .total {
  font-weight: 700;
  background: var(--surface-2);
}
.card-grid .par-row > div { color: var(--ink-2); font-weight: 500; }
.card-grid .score-row > div { font-weight: 700; font-size: 15px; position: relative; }
.card-grid .s-eagle { color: #fff !important; background: #D32F2F !important; }
.card-grid .s-birdie { color: var(--danger); }
.card-grid .s-birdie::after {
  content: ""; position: absolute; inset: 3px; border: 1.5px solid var(--danger); border-radius: 50%; pointer-events: none;
}
.card-grid .s-bogey::after {
  content: ""; position: absolute; inset: 5px; border: 1.5px solid var(--ink); pointer-events: none;
}
.card-grid .s-double { color: var(--ink-2); }
.card-grid .s-double::after {
  content: ""; position: absolute; inset: 3px; border: 1.5px solid var(--ink-2); pointer-events: none;
}
.card-grid .s-double::before {
  content: ""; position: absolute; inset: 7px; border: 1.5px solid var(--ink-2); pointer-events: none;
}
.card-grid .s-empty { color: var(--ink-3); }

/* Score entry ------------------------------------------------------------- */
.hole-stepper {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.hole-stepper button {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
}
.hole-stepper button:disabled { color: var(--ink-3); opacity: .5; }
.hole-stepper .middle { flex: 1; text-align: center; }
.hole-stepper .hole {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.hole-stepper .par {
  font-size: 12px;
  color: var(--ink-2);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.score-pad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 14px;
}
.score-pad button {
  height: 58px;
  background: var(--surface);
  border-radius: 12px;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.score-pad button.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(15,61,30,.35);
}
.score-pad button .tag {
  display: block;
  font-size: 10px;
  font-weight: 600;
  opacity: .7;
  margin-top: 2px;
}

/* Player picker (horizontal scroll) -------------------------------------- */
.player-picker {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0;
  margin: 6px -2px 0;
  scrollbar-width: none;
}
.player-picker::-webkit-scrollbar { display: none; }
.player-picker .chip-btn {
  flex-shrink: 0;
  padding: 8px 12px;
  min-height: 40px;
  background: var(--surface);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.player-picker .chip-btn.active { background: var(--primary); color: #fff; }
.player-picker .chip-btn .dot { width: 8px; height: 8px; border-radius: 50%; }

/* Skins board ------------------------------------------------------------- */
.skins-board {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px;
  margin-top: 10px;
  overflow-x: auto;
}
.skins-row {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 3px;
  margin-top: 4px;
}
.skins-hole {
  aspect-ratio: 1;
  border-radius: 6px;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  position: relative;
}
.skins-hole.carry { background: #FFF3E0; color: var(--warn); }
.skins-hole.won { background: var(--primary); color: #fff; }
.skins-hole.won.thunder { background: var(--thunder); }
.skins-hole.won.lightning { background: var(--lightning); }
.skins-hole .h { font-size: 9px; opacity: .7; }
.skins-hole .v { font-weight: 700; font-size: 14px; }
.skins-hole .carry-val { font-size: 9px; font-weight: 700; margin-top: 1px; }

/* Chat -------------------------------------------------------------------- */
.chat-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.chat-msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  max-width: 85%;
}
.chat-msg.me { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg .bubble {
  padding: 8px 12px;
  background: var(--surface);
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.35;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
  word-wrap: break-word;
}
.chat-msg.me .bubble {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg:not(.me) .bubble { border-bottom-left-radius: 4px; }
.chat-msg .sender {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-2);
  margin-bottom: 2px;
}
.chat-msg .ts {
  font-size: 10px;
  color: var(--ink-3);
  margin-top: 2px;
}
.chat-composer {
  position: sticky;
  bottom: calc(var(--tab-h) + 8px);
  display: flex;
  gap: 8px;
  background: var(--bg);
  padding: 8px 0;
  margin-top: 12px;
}
.chat-composer textarea {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  resize: none;
  padding: 10px 12px;
  border-radius: 20px;
  border: 1px solid var(--divider);
  background: var(--surface);
  font-size: 14px;
  color: var(--ink);
  line-height: 1.35;
}
.chat-composer textarea:focus { outline: none; border-color: var(--primary-2); }
.chat-composer button {
  background: var(--primary);
  color: #fff;
  border-radius: 20px;
  padding: 0 16px;
  font-weight: 700;
  min-height: 40px;
  flex-shrink: 0;
}

/* Drinks ------------------------------------------------------------------ */
.drink-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--divider);
}
.drink-row:first-child { border-top: none; }
.drink-row .info { flex: 1; min-width: 0; }
.drink-row .info .name { font-weight: 600; font-size: 14px; }
.drink-row .info .meta { font-size: 11px; color: var(--ink-2); }
.drink-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.drink-controls button {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  display: flex; align-items: center; justify-content: center;
}
.drink-controls .count {
  min-width: 24px;
  text-align: center;
  font-weight: 700;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

/* Weather ----------------------------------------------------------------- */
.weather-card {
  padding: 14px;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 12px;
}
.weather-card .icon {
  font-size: 32px;
  line-height: 1;
}
.weather-card .day {
  font-size: 15px;
  font-weight: 700;
}
.weather-card .details {
  font-size: 12px;
  color: var(--ink-2);
  margin-top: 2px;
}
.weather-card .temps {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.weather-card .temps .hi {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.weather-card .temps .lo {
  font-size: 12px;
  color: var(--ink-2);
  font-weight: 600;
}

/* Highlight cards --------------------------------------------------------- */
.hl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}
.hl-tile {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
  display: flex;
  flex-direction: column;
  min-height: 100px;
}
.hl-tile .hl-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-2);
}
.hl-tile .hl-value {
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  margin-top: 4px;
}
.hl-tile .hl-player {
  font-size: 13px;
  font-weight: 600;
  margin-top: 2px;
}
.hl-tile .hl-sub {
  font-size: 11px;
  color: var(--ink-2);
  margin-top: auto;
  padding-top: 6px;
}
.hl-tile.good .hl-value { color: var(--good); }
.hl-tile.bad .hl-value { color: var(--danger); }

/* Handicap history chart ------------------------------------------------- */
.hcp-chart {
  padding: 14px;
}
.hcp-chart svg { width: 100%; height: 100px; }
.hcp-chart .axis-year {
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  margin-top: 6px;
  font-size: 10px;
  color: var(--ink-3);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Profile page ------------------------------------------------------------ */
.profile-hero {
  padding: 18px 16px;
  margin-top: 14px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}
.profile-hero .avatar { margin: 0 auto 10px; }
.profile-hero .name { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.profile-hero .nick { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.profile-hero .bio { font-size: 13px; color: var(--ink); margin: 10px 6px 0; line-height: 1.4; }

.kv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px;
}
.kv-tile {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 8px 10px;
}
.kv-tile .k { font-size: 10px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.05em; }
.kv-tile .v { font-size: 16px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* Year card (history) ----------------------------------------------------- */
.year-card {
  padding: 14px;
  cursor: pointer;
}
.year-card .yr {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.year-card .champ {
  font-size: 14px;
  font-weight: 700;
  margin-top: 2px;
}
.year-card .notes {
  font-size: 12px;
  color: var(--ink-2);
  margin-top: 4px;
  line-height: 1.35;
}

/* Notification row -------------------------------------------------------- */
.notif-row {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--divider);
}
.notif-row:first-child { border-top: none; }
.notif-row .icon-wrap {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.notif-row .body { flex: 1; min-width: 0; }
.notif-row .title { font-size: 14px; font-weight: 600; }
.notif-row .msg { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.notif-row .ts { font-size: 10px; color: var(--ink-3); margin-top: 4px; }

/* Selector (dropdown in profile) ----------------------------------------- */
.switch-user {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.switch-user label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.switch-user select {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--divider);
  background: var(--surface-2);
  color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
}

/* Empty state ------------------------------------------------------------- */
.empty-state {
  text-align: center;
  color: var(--ink-2);
  padding: 40px 20px;
  font-size: 14px;
}

/* Toast ------------------------------------------------------------------- */
.toast {
  position: fixed;
  bottom: calc(var(--tab-h) + 16px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 22px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(0,0,0,.2);
  z-index: 40;
  animation: toast-in 180ms ease-out;
}
.toast.error { background: var(--danger); }
.toast.warn { background: var(--warn); }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* Banner ------------------------------------------------------------------ */
.banner {
  padding: 8px 12px;
  margin: 10px 0 0;
  background: var(--surface-3);
  border-radius: 8px;
  font-size: 12px;
  color: var(--ink-2);
  display: flex;
  gap: 8px;
  align-items: center;
}
.banner.offline { background: #FFF3E0; color: var(--warn); }
