/* ------------------------------------------------------------
   Page
------------------------------------------------------------ */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    background: #24150d;
    font-family: Arial, Helvetica, sans-serif;
}


/* ------------------------------------------------------------
   Three.js Container
------------------------------------------------------------ */

#game-container {
    width: 100%;
    height: 100%;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}


/* ------------------------------------------------------------
   Shared Visibility
------------------------------------------------------------ */

.hidden {
    opacity: 0 !important;
    visibility: hidden !important;
}


/* ------------------------------------------------------------
   Game HUD
------------------------------------------------------------ */

.game-hud {
    position: fixed;

    top: 0;
    left: 0;
    right: 0;

    display: flex;

    align-items: flex-start;
    justify-content: space-between;

    padding: 28px 34px;

    pointer-events: none;

    color: #fff0c8;

    text-shadow:
        0 2px 8px
        rgba(0, 0, 0, 0.55);

    opacity: 1;

    transition:
        opacity 0.35s ease,
        visibility 0.35s ease;
}

.hud-title {
    color: #f0c66f;

    font-size: 19px;
    font-weight: 800;

    letter-spacing: 0.18em;
}

.hud-difficulty {
    margin-top: 6px;

    color: #e8d4af;

    font-size: 15px;

    letter-spacing: 0.06em;
}

.hud-mistakes {
    display: flex;

    align-items: baseline;

    gap: 9px;

    padding: 8px 13px;

    background:
        rgba(52, 28, 14, 0.38);

    border:
        1px solid
        rgba(240, 198, 111, 0.25);

    border-radius: 10px;
}

.hud-label {
    color: #e8d4af;

    font-size: 14px;

    letter-spacing: 0.04em;
}

.hud-value {
    min-width: 16px;

    color: #f0c66f;

    font-size: 20px;
    font-weight: 800;

    text-align: center;
}


/* ------------------------------------------------------------
   Game Instructions
------------------------------------------------------------ */

.game-instructions {
    position: fixed;

    left: 50%;
    bottom: 24px;

    transform:
        translateX(-50%);

    padding: 9px 16px;

    color: #e8d4af;

    background:
        rgba(45, 24, 12, 0.42);

    border:
        1px solid
        rgba(240, 198, 111, 0.18);

    border-radius: 12px;

    font-size: 14px;

    letter-spacing: 0.035em;

    white-space: nowrap;

    pointer-events: none;

    text-shadow:
        0 2px 7px
        rgba(0, 0, 0, 0.55);

    opacity: 1;

    transition:
        opacity 0.35s ease,
        visibility 0.35s ease;
}

.game-instructions span {
    margin: 0 8px;

    color: #f0c66f;
}


/* ------------------------------------------------------------
   Opening Menu Overlay
------------------------------------------------------------ */

.menu-overlay {
    position: fixed;

    inset: 0;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 24px;

    background:
        rgba(32, 17, 8, 0.56);

    backdrop-filter:
        blur(2px);

    opacity: 0;
    visibility: hidden;

    transition:
        opacity 0.45s ease,
        visibility 0.45s ease;

    z-index: 20;
}

.menu-overlay.visible {
    opacity: 1;
    visibility: visible;
}


/* ------------------------------------------------------------
   Opening Menu Card
------------------------------------------------------------ */

.menu-card {
    width:
        min(520px, 92vw);

    padding:
        36px 34px 32px;

    text-align: center;

    color: #f6e4bd;

    background:
        linear-gradient(
            180deg,
            rgba(84, 47, 25, 0.97),
            rgba(52, 28, 15, 0.98)
        );

    border:
        1px solid
        rgba(240, 198, 111, 0.58);

    border-radius: 18px;

    box-shadow:
        0 24px 60px
        rgba(0, 0, 0, 0.48);

    transform:
        translateY(12px)
        scale(0.98);

    transition:
        transform 0.45s ease;
}

.menu-overlay.visible
.menu-card {
    transform:
        translateY(0)
        scale(1);
}

.menu-eyebrow {
    margin-bottom: 8px;

    color: #d8b56d;

    font-size: 11px;
    font-weight: 700;

    letter-spacing: 0.22em;
}

.menu-card h1 {
    margin:
        0;

    color: #f0c66f;

    font-size: 38px;

    letter-spacing: 0.10em;
}

.menu-subtitle {
    margin:
        10px 0 28px;

    color: #e5cfaa;

    font-size: 15px;
}


/* ------------------------------------------------------------
   Difficulty Choices
------------------------------------------------------------ */

.difficulty-options {
    display: grid;

    gap: 12px;
}

.difficulty-button {
    width: 100%;

    padding:
        15px 18px;

    cursor: pointer;

    text-align: left;

    color: #f6e4bd;

    background:
        rgba(38, 20, 10, 0.56);

    border:
        1px solid
        rgba(240, 198, 111, 0.24);

    border-radius: 12px;

    transition:
        transform 0.18s ease,
        background 0.18s ease,
        border-color 0.18s ease;
}

.difficulty-button:hover {
    transform:
        translateY(-2px);

    background:
        rgba(95, 54, 27, 0.82);

    border-color:
        rgba(240, 198, 111, 0.70);
}

