@font-face {
    font-family: "Jeopardy";
    src: url("fonts/gyparody.ttf") format("truetype");
}

:root {
    --bg: #081126;
    --panel: rgba(9, 20, 48, 0.9);
    --panel-border: rgba(137, 170, 255, 0.22);
    --gold: #ffd54a;
    --gold-soft: #ffe9a8;
    --text: #eef4ff;
    --muted: #adc0f2;
    --success: #38d996;
    --danger: #ff6f7d;
    --shadow: 0 24px 60px rgba(1, 6, 18, 0.45);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
}

body {
    font-family: "Outfit", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(68, 110, 255, 0.22), transparent 28%),
        radial-gradient(circle at top right, rgba(255, 213, 74, 0.18), transparent 24%),
        linear-gradient(180deg, #091127 0%, #081126 45%, #040915 100%);
}

button,
input,
textarea {
    font: inherit;
}

button {
    border: 0;
}

.app-shell {
    min-height: 100vh;
    padding: 24px;
}

.hero,
.control-panel,
.game-panel,
.scorecard,
.modal-card {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.hero {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: center;
    border-radius: 28px;
    padding: 28px 32px;
    margin-bottom: 24px;
}

.eyebrow,
.panel-kicker,
.modal-badge {
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.72rem;
    color: var(--gold-soft);
}

#titleHead {
    margin: 0;
    font-family: "Jeopardy", "Space Grotesk", sans-serif;
    font-size: clamp(2.4rem, 4vw, 4.4rem);
    color: var(--gold);
}

.hero-copy {
    max-width: 60ch;
    margin: 12px 0 0;
    color: var(--muted);
}

.hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.layout {
    display: grid;
    grid-template-columns: minmax(320px, 410px) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.control-panel,
.game-panel {
    border-radius: 28px;
    padding: 24px;
}

.panel-header,
.scorecard-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: start;
    margin-bottom: 20px;
}

.panel-header h2,
.scorecard-header h2 {
    margin: 0;
    font-size: 1.8rem;
}

.tab-list,
.panel-actions,
.manual-toolbar,
.modal-actions,
.modal-score-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.tab-list {
    margin-bottom: 18px;
}

