﻿:root{
    --bg: #f6f7fa;
    --panel: #ffffff;
    --card: #ffffff;
    --card-hi: #eef1f8;
    --line: #e3e6ed;
    --line-lit: #c7cddb;
    --accent: #2f6fed;
    --accent-soft: #eaf1ff;
    --pink: #dc2748;
    --green: #16915a;
    --green-soft: #e8f7ef;
    --amber: #b5750a;
    --text: #171b24;
    --text-dim: #6b7280;
    --text-faint: #9aa0ad;
    --radius: 10px;
    --shadow-card: 0 1px 2px rgba(20,24,33,.04), 0 1px 8px rgba(20,24,33,.03);
    --font-head: 'Oswald', sans-serif;
    --font-num: 'Space Mono', monospace;
    --font-body: 'Inter', sans-serif;
  }
  *{box-sizing:border-box; margin:0; padding:0;}
  body{
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
  }
  .lightbar{
    display:flex; justify-content:center; gap:10px; padding:10px 0 4px;
  }
  .lightbar span{
    width:5px; height:5px; border-radius:50%;
    background: var(--line-lit);
    animation: flicker 3.2s ease-in-out infinite;
  }
  .lightbar span:nth-child(3n){ animation-delay: .4s; }
  .lightbar span:nth-child(5n){ animation-delay: .9s; }
  .lightbar span:nth-child(7n){ animation-delay: 1.4s; }
  @keyframes flicker{
    0%,100%{ opacity:.4; }
    50%{ opacity:1; }
  }
  header.top{
    display:flex; align-items:center; justify-content:space-between;
    padding: 14px 22px; flex-wrap:wrap; gap:14px;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
  }
  .brand{ display:flex; flex-direction:column; gap:2px; }
  .brand .eyebrow{
    font-family: var(--font-head); font-size:11px; letter-spacing:.16em;
    text-transform:uppercase; color: var(--accent);
  }
  .brand h1{
    font-family: var(--font-head); font-weight:600; font-size:20px;
    letter-spacing:.02em; text-transform:uppercase; color: var(--text);
  }
  .brand .sub{ font-size:12px; color: var(--text-dim); }
  nav.views{ display:flex; gap:4px; background:var(--bg); padding:4px; border-radius:999px; border:1px solid var(--line); }
  nav.views button{
    font-family: var(--font-body); font-weight:600; font-size:13px;
    color: var(--text-dim); background:transparent; border:none;
    padding:8px 16px; border-radius:999px; cursor:pointer;
    transition: background .15s, color .15s;
  }
  nav.views button.active{ background: var(--panel); color: var(--accent); box-shadow: var(--shadow-card); }
  nav.views button:hover:not(.active){ color: var(--text); }

  main{ padding: 24px 22px 36px; max-width:1280px; margin:0 auto; }
  .hidden{ display:none !important; }

  /* ---- shared small pieces ---- */
  .field{ display:flex; flex-direction:column; gap:6px; }
  .field label{ font-size:12px; color:var(--text-dim); text-transform:uppercase; letter-spacing:.04em; }
  .field input, .field select{
    background: var(--panel); border:1px solid var(--line); color:var(--text);
    padding:9px 11px; border-radius:8px; font-family:var(--font-body); font-size:14px;
    outline:none; width:100%; min-width:0;
  }
  .field input:focus, .field select:focus{ border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
  .btn{
    font-family: var(--font-body); font-weight:600; font-size:13px;
    padding:9px 16px; border-radius:8px; cursor:pointer;
    border:1px solid var(--line); background:var(--panel); color:var(--text);
    transition: border-color .15s, background .15s, transform .1s;
  }
  .btn:hover{ border-color: var(--line-lit); background: var(--card-hi); }
  .btn:active{ transform: scale(.97); }
  .btn.primary{ background: var(--accent); color:#fff; border-color:var(--accent); }
  .btn.primary:hover{ background:#1f5adb; border-color:#1f5adb; }
  .btn.danger{ color: var(--pink); border-color: #f4c6ce; }
  .btn.danger:hover{ background: #fdeef1; }
  .btn.ghost{ background:transparent; }
  .btn.ghost:hover{ background: var(--card-hi); }
  .pill{ font-size:11px; padding:3px 9px; border-radius:999px; font-weight:600; letter-spacing:.03em; }
  .pill.live{ background: var(--green-soft); color: var(--green); }
  .pill.idle{ background: var(--card-hi); color: var(--text-dim); }
  .pill.timeup{ background: #fdeef1; color: var(--pink); }

  /* ================= SETUP VIEW ================= */
  #setup-view .meta-card{
    background: var(--card); border:1px solid var(--line); border-radius:12px; box-shadow: var(--shadow-card);
    padding:20px; margin:0; display:grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap:14px;
    align-items:end;
  }
  #setup-view .meta-card .field label{
    min-height:14px;
  }
  #setup-view .meta-card .btn{
    width:100%;
  }
  .section-title{
    font-family: var(--font-head); text-transform:uppercase; letter-spacing:.08em;
    font-size:13px; color: var(--text-dim); margin: 28px 0 12px; display:flex; align-items:center; gap:10px;
    line-height:1;
  }
  #setup-view > .section-title:first-child{ margin-top:0; }
  .section-title::after{ content:''; flex:1; height:1px; background: var(--line); }
  .platform-grid{ display:grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap:14px; margin:0; }
  .platform-edit,
  .panel-card{
    background: var(--card); border:1px solid var(--line); border-radius:12px; padding:20px; box-shadow: var(--shadow-card);
  }
  .platform-edit{ overflow: visible; }
  .platform-edit .ph{
    display:flex; align-items:center; justify-content:space-between; gap:10px;
    margin:0 0 14px; min-height:28px;
  }
  .platform-edit .ph-status{
    display:flex; gap:6px; flex-wrap:wrap; justify-content:flex-end; align-items:center;
  }
  .platform-edit .ph-status .pill{
    font-family: var(--font-num);
  }
  .platform-edit .ph-status [data-status="ready"]{
    font-family: var(--font-body);
  }
  .platform-edit .grid2{ display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap:12px; margin:0; }
  .platform-edit .grid3{ display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap:12px; margin:0; }
  .platform-edit .field{ min-width:0; }
  .platform-edit .field-athlete{ margin:0 0 12px; }
  .platform-edit .field-category{ margin:0; }
  .platform-edit .field-time{ margin:0; position:relative; z-index:1; }
  .platform-edit .field-time:focus-within,
  .platform-edit .time-dd.open{ z-index:6; }
  .platform-edit .field-bottom-row{ margin-top:12px; align-items:start; }
  .platform-edit .grid3 + .field-bottom-row{ margin-top:12px; }

  /* ================= FLIGHTS BOARD ================= */
  #flights-view{
    animation: flightsIn .45s ease both;
  }
  @keyframes flightsIn{
    from{ opacity:0; transform: translateY(8px); }
    to{ opacity:1; transform: none; }
  }
  .flights-stage{
    position:relative;
    border-radius: 18px;
    overflow:hidden;
    background:
      radial-gradient(1200px 420px at 0% -10%, rgba(47,111,237,.16), transparent 55%),
      radial-gradient(900px 360px at 100% 0%, rgba(22,145,90,.08), transparent 50%),
      linear-gradient(180deg, #fbfcff 0%, #f3f5fa 100%);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-card);
    padding: 28px 28px 22px;
  }
  .flights-hero{
    display:flex;
    align-items:flex-end;
    justify-content:space-between;
    gap: 20px;
    flex-wrap:wrap;
    padding-bottom: 22px;
    border-bottom: 1px solid rgba(227,230,237,.9);
    margin-bottom: 18px;
  }
  .flights-kicker{
    font-family: var(--font-head);
    font-size: 11px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 8px;
  }
  .flights-heading{
    font-family: var(--font-head);
    font-size: clamp(36px, 5vw, 52px);
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    line-height: .95;
    color: var(--text);
    margin: 0 0 10px;
  }
  .flights-lead{
    margin: 0;
    max-width: 42ch;
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.45;
  }
  .flights-hero-actions{
    display:flex;
    align-items:center;
    gap: 14px;
  }
  .flights-stat{
    display:flex;
    flex-direction:column;
    align-items:flex-end;
    min-width: 64px;
  }
  .flights-stat-num{
    font-family: var(--font-num);
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
  }
  .flights-stat-label{
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-faint);
    margin-top: 4px;
  }
  .flights-add-btn{
    min-height: 44px;
    padding-left: 18px;
    padding-right: 18px;
  }
  .flights-compose{
    margin-bottom: 16px;
    padding: 16px 18px;
    border-radius: 14px;
    background: rgba(255,255,255,.72);
    border: 1px solid var(--line);
    backdrop-filter: blur(6px);
    animation: flightsComposeIn .28s ease both;
  }
  @keyframes flightsComposeIn{
    from{ opacity:0; transform: translateY(-6px); }
    to{ opacity:1; transform: none; }
  }
  .flights-compose-label{
    font-family: var(--font-head);
    font-size: 12px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 10px;
  }
  .flights-compose-row{
    display:flex;
    gap: 10px;
    align-items:center;
    flex-wrap:wrap;
  }
  .flights-compose-row input{
    flex: 1 1 260px;
    min-width: 0;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
    font-family: var(--font-body);
    font-size: 15px;
    outline: none;
  }
  .flights-compose-row input:focus{
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
  }
  .flights-compose-actions{
    display:flex;
    gap: 8px;
  }
  .flights-empty{
    text-align: center;
    padding: 48px 20px 36px;
  }
  .flights-empty-mark{
    font-family: var(--font-num);
    font-size: 42px;
    color: var(--accent);
    opacity: .35;
    letter-spacing: .08em;
    margin-bottom: 10px;
  }
  .flights-empty-title{
    font-family: var(--font-head);
    font-size: 22px;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 8px;
  }
  .flights-empty-copy{
    margin: 0 auto;
    max-width: 36ch;
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.45;
  }
  .flights-board{
    display:flex;
    flex-direction:column;
    gap: 10px;
  }
  .flight-strip{
    display:grid;
    grid-template-columns: 56px minmax(0, 1fr) auto auto;
    gap: 16px;
    align-items:center;
    padding: 16px 18px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid var(--line);
    transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
    animation: flightStripIn .4s ease both;
    animation-delay: calc(var(--i, 0) * 45ms);
  }
  @keyframes flightStripIn{
    from{ opacity:0; transform: translateY(10px); }
    to{ opacity:1; transform: none; }
  }
  .flight-strip:hover{
    border-color: #b7c7f0;
    box-shadow: 0 8px 24px rgba(47,111,237,.08);
    transform: translateY(-1px);
  }
  .flight-strip-index{
    font-family: var(--font-num);
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
    opacity: .55;
    line-height: 1;
  }
  .flight-strip-name{
    font-family: var(--font-head);
    font-size: 22px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    line-height: 1.1;
    color: var(--text);
  }
  .flight-strip-meta{
    display:flex;
    flex-wrap:wrap;
    gap: 6px;
    align-items:center;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-faint);
  }
  .flight-strip-id{
    font-family: var(--font-num);
    font-size: 11px;
    color: var(--text-dim);
  }
  .flight-strip-dotsep{ opacity: .5; }
  .flight-platforms{
    display:flex;
    gap: 6px;
    margin-top: 10px;
  }
  .flight-dot{
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e6e9f0;
    border: 1px solid #d5dae6;
    transition: background .2s ease, border-color .2s ease, transform .2s ease;
  }
  .flight-dot.on{
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    transform: scale(1.05);
  }
  .flight-strip-count{
    text-align: right;
    min-width: 72px;
  }
  .flight-count-num{
    display:block;
    font-family: var(--font-num);
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    color: var(--text);
  }
  .flight-count-label{
    display:block;
    margin-top: 4px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-faint);
  }
  .flight-strip-actions{
    display:flex;
    flex-direction:column;
    gap: 6px;
  }

  /* ================= ATHLETES BOARD ================= */
  #athletes-view{
    animation: flightsIn .45s ease both;
  }
  .athletes-stage{
    position:relative;
    border-radius: 18px;
    overflow:hidden;
    background:
      radial-gradient(1100px 400px at 100% -20%, rgba(47,111,237,.14), transparent 55%),
      radial-gradient(800px 320px at 0% 100%, rgba(181,117,10,.07), transparent 50%),
      linear-gradient(180deg, #fbfcff 0%, #f3f5fa 100%);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-card);
    padding: 28px 28px 22px;
  }
  .athletes-hero{
    display:flex;
    align-items:flex-end;
    justify-content:space-between;
    gap: 20px;
    flex-wrap:wrap;
    padding-bottom: 22px;
    border-bottom: 1px solid rgba(227,230,237,.9);
    margin-bottom: 16px;
  }
  .athletes-kicker{
    font-family: var(--font-head);
    font-size: 11px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 8px;
  }
  .athletes-heading{
    font-family: var(--font-head);
    font-size: clamp(36px, 5vw, 52px);
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    line-height: .95;
    color: var(--text);
    margin: 0 0 10px;
  }
  .athletes-lead{
    margin: 0;
    max-width: 42ch;
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.45;
  }
  .athletes-hero-actions{
    display:flex;
    align-items:center;
    gap: 14px;
  }
  .athletes-stat{
    display:flex;
    flex-direction:column;
    align-items:flex-end;
    min-width: 64px;
  }
  .athletes-stat-num{
    font-family: var(--font-num);
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
  }
  .athletes-stat-label{
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-faint);
    margin-top: 4px;
  }
  .athletes-add-btn{
    min-height: 44px;
    padding-left: 18px;
    padding-right: 18px;
  }
  .athletes-filter-bar{
    display:flex;
    align-items:center;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap:wrap;
  }
  .athletes-filter-label{
    font-family: var(--font-head);
    font-size: 12px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-dim);
  }
  .athletes-filter-bar select{
    min-width: min(100%, 260px);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    font-family: var(--font-body);
    font-size: 14px;
    outline: none;
  }
  .athletes-filter-bar select:focus{
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
  }
  .athletes-compose{
    margin-bottom: 16px;
    padding: 18px;
    border-radius: 14px;
    background: rgba(255,255,255,.78);
    border: 1px solid var(--line);
    backdrop-filter: blur(6px);
    animation: flightsComposeIn .28s ease both;
  }
  .athletes-compose-label{
    font-family: var(--font-head);
    font-size: 14px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text);
    margin-bottom: 14px;
  }
  .athletes-compose .athlete-form-grid{ margin: 0; }
  .athletes-compose-actions{
    margin-top: 16px;
    display:flex;
    gap: 8px;
    flex-wrap:wrap;
  }
  .athletes-empty{
    text-align: center;
    padding: 48px 20px 36px;
  }
  .athletes-empty-mark{
    font-family: var(--font-num);
    font-size: 36px;
    color: var(--accent);
    opacity: .35;
    letter-spacing: .06em;
    margin-bottom: 10px;
  }
  .athletes-empty-title{
    font-family: var(--font-head);
    font-size: 22px;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 8px;
  }
  .athletes-empty-copy{
    margin: 0 auto;
    max-width: 36ch;
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.45;
  }
  .athletes-board{
    display:flex;
    flex-direction:column;
    gap: 10px;
  }
  .athlete-strip{
    display:grid;
    grid-template-columns: 64px minmax(0, 1fr) auto;
    gap: 16px;
    align-items:center;
    padding: 16px 18px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid var(--line);
    transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
    animation: flightStripIn .4s ease both;
    animation-delay: calc(var(--i, 0) * 40ms);
  }
  .athlete-strip:hover{
    border-color: #b7c7f0;
    box-shadow: 0 8px 24px rgba(47,111,237,.08);
    transform: translateY(-1px);
  }
  .athlete-plat{
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display:flex;
    align-items:center;
    justify-content:center;
    font-family: var(--font-num);
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid #d7e3ff;
  }
  .athlete-strip-top{
    display:flex;
    align-items:baseline;
    justify-content:space-between;
    gap: 12px;
    flex-wrap:wrap;
    margin-bottom: 8px;
  }
  .athlete-name{
    font-family: var(--font-head);
    font-size: 22px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    line-height: 1.1;
    color: var(--text);
  }
  .athlete-flight{
    font-size: 12px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: .06em;
    font-family: var(--font-head);
  }
  .athlete-chips{
    display:flex;
    flex-wrap:wrap;
    gap: 6px;
  }
  .athlete-chip{
    display:inline-flex;
    align-items:center;
    gap: 6px;
    padding: 5px 9px;
    border-radius: 999px;
    background: var(--card-hi);
    border: 1px solid var(--line);
    font-size: 12px;
    color: var(--text);
    white-space: nowrap;
  }
  .athlete-chip em{
    font-style: normal;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-faint);
  }
  .athlete-chip.muted{
    color: var(--text-faint);
  }
  .athlete-strip-actions{
    display:flex;
    flex-direction:column;
    gap: 6px;
  }

  /* ================= HISTORY BOARD ================= */
  #history-view{
    animation: flightsIn .45s ease both;
  }
  .history-stage{
    position:relative;
    border-radius: 18px;
    overflow:hidden;
    background:
      radial-gradient(1100px 400px at 0% -10%, rgba(22,145,90,.10), transparent 55%),
      radial-gradient(900px 360px at 100% 0%, rgba(47,111,237,.12), transparent 50%),
      linear-gradient(180deg, #fbfcff 0%, #f3f5fa 100%);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-card);
    padding: 28px 28px 22px;
  }
  .history-hero{
    display:flex;
    align-items:flex-end;
    justify-content:space-between;
    gap: 20px;
    flex-wrap:wrap;
    padding-bottom: 22px;
    border-bottom: 1px solid rgba(227,230,237,.9);
    margin-bottom: 16px;
  }
  .history-kicker{
    font-family: var(--font-head);
    font-size: 11px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 8px;
  }
  .history-heading{
    font-family: var(--font-head);
    font-size: clamp(36px, 5vw, 52px);
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    line-height: .95;
    color: var(--text);
    margin: 0 0 10px;
  }
  .history-lead{
    margin: 0;
    max-width: 44ch;
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.45;
  }
  .history-hero-actions{
    display:flex;
    align-items:center;
    gap: 10px;
    flex-wrap:wrap;
  }
  .history-stat{
    display:flex;
    flex-direction:column;
    align-items:flex-end;
    min-width: 56px;
    margin-right: 4px;
  }
  .history-stat-num{
    font-family: var(--font-num);
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
  }
  .history-stat-label{
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-faint);
    margin-top: 4px;
  }
  .history-empty{
    text-align: center;
    padding: 48px 20px 36px;
  }
  .history-empty-mark{
    font-family: var(--font-num);
    font-size: 42px;
    color: var(--green);
    opacity: .35;
    letter-spacing: .08em;
    margin-bottom: 10px;
  }
  .history-empty-title{
    font-family: var(--font-head);
    font-size: 22px;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 8px;
  }
  .history-empty-copy{
    margin: 0 auto;
    max-width: 40ch;
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.45;
  }
  .history-board,
  .history-results{
    display:flex;
    flex-direction:column;
    gap: 10px;
  }
  .history-strip{
    display:grid;
    grid-template-columns: 64px minmax(0, 1fr) auto;
    gap: 16px;
    align-items:center;
    padding: 16px 18px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid var(--line);
    transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
    animation: flightStripIn .4s ease both;
    animation-delay: calc(var(--i, 0) * 40ms);
  }
  .history-strip:hover{
    border-color: #b7c7f0;
    box-shadow: 0 8px 24px rgba(47,111,237,.08);
    transform: translateY(-1px);
  }
  .history-strip-id{
    font-family: var(--font-num);
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    opacity: .7;
  }
  .history-strip-top{
    display:flex;
    align-items:baseline;
    justify-content:space-between;
    gap: 12px;
    flex-wrap:wrap;
    margin-bottom: 4px;
  }
  .history-strip-flight{
    font-family: var(--font-head);
    font-size: 22px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    line-height: 1.1;
    color: var(--text);
  }
  .history-strip-when{
    font-family: var(--font-num);
    font-size: 12px;
    color: var(--text-faint);
  }
  .history-strip-event{
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 8px;
  }
  .history-strip-meta{
    display:flex;
    flex-wrap:wrap;
    gap: 6px;
  }
  .history-chip{
    display:inline-flex;
    align-items:center;
    gap: 6px;
    padding: 5px 9px;
    border-radius: 999px;
    background: var(--card-hi);
    border: 1px solid var(--line);
    font-size: 12px;
    color: var(--text);
    white-space: nowrap;
  }
  .history-chip em{
    font-style: normal;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-faint);
  }
  .history-chip-score{
    background: var(--accent-soft);
    border-color: #d7e3ff;
    color: var(--accent);
    font-family: var(--font-num);
    font-weight: 700;
  }
  .history-strip-actions{
    display:flex;
    flex-direction:column;
    gap: 6px;
  }
  .history-detail-head{
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
  }
  .history-detail-kicker{
    font-family: var(--font-num);
    font-size: 12px;
    color: var(--accent);
    margin-bottom: 6px;
  }
  .history-detail-title{
    font-family: var(--font-head);
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    line-height: 1;
    margin-bottom: 8px;
  }
  .history-detail-event{
    font-size: 14px;
    color: var(--text-dim);
  }
  .history-meta{ font-size: 12px; color: var(--text-dim); margin-top: 6px; }
  .history-notes{ font-size: 12px; color: var(--text-faint); margin-top: 6px; font-style: italic; }
  .history-result{
    display:grid;
    grid-template-columns: 56px minmax(0, 1fr) auto;
    gap: 14px;
    align-items:center;
    padding: 14px 16px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid var(--line);
    animation: flightStripIn .35s ease both;
    animation-delay: calc(var(--i, 0) * 35ms);
  }
  .history-result-plat{
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display:flex;
    align-items:center;
    justify-content:center;
    font-family: var(--font-num);
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid #d7e3ff;
  }
  .history-result-name{
    font-family: var(--font-head);
    font-size: 18px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-bottom: 8px;
  }
  .history-result-chips{
    display:flex;
    flex-wrap:wrap;
    gap: 6px;
  }
  .history-result-score{
    text-align: right;
    min-width: 64px;
  }
  .history-result-score-num{
    display:block;
    font-family: var(--font-num);
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
    color: var(--accent);
  }
  .history-result-score-label{
    display:block;
    margin-top: 4px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-faint);
  }

  /* ================= FLIGHTS & ATHLETES (shared) ================= */
  .flight-load-row{
    grid-template-columns: minmax(140px, 180px) minmax(200px, 280px) minmax(0, 1fr);
    align-items: end;
    margin: 0 0 16px;
  }
  .flight-load-note{
    margin: 0;
    padding: 9px 0;
    color: var(--text-dim);
    font-size: 13px;
  }
  .mod-toolbar{
    display:flex; align-items:flex-end; justify-content:space-between; gap:16px; flex-wrap:wrap;
    margin:0 0 18px;
  }
  .mod-toolbar .section-title{ margin:0 0 8px; }
  .mod-toolbar .panel-lead{ margin:0; max-width:560px; }
  .mod-title::after{ display:none; }
  .flight-form-card,
  .athlete-form-card,
  .filter-card,
  .table-card{
    margin-bottom:16px;
  }
  .flight-form-grid{
    grid-template-columns: minmax(0, 1fr) auto;
    align-items:end;
  }
  .field-actions .toolbar-actions{ display:flex; gap:8px; flex-wrap:wrap; }
  .athlete-form-grid{
    display:grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap:12px;
  }
  .athlete-form-grid .field-span-2{ grid-column: span 2; }
  .athlete-form-actions{ margin-top:16px; display:flex; gap:8px; flex-wrap:wrap; }
  .table-scroll{ overflow-x:auto; -webkit-overflow-scrolling:touch; }
  .data-table{
    width:100%;
    border-collapse:collapse;
    font-size:13px;
  }
  .data-table th,
  .data-table td{
    text-align:left;
    padding:10px 12px;
    border-bottom:1px solid var(--line);
    vertical-align:middle;
    white-space:nowrap;
  }
  .data-table th{
    font-size:11px;
    text-transform:uppercase;
    letter-spacing:.04em;
    color:var(--text-dim);
    font-weight:600;
  }
  .data-table tbody tr:hover{ background: var(--card-hi); }
  .data-table .th-actions,
  .data-table .td-actions{ text-align:right; }
  .td-actions{ display:flex; gap:6px; justify-content:flex-end; flex-wrap:wrap; }
  .btn.btn-sm{ padding:6px 10px; font-size:12px; }

  /* ================= CREDENTIALS ================= */
  .cred-toolbar{
    display:flex; align-items:flex-end; justify-content:space-between; gap:16px; flex-wrap:wrap;
    margin:0 0 18px;
  }
  .cred-toolbar .section-title{ margin:0 0 8px; }
  .cred-toolbar .panel-lead{ margin:0; max-width:520px; }
  .cred-title::after{ display:none; }
  .cred-empty{ margin-bottom:16px; }
  .cred-grid{
    display:grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap:16px;
  }
  .cred-card{
    background: var(--card);
    border:1px solid var(--line);
    border-radius:14px;
    box-shadow: var(--shadow-card);
    overflow:hidden;
    display:flex;
    flex-direction:column;
  }
  .cred-card-inner{
    padding:18px 18px 14px;
    background:
      linear-gradient(135deg, #eaf1ff 0%, transparent 42%),
      linear-gradient(180deg, #fff 0%, #f8f9fc 100%);
    border-bottom:1px solid var(--line);
  }
  .cred-card-top{
    display:flex; justify-content:space-between; align-items:flex-start; gap:10px; margin-bottom:14px;
  }
  .cred-event{
    font-family: var(--font-head);
    font-size:11px;
    letter-spacing:.08em;
    text-transform:uppercase;
    color: var(--accent);
    line-height:1.3;
  }
  .cred-plat{
    font-size:11px;
    font-weight:600;
    color: var(--text-dim);
    white-space:nowrap;
  }
  .cred-name{
    font-family: var(--font-head);
    font-size:22px;
    text-transform:uppercase;
    line-height:1.15;
    margin-bottom:8px;
    word-break: break-word;
  }
  .cred-flagline{
    display:flex; align-items:center; gap:6px; flex-wrap:wrap;
    color: var(--text-dim); font-size:13px; margin-bottom:14px;
  }
  .cred-flag{ font-size:18px; line-height:1; }
  .cred-dot{ color: var(--text-faint); }
  .cred-meta{
    display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap:8px;
    margin-bottom:12px;
  }
  .cred-meta-item{
    background: rgba(255,255,255,.75);
    border:1px solid var(--line);
    border-radius:8px;
    padding:8px 8px;
    display:flex; flex-direction:column; gap:3px;
  }
  .cred-meta-item .k{
    font-size:10px; text-transform:uppercase; letter-spacing:.05em; color: var(--text-faint);
  }
  .cred-meta-item .v{
    font-family: var(--font-num); font-size:13px; color: var(--text);
  }
  .cred-foot{
    display:flex; justify-content:space-between; gap:8px; flex-wrap:wrap;
    font-size:11px; color: var(--text-faint);
  }
  .cred-edit{ padding:14px 16px 16px; background: var(--panel); }

  @media print{
    body{ background:#fff !important; }
    .lightbar, header.top, .sync-banner, .no-print, #setup-view, #judge-view, #display-view,
    #flights-view, #athletes-view, #credEmpty, .cred-edit, .cred-toolbar .toolbar-actions,
    #historyListPanel{ display:none !important; }
    #credentials-view.hidden, #history-view.hidden{ display:none !important; }
    #credentials-view:not(.hidden), #history-view:not(.hidden){ display:block !important; }
    #historyDetailPanel{ display:block !important; }
    .history-stage{
      border:none;
      box-shadow:none;
      background:#fff;
      padding:0;
      border-radius:0;
    }
    .cred-toolbar, .mod-toolbar{ margin-bottom:12px; }
    .cred-toolbar .panel-lead, .mod-toolbar .panel-lead{ display:none; }
    main{ max-width:none; padding:0; }
    .cred-grid{
      display:grid;
      grid-template-columns: repeat(2, 1fr);
      gap:12px;
    }
    .cred-card{
      break-inside: avoid;
      box-shadow:none;
      border:1px solid #ccc;
    }
    .cred-card-inner{ background:#fff; }
    .history-result{ break-inside: avoid; box-shadow:none; }
  }

  .time-dd{ position:relative; width:100%; }
  .time-dd-trigger{
    width:100%;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    background: var(--panel);
    border:1px solid var(--line);
    border-radius:8px;
    padding:10px 12px;
    cursor:pointer;
    font-family: var(--font-body);
    color: var(--text);
    text-align:left;
    transition: border-color .15s, box-shadow .15s;
    min-height:42px;
    touch-action: manipulation;
  }
  .time-dd-trigger:hover{ border-color: var(--line-lit); }
  .time-dd.open .time-dd-trigger,
  .time-dd-trigger:focus{
    outline:none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
  }
  .time-dd-value{
    display:inline-flex;
    align-items:baseline;
    gap:6px;
  }
  .time-dd-num{
    font-family: var(--font-num);
    font-size:15px;
    font-weight:700;
    line-height:1;
  }
  .time-dd-unit{
    font-size:12px;
    color: var(--text-dim);
    text-transform:lowercase;
  }
  .time-dd-chevron{
    width:8px; height:8px;
    border-right:2px solid var(--text-faint);
    border-bottom:2px solid var(--text-faint);
    transform: rotate(45deg);
    margin-top:-4px;
    flex-shrink:0;
    transition: transform .15s, border-color .15s;
  }
  .time-dd.open .time-dd-chevron{
    transform: rotate(225deg);
    margin-top:4px;
    border-color: var(--accent);
  }
  .time-dd-menu{
    position:absolute;
    left:0; right:0; top:calc(100% + 6px);
    background: var(--panel);
    border:1px solid var(--line);
    border-radius:10px;
    box-shadow: 0 8px 24px rgba(20,24,33,.12), 0 2px 6px rgba(20,24,33,.06);
    padding:6px;
    display:flex;
    flex-direction:column;
    gap:4px;
    z-index:20;
  }
  .time-dd-menu[hidden]{ display:none !important; }
  .time-dd-option{
    appearance:none;
    border:0;
    background: transparent;
    border-radius:8px;
    padding:11px 12px;
    cursor:pointer;
    display:flex;
    align-items:baseline;
    gap:6px;
    width:100%;
    text-align:left;
    color: var(--text);
    font-family: var(--font-body);
    transition: background .12s, color .12s;
    touch-action: manipulation;
  }
  .time-dd-option:hover{
    background: var(--accent-soft);
    color: var(--accent);
  }
  .time-dd-option.selected{
    background: var(--accent);
    color: #fff;
  }
  .time-dd-option.selected .time-dd-unit{ color: rgba(255,255,255,.85); }
  .time-dd-option .time-dd-num{ font-size:15px; }

  .panel-card{
    display:flex; flex-direction:column; gap:14px;
  }
  .panel-lead{
    margin:0; color: var(--text-dim); font-size:14px; line-height:1.55;
  }
  .panel-lead b{ color: var(--text); font-weight:600; }
  .toolbar-row{
    display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap;
  }
  .toolbar-actions{
    display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  }
  .toolbar-row .pill{
    margin-left:0; flex-shrink:0;
  }
  .status-detail{
    margin:0; padding:0; font-size:13px; color:var(--text-dim);
    display:flex; gap:10px 18px; flex-wrap:wrap; align-items:center; min-height:0;
  }
  .status-detail:empty{ display:none; }
  .ready-summary{
    margin:0; padding:12px 14px; border-radius:8px;
    background:var(--bg); border:1px solid var(--line);
    font-size:13px; color:var(--text-dim); line-height:1.45;
    display:flex; flex-wrap:wrap; gap:8px 16px; align-items:center;
  }
  .ready-summary:empty{ display:none; }
  .ready-summary b{ color:var(--text); }

  .roles-grid{
    display:grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap:14px; margin:0;
  }
  .role-card{
    background:var(--card); border:1px solid var(--line); border-radius:12px;
    padding:16px 18px; box-shadow:var(--shadow-card);
    display:flex; flex-direction:column; gap:8px; min-height:100%;
  }
  .role-card .rk{
    font-family:var(--font-head); font-size:12px; letter-spacing:.06em;
    text-transform:uppercase; color:var(--accent); margin:0; line-height:1.2;
  }
  .role-card .rv{ font-size:13px; color:var(--text-dim); line-height:1.5; margin:0; }
  .role-card .rv b{ color:var(--text); font-weight:600; }

  .links-grid{ margin:0; }
  .links-panel .toolbar-row{ margin:0; }

  /* ================= JUDGE VIEW ================= */
  #judge-view .plat-tabs{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom:20px; }
  #judge-view .plat-tabs button{
    font-family: var(--font-head); font-size:13px; letter-spacing:.03em;
    padding:9px 18px; border-radius:8px; border:1px solid var(--line);
    background: var(--panel); color: var(--text-dim); cursor:pointer;
  }
  #judge-view .plat-tabs button.active{ border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

  .judge-console{
    background: var(--card); border:1px solid var(--line); border-radius:16px; box-shadow: var(--shadow-card);
    padding: 24px; display:grid; grid-template-columns: 1fr 1.1fr; gap:24px; align-items:start;
  }

  .athlete-block{ display:flex; flex-direction:column; gap:14px; }
  .athlete-id{ display:flex; align-items:center; gap:14px; }
  .avatar-dot{
    width:56px; height:56px; border-radius:50%;
    background: var(--accent-soft);
    border: 2px solid var(--accent); flex-shrink:0;
  }
  .athlete-id .name{ font-family: var(--font-head); font-size:22px; font-weight:600; text-transform:uppercase; line-height:1.15; }
  .athlete-id .flagrow{ display:flex; align-items:center; gap:8px; font-size:13px; color:var(--text-dim); margin-top:4px; }
  .athlete-id .flagrow .flag{ font-size:18px; }
  .stat-row{ display:flex; gap:18px 22px; flex-wrap:wrap; }
  .stat-row .stat{ display:flex; flex-direction:column; gap:4px; }
  .stat-row .stat .k{ font-size:11px; color: var(--text-faint); text-transform:uppercase; letter-spacing:.05em; }
  .stat-row .stat .v{ font-family: var(--font-num); font-size:15px; color: var(--text); }
  .no-athlete-note{ color: var(--text-dim); font-size:14px; line-height:1.55; margin:0; }

  .control-block{ display:flex; flex-direction:column; gap:16px; }
  .timer-display{
    background: var(--bg); border:1px solid var(--line); border-radius:12px;
    padding:16px 18px; display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap;
  }
  .timer-display .t{ font-family: var(--font-num); font-size:34px; letter-spacing:.03em; color: var(--text); line-height:1; }
  .timer-display.countdown{ border-color: var(--accent); background: var(--accent-soft); }
  .timer-display.countdown .t{ color: var(--accent); font-size:44px; }
  .timer-btns{ display:flex; gap:8px; }
  .count-area{ display:flex; align-items:center; justify-content:center; gap:22px; padding:8px 0; }
  .count-btn{
    width:64px; height:64px; border-radius:50%; border:1px solid var(--line);
    background: var(--panel); color: var(--text); font-family:var(--font-head);
    font-size:28px; cursor:pointer; display:flex; align-items:center; justify-content:center;
    transition: border-color .12s, transform .08s, background .12s;
    user-select:none;
  }
  .count-btn:hover{ border-color: var(--line-lit); }
  .count-btn:active{ transform: scale(.92); }
  .count-btn.plus{ border-color: #b7e4cb; color: var(--green); }
  .count-btn.plus:hover{ background: var(--green-soft); }
  .count-btn.minus{ border-color: #f4c6ce; color: var(--pink); }
  .count-btn.minus:hover{ background: #fdeef1; }
  .count-value{ font-family: var(--font-num); font-size:64px; color: var(--green); min-width:110px; text-align:center; line-height:1; }
  .ready-row{ display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }
  .ready-toggle{
    display:flex; align-items:center; gap:10px; cursor:pointer; padding:9px 16px;
    border:1px solid var(--line); border-radius:8px; font-size:13px; font-weight:600; color: var(--text-dim);
  }
  .ready-toggle.on{ border-color: var(--green); color: var(--green); background: var(--green-soft); }
  .ready-toggle .dot{ width:9px; height:9px; border-radius:50%; background: currentColor; }
  .judge-actions{
    display:flex; gap:8px; flex-wrap:wrap;
  }
  .note-sm{ font-size:12px; line-height:1.45; }
  .note-center{ text-align:center; }
  .count-value.is-locked{ opacity:.35; }

  /* ================= DISPLAY VIEW ================= */
  #display-view .display-head{
    text-align:center; margin:0 0 16px;
  }
  #display-view .display-head .comp-title{
    font-family: var(--font-head); font-size: clamp(20px,3vw,32px); text-transform:uppercase;
    letter-spacing:.03em; color: var(--text); line-height:1.15;
  }
  #display-view .display-head .comp-sub{ color: var(--text-dim); font-size:13px; margin-top:6px; line-height:1.4; }
  .display-toolbar{ display:flex; justify-content:center; gap:8px; margin:0 0 16px; flex-wrap:wrap; }

  .board-grid{ display:grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap:14px; }

  .board-card{
    background: var(--card); border:1px solid var(--line); border-radius:14px; box-shadow: var(--shadow-card);
    padding:16px; min-height:190px; display:flex; flex-direction:column; gap:12px;
    cursor:pointer; position:relative; overflow:hidden;
  }
  .board-card.live{ border-color: var(--accent); background: var(--accent-soft); }
  .board-card .top-row{ display:flex; justify-content:space-between; align-items:flex-start; }
  .board-card .plat-label{ font-family: var(--font-head); font-size:12px; color: var(--text-dim); letter-spacing:.06em; text-transform:uppercase; }
  .board-card .empty-note{
    flex:1; display:flex; align-items:center; justify-content:center;
    color: var(--text-faint); font-family: var(--font-head); letter-spacing:.05em;
    font-size:13px; text-transform:uppercase;
  }
  .board-card .athlete{ display:flex; align-items:center; gap:10px; }
  .board-card .dot{ width:30px; height:30px; border-radius:50%; background: var(--accent-soft); border:2px solid var(--accent); flex-shrink:0; }
  .board-card .aname{ font-family: var(--font-head); font-size:15px; text-transform:uppercase; line-height:1.2; }
  .board-card .aflag{ font-size:12px; color: var(--text-dim); display:flex; gap:6px; align-items:center; }
  .board-card .midrow{ display:flex; justify-content:space-between; align-items:flex-end; margin-top:auto; }
  .board-card .timer{ font-family: var(--font-num); font-size:14px; color: var(--text-dim); }
  .board-card .count{ font-family: var(--font-num); font-size:40px; color: var(--green); line-height:1; }
  .board-card .weight{ font-size:11px; color: var(--text-faint); }

  .fullscreen-card{
    background: var(--card); border:1px solid var(--accent); border-radius:18px; box-shadow: var(--shadow-card);
    padding: 36px 40px; display:flex; flex-direction:column; gap:22px;
  }
  .fullscreen-card .fs-top{ display:flex; justify-content:space-between; align-items:flex-start; }
  .fullscreen-card .fs-athlete{ display:flex; align-items:center; gap:20px; }
  .fullscreen-card .fs-dot{ width:74px; height:74px; border-radius:50%; background: var(--accent-soft); border:2px solid var(--accent); }
  .fullscreen-card .fs-name{ font-family: var(--font-head); font-size:36px; text-transform:uppercase; }
  .fullscreen-card .fs-flag{ font-size:16px; color: var(--text-dim); display:flex; gap:8px; align-items:center; margin-top:6px; }
  .fs-body{ display:grid; grid-template-columns: 1fr 1fr; gap:20px; }
  .fs-panel{ background: var(--bg); border:1px solid var(--line); border-radius:12px; padding:20px; text-align:center; }
  .fs-panel .lbl{ font-size:12px; color: var(--text-dim); text-transform:uppercase; letter-spacing:.06em; margin-bottom:8px; }
  .fs-panel .big{ font-family: var(--font-num); font-size: clamp(48px,8vw,86px); }
  .fs-panel.time .big{ color: var(--text); }
  .fs-panel.count .big{ color: var(--green); }
  .fs-meta{ display:flex; gap:26px; flex-wrap:wrap; }
  .fs-meta .stat .k{ font-size:11px; color: var(--text-faint); text-transform:uppercase; }
  .fs-meta .stat .v{ font-family: var(--font-num); font-size:16px; }

  .sync-note{
    text-align:center; font-size:11px; color: var(--text-faint); margin-top:20px;
    display:flex; align-items:center; justify-content:center; gap:6px;
  }
  .sync-note .sdot{ width:6px; height:6px; border-radius:50%; background: var(--green); animation: pulse 2s infinite; }
  .sync-note.warn .sdot{ background: var(--amber); animation:none; }
  .sync-note.err .sdot{ background: var(--pink); animation:none; }
  @keyframes pulse{ 0%,100%{opacity:1;} 50%{opacity:.3;} }

  .sync-banner{
    display:none; max-width:1280px; margin:12px auto 0; padding:10px 14px; border-radius:8px;
    font-size:13px; border:1px solid #f4c6ce; background:#fdeef1; color:var(--pink);
    box-sizing:border-box; width:calc(100% - 44px);
  }
  .sync-banner.show{ display:block; }
  .sync-banner.local{
    border-color:#e8d4a8; background:#fff8e8; color:var(--amber);
  }

  .pill.ready{ background: var(--green-soft); color: var(--green); }
  .pill.notready{ background: var(--card-hi); color: var(--text-faint); }

  ::selection{ background: var(--accent-soft); color: var(--accent); }

  /* ================= SHARE LINKS ================= */
  .link-row{
    display:flex; align-items:center; gap:10px; flex-wrap:wrap;
    padding:12px 0; border-bottom:1px solid var(--line);
  }
  .link-row:first-child{ padding-top:0; }
  .link-row:last-child{ border-bottom:none; padding-bottom:0; }
  .link-row .llabel{
    font-family: var(--font-head); font-size:12px; letter-spacing:.04em;
    text-transform:uppercase; color:var(--text-dim); min-width:140px; line-height:1.2;
  }
  .link-row input{
    flex:1; min-width:200px; background: var(--bg); border:1px solid var(--line);
    border-radius:8px; padding:9px 11px; font-family:var(--font-num); font-size:12px; color:var(--text);
  }
  .link-row .btn{ flex-shrink:0; }
  .header-actions{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
  .login-gate{ max-width:480px; margin:60px auto; padding:24px; text-align:center; }

  /* ================= RESPONSIVE: laptop ================= */
  @media (min-width: 1025px){
    .platform-grid{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .roles-grid{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .board-grid{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
  }

  /* ================= RESPONSIVE: tablet ================= */
  @media (max-width: 1024px){
    main{ padding: 20px 18px 32px; }
    .platform-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .roles-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .board-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
    #setup-view .meta-card{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .judge-console{ grid-template-columns: 1fr 1fr; gap:20px; padding:20px; }
    .fullscreen-card{ padding: 28px 24px; }
    .fullscreen-card .fs-name{ font-size:28px; }
    .sync-banner{ width: calc(100% - 36px); }
  }

  @media (max-width: 900px){
    .judge-console{ grid-template-columns: 1fr; }
    .link-row .llabel{ min-width: 110px; }
  }

  /* ================= RESPONSIVE: mobile ================= */
  @media (max-width: 640px){
    .lightbar{ padding: 8px 0 2px; gap: 7px; }
    .lightbar span{ width:4px; height:4px; }

    header.top{
      padding: 12px 14px;
      gap: 12px;
      align-items: flex-start;
    }
    .brand{ min-width: 0; flex: 1 1 auto; }
    .brand h1{
      font-size: 16px;
      line-height: 1.2;
      word-break: break-word;
    }
    .brand .sub{ font-size: 11px; line-height: 1.35; }
    .header-actions{
      width: 100%;
      justify-content: stretch;
      gap: 8px;
    }
    nav.views{
      width: 100%;
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 0;
      padding: 3px;
      border-radius: 10px;
    }
    nav.views button{
      width: 100%;
      padding: 9px 6px;
      font-size: 12px;
      border-radius: 8px;
      white-space: nowrap;
    }
    #logoutBtn{
      width: 100%;
    }

    main{ padding: 14px 12px 28px; }
    .section-title{ margin: 22px 0 10px; font-size: 12px; gap: 8px; }
    #setup-view > .section-title:first-child{ margin-top: 0; }

    .roles-grid,
    .platform-grid,
    .board-grid,
    #setup-view .meta-card{
      grid-template-columns: 1fr;
      gap: 12px;
    }

    .role-card,
    .platform-edit,
    .panel-card,
    .meta-card{
      padding: 14px;
      border-radius: 10px;
    }

    .platform-edit .grid2{
      grid-template-columns: 1fr 1fr;
      gap: 10px;
    }
    .platform-edit .grid3{
      grid-template-columns: 1fr 1fr 1fr;
      gap: 8px;
    }
    .platform-edit .ph{
      flex-wrap: wrap;
      align-items: flex-start;
      margin-bottom: 12px;
    }
    .platform-edit .ph-status{ justify-content: flex-start; }

    .time-dd-trigger{ min-height: 44px; padding: 12px; }
    .time-dd-option{ padding: 13px 12px; min-height: 44px; }
    .time-dd-menu{ top: calc(100% + 4px); }

    .cred-toolbar{ flex-direction: column; align-items: stretch; }
    .cred-toolbar .toolbar-actions{ width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .cred-toolbar .toolbar-actions .btn{ width: 100%; }
    .mod-toolbar{ flex-direction: column; align-items: stretch; }
    .mod-toolbar > .btn{ width: 100%; }
    .flights-stage{ padding: 20px 16px 16px; border-radius: 14px; }
    .flights-hero{ align-items: stretch; }
    .flights-hero-actions{
      width: 100%;
      justify-content: space-between;
    }
    .flights-add-btn{ flex: 1 1 auto; }
    .flights-compose-row{ flex-direction: column; align-items: stretch; }
    .flights-compose-actions{ width: 100%; }
    .flights-compose-actions .btn{ flex: 1 1 auto; }
    .flight-strip{
      grid-template-columns: 40px minmax(0, 1fr);
      gap: 10px 12px;
    }
    .flight-strip-count{
      grid-column: 2;
      text-align: left;
      display: flex;
      align-items: baseline;
      gap: 8px;
      min-width: 0;
    }
    .flight-count-num{ font-size: 22px; }
    .flight-strip-actions{
      grid-column: 1 / -1;
      flex-direction: row;
    }
    .flight-strip-actions .btn{ flex: 1 1 auto; }
    .athletes-stage{ padding: 20px 16px 16px; border-radius: 14px; }
    .athletes-hero{ align-items: stretch; }
    .athletes-hero-actions{
      width: 100%;
      justify-content: space-between;
    }
    .athletes-add-btn{ flex: 1 1 auto; }
    .athletes-filter-bar{ width: 100%; }
    .athletes-filter-bar select{ width: 100%; min-width: 0; }
    .athletes-compose-actions .btn{ flex: 1 1 auto; }
    .athlete-strip{
      grid-template-columns: 52px minmax(0, 1fr);
      gap: 10px 12px;
    }
    .athlete-plat{ width: 48px; height: 48px; font-size: 15px; border-radius: 12px; }
    .athlete-name{ font-size: 18px; }
    .athlete-strip-actions{
      grid-column: 1 / -1;
      flex-direction: row;
    }
    .athlete-strip-actions .btn{ flex: 1 1 auto; }
    .history-stage{ padding: 20px 16px 16px; border-radius: 14px; }
    .history-hero{ align-items: stretch; }
    .history-hero-actions{
      width: 100%;
      justify-content: flex-start;
    }
    .history-stat{ align-items: flex-start; margin-right: auto; }
    .history-strip{
      grid-template-columns: 48px minmax(0, 1fr);
      gap: 10px 12px;
    }
    .history-strip-flight{ font-size: 18px; }
    .history-strip-actions{
      grid-column: 1 / -1;
      flex-direction: row;
    }
    .history-strip-actions .btn{ flex: 1 1 auto; }
    .history-result{
      grid-template-columns: 48px minmax(0, 1fr);
      gap: 10px 12px;
    }
    .history-result-score{
      grid-column: 2;
      text-align: left;
      display: flex;
      align-items: baseline;
      gap: 8px;
    }
    .history-result-score-num{ font-size: 26px; }
    .flight-form-grid{ grid-template-columns: 1fr; }
    .flight-load-row{ grid-template-columns: 1fr; }
    .athlete-form-grid{ grid-template-columns: 1fr 1fr; }
    .athlete-form-grid .field-span-2{ grid-column: span 2; }
    .athlete-form-actions .btn{ flex: 1 1 auto; }
    .cred-meta{ grid-template-columns: 1fr; }
    .cred-name{ font-size: 18px; }

    .toolbar-row{
      flex-direction: column;
      align-items: stretch;
      gap: 10px;
    }
    .toolbar-actions{
      width: 100%;
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
    }
    .toolbar-actions .btn{
      width: 100%;
      justify-content: center;
      text-align: center;
      padding: 11px 10px;
      font-size: 12px;
    }
    .toolbar-row .pill{
      align-self: flex-start;
    }
    .ready-summary{ padding: 10px 12px; gap: 6px 12px; }
    .status-detail{ gap: 8px 12px; font-size: 12px; }

    /* Judge — phone-first control layout */
    #judge-view .plat-tabs{
      margin-bottom: 12px;
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 6px;
    }
    #judge-view .plat-tabs button{
      width: 100%;
      padding: 10px 6px;
      font-size: 12px;
    }

    .judge-console{
      padding: 14px;
      gap: 16px;
      border-radius: 12px;
    }
    .athlete-id{ gap: 12px; }
    .avatar-dot{ width: 48px; height: 48px; }
    .athlete-id .name{ font-size: 18px; }
    .stat-row{
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px 12px;
    }
    .stat-row .stat .v{ font-size: 14px; }

    .timer-display{
      flex-direction: column;
      align-items: flex-start;
      padding: 14px;
      gap: 8px;
    }
    .timer-display .t{ font-size: 40px; }
    .timer-display.countdown .t{ font-size: 48px; }

    .count-area{
      gap: 16px;
      padding: 12px 0 4px;
    }
    .count-btn{
      width: 72px;
      height: 72px;
      font-size: 32px;
      touch-action: manipulation;
      -webkit-tap-highlight-color: transparent;
    }
    .count-value{
      font-size: 56px;
      min-width: 90px;
    }

    .ready-row{
      flex-direction: column;
      align-items: stretch;
      gap: 8px;
    }
    .ready-toggle{
      justify-content: center;
      min-height: 44px;
    }
    .ready-row .pill{
      align-self: flex-start;
    }
    .judge-actions{
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
    }
    .judge-actions .btn{
      width: 100%;
      min-height: 44px;
      touch-action: manipulation;
    }

    /* Scoreboard */
    .board-card{ min-height: 160px; padding: 14px; }
    .board-card .count{ font-size: 34px; }
    .fullscreen-card{ padding: 18px 14px; gap: 16px; border-radius: 14px; }
    .fullscreen-card .fs-top{ flex-direction: column; gap: 10px; }
    .fullscreen-card .fs-athlete{ gap: 12px; }
    .fullscreen-card .fs-dot{ width: 52px; height: 52px; }
    .fullscreen-card .fs-name{ font-size: 22px; line-height: 1.15; }
    .fs-body{ grid-template-columns: 1fr; gap: 10px; }
    .fs-panel{ padding: 14px; }
    .fs-panel .big{ font-size: clamp(40px, 14vw, 64px); }
    .fs-meta{ gap: 14px 18px; }

    /* Links */
    .link-row{
      flex-direction: column;
      align-items: stretch;
      gap: 8px;
      padding: 14px 0;
    }
    .link-row .llabel{ min-width: 0; }
    .link-row input{ min-width: 0; width: 100%; }
    .link-row .btn,
    .link-row a.btn{
      width: 100%;
      text-align: center;
      min-height: 42px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }

    .sync-banner{ width: calc(100% - 24px); margin-top: 10px; }
    .login-gate{ margin: 40px 16px; padding: 20px 16px; }
  }

  /* Very small phones */
  @media (max-width: 380px){
    .platform-edit .grid3,
    .platform-edit .grid2,
    .stat-row,
    .toolbar-actions,
    .judge-actions{
      grid-template-columns: 1fr;
    }
    nav.views{ grid-template-columns: 1fr; }
    #judge-view .plat-tabs{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .count-btn{ width: 64px; height: 64px; }
    .count-value{ font-size: 48px; min-width: 72px; }
  }

  /* ---------- Bulk upload + multi edit ---------- */
  .bulk-help{ font-size:13px; color:var(--text-dim); line-height:1.55; margin:0 0 14px; }
  .bulk-grid{ display:grid; grid-template-columns: minmax(0,2fr) minmax(0,.8fr) minmax(0,1.2fr); gap:12px; }
  .bulk-grid input[type=file]{ padding:7px 9px; }
  .bulk-result{ margin-top:14px; font-size:13px; line-height:1.55; }
  .bulk-result.ok{ color:var(--green); font-weight:600; }
  .bulk-result.err{ color:var(--pink); font-weight:600; }
  .multi-flight-head{
    font-family: var(--font-head); font-size:13px; letter-spacing:.08em; text-transform:uppercase;
    color: var(--accent); margin: 22px 0 10px; display:flex; align-items:center; gap:8px;
  }
  .multi-flight-head::after{ content:''; flex:1; height:1px; background: var(--line); }
  .multi-flight-head:first-child{ margin-top:4px; }
  .multi-row{
    padding:14px; margin-bottom:10px; border:1px solid var(--line); border-radius:12px; background: var(--panel);
  }
  .multi-row.has-error{ border-color: var(--pink); background:#fff7f8; }
  .multi-row.removed{ opacity:.45; }
  .multi-row.removed .athlete-form-grid{ pointer-events:none; }
  .multi-row-top{ display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; font-size:12px; color:var(--text-faint); }
  .multi-row-top .btn{ padding:4px 10px; }
  .multi-row .field.bad input, .multi-row .field.bad select{ border-color: var(--pink); }
  .multi-row-errors{ margin-top:8px; font-size:12px; color: var(--pink); font-weight:600; }
  .multi-add-row{ margin: 4px 0 6px; }
  @media (max-width: 640px){ .bulk-grid{ grid-template-columns:1fr; } }
  .flight-day-select{ flex:0 0 auto; width:auto; min-width:96px; }
  .flights-day-head{
    font-family: var(--font-head); font-size:13px; letter-spacing:.08em; text-transform:uppercase;
    color: var(--accent); margin: 18px 0 8px; display:flex; align-items:center; gap:8px;
  }
  .flights-day-head::after{ content:''; flex:1; height:1px; background: var(--line); }
  .flights-day-head:first-child{ margin-top:0; }
  .athletes-filter-bar select.athletes-day-filter{ min-width: 140px; }
  .athletes-bulk-bar{
    display:flex; align-items:center; gap:14px; flex-wrap:wrap;
    padding:10px 14px; margin-bottom:12px; border:1px solid var(--line); border-radius:12px; background: var(--panel);
    font-size:13px;
  }
  .athletes-bulk-all{ display:flex; align-items:center; gap:8px; cursor:pointer; font-weight:600; color: var(--text); }
  .athletes-bulk-all input, .athlete-pick input{ width:16px; height:16px; cursor:pointer; }
  .athletes-bulk-count{ color: var(--text-dim); }
  .athletes-bulk-bar .btn{ margin-left:auto; }
  .athlete-pick{ display:flex; align-items:center; justify-content:center; gap:6px; font-size:12px; color: var(--text-dim); cursor:pointer; padding:4px 0; }
  .athlete-strip.picked{ border-color: var(--pink); background:#fff7f8; }
  .flights-day-filter{
    min-width:130px; background:#fff; border:1px solid var(--line); color:var(--text);
    padding:7px 10px; border-radius:8px; font-family:var(--font-body); font-size:13px;
  }
  .flight-strip.picked{ border-color: var(--pink); background:#fff7f8; }

  /* ---------- Setup: live timers per platform + Match clock strip ---------- */
  .clock-strip{ display:grid; grid-template-columns:repeat(6, minmax(0,1fr)); gap:10px; margin-top:14px; }
  .clock-strip:empty{ display:none; }
  .cs-chip{ border:1px solid var(--line); border-radius:10px; padding:8px 10px; text-align:center; background:var(--bg); }
  .cs-p{ font-family:var(--font-head); font-size:12px; color:var(--text-dim); letter-spacing:.06em; }
  .cs-t{ font-family:var(--font-num); font-size:19px; font-weight:700; margin-top:2px; color:var(--text-dim); }
  .cs-chip.run{ background:var(--green-soft); border-color:#b7e4cb; } .cs-chip.run .cs-t{ color:var(--green); }
  .cs-chip.warn{ background:#fdeef1; border-color:#f4c6ce; } .cs-chip.warn .cs-t{ color:var(--pink); }
  .cs-chip.cd{ background:var(--accent-soft); border-color:#c9dafc; } .cs-chip.cd .cs-t{ color:var(--accent); }
  .cs-chip.up .cs-t{ color:var(--pink); font-size:14px; padding:4px 0; }
  .cs-chip.idle .cs-t{ color:var(--text-faint); font-size:14px; padding:4px 0; }
  .cs-chip.stopped .cs-t{ color:var(--text); }

  .setup-timer{ border-radius:12px; padding:10px 14px; margin:0 0 14px; border:1px solid var(--line); background:var(--bg); }
  .setup-timer .st-row{ display:flex; align-items:baseline; justify-content:space-between; gap:8px; }
  .setup-timer .st-big{ font-family:var(--font-num); font-size:28px; font-weight:700; line-height:1.1; color:var(--text); }
  .setup-timer .st-lbl{ font-size:11px; text-transform:uppercase; letter-spacing:.06em; color:var(--text-dim); min-height:14px; }
  .setup-timer .st-reps{ font-family:var(--font-num); font-size:12px; color:var(--text-dim); text-align:right; }
  .setup-timer .st-reps b{ font-size:20px; color:var(--text); }
  .setup-timer .st-bar{ height:6px; border-radius:99px; background:var(--line); margin-top:8px; overflow:hidden; }
  .setup-timer .st-bar i{ display:block; height:100%; width:0; border-radius:99px; background:var(--green); transition:width .25s linear; }
  .setup-timer.run{ background:var(--green-soft); border-color:#b7e4cb; } .setup-timer.run .st-big{ color:var(--green); }
  .setup-timer.warn{ background:#fdeef1; border-color:#f4c6ce; } .setup-timer.warn .st-big{ color:var(--pink); } .setup-timer.warn .st-bar i{ background:var(--pink); }
  .setup-timer.cd{ background:var(--accent-soft); border-color:#c9dafc; } .setup-timer.cd .st-big{ color:var(--accent); font-size:24px; }
  .setup-timer.up{ background:#fdeef1; border-color:#f4c6ce; } .setup-timer.up .st-big{ color:var(--pink); font-size:22px; } .setup-timer.up .st-bar i{ background:var(--pink); }
  .setup-timer.idle .st-big{ color:var(--text-faint); font-size:22px; }
  .setup-timer.stopped .st-bar i{ background:var(--text-faint); }
  @media (max-width: 900px){ .clock-strip{ grid-template-columns:repeat(3, minmax(0,1fr)); } }

  /* ---------- Finished / Stopped status ---------- */
  .pill.finished{ background:#2b2f3a; color:#fff; }
  .pill.stopped{ background:#e9ebf0; color:#4b5260; }
  .ready-toggle.finished{ border-color:#2b2f3a; color:#fff; background:#2b2f3a; cursor:default; }
  .ready-toggle.stopped{ border-color:var(--line-lit); color:#4b5260; background:#e9ebf0; cursor:default; }

  .bulk-grid.bulk-grid-date-first{ grid-template-columns: minmax(0,1fr) minmax(0,2fr) minmax(0,1.2fr); }
  .bulk-grid input[type=file]:disabled{ opacity:.5; cursor:not-allowed; }
  .bulk-result.err{ white-space:pre-line; }
  @media (max-width: 640px){ .bulk-grid.bulk-grid-date-first{ grid-template-columns:1fr; } }

  /* ---------- DD/MM/YYYY date box ---------- */
  .dmy-wrap{ position:relative; display:flex; align-items:stretch; gap:0; width:100%; min-width:0; }
  .dmy-wrap .dmy-text{ flex:1 1 auto; min-width:0; width:100%; border-top-right-radius:0; border-bottom-right-radius:0; font-variant-numeric: tabular-nums; }
  .dmy-wrap .dmy-text.bad{ border-color: var(--pink); }
  .dmy-wrap .dmy-btn{
    flex:0 0 auto; border:1px solid var(--line); border-left:none; background:var(--panel); cursor:pointer;
    padding:0 12px; border-radius:0 8px 8px 0; font-size:16px; line-height:1;
  }
  .dmy-wrap .dmy-btn:hover{ background: var(--card-hi); }
  .dmy-wrap .dmy-native{ position:absolute; right:0; bottom:0; width:40px; height:100%; opacity:0; pointer-events:none; border:0; padding:0; }
  .flights-compose-row .dmy-wrap{ width:auto; flex:0 0 190px; }

/* Judge screen: stop pull-to-refresh / bounce so a swipe can't reload the page mid-set */
html.no-pull,
html.no-pull body {
  overscroll-behavior: none;
  overscroll-behavior-y: none;
}

/* Judge screen: no double-tap zoom anywhere (fast +/- taps), no text selection callouts */
html.no-pull,
html.no-pull * {
  touch-action: manipulation;
}
html.no-pull button,
html.no-pull .judge-console {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
