/* Quiz Game - Game Player Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #1e1e1e;
    --bg-panel: #252526;
    --bg-card: #2d2d2d;
    --text-primary: #e0e0e0;
    --text-secondary: #888;
    --accent-blue: #007acc;
    --accent-gold: #c7a317;
    --jeopardy-blue: #060ce9;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
}

/* Screens */
.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: block;
}

/* Setup Screen */
.setup-container {
    max-width: 500px;
    margin: 0 auto;
    padding: 40px 20px;
}

.setup-container h1 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 40px;
    color: var(--accent-gold);
}

.setup-section {
    margin-bottom: 24px;
}

.setup-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.setup-section select,
.setup-section input[type="number"],
.setup-section input[type="text"] {
    width: 100%;
    padding: 12px;
    background: var(--bg-panel);
    border: 1px solid #3c3c3c;
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 1rem;
}

.setup-section select:focus,
.setup-section input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.link-btn {
    display: inline-block;
    margin-top: 8px;
    color: var(--accent-blue);
    text-decoration: none;
}

.link-btn:hover {
    text-decoration: underline;
}

.team-count-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.team-count-controls button {
    width: 40px;
    height: 40px;
    background: var(--bg-panel);
    border: 1px solid #3c3c3c;
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: background 0.2s;
}

.team-count-controls button:hover {
    background: var(--bg-card);
}

.team-count-controls span {
    font-size: 1.5rem;
    min-width: 40px;
    text-align: center;
}

#team-names-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#team-names-container input {
    padding: 10px 12px;
    background: var(--bg-panel);
    border: 1px solid #3c3c3c;
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 1rem;
}

.primary-btn {
    width: 100%;
    padding: 14px 24px;
    background: var(--accent-blue);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
}

.primary-btn:hover:not(:disabled) {
    background: #005a9e;
}

.primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Game Screen */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: var(--jeopardy-blue);
}

.game-header h1 {
    font-size: 1.5rem;
    color: var(--accent-gold);
}

.header-controls {
    display: flex;
    gap: 12px;
}

.header-btn {
    padding: 8px 16px;
    background: transparent;
    border: 2px solid var(--accent-gold);
    border-radius: 6px;
    color: var(--accent-gold);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.header-btn:hover {
    background: rgba(199, 163, 23, 0.2);
}

/* Game Layout */
.game-layout {
    display: flex;
    height: calc(100vh - 60px);
    padding: 16px;
    gap: 16px;
}

.board-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-board {
    display: grid;
    gap: 6px;
    width: 100%;
    max-width: 900px;
    background: var(--bg-dark);
}

.category-header {
    background: var(--jeopardy-blue);
    color: white;
    padding: 12px 8px;
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
    text-transform: uppercase;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70px;
}

.question-tile {
    background: var(--jeopardy-blue);
    color: var(--accent-gold);
    padding: 16px 8px;
    text-align: center;
    font-weight: 700;
    font-size: 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.1s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70px;
}

.question-tile:hover:not(.answered) {
    transform: scale(1.02);
    background: #0810ff;
}

.question-tile.answered {
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: default;
}

/* Scores Panel */
.scores-panel {
    width: 220px;
    background: var(--bg-panel);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.scores-panel h2 {
    text-align: center;
    margin-bottom: 16px;
    color: var(--accent-gold);
    font-size: 1.2rem;
}

#team-scores {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.team-score-item {
    background: var(--bg-card);
    border-radius: 6px;
    padding: 12px;
}

.team-score-item .team-name {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.team-score-item .score-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.team-score-item .score-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent-gold);
    min-width: 80px;
    text-align: center;
}

.team-score-item .score-value.negative {
    color: var(--danger);
}

.score-btn {
    width: 32px;
    height: 32px;
    background: var(--bg-panel);
    border: 1px solid #3c3c3c;
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s;
}

.score-btn:hover {
    background: var(--bg-dark);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
}

.modal-content {
    position: relative;
    background: var(--jeopardy-blue);
    border-radius: 12px;
    padding: 32px;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    text-align: center;
}

/* Question Modal */
.question-modal-content {
    width: 800px;
}

.question-category {
    font-size: 1rem;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
}

.question-points {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-gold);
    margin-bottom: 24px;
}

.question-text {
    font-size: 1.8rem;
    line-height: 1.4;
    margin-bottom: 24px;
    color: white;
}

.answer-text {
    font-size: 1.5rem;
    color: var(--accent-gold);
    margin-bottom: 24px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.answer-text.hidden {
    display: none;
}

/* Timer */
.timer-display {
    margin-bottom: 24px;
}

.timer-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.timer-bar::after {
    content: '';
    display: block;
    height: 100%;
    background: var(--accent-gold);
    width: var(--timer-progress, 100%);
    transition: width 0.1s linear;
}

#timer-seconds,
#fj-timer-seconds {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-gold);
}

