@import url('https://fonts.googleapis.com/css2?family=Dancing+Script:wght@600&display=swap');

body {
    background: #0f0f0f;
    color: #fff;
    font-family: Arial, sans-serif;
    margin: 0;
}

html:has(.display-shell),
body:has(.display-shell) {
    height: 100%;
    overflow: hidden;
}

.container {
    max-width: 500px;
    margin: auto;
    padding: 20px;
}

.container.wide {
    max-width: 1440px;
}

.container.full-width {
    max-width: none;
    margin: 0;
    padding: 10px 14px;
}

.display-shell {
    box-sizing: border-box;
    display: grid;
    grid-template-columns: clamp(250px, 19vw, 330px) minmax(0, 1fr) clamp(250px, 19vw, 330px);
    grid-template-rows: minmax(0, 1fr);
    gap: 16px;
    height: calc(100vh - 50px);
    min-height: 0;
    overflow: hidden;
    padding: 12px 14px 4px;
}

.display-main {
    align-items: flex-start;
    display: flex;
    grid-column: 2;
    grid-row: 1;
    justify-content: center;
    min-height: 0;
    min-width: 0;
    overflow: auto;
    padding: 0 4px;
}

.display-main::-webkit-scrollbar {
    width: 8px;
}

.display-main > .container.wide {
    box-sizing: border-box;
    margin: 0 auto;
    max-width: min(100%, 1440px);
    padding: 0 8px;
    width: 100%;
}

.display-feed-panel {
    background:
        linear-gradient(180deg, rgba(255, 87, 0, 0.08), rgba(20, 20, 20, 0.42)),
        rgba(18, 18, 18, 0.74);
    border: 1px solid rgba(255, 87, 0, 0.18);
    border-radius: 10px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    grid-column: 1;
    grid-row: 1;
    min-height: 0;
    overflow: hidden;
    padding: 14px;
}

.display-side-status {
    align-self: stretch;
    justify-self: stretch;
    background:
        linear-gradient(180deg, rgba(0, 191, 255, 0.06), rgba(20, 20, 20, 0.5)),
        rgba(18, 18, 18, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 3fr) minmax(0, 7fr);
    gap: 10px;
    grid-column: 3;
    grid-row: 1;
    max-height: 100%;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    padding: 10px 12px;
    width: 100%;
}

.display-feed-panel h2,
.display-side-status h2 {
    color: #ff8a3d;
    flex: 0 0 auto;
    font-size: 16px;
    letter-spacing: 0;
    margin: 0 0 12px 0;
}

.display-side-status .subheading {
    flex: 0 0 auto;
    margin-top: 0;
}

.display-side-status > h2 {
    grid-column: auto;
}

.center {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 80vh;
}

.boards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 300px));
    gap: 14px;
    justify-content: center;
}

@media (min-width: 1200px) {
    .boards {
        grid-template-columns: repeat(auto-fit, minmax(220px, 300px));
    }
}

@media (max-width: 640px) {
    .boards {
        grid-template-columns: 1fr;
    }
}

h1,
h2 {
    color: #ff5700;
}

.card {
    background: #1c1c1c;
    padding: 20px;
    border-radius: 8px;
    margin: 10px 0;
}

.input {
    width: 100%;
    padding: 10px;
    margin: 5px 0 15px 0;
    border-radius: 8px;
    border: none;
}

button {
    all: unset;
}

.btn {
    display: inline-block;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    font-weight: bold;
    transition: all 0.2s ease;
}

.btn-success {
    background: #2e7d32;
    color: white;
}

.btn-primary {
    background: #ff5700;
    color: white;
}

.btn-secondary {
    background: #444;
    color: white;
}

.btn-primary:hover {
    background: #ff6f1f;
    transform: scale(1.02);
}

.btn-secondary:hover {
    background: #666;
}

.btn:active {
    transform: scale(0.98);
}

.small-btn {
    padding: 6px 10px;
    font-size: 12px;
}

.full {
    width: 100%;
}

.board-select {
    width: 120px;
    margin: 0 8px 0 0;
}

.actions {
    display: flex;
    gap: 5px;
    margin-top: 8px;
}

.actions .main {
    width: 75%;
}

.actions .small {
    width: 25%;
}

.quick-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.setup-grid {
    display: grid;
    gap: 12px;
}

.setup-start-form,
.setup-player-panel {
    min-width: 0;
}

.setup-start-form {
    display: grid;
    gap: 12px;
}

.setup-card {
    margin: 0;
}

.setup-card h2 {
    font-size: 18px;
    margin: 0 0 12px 0;
}

.setup-card-note {
    margin: -4px 0 10px 0;
    text-align: left;
}

.setup-dummy-helper {
    border-top: 1px solid #333;
    display: grid;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
}

.setup-dummy-helper form {
    margin: 0;
}

.setup-dummy-helper .btn {
    border-radius: 999px;
    box-sizing: border-box;
    width: 100%;
}

.danger-action {
    border: 1px solid rgba(211, 47, 47, 0.55);
    color: #ffd7d7;
}

.setup-add-card,
.setup-start-card,
.setup-mode-card {
    box-sizing: border-box;
}

