/* Ordinary time-trial layout adapters. All existing controls, portrait, table and modal skins
   come from root score-bp.css + css/score-bp-ui-theme.css. */
html,
body {
    margin: 0;
    overflow: hidden;
}
[hidden] {
    /* Business visibility state must win over component display:flex/grid. */
    display: none !important;
}

.scoreboard-container {
    height: 100vh;
}
.left-area {
    box-sizing: border-box;
    gap: 8px;
    padding: 10px;
    min-width: 0;
}
.left-area .home-logo {
    max-height: 100px;
    object-fit: contain;
    margin-bottom: 0;
    flex-shrink: 0;
}
.ranking-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 3px;
    margin-top: 4px;
    font-size: 12px;
}
.prelim-ranking {
    list-style: none;
    padding: 0;
    margin: 0 0 6px;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    flex: 1;
}
.prelim-ranking li {
    border-bottom: 1px solid
        color-mix(in srgb, var(--gsbp-ui-text) 9%, transparent);
}
.rank-row {
    width: 100%;
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr) auto;
    gap: 2px 4px;
    text-align: left;
    align-items: center;
    padding: 10px 3px;
    color: var(--gsbp-ui-text);
    background: transparent;
    border: 0;
    font-size: 12px;
    cursor: pointer;
}
.rank-row:hover {
    background: var(--gsbp-ui-neutral-hover);
}
.rank-row b {
    font-weight: 500;
    overflow-wrap: anywhere;
}
.rank-row small {
    grid-column: 2/4;
    color: var(--gsbp-ui-text-muted);
    font-size: 10px;
}
.sidebar-bottom {
    flex-shrink: 0;
}
.match-name-display {
    display: block;
    top: 32px;
    font-size: clamp(24px, 2.1vw, 40px);
}
.bo-info-display {
    display: block;
    top: 95px;
    font-size: clamp(15px, 1.3vw, 24px);
}
.stage-copy {
    text-align: center;
    max-width: 700px;
    padding: 24px;
    font-size: 18px;
    line-height: 2;
    color: var(--gsbp-ui-text);
}
.bottom-left,
.bottom-right,
.bottom-center {
    box-sizing: border-box;
    min-width: 0;
}
html.gsbp-ui-appearance:not(.gsbp-electron-broadcast-ui)
    .bottom-area
    .timer-table {
    grid-template-rows: 17px repeat(3, minmax(0, 1fr));
}
.timer-table td {
    cursor: default;
}
.timer-table .timer-cell {
    cursor: pointer;
}
.score-summary {
    font-size: 11px;
    color: var(--gsbp-ui-text-muted);
}
.bottom-center-top {
    font-size: 15px;
}
.bottom-center-top span {
    font-size: 15px;
}
.bottom-center-bottom {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 6px;
}
.result-unit {
    font-size: 12px;
    color: var(--gsbp-ui-text-muted);
}
.result-note {
    font-size: 11px;
    line-height: 1.5;
    text-align: center;
    color: var(--gsbp-ui-text-muted);
    min-height: 17px;
}
.scoreboard-actions {
    margin-top: 5px;
    flex-shrink: 0;
}
.scoreboard-actions button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.ban-heading {
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    margin: 0 6px 6px;
}
.prelim-bans {
    display: flex;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    flex-wrap: nowrap;
    --ban-min-size: 32px;
    --ban-count: 1;
    gap: 0;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex: 1;
}
.prelim-bans figure {
    margin: 0;
    /* Shrink portraits first, then overlap at the minimum readable size. */
    width: clamp(
        var(--ban-min-size),
        calc((100% - (var(--ban-count) - 1) * 8px) / var(--ban-count)),
        clamp(42px, 3.5vw, 68px)
    );
    flex: 0 0 auto;
    text-align: center;
}
.prelim-bans figure + figure {
    margin-left: min(
        8px,
        calc((100% - var(--ban-count) * var(--ban-min-size)) / max(1, var(--ban-count) - 1))
    );
}
.prelim-bans img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 50%;
    background: var(--gsbp-ui-surface-inset);
}
.prelim-bans figcaption {
    font-size: 10px;
    color: var(--gsbp-ui-text-muted);
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ban-note {
    font-size: 11px;
    margin: 5px 0 0;
    text-align: center;
    color: var(--gsbp-ui-text-muted);
}
@media (max-height: 800px) {
    .left-area .home-logo {
        max-height: 70px;
    }
    .match-name-display {
        top: 20px;
    }
    .bo-info-display {
        top: 65px;
    }
}
/* Entry setup uses the existing ordinary modal shell and palette. */
.setup-form {
    max-height: calc(100vh - 90px);
    overflow: auto;
    width: 540px;
    max-width: 90vw;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 28px;
}
.setup-form label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    font-size: 14px;
}
.setup-form select,
.setup-form input {
    width: 240px;
    padding: 8px;
    border: 1px solid var(--gsbp-ui-border);
    background: var(--gsbp-ui-surface-inset);
    color: var(--gsbp-ui-text);
    border-radius: 4px;
    font: inherit;
}
.setup-form p {
    font-size: 12px;
    line-height: 1.6;
    color: var(--gsbp-ui-text-muted);
}
.setup-form h2 {
    font-size: 22px;
}
#advanceEdit {
    font-size: 11px;
    color: var(--gsbp-ui-text-muted);
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

