.scorekeeper-page {
    background: #090a0d;
}

.scorekeeper-page .site-header {
    border-bottom-color: #2c2e35;
    background: #090a0d;
}

.scorekeeper-app,
.scorekeeper-app * {
    box-sizing: border-box;
}

.scorekeeper-app {
    min-height: 70vh;
    color: #f5f0e6;
    background:
        radial-gradient(circle at 50% 5%, rgba(226, 174, 53, .09), transparent 28%),
        #090a0d;
}

body.scorekeeper-intro-active {
    overflow: hidden;
}

.scorekeeper-intro {
    position: fixed;
    z-index: 10000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 28px;
    color: #fff;
    background:
        radial-gradient(circle, rgba(226, 174, 53, .16), transparent 36%),
        #050506;
}

.scorekeeper-intro[hidden] {
    display: none;
}

.scorekeeper-intro__content {
    width: min(620px, 92vw);
    text-align: center;
}

.scorekeeper-intro img {
    width: min(330px, 70vw);
    height: auto;
}

.scorekeeper-intro p {
    margin: 20px 0 4px;
    color: #e2ae35;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .22em;
    text-transform: uppercase;
}

.scorekeeper-intro h1 {
    margin: 0;
    font-family: "Barlow Condensed", sans-serif;
    font-size: clamp(45px, 8vw, 82px);
    font-weight: 900;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.scorekeeper-intro span {
    color: #aaaab1;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.scorekeeper-intro__progress {
    height: 3px;
    margin-top: 30px;
    overflow: hidden;
    background: #25262c;
}

.scorekeeper-intro__progress i {
    display: block;
    width: 0;
    height: 100%;
    background: #e2ae35;
}

.scorekeeper-intro.is-running .scorekeeper-intro__progress i {
    animation: scorekeeper-intro-progress 5s linear forwards;
}

@keyframes scorekeeper-intro-progress {
    to { width: 100%; }
}

.scorekeeper-toolbar {
    border-bottom: 1px solid #292b32;
    background: #111217;
}

.scorekeeper-toolbar__inner {
    width: min(100%, 1500px);
    min-height: 58px;
    margin: 0 auto;
    padding: 0 clamp(16px, 3vw, 42px);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 18px;
    color: #b8b9c0;
    font-size: 13px;
}

.scorekeeper-toolbar__inner > span:nth-child(2) {
    text-align: center;
}

.scorekeeper-toolbar__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.scorekeeper-toolbar button,
.scorekeeper-statusbar button {
    padding: 9px 12px;
    border: 1px solid #3b3d45;
    color: #d0d0d5;
    background: #1a1c21;
    cursor: pointer;
}

.scorekeeper-toolbar button.is-unlocked {
    color: #190b0b;
    border-color: #ff8d91;
    background: #ff8d91;
    font-weight: 900;
}

.scorekeeper-toolbar button.scorekeeper-share-action {
    color: #101114;
    border-color: #e2ae35;
    background: #e2ae35;
    font-weight: 900;
}

.scorekeeper-offline-status {
    color: #65e99a;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.scorekeeper-offline-status i {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 9px;
    border-radius: 50%;
    background: #55df89;
}

.scorekeeper-offline-status.is-offline {
    color: #ffd16f;
}

.scorekeeper-offline-status.is-offline i {
    background: #e2ae35;
}

.scorekeeper-board {
    width: min(100%, 1560px);
    margin: 0 auto;
    padding: 38px clamp(16px, 3vw, 44px) 46px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(230px, .42fr) minmax(0, 1fr);
    gap: clamp(20px, 3vw, 42px);
}

.score-team {
    min-width: 0;
    padding: 18px;
    border: 1px solid #30323a;
    background: rgba(13, 14, 18, .94);
    transition: border-color .18s ease, box-shadow .18s ease;
}

.score-team.is-selected {
    border-color: #8a6821;
    box-shadow: inset 0 0 0 1px rgba(226, 174, 53, .25);
}

.score-team.has-possession {
    border-color: #45c77a;
    box-shadow: 0 0 22px rgba(69, 199, 122, .14), inset 0 0 0 1px rgba(69, 199, 122, .25);
}

.score-team > header {
    min-height: 43px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.score-team > header button {
    max-width: 72%;
    overflow: hidden;
    padding: 0;
    border: 0;
    color: #e9e4da;
    background: transparent;
    font: 900 22px/1 "Barlow Condensed", sans-serif;
    letter-spacing: .08em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
    cursor: pointer;
}

.score-team__possession {
    visibility: hidden;
    color: #65e99a;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .06em;
}

.score-team.has-possession .score-team__possession {
    visibility: visible;
}

.score-display {
    position: relative;
    height: 320px;
    margin-top: 10px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid #33353d;
    background: #020203;
}

.score-display output {
    color: #fff8eb;
    font: 900 clamp(150px, 16vw, 245px)/1 "Barlow Condensed", sans-serif;
    letter-spacing: .02em;
}

.score-team--visitor .score-display output {
    color: #ff555b;
}

.score-display__brand {
    position: absolute;
    right: 14px;
    bottom: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
    color: #e2ae35;
    font-size: 10px;
}

.score-display__brand img {
    width: 78px;
    height: auto;
    opacity: .8;
}

.score-buttons {
    margin-top: 12px;
    display: grid;
    grid-template-columns: .8fr 1fr 1fr 1fr;
    gap: 8px;
}

.score-buttons button {
    min-height: 64px;
    border: 1px solid #3d4049;
    color: #fff;
    background: #267f49;
    font-size: 18px;
    font-weight: 900;
    cursor: pointer;
}

.score-buttons button.score-minus {
    color: #ffadaf;
    background: #3b2226;
}

.team-counters {
    margin-top: 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.team-counters section {
    padding: 12px;
    border: 1px solid #30323a;
    background: #131419;
}

.team-counters h2 {
    margin: 0 0 9px;
    color: #9d9ea6;
    font: 800 10px/1.2 Inter, sans-serif;
    letter-spacing: .08em;
    text-align: center;
    text-transform: uppercase;
}

.team-counters section > div {
    display: grid;
    grid-template-columns: 38px 1fr 38px;
    align-items: center;
    gap: 7px;
}

.team-counters button {
    width: 38px;
    height: 38px;
    border: 1px solid #42454e;
    color: #fff;
    background: #292b32;
    font-size: 20px;
    cursor: pointer;
}

.team-counters output {
    color: #f7d16f;
    font: 900 32px/1 "Barlow Condensed", sans-serif;
    text-align: center;
}

.scorekeeper-centre {
    display: grid;
    align-content: center;
    gap: 14px;
}

.segment-control,
.possession-control,
.segment-score-summary,
.segment-history,
.game-reset-actions {
    padding: 18px;
    border: 1px solid #33353d;
    background: #131419;
    text-align: center;
}

.segment-control > span,
.possession-control > span,
.segment-score-summary > span,
.segment-history > span {
    color: #9c9da4;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.segment-control > strong {
    display: block;
    margin-top: 4px;
    color: #f4cf66;
    font: 900 76px/1 "Barlow Condensed", sans-serif;
}

.segment-control > small {
    display: block;
    color: #8e8f97;
    font-size: 10px;
}

.segment-control > div,
.possession-control > div {
    margin-top: 14px;
    display: grid;
    gap: 7px;
}

.segment-control > div {
    grid-template-columns: 1fr 1fr;
}

.possession-control > div {
    grid-template-columns: 1fr .65fr 1fr;
}

.segment-control button,
.possession-control button,
.game-reset-actions button {
    min-height: 42px;
    border: 1px solid #41434c;
    color: #dedee2;
    background: #25272e;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}

.possession-control strong {
    display: block;
    min-height: 38px;
    margin-top: 8px;
    color: #65e99a;
    font-size: 13px;
}

.possession-control__note,
.segment-score-summary p,
.segment-history p {
    margin: 9px 0 0;
    color: #8e8f97;
    font-size: 10px;
    line-height: 1.45;
}

.segment-score-summary strong,
.segment-history > strong {
    display: block;
    margin-top: 9px;
    color: #f4cf66;
    font: 900 20px/1.2 "Barlow Condensed", sans-serif;
    text-transform: uppercase;
}

.segment-history label {
    margin-top: 10px;
    display: grid;
    gap: 6px;
    color: #9c9da4;
    font-size: 10px;
    line-height: 1.35;
}

.segment-history select {
    width: 100%;
    min-height: 40px;
    padding: 7px 9px;
    border: 1px solid #44464f;
    border-radius: 0;
    color: #fff;
    background: #0d0e12;
    font-weight: 800;
}

.arrow-scoring-warning {
    margin: 0;
    padding: 12px 14px;
    border: 1px solid #8f3b40;
    color: #ffb6b9;
    background: #351b1f;
    font-size: 11px;
    line-height: 1.45;
}

.arrow-scoring-warning[hidden] {
    display: none;
}

.possession-control button.is-active {
    color: #07150d;
    border-color: #65e99a;
    background: #65e99a;
}

.game-reset-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.game-reset-actions .game-reset-actions__new {
    color: #fff;
    border-color: #7d3034;
    background: #52252a;
}

.scorekeeper-statusbar {
    border-block: 1px solid #2a2c33;
    background: #121319;
}

.scorekeeper-statusbar__inner {
    width: min(100%, 1500px);
    min-height: 64px;
    margin: 0 auto;
    padding: 9px clamp(16px, 3vw, 42px);
    display: grid;
    grid-template-columns: minmax(150px, .55fr) 1fr auto;
    align-items: center;
    gap: 20px;
}

.scorekeeper-statusbar p {
    margin: 0;
    color: #b8b9c0;
    font-size: 12px;
    text-align: center;
}

.scorekeeper-statusbar span {
    color: #e2ae35;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.scorekeeper-dialog {
    width: min(620px, calc(100vw - 28px));
    padding: 0;
    border: 1px solid #4a4c55;
    color: #ece8df;
    background: #16171c;
}

.scorekeeper-dialog::backdrop {
    background: rgba(0, 0, 0, .78);
}

.scorekeeper-dialog header {
    padding: 22px 24px 12px;
}

.scorekeeper-dialog h2 {
    margin: 0 0 7px;
    font: 900 29px/1 "Barlow Condensed", sans-serif;
    text-transform: uppercase;
}

.scorekeeper-dialog p {
    margin: 0;
    color: #a8a9b0;
    line-height: 1.55;
}

.scorekeeper-dialog__fields {
    padding: 10px 24px 22px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.scorekeeper-dialog__fields--single {
    grid-template-columns: 1fr;
}

.scorekeeper-dialog label {
    display: grid;
    gap: 7px;
    color: #c7c7cc;
    font-size: 12px;
    font-weight: 700;
}

.scorekeeper-dialog input,
.scorekeeper-dialog select {
    width: 100%;
    min-height: 43px;
    padding: 8px 10px;
    border: 1px solid #44464f;
    border-radius: 0;
    color: #fff;
    background: #0d0e12;
}

.scorekeeper-dialog footer {
    padding: 15px 24px 22px;
    display: flex;
    justify-content: flex-end;
    gap: 9px;
}

.scorekeeper-dialog footer button {
    min-height: 42px;
    padding: 8px 16px;
    border: 1px solid #454750;
    color: #dddde1;
    background: #282a31;
    cursor: pointer;
}

.scorekeeper-dialog footer button.dialog-primary {
    color: #111;
    border-color: #e2ae35;
    background: #e2ae35;
    font-weight: 900;
}

.scorekeeper-dialog footer button.dialog-danger {
    color: #fff;
    border-color: #9b3e43;
    background: #7d3034;
    font-weight: 900;
}

.scorekeeper-shortcuts {
    margin: 0;
    padding: 8px 24px 16px;
    display: grid;
    gap: 7px;
}

.scorekeeper-shortcuts div {
    padding: 9px 10px;
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 12px;
    background: #202127;
}

.scorekeeper-shortcuts dt {
    color: #f0c75f;
    font-weight: 900;
}

.scorekeeper-shortcuts dd {
    margin: 0;
    color: #bcbcc2;
}

.knubian-score-report {
    display: none;
}

@media print {
    @page {
        size: letter portrait;
        margin: 9mm;
    }

    html,
    body,
    body.scorekeeper-page {
        width: auto;
        min-height: 0 !important;
        margin: 0 !important;
        color: #111;
        background: #fff !important;
    }

    body > :not(main),
    main.scorekeeper-app > :not(.knubian-score-report) {
        display: none !important;
    }

    .scorekeeper-app {
        display: block !important;
        width: auto !important;
        min-height: 0;
        margin: 0 !important;
        padding: 0 !important;
        color: #111;
        background: #fff !important;
    }

    .knubian-score-report {
        display: block !important;
        width: 100%;
        margin: 0;
        padding: 0;
        color: #111;
        background: #fff;
        font-family: Arial, sans-serif;
        break-inside: avoid;
    }

    .knubian-score-report > header {
        padding-bottom: 8px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 18px;
        border-bottom: 2px solid #c79320;
    }

    .score-report-brand {
        display: flex;
        align-items: flex-end;
        gap: 7px;
    }

    .score-report-brand img {
        width: 155px;
        height: auto;
    }

    .score-report-brand strong {
        padding-bottom: 5px;
        color: #8a6411;
        font-size: 11px;
        letter-spacing: .08em;
    }

    .knubian-score-report > header div {
        text-align: right;
    }

    .knubian-score-report > header .score-report-brand {
        text-align: left;
    }

    .knubian-score-report > header span {
        color: #8a6411;
        font-size: 10px;
        font-weight: 700;
        letter-spacing: .12em;
        text-transform: uppercase;
    }

    .knubian-score-report h2 {
        margin: 3px 0 0;
        font-size: 22px;
        text-transform: uppercase;
    }

    .score-report-summary {
        margin: 12px 0;
        padding: 10px;
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        gap: 16px;
        border: 1px solid #bbb;
        text-align: center;
    }

    .score-report-summary strong {
        display: block;
        font-size: 26px;
    }

    .score-report-summary span,
    .score-report-meta {
        color: #555;
        font-size: 10px;
        text-transform: uppercase;
    }

    .score-report-meta {
        margin: 8px 0 6px;
    }

    .score-report-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 10px;
    }

    .score-report-table th,
    .score-report-table td {
        padding: 5px 4px;
        border: 1px solid #aaa;
        text-align: center;
    }

    .score-report-table th {
        color: #111;
        background: #f1f1f1 !important;
    }

    .score-report-table td:first-child {
        font-weight: 700;
    }

    .score-report-promotion {
        margin-top: 14px;
        padding: 10px 12px;
        border: 1px solid #9b9b9b;
        border-top: 3px solid #c79320;
        break-inside: avoid;
    }

    .score-report-promotion h3 {
        margin: 0 0 8px;
        font-size: 13px;
        letter-spacing: .08em;
        text-transform: uppercase;
    }

    .score-report-promotion > div {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 14px;
    }

    .score-report-promotion section {
        padding-left: 9px;
        border-left: 2px solid #c79320;
    }

    .score-report-promotion strong,
    .score-report-promotion span {
        display: block;
    }

    .score-report-promotion strong {
        margin-bottom: 3px;
        font-size: 10px;
        letter-spacing: .06em;
    }

    .score-report-promotion span {
        color: #444;
        font-size: 8.5px;
        line-height: 1.35;
    }

    .score-report-promotion p {
        margin: 8px 0 0;
        color: #8a6411;
        font-size: 9px;
        font-weight: 700;
        letter-spacing: .08em;
        text-align: center;
        text-transform: uppercase;
    }

    .knubian-score-report > footer {
        margin-top: 10px;
        padding-top: 6px;
        border-top: 1px solid #bbb;
        color: #666;
        font-size: 8px;
        line-height: 1.45;
        text-align: center;
    }
}

@media (max-width: 1120px) {
    .scorekeeper-board {
        grid-template-columns: 1fr 1fr;
    }

    .scorekeeper-centre {
        grid-column: 1 / -1;
        grid-row: 1;
        grid-template-columns: 1fr 1.3fr 1fr;
    }
}

/*
 * Mobile scorekeeper formula
 * Segment, live scores and possession are the cockpit. Reports, history,
 * setup and sharing remain available below the live game controls.
 */
@media (max-width: 760px) {
    .scorekeeper-page .site-header__inner {
        min-height: 58px;
        padding-inline: 12px;
    }

    .scorekeeper-page .site-brand img {
        width: 118px;
        height: 40px;
    }

    .scorekeeper-page .site-menu-button {
        width: 42px;
        height: 42px;
    }

    .scorekeeper-app {
        display: flex;
        flex-direction: column;
    }

    .scorekeeper-board {
        order: 1;
        width: 100%;
        padding: 10px 7px 18px;
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-areas:
            "segment segment"
            "home visitor"
            "possession possession"
            "summary summary"
            "history history"
            "warning warning"
            "resets resets";
        gap: 8px;
    }

    .scorekeeper-centre {
        display: contents;
    }

    .score-team--home { grid-area: home; }
    .score-team--visitor { grid-area: visitor; }
    .segment-control { grid-area: segment; }
    .possession-control { grid-area: possession; }
    .segment-score-summary { grid-area: summary; }
    .segment-history { grid-area: history; }
    .arrow-scoring-warning { grid-area: warning; }
    .game-reset-actions { grid-area: resets; }

    .segment-control {
        padding: 8px;
        display: grid;
        grid-template-columns: 1fr 1.5fr;
        grid-template-areas:
            "label label"
            "period controls"
            "format controls";
        align-items: center;
        column-gap: 10px;
    }

    .segment-control > span { grid-area: label; }
    .segment-control > strong {
        grid-area: period;
        margin: 0;
        font-size: 48px;
    }
    .segment-control > small { grid-area: format; }
    .segment-control > div {
        grid-area: controls;
        margin: 0;
    }

    .score-team {
        min-width: 0;
        padding: 7px;
    }

    .score-team > header {
        min-height: 29px;
        gap: 4px;
    }

    .score-team > header button {
        max-width: 100%;
        font-size: clamp(15px, 4.5vw, 19px);
    }

    .score-team__possession {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }

    .score-display {
        height: clamp(104px, 30vw, 154px);
        margin-top: 4px;
    }

    .score-display output {
        font-size: clamp(70px, 25vw, 124px);
    }

    .score-display__brand {
        right: 5px;
        bottom: 5px;
        gap: 2px;
        font-size: 7px;
    }

    .score-display__brand img {
        width: clamp(38px, 10vw, 52px);
    }

    .score-buttons {
        margin-top: 6px;
        grid-template-columns: 1fr 1fr;
        gap: 5px;
    }

    .score-buttons button {
        min-height: 42px;
        font-size: 15px;
    }

    .team-counters {
        margin-top: 6px;
        grid-template-columns: 1fr 1fr;
        gap: 5px;
    }

    .team-counters section {
        min-width: 0;
        padding: 6px 3px;
    }

    .team-counters h2 {
        min-height: 22px;
        margin-bottom: 4px;
        font-size: 7px;
    }

    .team-counters section > div {
        grid-template-columns: 25px minmax(16px, 1fr) 25px;
        gap: 2px;
    }

    .team-counters button {
        width: 25px;
        height: 29px;
        font-size: 15px;
    }

    .team-counters output {
        font-size: 24px;
    }

    .possession-control,
    .segment-score-summary,
    .segment-history,
    .game-reset-actions {
        padding: 12px;
    }

    .possession-control strong {
        min-height: 0;
        margin-top: 6px;
    }

    .possession-control > div {
        margin-top: 8px;
    }

    .scorekeeper-statusbar {
        order: 2;
    }

    .scorekeeper-statusbar__inner {
        min-height: 52px;
        padding: 7px 9px;
        grid-template-columns: auto 1fr;
        gap: 9px;
    }

    .scorekeeper-statusbar p {
        font-size: 10px;
        text-align: left;
    }

    .scorekeeper-statusbar span {
        display: none;
    }

    .scorekeeper-toolbar {
        order: 3;
        border-top: 1px solid #292b32;
    }

    .scorekeeper-toolbar__inner {
        min-height: 0;
        padding: 12px 9px calc(68px + env(safe-area-inset-bottom));
        grid-template-columns: 1fr;
        gap: 9px;
    }

    .scorekeeper-toolbar__inner > span:nth-child(2) {
        display: block;
        font-size: 11px;
        text-align: left;
    }

    .scorekeeper-toolbar__actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        justify-content: stretch;
        gap: 7px;
    }

    .scorekeeper-toolbar__actions button {
        min-width: 0;
    }

    .scorekeeper-toolbar button.scorekeeper-share-action {
        position: fixed;
        z-index: 90;
        right: 10px;
        bottom: calc(10px + env(safe-area-inset-bottom));
        width: auto;
        min-height: 46px;
        padding: 10px 15px;
        border-radius: 999px;
        box-shadow: 0 8px 28px rgba(0, 0, 0, .62);
    }
}

@media (max-width: 480px) {
    .scorekeeper-dialog__fields {
        grid-template-columns: 1fr;
    }

    .scorekeeper-shortcuts div {
        grid-template-columns: 82px 1fr;
    }

    .scorekeeper-toolbar__actions button[data-help],
    .scorekeeper-toolbar__actions button[data-fullscreen] {
        display: none;
    }
}

@media (max-width: 340px) {
    .scorekeeper-board {
        grid-template-columns: 1fr;
        grid-template-areas:
            "segment"
            "home"
            "visitor"
            "possession"
            "summary"
            "history"
            "warning"
            "resets";
    }
}

@media (max-width: 760px) and (orientation: landscape) and (max-height: 520px) {
    .scorekeeper-page .site-header__inner {
        min-height: 48px;
    }

    .scorekeeper-page .site-brand img {
        width: 102px;
        height: 34px;
    }

    .score-display {
        height: 100px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .scorekeeper-intro.is-running .scorekeeper-intro__progress i {
        animation-duration: 5s;
    }
}