.setup-add-card .add-player-row {
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

.setup-add-card h2 {
    text-align: center;
}

.setup-mode-card {
    display: flex;
    flex-direction: column;
}

.setup-mode-card .setup-mode-toggle {
    flex: 1 1 auto;
    margin-top: 0;
}

.setup-player-heading {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    min-width: 0;
}

.setup-player-heading h2 {
    margin: 0;
}

.setup-list-actions {
    flex: 0 0 auto;
    margin: 0;
}

.setup-list-actions .btn {
    border-radius: 999px;
    padding: 6px 11px;
}

@media (max-width: 640px) {
    .setup-player-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .setup-list-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}

.admin-player-grid,
.admin-action-grid {
    display: block;
}

.admin-board-grid {
    display: block;
}

.admin-board-group {
    margin: 10px 0;
}

.admin-player-card {
    margin: 0;
    padding: 0 0 11px 0;
}

.admin-player-card + .admin-player-card {
    border-top: 1px solid #2a2a2a;
    padding-top: 7px;
}

.admin-board-player {
    font-size: 18px;
}

.admin-board-player span:last-child {
    font-size: 18px;
}

.admin-player-pending-out {
    color: #aaa;
    opacity: 0.88;
}

.admin-player-pending-out .player-title {
    text-decoration: line-through;
}

.admin-pending-out-icon {
    display: inline-block;
    font-size: 26px;
    line-height: 1;
}

.admin-player-actions {
    justify-content: flex-start;
    margin-top: 8px;
    padding-left: 0;
}

.admin-player-actions .btn {
    border-radius: 999px;
    font-size: 12px;
    padding: 6px 10px;
    width: auto;
}

.admin-player-actions .main,
.admin-player-actions .small {
    width: auto;
}

.admin-player-actions .btn:disabled {
    cursor: not-allowed;
    filter: grayscale(0.35);
    opacity: 0.42;
    transform: none;
}

.admin-board-title {
    margin-bottom: 12px;
}

.safe {
    color: #4caf50;
}

.warning {
    color: orange;
}

.danger {
    color: red;
}

.nav {
    background: linear-gradient(180deg, #1a1a1a 0%, #141414 100%);
    border-bottom: 1px solid #2d2d2d;
    box-shadow: 0 1px 0 rgba(255, 87, 0, 0.12);
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.nav-main,
.nav-system-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.nav-main {
    min-width: 0;
}

.nav-system-actions {
    margin-left: auto;
    padding-left: 12px;
    border-left: 1px solid #3a3a3a;
}

.nav a {
    align-items: center;
    box-sizing: border-box;
    color: #f2f2f2;
    display: inline-flex;
    min-height: 38px;
    margin: 0;
    text-decoration: none;
    padding: 8px 10px;
    border-radius: 8px;
}

.nav a.active-nav {
    background: #ff5700;
    color: white;
    font-weight: bold;
}

.nav-system-actions form {
    align-items: center;
    display: flex;
    margin: 0;
}

.nav .btn,
.nav .status-badge,
.nav-mode-badge {
    align-items: center;
    box-sizing: border-box;
    display: inline-flex;
    min-height: 38px;
}

.nav-mode-badge {
    background: rgba(0, 191, 255, 0.12);
    border: 1px solid rgba(0, 191, 255, 0.46);
    border-radius: 999px;
    color: #dff7ff;
    font-size: 12px;
    font-weight: bold;
    padding: 7px 11px;
    white-space: nowrap;
}

.nav-round-btn {
    padding: 8px 11px;
    white-space: nowrap;
}

.nav-action-btn {
    padding: 8px 11px;
    border-radius: 8px;
    font-size: 12px;
    opacity: 0.92;
    white-space: nowrap;
}

.nav-finalize-btn {
    background: rgba(255, 87, 0, 0.22);
    border: 1px solid rgba(255, 87, 0, 0.55);
    color: #ffd7c2;
}

.nav-reset-btn {
    background: transparent;
    border: 1px solid #444;
    color: #bbb;
}

.nav-action-btn:disabled {
    animation: none;
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.35;
}

.nav-pulse-action:not(:disabled) {
    animation: navActionPulse 2s ease-in-out infinite;
    box-shadow: 0 0 0 rgba(255, 87, 0, 0);
}

.nav-round-btn.nav-pulse-action:not(:disabled) {
    animation: roundReadyPulse 1.05s ease-in-out infinite;
    background: linear-gradient(135deg, #ff5700, #ff8a00);
    border: 1px solid rgba(255, 215, 194, 0.92);
    box-shadow: 0 0 18px rgba(255, 87, 0, 0.65);
    color: #fff;
}

.auto-board-btn {
    animation: autoBoardPulse 2s ease-in-out infinite;
    background: linear-gradient(135deg, rgba(0, 191, 255, 0.22), rgba(255, 87, 0, 0.24));
    border: 1px solid rgba(0, 191, 255, 0.62);
    box-shadow:
        0 0 0 0 rgba(0, 191, 255, 0),
        0 0 16px rgba(0, 191, 255, 0.18);
    color: #dff7ff;
    font-size: 12px;
    padding: 8px 11px;
}

@keyframes navActionPulse {
    0%, 100% {
        box-shadow: 0 0 0 rgba(255, 87, 0, 0);
        filter: brightness(1);
    }
    50% {
        box-shadow: 0 0 14px rgba(255, 87, 0, 0.42);
        filter: brightness(1.12);
    }
}

@keyframes roundReadyPulse {
    0%, 100% {
        box-shadow:
            0 0 0 0 rgba(255, 87, 0, 0.72),
            0 0 14px rgba(255, 87, 0, 0.55);
        filter: brightness(1);
    }
    45% {
        box-shadow:
            0 0 0 5px rgba(255, 87, 0, 0.22),
            0 0 28px rgba(255, 138, 0, 0.9);
        filter: brightness(1.35);
    }
    65% {
        box-shadow:
            0 0 0 2px rgba(255, 215, 194, 0.28),
            0 0 22px rgba(255, 87, 0, 0.78);
        filter: brightness(1.18);
    }
}

@keyframes autoBoardPulse {
    0%, 100% {
        box-shadow:
            0 0 0 0 rgba(0, 191, 255, 0),
            0 0 16px rgba(0, 191, 255, 0.22);
        filter: brightness(1);
    }
    50% {
        box-shadow:
            0 0 0 7px rgba(0, 191, 255, 0.12),
            0 0 34px rgba(0, 191, 255, 0.72),
            0 0 20px rgba(255, 87, 0, 0.34);
        filter: brightness(1.22);
    }
}

@keyframes drawNoticePulse {
    0%, 100% {
        filter: brightness(1);
        transform: translateY(0);
    }
    50% {
        filter: brightness(1.18);
        transform: translateY(-1px);
    }
}

@keyframes roundStartBurst {
    0% {
        box-shadow: 0 0 0 rgba(255, 87, 0, 0);
        filter: brightness(0.82);
        transform: scale(0.86);
    }
    28% {
        box-shadow:
            0 0 0 7px rgba(255, 87, 0, 0.22),
            0 0 34px rgba(255, 87, 0, 0.88);
        filter: brightness(1.45);
        transform: scale(1.18);
    }
    58% {
        box-shadow:
            0 0 0 3px rgba(255, 215, 194, 0.18),
            0 0 24px rgba(255, 138, 0, 0.62);
        filter: brightness(1.2);
        transform: scale(1.06);
    }
    100% {
        box-shadow: 0 0 0 rgba(255, 87, 0, 0);
        filter: brightness(1);
        transform: scale(1);
    }
}

.status-badge {
    padding: 7px 10px;
    border-radius: 8px;
    margin: 0;
    font-weight: bold;
    font-size: 13px;
}

.status-setup {
    background: #263238;
    color: #cfd8dc;
}

.status-running {
    background: #143d22;
    color: #8ee6a7;
}

.status-final {
    background: #4a3300;
    color: #ffd166;
}

.status-done {
    background: #332244;
    color: #d7b9ff;
}

.row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.row .input {
    flex: 1;
}

.row button {
    flex: 1;
}

.row span:first-child {
    font-size: 18px;
    font-weight: bold;
}

.row span:last-child {
    font-size: 16px;
}

.player-title {
    font-size: 20px;
}

.admin-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.admin-heading-group {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.admin-title-row h1 {
    margin-bottom: 8px;
}

.admin-board-select-form {
    align-items: center;
    display: flex;
    gap: 8px;
    margin: 0;
    flex-wrap: wrap;
}

.admin-title-board-select {
    appearance: none;
    background:
        linear-gradient(135deg, rgba(255, 87, 0, 0.16), rgba(0, 191, 255, 0.12)),
        #1c1c1c;
    border: 1px solid rgba(0, 191, 255, 0.48);
    border-radius: 8px;
    box-sizing: border-box;
    color: #dff7ff;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    line-height: 1;
    margin: 0;
    min-height: 38px;
    padding: 8px 28px 8px 11px;
    width: 210px;
}

.admin-auto-board-btn {
    align-items: center;
    box-sizing: border-box;
    display: inline-flex;
    font-size: 12px;
    justify-content: center;
    min-height: 38px;
    padding: 8px 11px;
    min-width: 250px;
    white-space: nowrap;
    width: auto;
}

.admin-status-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: #ddd;
    font-size: 13px;
}

.admin-status-summary span {
    background: #1c1c1c;
    border: 1px solid #333;
    border-left: 4px solid #ff5700;
    border-radius: 8px;
    padding: 7px 10px;
}

.admin-status-summary strong {
    color: #ff5700;
}

.admin-status-summary .admin-mode-season {
    border-left-color: #2e7d32;
    color: #d9ffd9;
}

.admin-status-summary .admin-mode-standalone {
    border-left-color: #9ad1ff;
    color: #dff3ff;
}

.player-warning {
    color: yellow;
}

.player-danger {
    color: red;
}

.player-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    transition: 0.2s;
}

.player-name.clickable {
    cursor: pointer;
}

.player-name {
    flex: 2;
    background: #1e1e1e;
    padding: 8px 10px;
    border-radius: 8px;
    font-weight: bold;
    border: 1px solid #333;
}

.player-row.active .player-name {
    background: #2a1a10;
    border-color: #ff5700;
}

.input.small {
    flex: 1;
    max-width: 70px;
    text-align: center;
    padding: 6px;
}

.input.clean {
    border: none;
    background: transparent;
    width: 100%;
    color: white;
}

.setup-options {
    padding: 0;
}

.setup-mode-toggle {
    background: #171717;
    border: 1px solid #333;
    border-left: 4px solid #ff5700;
    border-radius: 8px;
    display: grid;
    gap: 8px;
    margin-top: 10px;
    padding: 10px;
}

.setup-mode-label {
    color: #ddd;
    font-size: 13px;
    font-weight: bold;
}

.setup-mode-toggle label {
    align-items: center;
    display: flex;
    gap: 8px;
    margin: 0;
}

.setup-mode-toggle input {
    accent-color: #ff5700;
}

.setup-mode-hint {
    margin: 0;
}

.add-player-row {
    align-items: stretch;
}

.add-player-row .player-name,
.add-player-row .setup-class-select,
.add-player-row .input.small,
.add-player-row .btn {
    box-sizing: border-box;
    min-height: 42px;
    margin: 0;
    display: flex;
    align-items: center;
}

.add-player-row .input.small,
.add-player-row .setup-class-select {
    align-self: stretch;
}

.add-player-row .btn {
    justify-content: center;
}

.player-list-header {
    display: grid;
    grid-template-columns: minmax(0, 2fr) 92px 70px 40px;
    gap: 10px;
    color: #aaa;
    font-size: 12px;
    font-weight: bold;
    margin: 12px 0 6px 0;
    padding: 0 10px;
    text-transform: uppercase;
}

.setup-options label {
    display: block;
    font-weight: bold;
    margin-bottom: 6px;
}

.setup-board-select {
    box-sizing: border-box;
    margin-bottom: 0;
    min-width: 0;
    width: 100%;
}

.setup-class-select {
    background: #171717;
    border: 1px solid #333;
    border-radius: 8px;
    box-sizing: border-box;
    color: #fff;
    margin: 0;
    padding: 6px 8px;
}

.add-player-row .setup-class-select {
    flex: 0 0 130px;
    max-width: 130px;
}

.row-class-select {
    flex: 0 0 92px;
    max-width: 92px;
}

.setup-custom-max-indicator {
    color: #ffb38a;
    flex: 0 0 auto;
    font-size: 15px;
    line-height: 1;
    margin-left: -6px;
}

@media (min-width: 900px) {
    .container.setup-container,
    .container.admin-container {
        max-width: none;
        padding: 12px 16px;
    }

    .setup-container h1,
    .admin-container h1 {
        margin: 8px 0 10px 0;
    }

    .setup-grid {
        display: grid;
        grid-template-columns: minmax(280px, 0.95fr) minmax(290px, 1fr) minmax(260px, 0.85fr);
        gap: 12px;
        align-items: stretch;
    }

    .setup-start-form {
        display: contents;
    }

    .setup-add-card,
    .setup-start-card,
    .setup-mode-card {
        display: flex;
        flex-direction: column;
        min-height: 146px;
        padding: 14px;
    }

    .setup-start-card {
        gap: 8px;
        min-width: 0;
        overflow: hidden;
    }

    .setup-player-panel {
        grid-column: 1 / -1;
    }

    .setup-add-card .small-btn,
    .setup-player-panel .btn {
        padding: 7px 9px;
        font-size: 12px;
    }

    .setup-player-panel .player-list-header {
        margin: 6px 0 4px 0;
        padding: 0 8px;
    }

    .setup-player-panel {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 4px 8px;
        padding: 12px;
    }

    .setup-player-heading,
    .setup-player-panel h2,
    .setup-player-panel .player-list-header {
        grid-column: 1 / -1;
    }

    .setup-player-heading {
        margin-bottom: 2px;
    }

    .setup-list-actions {
        gap: 8px;
    }

    .setup-list-actions .btn {
        font-size: 12px;
        padding: 6px 10px;
    }

    .setup-player-panel .player-row.selectable {
        gap: 6px;
        margin-bottom: 3px;
    }

    .setup-player-panel .player-name,
    .add-player-row .player-name {
        padding: 5px 8px;
    }

    .setup-player-panel .input.small,
    .add-player-row .input.small {
        max-width: 54px;
        padding: 4px;
        margin: 0;
    }

    .setup-player-panel .row-class-select {
        flex-basis: 76px;
        max-width: 76px;
        padding: 4px 6px;
    }

    .add-player-row {
        gap: 6px;
        margin-bottom: 0;
    }

    .add-player-row .player-name,
    .add-player-row .setup-class-select,
    .add-player-row .input.small,
    .add-player-row .btn {
        min-height: 34px;
    }

    .setup-options {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 112px;
        gap: 8px;
        align-items: center;
        margin: 0;
        padding: 0;
        min-width: 0;
    }

    .setup-options label {
        margin: 0;
        min-width: 0;
    }

    .setup-options .hint-box {
        grid-column: 1 / -1;
        margin: 0;
    }

    .setup-board-select {
        padding: 6px 8px;
        margin: 0;
    }

    #startButton {
        box-sizing: border-box;
        padding: 8px 10px;
        width: 100%;
    }

    .admin-player-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
        gap: 8px;
        align-items: stretch;
    }

    .admin-board-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(230px, 300px));
        gap: 12px;
        align-items: start;
        justify-content: center;
    }

    .admin-board-group {
        margin: 0 0 10px 0;
        padding: 20px;
    }

    .admin-board-group .admin-player-grid {
        display: block;
    }

    .admin-ungrouped-list {
        display: contents;
    }

    .admin-player-card {
        margin: 0;
        padding: 9px 0;
    }

    .admin-player-card .actions,
    .admin-player-actions {
        gap: 5px;
        margin-top: 8px;
    }

    .admin-player-card .btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    .admin-title-row h1 {
        margin: 6px 0;
    }

    .admin-title-board-select {
        min-height: 36px;
        padding: 7px 26px 7px 10px;
        width: 190px;
    }

    .admin-auto-board-btn {
        min-height: 36px;
        min-width: 250px;
        width: auto;
    }

    .admin-status-summary span {
        padding: 5px 8px;
    }

    .admin-action-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(220px, 1fr));
        gap: 12px;
        margin-top: 14px;
    }

    .admin-action-grid form {
        margin: 0;
    }
}

