: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 { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; font-size: 1.25rem; font-weight: 800; letter-spacing: -.04em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; color: var(--ink); background: var(--accent); font-size: 1.05rem; }
.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); }
.language-switch { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 999px; }
.language-switch button { border: 0; border-radius: 999px; padding: 3px 8px; color: var(--muted); background: transparent; font-size: .75rem; cursor: pointer; }
.language-switch button.language-active { color: #fff; background: var(--ink); }
.language-switch button:focus-visible { outline: 2px solid var(--tms-primary); outline-offset: 2px; }
main { flex: 1; }

.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; }
.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 nav { gap: 12px; font-size: .84rem; }
    .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; }
    .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 (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
