.tn {
    --panel: #1a3028;
    --line: #3f6254;
    --ink: #f1f6ff;
    --muted: #bcc9df;
    --accent: #d8f77c;
    --visitor: #9ce2ff;
    max-width: 980px;
    margin: 0 auto;
    padding: clamp(10px, 2vw, 24px);
    color: var(--ink);
}
.tn [hidden] { display: none !important; }
.tn .app-loader { background: #14241e; color: var(--ink); }
.tn .app-loader p { color: var(--accent); }
.tn .app-loader span { color: var(--muted); }
.tn .app-loader__progress { background: var(--accent); }
.tn-heading, .tn-match-head, .tn-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tn-heading, .tn-match-head { justify-content: space-between; }
.tn h1 { font-size: clamp(1.2rem, 4vw, 2rem); margin: 0 0 8px; }
.tn h2, .tn h3 { margin: 0; }
.tn p { margin: 6px 0; }
.tn p, .tn-serve span, .tn-heading span { color: var(--muted); }
.tn-panel { padding: clamp(10px, 2vw, 18px); margin: 8px 0; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.tn-match-head img { width: clamp(84px, 17vw, 150px); height: auto; }
.tn-match-head > div:first-child { flex: 1 1 20rem; min-width: 0; }
.tn-brand { display: flex; align-items: center; gap: .3em; color: #ffd27a; font-size: .75rem; font-weight: 800; }
.tn-board > [data-tennis-side="0"] { grid-column: 1; }
.tn-board > [data-tennis-side="1"] { grid-column: 2; }
.tn-board > .tn-team { grid-row: 1; display: flex; flex-direction: column; justify-content: space-between; gap: .35rem; }
.tn #tn-match:focus:not(:focus-visible) { outline: none; }
.tn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 185px), 1fr)); gap: 10px; }
.tn [data-form] > .tn-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 235px), 1fr));
}
.tn fieldset { min-inline-size: 0; margin: 12px 0; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.tn label { display: grid; gap: 4px; font-size: .86rem; font-weight: 650; min-width: 0; }
.tn-grid :is(select, input) {
    box-sizing: border-box;
    inline-size: 100%;
    min-inline-size: 0;
    max-inline-size: 100%;
}
.tn-grid select { text-overflow: ellipsis; }
.tn button, .tn select, .tn input:not([type=checkbox]) {
    border: 1px solid #60748c;
    border-radius: 8px;
    background: #13251e;
    color: var(--ink);
    min-height: 44px;
    padding: 7px 10px;
    font: inherit;
}
.tn button { cursor: pointer; font-weight: 700; }
.tn button:disabled { opacity: .55; cursor: default; }
.tn button.tn-primary { background: var(--accent); border-color: var(--accent); color: #14200b; }
.tn :is(button, input, select, summary):focus-visible { outline: 3px solid var(--visitor); outline-offset: 2px; }
.tn form .tn-actions { margin-top: 10px; }
.tn-serve, .tn-board { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.tn-serve > div { padding: 8px 10px; background: #12271e; border-radius: 8px; }
.tn-serve span, .tn-serve strong { display: block; }
.tn-serve strong { color: var(--accent); font-variant-numeric: tabular-nums; }
.tn-board { margin-top: 7px; }
.tn-team {
    --side: var(--accent);
    position: relative;
    min-width: 0;
    text-align: center;
    padding: clamp(8px, 2vw, 18px);
    border: 2px solid var(--line);
    border-radius: 12px;
    background: linear-gradient(160deg, #294739, #1a3028 70%);
}
.tn-team[data-tennis-side="1"] { --side: var(--visitor); }
.tn-team[data-serving="true"] { border-color: var(--side); }
.tn-team[data-winner="true"] { border-color: var(--side); box-shadow: inset 0 0 20px color-mix(in srgb, var(--side) 25%, transparent); }
.tn-team .tn-points {
    display: block;
    color: var(--side);
    font-size: clamp(3rem, 13vw, 7rem);
    font-variant-numeric: tabular-nums;
    font-weight: 850;
    line-height: 1;
    border-radius: 12px;
}
.tn-team button { width: 100%; }
.tn-team[data-tennis-side="1"] .tn-primary { background: var(--visitor); border-color: var(--visitor); }
.tn .tn-banner { padding: 10px; border: 1px solid var(--accent); border-radius: 8px; background: #283a28; color: var(--accent); font-size: 1.2rem; font-weight: 800; }
.tn-progress { margin: 8px 0; padding: .65rem .8rem; border-left: 3px solid var(--accent); background: #12271e; }
.tn-progress p { margin: .2rem 0 0; }
.tn button.tn-new { border-color: #ffd27a; color: #ffd27a; }
.tn-activity, .tn-notes { margin-top: 1rem; }
.tn-activity summary { cursor: pointer; font-weight: 700; }
.tn-activity ol { max-height: 14rem; overflow: auto; padding-inline-start: 1.6rem; }
.tn-activity li + li { margin-top: .3em; }
.tn-notes textarea {
    box-sizing: border-box;
    width: 100%;
    margin-top: .35rem;
    padding: .6rem;
    resize: vertical;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #13251e;
    color: var(--ink);
    font: inherit;
}
.tn-print-notes { display: none; }
.tn-team.tn-point-pulse { outline: 2px solid var(--side); outline-offset: -4px; }
@media (prefers-reduced-motion: no-preference) {
    .tn-team.tn-point-pulse::after {
        content: "";
        position: absolute;
        inset: 0;
        border-radius: inherit;
        background: var(--side);
        pointer-events: none;
        animation: tn-score-glow 450ms ease-out both;
    }
}
@keyframes tn-score-glow {
    from { opacity: .18; }
    to { opacity: 0; }
}
.tn table { width: 100%; border-collapse: collapse; text-align: left; }
.tn caption { text-align: left; font-weight: 700; margin-top: 8px; }
.tn th, .tn td { border-bottom: 1px solid var(--line); padding: 6px 4px; }
.tn-print-brand { display: none; }
.tn [role=alert] { color: #ffd08c; }
.tn-court:fullscreen {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: clamp(6px, 1.25vh, 14px);
    overflow: auto;
    padding: clamp(8px, 1.4vw, 24px);
    background: #14241e;
}
.tn-court:fullscreen .tn-match-head { margin: 0; padding: .6rem .8rem; }
.tn-court:fullscreen [data-format] { display: none; }
.tn-court:fullscreen .tn-board { flex: 1 0 auto; margin: 0; }
.tn-court:fullscreen .tn-team { justify-content: center; gap: clamp(4px, 1.1vh, 14px); }
.tn-court:fullscreen .tn-team .tn-points { font-size: clamp(2.4rem, min(15vw, 21vh), 14rem); }
.tn-court:fullscreen .tn-team h3 { font-size: clamp(1rem, 2.3vw, 2rem); }
.tn-court:fullscreen .tn-team button { min-height: clamp(44px, 8vh, 68px); }
.tn-court:fullscreen .tn-progress { margin: 0; }
.tn-court:fullscreen > .tn-actions {
    position: sticky;
    bottom: 0;
    z-index: 1;
    padding-block: .25rem;
    background: #14241e;
}
.tn-court:fullscreen .tn-actions [data-install] { display: none; }
.tn-court:fullscreen [data-fullscreen] { margin-inline-start: auto; }
.tn-court:fullscreen [data-order] { margin: 0; }
@media (max-height: 480px) {
    .tn-court:fullscreen .tn-team { padding-block: 6px; }
    .tn-court:fullscreen .tn-score-meta { margin: 0; }
}
@media print {
    body:has(.tn) :is(.site-header, .site-footer, .site-app-search, .skip-link),
    .tn :is(.tn-heading, .tn-court, .tn-activity, .tn-notes textarea, [data-storage-warning], [data-setup], [role=alert]) { display: none !important; }
    .tn, .tn .tn-record, .tn .tn-record p { background: #fff; color: #000; border: 0; padding: 0; }
    .tn .tn-print-brand { display: flex; align-items: center; gap: 12px; font-weight: 750; }
    .tn-print-brand img { width: 115px; height: auto; }
    .tn-print-notes { display: block; white-space: pre-wrap; overflow-wrap: anywhere; }
    .tn-notes:has(.tn-print-notes:empty) { display: none; }
    .tn tr { break-inside: avoid; }
}

.tn-team .tn-points { font-size: clamp(2.2rem, 9vw, 6rem); overflow-wrap: anywhere; }
.tn-score-actions {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: .4rem;
    margin-top: 6px;
}
.tn-score-actions button { overflow-wrap: anywhere; }
@media (max-width: 480px) {
    .tn-score-actions { grid-template-columns: 1fr; }
}
.tn-score-meta { display: flex; justify-content: center; gap: .75em; flex-wrap: wrap; }
.tn-serve { grid-template-columns: 1fr; }