@media (min-width: 1500px) {
    .admin-board-grid {
        grid-template-columns: repeat(auto-fit, minmax(230px, 300px));
    }
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.switch input {
    display: none;
}

.slider {
    position: absolute;
    cursor: pointer;
    background-color: #555;
    border-radius: 22px;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    transition: 0.3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

input:checked + .slider {
    background-color: #ff5700;
}

input:checked + .slider:before {
    transform: translateX(18px);
}

.active {
    color: #4caf50;
    font-weight: bold;
}

.table-wrap {
    overflow-x: auto;
}

.season-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 520px;
}

.season-table th,
.season-table td {
    border-bottom: 1px solid #333;
    padding: 8px 10px;
    text-align: center;
    white-space: nowrap;
}

.season-table th:first-child,
.season-table td.name {
    text-align: left;
}

.season-table .trend-col {
    width: 52px;
}

.trend {
    display: inline-block;
    font-weight: bold;
    font-size: 13px;
    line-height: 1;
    vertical-align: middle;
}

.trend-up {
    color: #4caf50;
}

.trend-down {
    color: #f44336;
}

.season-table .total {
    font-size: 18px;
    font-weight: bold;
    color: #ff5700;
}

.compact-season-table {
    min-width: 560px;
}

.compact-season-table th,
.compact-season-table td {
    padding: 7px 8px;
}

.compact-season-table .rank-col {
    color: #ddd;
    font-size: 13px;
    font-weight: bold;
}

.final-rankings-grid {
    display: grid;
    grid-template-columns: minmax(260px, 0.9fr) minmax(360px, 1.1fr);
    gap: 14px;
    align-items: start;
}

.final-rankings-grid.single {
    grid-template-columns: minmax(260px, 560px);
    justify-content: center;
}

.final-ranking-card {
    margin: 0;
    max-height: calc(60vh - 120px);
    min-height: 0;
    overflow-y: auto;
    padding-right: 14px;
}

.final-ranking-card,
.final-ranking-card .table-wrap {
    scrollbar-color: rgba(255, 87, 0, 0.72) #151515;
    scrollbar-width: thin;
}

.final-ranking-card::-webkit-scrollbar,
.final-ranking-card .table-wrap::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.final-ranking-card::-webkit-scrollbar-track,
.final-ranking-card .table-wrap::-webkit-scrollbar-track {
    background: #151515;
    border-radius: 999px;
}

.final-ranking-card::-webkit-scrollbar-thumb,
.final-ranking-card .table-wrap::-webkit-scrollbar-thumb {
    background: rgba(255, 87, 0, 0.72);
    border-radius: 999px;
}

.final-ranking-card::-webkit-scrollbar-thumb:hover,
.final-ranking-card .table-wrap::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 111, 31, 0.9);
}

