:root {
    --bg-color: #1a1a2e;
    --text-color: #eaeaea;
    --accent-color: #e94560;
    --secondary-color: #16213e;
    --highlight-color: #0f3460;
    --success-color: #4caf50;
    --danger-color: #f44336;
    --font-main: 'Helvetica Neue', Arial, sans-serif;
}

body {
    margin: 0;
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

#app {
    width: 90%;
    max-width: 1000px;
    height: 90vh;
    background-color: var(--secondary-color);
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    padding: 2rem;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.screen {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.hidden {
    display: none !important;
}

/* BUTTONS */
.btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: transform 0.1s, opacity 0.2s;
    color: white;
}

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

.btn-primary {
    background-color: var(--accent-color);
}

.btn-secondary {
    background-color: var(--highlight-color);
}

.btn-success {
    background-color: var(--success-color);
}

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

/* GENRE GRID */
.genre-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    width: 100%;
    max-width: 600px;
}

.genre-btn {
    background-color: var(--highlight-color);
    color: white;
    border: 2px solid var(--accent-color);
    border-radius: 10px;
    padding: 1.5rem;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.genre-btn:hover {
    background-color: var(--accent-color);
}

.genre-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    border-color: #555;
    background-color: #333;
}

/* QUESTION SCREEN */
.header-row {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 0 2rem;
}

#timer-display {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent-color);
    border: 2px solid var(--accent-color);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    background-color: rgba(233, 69, 96, 0.1);
}

.genre-label {
    font-size: 1.2rem;
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    margin-bottom: 0;
    /* Changed from 2rem to 0 because of header-row */
}

#question-text {
    font-size: 2rem;
    line-height: 1.5;
    min-height: 150px;
    width: 80%;
    text-align: left;
    background: rgba(0, 0, 0, 0.2);
    padding: 2rem;
    border-radius: 10px;
}

/* BUZZER OVERLAY */
.buzzer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(233, 69, 96, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    animation: flash 0.2s;
}

@keyframes flash {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

.buzzer-content {
    background: white;
    padding: 3rem;
    border-radius: 20px;
    color: var(--bg-color);
    text-align: center;
}

.buzzer-text {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

#buzzer-player-name {
    font-size: 4rem;
    font-weight: bold;
    display: block;
    margin: 1rem 0;
}

/* JUDGMENT */
.answer-box {
    margin: 2rem 0;
    padding: 2rem;
    background: white;
    color: var(--bg-color);
    border-radius: 10px;
    width: 60%;
}

.correct-answer-display {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--accent-color);
    margin-top: 1rem;
}

/* PANELS & SCORE */
.panel-grid-large {
    background: #333;
    padding: 10px;
    border-radius: 5px;
}

.panel-grid-small {
    background: #333;
    padding: 2px;
}

.panel-cell {
    aspect-ratio: 1;
    background-color: #eee;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    cursor: default;
    border-radius: 2px;
}

.panel-cell.occupied {
    color: white;
    text-shadow: 0 0 2px black;
}

.panel-cell.selectable {
    background-color: var(--success-color);
    color: white;
    cursor: pointer;
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    from {
        opacity: 0.7;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1.05);
    }
}

.score-list {
    list-style: none;
    padding: 0;
    width: 100%;
}

.score-item {
    background: rgba(255, 255, 255, 0.1);
    margin-bottom: 0.5rem;
    padding: 0.8rem;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    border-left: 5px solid transparent;
}

/* ATTACK CHANCE */
#screen-attack-chance {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    animation: flashAttack 0.5s infinite alternate;
}

@keyframes flashAttack {
    from {
        background: rgba(255, 0, 0, 0.6);
    }

    to {
        background: rgba(255, 0, 0, 0.9);
    }
}

.attack-text {
    font-size: 5rem;
    font-weight: bold;
    color: yellow;
    text-shadow: 2px 2px 0 red, -2px -2px 0 red, 2px -2px 0 red, -2px 2px 0 red;
    transform: rotate(-5deg);
}

.panel-cell.erasable {
    background-color: var(--danger-color) !important;
    cursor: pointer;
    box-shadow: 0 0 10px red;
    animation: shake 0.5s infinite;
}

@keyframes shake {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-2px);
    }

    75% {
        transform: translateX(2px);
    }

    100% {
        transform: translateX(0);
    }
}

/* TITLE SCREEN */
#screen-title {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.title-logo {
    font-size: 5rem;
    font-weight: 900;
    /* Removed gradient text for specific coloring */
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin-bottom: 3rem;
    letter-spacing: 5px;
    animation: fadeInDown 1s ease-out;
}

.title-text-main {
    color: white;
    font-style: italic;
    /* Start often has italic look */
}

.title-text-sub {
    color: #ff9800;
    /* Orange */
    font-size: 1.2em;
    /* Slightly larger */
    margin-left: 0.2rem;
}

.title-text-pc {
    display: block;
    font-size: 1.5rem;
    color: #aaa;
    letter-spacing: 2px;
    margin-top: -10px;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.title-menu {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
    max-width: 300px;
    animation: fadeInUp 1s ease-out 0.5s backwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.btn-large {
    padding: 1.2rem 2rem;
    font-size: 1.5rem;
    width: 100%;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.footer-credit {
    position: absolute;
    bottom: 1rem;
    color: #555;
    font-size: 0.8rem;
}

/* MODAL */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    color: #333;
    padding: 2rem;
    border-radius: 15px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    position: relative;
    animation: zoomIn 0.3s ease-out;
}

@keyframes zoomIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.howto-body {
    text-align: left;
    margin: 1.5rem 0;
    line-height: 1.6;
}

.howto-body p {
    margin-bottom: 1rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

.howto-body strong {
    color: var(--accent-color);
    font-size: 1.1rem;
}

/* FINAL RANKING */
.ranking-title {
    font-size: 3rem;
    color: var(--accent-color);
    margin-bottom: 2rem;
    text-shadow: 0 0 10px rgba(233, 69, 96, 0.5);
}

.final-ranking-container {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.final-ranking-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.5rem;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease-out;
}

.final-ranking-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.final-ranking-item.winner {
    background: linear-gradient(to right, #ffd700, #ffeb3b);
    color: #333;
    font-weight: bold;
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    border: 2px solid #fff;
}

.rank-badge {
    background: #333;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
    margin-right: 1rem;
}

.winner .rank-badge {
    background: white;
    color: #ffd700;
}

/* IMPORT MODAL */
.import-textarea {
    width: 100%;
    height: 300px;
    background: #333;
    color: #eee;
    border: 1px solid #555;
    border-radius: 5px;
    padding: 1rem;
    font-family: monospace;
    font-size: 0.9rem;
    margin: 1rem 0;
    resize: vertical;
}

.error-msg {
    color: var(--danger-color);
    background: rgba(244, 67, 54, 0.1);
    border: 1px solid var(--danger-color);
    padding: 0.5rem;
    border-radius: 5px;
    margin-bottom: 1rem;
    text-align: left;
    white-space: pre-wrap;
}