/* Host display fits inside the ordinary sidebar. */
.left-area .prelim-title {
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    margin: 0 0 8px;
    line-height: 1.4;
    cursor: pointer;
}
.sidebar-bottom .host-info-container {
    margin: 8px 0 16px;
}
.sidebar-bottom .host-title {
    font-size: 12px;
}
.sidebar-bottom .host-display {
    font-size: 12px;
    text-align: center;
    margin-top: 4px;
}
.left-area .sidebar-bottom {
    width: 100%;
}
@media (max-height: 800px) {
    .left-area {
        gap: 5px;
    }
    .rank-row {
        padding: 7px 3px;
    }
    .sidebar-bottom .host-info-container {
        margin: 4px 0 10px;
    }
}

/* Keep the native picker, but show only the current label until it is opened. */
.left-area > :is(#group, #player) {
    flex: none;
    width: 100%;
    min-width: 0;
    height: auto;
    min-height: 36px;
    padding: 4px 2px;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    color: var(--gsbp-ui-text, white);
    font-family: inherit;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.3;
    text-align: center;
    text-align-last: center;
    text-overflow: ellipsis;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.65);
    cursor: pointer;
}
.left-area > #group {
    height: 28px;
    min-height: 28px;
    padding: 3px;
    text-shadow: none;
}
.left-area > #player {
    font-size: clamp(20px, 1.4vw, 28px);
    font-weight: 700;
}
.left-area > :is(#group, #player):focus-visible {
    outline: 2px solid var(--gsbp-ui-accent, white);
    outline-offset: 2px;
}
.left-area > :is(#group, #player) option {
    font-size: 16px;
    font-weight: 400;
    text-shadow: none;
}

