/* Home page: the live demo hero and the sections after it. */

/* MARK: Hero */
.hero { padding-bottom: clamp(3rem, 7vw, 6rem); overflow: hidden; }
.hero-copy { display: grid; grid-template-columns: 1.25fr 1fr; gap: 1.5rem 4rem; align-items: end; padding-block: clamp(1.5rem, 5vw, 4rem) clamp(2.5rem, 5vw, 4rem); }
.hero-copy h1 { color: var(--night-text); }
.hero-side { display: grid; gap: 1.5rem; justify-items: start; }
.hero-side .lede { color: var(--night-soft); }
@media (max-width: 860px) { .hero-copy { grid-template-columns: 1fr; } }

.stage { position: relative; }
.stage .tv { position: relative; width: 80%; margin-left: 20%; isolation: isolate; z-index: 1; }
.stage .phone { position: absolute; left: 0; bottom: -7%; width: 23%; isolation: isolate; z-index: 2; }
.frame-img { position: relative; z-index: 2; pointer-events: none; width: 100%; filter: drop-shadow(0 40px 50px rgba(0, 0, 0, .45)); }
.stage-hint { display: flex; align-items: center; gap: .75rem; margin-top: clamp(3rem, 8vw, 6.5rem); margin-left: 25%; color: var(--night-soft); font-weight: 600; }
.stage-hint .button { margin-left: auto; }
.stage-hint[hidden] { display: none; }
@media (max-width: 760px) {
    .stage .tv { width: 100%; margin-left: 0; }
    .stage .phone { position: relative; left: auto; bottom: auto; width: 64%; margin: -6% auto 0; }
    .stage-hint { margin: 1.5rem 0 0; justify-content: center; text-align: center; flex-wrap: wrap; }
    .stage-hint .button { margin-left: 0; }
}

/* Screens sit under the frame image, inside its transparent screen area. */
.screen { position: absolute; z-index: 1; overflow: hidden; container-type: inline-size; }
.tv .screen { left: 2.3953%; top: 4.2806%; width: 89.3023%; height: 77.6978%; }
.phone .screen { left: 5.102%; top: 2.2%; width: 89.796%; height: 95.6%; border-radius: 14.4% / 6.6%; }