@media (max-width: 900px) {
    .final-rankings-grid {
        grid-template-columns: 1fr;
    }

    .final-ranking-card {
        max-height: calc(45vh - 36px);
    }
}

.board-card {
    min-width: 0;
    padding: 24px;
    border: 1px solid #333;
    box-shadow: 0 0 0 1px rgba(255, 87, 0, 0.12);
}

.board-card-pending {
    background:
        linear-gradient(180deg, rgba(255, 87, 0, 0.08), rgba(28, 28, 28, 0.96)),
        #1c1c1c;
    border-color: rgba(255, 87, 0, 0.58);
    box-shadow:
        inset 0 0 0 1px rgba(255, 87, 0, 0.16),
        0 0 0 1px rgba(255, 87, 0, 0.18);
}

.board-card-pending .board-pill {
    background: rgba(255, 87, 0, 0.24);
    border-color: rgba(255, 87, 0, 0.72);
}

.board-active {
    animation: boardActivePulse 2.8s ease-in-out infinite;
    will-change: box-shadow, border-color, background;
}

@keyframes boardActivePulse {
    0%, 100% {
        border-color: rgba(255, 87, 0, 0.5);
        background:
            linear-gradient(180deg, rgba(255, 87, 0, 0.07), rgba(28, 28, 28, 0.96)),
            #1c1c1c;
        box-shadow:
            inset 0 0 0 1px rgba(255, 87, 0, 0.14),
            0 0 0 1px rgba(255, 87, 0, 0.16),
            0 0 0 rgba(255, 87, 0, 0);
    }
    50% {
        border-color: rgba(255, 87, 0, 0.76);
        background:
            linear-gradient(180deg, rgba(255, 87, 0, 0.11), rgba(28, 28, 28, 0.96)),
            #1c1c1c;
        box-shadow:
            inset 0 0 0 1px rgba(255, 87, 0, 0.22),
            0 0 0 1px rgba(255, 87, 0, 0.28),
            0 0 12px rgba(255, 87, 0, 0.22);
    }
}

