:root {
    /* Ellington Christmas palette. Change colors here; the rest of site.css uses these. */
    --xmas-pine: #1f5130;          /* primary green: buttons, table headers, pills */
    --xmas-pine-dark: #163d24;     /* hover / borders on green */
    --xmas-pine-deep: #0d2416;     /* header, dark panels */
    --xmas-holly: #2f7d4a;         /* bright green rule (ticker borders) */
    --xmas-holly-tint: #e6efe7;    /* soft green tint (non-bracket) */
    --xmas-winner-fill: #1f8a45;   /* P10/P11/TV winning-row fill */
    --xmas-winner-text: #f4fff6;   /* high-contrast text on winner fill */
    --xmas-cranberry: #a4161a;     /* primary red: headings, ACTIVE, primary buttons */
    --xmas-cranberry-dark: #7a0f13;
    --xmas-cranberry-deep: #4f0a0d;/* tourney bar, ticker background */
    --xmas-gold: #c9a227;          /* accent rules, bracket lines, borders */
    --xmas-gold-light: #e2c35a;    /* gold text on dark, Pause button */
    --xmas-gold-pale: #f5e7b8;     /* gold highlight fills */
    --xmas-snow: #faf7f0;          /* page background */
    --xmas-card: #fffdf8;          /* cards, table rows */
    --xmas-stripe: #f4eddc;        /* striped rows */
    --xmas-border: #e3d6b8;        /* soft borders */
    --xmas-taupe: #6b5f4e;         /* PENDING pills */
    --xmas-ink: #1f1a17;           /* body text */
    --xmas-muted: #5e564b;
    --xmas-on-dark: #fbf3e0;       /* text on dark panels */

    /* Older names kept as aliases */
    --xmas-red: var(--xmas-cranberry);
    --xmas-red-dark: var(--xmas-cranberry-dark);
    --xmas-green: var(--xmas-pine);
    --xmas-green-dark: var(--xmas-pine-dark);
    --xmas-gold-bright: var(--xmas-gold-light);
    --xmas-cream: var(--xmas-snow);
    --xmas-cream-card: var(--xmas-card);
    --xmas-header: var(--xmas-pine-deep);
}

html, body {
    color: var(--xmas-ink);
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background-color: var(--xmas-cream);
    background-image:
        radial-gradient(circle at 12px 12px, rgba(255, 255, 255, 0.85) 1.5px, transparent 2.5px),
        radial-gradient(circle at 36px 28px, rgba(201, 162, 39, 0.16) 1px, transparent 2px);
    background-size: 48px 48px;
    min-height: 100%;
}

h1, h2, h3, h4, .navbar-brand, .modal-title, .card-title, .display-4, .page-title {
    font-family: Georgia, "Palatino Linotype", Palatino, "Times New Roman", serif;
}

h1, .display-4, .page-title {
    color: var(--xmas-red-dark);
}

h2, h3, h4 {
    color: var(--xmas-green-dark);
}

a {
    color: var(--xmas-red-dark);
}

a:hover {
    color: var(--xmas-red);
}

hr {
    border: 0;
    border-top: 2px solid var(--xmas-gold);
    opacity: 1;
}

/* Header: keep it black, add a candy-cane stripe underneath */
.app-header {
    margin-bottom: 1rem;
    overflow: visible;
}

.app-header .navbar {
    background-color: var(--xmas-header) !important;
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
    overflow: visible;
}

.app-header .navbar .container-fluid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(min-content, 1fr);
    align-items: center;
    column-gap: 0.75rem;
    row-gap: 0.25rem;
    padding-left: 16px;
    padding-right: 16px;
}

body.hide-page-id .page-id {
    visibility: hidden;
}
body.hide-build-number .footer-stamp,
body.hide-build-number .finals-stamp,
body.hide-build-number .pongview-stamp {
    display: none !important;
}

.page-id {
    justify-self: start;
    flex-shrink: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    line-height: 1;
    color: rgba(245, 231, 184, 0.75);
    white-space: nowrap;
}

.app-header .navbar-brand {
    justify-self: center;
    text-align: center;
    margin-right: 0;
    color: var(--xmas-gold-light);
    font-weight: 700;
    letter-spacing: 0.02em;
    font-size: 2.16rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: visible;
}

.app-header .navbar-nav {
    justify-self: end;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 0.15rem 0.25rem;
    white-space: nowrap;
}

.title-with-paddles {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3em;
    flex-wrap: wrap;
}

.app-header .title-with-paddles {
    flex-wrap: nowrap;
    white-space: nowrap;
}

h1.title-with-paddles,
.page-title.title-with-paddles {
    display: flex;
}

.paddle-icon {
    display: block;
    width: 1.25em;
    height: 1.25em;
    flex-shrink: 0;
    overflow: visible;
}

.paddle-icon.paddle-left {
    -webkit-transform: scaleX(-1);
    transform: scaleX(-1);
}

/* Static metallic gold title with 8-point stars on the E, i, and g */
.sparkle-title {
    position: relative;
    display: inline-block;
    padding: 0.4em 0.45em;
    overflow: visible;
}

.sparkle-text {
    color: #e0b825;
    background-image: linear-gradient(
        110deg,
        #8a6a12 0%,
        #c9a227 16%,
        #ffe9a0 34%,
        #e0b825 50%,
        #a67c00 64%,
        #fff1b0 80%,
        #c9a227 100%
    );
    background-size: 220% 100%;
    background-position: 40% 50%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.page-title .sparkle-text {
    color: #8a6a12;
    background-image: linear-gradient(
        110deg,
        #5c4308 0%,
        #8a6a12 16%,
        #d4af37 34%,
        #a67c00 50%,
        #7a5c0a 64%,
        #c9a227 80%,
        #6b4f08 100%
    );
}

.title-letter {
    position: relative;
    display: inline-block;
    /* Solid gold first so the glyph is never invisible (WebKit does not
       paint a parent's background-clip:text into inline-block children). */
    color: #e0b825;
    -webkit-text-fill-color: #e0b825;
    background-image: inherit;
    background-size: inherit;
    background-position: inherit;
    background-repeat: inherit;
}

.page-title .title-letter {
    color: #8a6a12;
    -webkit-text-fill-color: #8a6a12;
}

/* Own clipped gradient, matching .sparkle-text / the darker page-title variant. */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
    .title-letter,
    .page-title .title-letter {
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
    }
}

/* Stars keep their SVG fills and existing positions. */
.title-letter .title-star {
    -webkit-text-fill-color: initial;
    -webkit-background-clip: initial;
    background-clip: initial;
    background-image: none;
}

/* SVG box includes the 1.2× glow; the star itself is 0.55em (E/g) or 0.4em (i). */
.title-star {
    position: absolute;
    display: block;
    width: 0.66em;
    height: 0.66em;
    overflow: visible;
    pointer-events: none;
    user-select: none;
    line-height: 0;
    shape-rendering: geometricPrecision;
    filter: none;
}

.title-star-e {
    /* Center of the star on the E's upper-left ink corner. */
    top: -0.02em;
    left: -0.22em;
    right: auto;
}

.title-star-g {
    /* Center of the star on the g's lower-right ink corner. */
    bottom: -0.14em;
    right: -0.16em;
}

.title-star-i {
    /* 0.4em star + 1.2× glow = 0.48em box. No transform, to keep edges crisp. */
    width: 0.48em;
    height: 0.48em;
    left: 50%;
    margin-left: -0.24em;
    top: 0.1em;
}

.page-title {
    font-size: 3.25rem;
    line-height: 1.2;
}

/* P07: tournament name centered, with the status pill immediately to its right. */
.tournament-heading {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.35rem 0.65rem;
    text-align: center;
}

.tournament-heading h1 {
    margin: 0;
    line-height: 1.15;
    max-width: 100%;
}

.app-header .navbar-dark .navbar-nav .nav-link {
    color: #f5e6c8;
    font-weight: 600;
}

.app-header .navbar-dark .navbar-nav .nav-link:hover,
.app-header .navbar-dark .navbar-nav .nav-link:focus {
    color: var(--xmas-gold-light);
}

/* WebKit (Safari/iPad) keeps the UA/reboot underline on navbar and button
   links; Bootstrap's text-decoration:none does not always win there.
   Same-origin -webkit-text-decoration:none clears it in every link state.
   Hover color change is intended; hover underline is not. */
.app-header a.navbar-brand,
.app-header a.navbar-brand:link,
.app-header a.navbar-brand:visited,
.app-header a.navbar-brand:hover,
.app-header a.navbar-brand:focus,
.app-header a.navbar-brand:active,
.app-header .nav-link,
.app-header .nav-link:link,
.app-header .nav-link:visited,
.app-header .nav-link:hover,
.app-header .nav-link:focus,
.app-header .nav-link:active,
a.btn,
a.btn:link,
a.btn:visited,
a.btn:hover,
a.btn:focus,
a.btn:active {
    text-decoration: none;
    -webkit-text-decoration: none;
}

.candy-cane,
#appDialog .modal-header::after,
#movePlayerModal .modal-header::after {
    height: 14px;
    background: repeating-linear-gradient(
        45deg,
        var(--xmas-red) 0 14px,
        #fffaf0 14px 28px
    );
    box-shadow: 0 2px 0 var(--xmas-gold);
}

/* Footer */
.app-footer {
    color: var(--xmas-muted);
    font-size: 0.9rem;
}

.app-footer .footer-mark {
    margin-bottom: 0.35rem;
    gap: 0.55em;
}

.app-footer .footer-mark .paddle-icon {
    width: 2em;
    height: 2em;
}

.app-footer .footer-table {
    display: block;
    height: 3.15em;
    width: auto;
    overflow: visible;
    flex-shrink: 0;
}

.app-footer .footer-stamp {
    font-size: 0.8rem;
}

/* Buttons */
.btn {
    font-weight: 600;
}

.btn-primary {
    background-color: var(--xmas-red);
    border-color: var(--xmas-red-dark);
    color: #fff;
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--xmas-red-dark);
    border-color: var(--xmas-cranberry-deep);
    color: #fff;
}

.btn-success {
    background-color: var(--xmas-green);
    border-color: var(--xmas-green-dark);
    color: #fff;
}

.btn-success:hover, .btn-success:focus {
    background-color: var(--xmas-green-dark);
    border-color: var(--xmas-pine-deep);
    color: #fff;
}

.btn-secondary {
    background-color: #3a4a3f;
    border-color: #2c3a2c;
    color: var(--xmas-on-dark);
}

.btn-secondary:hover, .btn-secondary:focus {
    background-color: #2c3a2c;
    border-color: #1e281e;
    color: #fff;
}

.btn-warning {
    background-color: var(--xmas-gold-bright);
    border-color: var(--xmas-gold);
    color: var(--xmas-ink);
}

.btn-warning:hover, .btn-warning:focus {
    background-color: var(--xmas-gold);
    border-color: #8a6d12;
    color: var(--xmas-ink);
}

.btn-outline-primary {
    color: var(--xmas-red);
    border-color: var(--xmas-red);
}

.btn-outline-primary:hover, .btn-outline-primary:focus {
    background-color: var(--xmas-red);
    border-color: var(--xmas-red-dark);
    color: #fff;
}

.btn-outline-secondary {
    color: #3a4a3f;
    border-color: #8a9a8a;
}

.btn-outline-secondary:hover, .btn-outline-secondary:focus {
    background-color: #3a4a3f;
    border-color: #2c3a2c;
    color: #fff;
}

.btn-outline-danger {
    color: var(--xmas-red);
    border-color: var(--xmas-red);
}

.btn-outline-danger:hover, .btn-outline-danger:focus {
    background-color: var(--xmas-red);
    border-color: var(--xmas-red-dark);
    color: #fff;
}

.btn-outline-warning {
    color: #8a6d12;
    border-color: var(--xmas-gold);
}

.btn-outline-warning:hover, .btn-outline-warning:focus {
    background-color: var(--xmas-gold-bright);
    border-color: var(--xmas-gold);
    color: var(--xmas-ink);
}

.btn-outline-dark {
    color: var(--xmas-ink);
    border-color: var(--xmas-ink);
    background: #fffdf8;
}

.btn-outline-dark:hover, .btn-outline-dark:focus {
    background-color: var(--xmas-header);
    border-color: var(--xmas-gold);
    color: var(--xmas-gold-light);
}

.btn:disabled, .btn.disabled {
    opacity: 0.65;
}

/* Tables */
.table {
    --bs-table-bg: var(--xmas-cream-card);
    --bs-table-striped-bg: var(--xmas-stripe);
    --bs-table-hover-bg: var(--xmas-gold-pale);
    --bs-table-border-color: var(--xmas-border);
    --bs-table-color: var(--xmas-ink);
    background-color: var(--xmas-cream-card);
}

.table thead th {
    background-color: var(--xmas-green);
    color: var(--xmas-on-dark);
    border-bottom: 3px solid var(--xmas-gold) !important;
    font-weight: 600;
    vertical-align: middle;
}

.table td {
    vertical-align: middle;
}

.table-info {
    --bs-table-bg: #fff0c2;
    --bs-table-striped-bg: #fff0c2;
    --bs-table-color: var(--xmas-ink);
    --bs-table-hover-bg: #ffe9a8;
}

.table-warning {
    --bs-table-bg: #fde8e4;
    --bs-table-striped-bg: #fde8e4;
    --bs-table-color: var(--xmas-ink);
    --bs-table-hover-bg: #f9d7d0;
}

/* Nav tabs (Active / Closed) */
.nav-tabs {
    border-bottom: 2px solid var(--xmas-gold);
}

.nav-tabs .nav-link {
    color: var(--xmas-green-dark);
    font-weight: 600;
    background: transparent;
}

.nav-tabs .nav-link:hover {
    border-color: var(--xmas-border) var(--xmas-border) var(--xmas-gold);
    color: var(--xmas-red);
}

.nav-tabs .nav-link.active {
    background-color: var(--xmas-red);
    color: #fff;
    border-color: var(--xmas-red) var(--xmas-red) var(--xmas-gold);
}

/* Cards and Edit Player group boxes */
.card {
    background: var(--xmas-cream-card);
    border: 1px solid var(--xmas-border);
    border-top: 4px solid var(--xmas-red);
    box-shadow: 0 2px 8px rgba(80, 40, 20, 0.08);
    border-radius: 0.75rem;
}

