:root {
    color-scheme: light;
    --ink: #102a43;
    --muted: #61758a;
    --line: #d9e2ec;
    --paper: #f5f7fa;
    --white: #fff;
    --accent: #e8a124;
    --accent-dark: #bd7711;
    --green: #17845c;
    --tms-primary: #145da0;
    --tms-surface: #fff;
    --tms-border: #d9e2ec;
    --tms-text: #102a43;
    --tms-text-secondary: #61758a;
    --tms-player1: #0072b2;
    --tms-player1-dark: #005a8e;
    --tms-player2: #a9490a;
    --tms-player2-dark: #833a08;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--paper);
    color: var(--ink);
}

* { box-sizing: border-box; }

html, body { min-width: 320px; min-height: 100%; margin: 0; }
body { line-height: 1.5; }
button, input, select { font: inherit; }
a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.site-shell { min-height: 100vh; display: flex; flex-direction: column; }
.site-header {
    width: min(1160px, calc(100% - 48px));
    height: 82px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand-group { display: inline-flex; align-items: center; gap: 1rem; min-width: 0; }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; font-size: 1.25rem; font-weight: 800; letter-spacing: -.04em; }
.brand-mark { display: block; width: 40px; height: 40px; border-radius: 11px; background: var(--ink); }
.site-header nav { display: flex; gap: 30px; font-size: .92rem; color: var(--muted); }
.site-header nav a, .site-footer a { text-decoration: none; }
.site-header nav a:hover, .site-footer a:hover { color: var(--ink); }
.site-header nav .tester-nav-link {
    padding: .42rem .8rem;
    border-radius: 999px;
    background: var(--ink);
    color: var(--white);
    font-size: .84rem;
    font-weight: 700;
    white-space: nowrap;
}
.site-header nav .tester-nav-link:hover { background: #1b4668; color: var(--white); }
.tester-nav-short { display: none; }
.tester-signup { scroll-margin-top: 1.5rem; }
.language-menu { position: relative; }
.language-menu summary { display: inline-flex; align-items: center; gap: 6px; min-width: 2.75rem; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); font-size: .75rem; font-weight: 700; cursor: pointer; list-style: none; white-space: nowrap; }
.language-menu summary::-webkit-details-marker { display: none; }
.language-menu summary::after { content: ""; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.language-menu[open] summary::after { transform: translateY(1px) rotate(-135deg); }
.language-menu summary:focus-visible { outline: 2px solid var(--tms-primary); outline-offset: 2px; }
.language-menu ul { position: absolute; z-index: 20; top: calc(100% + 8px); right: 0; display: grid; grid-template-columns: repeat(3, minmax(7.5rem, 1fr)); gap: 2px; width: max-content; max-width: calc(100vw - 32px); margin: 0; padding: 8px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 18px 40px rgba(16, 42, 67, .16); list-style: none; }
.language-menu a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: .86rem; white-space: nowrap; }
.language-menu a:hover { background: #eaf0f5; }
.language-menu a.language-active { color: #fff; background: var(--ink); }
.language-menu a:focus-visible { outline: 2px solid var(--tms-primary); outline-offset: 2px; }
main { flex: 1; }

.tms-preview {
    width: min(1160px, calc(100% - 48px));
    margin: 64px auto;
    padding-block: 32px;
    border-block: 1px solid var(--line);
}

.tms-preview-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 24px;
}

.tms-preview-heading h2 { margin: 0; font-size: clamp(1.5rem, 4vw, 2rem); }
.tms-preview-status { padding: 5px 12px; border-radius: 6px; background: #fbe8bd; color: #604009; font-weight: 700; }
.tms-preview-lede { max-width: 72ch; margin: 20px 0 28px; }
.tms-preview-roles { display: flex; flex-wrap: wrap; gap: 24px 48px; margin: 0; }
.tms-preview-roles div { flex: 1 1 260px; max-width: 52ch; }
.tms-preview-roles dt { font-weight: 700; }
.tms-preview-roles dd { margin: 8px 0 0; }
.tms-preview-note { max-width: 72ch; margin: 28px 0 0; font-size: .92rem; color: #52677b; }
.tester-signup { max-width: 760px; margin-top: 40px; }
.tester-signup h3 { margin: 0; font-size: 1.35rem; }
.tester-signup > p { max-width: 66ch; margin: 10px 0 20px; }
.tester-signup-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tester-signup-fields label { display: grid; gap: 6px; font-weight: 650; }
.tester-signup-fields input { width: 100%; min-height: 46px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--white); color: var(--ink); }
.tester-signup-email { grid-column: 1 / -1; }
.tester-signup-consent { display: flex; align-items: flex-start; gap: 10px; margin-top: 18px; line-height: 1.55; }
.tester-signup-consent input { flex: 0 0 20px; width: 20px; height: 20px; margin-top: 2px; accent-color: var(--tms-primary); }
.tester-signup-submit { margin-top: 20px; }
.tester-signup-honeypot { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tester-signup :focus-visible { outline: 3px solid var(--tms-primary); outline-offset: 3px; }
.tester-signup .notice { margin: 16px 0; }
@media (max-width: 560px) {
    .tester-signup-fields { grid-template-columns: 1fr; }
    .tester-signup-email { grid-column: auto; }
}

.scorekeeper-mode-picker {
    display: flex;
    flex: 0 1 auto;
    align-items: center;
    gap: 2px;
    min-width: 0;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--white);
}

.scorekeeper-mode-active,
.scorekeeper-mode-upcoming {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    min-width: 0;
    padding: .35rem .65rem;
    border-radius: 999px;
    font-size: .76rem;
    line-height: 1.25;
    font-weight: 650;
    white-space: nowrap;
}

.scorekeeper-mode-active {
    background: var(--ink);
    color: var(--white);
}

.scorekeeper-mode-upcoming {
    color: var(--muted);
}

.scorekeeper-mode-upcoming small {
    padding: .1rem .35rem;
    border-radius: 999px;
    background: var(--paper);
    color: #52677b;
    font-size: .64rem;
    font-weight: 600;
}

.hero {
    width: min(1160px, calc(100% - 48px));
    min-height: 470px;
    margin: 0 auto;
    padding: 60px 7.5%;
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    align-items: center;
    gap: 70px;
    border-radius: 28px;
    color: #fff;
    background: radial-gradient(ellipse at 82% 12%, #28506d 0, transparent 42%), linear-gradient(130deg, #102a43, #173d58);
    overflow: hidden;
}
.eyebrow { margin: 0 0 13px; color: var(--accent-dark); font-size: .75rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.hero .eyebrow { color: #f5bd55; }
.hero h1 { max-width: 560px; margin: 0; font-size: clamp(2.6rem, 5vw, 4.4rem); line-height: 1.02; letter-spacing: -.065em; }
.hero-lede { max-width: 450px; margin: 22px 0 27px; color: #d8e3ec; font-size: 1.13rem; }
.button { min-height: 48px; border: 0; border-radius: 12px; padding: 0 20px; display: inline-flex; align-items: center; justify-content: center; gap: 12px; font-weight: 750; text-decoration: none; cursor: pointer; transition: transform .15s ease, background .15s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #152b3f; background: var(--accent); }
.button-primary:hover { background: #f2b340; }
.hero-note { margin: 13px 0 0; color: #b8c8d5; font-size: .82rem; }
.hero-score { width: min(100%, 330px); justify-self: center; padding: 25px 29px 20px; border: 1px solid rgba(255,255,255,.14); border-radius: 24px; background: rgba(5, 20, 32, .62); box-shadow: 0 26px 55px rgba(0,0,0,.2); transform: rotate(2deg); }
.live-indicator { display: inline-flex; align-items: center; gap: 8px; color: #a5b7c5; font-size: .65rem; font-weight: 800; letter-spacing: .13em; }
.live-indicator::before { width: 7px; height: 7px; border-radius: 100%; background: #53d49a; content: ""; }
.preview-player { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; }
.preview-player span, .preview-divider span, .preview-sets span { color: #9aafbf; font-size: .67rem; font-weight: 750; letter-spacing: .1em; }
.preview-player strong { color: #fff; font-size: 3.2rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.preview-divider { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-top: 1px solid rgba(255,255,255,.12); border-bottom: 1px solid rgba(255,255,255,.12); }
.preview-divider i { color: #6d8598; font-style: normal; }
.preview-sets { display: flex; justify-content: space-between; padding-top: 15px; }
.preview-sets b { color: var(--accent); font-size: .85rem; }

.feature-strip { width: min(1080px, calc(100% - 64px)); margin: 68px auto 76px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 35px; }
.feature-strip > div { min-width: 0; }
.feature-icon { display: inline-grid; place-items: center; width: 42px; height: 42px; margin-bottom: 18px; border-radius: 14px; color: var(--ink); background: #f4e8d3; font-size: .77rem; font-weight: 850; }
.feature-strip h2 { margin: 0 0 8px; font-size: 1.05rem; letter-spacing: -.025em; }
.feature-strip p { margin: 0; color: var(--muted); font-size: .9rem; }
.android-showcase { width: min(1080px, calc(100% - 64px)); margin: 0 auto 76px; }
.android-showcase-heading { max-width: 680px; margin-bottom: 32px; }
.android-showcase-heading h2 { margin: 0 0 12px; font-size: clamp(1.7rem, 3vw, 2.4rem); line-height: 1.15; letter-spacing: -.035em; }
.android-showcase-heading p { margin: 0; color: var(--muted); }
.android-screenshots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.android-screenshots figure { min-width: 0; margin: 0; }
.android-screenshots a { display: block; border-radius: 12px; }
.android-screenshots img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--white); }
.android-screenshots figcaption { margin-top: 14px; font-size: .9rem; font-weight: 700; }
.closing-cta { width: min(1080px, calc(100% - 64px)); margin: 0 auto 72px; padding: 30px 36px; display: flex; align-items: center; justify-content: space-between; gap: 25px; border-radius: 22px; background: #e8edf2; }
.closing-cta .eyebrow { margin-bottom: 6px; }
.closing-cta h2 { margin: 0; font-size: 1.55rem; letter-spacing: -.04em; }
.button-light { color: var(--ink); background: #fff; }

.site-footer { width: min(1160px, calc(100% - 48px)); min-height: 75px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--muted); font-size: .82rem; }

.counter-page { width: min(1100px, calc(100% - 40px)); min-height: 70vh; margin: 45px auto 70px; }
.counter-loading { padding: 60px 20px; text-align: center; color: var(--muted); }
.counter-setup { max-width: 680px; margin: 0 auto; padding: 36px 42px 42px; border: 1px solid var(--line); border-radius: 22px; background: var(--white); box-shadow: 0 12px 32px rgba(16,42,67,.05); }
.counter-setup h1, .match-toolbar h1, .legal-page h1 { margin: 0; font-size: clamp(2rem, 5vw, 3rem); line-height: 1.08; letter-spacing: -.055em; }
.setup-lede { margin: 13px 0 27px; color: var(--muted); }
.setup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.setup-grid label, .sets-select { display: grid; gap: 8px; color: var(--ink); font-size: .88rem; font-weight: 700; }
.setup-grid input, .sets-select select { width: 100%; min-height: 49px; border: 1px solid #bdcbd7; border-radius: 10px; padding: 0 13px; outline: none; background: #fff; color: var(--ink); }
.setup-grid input:focus, .sets-select select:focus { border-color: #3377a8; box-shadow: 0 0 0 3px rgba(51,119,168,.13); }
.sport-picker { min-width: 0; margin: 25px 0 19px; padding: 0; border: 0; }
.sport-picker legend { margin-bottom: 11px; font-size: .88rem; font-weight: 750; }
.sport-choice { display: inline-flex; align-items: center; min-width: 190px; gap: 10px; margin: 0 9px 8px 0; padding: 12px 15px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.sport-choice input { accent-color: var(--green); }
.sport-choice span { display: grid; gap: 1px; }
.sport-choice strong { font-size: .9rem; }
.sport-choice small { color: var(--muted); font-size: .75rem; }
.sets-select { max-width: 260px; margin: 12px 0 24px; }
.setup-start { width: 100%; margin-top: 15px; }

.match-toolbar { margin: 0 auto 21px; display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.match-toolbar .eyebrow { margin-bottom: 5px; }
.button-quiet { border: 1px solid var(--line); color: var(--ink); background: #fff; }
.button-quiet:hover { background: #f0f4f7; }
.button-danger { color: #fff; background: #b42318; }
.match-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(240px, .7fr); align-items: start; gap: 20px; }
.shared-scoreboard, .match-tools { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.shared-scoreboard { --tms-primary: #145da0; }
.match-tools { display: grid; gap: 22px; }
.notice { margin: 14px 0; padding: 13px 16px; border-radius: 11px; font-size: .9rem; }
.notice-warning { border: 1px solid #f2d493; color: #704b0a; background: #fff8e8; }
.notice-success { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid #a8dfc5; color: #125b40; background: #edfbf4; }
.text-button { border: 0; padding: 3px 0; color: #125b40; background: transparent; font-weight: 750; text-decoration: underline; cursor: pointer; }
.dialog-backdrop { position: fixed; z-index: 1000; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(7, 22, 36, .58); }
.confirm-dialog { width: min(440px, 100%); padding: 26px; border-radius: 18px; background: #fff; box-shadow: 0 24px 65px rgba(0,0,0,.25); }
.confirm-dialog h2 { margin: 0; font-size: 1.35rem; }
.confirm-dialog p { color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

.legal-page { width: min(780px, calc(100% - 40px)); margin: 45px auto 80px; padding: 38px 44px; border: 1px solid var(--line); border-radius: 20px; background: #fff; }
.legal-page h1 { margin-bottom: 5px; }
.legal-page .legal-updated { margin: 0 0 30px; color: var(--muted); font-size: .85rem; }
.legal-page h2 { margin: 30px 0 7px; font-size: 1.17rem; letter-spacing: -.025em; }
.legal-page p { color: #42586b; }
.legal-page a { color: #155d8a; }
.configuration-warning { padding: 12px 14px; border: 1px solid #f2d493; border-radius: 10px; color: #704b0a !important; background: #fff8e8; }
.legal-note { margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line); font-size: .88rem; }

.blazor-error-boundary { margin: 20px; padding: 16px; border-radius: 10px; color: white; background: #a61b1b; }
#blazor-error-ui { display: none; position: fixed; z-index: 2000; right: 0; bottom: 0; left: 0; padding: 14px 24px; color: #fff; background: #a61b1b; }
#blazor-error-ui .dismiss { float: right; cursor: pointer; }
#blazor-error-details { display: none; max-height: 35vh; overflow: auto; margin: 12px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; }

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #2577ad; outline-offset: 3px; }

@media (max-width: 760px) {
    .site-header { width: calc(100% - 32px); height: 68px; }
    .site-header.scorekeeper-header { height: auto; min-height: 68px; flex-wrap: wrap; row-gap: .5rem; padding-block: .5rem; }
    .scorekeeper-header nav { margin-left: auto; }
    .site-header nav { gap: 12px; font-size: .84rem; }
    .site-header nav .tester-nav-link { padding: .36rem .65rem; }
    /* The studio runs on the OBS computer; phones pair from the scorekeeper. */
    .site-header nav .broadcast-nav-link { display: none; }
    .hero { width: calc(100% - 24px); min-height: auto; padding: 42px 26px; grid-template-columns: 1fr; gap: 34px; border-radius: 21px; }
    .hero-score { justify-self: start; width: min(100%, 360px); transform: none; }
    .feature-strip { width: calc(100% - 40px); margin: 48px auto; grid-template-columns: repeat(2, 1fr); gap: 28px 20px; }
    .android-showcase { width: calc(100% - 40px); margin-bottom: 48px; }
    .android-screenshots { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 20px; }
    .closing-cta { width: calc(100% - 32px); margin-bottom: 42px; padding: 25px; align-items: flex-start; flex-direction: column; }
    .site-footer { width: calc(100% - 32px); min-height: 67px; }
    .counter-page { width: calc(100% - 24px); margin: 23px auto 45px; }
    .counter-setup { padding: 28px 22px; }
    .setup-grid { grid-template-columns: 1fr; }
    .match-toolbar { align-items: flex-end; }
    .match-toolbar .button { min-height: 42px; padding: 0 12px; font-size: .86rem; }
    .match-layout { grid-template-columns: 1fr; }
    .shared-scoreboard, .match-tools { padding: 13px; }
    .legal-page { width: calc(100% - 24px); margin: 23px auto 45px; padding: 28px 22px; }
}

@media (max-width: 560px) {
    /* The brand and the navigation do not fit on one phone row; the navigation gets its own. */
    .site-header { height: auto; min-height: 68px; flex-wrap: wrap; row-gap: .5rem; padding-block: .6rem; }
    .site-header nav { width: 100%; align-items: center; justify-content: space-between; gap: 10px; }
}

@media (max-width: 400px) {
    .tester-nav-full { display: none; }
    .language-menu ul { grid-template-columns: repeat(2, minmax(0, 1fr)); width: calc(100vw - 32px); }
    .tester-nav-short { display: inline; }
    .scorekeeper-header .brand-group { gap: .5rem; }
    .scorekeeper-header .brand { gap: 8px; font-size: 1.08rem; }
    .scorekeeper-header .brand-mark { width: 32px; height: 32px; border-radius: 9px; }
    .scorekeeper-header .scorekeeper-mode-picker { gap: 1px; padding: 2px; }
    .scorekeeper-header .scorekeeper-mode-active,
    .scorekeeper-header .scorekeeper-mode-upcoming { padding: .3rem .4rem; font-size: .7rem; }
    .scorekeeper-header .scorekeeper-mode-upcoming small {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        clip-path: inset(50%);
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .android-screenshots { grid-template-columns: minmax(0, 330px); justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Broadcast to OBS (RALLYO_BROADCAST_ENABLED). */
.broadcast-panel { display: grid; gap: 12px; }
.counter-setup .broadcast-panel { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.broadcast-panel h2 { margin: 0; font-size: 1.05rem; }
.broadcast-lede, .broadcast-privacy, .broadcast-hint { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.45; }
.broadcast-privacy { padding: 10px 12px; border-radius: 10px; color: var(--ink); background: var(--paper); }
.broadcast-field { display: grid; gap: 5px; font-size: .85rem; font-weight: 700; }
.broadcast-field input, .broadcast-field select { min-width: 0; width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; font: inherit; font-weight: 400; color: var(--ink); background: #fff; }
.broadcast-link { font-family: ui-monospace, Consolas, monospace; font-size: .8rem !important; }
.broadcast-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.broadcast-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.broadcast-status { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 800; }
.broadcast-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); }
.broadcast-status.is-live .broadcast-dot { box-shadow: 0 0 0 4px rgba(23, 132, 92, .18); }
.broadcast-status.is-retrying { color: #704b0a; }
.broadcast-status.is-retrying .broadcast-dot { background: var(--accent); }
.broadcast-status-top { margin: 0 0 12px; }
@media (max-width: 420px) { .broadcast-options { grid-template-columns: 1fr; } }
.broadcast-join { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.broadcast-code { font: 700 1.3rem/1.2 ui-monospace, Consolas, monospace !important; letter-spacing: .12em; }
.broadcast-or { margin: 0; color: var(--muted); font-size: .85rem; }