.board-title {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 18px;
    line-height: 1.25;
    margin-top: 0;
}

.board-pill {
    background: rgba(255, 87, 0, 0.16);
    border: 1px solid rgba(255, 87, 0, 0.5);
    border-radius: 999px;
    color: #ffd7c2;
    display: inline-block;
    padding: 6px 12px;
}

.board-summary {
    color: #ddd;
    font-size: 15px;
    font-weight: normal;
}

.display-round-title {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.display-board-notice-row {
    display: flex;
    justify-content: center;
    margin: 14px 0 0 0;
}

.display-board-notice {
    align-items: center;
    border-radius: 999px;
    box-sizing: border-box;
    display: inline-flex;
    font-size: 16px;
    font-weight: bold;
    gap: 7px;
    margin: 0;
    max-width: 620px;
    padding: 10px 18px;
    text-align: center;
}

.display-board-notice-draw {
    animation: drawNoticePulse 1.8s ease-in-out infinite;
}

.display-board-notice-icon {
    font-size: 18px;
    line-height: 1;
}

.display-board-notice-info {
    background: rgba(0, 191, 255, 0.12);
    border: 1px solid rgba(0, 191, 255, 0.48);
    color: #dff7ff;
}

.display-board-notice-urgent {
    background: rgba(255, 87, 0, 0.16);
    border: 1px solid rgba(255, 87, 0, 0.72);
    box-shadow: 0 0 16px rgba(255, 87, 0, 0.22);
    color: #ffd7c2;
}

.round-pill {
    background: rgba(255, 87, 0, 0.18);
    border: 1px solid rgba(255, 87, 0, 0.58);
    border-radius: 999px;
    color: #ffd7c2;
    display: inline-block;
    padding: 6px 14px;
}

.round-start-burst {
    animation: roundStartBurst 1450ms cubic-bezier(0.18, 0.9, 0.24, 1) 1;
}

.round-summary {
    color: #ddd;
    font-size: 18px;
    font-weight: normal;
}

.setup-display-card {
    background:
        linear-gradient(180deg, rgba(255, 87, 0, 0.08), rgba(28, 28, 28, 0.96)),
        #1c1c1c;
    border: 1px solid rgba(255, 87, 0, 0.24);
    border-radius: 10px;
    box-sizing: border-box;
    margin: 0 auto;
    max-width: 980px;
    padding: 18px;
}

.setup-display-list {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    margin-top: 16px;
}

.setup-display-player {
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 4px solid rgba(255, 87, 0, 0.66);
    border-radius: 8px;
    display: grid;
    gap: 8px;
    grid-template-columns: 28px minmax(0, 1fr) auto auto;
    min-width: 0;
    padding: 9px 10px;
    white-space: nowrap;
}

.setup-display-order {
    color: #ffb38a;
    font-weight: bold;
}

.setup-display-name {
    font-size: 18px;
    font-weight: bold;
    overflow: hidden;
    text-overflow: ellipsis;
}

.setup-display-class {
    background: rgba(0, 191, 255, 0.1);
    border: 1px solid rgba(0, 191, 255, 0.35);
    border-radius: 999px;
    color: #dff7ff;
    font-size: 13px;
    padding: 4px 8px;
}

.setup-display-max {
    color: #ddd;
    font-size: 14px;
}

.setup-display-custom {
    border-left-color: #ffd166;
}

.setup-display-custom-icon {
    color: #ffd166;
    margin-left: 4px;
}

.board-player {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 7px 0;
    white-space: nowrap;
    font-size: 18px;
    border-top: 1px solid #2a2a2a;
}

.board-player span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
}