.tab-btn,
.ghost-btn,
.secondary-btn,
.primary-btn,
.accent-btn,
.icon-btn {
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.18s ease, background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.tab-btn,
.ghost-btn,
.secondary-btn,
.icon-btn {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.tab-btn,
.ghost-btn,
.secondary-btn,
.primary-btn,
.accent-btn {
    padding: 12px 18px;
}

.tab-btn.active,
.primary-btn,
.accent-btn {
    background: linear-gradient(135deg, #2452e3, #1537a7);
    color: white;
    box-shadow: 0 14px 30px rgba(34, 74, 208, 0.35);
}

.accent-btn {
    background: linear-gradient(135deg, #ffd54a, #e0a21a);
    color: #302000;
}

.secondary-btn:hover,
.ghost-btn:hover,
.tab-btn:hover,
.primary-btn:hover,
.accent-btn:hover,
.icon-btn:hover {
    transform: translateY(-1px);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.field {
    display: grid;
    gap: 8px;
    margin-bottom: 14px;
}

.field-grid {
    display: grid;
    gap: 14px;
}

.field span,
.toggle-field span {
    color: var(--gold-soft);
    font-size: 0.92rem;
}

.field input,
.field textarea {
    width: 100%;
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 13px 14px;
}

.field textarea {
    min-height: 90px;
    resize: vertical;
}

.helper-text,
.reload-link,
.status-message {
    color: var(--muted);
}

.reload-link {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.text-link {
    color: var(--gold-soft);
}

.compact {
    width: 130px;
    margin-bottom: 0;
}

.toggle-field {
    display: inline-flex;
    gap: 10px;
    align-items: center;
    margin-right: 12px;
}

.manual-editor {
    display: grid;
    gap: 16px;
    max-height: 420px;
    overflow: auto;
    padding-right: 4px;
    margin-bottom: 18px;
}

.manual-category-card,
.manual-final-card {
    border-radius: 22px;
    padding: 16px;
}

.manual-category-card {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
}

.manual-final-card {
    border: 1px dashed rgba(255, 213, 74, 0.35);
    background: rgba(255, 213, 74, 0.05);
}

.manual-question-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.host-panel {
    margin-top: 18px;
    padding-top: 22px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.host-panel-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: start;
    margin-bottom: 16px;
}

.host-room-grid,
.host-room-columns,
.player-room-strip {
    display: grid;
    gap: 12px;
}

.host-room-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 14px;
}

.host-delay-field {
    width: 180px;
}

.host-room-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 16px;
}

.host-room-card,
.host-list,
.player-card,
.player-clue-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 22px;
}

.host-room-card {
    padding: 14px 16px;
}

.host-room-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.82rem;
    color: var(--gold-soft);
    text-transform: uppercase;
    letter-spacing: 0.14em;
}

.host-list-title {
    margin: 0 0 8px;
    color: var(--gold-soft);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.78rem;
}

.host-list {
    min-height: 140px;
    max-height: 220px;
    overflow: auto;
    padding: 14px;
}

.question-buzz-panel {
    margin: 0 0 18px;
}

#questionBuzzList {
    min-height: 96px;
    max-height: 180px;
    text-align: left;
}

.host-list.empty {
    color: var(--muted);
}

.host-list-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.host-list-item:last-child {
    border-bottom: 0;
}

.host-list-rank {
    color: var(--gold);
    font-weight: 800;
}

.game-panel {
    min-height: calc(100vh - 170px);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.board-shell {
    --board-cols: 6;
    --board-rows: 6;
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-rows: repeat(var(--board-rows), minmax(0, 1fr));
    gap: 10px;
    padding: 10px;
    border-radius: 26px;
    background:
        linear-gradient(180deg, rgba(36, 83, 227, 0.28), rgba(8, 17, 38, 0.1)),
        rgba(3, 9, 24, 0.9);
}

.board-row {
    display: grid;
    grid-template-columns: repeat(var(--board-cols), minmax(0, 1fr));
    gap: 10px;
    min-height: 0;
}

.cell {
    min-width: 0;
    min-height: 0;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(46, 89, 232, 0.92), rgba(19, 38, 118, 0.96));
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: clamp(8px, 1.2vw, 16px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.cell.topic {
    font-family: "Coda", sans-serif;
    font-size: clamp(0.76rem, 1.2vw, 1.15rem);
    color: white;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 0.05em;
}

.cell.question-cell {
    font-family: "Coda", sans-serif;
    color: var(--gold);
    cursor: pointer;
    font-weight: 800;
}

.cell.question-cell:hover:not(.viewed) {
    background: linear-gradient(180deg, rgba(61, 111, 255, 0.98), rgba(25, 55, 154, 0.98));
}

.cell.viewed {
    background: linear-gradient(180deg, rgba(28, 44, 92, 0.8), rgba(12, 19, 39, 0.92));
    color: rgba(255, 255, 255, 0.12);
}

.cell.viewed .qvalue {
    visibility: hidden;
}

.topic-text,
.qvalue {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.qvalue {
    font-family: "Coda", sans-serif;
    font-size: clamp(1.1rem, 2.5vw, 2.6rem);
    line-height: 1;
    font-weight: 800;
}

.initialBoardText {
    align-self: center;
    justify-self: center;
    max-width: 42ch;
    text-align: center;
}

.scorecard {
    position: fixed;
    right: 24px;
    top: 24px;
    width: min(420px, calc(100vw - 32px));
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
    border-radius: 28px;
    padding: 22px;
    z-index: 30;
    overflow: hidden;
}

.score-list,
.modal-score-list {
    display: grid;
    gap: 12px;
    margin-bottom: 16px;
}

.score-list {
    max-height: calc(100vh - 190px);
    overflow: auto;
    padding-right: 4px;
}

.team-row {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) 92px 104px 88px 88px;
    gap: 10px;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 18px;
    padding: 10px;
}

.team-row.modal-team-row {
    grid-template-columns: minmax(0, 1fr) 90px;
}

.team-name,
.new-score {
    width: 100%;
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 10px 12px;
}

.team-score {
    margin: 0;
    font-weight: 800;
    text-align: center;
}

.team-score::before {
    content: attr(data-emoji);
    margin-right: 6px;
}

.remove-team {
    color: var(--danger);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(2, 7, 19, 0.78);
    display: grid;
    place-items: center;
    padding: 24px;
}

.modal-card {
    width: min(920px, 100%);
    border-radius: 30px;
    padding: 32px;
    background:
        radial-gradient(circle at top, rgba(77, 118, 255, 0.28), transparent 38%),
        linear-gradient(180deg, rgba(28, 62, 193, 0.96), rgba(9, 26, 93, 0.98));
    border: 3px solid rgba(255, 213, 74, 0.28);
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.16);
    display: flex;
    flex-direction: column;
}

.modal-question {
    margin: 0 0 24px;
    font-family: "Coda", sans-serif;
    font-size: clamp(1.7rem, 3vw, 2.8rem);
    line-height: 1.15;
    text-transform: uppercase;
    text-align: center;
    text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
    font-weight: 800;
}

.modal-answer {
    margin: 0 0 24px;
    font-family: "Coda", sans-serif;
    color: var(--gold);
    font-size: clamp(1.7rem, 3vw, 2.4rem);
    line-height: 1.2;
    text-transform: uppercase;
    text-align: center;
    text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
    font-weight: 800;
}

.final-modal-title {
    margin: 0 0 10px;
    font-family: "Coda", sans-serif;
    font-size: clamp(1.8rem, 3vw, 2.7rem);
    line-height: 1.1;
    text-transform: uppercase;
    text-align: center;
    text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
    font-weight: 800;
}

.hidden-answer {
    visibility: hidden;
}

#modValue,
#modCategory {
    font-family: "Coda", sans-serif;
    font-size: clamp(1.2rem, 2vw, 1.7rem);
    text-align: center;
    color: var(--gold);
    font-weight: 800;
}

#questionModal,
#finaljeopardyModal {
    text-align: center;
}

