/* =========================================================
   Doordle — game styles
   ========================================================= */

:root {
    --brand: #ED1C24;
}

html, body {
    height: 100%;
}

body {
    font-family: "cofo-sans-mono-variable", sans-serif;
    background: url('https://doordlequiz.com/wp-content/uploads/2025/03/Background.webp') no-repeat center center fixed;
    background-size: cover;
    color: #000000;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

@media (prefers-color-scheme: dark) {
    body {
        background-image: url('https://doordlequiz.com/wp-content/uploads/2025/03/Background-Dark-Mode.webp');
        color: #ffffff;
    }
}

/* --- Pre-game screen --- */

#pre-game-screen {
    text-align: center;
}

h1 {
    font-size: 10vw;
    color: var(--brand);
    text-shadow: 0.026em 0.026em 0.0052em #000000;
    margin-bottom: 20px;
    text-align: center;
}

@media (prefers-color-scheme: dark) {
    h1 { text-shadow: 0.026em 0.026em 0.0052em #ffffff; }
}

/* --- Game area --- */

.game-area {
    height: 70vh;
    width: 98vw;
    position: relative;
}

/* --- Question --- */

.question-text {
    position: relative;
    width: 100%;
    min-height: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1rem, 2vw, 3rem);
    color: #000000;
    text-align: center;
    z-index: 10;
}

@media (prefers-color-scheme: dark) {
    .question-text { color: #ffffff; }
}

/* --- Doors grid --- */

#doors {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2vw;
    justify-items: center;
    margin-top: 40px;
    width: 100%;
    max-width: 100%;
}

.door {
    width: 100%;
    max-width: 30vw;
    max-height: 50vh;
    aspect-ratio: 9 / 16;
    background: url('https://doordlequiz.com/wp-content/uploads/2025/03/Door-Closed.png') no-repeat center center;
    background-size: contain;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.2s ease;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 1;
}

.door:hover {
    transform: translateY(-2px);
}

.door.correct {
    background: url('https://doordlequiz.com/wp-content/uploads/2025/03/Door-Open.png') no-repeat center center;
    background-size: contain;
}

.door.locked {
    pointer-events: none;
    animation: shake 0.5s 1;
}

@keyframes shake {
    0%   { transform: translateX(0); }
    25%  { transform: translateX(-5px); }
    50%  { transform: translateX(5px); }
    75%  { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}

/* --- Answer text inside doors --- */

.answer-text {
    color: #000000;
    width: 80%;
    padding: 0 0.5rem;
    max-height: 3em;
    line-height: 1.5em;
    font-size: 32px;
    overflow: hidden;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

@media (prefers-color-scheme: dark) {
    .answer-text { color: #ffffff; }
}

@media (max-width: 1024px) { .answer-text { font-size: 24px; } }
@media (max-width: 768px)  { .answer-text { font-size: 18px; } }
@media (max-width: 480px)  { .answer-text { font-size: 16px; } }

/* --- Timer --- */

#timer {
    font-size: 18px;
    color: var(--brand);
    position: absolute;
    top: 10px;
    left: 20px;
}

/* --- Buttons --- */

button {
    background: var(--brand);
    color: #ffffff;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s;
}

button:hover {
    background: #dc2b35;
}

/* --- Penalty notification --- */

#penalty-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.75);
    color: var(--brand);
    font-size: 28px;
    padding: 12px 24px;
    border-radius: 12px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-in-out, visibility 0s linear 0.5s;
    pointer-events: none;
    z-index: 2000;
}

#penalty-notification.show {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease-in-out;
}

/* --- End-game modal --- */

.end-game-modal {
    position: fixed;
    inset: 0;
    display: none;
    place-items: center;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
}

.end-game-modal.active {
    display: grid;
}

.end-game-modal .modal-content {
    background: rgba(0, 0, 0, 0.85);
    color: #ffffff;
    padding: 24px;
    border-radius: 12px;
    width: min(90vw, 420px);
    text-align: center;
    backdrop-filter: blur(2px);
}

.blur-background {
    filter: blur(5px);
    pointer-events: none;
    user-select: none;
}

/* --- History section --- */

#history-section {
    width: 100%;
    max-width: 600px;
    margin: 40px auto 20px;
    padding: 0 18px;
    color: #000000;
}

@media (prefers-color-scheme: dark) {
    #history-section { color: #ffffff; }
}

#history-section h3 {
    font-size: 18px;
    margin-bottom: 10px;
}

.doordle-history {
    width: 100%;
    border-collapse: collapse;
    font-family: "cofo-sans-mono-variable", monospace;
}

.doordle-history th,
.doordle-history td {
    border: 1px solid rgba(0, 0, 0, 0.2);
    padding: 10px;
}

@media (prefers-color-scheme: dark) {
    .doordle-history th,
    .doordle-history td {
        border-color: rgba(255, 255, 255, 0.15);
    }
}

.doordle-history th {
    background: rgba(0, 0, 0, 0.08);
    text-align: center;
}

@media (prefers-color-scheme: dark) {
    .doordle-history th { background: rgba(255, 255, 255, 0.08); }
}

.doordle-history td {
    text-align: left;
}

.doordle-history .score-cell {
    text-align: center;
    font-weight: bold;
    color: var(--brand);
    font-size: 1.1em;
}

.no-scores {
    color: inherit;
    opacity: 0.7;
}

/* --- Footer --- */

.footer {
    position: absolute;
    bottom: 10px;
    width: 100%;
    text-align: center;
    font-size: 14px;
}

.footer a {
    color: var(--brand);
    text-decoration: none;
}

.footer a:hover {
    color: #dc2b35;
}
