@import url('fonts/fonts.css');

:root {
  --ground: #0a1224; --panel: #121f3a; --panel-2: #182a4d; --line: #2a3c63;
  --ink: #f3f5fa; --muted: #98a6c2; --red: #e5484d; --blue: #4c8dff; --yellow: #f6c549; --stamp: #e02d3c;
  --display: 'Karantina', 'Arial Hebrew', Impact, sans-serif;
  --body: 'Heebo', 'Arial Hebrew', Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--ground); color: var(--ink); font-family: var(--body); -webkit-text-size-adjust: 100%; }
body { overscroll-behavior: none; }
button { font-family: inherit; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

#app { position: relative; height: 100dvh; max-width: 560px; margin-inline: auto; display: grid; grid-template-rows: auto 1fr auto; overflow: hidden;
  touch-action: manipulation;
  background: radial-gradient(120% 60% at 50% 0%, #16284d 0%, var(--ground) 60%); }
.bug { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  font-family: var(--display); font-size: 22px; background: #07101f; border-bottom: 2px solid var(--line); }
.bug-a { color: var(--red); } .bug-b { color: var(--blue); } .bug b { font-variant-numeric: tabular-nums; }
.bug-title { font-size: 16px; letter-spacing: .12em; color: var(--muted); }
#stage { position: relative; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; padding: 16px; display: flex; flex-direction: column; }
body.is-host #stage { padding-block-end: calc(96px + env(safe-area-inset-bottom)); }
.ticker { overflow: hidden; background: #07101f; border-top: 2px solid var(--yellow); padding-bottom: env(safe-area-inset-bottom); }
body.is-free .ticker { display: none; }
.ticker-track { display: flex; gap: 48px; width: max-content; padding: 8px 0; white-space: nowrap; font-size: 14px; color: var(--muted); animation: tick 120s linear infinite; }
.ticker-track b { color: var(--yellow); margin-inline-end: 6px; }
@keyframes tick { from { transform: translateX(0); } to { transform: translateX(50%); } }
.stepno { position: absolute; inset-block-end: calc(40px + env(safe-area-inset-bottom)); inset-inline-start: 8px; font-size: 11px; color: var(--muted); opacity: .7; font-variant-numeric: tabular-nums; }
.status { position: absolute; inset-block-start: 56px; inset-inline: 16px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 10px; border-radius: 6px; background: #3a1418; border: 1px solid var(--red); font-size: 14px; }
.status button, .free-back { font: 700 14px var(--body); background: var(--ink); color: var(--ground); border: 0; border-radius: 4px; padding: 6px 10px; }

.host { position: absolute; inset-inline: 0; inset-block-end: 0; z-index: 10; display: grid; grid-template-columns: auto 1fr auto auto auto; gap: 6px; align-items: center;
  padding: 8px; padding-bottom: max(8px, env(safe-area-inset-bottom)); background: rgba(4, 9, 18, .94); border-top: 1px solid var(--line); }
.host button { font: 700 16px var(--body); min-height: 44px; padding: 10px 14px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); }
.host .small { padding-inline: 10px; }
.host button:disabled { opacity: .4; }
.host .next { background: var(--yellow); border-color: var(--yellow); color: #1b1400; }
.host-info { font-size: 12px; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.host-msg { grid-column: 1 / -1; margin: 0; font-size: 12px; color: var(--red); }
body.is-host .ticker, body.is-host .stepno { visibility: hidden; }

.gate { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 24px; text-align: center; background: var(--ground); }
.gate-eyebrow { margin: 0; font-size: 13px; letter-spacing: .2em; color: var(--yellow); }
.gate h1 { margin: 0; font-family: var(--display); font-size: 48px; line-height: 1; }
.gate input { width: 100%; max-width: 240px; margin-inline: auto; padding: 12px; font: 700 32px var(--body); letter-spacing: .3em; text-align: center; color: var(--ink); background: var(--panel); border: 2px solid var(--line); border-radius: 8px; }
.gate button { width: 100%; max-width: 240px; margin-inline: auto; padding: 12px; font: 700 20px var(--body); color: #1b1400; background: var(--yellow); border: 0; border-radius: 8px; }
.gate-error { min-height: 1.4em; margin: 0; color: var(--red); }
.gate-hint { margin: 0; font-size: 14px; color: var(--muted); }

.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.panel { display: flex; flex-direction: column; gap: 10px; }
.center { flex: 1; align-items: center; justify-content: center; text-align: center; }
.eyebrow { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .14em; color: var(--yellow); }
.muted { color: var(--muted); }
.team-A { --team: var(--red); } .team-B { --team: var(--blue); }
.quote { margin: 0; padding: 8px 12px; background: var(--panel); border: 1px solid var(--line); border-inline-start: 3px solid var(--team, var(--line)); border-radius: 12px 12px 12px 3px; }
.quote-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 12px; color: var(--muted); }
.quote-meta b { color: var(--ink); }
.quote blockquote { margin: 0; font-size: 17px; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; }
.quote.big blockquote { font-size: 16px; line-height: 1.4; }
.avatar { position: relative; flex: none; display: inline-grid; place-items: center; overflow: hidden; border-radius: 50%; font-weight: 700; background: var(--panel-2); border: 2px solid var(--team, var(--line)); }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-s { width: 24px; height: 24px; font-size: 10px; border-width: 1px; } .avatar-m { width: 44px; height: 44px; font-size: 15px; } .avatar-xl { width: 128px; height: 128px; font-size: 40px; }
.lower-third { align-self: flex-start; display: inline-flex; flex-direction: column; padding: 6px 14px; color: var(--ground); background: var(--ink); border-inline-start: 6px solid var(--yellow); }
.lower-third strong { font-family: var(--display); font-size: 26px; line-height: 1; }
.lower-third span { font-size: 13px; }
.fallback { justify-content: center; text-align: center; font-family: var(--display); font-size: 40px; }

.enter .drop, .drop.enter { animation: drop .45s cubic-bezier(.2, .8, .2, 1) both; animation-delay: var(--d, 0ms); }
@keyframes drop { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition: none !important; }
  .ticker-track { animation: none; }
}

/* Broadcast screens */
.sting { justify-content: center; align-items: center; text-align: center; gap: 16px; }
.sting-logo { width: min(46vw, 180px); height: auto; max-height: 38dvh; object-fit: contain; align-self: center; background: #fff; border-radius: 18px; padding: 12px; }
.sting-title { margin: 0; font-family: var(--display); font-size: clamp(60px, 20vw, 116px); line-height: .85; }
.sting-sub { margin: 0; font-size: 20px; }
.speech { justify-content: center; }
.final-score { justify-content: center; gap: 16px; }
.score-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.score-team { display: flex; flex-direction: column; gap: 4px; padding: 14px; background: var(--panel); border-top: 6px solid var(--team); }
.score-team span { font-weight: 700; color: var(--muted); }
.score-team b { font-family: var(--display); font-size: 64px; line-height: .9; color: var(--team); font-variant-numeric: tabular-nums; }
.score-team.team-B b { font-size: 44px; }
.score-note { margin: 0; font-size: 18px; }
.funnel { justify-content: center; }
.funnel ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.funnel li { display: grid; gap: 4px; }
.funnel-stage { font-weight: 700; }
.funnel-bar { display: flex; gap: 3px; height: 38px; }
.funnel-bar i { min-width: 2.4em; display: flex; align-items: center; justify-content: center; font-style: normal; font-family: var(--display); font-size: 26px; background: var(--team); font-variant-numeric: tabular-nums; }
.funnel-legend { display: flex; gap: 16px; margin: 0; } .funnel-legend b { color: var(--team); }
.break { justify-content: center; align-items: center; text-align: center; }
.break h1 { margin: 0; font-family: var(--display); font-size: clamp(48px, 16vw, 84px); line-height: .95; }
.break p { margin: 0; font-size: 18px; color: var(--muted); }
.award { justify-content: center; }
.award-title { margin: 0; font-family: var(--display); font-size: clamp(38px, 11vw, 60px); line-height: .95; color: var(--yellow); text-wrap: balance; }
.award-winner { display: flex; align-items: center; gap: 12px; font-size: 20px; }
.award-line { margin: 0; font-size: 18px; font-weight: 700; }
.closing { justify-content: center; }
.verdict, .signoff { margin: 0; font-family: var(--display); font-size: clamp(44px, 14vw, 76px); line-height: .95; text-wrap: balance; }

/* Stamp (shared with player screens) */
.stamp { pointer-events: none; display: grid; place-items: center; }
.stamp span { display: inline-block; padding: 2px 16px; font-family: var(--display); font-size: 56px; line-height: 1; color: var(--stamp);
  border: 5px solid var(--stamp); border-radius: 8px; background: rgba(10, 18, 36, .55); transform: rotate(-12deg); }
.stamp-full span { font-size: clamp(56px, 18vw, 96px); }
.stamp.enter span, .enter .stamp span { animation: stamp .55s cubic-bezier(.2, .9, .3, 1.25) both; animation-delay: var(--d, 0ms); }
@keyframes stamp {
  0% { opacity: 0; transform: scale(2.4) rotate(-12deg); }
  70% { opacity: 1; transform: scale(.94) rotate(-12deg); }
  100% { opacity: 1; transform: scale(1) rotate(-12deg); }
}

/* Player card */
.fut { position: relative; display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-top: 4px solid var(--team); border-radius: 14px;
  background: linear-gradient(160deg, #1c3263, #0f1b35 70%); }
.fut-top { display: flex; align-items: center; gap: 12px; }
.fut-id { display: grid; gap: 2px; min-width: 0; }
.fut-nick { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: .06em; color: var(--yellow); }
.fut h2 { margin: 0; font-family: var(--display); font-size: 56px; line-height: .9; overflow-wrap: anywhere; }
.fut-tag { margin: 0; font-size: 18px; color: var(--muted); }
.fut-compact { padding-block: 8px; }
.fut-compact h2 { font-size: 32px; }
.fut-compact .fut-tag { font-size: 14px; }
.fut-stats { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.fut-stats li { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 4px 8px; font-size: 17px; line-height: 1.25; }
.fut-stats span { color: var(--muted); }
.fut-stats b { font-variant-numeric: tabular-nums; text-align: end; }
.bar { grid-column: 1 / -1; display: block; height: 10px; overflow: hidden; border-radius: 5px; background: #0a1224; }
.bar > i { display: block; height: 100%; width: calc(var(--v) * 1%); background: var(--yellow); }
.enter .bar > i { animation: fill 1.05s ease-out both; animation-delay: var(--d, 0ms); }
@keyframes fill { from { width: 0; } }
.stamp-card { position: absolute; inset: 0; }
.stamp-card span { font-size: clamp(56px, 22vw, 96px); border-width: clamp(5px, 1.8vw, 8px); padding: 4px clamp(12px, 5vw, 22px); }
.fut:has(.stamp.enter) { animation: thud .35s .45s both; }
@keyframes thud {
  0%, 100% { transform: none; }
  20% { transform: translate(8px, 4px) rotate(1.5deg); }
  40% { transform: translate(-8px, -3px) rotate(-1.5deg); }
  60% { transform: translate(6px, -4px) rotate(1deg); }
  80% { transform: translate(-4px, 2px) rotate(-.5deg); }
}
.screen-player > .panel, .screen-ghost > .panel { flex: 1; justify-content: center; }
.charges { margin: 0; padding-inline-start: 24px; display: grid; gap: 12px; font-size: 20px; font-weight: 700; }
.charges li::marker { color: var(--red); }
.var-check { align-self: center; margin: 0; padding: 3px 12px; font-weight: 700; letter-spacing: .1em; color: #1b1400; background: var(--yellow); }
.var-verdict { align-self: center; margin: 0; font-family: var(--display); font-size: 30px; line-height: 1; color: var(--red); text-align: center; text-wrap: balance; }
.reality-fact { display: grid; gap: 2px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-inline-start: 3px solid var(--yellow); }
.reality-fact span { font-size: 12px; color: var(--muted); }

/* Yarkoni's VAR room */
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.cards li { display: grid; grid-template-columns: auto auto auto 1fr; align-items: center; gap: 8px; font-size: 15px; }
.ref-card { display: inline-block; width: 18px; height: 25px; border-radius: 3px; transform: rotate(-8deg); }
.ref-card.yellow { background: var(--yellow); } .ref-card.red { background: var(--red); }
.ref-card.big { width: 40px; height: 56px; }
.clock { margin: 0; font-family: var(--display); font-size: 52px; line-height: 1; text-align: center; color: var(--yellow); }
.last-card { margin: 0; display: flex; align-items: center; justify-content: center; gap: 14px; font-family: var(--display); font-size: 46px; }

/* Free mode */
.free { display: flex; flex-direction: column; gap: 12px; padding-bottom: 24px; }
.free-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.free-head h1 { margin: 0; font-family: var(--display); font-size: 40px; line-height: 1; }
.free-tabs { position: sticky; top: 0; z-index: 2; display: flex; gap: 6px; overflow-x: auto; padding-block: 8px; background: var(--ground); scrollbar-width: none; }
.free-tabs button { flex: none; padding: 6px 14px; font: 700 15px var(--body); color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; }
.free-tabs button[aria-selected="true"] { color: #1b1400; background: var(--yellow); border-color: var(--yellow); }
.free-list { display: grid; gap: 10px; }
.free-player { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; padding: 10px; text-align: start;
  font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.free-player .avatar { grid-row: 1 / 3; }
.free-player b { font-size: 18px; } .free-player span { font-size: 14px; color: var(--muted); }
.free-card { display: grid; gap: 8px; padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.free-card p { margin: 0; }
.free-card h3, .free-profile h3 { margin: 0; font-family: var(--display); font-size: 30px; line-height: 1; color: var(--yellow); }
.free-winner { font-weight: 700; }
.free-profile { display: grid; gap: 14px; }
.free-profile section { display: grid; gap: 8px; }
.free-profile .free-back { justify-self: start; }
.free-profile .stamp span { font-size: 44px; border-width: 5px; padding: 2px 16px; opacity: .9; }