.card-title, .card .card-title {
    color: var(--xmas-green-dark);
}

/* Forms */
.form-control, .form-select {
    background-color: #fffdf8;
    border-color: var(--xmas-border);
    color: var(--xmas-ink);
}

.form-control:focus, .form-select:focus {
    border-color: var(--xmas-gold);
    box-shadow: 0 0 0 0.2rem rgba(201, 162, 39, 0.35);
}

.text-muted, .form-text {
    color: var(--xmas-muted) !important;
}

/* Alerts */
.alert-warning {
    background-color: #fff3cd;
    border-color: var(--xmas-gold);
    color: #5c4300;
}

.alert-info {
    background-color: var(--xmas-holly-tint);
    border-color: var(--xmas-green);
    color: var(--xmas-pine-deep);
}

/* Tournament status badges (classes come from TournamentStatus.BadgeClass) */
.badge {
    font-weight: 700;
    letter-spacing: 0.03em;
}

.badge.bg-secondary {
    background-color: var(--xmas-taupe) !important;
    color: var(--xmas-on-dark) !important;
}

.badge.bg-success {
    background-color: var(--xmas-green) !important;
    color: #fff !important;
}

.badge.bg-warning {
    background-color: var(--xmas-gold-bright) !important;
    color: var(--xmas-ink) !important;
}

.badge.bg-dark {
    background-color: var(--xmas-pine-deep) !important;
    color: #f5e6c8 !important;
    box-shadow: inset 0 0 0 1px var(--xmas-gold);
}

.badge.bg-info {
    background-color: var(--xmas-gold-pale) !important;
    color: var(--xmas-ink) !important;
    box-shadow: inset 0 0 0 1px var(--xmas-gold);
}

/* Match status badges */
.badge-match-PENDING {
    background-color: var(--xmas-taupe);
    color: var(--xmas-on-dark);
}

.badge-match-ACTIVE {
    background-color: var(--xmas-red);
    color: #fff;
}

.badge-match-COMPLETE {
    background-color: var(--xmas-pine);
    color: #fff;
}

/* Tournament member checklist */
.member-checklist {
    max-height: 60vh;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.25rem;
    background: var(--xmas-cream-card);
    border-color: var(--xmas-border) !important;
}

.member-item {
    cursor: pointer;
    user-select: none;
}

.member-item:hover {
    background: var(--xmas-gold-pale);
}

/* P08 two-panel member picker (touch-first; no hover required) */
.member-picker-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    margin: 0.75rem 0 0.85rem;
}
.member-picker-search {
    flex: 1 1 16rem;
    min-width: 12rem;
    min-height: 44px;
    font-size: 16px;
}
.member-picker-toolbar .btn {
    min-height: 44px;
    min-width: 7rem;
    font-size: 1rem;
    padding: 0.4rem 0.9rem;
}
.member-picker {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 1rem;
}
.member-picker-panels {
    grid-column: 1 / -1;
    display: flex;
    gap: 1rem;
    align-items: stretch;
    margin-bottom: 0.5rem;
}
.member-picker-panel {
    flex: 1 1 0;
    min-width: 0;
    background: var(--xmas-cream-card);
    border: 1px solid var(--xmas-border);
    border-radius: 0.5rem;
    display: flex;
    flex-direction: column;
    min-height: 16rem;
}
.member-picker-heading {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--xmas-border);
    background: var(--xmas-cream);
    border-radius: 0.5rem 0.5rem 0 0;
    color: var(--xmas-ink);
}
.member-picker-save-row {
    grid-column: 2;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin: 0 0 0.4rem;
    padding: 0;
    min-height: 44px;
    box-sizing: border-box;
    background: none;
}
.member-picker-save-row .btn {
    min-height: 44px;
    min-width: 7rem;
    font-size: 1rem;
    padding: 0.4rem 0.9rem;
}
.member-picker-panel-search {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.85rem 0.35rem;
    border-bottom: 1px solid var(--xmas-border);
    background: var(--xmas-cream);
}
.member-picker-panel-search .member-picker-search {
    flex: 1 1 10rem;
    width: auto;
    min-width: 0;
    min-height: 44px;
    font-size: 16px; /* iOS Safari zooms inputs under 16px */
}
.member-picker-panel-search .btn {
    flex: 0 0 auto;
    min-height: 44px;
    min-width: 7rem;
    font-size: 1rem;
    padding: 0.4rem 0.9rem;
}
.member-picker-list {
    overflow: visible;
    padding: 0.45rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1 1 auto;
}
.member-picker-empty {
    margin: 0.4rem 0.85rem 0.85rem;
    color: var(--xmas-muted, #6b5a4a);
    font-size: 0.95rem;
}
.member-tile {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    min-height: 56px;
    margin: 0;
    padding: 0.35rem 0.65rem;
    text-align: left;
    font: inherit;
    font-size: 1.05rem;
    color: inherit;
    background: #fff;
    border: 1px solid var(--xmas-border);
    border-radius: 0.4rem;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(160, 40, 40, 0.18);
    appearance: none;
    -webkit-appearance: none;
}
.member-tile .member-tile-name {
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 600;
    line-height: 1.25;
    overflow-wrap: break-word;
    word-wrap: break-word;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}
.member-tile:active:not(.is-locked) {
    background: var(--xmas-gold-pale);
}
.member-tile.is-locked {
    cursor: default;
    background: #f3eee4;
}
.member-tile-lock {
    flex-shrink: 0;
    font-size: 1.1rem;
    line-height: 1;
}
@media (max-width: 700px) {
    .member-picker {
        display: flex;
        flex-direction: column;
    }
    .member-picker-panels {
        display: contents;
    }
    .member-picker-panel[data-panel="in"] {
        order: 1;
    }
    .member-picker-save-row {
        order: 2;
        grid-column: auto;
        margin: 0.35rem 0;
    }
    .member-picker-panel[data-panel="available"] {
        order: 3;
    }
}
body.page-members form#memberPickerForm > .btn-primary {
    min-height: 44px;
    min-width: 7rem;
    font-size: 1.05rem;
    padding: 0.45rem 1.2rem;
}

/* Member photos */
.member-photo {
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--xmas-gold);
    box-sizing: content-box;
}

.member-photo-blank {
    background: var(--xmas-green);
    color: var(--xmas-on-dark);
    font-weight: 600;
}

/* Level color swatch. Stored codes stay RED / GREEN / YELLOW / UNKNOWN;
   GREEN (College) is shown as a clear blue that reads on light admin and dark TV. */
.level-swatch {
    display: inline-block;
    width: 0.8em;
    height: 0.8em;
    border-radius: 0.15em;
    border: 1px solid var(--xmas-ink);
    vertical-align: -0.05em;
    flex-shrink: 0;
}
.level-swatch.level-RED { background-color: #c8102e; }
.level-swatch.level-GREEN { background-color: #1d4ed8; }
.level-swatch.level-YELLOW { background-color: #f2c200; }
.level-swatch.level-UNKNOWN { background-color: #8a8f98; }
.player-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
}

/* P07 match table: name/avatar opens member edit. */
a.player-edit-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: inherit;
    text-decoration: none;
}

a.player-edit-link:hover,
a.player-edit-link:focus {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 0.15em;
}


/* P03/P04 clickable level radios */
.level-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem 1.15rem;
    margin-top: 0.15rem;
}

.level-choice {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    flex: 0 0 5.5em;
    width: 5.5em;
    gap: 0.35rem;
    margin: 0;
    cursor: pointer;
    text-align: center;
    box-sizing: border-box;
}

.level-choice-input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    pointer-events: none;
}

.level-choice-swatch {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 0.4rem;
    border: 2px solid var(--xmas-ink);
    box-sizing: border-box;
}

