  :root {
    --bg: #0a0f0d;
    --surface: #111a15;
    --surface2: #1a2820;
    --border: #2a3d30;
    --green: #3DDC6E;
    --green-dim: #2AAA50;
    --green-glow: rgba(61,220,110,0.12);
    --gold: #F0C040;
    --red: #ff5252;
    --text: #e8f0eb;
    --text-dim: #7a9a82;
    --text-muted: #4a6450;
    --radius: 8px;
  }

  * { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

  body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
  }

  /* ── HEADER ── */
  header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(10,15,13,0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0 16px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .logo {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 20px;
    letter-spacing: 2px;
    color: var(--green);
    line-height: 1;
    flex-shrink: 0;
  }

  .logo span {
    display: block;
    font-size: 9px;
    letter-spacing: 3px;
    color: var(--text-muted);
    font-family: 'DM Mono', monospace;
    margin-top: 1px;
  }

  nav {
    display: flex;
    gap: 2px;
    flex-wrap: nowrap;
  }

  nav button {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
  }

  nav button:hover { color: var(--text); background: var(--surface); }
  nav button.active { color: var(--green); background: var(--green-glow); }

  /* Tag Matches / Side Matches toggle on the home screen — styled like nav button above */
  .splash-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 14px;
  }

  .splash-tab-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    padding: 10px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
  }

  .splash-tab-btn:hover { color: var(--text); background: var(--surface); }
  .splash-tab-btn.active { color: var(--green); background: var(--green-glow); }

  .header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }

  .user-pill {
    font-size: 11px;
    color: var(--text-muted);
    font-family: 'DM Mono', monospace;
    white-space: nowrap;
  }

  /* ── MAIN ── */
  main {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 14px 80px;
  }

  .page { display: none; }
  .page.active { display: block; }

  /* ── BUTTONS ── */
  .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius);
    border: none;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
  }

  .btn-primary { background: var(--green); color: #0a0f0d; }
  .btn-primary:hover { background: #4aee7e; }
  .btn-primary:active { transform: scale(0.97); }
  .btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
  .btn-secondary:hover { border-color: var(--green); color: var(--green); }
  .btn-danger { background: rgba(255,82,82,0.1); color: var(--red); border: 1px solid rgba(255,82,82,0.2); }
  .btn-gold { background: var(--gold); color: #0a0f0d; }
  .btn-sm { padding: 5px 10px; font-size: 12px; }
  .btn-full { width: 100%; justify-content: center; }

  /* ── FORMS ── */
  .form-row { margin-bottom: 14px; }

  label {
    display: block;
    font-size: 10px;
    font-family: 'DM Mono', monospace;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 5px;
  }

  input, select, textarea {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
    -webkit-appearance: none;
  }

  input:focus, select:focus { border-color: var(--green); }
  select option { background: var(--surface2); }

  /* ── CARDS ── */
  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 14px;
  }

  .card-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 18px;
    letter-spacing: 1.5px;
    color: var(--text);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
  }

  /* ── SECTION HEADER ── */
  .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .section-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 28px;
    letter-spacing: 2px;
    color: var(--text);
  }

  .section-title span { color: var(--green); }

  /* ── SPLASH ── */
  .splash-hero {
    background: linear-gradient(135deg, var(--surface) 0%, var(--bg) 100%);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
  }

  .splash-hero::after {
    content: '🥏';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 50px;
    opacity: 0.08;
  }

  .splash-hero h1 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 36px;
    letter-spacing: 3px;
    color: var(--green);
    line-height: 1;
  }

  .splash-hero .sub {
    color: var(--text-muted);
    font-size: 11px;
    letter-spacing: 3px;
    font-family: 'DM Mono', monospace;
    margin-top: 4px;
  }

  /* ── EVENT CARDS ── */
  .event-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 10px;
    transition: border-color 0.2s;
  }

  .event-card.today { border-color: var(--green); background: linear-gradient(135deg, var(--surface), rgba(61,220,110,0.04)); }
  .event-card.cancelled { opacity: 0.5; }

  .badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.5px;
    padding: 2px 7px;
    border-radius: 4px;
    margin-bottom: 8px;
    font-family: 'DM Mono', monospace;
  }

  .badge-green { background: var(--green); color: #0a0f0d; }
  .badge-red { background: var(--red); color: white; }

  .event-title { font-weight: 600; font-size: 15px; margin-bottom: 6px; }
  .event-title.cancelled-text { text-decoration: line-through; color: var(--text-muted); }

  .event-meta { font-size: 12px; color: var(--text-dim); line-height: 1.8; font-family: 'DM Mono', monospace; }
  .event-meta strong { color: var(--green); }

  /* ── NOTES ── */
  .notes-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--gold);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-top: 16px;
  }

  .notes-section h3 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 16px;
    letter-spacing: 2px;
    color: var(--gold);
    margin-bottom: 10px;
  }

  .note-item {
    display: flex;
    gap: 8px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.5;
  }

  .note-item:last-child { border-bottom: none; }
  .note-item::before { content: '›'; color: var(--gold); font-size: 16px; line-height: 1.3; flex-shrink: 0; }
  .note-item.draggable::before { display: none; }
  .drag-handle {
    cursor: grab; color: var(--text-muted); font-size: 20px; padding: 0 6px 0 2px;
    flex-shrink: 0; user-select: none; line-height: 1; opacity: 0.45; touch-action: none;
    font-family: serif; letter-spacing: -1px;
  }
  .drag-handle:active { cursor: grabbing; opacity: 0.9; }
  .note-edit-btn, .note-del-btn {
    background: none; border: none; cursor: pointer; font-size: 13px;
    padding: 2px 5px; opacity: 0; transition: opacity 0.2s; flex-shrink: 0; color: var(--text);
  }
  .note-item:hover .note-edit-btn,
  .note-item:hover .note-del-btn { opacity: 0.55; }
  .note-edit-btn:hover, .note-del-btn:hover { opacity: 1 !important; }
  /* Touch devices: always show edit/delete — no hover available */
  @media (hover: none) {
    .note-edit-btn, .note-del-btn { opacity: 0.6; }
  }
  .note-item { align-items: center; }
  /* ── Event card inner: flex row, weather on the right ── */
  .event-card-inner {
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: flex-start;
  }
  .event-card-left {
    min-width: 0;
    flex-shrink: 0;
  }
  .event-weather-wrapper {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding-right: 70px;
  }

  /* ── Weather bar ── */
  .event-weather-bar {
    display: none;
    width: 320px;
    flex-shrink: 0;
    margin-top: 0;
    background: linear-gradient(160deg, #1a2820 0%, #111a15 55%, #0a1210 100%);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    font-family: 'Barlow Condensed', sans-serif;
    letter-spacing: 0.5px;
  }
  @media (max-width: 640px) {
    .event-card-inner { flex-direction: column; }
    .event-weather-bar { width: 100%; }
  }
  /* iPhone landscape — height < 500px: stack weather below event info */
  @media (max-height: 500px) and (orientation: landscape) {
    .event-card-inner { flex-direction: column; }
    .event-weather-bar { width: 100%; }
    .card { padding: 10px 12px; }
    nav { gap: 0; }
    nav button { padding: 8px 6px; font-size: 10px; }
    .page { padding-top: 4px; }
  }
  /* Body: left panel + hourly columns */
  .ewb-body { display: flex; align-items: stretch; }

  /* LEFT: event-start forecast */
  .ewb-left {
    min-width: 130px;
    max-width: 140px;
    padding: 10px 12px 10px 14px;
    border-right: 1px solid rgba(255,255,255,0.07);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
  }
  .ewb-left .ewb-datetime {
    font-size: 10px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.35);
    margin-bottom: 4px;
  }
  .ewb-left .ewb-main {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .ewb-left .ewb-icon { font-size: 24px; line-height: 1; filter: drop-shadow(0 1px 6px rgba(255,255,255,0.15)); }
  .ewb-left .ewb-temp { font-family:'Bebas Neue',sans-serif; font-size:26px; color:#fff; line-height:1; letter-spacing:2px; }
  .ewb-left .ewb-hilo { font-size:11px; color:rgba(61,220,110,0.45); margin-top:2px; }
  .ewb-left .ewb-wind { font-size:11px; color:rgba(61,220,110,0.6); margin-top:4px; display:flex; align-items:center; gap:4px; }
  .ewb-left .ewb-arrow { font-size:15px; color:#2AAA50; }
  .ewb-left .ewb-cond  { font-size:10px; color:rgba(255,255,255,0.25); margin-top:3px; letter-spacing:1px; text-transform:uppercase; }

  /* RIGHT: 5 hourly columns */
  .ewb-hours { display:flex; flex:1; }
  .ewb-hour {
    flex:1;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    padding:8px 3px;
    border-left:1px solid rgba(255,255,255,0.05);
    gap:3px;
    transition: background 0.2s;
  }
  .ewb-hour.event-time {
    background: rgba(61,220,110,0.06);
    border-left-color: rgba(61,220,110,0.2);
  }
  .ewb-hour .ewb-htime  { font-size:10px; letter-spacing:1px; color:rgba(255,255,255,0.3); text-transform:uppercase; }
  .ewb-hour.event-time .ewb-htime { color:rgba(61,220,110,0.7); }
  .ewb-hour .ewb-hicon  { font-size:20px; line-height:1; }
  .ewb-hour .ewb-htemp  { font-size:13px; color:#fff; font-weight:600; }
  .ewb-hour .ewb-harrow { font-size:12px; color:#2AAA50; line-height:1; }
  .ewb-hour .ewb-hwind  { font-size:10px; color:rgba(61,220,110,0.35); }

  /* Narrow phones: 5 hourly columns (64px each) + the 130px left panel overflow
     past the screen edge. Trim to 3 columns -- event hour plus one on each
     side, per hourOffsets = [-1,0,1,2,3] in weather.js where the event hour is
     the 2nd column -- and stop reserving 70px of dead space on the right.
     Placed after the base .ewb-hour/.ewb-hours rules above so it actually wins
     the cascade at equal specificity instead of being overridden by them. */
  @media (max-width: 480px) {
    .event-weather-wrapper { padding-right: 0; }
    .ewb-hour:nth-child(4), .ewb-hour:nth-child(5) { display: none; }
  }
  /* Smallest phones: drop the hourly columns entirely, left panel only. */
  @media (max-width: 380px) {
    .ewb-hours { display: none; }
  }

  /* ── TAG LEDGER ── */
  .search-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 9px 12px;
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    width: 100%;
    outline: none;
    transition: border-color 0.2s;
    margin-bottom: 12px;
  }

  .search-box:focus { border-color: var(--green); }

  .tag-list { display: flex; flex-direction: column; gap: 6px; }

  .tag-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.15s;
  }

  .tag-row:hover { border-color: var(--green-dim); }

  .tag-num {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 24px;
    min-width: 44px;
    letter-spacing: 1px;
  }

  .tag-num.t1 { color: var(--gold); text-shadow: 0 0 10px rgba(240,192,64,0.4); }
  .tag-num.t2 { color: #c0d0c8; }
  .tag-num.t3 { color: #cd7f32; }
  .tag-num.top { color: var(--green); }
  .tag-num.mid { color: var(--text-dim); }
  .tag-num.low { color: var(--text-muted); }

  .tag-info { flex: 1; }
  .tag-name { font-weight: 500; font-size: 14px; }
  .tag-pdga { font-size: 11px; color: var(--text-muted); font-family: 'DM Mono', monospace; }

  .tag-change {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
  }

  .change-up { background: rgba(61,220,110,0.12); color: var(--green); }
  .change-down { background: rgba(255,82,82,0.12); color: var(--red); }
  .change-same { color: var(--text-muted); }

  /* ── MATCH FLOW ── */
  .step-indicator {
    display: flex;
    gap: 6px;
    margin-bottom: 18px;
  }

  .step-dot {
    height: 3px;
    flex: 1;
    border-radius: 2px;
    background: var(--border);
    transition: background 0.3s;
  }

  .step-dot.active { background: var(--green); }
  .step-dot.done { background: var(--green-dim); }

  .registrant-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--surface2);
    border-radius: var(--radius);
    margin-bottom: 6px;
  }

  .reg-tag {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 22px;
    color: var(--green);
    min-width: 38px;
  }

  .reg-name { flex: 1; font-size: 14px; font-weight: 500; }
.score-status-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface2); border-radius: var(--radius); margin-bottom: 6px; }
.score-badge-done { font-size: 18px; flex-shrink: 0; }
.score-badge-pending { font-size: 18px; flex-shrink: 0; opacity: 0.5; }
.score-done-val { font-family: 'DM Mono', monospace; font-size: 15px; color: var(--green); font-weight: 600; }
.score-pending-input { width: 80px !important; text-align: center; font-family: 'DM Mono', monospace; font-size: 16px; padding: 8px !important; }

  .score-input {
    width: 72px;
    text-align: center;
    font-family: 'DM Mono', monospace;
    font-size: 16px;
    padding: 8px;
  }

  /* ── RESULTS ── */
  .result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    flex-wrap: wrap;
  }

  .finish-num {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 26px;
    min-width: 30px;
    color: var(--text-muted);
  }

  .finish-num.f1 { color: var(--gold); }
  .finish-num.f2 { color: #c0d0c8; }
  .finish-num.f3 { color: #cd7f32; }

  .result-name { flex: 1; font-weight: 500; font-size: 14px; }

  .tag-arrow { font-size: 16px; color: var(--text-muted); }
  .tag-arrow.better { color: var(--green); }
  .tag-arrow.worse { color: var(--red); }

  .new-tag {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 22px;
  }

  .new-tag.better { color: var(--green); }
  .new-tag.worse { color: var(--red); }
  .new-tag.same { color: var(--text-muted); }

  /* ── ADMIN ── */
  .stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 18px;
  }

  .stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
  }

  .stat-val {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 36px;
    color: var(--green);
    line-height: 1;
  }

  .stat-lbl {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 1px;
    font-family: 'DM Mono', monospace;
    margin-top: 3px;
  }

  .admin-section { margin-bottom: 22px; }

  .admin-section h3 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 16px;
    letter-spacing: 2px;
    color: var(--text-dim);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
  }

  .list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 6px;
    gap: 8px;
    flex-wrap: wrap;
  }

  .list-item-info { display: flex; flex-direction: column; gap: 2px; }
  .list-item-name { font-weight: 500; font-size: 14px; }
  .list-item-meta { font-size: 11px; color: var(--text-muted); font-family: 'DM Mono', monospace; }

  .role-badge {
    font-size: 10px;
    font-family: 'DM Mono', monospace;
    letter-spacing: 1px;
    padding: 2px 8px;
    border-radius: 20px;
  }

  .role-god { background: rgba(240,192,64,0.12); color: var(--gold); border: 1px solid rgba(240,192,64,0.25); }
  .role-admin { background: var(--green-glow); color: var(--green); border: 1px solid rgba(61,220,110,0.25); }
  .role-scorer { background: rgba(100,150,200,0.08); color: #7ab0e0; border: 1px solid rgba(100,150,200,0.2); }
  .role-demigod { background: rgba(240,192,64,0.06); color: #e0b050; border: 1px dashed rgba(240,192,64,0.35); }
  .role-player { background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); }

  /* ── MODAL ── */
  .modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    z-index: 200;
    align-items: flex-end;
    justify-content: center;
    backdrop-filter: blur(4px);
    padding: 0;
  }

  .modal-overlay.open { display: flex; }

  .modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px 14px 0 0;
    padding: 24px 20px 32px;
    width: 100%;
    max-width: 600px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
  }

  .modal h2 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 24px;
    letter-spacing: 2px;
    color: var(--green);
    margin-bottom: 16px;
  }

  .modal-handle {
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0 auto 16px;
  }

  .modal-actions { display: flex; gap: 10px; margin-top: 16px; }

  /* ── TOAST ── */
  .toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--green);
    color: #0a0f0d;
    padding: 11px 22px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 13px;
    z-index: 300;
    transition: transform 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 4px 20px rgba(61,220,110,0.3);
  }

  .toast.show { transform: translateX(-50%) translateY(0); }
  .toast.error { background: var(--red); box-shadow: 0 4px 20px rgba(255,82,82,0.3); }

  /* ── LOADING ── */
  .loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted);
    font-family: 'DM Mono', monospace;
    font-size: 13px;
    gap: 10px;
  }

  .spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--green);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
  }

  @keyframes spin { to { transform: rotate(360deg); } }