.timer-display.expired #timer-seconds,
.timer-display.expired #fj-timer-seconds {
    color: var(--danger);
}

/* Question Controls */
.question-controls {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-bottom: 24px;
}

.control-btn {
    padding: 12px 24px;
    background: transparent;
    border: 2px solid white;
    border-radius: 6px;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.control-btn.hidden {
    display: none;
}

/* Award Panel */
.award-panel {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 24px;
}

.award-panel.hidden {
    display: none;
}

.award-panel p {
    margin-bottom: 16px;
    color: rgba(255, 255, 255, 0.8);
}

#award-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-bottom: 16px;
}

.award-btn {
    padding: 12px 24px;
    background: var(--success);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.award-btn:hover {
    background: #15803d;
}

.award-btn.wrong {
    background: var(--danger);
}

.award-btn.wrong:hover {
    background: #b91c1c;
}

#no-award-btn {
    background: var(--bg-card);
    border-color: var(--bg-card);
}

/* Daily Double Modal */
.daily-double-content {
    width: 500px;
}

.daily-double-content h2 {
    font-size: 2rem;
    color: var(--accent-gold);
    margin-bottom: 16px;
}

.dd-team-select {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-bottom: 24px;
}

.dd-team-btn {
    padding: 12px 24px;
    background: transparent;
    border: 2px solid white;
    border-radius: 6px;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.dd-team-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.dd-team-btn.selected {
    background: var(--accent-gold);
    border-color: var(--accent-gold);
    color: var(--bg-dark);
}

.wager-input-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
}

.wager-input-group label {
    font-size: 1.1rem;
}

.wager-input-group input {
    width: 120px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid white;
    border-radius: 6px;
    color: white;
    font-size: 1.2rem;
    text-align: center;
}

.wager-input-group input:focus {
    outline: none;
    border-color: var(--accent-gold);
}

#wager-max {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

/* Final Jeopardy Modal */
.final-jeopardy-content {
    width: 700px;
}

.fj-phase {
    display: block;
}

.fj-phase.hidden {
    display: none;
}

.fj-category {
    font-size: 1.5rem;
    color: var(--accent-gold);
    margin-bottom: 24px;
    text-transform: uppercase;
}

#fj-wagers {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.fj-wager-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
}

.fj-wager-row .team-name {
    font-weight: 600;
    min-width: 120px;
    text-align: left;
}

.fj-wager-row .team-score {
    color: var(--accent-gold);
    min-width: 80px;
}

.fj-wager-row input {
    width: 100px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid white;
    border-radius: 4px;
    color: white;
    font-size: 1rem;
    text-align: center;
}

#fj-results {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.fj-result-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
}

.fj-result-row .team-info {
    text-align: left;
}

.fj-result-row .team-name {
    font-weight: 600;
}

.fj-result-row .wager-info {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.fj-result-btns {
    display: flex;
    gap: 8px;
}

.fj-result-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: opacity 0.2s;
}

.fj-result-btn.correct {
    background: var(--success);
    color: white;
}

.fj-result-btn.incorrect {
    background: var(--danger);
    color: white;
}

.fj-result-btn:not(.selected) {
    opacity: 0.5;
}

.fj-result-btn.selected {
    opacity: 1;
}

/* End Game Modal */
.end-game-content {
    width: 500px;
}

.end-game-content h2 {
    font-size: 2rem;
    color: var(--accent-gold);
    margin-bottom: 24px;
}

#final-scores {
    margin-bottom: 24px;
}

.final-score-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    margin-bottom: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
}

.final-score-item.winner {
    background: var(--accent-gold);
    color: var(--bg-dark);
}

.final-score-item .rank {
    font-size: 1.5rem;
    font-weight: 700;
    width: 40px;
}

.final-score-item .team-name {
    flex: 1;
    text-align: left;
    font-weight: 600;
    font-size: 1.1rem;
}

.final-score-item .score {
    font-size: 1.3rem;
    font-weight: 700;
}

.end-game-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.end-game-buttons .primary-btn {
    width: auto;
}

/* Hidden utility */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 1024px) {
    .game-layout {
        flex-direction: column;
    }

    .scores-panel {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .scores-panel h2 {
        width: 100%;
    }

    #team-scores {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .team-score-item {
        min-width: 150px;
    }

    .question-tile {
        font-size: 1.2rem;
        min-height: 60px;
    }

    .category-header {
        font-size: 0.8rem;
        min-height: 60px;
    }
}

@media (max-width: 768px) {
    .modal-content {
        padding: 20px;
        margin: 10px;
    }

    .question-text {
        font-size: 1.4rem;
    }

    .question-modal-content,
    .final-jeopardy-content {
        width: 95%;
    }
}