.level-choice-swatch.level-RED { background-color: #c8102e; }
.level-choice-swatch.level-GREEN { background-color: #1d4ed8; }
.level-choice-swatch.level-YELLOW { background-color: #f2c200; }
.level-choice-swatch.level-UNKNOWN { background-color: #8a8f98; }

.level-choice-caption {
    display: block;
    width: 100%;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--xmas-ink);
    text-align: center;
    line-height: 1.15;
    white-space: normal;
}

.level-choice:has(.level-choice-input:checked) .level-choice-swatch {
    box-shadow: 0 0 0 3px var(--xmas-header), 0 0 0 6px var(--xmas-gold);
}

.level-choice:has(.level-choice-input:checked) .level-choice-swatch::after {
    content: "";
    width: 8px;
    height: 16px;
    margin-top: -3px;
    border: solid #fff;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
    filter: drop-shadow(0 0 1px var(--xmas-ink));
}

.level-choice:has(.level-choice-input:focus-visible) .level-choice-swatch {
    outline: 3px solid var(--xmas-gold);
    outline-offset: 7px;
}

.level-choice:hover .level-choice-swatch {
    filter: brightness(1.08);
}

/* P05: New Tournament sits on the Active/Closed tabs row, far right. */
.tournaments-tabs-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.tournaments-tabs-row .nav-tabs {
    flex: 1 1 auto;
    margin-bottom: 0;
    border-bottom: var(--bs-nav-tabs-border-width) solid var(--bs-nav-tabs-border-color);
}

.tournaments-tabs-row .tournaments-new-btn {
    flex: 0 0 auto;
    margin-bottom: 0.15rem;
}

/* P02 members list: same P04 level picker, sized to sit in a table row. */
.members-level-form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem 0.6rem;
}

.members-level-form .level-picker {
    margin-top: 0;
    gap: 0.2rem 0.3rem;
}
.members-level-form .level-choice {
    flex-basis: 4.4em;
    width: 4.4em;
}

.members-level-form .level-choice-swatch {
    width: 36px;
    height: 36px;
}

.members-level-saved {
    display: inline-block;
    min-width: 3.6em;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--xmas-green-dark);
    visibility: hidden;
    white-space: nowrap;
}

.members-level-saved.is-visible {
    visibility: visible;
}

.members-table a {
    font-weight: 600;
}

/* P02 Status (Activate on the Not Active tab) and Delete */
.members-status-form {
    display: flex;
    align-items: center;
    margin: 0;
}

.members-delete-col {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

.members-table tr.member-row-inactive > td {
    color: var(--xmas-muted);
}

.members-table tr.member-row-inactive > td:not(:last-child) > * {
    opacity: 0.6;
}

/* P02 Active / Not Active tabs (same look as P05 Active / Closed) */
.members-tab-count {
    font-weight: 500;
    opacity: 0.85;
}
.members-readonly-note {
    margin-top: -0.25rem;
}

/* P02: search box just above the members name list */
.members-search {
    position: relative;
    margin: 0 0 0.75rem;
    max-width: 28rem;
}
.members-search-input {
    font-size: 16px; /* iOS Safari zooms inputs under 16px */
    min-height: 44px;
    padding-right: 2.75rem;
}
.members-search-clear {
    position: absolute;
    right: 0.15rem;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border: 0;
    background: transparent;
    color: var(--xmas-muted);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}
.members-search-clear:hover,
.members-search-clear:focus {
    color: var(--xmas-red, #8b1e1e);
}

/* P03/P04: status after a photo is resized in the browser */
.photo-resize-status {
    min-height: 1.2em;
    margin: 0.35rem 0 0;
    font-size: 0.95rem;
    color: var(--xmas-green-dark, #1e4d2b);
}
.photo-resize-status.is-error {
    color: var(--xmas-red, #8b1e1e);
}
/* Not Active tab: read-only level (static square + label) and Activate */
.member-level-static {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}
.member-level-static .level-choice-swatch {
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
}
.member-level-static-label {
    font-weight: 600;
}
.members-table .member-name-readonly {
    color: var(--xmas-muted);
}
.member-activate-btn {
    font-weight: 700;
    min-width: 6.5em;
}
/* P04 read-only banner for a Not Active member */
.member-readonly-banner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    border: 1px dashed var(--xmas-taupe);
    border-radius: 0.5rem;
    background: var(--xmas-gold-pale);
}
.member-edit-fieldset[disabled] .level-choice {
    cursor: default;
    opacity: 0.75;
}

/* P04: single-column editor. Labels share one aligned column (Name/Level/
   Status/Photo) with controls on the same row. The delete-member control
   was removed from this page; leftover space is used for slightly larger
   even section gaps. The page still fits a laptop viewport (~1366x657)
   without scrolling. */
html:has(body.page-member-edit) {
    overflow: hidden;
    height: 100%;
}
body.page-member-edit {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 100%;
}
body.page-member-edit > .container {
    flex: 1 1 auto;
}
body.page-member-edit .app-header {
    margin-bottom: 0.3rem;
}
body.page-member-edit .app-header .navbar {
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}
body.page-member-edit .app-header .navbar-brand {
    font-size: 1.85rem;
}
body.page-member-edit main {
    padding-bottom: 0 !important;
}
body.page-member-edit .app-footer {
    margin-top: 0.35rem !important;
    margin-bottom: 0 !important;
}
body.page-member-edit .app-footer .footer-table {
    height: 2em;
}
body.page-member-edit .app-footer .footer-mark {
    margin-bottom: 0.12rem;
}
body.page-member-edit .app-footer .footer-stamp {
    font-size: 0.72rem;
}
body.page-member-edit h1 {
    font-size: 1.55rem;
    margin: 0.2rem 0 0.4rem;
    line-height: 1.2;
}
body.page-member-edit hr {
    margin: 0.2rem 0 0.6rem;
}
body.page-member-edit .members-message {
    padding: 0.35rem 0.75rem;
    margin-bottom: 0.75rem;
}
body.page-member-edit .member-readonly-banner {
    gap: 0.35rem 0.75rem;
    padding: 0.4rem 0.75rem;
    margin-bottom: 0.75rem;
}
body.page-member-edit .member-edit-form,
body.page-member-edit .member-edit-fieldset {
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
}
body.page-member-edit .member-edit-section + .member-edit-section {
    margin-top: 1.4rem;
}
body.page-member-edit .member-edit-fieldset + .member-edit-actions {
    margin-top: 1.4rem;
}

body.page-member-edit .member-edit-names {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
body.page-member-edit .member-edit-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 0.55rem;
    row-gap: 0.15rem;
}
body.page-member-edit .member-edit-photo {
    align-items: flex-start;
}
.member-edit-photo-slots {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1.1rem 1.75rem;
    min-width: 0;
    width: 100%;
}
.member-edit-photo-slot {
    flex: 1 1 16rem;
    max-width: 26rem;
    min-width: 15rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.member-edit-photo-slot > .form-label {
    flex: none;
    width: auto;
    margin-bottom: 0;
    font-size: 1rem;
    font-weight: 600;
}
.member-edit-swap-photos {
    min-height: 44px;
    padding: 0.45rem 0.9rem;
    font-size: 1rem;
}
.member-edit-swap-photos.is-swapped {
    background: var(--xmas-red, #8b1e1e);
    border-color: var(--xmas-red, #8b1e1e);
    color: #fff;
}
@media (max-width: 700px) {
    .member-edit-photo-slot {
        flex: 1 1 100%;
        max-width: none;
        min-width: 0;
    }
}
body.page-member-edit .member-edit-row > .form-label {
    flex: 0 0 7.2em;
    width: 7.2em;
    margin-bottom: 0;
    font-size: 0.95rem;
    line-height: 1.2;
    text-align: left;
}
body.page-member-edit .member-edit-row > .form-label::after {
    content: ": ";
}
body.page-member-edit .member-edit-row > .form-control {
    width: 20rem;
    max-width: calc(100% - 8.2em);
    flex: 0 1 20rem;
    padding: 0.22rem 0.6rem;
    min-height: calc(1.35em + 0.44rem);
    height: calc(1.35em + 0.44rem);
    font-size: 1rem;
}
body.page-member-edit .member-edit-row > .text-danger {
    flex: 1 0 100%;
    margin-left: 7.75em;
}
body.page-member-edit .level-picker {
    gap: 0.2rem 0.35rem;
    margin-top: 0;
}
body.page-member-edit .level-choice {
    flex-basis: 4.4em;
    width: 4.4em;
    gap: 0.15rem;
}
body.page-member-edit .level-choice-swatch {
    width: 36px;
    height: 36px;
}
body.page-member-edit .level-choice-caption {
    font-size: 0.75rem;
    line-height: 1.1;
}
body.page-member-edit .member-edit-status {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.1rem;
    align-items: center;
}
body.page-member-edit .member-edit-status .form-check {
    margin: 0;
    min-height: 0;
    padding-left: 1.55em;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
body.page-member-edit .member-edit-status .form-check-input {
    margin-top: 0;
    margin-left: -1.55em;
    flex: 0 0 auto;
}
body.page-member-edit .member-edit-photo-body {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    min-width: 0;
}
body.page-member-edit .member-photo,
body.page-member-edit .member-photo-blank {
    width: 64px !important;
    height: 64px !important;
}
body.page-member-edit .member-edit-photo-slot .member-photo,
body.page-member-edit .member-edit-photo-slot .member-photo-blank {
    width: 96px !important;
    height: 96px !important;
    flex: 0 0 96px;
}
body.page-member-edit .member-edit-photo-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
    min-width: 0;
}
body.page-member-edit .member-edit-photo-controls .form-check {
    margin: 0;
    min-height: 0;
    padding-left: 1.4em;
}
body.page-member-edit .member-edit-photo-file-label {
    margin: 0.1rem 0 0;
    font-size: 0.9rem;
}
body.page-member-edit .member-edit-photo-file-label::after {
    content: none;
}
body.page-member-edit .member-edit-photo-controls input[type="file"].form-control {
    width: 24rem;
    max-width: 100%;
    height: auto;
    min-height: 44px;
    padding: 0.35rem 0.5rem;
    font-size: 1rem;
}
body.page-member-edit .member-edit-photo-controls .form-check-input,
body.page-member-edit .member-edit-photo-controls .form-check-label {
    min-height: 28px;
}
body.page-member-create .member-edit-photo-slots input[type="file"].form-control {
    min-height: 44px;
    font-size: 1rem;
}
body.page-member-edit .member-edit-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 0.6rem;
    align-items: center;
    padding-left: 7.75em;
}
body.page-member-edit .btn {
    padding: 0.28rem 0.8rem;
}

/* P08 checklist / P04: tag for a member who is Not Active */
.member-inactive-tag {
    display: inline-block;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    border: 1px dashed var(--xmas-taupe);
    color: var(--xmas-taupe);
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}


/* Match scoreboard */
.scoreboard .match-meta {
    font-family: Georgia, "Palatino Linotype", Palatino, "Times New Roman", serif;
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: var(--xmas-red-dark);
    line-height: 1.2;
}

.scoreboard .game-points {
    font-family: Georgia, "Palatino Linotype", Palatino, "Times New Roman", serif;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--xmas-green);
}

.scoreboard .player-card {
    border: 3px solid var(--xmas-gold);
    border-radius: 1rem;
    padding: 1.5rem 1rem;
    background: var(--xmas-pine-deep);
    color: #fffdf8;
    box-shadow: 0 6px 18px rgba(20, 32, 22, 0.25);
    min-width: 0;
    overflow: hidden;
}

.scoreboard .player-card .text-muted {
    color: #d4c4a8 !important;
}

.scoreboard .player-card.winner {
    border-color: var(--xmas-gold-light);
    background: var(--xmas-winner-fill);
    color: var(--xmas-winner-text);
    box-shadow: 0 0 0 3px rgba(31, 138, 69, 0.45), 0 6px 18px rgba(20, 32, 22, 0.3);
}

.scoreboard .player-card.winner .player-name,
.scoreboard .player-card.winner .text-muted,
.scoreboard .player-card.winner .winner-label {
    color: var(--xmas-winner-text) !important;
}

.scoreboard .player-card.loser {
    border-color: var(--xmas-gold-light);
    background: var(--xmas-cranberry);
    color: #fffdf8;
    box-shadow: 0 0 0 3px rgba(164, 22, 26, 0.35), 0 6px 18px rgba(79, 10, 13, 0.3);
}

.scoreboard .player-card.loser .text-muted,
.scoreboard .player-card.loser .player-name.text-muted {
    color: #ffd6d6 !important;
}

.scoreboard .player-name {
    font-family: Georgia, "Palatino Linotype", Palatino, "Times New Roman", serif;
    font-size: 6rem;
    font-weight: 700;
    line-height: 1.05;
    margin-top: 0.75rem;
    color: #fffdf8;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 0.35em;
    max-width: 100%;
    width: 100%;
    min-width: 0;
    min-width: 0;
}

.scoreboard .player-name > span:not(.level-swatch) {
    min-width: 0;
    flex: 1 1 0;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    word-break: normal;
    overflow-wrap: normal;
    text-align: center;
    display: block;
}

.scoreboard .level-swatch {
    width: 2.2rem;
    height: 2.2rem;
    flex: 0 0 auto;
    border-color: rgba(255, 253, 248, 0.85);
}

.scoreboard .player-name.text-muted {
    color: #d4c4a8 !important;
}

.scoreboard .vs-text {
    font-family: Georgia, "Palatino Linotype", Palatino, "Times New Roman", serif;
    font-size: 6.25rem;
    font-weight: 700;
    color: var(--xmas-gold);
    line-height: 1;
}

.scoreboard .score-box {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.scoreboard .score-value {
    font-size: 5rem;
    font-weight: 800;
    line-height: 1;
    min-width: 2ch;
    color: var(--xmas-gold-light);
    font-variant-numeric: tabular-nums;
}

.scoreboard input.score-value {
    display: block;
    width: 2.35ch;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 0.2rem;
    background: transparent;
    color: var(--xmas-gold-light);
    text-align: center;
    font: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    font-variant-numeric: tabular-nums;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: textfield;
    box-shadow: none;
    outline: none;
    caret-color: var(--xmas-gold-light);
}

.scoreboard input.score-value:focus {
    outline: 2px solid var(--xmas-gold-light);
    outline-offset: 3px;
    background: rgba(0, 0, 0, 0.18);
}

.scoreboard input.score-value::-webkit-outer-spin-button,
.scoreboard input.score-value::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.scoreboard .score-btn {
    border: 2px solid var(--xmas-gold-light);
    background: #111;
    color: #fff;
    font-size: 2rem;
    width: 5rem;
    height: 3.5rem;
    min-width: 5rem;
    min-height: 3.5rem;
    border-radius: 0.75rem;
    cursor: pointer;
}

.scoreboard .score-btn[data-change="1"] {
    background: var(--xmas-green);
}

.scoreboard .score-btn[data-change="-1"] {
    background: var(--xmas-red);
}

.scoreboard .score-btn:hover:not(:disabled) {
    filter: brightness(1.12);
}

.scoreboard .score-btn:disabled {
    background: #5a635a;
    border-color: #8a9a8a;
    color: #cfd4cf;
    cursor: not-allowed;
    filter: none;
}

.scoreboard .winner-label {
    font-weight: 700;
    color: var(--xmas-gold-light);
    font-size: 1.25rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Modal dialogs titled "Ellington Christmas Pong" */
#appDialog .modal-content,
#movePlayerModal .modal-content {
    background: var(--xmas-cream-card);
    border: 2px solid var(--xmas-gold);
    border-radius: 0.75rem;
    overflow: hidden;
}

#appDialog .modal-header,
#movePlayerModal .modal-header {
    background: var(--xmas-header);
    color: var(--xmas-gold-light);
    border-bottom: 0;
    position: relative;
    padding-top: 1rem;
    padding-bottom: 1.5rem;
    overflow: visible;
}

#appDialog .modal-header::after,
#movePlayerModal .modal-header::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
}

#appDialog .modal-title,
#movePlayerModal .modal-title {
    color: var(--xmas-gold-light);
    font-weight: 700;
    overflow: visible;
}

#appDialog .modal-body,
#movePlayerModal .modal-body {
    color: var(--xmas-ink);
}

#movePlayerModal .modal-content {
    display: flex;
    flex-direction: column;
    max-height: calc(60vh + 9rem);
}

#movePlayerModal .modal-header,
#movePlayerModal .modal-footer {
    flex: 0 0 auto;
}

#movePlayerModal .modal-body {
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
    flex: 1 1 auto;
}

#appDialog .modal-footer,
#movePlayerModal .modal-footer {
    border-top: 1px solid var(--xmas-border);
    background: var(--xmas-on-dark);
}

/* Falling snow overlay. Never intercepts clicks. */
.snow {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    inset: 0;
    pointer-events: none;
    z-index: 2000;
    overflow: hidden;
}

.snowflake {
    position: absolute;
    top: -20px;
    color: #fff;
    text-shadow: 0 0 4px rgba(255, 255, 255, 0.85);
    pointer-events: none;
    animation-name: snowfall;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    user-select: none;
}