.board-player span:last-child {
    text-align: right;
    font-size: 18px;
}

.board-player-hit {
    background: rgba(255, 87, 0, 0.08);
    border-left: 4px solid rgba(255, 87, 0, 0.75);
    color: #ffd7c2;
    margin: 0 -8px;
    padding-left: 8px;
    padding-right: 8px;
}

.board-player-out {
    color: #aaa;
    opacity: 0.82;
}

.board-player-out span:first-child {
    text-decoration: line-through;
}

.board-player-out span:last-child {
    color: #ff8a8a;
    font-weight: bold;
    text-decoration: none;
}

.board-out-icon {
    display: inline-block;
    font-size: 26px;
    line-height: 1;
}

.ranking-row {
    margin-bottom: 6px;
    font-size: 16px;
}

.place-first {
    color: gold;
    font-size: 26px;
    font-weight: bold;
}

.place-second {
    color: silver;
    font-size: 22px;
}

.place-third {
    color: #cd7f32;
    font-size: 20px;
}

.place-fourth {
    color: #9ad1ff;
    font-size: 18px;
}

.log-swimmer {
    color: #00bfff;
}

.log-eliminated {
    color: #8b0000;
    font-weight: bold;
}

.log-winner {
    color: gold;
    font-weight: bold;
}

.log-place-2 {
    color: silver;
    font-weight: bold;
}

.log-place-3 {
    color: #cd7f32;
    font-weight: bold;
}

.log-place-4 {
    color: #9ad1ff;
    font-weight: bold;
}

.log-round-duration {
    color: #9ad1ff;
}

.log-draw {
    color: #ffe7a0;
}

.history-new {
    animation: historyNewPulse 5s ease-out 1;
    overflow: hidden;
}

@keyframes historyNewPulse {
    0% {
        background: rgba(255, 87, 0, 0.28);
        border-color: rgba(255, 87, 0, 0.82);
        border-left-color: #ff5700;
    }
    45% {
        background: rgba(255, 87, 0, 0.16);
        border-color: rgba(255, 87, 0, 0.58);
        border-left-color: #ff5700;
    }
    100% {
        background: rgba(255, 255, 255, 0.04);
        border-color: rgba(255, 255, 255, 0.08);
        border-left-color: rgba(255, 87, 0, 0.58);
    }
}

.history-entry {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 3px solid rgba(255, 87, 0, 0.58);
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 14px;
    line-height: 1.35;
    margin-bottom: 0;
    min-width: 0;
    overflow: visible;
    padding: 8px 9px;
    white-space: normal;
}

.history-old {
    font-size: 11px;
    opacity: 0.66;
}

.history-meta {
    color: #aaa;
    display: block;
    font-size: 11px;
    line-height: 1.2;
    margin-bottom: 3px;
    white-space: nowrap;
}

.history-text {
    display: block;
    line-height: 1.3;
    overflow: visible;
    white-space: normal;
    word-break: normal;
    overflow-wrap: anywhere;
}