@keyframes rainDrift { 0% { transform: translate(0, -4px) rotate(15deg); opacity: 0; } 50% { opacity: 1; } 100% { transform: translate(3px, 4px) rotate(15deg); opacity: 0; } } .rain-drop { display: inline-block; color: #6ab0d4; animation: rainDrift 0.8s ease-in infinite; font-size: 0.65em; letter-spacing: -1px; } .rain-drop:nth-child(2) { animation-delay: 0.25s; } .rain-drop:nth-child(3) { animation-delay: 0.5s; }

  /* ── EMPTY ── */
  .empty {
    text-align: center;
    padding: 32px;
    color: var(--text-muted);
    font-family: 'DM Mono', monospace;
    font-size: 12px;
  }

  .divider { height: 1px; background: var(--border); margin: 14px 0; }
  .flex-gap { display: flex; gap: 8px; flex-wrap: wrap; }
  .mt-8 { margin-top: 8px; }
  .mt-14 { margin-top: 14px; }

  /* ── SCROLLBAR ── */
  ::-webkit-scrollbar { width: 4px; }
  ::-webkit-scrollbar-track { background: var(--bg); }
  ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

  /* ── PWA INSTALL BANNER ── */
  .install-banner {
    display: none;
    background: var(--surface2);
    border: 1px solid var(--green-dim);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 14px;
    align-items: center;
    gap: 12px;
  }

  .install-banner.show { display: flex; }
  .install-banner p { flex: 1; font-size: 13px; color: var(--text-dim); }

  @media (max-width: 480px) {
    .stat-grid { grid-template-columns: repeat(3, 1fr); }
    .stat-val { font-size: 28px; }
  }

  /* ══════════════════════════════════════════════════════
     RESPONSIVE BREAKPOINTS
     320px  — iPhone SE (old), small Android
     360px  — Galaxy S base, most budget Android
     375px  — iPhone SE (2nd/3rd gen), iPhone 6/7/8/12 mini
     390px  — iPhone 14/15/16
     412px  — Pixel 6/7, Galaxy S21/S22
     430px  — iPhone 14/15 Plus, iPhone Pro Max
     768px  — iPad mini portrait, tablet
     1024px — iPad landscape, small laptop
  ══════════════════════════════════════════════════════ */

  /* All phones ≤ 480px: base mobile adjustments */
  @media (max-width: 480px) {
    nav button { font-size: 11px; padding: 10px 8px; min-height: 44px; }
    .card { padding: 14px 12px; }
    .btn { min-height: 44px; font-size: 14px; }
    input, select, textarea { font-size: 16px !important; } /* prevents iOS zoom */
    .event-meta, .course-meta { white-space: normal; word-break: break-word; }
    * { overflow-wrap: break-word; }
  }

  /* 320px — tightest phones (Galaxy Z Fold cover, old SE) */
  @media (max-width: 320px) {
    nav button { font-size: 8px; padding: 10px 3px; min-height: 44px; letter-spacing: 0; }
    .card { padding: 8px 6px; }
    .card-title { font-size: 10px; letter-spacing: 0.3px; }
    .btn { font-size: 13px; padding: 10px 8px; }
    .btn-sm { padding: 5px 6px; font-size: 11px; }
    .flex-gap { flex-direction: column; }
    h2 { font-size: 16px; }
  }

  /* 321px–360px — narrow Android (Galaxy S base) */
  @media (min-width: 321px) and (max-width: 360px) {
    nav button { font-size: 9px; padding: 10px 4px; min-height: 44px; letter-spacing: 0; }
    .card { padding: 10px 8px; }
    .card-title { font-size: 11px; letter-spacing: 0.5px; }
    .flex-gap { flex-direction: column; }
    .btn-sm { padding: 6px 8px; font-size: 12px; }
  }

  /* 361px–375px — iPhone SE 2/3, iPhone 12 mini */
  @media (min-width: 361px) and (max-width: 375px) {
    nav button { font-size: 10px; padding: 10px 6px; }
    .card { padding: 12px 10px; }
    .btn-sm { font-size: 12px; }
  }

  /* 376px–390px — iPhone 14/15/16 standard */
  @media (min-width: 376px) and (max-width: 390px) {
    nav button { font-size: 10px; padding: 10px 7px; }
    .card { padding: 14px 12px; }
  }

  /* 391px–412px — Pixel 6/7, Galaxy S21/S22 */
  @media (min-width: 391px) and (max-width: 412px) {
    nav button { font-size: 11px; padding: 10px 8px; }
    .card { padding: 14px 14px; }
  }

  /* 413px–430px — iPhone 14/15 Plus, Pro Max */
  @media (min-width: 413px) and (max-width: 430px) {
    nav button { font-size: 11px; padding: 10px 9px; }
    .card { padding: 16px 14px; }
    .btn { font-size: 15px; }
  }

  /* 768px — tablet portrait (iPad mini, iPad Air) */
  @media (min-width: 481px) and (max-width: 768px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    nav button { font-size: 13px; padding: 12px 14px; }
    .card { padding: 18px 16px; }
  }

  /* 1024px — iPad landscape, small laptop */
  @media (min-width: 769px) and (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
    nav button { font-size: 13px; padding: 12px 16px; }
  }
  /* ── STATS SCREEN ── */
  .stats-screen { padding: 16px; }
  .stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-top: 16px; }
  .stats-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
  .stats-card-title { font-family: 'Barlow Condensed', sans-serif; font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--text-dim); margin-bottom: 10px; }
  .stats-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.04); font-size: 13px; }
  .stats-row:last-child { border-bottom: none; }
  .stats-rank { width: 18px; font-size: 11px; color: var(--text-muted); flex-shrink: 0; text-align: right; }
  .stats-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .stats-val { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--green); }
  .stats-empty { text-align: center; padding: 48px 20px; color: var(--text-dim); font-size: 14px; }
  .recur-section { background: rgba(61,220,110,0.04); border: 1px solid rgba(61,220,110,0.15); border-radius: 8px; padding: 14px; margin-top: 12px; }

  /* ── LIVE ROUNDS + UNOFFICIAL ROUNDS (live-round.js) ── */
  .unofficial-entry { margin: 4px 0 14px; }
  .live-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
  .live-net { font-size: 11px; font-family: 'DM Mono', monospace; color: var(--text-dim); }
  .live-net.off { color: var(--gold); }
  .live-head .live-head-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
  .live-title { font-family: 'Bebas Neue', sans-serif; font-size: 26px; letter-spacing: 1.5px; line-height: 1.1; margin-bottom: 4px; overflow-wrap: anywhere; }
  .live-me { margin: 12px 0 0; }
  .live-state { display: inline-block; font-family: 'DM Mono', monospace; font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; padding: 3px 8px; border-radius: 4px; background: var(--surface2); color: var(--text-dim); border: 1px solid var(--border); }
  .live-state.checkin { background: var(--green); color: #0a0f0d; border-color: var(--green); }
  .live-state.scoring { background: var(--gold); color: #0a0f0d; border-color: var(--gold); }
  .live-state.finalized, .live-state.committed { color: var(--green); border-color: var(--green-dim); }
  .live-state.unofficial { color: var(--gold); border-color: rgba(240,192,64,0.4); }
  .live-tabs { display: flex; gap: 4px; margin-bottom: 14px; }
  .live-tab-btn { flex: 1; min-width: 0; background: none; border: none; color: var(--text-muted); font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 600; padding: 10px 4px; min-height: 44px; border-radius: var(--radius); cursor: pointer; transition: all 0.2s; }
  .live-tab-btn:hover { color: var(--text); background: var(--surface); }
  .live-tab-btn.active { color: var(--green); background: var(--green-glow); }
  .live-notice { padding: 12px 14px; margin-bottom: 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text-dim); font-size: 13px; line-height: 1.5; }
  .live-notice.ok { border-color: var(--green-dim); color: var(--green); }
  .live-note { font-size: 12px; color: var(--text-dim); line-height: 1.5; margin: 6px 0 12px; }
  .live-flag { width: 100%; font-size: 12px; color: var(--gold); line-height: 1.4; margin-top: 4px; }
  .live-list-head { font-family: 'DM Mono', monospace; font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px; }
  .live-count { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--text-dim); margin-bottom: 10px; }
  .live-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 10px 12px; background: var(--surface2); border: 1px solid transparent; border-radius: var(--radius); margin-bottom: 6px; }
  .live-row.conflict { border-color: var(--gold); }
  .live-row.pending { opacity: 0.75; border-style: dashed; border-color: var(--border); }
  .live-row .live-tag { font-family: 'Bebas Neue', sans-serif; font-size: 22px; color: var(--green); min-width: 38px; }
  .live-row .live-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
  .live-row-status { width: 100%; font-size: 12px; line-height: 1.5; }
  .live-status { font-family: 'DM Mono', monospace; font-weight: 600; }
  .live-status.waiting { color: var(--text-muted); }
  .live-status.entered { color: var(--green); }
  .live-status.conflict { color: var(--gold); }
  .live-who { color: var(--text-dim); font-size: 11px; overflow-wrap: anywhere; }
  .live-conflict { margin-top: 4px; padding: 6px 8px; border-left: 2px solid var(--gold); color: var(--text-dim); font-size: 12px; }
  .live-conflict strong { color: var(--gold); font-family: 'DM Mono', monospace; }
  .live-row-entry { display: flex; align-items: center; gap: 6px; width: 100%; }
  .live-row-entry input { width: 96px; flex: 0 0 96px; text-align: center; font-family: 'DM Mono', monospace; padding: 8px; }
  .live-badge { font-family: 'DM Mono', monospace; font-size: 9px; font-weight: 700; letter-spacing: 1px; padding: 2px 6px; border-radius: 4px; flex-shrink: 0; }
  .live-badge.new { background: var(--gold); color: #0a0f0d; }
  .live-badge.ace { background: rgba(240,192,64,0.12); color: var(--gold); border: 1px solid rgba(240,192,64,0.3); }
  .live-badge.ctp { background: rgba(245,116,42,0.12); color: #F5742A; border: 1px solid rgba(245,116,42,0.3); }
  .live-badge.pending { background: var(--surface); color: var(--text-dim); border: 1px solid var(--border); }
  .live-badge.failed { background: var(--red); color: #fff; }
  .live-dropdown { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); margin-top: 4px; max-height: 240px; overflow-y: auto; }
  .live-dd-item { padding: 12px; border-bottom: 1px solid var(--border); font-size: 14px; cursor: pointer; overflow-wrap: anywhere; }
  .live-dd-item:hover { background: var(--surface); }
  .live-dd-meta { font-size: 11px; color: var(--text-muted); font-family: 'DM Mono', monospace; }
  .live-dd-new { color: var(--green); }
  .live-dd-item { min-height: 48px; box-sizing: border-box; }
  .live-dd-note { color: var(--text-muted); cursor: default; font-size: 13px; }
  .live-dd-note:hover { background: none; }
  a.live-dd-link { display: block; color: var(--green); text-decoration: none; }
  .live-picked { font-size: 12px; color: var(--green); margin-top: 6px; min-height: 1em; }
  label.live-check { display: flex; align-items: center; gap: 8px; font-family: 'DM Sans', sans-serif; font-size: 14px; letter-spacing: 0; text-transform: none; color: var(--text); margin-bottom: 10px; cursor: pointer; }
  label.live-check.sm { font-size: 12px; margin-bottom: 0; color: var(--text-dim); }
  label.live-check input[type=checkbox] { -webkit-appearance: checkbox; appearance: auto; width: 20px; height: 20px; flex: 0 0 20px; padding: 0; margin: 0; accent-color: var(--green); }
  .live-money { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; width: 100%; padding: 6px 0; border-top: 1px solid var(--border); }
  .live-optin { font-size: 11px; font-family: 'DM Mono', monospace; color: var(--text-muted); }
  .live-optin.in { color: var(--green); }
  .live-sortbar { display: flex; gap: 6px; margin-bottom: 12px; align-items: center; }
  .live-sort-btn { flex: 0 0 auto; background: var(--surface2); border: 1px solid var(--border); color: var(--text-dim); border-radius: var(--radius); padding: 8px 10px; min-height: 40px; font-size: 12px; font-weight: 600; cursor: pointer; }
  .live-sort-btn.active { color: var(--green); border-color: var(--green-dim); background: var(--green-glow); }
  .live-sortbar input { flex: 1; min-width: 0; padding: 8px 10px; }
  .live-td-controls { display: flex; flex-direction: column; gap: 8px; }
  .live-share-row .btn { flex: 1; justify-content: center; }
  .live-summary { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--text-dim); margin-bottom: 12px; }
  .live-big { font-family: 'Bebas Neue', sans-serif; font-size: 40px; color: var(--green); line-height: 1; }
  .live-big small { font-size: 22px; color: var(--text-dim); }
  .live-warn { color: var(--gold); }
  .live-pools { border-top: 1px solid var(--border); padding-top: 10px; }
  .live-pool-totals { display: flex; gap: 14px; flex-wrap: wrap; font-family: 'Barlow Condensed', sans-serif; font-size: 16px; letter-spacing: 1px; margin-bottom: 8px; }
  .live-pool-line { font-size: 12px; color: var(--text-dim); line-height: 1.5; margin-bottom: 4px; overflow-wrap: anywhere; }
  .live-pool-line strong { color: var(--text); }
  .live-gold { color: var(--gold); }
  .live-orange { color: #F5742A; }
  .live-pending { border-color: var(--gold); }
  .live-pending-title { font-size: 13px; color: var(--gold); margin-bottom: 8px; }
  .live-pending-item { font-size: 12px; color: var(--text-dim); padding: 6px 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
  .live-pending-item.failed { color: var(--text); }
  .live-pending-item .flex-gap { margin-top: 6px; }
  .live-sync-badge { position: fixed; top: 62px; right: 10px; z-index: 250; max-width: calc(100vw - 20px); background: var(--gold); color: #0a0f0d; border: none; border-radius: 20px; padding: 7px 12px; font-family: 'DM Sans', sans-serif; font-size: 12px; font-weight: 700; box-shadow: 0 4px 16px rgba(0,0,0,0.4); cursor: pointer; }
  .live-sync-badge.failed { background: var(--red); color: #fff; }
  .live-card-btn { margin-top: 10px; display: block; width: 100%; max-width: 360px; padding: 12px 16px; text-align: center; }
  .live-card-td { margin-top: 8px; }
  .live-card-note { max-width: 360px; margin-top: 10px; padding: 10px 14px; background: rgba(61,220,110,0.07); border: 1px solid rgba(61,220,110,0.2); border-radius: 8px; font-size: 13px; color: var(--green); font-family: 'Barlow Condensed', sans-serif; letter-spacing: 0.5px; }
  .live-code { font-family: 'DM Mono', monospace !important; font-size: 12px !important; word-break: break-all; line-height: 1.4; }
  .live-center { text-align: center; margin: 10px 0; color: var(--text-dim); }
  .live-qr { display: flex; align-items: center; justify-content: center; background: #fff; padding: 12px; border-radius: 8px; width: fit-content; min-width: 120px; min-height: 120px; margin: 0 auto; }
  .live-qr.live-qr-fail { background: var(--surface2); color: var(--text-dim); font-size: 13px; padding: 16px; }
  .live-qr img, .live-qr canvas { display: block; max-width: 100%; height: auto; }
  .import-row { border-color: var(--border); }
  .import-row.flagged { border-color: var(--gold); }
  .import-row .import-name { flex: 1 1 100%; font-weight: 500; }
  .import-fields { display: flex; gap: 8px; align-items: flex-end; width: 100%; }
  .import-fields label { flex: 1; min-width: 0; margin: 0; }
  .import-fields input { margin-top: 4px; text-align: center; font-family: 'DM Mono', monospace; }

  /* ── PHONE HEADER — below 641px the nav collapses into a ☰ menu so the header fits every role ── */
  .nav-toggle { display: none; }
  @media (max-width: 640px) {
    header { padding: 0 12px; gap: 6px; }
    .logo { font-size: 18px; letter-spacing: 1.5px; }
    .header-right { gap: 6px; }
    .nav-toggle { display: inline-flex; white-space: nowrap; }
    .nav-toggle.open { border-color: var(--green); color: var(--green); }
    .user-pill { display: none; }
    header nav#mainNav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; gap: 2px; padding: 8px 12px 12px; background: rgba(10,15,13,0.98); border-bottom: 1px solid var(--border); box-shadow: 0 10px 24px rgba(0,0,0,0.5); z-index: 101; }
    header nav#mainNav.open { display: flex; }
    header nav#mainNav button { width: 100%; text-align: left; font-size: 15px; padding: 12px 14px; min-height: 44px; letter-spacing: 0; }
  }
  @media (max-width: 360px) {
    .logo { font-size: 16px; letter-spacing: 1px; }
    .logo span { letter-spacing: 2px; }
  }

  /* ── ACCESS CODE ── */
  .code-link { margin-top: 14px; text-align: center; font-size: 12px; }
  .code-link a { color: var(--text-muted); }
  .code-note { font-size: 13px; color: var(--text-dim); line-height: 1.5; margin-bottom: 12px; }

  /* ── TAG HISTORY CHART (tag-chart.js) ── */
  .tag-chart-ranges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
  .tag-chart-wrap { position: relative; width: 100%; height: 260px; }
  .tag-chart-note { font-size: 12px; color: var(--text-dim); line-height: 1.5; margin: 8px 0; }
  .tag-chart-legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 10px; }
  .tag-chart-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 4px 4px 10px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface2); font-size: 12px; color: var(--text); }
  .tag-chart-swatch { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 12px; }
  .tag-chart-chip-name { overflow-wrap: anywhere; }
  .tag-chart-chip-x { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 12px; padding: 4px 8px; min-height: 28px; }
  .tag-chart-chip-x:hover { color: var(--red); }
  .tag-chart-search { position: relative; }
  @media (max-width: 380px) { .tag-chart-wrap { height: 220px; } }