.difficulty-button:active {
    transform:
        translateY(0);
}

.difficulty-name {
    display: block;

    color: #f0c66f;

    font-size: 16px;
    font-weight: 800;

    letter-spacing: 0.10em;
}

.difficulty-description {
    display: block;

    margin-top: 5px;

    color: #dbc5a1;

    font-size: 13px;

    letter-spacing: 0.025em;
}


/* ------------------------------------------------------------
   Completion Overlay
------------------------------------------------------------ */

.completion-overlay {
    position: fixed;

    inset: 0;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 24px;

    background:
        rgba(32, 17, 8, 0.58);

    opacity: 0;
    visibility: hidden;

    transition:
        opacity 0.45s ease,
        visibility 0.45s ease;

    z-index: 30;
}

.completion-overlay.visible {
    opacity: 1;
    visibility: visible;
}


/* ------------------------------------------------------------
   Completion Card
------------------------------------------------------------ */

.completion-card {
    width:
        min(430px, 90vw);

    padding:
        34px 30px;

    text-align: center;

    color: #f6e4bd;

    background:
        linear-gradient(
            180deg,
            rgba(84, 47, 25, 0.97),
            rgba(52, 28, 15, 0.98)
        );

    border:
        1px solid
        rgba(240, 198, 111, 0.60);

    border-radius: 18px;

    box-shadow:
        0 24px 60px
        rgba(0, 0, 0, 0.48);

    transform:
        translateY(12px)
        scale(0.97);

    transition:
        transform 0.45s ease;
}

.completion-overlay.visible
.completion-card {
    transform:
        translateY(0)
        scale(1);
}

.completion-eyebrow {
    margin-bottom: 8px;

    color: #d8b56d;

    font-size: 11px;
    font-weight: 700;

    letter-spacing: 0.22em;
}

.completion-card h1 {
    margin:
        0;

    color: #f0c66f;

    font-size: 34px;
}

.completion-card p {
    margin:
        10px 0 24px;

    color: #e5cfaa;

    font-size: 15px;
}


/* ------------------------------------------------------------
   Completion Buttons
------------------------------------------------------------ */

.completion-actions {
    display: flex;

    justify-content: center;

    gap: 10px;
}

.completion-actions button {
    padding:
        11px 18px;

    cursor: pointer;

    color: #321c0e;

    background:
        #f0c66f;

    border: none;

    border-radius: 9px;

    font-size: 14px;
    font-weight: 800;

    transition:
        transform 0.18s ease,
        filter 0.18s ease;
}

.completion-actions button:hover {
    transform:
        translateY(-2px);

    filter:
        brightness(1.06);
}

.completion-actions
.secondary-button {
    color: #f0c66f;

    background:
        transparent;

    border:
        1px solid
        rgba(240, 198, 111, 0.48);
}


/* ------------------------------------------------------------
   Responsive UI
------------------------------------------------------------ */

@media (
    max-width: 650px
) {

    .game-hud {
        padding:
            18px 18px;
    }

    .hud-title {
        font-size:
            16px;
    }

    .game-instructions {
        bottom:
            16px;

        font-size:
            12px;
    }

    .menu-card {
        padding:
            30px 22px 24px;
    }

    .menu-card h1 {
        font-size:
            30px;
    }

    .completion-actions {
        flex-direction:
            column;
    }
}


/* ------------------------------------------------------------
   Sound Button
   ------------------------------------------------------------ */

#sound-button {
    position: fixed;
    top: 72px;
    right: 62px;

    width: 42px;
    height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: 1px solid rgba(255, 211, 107, 0.28);
    border-radius: 10px;

    background:
        rgba(63, 36, 21, 0.72);

    color: #ffd36b;

    font-size: 19px;
    line-height: 1;

    cursor: pointer;

    backdrop-filter:
        blur(6px);

    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        transform 0.15s ease;
}

#sound-button:hover {
    background:
        rgba(82, 47, 27, 0.88);

    border-color:
        rgba(255, 211, 107, 0.55);
}

#sound-button:active {
    transform:
        scale(0.94);
}

#sound-button:focus-visible {
    outline:
        2px solid #ffd36b;

    outline-offset:
        3px;
}

/* ------------------------------------------------------------
   Zoom Controls
   ------------------------------------------------------------ */

#zoom-controls {
    position: fixed;

    right: 34px;
    bottom: 28px;

    display: flex;

    gap: 8px;

    z-index: 10;
}

#zoom-controls button {
    width: 42px;
    height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    cursor: pointer;

    color: #ffd36b;

    background:
        rgba(63, 36, 21, 0.72);

    border:
        1px solid
        rgba(255, 211, 107, 0.28);

    border-radius: 10px;

    font-size: 22px;
    font-weight: 700;
    line-height: 1;

    backdrop-filter:
        blur(6px);

    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        transform 0.15s ease;
}

#zoom-controls button:hover {
    background:
        rgba(82, 47, 27, 0.88);

    border-color:
        rgba(255, 211, 107, 0.55);
}

#zoom-controls button:active {
    transform:
        scale(0.94);
}

#zoom-controls button:focus-visible {
    outline:
        2px solid #ffd36b;

    outline-offset:
        3px;
}
