/* ─────────────────────────────────────────────────────────────
   COMPONENTS — shared building blocks (Lift language)
   ───────────────────────────────────────────────────────────── */

/* ── SCREENS ── */
.screen {
  position: relative; z-index: 1;
  height: 100%; height: 100svh;
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden; overflow-x: clip;
  -webkit-overflow-scrolling: touch;
  width: 100%; max-width: 560px; margin: 0 auto;
}
.screen > * { flex-shrink: 0; }
.screen-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.screen-foot {
  position: sticky; bottom: 0; z-index: 8; margin-top: auto;
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 8px;
  background: linear-gradient(180deg, rgba(11,11,12,0) 0%, rgba(11,11,12,.85) 28%, var(--bg) 60%);
}
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }

/* ── GLASS TOP BAR ── */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--hair);
  min-height: 56px;
}
.topbar-title { font-family: var(--display); font-weight: 800; font-size: 19px; text-transform: uppercase; letter-spacing: .03em; text-align: center; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-brand { display: flex; align-items: center; gap: 9px; }
.topbar-logo { height: 30px; width: 30px; object-fit: contain; }
.topbar-wordmark { font-family: var(--display); font-weight: 800; font-size: 17px; text-transform: uppercase; letter-spacing: .04em; }
.topbar-spacer { width: 38px; flex-shrink: 0; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-size: 18px; line-height: 1;
  background: linear-gradient(180deg, var(--s2-top), var(--s2-bot));
  box-shadow: inset 0 1px 0 var(--edge), 0 4px 10px -4px rgba(0,0,0,.8);
  color: var(--text2);
  transition: transform .12s var(--spring);
}
.icon-btn:active { transform: scale(.9); }
.icon-btn svg { width: 17px; height: 17px; }

/* ── BUTTONS ── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 15px 16px; border-radius: var(--r-sm);
  font-size: 15px; font-weight: 700; letter-spacing: .01em; text-align: center;
  transition: transform .12s var(--spring), box-shadow .15s, filter .15s;
}
.btn:active:not(:disabled) { transform: translateY(1px) scale(.985); }
.btn-lime {
  color: #10140A;
  background: linear-gradient(180deg, var(--lime-hi), var(--lime));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 10px 22px -10px rgba(158,194,40,.7);
}
.btn-lime:hover { filter: brightness(1.05); }
.btn-ghost {
  color: var(--text);
  background: linear-gradient(180deg, var(--s2-top), var(--s2-bot));
  box-shadow: inset 0 1px 0 var(--edge), 0 6px 14px -10px rgba(0,0,0,.9);
}
.btn-outline { color: var(--text2); background: transparent; box-shadow: inset 0 0 0 1px var(--hair-2); }
.btn-outline:hover { color: var(--text); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.btn-danger { color: var(--bad); background: transparent; box-shadow: inset 0 0 0 1px rgba(224,85,85,.35); }
.btn-sm { width: auto; padding: 9px 14px; font-size: 13px; border-radius: 10px; }
.btn-xs { width: auto; padding: 6px 10px; font-size: 12px; border-radius: 8px; font-weight: 600; }
.btn-back { width: auto; padding: 8px 12px 8px 10px; font-size: 13px; border-radius: 999px; color: var(--text2); background: rgba(255,255,255,.06); box-shadow: inset 0 1px 0 var(--edge); }
/* Broadcast-cut button for big moments */
.btn-cut { clip-path: polygon(0 0, 100% 0, calc(100% - 12px) 100%, 0 100%); border-radius: 6px; font-family: var(--display); font-size: 19px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }

/* ── LIFT CARD ── */
.card {
  background: linear-gradient(180deg, var(--s1-top), var(--s1-bot));
  border-radius: var(--r);
  box-shadow: inset 0 1px 0 var(--edge), var(--shadow-card);
}
.card-pad { padding: 16px; }
.card-tap { cursor: pointer; transition: transform .14s var(--spring); text-align: left; width: 100%; display: block; }
.card-tap:active { transform: scale(.985); }
.card.selected, .card-tap.selected {
  box-shadow: inset 0 1px 0 var(--edge), inset 0 0 0 1.5px var(--lime), 0 10px 26px -14px rgba(158,194,40,.55);
  background: linear-gradient(180deg, #232a14, #171a12);
}

.section-label {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 18px 16px 8px;
  font-size: 10px; letter-spacing: .2em; text-transform: uppercase; font-weight: 700; color: var(--text3);
}
.page-note { font-size: 13px; color: var(--text2); padding: 14px 16px 8px; }

/* ── FIELDS ── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; font-weight: 700; color: var(--text2); }
.input, .field input, select.input {
  width: 100%; padding: 13px 14px; border-radius: var(--r-sm);
  background: var(--well); color: var(--text);
  border: 1px solid rgba(255,255,255,.06);
  box-shadow: inset 0 2px 4px rgba(0,0,0,.55);
  outline: none; font-size: 16px;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .field input:focus { border-color: rgba(158,194,40,.7); box-shadow: inset 0 2px 4px rgba(0,0,0,.55), 0 0 0 3px rgba(158,194,40,.15); }
.code-input {
  text-align: center; font-family: var(--display); font-weight: 800; font-size: 44px; letter-spacing: .3em;
  text-transform: uppercase; color: var(--lime); padding: 16px 8px 16px calc(8px + .3em);
}
.error-msg {
  background: rgba(224,85,85,.1); border: 1px solid rgba(224,85,85,.3); border-radius: var(--r-xs);
  padding: 10px 13px; font-size: 13px; color: var(--bad);
}
.error-msg.ok { background: rgba(88,200,136,.1); border-color: rgba(88,200,136,.3); color: var(--good); }

/* ── CHIPS / PILLS ── */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: rgba(255,255,255,.06); color: var(--text2); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.chip b { color: var(--text); font-weight: 700; }
.chip-acc { background: color-mix(in srgb, var(--acc) 16%, transparent); color: var(--acc); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--acc) 35%, transparent); }
.chip-gold { background: rgba(201,168,76,.14); color: var(--gold-hi); box-shadow: inset 0 0 0 1px rgba(201,168,76,.35); }
.chip-bad { background: rgba(224,85,85,.12); color: #FF8A80; box-shadow: inset 0 0 0 1px rgba(224,85,85,.35); }
.chip-lime { background: rgba(158,194,40,.12); color: var(--lime-hi); box-shadow: inset 0 0 0 1px rgba(158,194,40,.35); }
.tag {
  display: inline-block; font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 6px;
  text-transform: uppercase; letter-spacing: .08em; background: rgba(255,255,255,.06); color: var(--text2);
}
.mode-badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11px; letter-spacing: .16em; text-transform: uppercase; font-weight: 800;
  padding: 6px 12px 6px 9px; border-radius: 999px;
  color: var(--acc-ink); background: linear-gradient(135deg, var(--acc), var(--acc2));
  box-shadow: 0 6px 18px -6px var(--acc-glow), inset 0 1px 0 rgba(255,255,255,.45);
  white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.toggle-pill {
  font-size: 10px; font-weight: 800; letter-spacing: .08em; padding: 4px 8px; border-radius: 6px;
  background: rgba(255,255,255,.05); color: var(--text3); box-shadow: inset 0 0 0 1px var(--hair-2);
}
.toggle-pill.off { color: var(--bad); box-shadow: inset 0 0 0 1px rgba(224,85,85,.4); }

/* ── PLAYER CHIP (emoji avatar in player color ring) ── */
.pchip {
  --pc: var(--lime);
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-size: 19px; line-height: 1;
  background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--pc) 30%, #1b1b1e), #141416 75%);
  box-shadow: inset 0 0 0 2px var(--pc), 0 4px 10px -4px rgba(0,0,0,.8);
}
.pchip.sm { width: 28px; height: 28px; font-size: 14px; box-shadow: inset 0 0 0 1.5px var(--pc); }
.pchip.lg { width: 56px; height: 56px; font-size: 28px; }
.pdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--pc, var(--lime)); flex-shrink: 0; }