@keyframes snowfall {
    0% {
        transform: translate3d(0, -20px, 0);
    }
    100% {
        transform: translate3d(var(--drift, 40px), 110vh, 0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .snow,
    .snowflake {
        display: none !important;
        animation: none !important;
    }

}

@media (max-width: 575.98px) {
    .app-header .navbar .container-fluid {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "pageid nav"
            "title title";
    }

    .app-header .page-id {
        grid-area: pageid;
    }

    .app-header .navbar-brand {
        grid-area: title;
        justify-self: center;
    }

    .app-header .navbar-nav {
        grid-area: nav;
    }
}

@media (max-width: 767.98px) {
    .scoreboard .player-name {
        font-size: 4.2rem;
    }

    .scoreboard .score-value {
        font-size: 3.5rem;
    }

    .scoreboard .match-meta,
    .scoreboard .vs-text {
        font-size: 2rem;
    }

    .app-header .navbar-brand {
        font-size: 1.51rem;
    }

    .page-title {
        font-size: 2.15rem;
    }
}

@media (min-width: 576px) and (max-width: 991.98px) {
    .app-header .navbar-brand {
        font-size: 1.84rem;
    }
}


/* P10 read-only March Madness bracket tree */
body.page-bracket .app-header {
    margin-bottom: 0;
}

body.page-bracket main.pb-3 {
    padding-bottom: 0 !important;
}

body.page-bracket .app-footer {
    display: none;
}

.bracket-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.35rem 0.65rem;
    margin-bottom: 0.4rem;
    position: relative;
    min-height: 2.1rem;
    padding: 0 0.15rem;
}

.bracket-title-group {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 0.4rem 0.55rem;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}

.bracket-title {
    flex: 0 1 auto;
    min-width: 0;
    margin: 0;
    font-size: 1.35rem;
    line-height: 1.2;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bracket-toolbar-spacer {
    flex: 0 0 auto;
    visibility: hidden;
    pointer-events: none;
}

.bracket-toolbar-right {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.4rem 0.55rem;
    flex: 0 0 auto;
    z-index: 2;
}

.bracket-zoom-controls {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.25rem;
    margin-left: 0;
}

.bracket-zoom-controls .btn {
    padding: 0.12rem 0.5rem;
    font-size: 0.85rem;
    line-height: 1.2;
    color: var(--xmas-green-dark);
    border-color: var(--xmas-gold);
    background: var(--xmas-cream-card);
}

.bracket-zoom-controls .btn.is-active,
.bracket-zoom-controls .btn.is-active:focus,
.bracket-zoom-controls .btn.is-active:hover {
    background: var(--xmas-green) !important;
    border-color: var(--xmas-green-dark) !important;
    color: var(--xmas-on-dark) !important;
}

.bracket-zoom-pct {
    min-width: 2.6rem;
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    color: var(--xmas-muted);
    text-align: right;
}

.bracket-scroll {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y pinch-zoom;
    /* Break out of the centered page container so large trees can use the full window. */
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    margin: 0 0 0;
    margin-left: calc(50% - 50vw + 8px);
    padding: 0;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.bracket-zoom {
    position: relative;
    flex: 0 0 auto;
}

.bracket-tree {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
}

.bracket-cluster {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    transform-origin: 0 0;
}

.bracket-round {
    position: absolute;
    top: 0;
}

.bracket-round-title {
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Georgia, "Palatino Linotype", Palatino, "Times New Roman", serif;
    font-weight: 700;
    font-size: 0.7rem;
    color: var(--xmas-green-dark);
    text-align: center;
    padding: 0 0.15rem;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* P10 and TV full-bracket headers: 200% of the original 0.7rem size. */
body.page-bracket .bracket-round-title,
body.page-pongview .tv-bracket .bracket-round-title {
    height: 40px;
    font-size: 1.4rem;
    letter-spacing: 0;
    overflow: visible;
    text-overflow: clip;
    padding: 0 0.05rem;
}

.bracket-lines {
    position: absolute;
    left: 0;
    top: 0;
    pointer-events: none;
    z-index: 0;
}

.bracket-box {
    position: absolute;
    z-index: 1;
    box-sizing: border-box;
    border: 1px solid var(--xmas-gold);
    border-radius: 0.28rem;
    background: var(--xmas-cream-card);
    box-shadow: 0 1px 2px rgba(28, 23, 18, 0.1);
    overflow: visible;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
}

.bracket-box-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-radius: inherit;
}

.bracket-box-caption {
    flex: 0 0 12px;
    height: 12px;
    padding: 0 0.3rem;
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 12px;
    color: var(--xmas-muted);
    background: rgba(244, 238, 224, 0.92);
    border-bottom: 1px solid var(--xmas-border);
    border-radius: 0.28rem 0.28rem 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bracket-box-tag {
    position: absolute;
    top: 1px;
    right: calc(100% + 2px);
    left: auto;
    padding: 0 0.22rem;
    font-size: 0.5rem;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 11px;
    height: 11px;
    color: var(--xmas-muted);
    background: var(--xmas-stripe);
    border: 1px solid var(--xmas-border);
    border-radius: 0.2rem 0 0 0.2rem;
    white-space: nowrap;
    overflow: visible;
    z-index: 2;
    pointer-events: none;
}

.bracket-box-right .bracket-box-tag {
    right: auto;
    left: calc(100% + 2px);
    border-radius: 0 0.2rem 0.2rem 0;
}

.bracket-line {
    display: flex;
    align-items: center;
    gap: 0.25em;
    padding: 0 0.3rem;
    height: 20px;
    min-height: 20px;
    flex: 1 1 20px;
    font-size: 0.7rem;
    line-height: 1.1;
    box-sizing: border-box;
}

.bracket-line-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.bracket-score {
    margin-left: auto;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--xmas-ink);
    padding-left: 0.2rem;
    flex-shrink: 0;
}

.bracket-box .level-swatch {
    width: 8px;
    height: 8px;
    border-radius: 0.12em;
}

.bracket-line-winner {
    background: var(--xmas-winner-fill);
    font-weight: 800;
    color: var(--xmas-winner-text);
}
.bracket-line-winner .bracket-line-name,
.bracket-line-winner .bracket-score {
    color: inherit;
    font-weight: 800;
}
/* Keep the gold champion box from picking up the match-row winner fill. */
.bracket-champion .bracket-line-winner {
    background: transparent;
    color: #1c1712;
}
.bracket-champion .bracket-line-winner .bracket-line-name,
.bracket-champion .bracket-line-winner .bracket-score {
    color: inherit;
}

.bracket-line-loser {
    opacity: 0.48;
}

.bracket-box-ACTIVE {
    border-color: var(--xmas-red);
    box-shadow: 0 0 0 1px var(--xmas-red), 0 0 8px rgba(164, 22, 26, 0.4);
}

.bracket-box-ACTIVE .bracket-box-tag {
    color: var(--xmas-on-dark);
    background: var(--xmas-red);
}

.bracket-box-PENDING {
    border-color: var(--xmas-border);
    background: #f7f2e6;
}

.bracket-box-PENDING .bracket-line {
    color: var(--xmas-muted);
}

.bracket-box-COMPLETE {
    border-color: var(--xmas-gold);
}

.bracket-box-tbd {
    border-style: dashed;
    background: #f7f3ea;
}

.bracket-champion {
    border: 4px solid transparent;
    border-radius: 0.28rem;
    background:
        radial-gradient(120% 70% at 50% 0%, rgba(255, 248, 220, 0.95) 0%, rgba(255, 248, 220, 0) 58%),
        linear-gradient(180deg, #fffdf6 0%, #fff6d8 42%, #f4e6b5 100%) padding-box,
        linear-gradient(180deg, #fff3a0 0%, #d4a017 42%, #8a6d0b 72%, #f5d76e 100%) border-box;
    box-shadow:
        0 0 10px rgba(212, 160, 23, 0.6),
        0 0 0 1px rgba(138, 109, 11, 0.45),
        inset 0 1px 1px rgba(255, 243, 160, 0.95),
        inset 0 -1px 1px rgba(138, 109, 11, 0.28);
}

.bracket-champion.bracket-box-tbd {
    border-style: solid;
    background:
        radial-gradient(120% 70% at 50% 0%, rgba(255, 248, 220, 0.7) 0%, rgba(255, 248, 220, 0) 58%),
        linear-gradient(180deg, #fffdf8 0%, #f8f1d8 100%) padding-box,
        linear-gradient(180deg, #fff3a0 0%, #d4a017 42%, #8a6d0b 72%, #f5d76e 100%) border-box;
}

.bracket-champion .bracket-box-caption {
    flex: 0 0 18px;
    height: 18px;
    line-height: 18px;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #8a6d0b;
    background: rgba(255, 243, 160, 0.55);
    border-bottom: 1px solid rgba(212, 160, 23, 0.45);
}

.bracket-champion .bracket-line {
    height: 30px;
    min-height: 30px;
    flex: 1 1 30px;
    font-size: 1.1rem;
    font-weight: 700;
    justify-content: center;
    color: #1c1712;
}

.bracket-champion .bracket-line-name {
    font-weight: 800;
    font-size: 1.14rem;
    flex: 0 1 auto;
    text-align: center;
}

.bracket-champion .level-swatch {
    width: 10px;
    height: 10px;
}

.bracket-champion-score {
    flex: 0 0 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.26rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
    color: #5c4308;
    line-height: 1;
}

.bracket-champion.bracket-box-tbd .bracket-champion-score,
.bracket-champion.bracket-box-tbd .bracket-line {
    color: var(--xmas-muted);
    font-weight: 700;
}

.bracket-box-right .bracket-line {
    flex-direction: row-reverse;
}

.bracket-box-right .bracket-line-name {
    text-align: right;
}

.bracket-box-right .bracket-score {
    margin-left: 0;
    padding-left: 0;
    padding-right: 0.2rem;
}

.bracket-box-final {
    border-width: 2.5px;
    border-color: var(--xmas-gold);
    box-shadow: 0 0 0 1px var(--xmas-gold), 0 2px 8px rgba(201, 162, 39, 0.32);
}

.bracket-box-final .bracket-line {
    font-size: 0.8rem;
    height: 24px;
    min-height: 24px;
    flex: 1 1 24px;
}

.bracket-box-final .bracket-line-name {
    font-weight: 600;
}

.bracket-final-trophy {
    position: absolute;
    z-index: 5;
    pointer-events: none;
    user-select: none;
    filter: drop-shadow(0 2px 3px rgba(28, 23, 18, 0.3));
}

.bracket-final-trophy img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.bracket-trophy-plaque {
    position: absolute;
    left: 35.379%;
    top: 80.809%;
    width: 29.241%;
    height: 11.88%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 0 5%;
    overflow: hidden;
    color: #1a1008;
    font-family: "Noto Serif", "Source Serif Pro", Georgia, "Times New Roman", serif;
    font-weight: 700;
    font-variant: small-caps;
    font-size: 12px;
    letter-spacing: 0.03em;
    line-height: 1.05;
    text-align: center;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-shadow: 0 1px 0 rgba(255, 236, 180, 0.75);
}

.bracket-final-trophy.is-dim {
    opacity: 0.38;
    filter: grayscale(0.45) drop-shadow(0 1px 1px rgba(28, 23, 18, 0.18));
}

.bracket-final-trophy.is-lit {
    opacity: 1;
}

/* P11 Finals: fit the whole page in the viewport (100dvh / innerHeight). */
body.page-finals {
    background: #d4e6f4;
    display: flex;
    flex-direction: column;
    height: 100dvh;
    max-height: 100dvh;
    min-height: 0;
    overflow: hidden;
}

body.page-finals .app-header {
    margin-bottom: 0;
    flex: 0 0 auto;
}

body.page-finals .app-header .navbar {
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}

body.page-finals .app-header .navbar-brand {
    font-size: 1.67rem;
}

body.page-finals > .container {
    max-width: none;
    width: 100%;
    padding: 0;
    margin: 0;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body.page-finals main.pb-3 {
    padding: 0 !important;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body.page-finals .app-footer {
    display: none;
}

body.page-finals .snowflake {
    text-shadow: 0 0 6px #fff, 0 0 12px rgba(255, 255, 255, 0.8);
}

.finals-page {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.finals-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.25rem 0.5rem;
    padding: 0.25rem 0.7rem;
    background: linear-gradient(180deg, var(--xmas-cranberry-dark) 0%, var(--xmas-cranberry-deep) 100%);
    border-bottom: 2px solid var(--xmas-gold);
    color: var(--xmas-on-dark);
    position: relative;
    z-index: 3;
    flex: 0 0 auto;
    min-height: 2rem;
}

.finals-toolbar-left,
.finals-toolbar-right {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.35rem 0.5rem;
    z-index: 2;
    flex: 1 1 0;
    min-width: 0;
}

.finals-toolbar-right {
    justify-content: flex-end;
    flex: 0 0 auto;
}

.finals-toolbar-spacer {
    flex: 0 0 auto;
    visibility: hidden;
    pointer-events: none;
}

.finals-toolbar-spacer .finals-toolbar-right {
    justify-content: flex-start;
}

.finals-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    -webkit-transform: translateX(-50%);
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--xmas-on-dark);
    text-align: center;
    max-width: calc(100% - 22rem);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    z-index: 1;
}

.finals-title-group {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 0.4rem 0.55rem;
    flex: 1 1 auto;
    min-width: 0;
    z-index: 1;
    overflow: hidden;
}

.finals-title-group .finals-title {
    position: static;
    left: auto;
    transform: none;
    -webkit-transform: none;
    max-width: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.finals-toolbar-right .btn {
    white-space: nowrap;
}

/* Shared P07 / P10 / P11 tournament banner (admin). TV finals keep .finals-toolbar. */
.tourney-bar {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.5rem;
    padding: 0.25rem 0.7rem;
    background: linear-gradient(180deg, var(--xmas-cranberry-dark) 0%, var(--xmas-cranberry-deep) 100%);
    border-bottom: 2px solid var(--xmas-gold);
    color: var(--xmas-on-dark);
    position: relative;
    z-index: 3;
    flex: 0 0 auto;
    width: 100%;
    min-height: 2rem;
    box-sizing: border-box;
}

.tourney-bar-spacer,
.tourney-bar-right {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.35rem 0.5rem;
    flex: 0 0 auto;
    z-index: 2;
}

.tourney-bar-spacer {
    visibility: hidden;
    pointer-events: none;
}

.tourney-bar-zoom {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    -webkit-transform: none;
    flex: 0 0 auto;
    z-index: 3;
    margin-right: 0.35rem;
}

/* P10: keep the title on the far left and the page buttons on the far right,
   with fit-to-screen / zoom sitting in the true horizontal center. */
.tourney-bar.has-zoom {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 0.5rem;
}

.tourney-bar.has-zoom .tourney-bar-title {
    grid-column: 1;
    justify-self: start;
    min-width: 0;
    max-width: 100%;
}

.tourney-bar.has-zoom .tourney-bar-zoom {
    grid-column: 2;
    justify-self: center;
    margin-right: 0;
}

.tourney-bar.has-zoom .tourney-bar-right {
    grid-column: 3;
    justify-self: end;
    min-width: 0;
}

.tourney-bar-right .btn,
.tourney-bar-right form,
.tourney-bar-spacer .btn,
.tourney-bar-title .btn,
.tourney-bar-title form {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 1rem;
    line-height: 1.5;
    padding: 0.375rem 0.75rem;
}

/* Keep each variant's normal fill when it is the current page; Bootstrap's
   .active styles otherwise fade Tourney Admin into the slate bar. */
.tourney-bar-right .btn-secondary,
.tourney-bar-right .btn-secondary.active,
.tourney-bar-right .btn-secondary.active:hover,
.tourney-bar-right .btn-secondary.active:focus {
    background-color: #3a4a3f;
    border-color: #2c3a2c;
    color: var(--xmas-on-dark);
}

.tourney-bar-right .btn-secondary:hover:not(.active),
.tourney-bar-right .btn-secondary:focus:not(.active) {
    background-color: #2c3a2c;
    border-color: #1e281e;
    color: #fff;
}

.tourney-bar-right .btn-success,
.tourney-bar-right .btn-success.active,
.tourney-bar-right .btn-success.active:hover,
.tourney-bar-right .btn-success.active:focus {
    background-color: var(--xmas-green);
    border-color: var(--xmas-green-dark);
    color: #fff;
}

.tourney-bar-right .btn-success:hover:not(.active),
.tourney-bar-right .btn-success:focus:not(.active) {
    background-color: var(--xmas-green-dark);
    border-color: var(--xmas-pine-deep);
    color: #fff;
}

.tourney-bar-right .btn-warning,
.tourney-bar-right .btn-warning:hover,
.tourney-bar-right .btn-warning:focus,
.tourney-bar-title .btn-warning,
.tourney-bar-title .btn-warning:hover,
.tourney-bar-title .btn-warning:focus {
    background-color: var(--xmas-gold-bright);
    border-color: var(--xmas-gold);
    color: var(--xmas-ink);
}

.tourney-bar-right .btn.active,
.tourney-bar-right .btn.active:hover,
.tourney-bar-right .btn.active:focus {
    box-shadow: 0 0 0 2px var(--xmas-gold-bright);
}

.tourney-bar-title {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 0.4rem 0.55rem;
    flex: 1 1 auto;
    min-width: 0;
    z-index: 1;
    text-align: left;
}

.tourney-bar-title h1 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--xmas-on-dark);
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.tourney-bar-title .badge {
    flex: 0 0 auto;
}

/* P11 and TV finals only: larger tournament name / status.
   P10 and the TV bracket view keep the shared 1.05rem title. */
body.page-finals .tourney-bar-title h1,
body.page-pongview .tv-finals .tourney-bar-title h1 {
    font-size: 1.45rem;
}
body.page-finals .tourney-bar-title .badge,
body.page-pongview .tv-finals .tourney-bar-title .badge {
    font-size: 1rem;
    padding: 0.4em 0.7em;
}
body.page-finals .tourney-bar,
body.page-pongview .tv-finals .tourney-bar {
    min-height: 2.55rem;
    padding-top: 0.32rem;
    padding-bottom: 0.32rem;
}

/* Full-bleed the banner when the page still lives in a Bootstrap container. */
body.page-details .app-header,
body.page-bracket .app-header {
    margin-bottom: 0;
}

body.page-details .tourney-bar,
body.page-bracket .tourney-bar {
    left: 50%;
    margin-left: -50vw;
    width: 100vw;
    max-width: 100vw;
}

body.page-details .tourney-bar {
    margin-bottom: 1rem;
}

body.page-bracket .tourney-bar {
    margin-bottom: 0.4rem;
}

.tourney-bar .bracket-zoom-controls .btn {
    background: rgba(255, 248, 231, 0.12);
    border-color: rgba(255, 248, 231, 0.45);
    color: var(--xmas-on-dark);
}

.tourney-bar .bracket-zoom-controls .btn:hover,
.tourney-bar .bracket-zoom-controls .btn:focus {
    background: rgba(255, 248, 231, 0.22);
    border-color: rgba(255, 248, 231, 0.7);
    color: var(--xmas-on-dark);
}

.tourney-bar .bracket-zoom-controls .btn.is-active,
.tourney-bar .bracket-zoom-controls .btn.is-active:focus,
.tourney-bar .bracket-zoom-controls .btn.is-active:hover {
    background: var(--xmas-green) !important;
    border-color: var(--xmas-green-dark) !important;
    color: var(--xmas-on-dark) !important;
}

.tourney-bar .bracket-zoom-pct {
    color: var(--xmas-on-dark);
}


/* Sky band: headers stay at the top; match boxes are centered in the remaining space. */
.finals-bracket-band {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 0.15rem 0.5rem 0;
    background: linear-gradient(180deg, #c5dff2 0%, #d7e8f5 55%, #e4f0f9 100%);
}

.finals-bracket {
    position: relative;
    width: min(96%, 52rem);
    height: 9rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    pointer-events: none;
}

.finals-bracket-zoom {
    position: relative;
    flex: 0 0 auto;
}

body.page-finals .bracket-round-title {
    color: #15301c;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
    background: rgba(255, 252, 245, 0.7);
    border-radius: 0.25rem;
}

/* The P11 / TV finals column is already titled 3rd Place. */
body.page-finals .bracket-box-third .bracket-box-caption,
body.page-pongview .tv-finals .bracket-box-third .bracket-box-caption {
    display: none;
}

.finals-empty {
    margin: 0;
    padding: 0.4rem 0.8rem;
    background: rgba(255, 252, 245, 0.8);
    border-radius: 0.4rem;
    color: var(--xmas-ink);
}

/* Fills leftover height; the 16:9 stage is scaled by min(width, remainingHeight*16/9). */
.finals-scene {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(210, 230, 245, 0.35) 0%, rgba(255, 255, 255, 0) 28%),
        linear-gradient(180deg, #cfe4f2 0%, #e7f1f8 42%, #d9e8ef 70%, #c5dbe6 100%);
    box-shadow: inset 0 0 80px rgba(255, 255, 255, 0.35);
}

.finals-stage {
    container-type: size;
    position: relative;
    flex: 0 0 auto;
    width: min(100%, calc(var(--finals-scene-h, 100%) * 16 / 9));
    aspect-ratio: 16 / 9;
    max-width: 100%;
    max-height: 100%;
    margin: 0 auto;
    background-image: url("/images/finals-island.jpg?v=polar-v7");
    background-size: 100% 100%;
    background-position: center bottom;
    background-repeat: no-repeat;
}

.podium-place {
    position: absolute;
    z-index: 2;
    pointer-events: none;
}

/* Polar ice island (same art as P11 / TV): percentages are of the 16:9
   .finals-stage. Anchor X is the visual center of the top surface (average
   of the four top-face corners). Anchor Y is the visual center line of the
   visible top face (midpoint of the first opaque top-surface row and the
   front lip) so the circle bottom sits on the top with zero sky gap and
   does not reach the front rim or icicles. .podium-figure is a column
   (name label above the circle) anchored with bottom:100% + translateX(-50%).
   A soft contact shadow sits on the top face under the circle.
   Diameter is 64% of the measured back-edge top width (cqi of the stage).
   Measured pixel-by-pixel from the 1920x1080 polar art; podium geometry is unchanged in polar-v7. */
.podium-silver { left: 38.697917%; top: 64.166667%; }
.podium-gold   { left: 52.421875%; top: 59.907407%; }
.podium-bronze { left: 65.677083%; top: 66.944444%; }

.podium-figure {
    position: absolute;
    left: 0;
    bottom: 100%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 0.28em;
    z-index: 2;
}

/* Soft ellipse on the top face, just under the circle, to sell "resting". */
.podium-contact-shadow {
    position: absolute;
    left: 0;
    top: 1px;
    transform: translateX(-50%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    background: radial-gradient(ellipse at 50% 40%, rgba(18, 28, 38, 0.52) 0%, rgba(18, 28, 38, 0.28) 38%, rgba(18, 28, 38, 0) 72%);
}
.podium-silver .podium-contact-shadow {
    width: 5.16cqi;
    height: 0.26cqi;
}
.podium-gold .podium-contact-shadow {
    width: 5.74cqi;
    height: 0.24cqi;
}
.podium-bronze .podium-contact-shadow {
    width: 4.18cqi;
    height: 0.24cqi;
}

.podium-figure .member-photo,
.podium-photo-tbd {
    box-sizing: border-box;
    max-width: none;
    max-height: none;
}
.podium-silver .member-photo,
.podium-silver .podium-photo-tbd {
    width: 7.167cqi !important;
    height: 7.167cqi !important;
    font-size: 2.58cqi !important;
}
.podium-gold .member-photo,
.podium-gold .podium-photo-tbd {
    width: 7.967cqi !important;
    height: 7.967cqi !important;
    font-size: 2.868cqi !important;
}
.podium-bronze .member-photo,
.podium-bronze .podium-photo-tbd {
    width: 5.8cqi !important;
    height: 5.8cqi !important;
    font-size: 2.088cqi !important;
}

.podium-gold .member-photo { border-color: #f0d060; border-width: 3px; }
.podium-silver .member-photo { border-color: #b8c2cc; border-width: 3px; }
.podium-bronze .member-photo { border-color: #c9894a; border-width: 3px; }
.podium-figure .member-photo,
.podium-photo-tbd {
    box-shadow: 0 0 0 1px rgba(30, 40, 50, 0.35), 0 1px 2px rgba(20, 20, 30, 0.28);
}

.podium-photo-tbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 3px dashed rgba(255, 255, 255, 0.85);
    background: rgba(20, 30, 40, 0.35);
    color: #fff;
    font-weight: 700;
    box-sizing: border-box;
    flex: 0 0 auto;
}

.podium-label {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    max-width: 18cqi;
    padding: 0.18em 0.7em 0.18em 0.45em;
    border-radius: 999px;
    font-weight: 700;
    font-size: clamp(0.7rem, 1.35cqi, 1.02rem);
    line-height: 1.2;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(20, 20, 30, 0.35);
    flex: 0 0 auto;
}

.podium-name {
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.podium-medal-tag {
    font-size: 0.78em;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.85;
}

.podium-label-gold {
    color: #1a1008;
    background: linear-gradient(180deg, #ffe9a0 0%, #e0b02a 100%);
    border: 1.5px solid #a67c12;
}

.podium-label-silver {
    color: #1c242c;
    background: linear-gradient(180deg, #f5f7fa 0%, #c5ced6 100%);
    border: 1.5px solid #8a96a0;
}

.podium-label-bronze {
    color: #2a1408;
    background: linear-gradient(180deg, #f0c08a 0%, #c87a38 100%);
    border: 1.5px solid #8a4e18;
}

.podium-label-gold .podium-medal-tag,
.podium-label-silver .podium-medal-tag,
.podium-label-bronze .podium-medal-tag {
    opacity: 0.75;
}

/* TBD uses the same stacked figure: label above a dashed circle, sitting on the back rim. */

.finals-stamp {
    position: absolute;
    right: 0.6rem;
    bottom: 0.45rem;
    z-index: 3;
    padding: 0.12em 0.55em;
    font-size: 0.72rem;
    color: var(--xmas-ink);
    background: rgba(255, 252, 245, 0.72);
    border-radius: 0.3rem;
    pointer-events: none;
}


/* P11 and TV finals: full-bleed polar island under the header + title bar.
   Shared .finals-stage / .podium-* already use this art and the sit-on-top anchors. */
body.page-finals .finals-scene,
body.page-pongview .tv-finals .finals-scene {
    background: #8fa3b0;
    box-shadow: none;
    align-items: stretch;
    justify-content: flex-start;
}

body.page-finals .finals-stage,
body.page-pongview .tv-finals .finals-stage {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    max-width: none;
    max-height: none;
    margin: 0;
    background-image: url("/images/finals-island.jpg?v=polar-v7");
    background-size: 100% 100%;
    background-position: center bottom;
    background-repeat: no-repeat;
    z-index: 1;
}

body.page-finals .finals-bracket-band,
body.page-pongview .tv-finals .finals-bracket-band {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: auto;
    z-index: 4;
    height: 22rem;
    max-height: 42%;
    padding: 0.3rem 0.5rem 0;
    background: transparent;
    pointer-events: none;
    justify-content: center;
    align-items: flex-start;
}

body.page-finals .finals-bracket,
body.page-pongview .tv-finals .finals-bracket {
    width: min(98%, 66rem);
    height: 100%;
    pointer-events: none;
}

body.page-finals .finals-bracket .bracket-box,
body.page-pongview .tv-finals .finals-bracket .bracket-box,
body.page-finals .finals-bracket .bracket-round-title,
body.page-pongview .tv-finals .finals-bracket .bracket-round-title,
body.page-finals .finals-empty,
body.page-pongview .tv-finals .finals-empty {
    pointer-events: auto;
}

/* Frosted ice/glass overlay. The first block is a solid-ish translucent
   fallback for TVs (Tizen) that ignore backdrop-filter. */
body.page-finals .bracket-round-title,
body.page-pongview .tv-finals .bracket-round-title {
    height: 40px;
    font-size: 1.4rem;
    letter-spacing: 0;
    overflow: visible;
    text-overflow: clip;
    padding: 0 0.85rem;
    color: #15301c;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
    background: rgba(236, 246, 255, 0.88);
    border: 1px solid rgba(210, 230, 245, 0.95);
    border-radius: 999px;
    box-shadow: 0 2px 10px rgba(20, 40, 60, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

body.page-finals .bracket-box,
body.page-pongview .tv-finals .bracket-box {
    background: rgba(236, 246, 255, 0.86);
    border-color: rgba(190, 220, 240, 0.95);
    border-radius: 0.45rem;
    box-shadow: 0 3px 14px rgba(20, 40, 60, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.35);
}

body.page-finals .bracket-box-PENDING,
body.page-pongview .tv-finals .bracket-box-PENDING,
body.page-finals .bracket-box-tbd,
body.page-pongview .tv-finals .bracket-box-tbd {
    background: rgba(228, 240, 250, 0.82);
}

body.page-finals .bracket-box-caption,
body.page-pongview .tv-finals .bracket-box-caption {
    background: rgba(220, 236, 248, 0.8);
}

/* Winner rows stay solid green with light text, even on the frosted boxes. */
body.page-finals .finals-bracket .bracket-line-winner,
body.page-pongview .tv-finals .finals-bracket .bracket-line-winner {
    background: #1f8a45;
    color: var(--xmas-winner-text);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    text-shadow: none;
}

@supports ((-webkit-backdrop-filter: blur(8px)) or (backdrop-filter: blur(8px))) {
    body.page-finals .bracket-round-title,
    body.page-pongview .tv-finals .bracket-round-title {
        background: rgba(236, 246, 255, 0.52);
        -webkit-backdrop-filter: blur(12px) saturate(1.2);
        backdrop-filter: blur(12px) saturate(1.2);
    }
    body.page-finals .bracket-box,
    body.page-pongview .tv-finals .bracket-box {
        background: rgba(236, 246, 255, 0.5);
        -webkit-backdrop-filter: blur(12px) saturate(1.2);
        backdrop-filter: blur(12px) saturate(1.2);
    }
    body.page-finals .bracket-box-PENDING,
    body.page-pongview .tv-finals .bracket-box-PENDING,
    body.page-finals .bracket-box-tbd,
    body.page-pongview .tv-finals .bracket-box-tbd {
        background: rgba(228, 240, 250, 0.46);
    }
    body.page-finals .bracket-box-caption,
    body.page-pongview .tv-finals .bracket-box-caption {
        background: rgba(220, 236, 248, 0.46);
    }
    body.page-finals .finals-bracket .bracket-line-winner,
    body.page-pongview .tv-finals .finals-bracket .bracket-line-winner {
        background: #1f8a45;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
}

body.page-finals .bracket-lines,
body.page-pongview .tv-finals .bracket-lines {
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}

body.page-finals .finals-empty,
body.page-pongview .tv-finals .finals-empty {
    background: rgba(255, 252, 245, 0.78);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

body.page-finals .finals-stamp,
body.page-pongview .tv-finals .finals-stamp {
    background: rgba(255, 252, 245, 0.7);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}


/* P09 scoreboard: back button up top, news-style match chyron at the bottom */
body.page-match {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    height: 100dvh;
    overflow: hidden;
}

body.page-match .app-header {
    flex: 0 0 auto;
    margin-bottom: 0.25rem;
}

body.page-match > .container {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
}

body.page-match main.pb-3 {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding-bottom: 0 !important;
}

body.page-match .app-footer {
    flex: 0 0 auto;
    margin-top: 0.25rem !important;
    margin-bottom: 0.25rem !important;
}

body.page-match .app-footer .footer-table {
    width: 5.5rem;
    height: auto;
}

.match-page {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.match-topbar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    position: relative;
    left: 50%;
    margin-left: -50vw;
    width: 100vw;
    box-sizing: border-box;
    min-height: 2.4rem;
    padding: 0.1rem 1rem 0.25rem;
    flex-wrap: nowrap;
    gap: 0.5rem;
}

.match-topbar-titles {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    flex: 1 1 auto;
    min-width: 0;
}

.match-topbar-spacer {
    flex: 0 0 auto;
    visibility: hidden;
    pointer-events: none;
}

.match-topbar .match-meta {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    margin: 0;
    text-align: left;
    font-family: Georgia, "Palatino Linotype", Palatino, "Times New Roman", serif;
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    color: var(--xmas-red-dark);
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.match-topbar .match-status-line {
    margin: 0.08rem 0 0;
    font-family: Georgia, "Palatino Linotype", Palatino, "Times New Roman", serif;
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.2;
    color: var(--xmas-red-dark);
    text-align: left;
    opacity: 0.82;
    white-space: nowrap;
}

.match-topbar-actions {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.5rem;
    flex: 0 0 auto;
    z-index: 2;
}

.match-scoreboard-wrap {
    flex: 0 0 auto;
    min-height: 0;
    overflow: visible;
    padding-bottom: 0;
}

.chyron-region {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 1:3 split of leftover space below the scoreboard places the chyron
   25% of the way toward the footer, with a 12px minimum gap. */
.chyron-spacer-before {
    flex: 1 1 0;
    min-height: 12px;
}

.chyron-spacer-after {
    flex: 3 1 0;
    min-height: 0;
}

.match-chyron {
    flex: 0 0 auto;
    display: flex;
    align-items: stretch;
    min-height: 3.55rem;
    margin-top: 0;
    background: linear-gradient(180deg, #123321 0%, var(--xmas-pine-deep) 60%, #081a0f 100%);
    color: var(--xmas-on-dark);
    overflow: hidden;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    border: 3px solid var(--xmas-holly);
}

.chyron-tag {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4em;
    padding: 0 0.9rem;
    background: linear-gradient(180deg, #c0262b 0%, var(--xmas-cranberry-dark) 100%);
    color: var(--xmas-on-dark);
    font-weight: 800;
    font-size: 0.82rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-right: 2px solid var(--xmas-holly);
    z-index: 2;
}

.chyron-tag.is-live::before {
    content: "";
    width: 0.55em;
    height: 0.55em;
    border-radius: 50%;
    background: var(--xmas-gold-pale);
    box-shadow: 0 0 6px var(--xmas-gold-light);
    animation: chyron-live-dot 1.2s ease-in-out infinite;
}

.chyron-viewport {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    padding: 0.35rem 0.35rem;
}

.chyron-track {
    display: flex;
    align-items: center;
    width: max-content;
    animation-name: chyron-scroll;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

.chyron-viewport:hover .chyron-track,
.chyron-viewport:active .chyron-track,
.chyron-viewport.is-paused .chyron-track {
    animation-play-state: paused;
}

.chyron-loop {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0 0.225rem;
}

.chyron-box {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.1rem;
    min-width: 9.75rem;
    margin: 0;
    padding: 0.22rem 0.6rem 0.28rem;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid var(--xmas-holly);
    border-radius: 0.25rem;
    color: var(--xmas-on-dark);
    text-decoration: none;
    -webkit-text-decoration: none;
    white-space: nowrap;
    box-sizing: border-box;
}

.chyron-box:hover,
.chyron-box:focus,
.chyron-box:visited {
    color: var(--xmas-on-dark);
    text-decoration: none;
    -webkit-text-decoration: none;
}

.chyron-box.is-current,
.chyron-box.is-active {
    border-color: var(--xmas-gold-light);
    box-shadow: 0 0 0 1px var(--xmas-gold-light), 0 0 8px rgba(226, 195, 90, 0.35);
    background: rgba(226, 195, 90, 0.12);
}

.chyron-id {
    font-weight: 800;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    color: var(--xmas-gold-light);
}

.chyron-player {
    display: flex;
    align-items: center;
    gap: 0.3em;
    font-size: 0.78rem;
    line-height: 1.2;
}

.chyron-player.is-winner {
    color: var(--xmas-winner-text);
    background: var(--xmas-winner-fill);
    font-weight: 700;
    border-radius: 999px;
    padding: 0.05em 0.4em 0.05em 0.2em;
}

.chyron-player.is-winner .chyron-score {
    color: var(--xmas-winner-text);
}

.chyron-player.is-loser {
    opacity: 0.55;
}

.chyron-score {
    margin-left: auto;
    padding-left: 0.55em;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

@keyframes chyron-scroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

@keyframes chyron-live-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
    .chyron-tag.is-live::before {
        animation: none;
    }

    .chyron-track {
        animation: none !important;
        transform: none;
    }

    .chyron-viewport {
        overflow-x: auto;
    }

    .chyron-loop + .chyron-loop {
        display: none;
    }
}


/* Compact P09 so the scoreboard, actions, and chyron all fit iPad landscape. */
.zoom-fit-label-short { display: none; }

@media (max-width: 1100px) {
    .match-topbar-actions .btn,
    .bracket-toolbar-right > .btn,
    .bracket-toolbar-right > a.btn,
    .finals-toolbar-right .btn,
    .tourney-bar-right .btn,
    .tourney-bar-spacer .btn {
        padding: 0.2rem 0.5rem;
        font-size: 0.875rem;
        line-height: 1.3;
    }

    .zoom-fit-label-full { display: none; }
    .zoom-fit-label-short { display: inline; }
    .bracket-zoom-pct { display: none; }
}

body.page-match .scoreboard .match-meta {
    font-size: 1.45rem;
    letter-spacing: 0.03em;
    margin-bottom: 0.1rem;
    line-height: 1.15;
}

body.page-match .match-topbar .match-meta {
    margin-bottom: 0;
}

/* Give the centered P09 title enough room to stay on one line at 1280. */
@media (max-width: 1280px) {
    .match-topbar-actions .btn {
        padding: 0.2rem 0.5rem;
        font-size: 0.875rem;
        line-height: 1.3;
    }
}

/* At iPad width, wrap the P09 title to two lines rather than ellipsizing or colliding with the buttons. */
@media (max-width: 1024px) {
    .match-topbar .match-meta {
        white-space: normal;
    }
}

body.page-match .scoreboard .game-points {
    margin-bottom: 0.3rem !important;
    font-size: 2.16rem;
    font-weight: 700;
    color: var(--xmas-green);
}

body.page-match .scoreboard .player-card {
    padding: 0.5rem 0.7rem 0.55rem;
}

body.page-match .scoreboard .player-card .member-photo {
    width: 88px !important;
    height: 88px !important;
}

body.page-match .scoreboard .player-name {
    font-size: 5.775rem;
    margin-top: 0.15rem;
}

body.page-match .scoreboard .level-swatch {
    width: 3.3rem;
    height: 3.3rem;
}

body.page-match .scoreboard .player-card .text-muted {
    font-size: 1.425rem;
    line-height: 1.2;
    margin-top: 0.1rem;
}

body.page-match .scoreboard .vs-text {
    font-size: 5.625rem;
    line-height: 1;
}

body.page-match .scoreboard .score-value {
    font-size: 3.9rem;
}

body.page-match .scoreboard .score-btn {
    font-size: 1.15rem;
    width: 2.6rem;
    height: 2.2rem;
    min-width: 2.6rem;
    min-height: 2.2rem;
    border-radius: 0.45rem;
}

body.page-match .scoreboard .score-box {
    gap: 0.45rem;
    margin-top: 0.35rem !important;
}

body.page-match .scoreboard .winner-label {
    font-size: 1.425rem;
    margin-top: 0.15rem !important;
}

body.page-match .match-actions {
    margin-top: 0.45rem !important;
    margin-bottom: 0;
}

body.page-match .move-player-btn {
    margin-top: 0.55rem;
    white-space: nowrap;
}

.move-player-hint {
    margin: 0 0 0.75rem;
    color: var(--xmas-muted);
}

.move-player-list {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.move-player-match {
    border: 1px solid var(--xmas-border);
    border-radius: 0.55rem;
    background: #fff;
    overflow: hidden;
}

.move-player-match-head {
    padding: 0.35rem 0.7rem;
    background: var(--xmas-green);
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.move-player-round {
    font-weight: 600;
    opacity: 0.9;
}

.move-player-match-head > * + * {
    margin-left: 0.45rem;
}

.move-player-slots {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
    padding: 0.5rem;
}

.move-player-slot {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    min-height: 3.1rem;
    padding: 0.35rem 0.55rem;
    border: 2px solid var(--xmas-border);
    border-radius: 0.45rem;
    background: var(--xmas-cream-card);
    color: var(--xmas-ink);
    text-align: left;
    cursor: pointer;
}

.move-player-slot:hover:not(:disabled):not(.is-current) {
    border-color: var(--xmas-green);
    background: #f6fff6;
}

.move-player-slot.is-selected {
    border-color: var(--xmas-gold);
    background: #fff8e1;
    box-shadow: 0 0 0 2px var(--xmas-gold-bright);
}

.move-player-slot.is-current,
.move-player-slot:disabled {
    opacity: 0.55;
    cursor: default;
    background: #f0f0f0;
}

.move-player-slot-name {
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.move-player-empty {
    font-weight: 700;
    color: var(--xmas-muted);
    font-style: italic;
}

.move-player-slot .member-photo {
    flex: 0 0 auto;
}

.move-player-slot .level-swatch {
    flex: 0 0 auto;
    width: 1.05rem;
    height: 1.05rem;
}

body.page-match .scoreboard .row {
    --bs-gutter-y: 0.4rem;
}

/* Keep the doubled banner names, but leave room for the chyron on shorter screens. */
@media (max-height: 800px) {
    body.page-match .scoreboard .player-card .member-photo {
        width: 64px !important;
        height: 64px !important;
    }
    body.page-match .scoreboard .player-card {
        padding: 0.28rem 0.45rem 0.32rem;
    }
    body.page-match .scoreboard .score-box {
        margin-top: 0.2rem !important;
        gap: 0.35rem;
    }
    body.page-match .scoreboard .game-points {
        margin-bottom: 0.2rem !important;
    }
    body.page-match .scoreboard .player-name {
        margin-top: 0.08rem;
    }
}

/* At 1280x720, keep the 50% larger match type but tuck the header and
   footer so the chyron does not collide with the stamp. */
@media (max-height: 740px) {
    body.page-match .app-header {
        margin-bottom: 0;
    }
    body.page-match .app-header .navbar {
        padding-top: 0.35rem;
        padding-bottom: 0.35rem;
    }
    body.page-match .app-footer {
        margin-top: 0.1rem !important;
        margin-bottom: 0.1rem !important;
    }
    body.page-match .app-footer .footer-mark {
        margin-bottom: 0.1rem;
    }
    body.page-match .app-footer .footer-mark .paddle-icon {
        width: 1.35em;
        height: 1.35em;
    }
    body.page-match .app-footer .footer-table {
        width: 4.2rem;
    }
    body.page-match .app-footer .footer-stamp {
        font-size: 0.7rem;
    }
}


/* Keep the app dialog hidden until it is shown. */
#appDialog:not(.show),
#appDialog.modal:not(.show),
#movePlayerModal:not(.show),
#movePlayerModal.modal:not(.show) {
    display: none !important;
}


/* Public welcome page at / (no admin links). */
body.page-welcome .navbar-brand {
    justify-self: center;
}
.welcome-card {
    text-align: center;
    padding: 3rem 1rem 2rem;
}
.welcome-msg {
    font-size: 1.25rem;
    color: var(--xmas-muted);
    margin-top: 1rem;
}

/* P12 TV display (/PongView/{id}): fit 1920x1080, 1280x720, and 960x540, no scroll, no cursor.
   Do not combine modern selectors (e.g. :has()) with these rules — old Chromium would drop the block. */
html.page-pongview,
body.page-pongview {
    height: 100%;
    height: 100vh;
    max-height: 100%;
    max-height: 100vh;
    overflow: hidden;
    cursor: none;
    margin: 0;
}
body.page-pongview {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    flex-direction: column;
    box-sizing: border-box;
}

body.page-pongview .app-header {
    flex: 0 0 auto;
    margin-bottom: 0;
}

body.page-pongview .app-header .navbar {
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}

body.page-pongview .app-header .navbar-brand {
    font-size: 1.67rem;
}

body.page-pongview .app-footer,
body.page-pongview .navbar-nav {
    display: none;
}

.pongview-stage {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 1;
    transition: opacity 0.28s ease;
}

.pongview-stage.is-fading {
    opacity: 0;
}

.pongview-stage > .tv-panel {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pongview-hud {
    position: fixed;
    right: 0.7rem;
    bottom: 0.45rem;
    z-index: 20;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: rgba(28, 23, 18, 0.7);
    background: rgba(255, 252, 245, 0.72);
    border-radius: 0.3rem;
    padding: 0.12em 0.55em;
    pointer-events: none;
}

.pongview-hud span + span {
    margin-left: 0.45em;
}

.pongview-missing {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
}

.pongview-missing h1 {
    font-size: 2.4rem;
    margin-bottom: 0.6rem;
}

.tv-match {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tv-scoreboard {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0.4rem 1.2rem 0.3rem;
    overflow: hidden;
}

.tv-match-banner {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 0.15rem;
}

.tv-match-banner.is-live {
    color: var(--xmas-cranberry);
}

.tv-match-banner.is-upnext {
    color: var(--xmas-green-dark);
}

/* TV match typography is applied with the P09 rules below (body.page-pongview .tv-match). */

body.page-pongview .tv-match .match-chyron {
    flex: 0 0 auto;
    margin-top: 0;
}

.tv-waiting {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.tv-waiting-kicker {
    font-size: 1.2rem;
    color: var(--xmas-muted);
    margin-bottom: 0.4rem;
}

.tv-waiting-title {
    font-size: 2.6rem;
    font-weight: 700;
    color: var(--xmas-red-dark);
}

.tv-bracket {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0.25rem 0.6rem 0.4rem;
}

.tv-bracket-title {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.4rem 0.55rem;
    text-align: left;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--xmas-green-dark);
    margin-bottom: 0.2rem;
}

.tv-bracket-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.tv-finals {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body.page-pongview .tv-finals-toolbar {
    justify-content: flex-start;
}

body.page-pongview .tv-finals-toolbar .finals-title-group {
    justify-content: flex-start;
}

body.page-pongview .tv-scoreboard .match-meta {
    text-align: left;
}

body.page-pongview .chyron-box {
    /* TV boxes are divs, not links */
    cursor: inherit;
}

@media (max-height: 800px) {
    .tv-waiting-title { font-size: 2rem; }
}


.pongview-stamp {
    position: fixed;
    left: 0.7rem;
    bottom: 0.45rem;
    z-index: 20;
    font-size: 0.72rem;
    color: rgba(28, 23, 18, 0.7);
    background: rgba(255, 252, 245, 0.72);
    border-radius: 0.3rem;
    padding: 0.12em 0.55em;
    pointer-events: none;
}

body.page-pongview .finals-stamp {
    /* Keep the in-scene stamp too; the shell stamp is the global TV build label. */
}



/* TV-safe snow (no CSS variables in keyframes — old Chromium will not animate var()). */
@-webkit-keyframes snowfall-tv {
    0% { -webkit-transform: translateY(-20px); transform: translateY(-20px); }
    100% { -webkit-transform: translateY(110vh); transform: translateY(110vh); }
}
@keyframes snowfall-tv {
    0% { -webkit-transform: translateY(-20px); transform: translateY(-20px); }
    100% { -webkit-transform: translateY(110vh); transform: translateY(110vh); }
}

/* Fallbacks for old Chromium / Tizen on the TV display only. */
body.page-pongview .app-header .navbar .container-fluid {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    position: relative;
    padding-left: 16px;
    padding-right: 16px;
}
body.page-pongview .page-id {
    position: absolute;
    left: 16px;
    top: 50%;
    margin-top: -0.5em;
    justify-self: auto;
}
body.page-pongview .navbar-brand {
    justify-self: auto;
    margin: 0 auto;
}
body.page-pongview .title-with-paddles .paddle-icon {
    margin: 0 0.3em;
}
body.page-pongview .pongview-stage {
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 auto;
    flex: 1 1 auto;
    min-height: 240px;
    opacity: 1;
}
body.page-pongview .pongview-stage > .tv-panel,
body.page-pongview .tv-match,
body.page-pongview .tv-bracket,
body.page-pongview .tv-finals {
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 auto;
    flex: 1 1 auto;
    min-height: 0;
}
body.page-pongview .finals-toolbar {
    /* gap fallback */
}
body.page-pongview .finals-toolbar > * {
    margin: 0.15rem 0.25rem;
}
body.page-pongview .finals-title {
    margin: 0;
}

/* TV finals share P11 polar anchors, circle sizes, and the overlay band.
   Photo pixel sizes are applied by pongview.js for older TV browsers without cqi. */
body.page-pongview .tv-finals .podium-label > * {
    margin-right: 0.3em;
}
body.page-pongview .tv-scoreboard .row {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    margin-left: 0;
    margin-right: 0;
}
body.page-pongview .tv-scoreboard .row > [class*="col-"] {
    float: none;
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 0%;
    flex: 1 1 0%;
    width: auto;
    max-width: 42%;
    padding: 0 0.6rem;
    margin: 0;
}
body.page-pongview .tv-scoreboard .vs-text {
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 auto;
    flex: 0 0 auto;
    width: auto;
    max-width: none;
    padding: 0 0.4rem;
}
body.page-pongview .copy-view-status { }

/* P05 copy-view-link on the Tournaments list */
.view-link-cell {
    white-space: nowrap;
    vertical-align: middle;
}
.copy-view-status {
    margin-left: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--xmas-green-dark);
}
.copy-view-fallback {
    margin-top: 0.35rem;
    min-width: 16rem;
    max-width: 24rem;
    font-size: 0.82rem;
}


/* Full TV URL in the P05 copy-button tooltip */
.tv-view-tooltip {
    --bs-tooltip-max-width: 28rem;
}
.tv-view-tooltip .tooltip-inner {
    text-align: left;
    word-break: break-all;
    font-size: 0.82rem;
}


/* P05 rename tournament */
.tourney-name {
    font-weight: 600;
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 0.15em;
}
/* Shrink-to-fit columns so the pencil hugs the name; TV View Link takes the slack. */
.tourney-list-table .tourney-fit-col,
.tourney-list-table .tourney-name-col,
.tourney-list-table .tourney-edit-col {
    width: 1%;
    white-space: nowrap;
}
.tourney-list-table .tourney-fit-col {
    padding-right: 1.25rem;
}
/* ~100px between ID and Name (default cell pad-left 0.5rem + this right pad) */
.tourney-list-table .tourney-id-col {
    padding-right: 5.75rem;
}
.tourney-list-table .tourney-name-col {
    padding-right: 0.3rem;
}
/* Pencil sits a little after the longest name; modest gap before Scheduled Start */
.tourney-edit-col {
    width: 1%;
    text-align: left;
    white-space: nowrap;
    vertical-align: middle;
    padding-left: 1.25rem !important;
    padding-right: 1.75rem !important;
}
.tourney-list-table .tourney-sched-col {
    white-space: nowrap;
    padding-right: 2rem;
}
.tourney-list-table tbody td.tourney-sched-col {
    color: var(--xmas-ink);
}
/* Empty spacer takes the slack so TV View Link sits at the far right */
.tourney-list-table .tourney-spacer-col {
    width: auto;
    padding-left: 0;
    padding-right: 0;
}
.tourney-list-table .tourney-viewlink-col {
    text-align: right;
    padding-right: 0.75rem;
    padding-left: 1.25rem;
}
/* "Copied!" floats left of the button so the button never shifts */
.tourney-list-table td.tourney-viewlink-col {
    position: relative;
}
.tourney-list-table td.tourney-viewlink-col .copy-view-status {
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 0;
    margin-right: -0.5rem;
    white-space: nowrap;
}
.tourney-list-table td.tourney-viewlink-col .copy-view-fallback {
    margin-left: auto;
}
.tourney-name:hover,
.tourney-name:focus {
    color: var(--xmas-green-dark);
}
.tourney-rename-btn {
    padding: 0.1rem 0.35rem;
    vertical-align: middle;
    color: var(--xmas-green-dark);
    border-color: var(--xmas-gold);
    background: var(--xmas-cream-card);
}
.tourney-rename-btn:hover,
.tourney-rename-btn:focus {
    color: var(--xmas-on-dark);
    background: var(--xmas-green);
    border-color: var(--xmas-green-dark);
}
.tourney-rename-icon {
    display: block;
}


/* P10/P11 3rd place box under the Final */
.bracket-box-third {
    overflow: visible;
}
.bracket-box-third .bracket-box-caption {
    position: absolute;
    top: -15px;
    left: 0;
    right: 0;
    text-align: center;
    font-family: Georgia, "Palatino Linotype", Palatino, "Times New Roman", serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--xmas-green-dark);
    text-transform: uppercase;
    line-height: 1;
}
.chyron-box.is-third .chyron-id {
    color: var(--xmas-green-dark);
}


/* P07 Quick Score: compact P1/P2 inputs + save/win on one line. */
.quick-score {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    white-space: nowrap;
}

.quick-score-tag {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #4a433c;
    line-height: 1;
}

.quick-score-p1,
.quick-score-p2 {
    width: 3.2em;
    min-width: 3.2em;
    max-width: 3.2em;
    padding: 0.15rem 0.2rem;
    font-size: 0.85rem;
    text-align: center;
    line-height: 1.2;
    -moz-appearance: textfield;
    appearance: textfield;
}

.quick-score-p1::-webkit-outer-spin-button,
.quick-score-p1::-webkit-inner-spin-button,
.quick-score-p2::-webkit-outer-spin-button,
.quick-score-p2::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.quick-score .btn {
    padding: 0.15rem 0.4rem;
    font-size: 0.8rem;
    line-height: 1.2;
}

.quick-score-win:disabled {
    opacity: 0.55;
    pointer-events: none;
}

.matches-table {
    font-size: 0.95rem;
}

.matches-table td,
.matches-table th {
    padding: 0.35rem 0.45rem;
}

@media (max-width: 1280px) {
    .matches-table {
        font-size: 0.85rem;
    }
    .matches-table td,
    .matches-table th {
        padding: 0.3rem 0.3rem;
    }
    .matches-table .member-photo {
        width: 28px !important;
        height: 28px !important;
    }
}


/* P07 Test column */
.test-random {
    white-space: nowrap;
    padding: 0.15rem 0.4rem;
    font-size: 0.8rem;
    line-height: 1.2;
}


/* P12 TV chyron at 2x: twice as tall with ~2x text. Literal px so Tizen does not
   depend on rem rounding; the scoreboard gives up the height on short screens.
   The bar uses an explicit height (not only min-height) so descendants have a
   definite height. Boxes stretch to the bar with small padding. No flex gap
   (old Tizen WebKit ignores it); spacing uses margins. */
body.page-pongview .tv-match .match-chyron {
    height: 162px;
    min-height: 162px;
    border-width: 4px;
    box-sizing: border-box;
    align-items: stretch;
    -webkit-box-align: stretch;
}
body.page-pongview .tv-match .chyron-tag {
    font-size: 26px;
    padding: 0 28px;
    border-right-width: 3px;
    height: 100%;
    box-sizing: border-box;
    gap: 0;
}
body.page-pongview .tv-match .chyron-tag.is-live::before {
    width: 14px;
    height: 14px;
    margin-right: 10px;
}
body.page-pongview .tv-match .chyron-viewport {
    height: 100%;
    padding: 8px 10px;
    box-sizing: border-box;
    align-items: stretch;
    -webkit-box-align: stretch;
}
body.page-pongview .tv-match .chyron-track,
body.page-pongview .tv-match .chyron-loop {
    height: 100%;
    align-items: stretch;
    -webkit-box-align: stretch;
}
body.page-pongview .tv-match .chyron-loop {
    gap: 0;
    padding: 0;
}
body.page-pongview .tv-match .chyron-box {
    /* TV boxes are divs, not links */
    cursor: inherit;
    height: 100%;
    box-sizing: border-box;
    justify-content: center;
    gap: 0;
    min-width: 220px;
    margin: 0 6px;
    padding: 8px 16px;
}
body.page-pongview .tv-match .chyron-id {
    font-size: 22px;
    margin-bottom: 6px;
    line-height: 1.15;
}
body.page-pongview .tv-match .chyron-player {
    font-size: 24px;
    line-height: 1.2;
    gap: 0;
}
body.page-pongview .tv-match .chyron-player + .chyron-player {
    margin-top: 2px;
}
body.page-pongview .tv-match .chyron-score {
    margin-left: auto;
    padding-left: 12px;
}


/* Christmas theme touches: green nav buttons get a gold edge on the cranberry bars,
   bracket connectors pick up the palette gold. */
.tourney-bar .btn-success,
.tourney-bar .btn-success.active,
.finals-toolbar .btn-success {
    border-color: var(--xmas-gold-light) !important;
}
.tourney-bar .badge.bg-success,
.finals-toolbar .badge.bg-success {
    box-shadow: inset 0 0 0 1px rgba(251, 243, 224, 0.55);
}
.bracket-connector {
    stroke: var(--xmas-gold);
}


/* P08 uses the same full-bleed tourney bar as P07 */
body.page-members .app-header,
body.page-details .app-header,
body.page-bracket .app-header {
    margin-bottom: 0;
}
body.page-members .tourney-bar,
body.page-details .tourney-bar,
body.page-bracket .tourney-bar {
    left: 50%;
    margin-left: -50vw;
    width: 100vw;
    max-width: 100vw;
}
body.page-members .tourney-bar {
    margin-bottom: 1rem;
}

.tourney-bar-schedule {
    flex: 0 1 auto;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--xmas-gold-pale);
    white-space: nowrap;
}

.tourney-setup-row {
    margin-top: 0.15rem;
}

.setup-btn-wrap {
    display: inline-block;
    cursor: not-allowed;
}
.setup-btn-wrap .btn[disabled] {
    pointer-events: none;
    opacity: 0.65;
}

.tourney-schedule-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.55rem;
    margin: 0;
    margin-left: 0.35rem;
}
.tourney-schedule-label {
    margin: 0;
    font-weight: 600;
    white-space: nowrap;
    color: var(--xmas-ink);
}
.tourney-schedule-input {
    width: auto;
    min-width: 13.5rem;
    background: var(--xmas-card);
    border-color: var(--xmas-gold);
}

.rename-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem 1.25rem;
    align-items: flex-start;
}
.rename-field-name {
    flex: 1 1 14rem;
    min-width: 12rem;
}
.rename-field-start {
    flex: 1 1 16rem;
    min-width: 14rem;
}
.rename-start-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.rename-start-row .tourney-schedule-input {
    flex: 1 1 auto;
    width: auto;
    min-width: 12rem;
}

.tourney-closed-actions {
    white-space: nowrap;
}
.tourney-closed-actions form {
    margin-right: 0.35rem;
}


/* P12 pre-game countdown — bright daytime scene, no candy-cane stripe. */
body.page-pongview.is-countdown .pongview-hud {
    display: none !important;
}
body.page-pongview.is-countdown .candy-cane {
    display: none !important;
}

/* Match P07: dark pine header, candy-cane stripe, and a cranberry tourney bar. No nav buttons. */
body.page-pongview.is-countdown .app-header .navbar {
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
}

body.page-pongview.is-countdown .app-header .navbar-brand {
    font-size: 2.16rem;
}

body.page-pongview.is-countdown .tourney-bar {
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 auto;
    flex: 0 0 auto;
    margin-bottom: 0;
    width: 100%;
}

body.page-pongview.is-countdown .pongview-stamp {
    color: #1f5130;
    background: rgba(255, 252, 248, 0.86);
}

.tv-countdown {
    position: relative;
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 auto;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: start;
    -webkit-justify-content: flex-start;
    justify-content: flex-start;
    background-color: #7eb8e0;
    background-image: url("/images/countdown-scene.jpg");
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
    color: #1f1a17;
    text-align: center;
    padding: calc(1.1rem + 5vh) 1.25rem 0.8rem;
}

.tv-countdown-veil {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 42%;
    pointer-events: none;
    z-index: 1;
    background: -webkit-linear-gradient(top, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0.10) 58%, rgba(255, 255, 255, 0) 100%);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0.10) 58%, rgba(255, 255, 255, 0) 100%);
}

.tv-countdown-snow {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.tv-countdown-inner {
    position: relative;
    z-index: 3;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    max-width: 100%;
}

.tv-countdown-title {
    margin: 0 0 1rem;
    font-family: Georgia, "Palatino Linotype", Palatino, "Times New Roman", serif;
    font-size: 3.57rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    line-height: 1.15;
    color: #a4161a;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.95), 0 2px 10px rgba(20, 40, 70, 0.28), 0 0 18px rgba(255, 255, 255, 0.7);
}

.tv-countdown-clock {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: end;
    -webkit-align-items: flex-end;
    align-items: flex-end;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    gap: 0.4rem;
}

.tv-countdown-clock.is-hidden,
.tv-countdown-soon.is-hidden {
    display: none !important;
}

.tv-cd-unit {
    min-width: 6.1rem;
    padding: 0.58rem 0.7rem 0.5rem;
    background: rgba(255, 255, 255, 0.86);
    border: 2px solid #c9a227;
    -webkit-border-radius: 0.55rem;
    border-radius: 0.55rem;
    box-shadow: 0 4px 14px rgba(20, 40, 70, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.95);
    /* blur is a progressive enhancement; the rgba fill is the Tizen-safe look */
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.tv-cd-num {
    display: block;
    font-family: Georgia, "Palatino Linotype", Palatino, "Times New Roman", serif;
    font-size: 3.85rem;
    font-weight: 800;
    line-height: 1;
    color: #a4161a;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.tv-cd-label {
    display: block;
    margin-top: 0.22rem;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #1f5130;
}

.tv-cd-sep {
    font-family: Georgia, "Palatino Linotype", Palatino, "Times New Roman", serif;
    font-size: 3rem;
    font-weight: 700;
    color: #c9a227;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
    padding-bottom: 1.15rem;
}

.tv-countdown-soon {
    margin: 0.2rem 0 0;
    padding: 0.35rem 1.1rem;
    font-family: Georgia, "Palatino Linotype", Palatino, "Times New Roman", serif;
    font-size: 2.8rem;
    font-weight: 800;
    color: #a4161a;
    background: rgba(255, 255, 255, 0.86);
    border: 2px solid #c9a227;
    -webkit-border-radius: 0.55rem;
    border-radius: 0.55rem;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 14px rgba(20, 40, 70, 0.16);
}


.tv-countdown.has-roster {
    padding-top: 0.45rem;
}

.tv-countdown-roster {
    position: relative;
    z-index: 4;
    width: 100%;
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 auto;
    flex: 0 0 auto;
    overflow: hidden;
    margin: 0 0 0.7rem;
}

.tv-countdown-roster-viewport {
    position: relative;
    overflow: hidden;
    width: 100%;
}

.tv-countdown-roster-track {
    display: -webkit-inline-box;
    display: -webkit-inline-flex;
    display: inline-flex;
    width: auto;
    -webkit-box-align: start;
    -webkit-align-items: flex-start;
    align-items: flex-start;
    white-space: nowrap;
}

.tv-countdown-card {
    display: block;
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 auto;
    flex: 0 0 auto;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.86);
    border: 2px solid #c9a227;
    -webkit-border-radius: 0.55rem;
    border-radius: 0.55rem;
    box-shadow: 0 4px 14px rgba(20, 40, 70, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.95);
    text-align: center;
    overflow: hidden;
}

.tv-countdown-card-photo,
.tv-countdown-card .member-photo {
    display: block;
    margin: 0 auto;
    -webkit-border-radius: 50%;
    border-radius: 50%;
    object-fit: cover;
    background: #efe7d6;
}

.tv-countdown-card-first,
.tv-countdown-card-last {
    display: block;
    overflow: hidden;
    font-family: Georgia, "Palatino Linotype", Palatino, "Times New Roman", serif;
    font-weight: 700;
    color: #a4161a;
    line-height: 1.1;
    margin: 0;
}
.tv-countdown-card-first {
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tv-countdown-card-last {
    white-space: normal;
    word-wrap: break-word;
}

@media (max-width: 1100px), (max-height: 700px) {
    .tv-countdown { padding: calc(0.7rem + 5vh) 0.8rem 0.5rem; }
    .tv-countdown.has-roster { padding-top: 0.3rem; }
    .tv-countdown-title { font-size: 1.96rem; margin-bottom: 0.55rem; }
    .tv-cd-num { font-size: 2.15rem; }
    .tv-cd-unit { min-width: 3.7rem; padding: 0.32rem 0.38rem 0.26rem; }
    .tv-cd-label { font-size: 0.62rem; }
    .tv-cd-sep { font-size: 1.6rem; padding-bottom: 0.75rem; }
    .tv-countdown-soon { font-size: 1.85rem; padding: 0.25rem 0.75rem; }
}


/* P13 Admin settings */
body.page-admin h1 {
    font-size: 1.7rem;
    margin: 0.2rem 0 0.35rem;
}
body.page-admin hr {
    margin: 0.2rem 0 1rem;
}
body.page-admin .admin-settings-form {
    max-width: 32rem;
}
body.page-admin .admin-settings-form .form-label {
    font-weight: 700;
    color: var(--xmas-ink);
}
body.page-admin .admin-settings-form .form-select,
body.page-admin .admin-settings-form .form-control {
    max-width: 20rem;
}
body.page-admin .admin-settings-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.7rem;
    align-items: center;
    margin-top: 1.25rem;
}
body.page-admin .admin-settings-toggle {
    padding-left: 2.6rem;
    min-height: 1.6rem;
}
body.page-admin .admin-settings-toggle .form-check-input {
    width: 2.4rem;
    height: 1.2rem;
    margin-left: -2.6rem;
    cursor: pointer;
}
body.page-admin .admin-settings-toggle .form-check-label {
    font-weight: 700;
    color: var(--xmas-ink);
}

body.page-admin .admin-page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0.2rem 0 1rem;
}
body.page-admin .admin-page-head h1 {
    margin: 0;
}


/* TV match: same typography and title bar as P09 (no admin controls). */
body.page-pongview .tv-match .match-topbar {
    left: auto;
    margin-left: 0;
    width: 100%;
    padding-left: 0.7rem;
    padding-right: 0.7rem;
}
body.page-pongview .tv-match .scoreboard .game-points {
    margin-bottom: 0.3rem !important;
    font-size: 2.16rem;
    font-weight: 700;
    color: var(--xmas-green);
}
body.page-pongview .tv-match .scoreboard .player-card {
    padding: 0.5rem 0.7rem 0.55rem;
}
body.page-pongview .tv-match .scoreboard .player-card .member-photo {
    width: 88px !important;
    height: 88px !important;
}
body.page-pongview .tv-match .scoreboard .player-name {
    font-size: 5.775rem;
    margin-top: 0.15rem;
}
body.page-pongview .tv-match .scoreboard .level-swatch {
    width: 3.3rem;
    height: 3.3rem;
}
body.page-pongview .tv-match .scoreboard .player-card .text-muted {
    font-size: 1.425rem;
    line-height: 1.2;
    margin-top: 0.1rem;
}
body.page-pongview .tv-match .scoreboard .vs-text {
    font-size: 5.625rem;
    line-height: 1;
}
body.page-pongview .tv-match .scoreboard .score-value {
    font-size: 3.9rem;
}
body.page-pongview .tv-match .scoreboard .score-box {
    gap: 0.45rem;
    margin-top: 0.35rem !important;
}
body.page-pongview .tv-match .scoreboard .winner-label {
    font-size: 1.425rem;
    margin-top: 0.15rem !important;
}
body.page-pongview .tv-match .scoreboard .row {
    --bs-gutter-y: 0.4rem;
}
body.page-pongview .tv-match .chyron-region {
    flex: 1 1 auto;
    min-height: 0;
}
@media (max-height: 800px) {
    body.page-pongview .tv-match .scoreboard .player-card .member-photo {
        width: 64px !important;
        height: 64px !important;
    }
    body.page-pongview .tv-match .scoreboard .player-card {
        padding: 0.28rem 0.45rem 0.32rem;
    }
    body.page-pongview .tv-match .scoreboard .score-box {
        margin-top: 0.2rem !important;
        gap: 0.35rem;
    }
    body.page-pongview .tv-match .scoreboard .game-points {
        margin-bottom: 0.2rem !important;
    }
    body.page-pongview .tv-match .scoreboard .player-name {
        margin-top: 0.08rem;
    }
}

/* TV bracket / finals: same cranberry tourney bar as P10/P11, no admin buttons. */
body.page-pongview .tv-bracket .tourney-bar,
body.page-pongview .tv-finals .tourney-bar,
body.page-pongview.is-countdown .tourney-bar {
    left: auto;
    margin-left: 0;
    width: 100%;
    max-width: 100%;
    flex: 0 0 auto;
    margin-bottom: 0;
}



/* P09 / TV match: swap sides is a visual-only reorder (scores stay with the player). */
.scoreboard .match-sides {
    display: flex;
}
.scoreboard.is-swapped .match-side-1 {
    -webkit-box-ordinal-group: 4;
    -webkit-order: 3;
    order: 3;
}
.scoreboard.is-swapped .match-side-vs {
    -webkit-box-ordinal-group: 3;
    -webkit-order: 2;
    order: 2;
}
.scoreboard.is-swapped .match-side-2 {
    -webkit-box-ordinal-group: 2;
    -webkit-order: 1;
    order: 1;
}

body.page-match .match-swap-btn,
body.page-match .match-forfeit-btn {
    min-width: 8.5rem;
}
body.page-match .match-forfeit {
    margin-top: 0.75rem;
}
body.page-match .match-winner-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.55rem;
}
body.page-match .match-declare-form {
    margin: 0;
}

/* TV view override — slide-out sidebar on P07 / P09 / P10 / P11. */
.tv-sidebar-toggle {
    position: fixed;
    top: 50%;
    right: 0;
    z-index: 1041;
    transform: translateY(-50%);
    writing-mode: horizontal-tb;
    letter-spacing: 0.12em;
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff8e1;
    background: #145c30;
    border: 2px solid #c9a227;
    border-right: 0;
    border-radius: 10px 0 0 10px;
    padding: 0.7rem 0.55rem;
    box-shadow: -2px 2px 8px rgba(0, 0, 0, 0.35);
    cursor: pointer;
}
.tv-sidebar-toggle:hover,
.tv-sidebar-toggle:focus-visible {
    background: #1a7540;
    color: #fff;
    outline: none;
}
.tv-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: rgba(0, 0, 0, 0.4);
}
body.tv-sidebar-open .tv-sidebar-backdrop { display: block; }
.tv-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1042;
    width: 320px;
    max-width: 92vw;
    height: 100%;
    overflow-y: auto;
    color: #fff8e1;
    background: #14301c;
    border-left: 3px solid #c9a227;
    box-shadow: none;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    padding: 1.1rem 1.15rem 1.5rem;
}
.tv-sidebar.is-open {
    transform: translateX(0);
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.45);
}
.tv-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.tv-sidebar-header h2 {
    margin: 0;
    font-size: 1.35rem;
    color: #fff8e1;
}
.tv-sidebar-close {
    border: 0;
    background: transparent;
    color: #fff8e1;
    font-size: 1.8rem;
    line-height: 1;
    padding: 0 0.25rem;
    cursor: pointer;
}
.tv-sidebar-current,
.tv-sidebar-tournament {
    font-weight: 700;
    margin-bottom: 0.25rem;
}
.tv-sidebar-auto,
.tv-sidebar-hint {
    font-size: 0.88rem;
    color: #d9e8d4;
    margin-bottom: 0.85rem;
}
.tv-sidebar-options {
    border: 0;
    margin: 0 0 1rem;
    padding: 0;
}
.tv-sidebar-options legend {
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #fff8e1;
}
.tv-sidebar-option {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin: 0 0 0.45rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid rgba(201, 162, 39, 0.45);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.18);
    cursor: pointer;
}
.tv-sidebar-option:has(input:checked) {
    border-color: #c9a227;
    background: rgba(201, 162, 39, 0.2);
}
.tv-sidebar-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.tv-sidebar-option span {
    font-weight: 700;
}
.tv-sidebar-option small {
    color: #d9e8d4;
    line-height: 1.3;
}


/* P14 Move Players */
body.page-move-players .move-players-hint {
    max-width: 52rem;
    margin-bottom: 0.85rem;
}
body.page-move-players .member-picker-panels {
    display: block;
}
body.page-move-players .member-picker-panel {
    min-height: 0;
}
body.page-move-players .move-players-table-wrap {
    padding: 0.45rem 0.65rem 0.7rem;
}
body.page-move-players .move-players-table {
    margin: 0;
}
body.page-move-players .move-players-table td,
body.page-move-players .move-players-table th {
    vertical-align: middle;
}
.move-slot {
    min-height: 52px;
    cursor: grab;
    touch-action: none;
    max-width: 18rem;
}
.move-slot.is-empty {
    cursor: default;
    background: #f3eee4;
    color: var(--xmas-muted, #6b5a4a);
    justify-content: flex-start;
    gap: 0.35rem;
}
.move-slot.is-empty .move-slot-empty {
    font-weight: 600;
}
.move-slot.is-empty .move-slot-tbd {
    font-size: 0.85rem;
    color: var(--xmas-muted, #6b5a4a);
}
.move-slot.is-locked {
    cursor: grab;
    background: #f3eee4;
}
.move-slot.is-source {
    opacity: 0.55;
}
.move-slot.is-drop-ok {
    outline: 2px solid var(--xmas-green, #1f6b3a);
    background: #e7f4ea;
    box-shadow: 0 0 0 2px rgba(31, 107, 58, 0.2);
}
.move-slot.is-drop-no {
    outline: 2px solid #a0a0a0;
    background: #ececec;
    cursor: not-allowed;
}
.move-slot-ghost {
    box-shadow: 0 8px 18px rgba(40, 20, 10, 0.22);
    cursor: grabbing;
    background: #fff;
}
body.is-moving-player {
    cursor: grabbing;
    -webkit-user-select: none;
    user-select: none;
}
body.is-moving-player img {
    -webkit-user-drag: none;
    user-drag: none;
}
.move-players-result {
    white-space: nowrap;
}
.move-players-winner {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-left: 0.55rem;
    font-weight: 600;
}
.app-toast {
    position: fixed;
    left: 50%;
    bottom: 1.4rem;
    transform: translateX(-50%);
    z-index: 4100;
    min-width: 16rem;
    max-width: 28rem;
    padding: 0.7rem 1.05rem;
    border-radius: 0.45rem;
    background: var(--xmas-green, #1f6b3a);
    color: #fff;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 8px 20px rgba(20, 10, 0, 0.22);
}
.app-toast.is-error {
    background: #8b1e1e;
}
.app-toast[hidden] {
    display: none !important;
}
@media (max-width: 700px) {
    body.page-move-players .member-picker {
        display: block;
    }
}