.history-feed {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 7px;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
}

.eliminated-row {
    margin-bottom: 4px;
}

.swimmer-row,
.eliminated-row,
.status-scroll-list > div {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-feed,
.status-scroll-list,
.display-main {
    scrollbar-color: rgba(255, 87, 0, 0.72) #151515;
    scrollbar-width: thin;
}

.history-feed::-webkit-scrollbar,
.status-scroll-list::-webkit-scrollbar,
.display-main::-webkit-scrollbar {
    width: 8px;
}

.history-feed::-webkit-scrollbar-track,
.status-scroll-list::-webkit-scrollbar-track,
.display-main::-webkit-scrollbar-track {
    background: #151515;
    border-radius: 999px;
}

.history-feed::-webkit-scrollbar-thumb,
.status-scroll-list::-webkit-scrollbar-thumb,
.display-main::-webkit-scrollbar-thumb {
    background: rgba(255, 87, 0, 0.72);
    border-radius: 999px;
}

.history-feed::-webkit-scrollbar-thumb:hover,
.status-scroll-list::-webkit-scrollbar-thumb:hover,
.display-main::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 111, 31, 0.9);
}

@media (max-width: 900px) {
    .display-shell {
        display: flex;
        flex-direction: column;
        height: calc(100vh - 36px);
        min-height: 0;
        overflow-y: auto;
        padding: 10px;
    }

    .display-main {
        order: 1;
        overflow: visible;
        padding: 0;
    }

    .display-feed-panel {
        max-height: 34vh;
        min-height: 210px;
        order: 2;
        width: 100%;
    }

    .display-side-status {
        align-self: stretch;
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr) minmax(0, 1fr);
        max-width: none;
        max-height: 34vh;
        min-height: 210px;
        order: 3;
        width: 100%;
    }

    .status-scroll-list,
    .eliminated-scroll-list {
        max-height: none;
    }
}

.info-card {
    margin: 0;
    padding: 14px;
    height: 100%;
    box-sizing: border-box;
}

.status-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.status-mini-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.info-card h2 {
    font-size: 18px;
    margin-top: 0;
}

.subheading {
    color: #fff;
    font-size: 15px;
    margin: 10px 0 6px 0;
}

.section-divider {
    border-top: 1px solid #333;
    margin: 12px 0;
}

.status-scroll-list {
    min-height: 42px;
    max-height: calc(20vh - 44px);
    overflow-y: auto;
    padding-right: 4px;
}

.eliminated-scroll-list {
    max-height: calc(20vh - 52px);
}

.display-side-status .status-scroll-list {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
}

.display-side-status .eliminated-scroll-list {
    max-height: none;
}

.hint-box {
    background: #1c1c1c;
    border-left: 4px solid #ff5700;
    border-radius: 8px;
    color: #ddd;
    font-size: 13px;
    line-height: 1.35;
    margin: 8px 0 14px 0;
    padding: 10px 12px;
}

.hint-box.compact {
    margin-bottom: 0;
}

.danger-box {
    border-left-color: #d32f2f;
    color: #ffd7d7;
}

.swimmer-row {
    color: #00bfff;
    font-weight: bold;
    margin-bottom: 4px;
}

.footer {
    text-align: center;
    font-size: 12px;
    opacity: 0.6;
    margin-top: 2px;
    padding: 3px 10px;
}

.footer-separator {
    color: #777;
    display: inline-block;
    margin: 0 6px;
}

.footer-link {
    color: #ffd7c2;
    cursor: pointer;
    font-size: 12px;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.footer-link:hover {
    color: #ff8a3d;
}

.password-change-form label {
    color: #ddd;
    display: block;
    font-size: 13px;
    font-weight: bold;
    margin: 10px 0 4px;
}

.password-change-form .input {
    box-sizing: border-box;
    margin-bottom: 8px;
}

.password-hint {
    margin: 8px 0 10px;
}

.password-message {
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.35;
    margin-top: 10px;
    padding: 10px 12px;
}

.password-message.success {
    background: rgba(46, 125, 50, 0.16);
    border: 1px solid rgba(76, 175, 80, 0.45);
    color: #c8f7c5;
}

.password-message.error {
    background: rgba(211, 47, 47, 0.14);
    border: 1px solid rgba(211, 47, 47, 0.45);
    color: #ffd7d7;
}

.password-force-card {
    margin-top: 18px;
}

.docs-container {
    padding-top: 14px;
}

.docs-hero {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 12px;
}

.docs-hero h1 {
    margin: 0 0 4px;
}

.docs-hero p {
    color: #ccc;
    margin: 0;
}

.docs-version {
    background: rgba(255, 87, 0, 0.16);
    border: 1px solid rgba(255, 87, 0, 0.55);
    border-radius: 999px;
    color: #ffd7c2;
    font-size: 13px;
    font-weight: bold;
    padding: 7px 12px;
    white-space: nowrap;
}

.docs-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.docs-card {
    margin: 0;
    padding: 16px;
}

.docs-card h2 {
    font-size: 18px;
    margin: 0 0 10px;
}

.docs-feature-overview {
    grid-column: 1 / -1;
}

.docs-feature-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.docs-feature-block {
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 4px solid rgba(255, 87, 0, 0.72);
    border-radius: 8px;
    padding: 12px;
}

.docs-feature-block h3 {
    color: #ffb38a;
    font-size: 15px;
    margin: 0 0 8px;
}

.docs-list {
    color: #ddd;
    display: grid;
    gap: 8px;
    line-height: 1.4;
    margin: 0;
    padding-left: 18px;
}

.docs-meta {
    background: #171717;
    border-left: 4px solid #ff5700;
    border-radius: 8px;
    color: #ddd;
    font-size: 13px;
    margin-bottom: 12px;
    padding: 9px 11px;
}

.docs-changelog {
    border-color: rgba(255, 87, 0, 0.36);
}

.admin-users-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(280px, 420px) minmax(320px, 1fr);
}