/* ── SCORE SHAPES (circles under par, squares over) ── */
.glyph {
  position: relative; display: inline-grid; place-items: center;
  width: 42px; height: 42px; flex-shrink: 0;
  font-family: var(--display); font-weight: 800; font-size: 28px; line-height: 1;
  font-variant-numeric: tabular-nums; color: var(--text);
}
.glyph > span { position: relative; z-index: 1; }
.glyph::before, .glyph::after { content: ''; position: absolute; pointer-events: none; border: 2px solid transparent; }
.glyph::before { inset: 3px; }
.glyph::after { inset: -1px; }
.glyph.birdie::before, .glyph.eagle::before, .glyph.eagle::after { border-color: currentColor; border-radius: 50%; }
.glyph.birdie::before { background: rgba(158,194,40,.10); }
.glyph.eagle::before { background: rgba(158,194,40,.14); }
.glyph.ace::before { border-radius: 50%; background: var(--text); border-color: var(--text); }
.glyph.ace > span { color: var(--bg); }
.glyph.ace::after { border-color: var(--lime); border-radius: 50%; inset: -2px; }
.glyph.bogey::before, .glyph.double::before, .glyph.double::after { border-color: currentColor; border-radius: 4px; }
.glyph.bogey::before { background: rgba(224,110,85,.10); }
.glyph.double::before { background: rgba(224,85,85,.16); }
.glyph.none { color: var(--text3); }
.glyph.sm { width: 28px; height: 28px; font-size: 17px; }
.glyph.sm::before { inset: 2px; border-width: 1.5px; }
.glyph.sm::after { inset: -1px; border-width: 1.5px; }
.glyph.sm.ace::after { inset: -2px; }
.glyph.bump { animation: bump .34s var(--spring); }
@keyframes bump { 0% { transform: none; } 35% { transform: translateY(-4px) scale(1.14); } 100% { transform: none; } }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text2); align-items: center; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }

/* ── LIST ROWS ── */
.list { display: flex; flex-direction: column; gap: 8px; padding: 0 16px; }
.list-card { display: flex; align-items: center; gap: 12px; padding: 13px 14px; }
.list-card .main { flex: 1; min-width: 0; }
.list-card .t { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-card .s { font-size: 12px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-card .side { text-align: right; flex-shrink: 0; }
.list-card .side .w { font-size: 13px; font-weight: 700; color: var(--lime); max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-card .side .l { font-size: 10px; color: var(--text3); letter-spacing: .12em; text-transform: uppercase; font-weight: 700; }
.empty { text-align: center; padding: 34px 20px; color: var(--text3); font-size: 14px; line-height: 1.7; }
.accent-rail { position: relative; overflow: hidden; }
.accent-rail::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--rail, var(--lime)); }
.live-badge {
  display: inline-flex; align-items: center; gap: 5px; margin-left: 6px; vertical-align: middle;
  font-size: 9px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 5px; color: #10140A; background: var(--lime);
}

/* ── OVERLAYS & SHEETS ── */
.overlay {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(0,0,0,.72);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .2s ease-out;
}
.overlay.center { align-items: center; padding: 24px; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 560px;
  background: linear-gradient(180deg, #212125, #151517 40%);
  border-radius: 24px 24px 0 0;
  box-shadow: inset 0 1px 0 var(--edge), var(--shadow-pop);
  padding: 12px 16px calc(24px + env(safe-area-inset-bottom, 0px));
  max-height: 92svh; overflow-y: auto; overflow-x: hidden;
  animation: sheet-up .32s var(--ease-out);
}
.sheet::before { content: ''; display: block; width: 38px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.18); margin: 0 auto 16px; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: .4; } }
.sheet-title { font-family: var(--display); font-weight: 800; font-size: 28px; text-transform: uppercase; line-height: 1; margin-bottom: 6px; letter-spacing: .01em; }
.sheet-sub { font-size: 13px; color: var(--text2); margin-bottom: 18px; line-height: 1.55; }
.dialog {
  width: 100%; max-width: 360px; padding: 20px;
  background: linear-gradient(180deg, #232327, #18181a);
  border-radius: var(--r-lg); box-shadow: inset 0 1px 0 var(--edge), var(--shadow-pop);
  animation: pop .28s var(--spring);
}
@keyframes pop { from { transform: scale(.92); opacity: 0; } }

/* ── DRAWER ── */
.drawer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.66); z-index: 50; display: flex; justify-content: flex-end; animation: fade .2s; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.drawer {
  width: 300px; max-width: 88vw; height: 100%;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 18px calc(24px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 18px; overflow-y: auto;
  background: linear-gradient(180deg, #1c1c1f, #121214);
  box-shadow: inset 1px 0 0 var(--edge), -20px 0 50px -10px rgba(0,0,0,.8);
  animation: slide-in .3s var(--ease-out);
}
@keyframes slide-in { from { transform: translateX(40px); opacity: .5; } }
.avatar-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.avatar-option {
  aspect-ratio: 1; border-radius: 10px; font-size: 20px; display: grid; place-items: center;
  background: rgba(255,255,255,.04); box-shadow: inset 0 0 0 1px transparent; transition: background .1s;
}
.avatar-option:hover { background: rgba(255,255,255,.08); }
.avatar-option.selected { background: rgba(158,194,40,.14); box-shadow: inset 0 0 0 1.5px var(--lime); }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { padding: 12px 14px; }
.stat .v { font-family: var(--display); font-weight: 800; font-size: 30px; line-height: 1; color: var(--lime-hi); font-variant-numeric: tabular-nums; }
.stat .k { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; font-weight: 700; color: var(--text3); margin-top: 4px; }
.mini-btn { padding: 6px 10px; font-size: 12px; font-weight: 600; border-radius: 8px; color: var(--text2); box-shadow: inset 0 0 0 1px var(--hair-2); }

/* ── TOAST (event notice) ── */
.toast-host { position: fixed; left: 0; right: 0; top: calc(64px + env(safe-area-inset-top, 0px)); z-index: 400; display: flex; justify-content: center; pointer-events: none; padding: 0 12px; }
.toast {
  width: 100%; max-width: 520px;
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r);
  background: rgba(34,34,38,.78);
  -webkit-backdrop-filter: blur(20px) saturate(1.5); backdrop-filter: blur(20px) saturate(1.5);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 20px 40px -12px rgba(0,0,0,.9);
  transform: translateY(-14px) scale(.96); opacity: 0;
  transition: transform .38s var(--spring), opacity .25s;
}
.toast.show { transform: none; opacity: 1; }
.toast .ti { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; font-size: 19px; background: linear-gradient(135deg, var(--acc), var(--acc2)); color: var(--acc-ink); }
.toast .tt { font-family: var(--display); font-weight: 800; font-size: 19px; text-transform: uppercase; line-height: 1.05; }
.toast .ts { font-size: 12px; color: var(--text2); }

/* ── BIG MOMENT FLASH (Broadcast) ── */
.flash { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 24px; background: rgba(8,8,10,.86); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); animation: fade .2s; cursor: pointer; }
.flash-card { width: 100%; max-width: 380px; text-align: left; animation: flash-in .45s var(--spring); }
@keyframes flash-in { 0% { transform: translateX(-30px) skewX(-6deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
.flash-kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--display); font-weight: 800; font-style: italic; font-size: 16px; letter-spacing: .1em; text-transform: uppercase;
  padding: 6px 22px 6px 12px; color: var(--acc-ink);
  background: linear-gradient(180deg, var(--acc), var(--acc2));
  clip-path: polygon(0 0, 100% 0, calc(100% - 12px) 100%, 0 100%);
}
.flash-plate {
  margin-top: 6px; padding: 18px 26px 18px 18px;
  background: linear-gradient(180deg, #252a35, #171a22);
  border-left: 4px solid var(--acc);
  clip-path: polygon(0 0, 100% 0, calc(100% - 18px) 100%, 0 100%);
  box-shadow: var(--shadow-pop);
}
.flash-big { font-family: var(--display); font-weight: 800; font-size: 76px; line-height: .9; letter-spacing: -.01em; color: var(--acc); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.flash-big.long { font-size: 40px; line-height: 1; }
.flash-name { font-family: var(--display); font-weight: 800; font-size: 26px; text-transform: uppercase; letter-spacing: .02em; margin-top: 6px; line-height: 1.05; display: flex; align-items: center; gap: 10px; }
.flash-list { display: flex; flex-direction: column; gap: 4px; font-family: var(--body); text-transform: none; letter-spacing: 0; font-size: 16px; font-weight: 700; margin-top: 4px; }
.flash-list span { display: flex; justify-content: space-between; gap: 16px; }
.flash-list b { font-family: var(--display); font-size: 20px; font-weight: 800; }
.flash-label { font-size: 14px; color: var(--text2); margin-top: 6px; line-height: 1.5; }
.flash-dismiss { margin-top: 14px; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--text3); font-weight: 700; }

/* ── LOADING ── */
.loading-overlay { position: fixed; inset: 0; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 999; gap: 14px; }
.loading-ring { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--hair-2); border-top-color: var(--lime); animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── BANNERS ── */
.banner {
  position: fixed; left: 0; right: 0; z-index: 600;
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  background: rgba(24,24,27,.9); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
.banner.top { top: 0; padding-top: calc(12px + env(safe-area-inset-top, 0px)); box-shadow: inset 0 -1px 0 rgba(158,194,40,.5); }
.banner.bottom { bottom: 0; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); box-shadow: inset 0 1px 0 var(--edge), 0 -10px 30px -10px #000; }
.banner .bt { font-weight: 700; font-size: 14px; }
.banner .bs { font-size: 12px; color: var(--text3); }

/* ── CONFETTI ── */
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); opacity: 0; } }