/* Production-only single-page adapters; ordinary source styles remain authoritative. */
#broadcastPanel {
    position: absolute;
    inset: 0;
    z-index: 20;
    background: var(--gsbp-ui-canvas);
    overflow: hidden;
}
#broadcastIframe {
    width: 100%;
    height: 100%;
    border: 0;
    transform-origin: top left;
}
.broadcast-controls {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 8px;
    left: auto;
    transform: none;
}
.broadcast-controls button,
#manageBody button {
    padding: 5px;
}
#manageDialog {
    position: fixed;
    inset: 0;
    margin: auto;
    max-height: 85vh;
    overflow: auto;
    width: 600px;
    border: 0;
    padding: 24px;
}
#manageBody {
    padding: 16px 0;
    line-height: 1.8;
}
#manageBody input,
#manageBody select {
    font: inherit;
    padding: 6px;
    color: var(--gsbp-ui-text);
    background: var(--gsbp-ui-surface-inset);
    border: 1px solid var(--gsbp-ui-border);
}
.timer-cell input {
    width: 100%;
    min-width: 0;
    border: 0;
    background: transparent;
    text-align: center;
    color: inherit;
    font: inherit;
}
.timer-cell input:focus {
    outline: 2px solid var(--gsbp-ui-focus-ring);
}
.timer-cell {
    position: relative;
}
.dnf-toggle {
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
    padding: 2px 0;
    font-size: 9px;
    line-height: 1;
    border: 0;
    background: transparent;
    color: color-mix(in srgb, var(--gsbp-ui-text-muted) 38%, transparent);
    cursor: pointer;
}
.dnf-toggle:hover,
.dnf-toggle:focus-visible {
    color: var(--gsbp-ui-text-muted);
}
.timer-cell:has(.dnf-toggle:not([hidden])) input {
    padding-right: 24px;
    box-sizing: border-box;
}
#notice {
    position: fixed;
    top: 10px;
    left: 25%;
    right: 10px;
    z-index: 13000;
    padding: 12px;
    background: var(--gsbp-semantic-danger-soft);
    color: var(--gsbp-ui-text);
}
.rank-row.selected {
    background: var(--gsbp-ui-neutral-fill);
}

#stageContentContainer {
    position: absolute;
    inset: 0;
    z-index: 19;
    background: var(--gsbp-ui-canvas);
}
#stageContentImage,
#stageContentIframe {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border: 0;
}
#closeStageContent {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 8px;
}

/* Outer geometry comes exclusively from score-bp.css: 10/90, 85/15, 40/20/40.
   Extra attempt rows scroll inside their existing footer region. */
.bottom-center {
    min-height: 0;
    overflow: auto;
}

/* Keep scrolling inside content regions without painting scrollbar tracks.
   Both standard and WebKit rules are needed for Safari and Firefox. */
html,
body,
.scoreboard-container {
    overflow: hidden;
}
html,
body,
body * {
    scrollbar-width: none;
}
html::-webkit-scrollbar,
body::-webkit-scrollbar,
body *::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.timer-cell[data-reference-suspect="true"] input {
    text-decoration: underline dotted;
    text-underline-offset: 4px;
}

/* Original ordinary nine-grid geometry; labels stay in title/aria-label. */
.sidebar-bottom .ban-tool-icon {
    font-size: 12px;
    font-weight: 700;
    line-height: 14px;
}
.sidebar-bottom .left-tool-button:disabled {
    opacity: 0.4;
    cursor: default;
}
.home-logo-button {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    flex-shrink: 0;
}
.home-logo-button .home-logo {
    display: block;
    width: 100%;
    margin: 0;
}
.home-logo-button:focus-visible {
    outline: 2px solid var(--gsbp-ui-focus-ring);
    outline-offset: 2px;
}

/* Local scoring hierarchy: room entries support the brighter totals. */
.bottom-area .timer-table .timer-cell input {
    font-size: clamp(16px, 1.1vw, 22px);
    font-weight: 500;
    color: var(--gsbp-ui-accent);
    font-variant-numeric: tabular-nums;
}
.bottom-area .timer-table .total-cell,
html.gsbp-ui-appearance:not(.gsbp-electron-broadcast-ui) .bottom-area .timer-table .total-cell {
    color: var(--gsbp-ui-text);
    font-size: clamp(20px, 1.4vw, 28px);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 1px 3px #000, 0 0 6px #0008;
}
.bottom-area #result {
    color: var(--gsbp-ui-text);
    font-weight: 700;
    text-shadow: 0 1px 3px #000, 0 0 6px #0008;
}
.dnf-toggle[hidden] { display: none; }