#questionModal .modal-actions,
#finaljeopardyModal .modal-actions {
    justify-content: flex-end;
    margin-top: auto;
    padding-top: 12px;
}

.answer-score-btn {
    min-width: 140px;
}

.hidden {
    display: none !important;
}

.board-focus-exit {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 60;
    padding: 12px 18px;
    border-radius: 999px;
    background: rgba(9, 20, 48, 0.92);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: var(--shadow);
}

.player-body {
    min-height: 100vh;
}

.player-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.player-card {
    width: min(640px, 100%);
    padding: 28px;
    box-shadow: var(--shadow);
}

.player-title {
    margin: 0 0 18px;
    font-size: clamp(2rem, 5vw, 3rem);
    color: var(--gold);
}

.player-submit,
.player-buzz-btn {
    width: 100%;
}

.player-room-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 16px;
}

.player-room-strip > div {
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 18px;
}

.player-clue-card {
    padding: 24px;
    margin-bottom: 18px;
    text-align: center;
    background:
        radial-gradient(circle at top, rgba(77, 118, 255, 0.28), transparent 38%),
        linear-gradient(180deg, rgba(28, 62, 193, 0.96), rgba(9, 26, 93, 0.98));
}

.player-question-value {
    margin: 0 0 12px;
    font-family: "Coda", sans-serif;
    font-size: clamp(1.3rem, 4vw, 2rem);
    color: var(--gold);
    text-transform: uppercase;
}

.player-question-text {
    margin: 0;
    font-family: "Coda", sans-serif;
    font-size: clamp(1.5rem, 4vw, 2.4rem);
    line-height: 1.2;
    text-transform: uppercase;
}

.player-buzzer-wrap {
    display: grid;
    gap: 12px;
}

.player-buzz-btn {
    min-height: 88px;
    font-size: 1.4rem;
    font-weight: 800;
    border-radius: 26px;
    background: linear-gradient(135deg, #ffd54a, #e0a21a);
    color: #302000;
    box-shadow: 0 14px 30px rgba(224, 162, 26, 0.28);
}

.player-buzz-btn:disabled {
    opacity: 0.72;
    cursor: not-allowed;
    box-shadow: none;
}

.player-status {
    margin: 0;
    text-align: center;
    color: var(--muted);
}

.status-message.success {
    color: var(--success);
}

.status-message.error {
    color: #ff9aa3;
}

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

    .game-panel {
        min-height: 60vh;
    }
}

@media (max-width: 720px) {
    .app-shell {
        padding: 16px;
    }

    .hero,
    .control-panel,
    .game-panel {
        padding: 18px;
        border-radius: 24px;
    }

    .hero {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-actions button,
    .panel-actions button,
    .panel-actions a {
        width: 100%;
        text-align: center;
    }

    .manual-question-grid,
    .team-row,
    .host-room-grid,
    .host-room-columns,
    .player-room-strip {
        grid-template-columns: 1fr;
    }

    .board-shell {
        overflow: auto;
    }

    .board-row {
        min-width: 680px;
    }

    .scorecard {
        right: 16px;
        left: 16px;
        width: auto;
    }
}

body.board-focus .hero,
body.board-focus .control-panel {
    display: none;
}

body.board-focus .app-shell {
    min-height: 100vh;
    padding: 12px;
}

body.board-focus .layout {
    display: block;
}

body.board-focus .game-panel {
    min-height: calc(100vh - 24px);
    padding: 16px;
}

body.board-focus .board-focus-exit {
    display: inline-flex !important;
}