.admin-user-card {
    margin: 0;
}

.admin-user-card label {
    color: #ddd;
    display: block;
    font-size: 13px;
    font-weight: bold;
    margin: 8px 0 4px;
}

.admin-user-list {
    display: grid;
    gap: 8px;
}

.admin-user-row {
    align-items: center;
    background: #171717;
    border: 1px solid #333;
    border-left: 4px solid #ff5700;
    border-radius: 8px;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 10px 12px;
}

.admin-user-row span {
    color: #aaa;
    display: block;
    font-size: 12px;
    margin-top: 3px;
}

.admin-user-row .initial-password-note {
    color: #ffd7c2;
}

.initial-password-note code {
    background: rgba(255, 87, 0, 0.14);
    border: 1px solid rgba(255, 87, 0, 0.45);
    border-radius: 6px;
    color: #fff;
    display: inline-block;
    margin-left: 4px;
    padding: 2px 6px;
}

.admin-user-row .initial-password-done {
    color: #8ee6a7;
}

@media (max-width: 800px) {
    .admin-users-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .docs-hero {
        align-items: flex-start;
        flex-direction: column;
    }
}

.text-admin-container {
    padding-top: 14px;
}

.text-admin-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
}

.text-resource-card {
    margin: 0;
    padding: 14px;
    scroll-margin-top: 74px;
}

.text-resource-card:target {
    border: 1px solid rgba(255, 87, 0, 0.7);
    box-shadow: 0 0 0 2px rgba(255, 87, 0, 0.18);
}

.text-resource-head {
    align-items: flex-start;
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.text-resource-head code {
    color: #aaa;
    display: block;
    font-size: 12px;
    margin-top: 4px;
    word-break: break-word;
}

.text-resource-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: flex-end;
}

.text-resource-badges span {
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 999px;
    color: #ddd;
    font-size: 11px;
    padding: 3px 7px;
}

.text-resource-badges .text-badge-variable {
    background: rgba(0, 191, 255, 0.12);
    border-color: rgba(0, 191, 255, 0.45);
    color: #dff7ff;
}

.text-resource-badges .text-badge-critical {
    background: rgba(255, 87, 0, 0.14);
    border-color: rgba(255, 87, 0, 0.55);
    color: #ffd7c2;
}

.text-resource-description {
    color: #bbb;
    font-size: 12px;
    line-height: 1.35;
    margin: 10px 0;
}

.text-resource-input {
    box-sizing: border-box;
    min-height: 86px;
    resize: vertical;
}

.brand-mark {
    display: inline-block;
    padding: 1px 6px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    color: #ffffff;
    font-size: 11px;
    line-height: 1.5;
    opacity: 0.9;
}

.signature {
    color: #ffffff;
    display: inline-block;
    font-family: 'Dancing Script', cursive;
    font-size: 1.35em;
    font-weight: 600;
    line-height: 1;
    padding: 0 2px;
    vertical-align: -0.08em;
}

.nav-hint {
    display: inline-block;
    margin-left: 6px;
    color: #aaa;
    font-size: 12px;
    vertical-align: middle;
}

.nav-small-btn {
    margin-left: 6px;
    padding: 8px 10px;
    font-size: 12px;
}

.popup-backdrop {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.65);
    padding: 20px;
}

.popup-card {
    width: min(420px, 100%);
    background: #1c1c1c;
    border: 1px solid #ff5700;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.popup-card h2 {
    margin-top: 0;
}

.modal-backdrop {
    position: fixed;
    z-index: 1200;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.68);
    padding: 20px;
}

.modal-backdrop[hidden] {
    display: none;
}

.modal-card {
    width: min(460px, 100%);
    background: #1c1c1c;
    border: 1px solid #ff5700;
    border-left: 6px solid #ff5700;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}

.modal-card h2 {
    color: #ff5700;
    margin-top: 0;
}

.modal-message p {
    color: #ddd;
    line-height: 1.45;
    margin: 0;
}

.modal-warning-list {
    display: grid;
    gap: 14px;
}

.modal-warning-item {
    background: rgba(255, 87, 0, 0.08);
    border: 1px solid rgba(255, 87, 0, 0.28);
    border-left: 4px solid #ff5700;
    border-radius: 8px;
    padding: 12px 13px;
}

.modal-warning-item p {
    margin: 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.modal-warning-title {
    color: #ffb38a;
    display: block;
    font-size: 13px;
    letter-spacing: 0;
    margin-bottom: 7px;
    text-transform: uppercase;
}

.modal-warning-hint {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffd7c2;
    display: block;
    font-size: 12px;
    font-style: normal;
    margin-top: 9px;
    padding-top: 8px;
}

.modal-confirm-question {
    background: rgba(255, 87, 0, 0.16);
    border: 1px solid rgba(255, 87, 0, 0.45);
    border-left: 4px solid #ff5700;
    border-radius: 8px;
    color: #ffd7c2;
    font-size: 13px;
    font-weight: bold;
    line-height: 1.45;
    margin-top: 14px;
    padding: 12px 13px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 18px;
}