/* MARK: TV scoreboard (matches TallyPal on Apple TV) */
.tv-board {
    position: absolute; inset: 0;
    padding: 2.6cqw 4.4cqw 3.4cqw;
    display: grid; grid-template-rows: auto 1fr; gap: 2.2cqw;
    color: #0F1117;
    background:
        radial-gradient(60% 70% at 0% 0%, #FFE1E3, transparent 70%),
        radial-gradient(60% 70% at 100% 100%, #DCE8FF, transparent 70%),
        #FBFBFD;
    font-family: system-ui, -apple-system, sans-serif;
}
.tv-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 2cqw; }
.tv-title { display: flex; align-items: center; gap: 1.4cqw; min-width: 0; }
.game-icon { width: 4.4cqw; height: 4.4cqw; border-radius: 1.1cqw; background: #FFDDE0; color: #F2394A; display: grid; place-items: center; flex: none; }
.game-icon .mask-icon { width: 60%; height: 60%; }
.tv-title > div > strong { display: block; font-size: 2.5cqw; font-weight: 700; letter-spacing: -0.01em; line-height: 1.1; }
.tv-title > div > span { display: block; font-size: 1.3cqw; color: #6B7080; }
.tv-title .won { color: #A87700; font-weight: 700; }
.timer-chip { display: flex; align-items: center; gap: 1cqw; padding: .8cqw 2.2cqw; border-radius: 99cqw; background: #DDF5E3; color: #1E9E49; }
.timer-chip svg { width: 2.4cqw; height: 2.4cqw; }
.timer-chip b { display: block; font-family: var(--score); font-size: 2.4cqw; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.timer-chip small { display: block; font-size: 1.05cqw; font-weight: 700; letter-spacing: .04em; }
.tv-live { justify-self: end; display: grid; justify-items: end; gap: .5cqw; }
.tv-live .live { font-size: 1.3cqw; }
.tv-live .live.final { background: rgba(15, 17, 23, .08); color: #0F1117; }
.tv-live .live.final::before { display: none; }
.tv-live small { font-size: 1.25cqw; color: #6B7080; }

.tv-grid { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 1.8cqw; min-height: 0; }
.tv-tile {
    background: #fff; border-radius: 1.6cqw; padding: 1.6cqw 1.8cqw 1.4cqw;
    display: grid; grid-template-rows: auto auto 1fr; min-height: 0;
    box-shadow: 0 .2cqw .8cqw rgba(15, 17, 23, .06), inset 0 0 0 .1cqw rgba(15, 17, 23, .04);
}
.tv-tile.leader { box-shadow: inset 0 0 0 .22cqw var(--gold), 0 .2cqw .8cqw rgba(15, 17, 23, .06); }
.tile-top { display: flex; align-items: center; gap: .9cqw; }
.crown { width: 2.4cqw; height: 2.4cqw; color: #F5B800; display: none; }
.leader .crown { display: block; }
.avatar { width: 3cqw; height: 3cqw; border-radius: 50%; background: var(--c); color: #fff; display: grid; place-items: center; font-size: 1.15cqw; font-weight: 700; flex: none; }
.tile-top .name { font-size: 2.1cqw; font-weight: 600; }
.change { margin-left: auto; padding: .25cqw .8cqw; border-radius: 99cqw; font-size: 1.3cqw; font-weight: 700; background: #DDF5E3; color: #1E9E49; font-family: var(--score); }
.change.down { background: #FFE2E4; color: #D9313B; }
.change:empty { visibility: hidden; }
.bar { height: .45cqw; border-radius: 1cqw; margin-top: 1.1cqw; background: color-mix(in srgb, var(--c) 22%, #fff); overflow: hidden; }
.bar i { display: block; height: 100%; width: var(--p, 0%); background: var(--c); border-radius: inherit; transition: width .45s cubic-bezier(.3, .8, .3, 1); }
.tile-score { display: flex; align-items: flex-end; justify-content: space-between; gap: 1cqw; min-height: 0; }
.tile-score .num { font-family: var(--score); font-size: 8.4cqw; font-weight: 700; line-height: .9; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tile-score .togo { font-size: 1.35cqw; color: #6B7080; padding-bottom: .5cqw; }
.confetti { position: absolute; inset: 0; z-index: 3; pointer-events: none; width: 100%; height: 100%; }

/* MARK: Phone (matches TallyPal on iPhone) */
.phone-ui {
    position: absolute; inset: 0;
    background: #F2F2F7; color: #0F1117;
    font-family: system-ui, -apple-system, sans-serif;
    padding: 0 3.6cqw;
    display: grid; grid-template-rows: auto auto auto 1fr; gap: 2.6cqw;
}
.status { display: flex; justify-content: space-between; align-items: center; height: 12.5cqw; padding: 2cqw 5cqw 0; font-size: 4cqw; font-weight: 600; }
.status svg { height: 3.4cqw; width: auto; }
.status .icons { display: flex; gap: 1.4cqw; align-items: center; }
.nav { display: flex; align-items: center; gap: 3cqw; }
.nav .back { width: 10cqw; height: 10cqw; border-radius: 50%; background: #fff; display: grid; place-items: center; box-shadow: 0 .3cqw 1cqw rgba(0, 0, 0, .06); }
.nav .back svg { width: 3.6cqw; }
.nav strong { display: block; font-size: 4.4cqw; font-weight: 700; line-height: 1.15; }
.nav span { display: block; font-size: 2.9cqw; color: #6B7080; }
.timer-row { display: flex; align-items: center; gap: 2.6cqw; background: #fff; border-radius: 99cqw; padding: 2cqw 2cqw 2cqw 3.4cqw; }
.timer-row .ring { width: 6.6cqw; height: 6.6cqw; border-radius: 50%; border: 1.2cqw solid #34C759; flex: none; }
.timer-row b { display: block; font-family: var(--score); font-size: 4.6cqw; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.timer-row small { display: block; font-size: 2.7cqw; color: #6B7080; }
.timer-row .pause { margin-left: auto; width: 10cqw; height: 10cqw; border-radius: 50%; background: #34C759; display: grid; place-items: center; }
.timer-row .pause::before { content: ""; width: 3.2cqw; height: 3.4cqw; border-inline: 1.1cqw solid #fff; box-sizing: border-box; }
.phone-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3cqw; align-content: start; }
.p-tile { background: #fff; border-radius: 5cqw; padding: 3.2cqw 3cqw 3cqw; display: grid; gap: 1.8cqw; }
.p-tile.leader { box-shadow: inset 0 0 0 .5cqw var(--gold); }
.p-tile .tile-top { gap: 1.8cqw; }
.p-tile .crown { width: 5cqw; height: 5cqw; }
.p-tile .avatar { width: 6.6cqw; height: 6.6cqw; font-size: 2.6cqw; }
.p-tile .name { font-size: 4.2cqw; font-weight: 600; }
.p-tile .bar { height: 1cqw; margin-top: 0; }
.p-tile .num { font-family: var(--score); font-size: 11.6cqw; font-weight: 700; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.p-tile .change { margin: 0; justify-self: start; font-size: 2.6cqw; padding: .5cqw 1.6cqw; }
.p-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 2cqw; }
.p-buttons button {
    border: 0; cursor: pointer; height: 12cqw; border-radius: 3.4cqw;
    display: grid; place-items: center;
    background: color-mix(in srgb, var(--c) 18%, #fff); color: var(--c);
    -webkit-tap-highlight-color: transparent;
    transition: transform .12s ease;
}
.p-buttons button.plus { background: var(--c); color: #fff; }
.p-buttons button svg { width: 4.4cqw; height: 4.4cqw; }
.p-buttons button:active { transform: scale(.94); }
.p-buttons button:focus-visible { outline: .8cqw solid var(--blue); outline-offset: .5cqw; }
@media (prefers-reduced-motion: reduce) { .p-buttons button { transition: none; } .bar i { transition: none; } }

/* The "End the game?" alert the app shows when someone reaches the target. */
.alert-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .28); display: grid; place-items: center; padding: 10cqw; z-index: 2; }
.alert-scrim[hidden] { display: none; }
.alert { color: #0F1117; background: rgba(250, 250, 252, .97); border-radius: 6cqw; width: 100%; text-align: center; overflow: hidden; box-shadow: 0 4cqw 10cqw rgba(0, 0, 0, .25); }
.alert-body { padding: 5cqw 5cqw 4cqw; display: grid; gap: 1.4cqw; }
.alert-body strong { font-size: 4.4cqw; }
.alert-body p { font-size: 3.4cqw; color: #3C3F48; line-height: 1.35; }
.alert-actions { display: grid; grid-template-columns: 1fr 1fr; border-top: .25cqw solid #D7D9E0; }
.alert-actions button { border: 0; background: none; padding: 3.4cqw 0; font-size: 4cqw; color: #0A6CFF; cursor: pointer; }
.alert-actions button + button { border-left: .25cqw solid #D7D9E0; font-weight: 700; }

/* MARK: Sections */
.rules-head { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem 4rem; align-items: end; margin-bottom: 2.5rem; }
@media (max-width: 860px) { .rules-head { grid-template-columns: 1fr; } }
.rules-more { margin-top: .5rem; font-weight: 700; }

/* Scroll story: the phone stays put while its screen changes. */
.story { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(2rem, 6vw, 6rem); }
.story-phone { position: sticky; top: max(2rem, calc(50vh - 22rem)); align-self: start; height: min(44rem, 88vh); display: grid; place-items: center; }
.story-phone .stack { position: relative; height: 100%; aspect-ratio: 640 / 1306; }
.story-phone img { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity .35s ease; }
.story-phone img.on { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .story-phone img { transition: none; } }
.story-steps { list-style: none; margin: 0; padding: 0; }
.story-steps li { min-height: 78vh; display: grid; align-content: center; gap: 1rem; max-width: 30rem; }
.story-steps li:first-child { min-height: 60vh; align-content: start; padding-top: 12vh; }
.story-steps .kicker { font-family: var(--score); font-weight: 800; font-size: 1rem; color: var(--ink-soft); }
.story-steps h3 { font-family: var(--wide); font-stretch: 125%; font-weight: 850; font-size: clamp(1.75rem, 3vw, 2.5rem); letter-spacing: -0.03em; line-height: 1; }
.story-steps p { color: var(--ink-soft); font-size: 1.125rem; }
.story-steps .inline-shot { display: none; }
@media (max-width: 860px) {
    .story { grid-template-columns: 1fr; }
    .story-phone { display: none; }
    .story-steps li, .story-steps li:first-child { min-height: 0; padding: 0 0 3.5rem; }
    .story-steps .inline-shot { display: block; width: min(70%, 18rem); margin-top: .5rem; }
}

/* The whole table: iPad big enough to bleed off the page edge. */
.table-section { overflow: hidden; }
.table-grid { display: grid; grid-template-columns: 1fr 1.6fr; gap: clamp(2rem, 5vw, 5rem); align-items: center; }
.table-grid .bleed { width: 118%; max-width: none; }
.duo-row { display: grid; grid-template-columns: 1fr 1.4fr .55fr; gap: clamp(1.5rem, 4vw, 3.5rem); align-items: end; margin-top: clamp(4rem, 8vw, 7rem); }
.duo-row .split-copy { align-self: center; }
@media (max-width: 900px) {
    .table-grid { grid-template-columns: 1fr; }
    .table-grid .bleed { width: 108%; }
    .duo-row { grid-template-columns: 1.6fr .6fr; }
    .duo-row .split-copy { grid-column: 1 / -1; }
}

/* Head-to-head: Free and Premium as two teams on a broadcast stat graphic. */
.h2h { border-radius: 28px; padding: clamp(1.5rem, 4vw, 3rem); }
.h2h-teams { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 1rem; padding-bottom: 1.25rem; border-bottom: 3px solid var(--night-text); }
.h2h-teams div { font-family: var(--wide); font-stretch: 125%; font-weight: 850; font-size: clamp(1.5rem, 3.4vw, 2.75rem); letter-spacing: -0.03em; line-height: 1; }
.h2h-teams div:last-child { text-align: right; }
.h2h-teams small { display: block; font-family: var(--body); font-stretch: 100%; font-size: .9375rem; font-weight: 600; letter-spacing: 0; color: var(--night-soft); margin-top: .5rem; }
.h2h-teams .vs { font-family: var(--score); font-weight: 800; color: var(--night-soft); font-size: 1rem; padding-bottom: .4rem; }
.h2h-rows { list-style: none; margin: 0; padding: 0; }
.h2h-rows li { display: grid; grid-template-columns: 1fr 1.4fr 1fr; align-items: center; padding-block: .85rem; border-bottom: 1px solid rgba(238, 240, 250, .14); }
.h2h-rows li > span { font-family: var(--score); font-weight: 800; font-size: clamp(1.125rem, 2.2vw, 1.75rem); }
.h2h-rows li > span:last-child { text-align: right; color: var(--gold); }
.h2h-rows li > span.same { color: var(--night-text); }
.h2h-rows li > span.none { color: rgba(238, 240, 250, .35); }
.h2h-rows li > em { font-style: normal; text-align: center; color: var(--night-soft); font-size: .9375rem; }
.h2h-prices { display: flex; flex-wrap: wrap; gap: .75rem 2.25rem; margin-top: 1.75rem; color: var(--night-soft); }
.h2h-prices b { color: var(--night-text); font-family: var(--score); font-size: 1.25rem; margin-right: .25rem; }
.h2h-note { margin-top: 1rem; font-size: .875rem; color: var(--night-soft); }
@media (max-width: 600px) {
    .h2h-rows li { grid-template-columns: 1fr 1fr; gap: .25rem 1rem; }
    .h2h-rows li > em { grid-column: 1 / -1; grid-row: 1; text-align: left; }
}

/* "It already knows the rules": every game drifting past in three rows, faded at the edges. */
.rules-drift {
    display: grid; gap: .875rem; margin-inline: -1.25rem; padding-block: .5rem;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
}
.rules-row {
    display: flex; gap: .875rem; width: max-content; list-style: none; margin: 0; padding: 0;
    animation: rules-drift calc(var(--n) * 3.2s) linear infinite;
}
.rules-row:nth-child(2) { animation-direction: reverse; animation-duration: calc(var(--n) * 3.8s); }
.rules-row:nth-child(3) { animation-duration: calc(var(--n) * 2.8s); }
.rules-drift:hover .rules-row, .rules-drift:focus-within .rules-row { animation-play-state: paused; }
/* The list repeats once, so sliding by half (plus half a gap) lands on the seam exactly. */
@keyframes rules-drift { to { transform: translateX(calc(-50% - .4375rem)); } }

.rules-tile {
    display: flex; align-items: center; gap: .75rem; flex: none;
    padding: .625rem 1.125rem .625rem .625rem; border-radius: 999px;
    background: var(--card); box-shadow: 0 0 0 1px var(--rule);
}
.rules-glyph {
    width: 2.75rem; height: 2.75rem; border-radius: 50%; flex: none; display: grid; place-items: center;
    color: var(--tint); background: color-mix(in srgb, var(--tint) 13%, transparent);
}
.rules-glyph .mask-icon { width: 58%; height: 58%; }
.rules-glyph .letter { font-family: var(--wide); font-stretch: 125%; font-weight: 900; font-size: 1.25rem; line-height: 1; }
.rules-glyph .suit { font-size: 1.4rem; line-height: 1; font-family: system-ui, sans-serif; }
.rules-text { display: grid; line-height: 1.2; white-space: nowrap; }
.rules-text b { font-size: .9375rem; font-weight: 700; }
.rules-text small { font-size: .8125rem; color: var(--ink-soft); }

@media (prefers-reduced-motion: reduce) {
    /* No drift: each row scrolls by hand, without the repeated half. */
    .rules-row { animation: none; width: auto; overflow-x: auto; padding-inline: 1.25rem; scrollbar-width: none; }
    .rules-row > [aria-hidden="true"] { display: none; }
}
