/* Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

:root {
    /* Colors */
    --bg-color: #0f0f11;
    --bg-card: #1a1a1e;
    --bg-modal: rgba(22, 22, 26, 0.95);
    --text-color: #ffffff;
    --text-muted: #9ba3af;
    --border-modal: #2d2d34;
    --bg-pill: #222226;

    /* Tile States (Standard Mode) */
    --color-correct: #FF0000;
    /* Canadian Red */
    --color-present: #E6A100;
    /* Canadian Gold */
    --color-absent: #3a3a3c;
    /* Slate Grey */
    --tile-border: #2c2c30;
    --tile-border-active: #565758;
    --tile-border-filled: #818384;

    /* Keyboard */
    --key-bg: #818384;
    --key-bg-hover: #9c9ea0;
    --key-text: #ffffff;

    /* Accent Colors */
    --canadian-red: #FF0000;
    --canadian-red-hover: #cc0000;
    --danger-color: #d93838;

    /* Layout */
    --max-width: 500px;
    --header-height: 65px;
    --transition-speed: 0.2s;
}

/* Light Theme overrides */
body.light-theme {
    --bg-color: #f6f8fa;
    --bg-card: #eaeef2;
    --bg-modal: rgba(255, 255, 255, 0.98);
    --text-color: #0f0f11;
    --text-muted: #57606a;
    --border-modal: #d0d7de;
    --bg-pill: #eaeef2;

    --tile-border: #d0d7de;
    --tile-border-active: #57606a;
    --tile-border-filled: #8c959f;

    --key-bg: #d0d7de;
    --key-bg-hover: #afb8c1;
    --key-text: #0f0f11;
}

/* High Contrast mode overrides */
body.high-contrast {
    --color-correct: #F5793A;
    /* Orange */
    --color-present: #85C1E9;
    /* Light Blue */
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

html {
    height: -webkit-fill-available;
}

/* App Layout Container */
.app-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: var(--max-width);
    height: 100vh;
    padding: 0 10px;
    flex-shrink: 0;
}

/* Header Styles */
.game-header {
    height: var(--header-height);
    border-bottom: 1px solid var(--border-modal);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5px;
    flex-shrink: 0;
    flex-wrap: nowrap;
}

.logo-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--canadian-red);
    letter-spacing: 0.5px;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.15);
    white-space: nowrap;
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

/* Icon Buttons */
.icon-button {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color var(--transition-speed), transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.icon-button:hover {
    background-color: var(--bg-card);
    transform: scale(1.05);
}

.icon-button svg {
    width: 20px;
    height: 20px;
}

/* Mode Selector Dropdown */
.mode-select-dropdown {
    background-color: var(--bg-pill);
    color: var(--text-color);
    border: 1px solid var(--border-modal);
    padding: 6px 24px 6px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    font-family: inherit;
    transition: all var(--transition-speed);
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 10px;
    flex-shrink: 0;
}

body.light-theme .mode-select-dropdown {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230f0f11' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

/* Subheader Actions */
.subheader-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 5px;
    flex-shrink: 0;
    height: 45px;
}

.mode-badge {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 5px;
}

.mode-badge::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--canadian-red);
    box-shadow: 0 0 8px var(--canadian-red);
}

.new-game-btn {
    background-color: var(--bg-pill);
    border: 1px solid var(--border-modal);
    color: var(--text-color);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: all var(--transition-speed);
}

.new-game-btn:hover {
    background-color: var(--bg-card);
    transform: translateY(-1px);
}

/* Game Board Styles */
.board-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
    overflow: hidden;
    padding: 10px 0;
}

.board-grid {
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    gap: 5px;
    width: 100%;
    max-width: 350px;
    aspect-ratio: 5 / 6;
}

/* Rows & Tiles */
.board-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
}

.tile {
    width: 100%;
    aspect-ratio: 1 / 1;
    border: 2px solid var(--tile-border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    user-select: none;
    background-color: transparent;
    color: var(--text-color);
    transition: border-color 0.1s ease;
}

.tile.filled {
    border-color: var(--tile-border-filled);
}

/* Tile Reveal Colors */
.tile.correct {
    background-color: var(--color-correct) !important;
    border-color: var(--color-correct) !important;
    color: #ffffff;
}

.tile.present {
    background-color: var(--color-present) !important;
    border-color: var(--color-present) !important;
    color: #ffffff;
}

.tile.absent {
    background-color: var(--color-absent) !important;
    border-color: var(--color-absent) !important;
    color: #ffffff;
}

/* Keyboard Styles */
.keyboard-container {
    padding-bottom: 20px;
    flex-shrink: 0;
    width: 100%;
}

.keyboard {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 4px;
    width: 100%;
    padding: 0 4px;
    box-sizing: border-box;
}

.key {
    background-color: var(--key-bg);
    color: var(--key-text);
    border: none;
    border-radius: 5px;
    font-size: 0.95rem;
    font-weight: 700;
    height: 58px;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 0;
    max-width: 44px;
    transition: background-color var(--transition-speed), transform 0.05s;
}

.key:hover {
    background-color: var(--key-bg-hover);
}

.key:active {
    transform: scale(0.95);
}

.key.wide-key {
    flex: 1.5;
    max-width: 65px;
    font-size: 0.8rem;
    text-transform: uppercase;
}

/* Keyboard State Colors */
.key.correct {
    background-color: var(--color-correct) !important;
    color: #ffffff;
}

.key.present {
    background-color: var(--color-present) !important;
    color: #ffffff;
}

.key.absent {
    background-color: var(--color-absent) !important;
    opacity: 0.4;
}

/* ================= ANIMATIONS ================= */

/* Pop-in (Letter Typed) */
@keyframes pop-in {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    40% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.tile.pop {
    animation: pop-in 0.12s ease-in-out forwards;
    border-color: var(--tile-border-active);
}

/* 3D Flip (Reveal colors) */
@keyframes flip-tile-out {
    0% {
        transform: rotateX(0deg);
    }

    50% {
        transform: rotateX(90deg);
    }

    100% {
        transform: rotateX(0deg);
    }
}

.tile.flip {
    animation: flip-tile-out 0.5s ease-in-out forwards;
}

/* Shake (Word/letters error) */
@keyframes shake {

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

    15%,
    45%,
    75% {
        transform: translateX(-6px);
    }

    30%,
    60%,
    90% {
        transform: translateX(6px);
    }
}

.board-row.shake {
    animation: shake 0.5s ease-in-out;
}

/* Bounce (Win celebratory) */
@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-24px);
    }

    60% {
        transform: translateY(-12px);
    }
}

.tile.bounce {
    animation: bounce 0.6s ease-in-out forwards;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 10%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 3000;
    pointer-events: none;
}

.toast {
    background-color: #ffffff;
    color: #0f0f11;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    opacity: 0;
    animation: toast-fade 2s ease-in-out forwards;
}

@keyframes toast-fade {
    0% {
        opacity: 0;
        transform: translateY(-15px);
    }

    10% {
        opacity: 1;
        transform: translateY(0);
    }

    90% {
        opacity: 1;
        transform: translateY(0);
    }

    100% {
        opacity: 0;
        transform: translateY(-15px);
    }
}

/* ================= MODAL STYLING ================= */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
}

.modal-wrapper {
    position: relative;
    z-index: 2001;
    width: 90%;
    max-width: 440px;
    animation: modal-zoom 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modal-zoom {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

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

.modal-content {
    background-color: var(--bg-modal);
    border: 1px solid var(--border-modal);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 18px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    transition: color var(--transition-speed);
}

.modal-close:hover {
    color: var(--text-color);
}

.modal-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 20px;
    color: var(--text-color);
}

.modal-divider {
    border: 0;
    height: 1px;
    background-color: var(--border-modal);
    margin: 18px 0;
}

.modal-body {
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: #3a3a42 transparent;
}

.modal-body::-webkit-scrollbar {
    width: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background-color: #3a3a42;
    border-radius: 2px;
}

.text-left {
    text-align: left;
}

.rules-list {
    list-style-type: none;
    margin: 12px 0;
}

.rules-list li {
    margin-bottom: 8px;
    font-size: 0.9rem;
    line-height: 1.4;
    position: relative;
    padding-left: 15px;
}

.rules-list li::before {
    content: "🍁";
    position: absolute;
    left: 0;
    top: 2px;
    font-size: 0.75rem;
}

.subsection-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-color);
}

/* Help Example Grids */
.example-item {
    margin-bottom: 15px;
}

.example-row {
    display: flex;
    gap: 5px;
    margin-bottom: 6px;
}

.example-tile {
    width: 36px;
    height: 36px;
    border: 2px solid var(--border-modal);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    background-color: transparent;
    color: var(--text-color);
}

.example-tile.correct {
    background-color: var(--color-correct);
    border-color: var(--color-correct);
    color: #ffffff;
}

.example-tile.present {
    background-color: var(--color-present);
    border-color: var(--color-present);
    color: #ffffff;
}

.example-tile.absent {
    background-color: var(--color-absent);
    border-color: var(--color-absent);
    color: #ffffff;
}

.canadian-fact-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Modal Buttons */
.modal-footer {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

.btn-primary {
    background-color: var(--canadian-red);
    color: #ffffff;
    border: none;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.btn-primary:hover {
    background-color: var(--canadian-red-hover);
    transform: translateY(-1px);
}

.btn-danger {
    background-color: transparent;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-speed);
}

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

/* Stats Modal Styling */
.stats-mode-subtitle {
    text-align: center;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-top: -15px;
    margin-bottom: 20px;
}

.stats-grid {
    display: flex;
    justify-content: space-around;
    margin-bottom: 25px;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
}

.stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
    max-width: 70px;
    line-height: 1.2;
}

/* Guess Distribution Histogram */
.histogram {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 10px 0;
}

.histogram-row {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
}

.row-num {
    width: 15px;
    font-weight: 600;
}

.bar-container {
    flex-grow: 1;
    background-color: var(--bg-card);
    border-radius: 3px;
    margin-left: 8px;
    height: 20px;
}

.bar {
    background-color: var(--color-absent);
    color: #ffffff;
    font-weight: 700;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    font-size: 0.75rem;
    border-radius: 3px;
    min-width: 20px;
    box-sizing: border-box;
}

.bar.highlighted {
    background-color: var(--color-correct);
}

.stats-footer-buttons {
    justify-content: space-between;
}

/* Settings Modal Styling */
.settings-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-modal);
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
    text-align: left;
    flex: 1;
    padding-right: 12px;
}

.setting-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.setting-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.badge-accent {
    background-color: rgba(255, 0, 0, 0.15);
    color: var(--canadian-red);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid rgba(255, 0, 0, 0.2);
    white-space: nowrap;
}

/* Switch Toggle Styling */
.switch-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.switch-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #3a3a42;
    transition: .3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
}

input:checked+.slider {
    background-color: var(--canadian-red);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Game Over Modal Customizations */
.gameover-heading {
    font-size: 2.2rem;
    color: var(--canadian-red);
    text-shadow: 0 0 15px rgba(255, 0, 0, 0.1);
    margin-top: 10px;
}

.result-word-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 20px;
}

.result-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.revealed-word {
    font-family: 'Outfit', sans-serif;
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: 4px;
    color: var(--text-color);
    background-color: var(--bg-card);
    padding: 6px 20px;
    border-radius: 8px;
    border: 2px solid var(--border-modal);
}

.canadian-fact-card {
    background: linear-gradient(135deg, rgba(255, 0, 0, 0.08) 0%, rgba(230, 161, 0, 0.03) 100%);
    border: 1px solid rgba(255, 0, 0, 0.15);
    border-radius: 12px;
    padding: 16px 20px;
    text-align: left;
    margin-bottom: 20px;
}

.fact-card-title {
    color: var(--canadian-red);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.fact-text {
    font-size: 0.9rem;
    line-height: 1.45;
    color: var(--text-color);
}

.countdown-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin: 10px 0;
}

.countdown-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 1px;
}

.countdown-time {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
}

.gameover-actions {
    justify-content: center;
    gap: 12px;
}

.btn-share {
    background-color: var(--bg-pill);
    border: 1px solid var(--border-modal);
    color: var(--text-color);
    font-weight: 700;
    font-size: 0.9rem;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-speed);
    display: flex;
    align-items: center;
}

.btn-share:hover {
    background-color: var(--bg-card);
    border-color: var(--border-modal);
    transform: translateY(-1px);
}

.hidden {
    display: none !important;
}

/* ================= RESPONSIVE STYLING ================= */

@media (max-height: 700px) {
    .logo-title {
        font-size: 1.3rem;
    }

    .game-header {
        height: 50px;
    }

    .tile {
        font-size: 1.6rem;
    }

    .key {
        height: 48px;
        font-size: 0.85rem;
    }
}

@media (max-width: 500px) {
    .game-header {
        display: grid !important;
        grid-template-columns: auto 1fr;
        grid-template-areas:
            "logo logo"
            "left right";
        height: auto !important;
        padding: 8px 5px 6px 5px;
        gap: 8px 0;
        align-items: center;
    }

    .header-center {
        grid-area: logo;
        justify-self: center;
    }

    .header-left {
        grid-area: left;
        justify-self: start;
    }

    .header-right {
        grid-area: right;
        justify-self: end;
    }

    .logo-title {
        font-size: 1.15rem;
        letter-spacing: 0.2px;
    }

    .mode-select-dropdown {
        padding: 5px 20px 5px 6px;
        font-size: 0.7rem;
        background-position: right 6px center;
        background-size: 8px;
    }

    .tile {
        font-size: 1.5rem;
    }

    .key {
        height: 44px;
        font-size: 0.8rem;
        max-width: 34px;
    }

    .key.wide-key {
        max-width: 52px;
        font-size: 0.7rem;
    }

    .header-left,
    .header-right {
        gap: 4px;
    }

    .icon-button {
        padding: 6px;
    }
}

@media (max-width: 350px) {
    .logo-title {
        font-size: 1rem;
    }

    .mode-select-dropdown {
        padding: 4px 16px 4px 4px;
        font-size: 0.65rem;
        background-position: right 4px center;
        background-size: 6px;
    }

    .key {
        height: 38px;
        font-size: 0.75rem;
        max-width: 28px !important;
    }

    .key.wide-key {
        max-width: 42px !important;
        font-size: 0.65rem;
    }
}

/* ================= DRAWER MENU STYLING ================= */
.drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2100;
    visibility: hidden;
    pointer-events: none;
    transition: visibility 0.3s step-end;
    display: flex;
    justify-content: flex-start;
}

.drawer.active {
    visibility: visible;
    pointer-events: auto;
    transition: visibility 0s;
}

.drawer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.drawer.active .drawer-overlay {
    opacity: 1;
}

.drawer-content {
    position: relative;
    z-index: 2101;
    width: 85%;
    max-width: 320px;
    height: 100%;
    background-color: var(--bg-modal);
    border-right: 1px solid var(--border-modal);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer.active .drawer-content {
    transform: translateX(0);
}

/* Hamburger Icon Animations */
#btn-menu svg line {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    transform-origin: center;
}

#btn-menu.open .line-top {
    transform: translateY(6px) rotate(45deg);
}

#btn-menu.open .line-middle {
    opacity: 0;
}

#btn-menu.open .line-bottom {
    transform: translateY(-6px) rotate(-45deg);
}

.drawer-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-modal);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.drawer-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--canadian-red);
    letter-spacing: 0.5px;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.15);
}

.drawer-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    transition: color var(--transition-speed);
    display: flex;
    align-items: center;
    justify-content: center;
}

.drawer-close:hover {
    color: var(--text-color);
}

.drawer-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.drawer-nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 12px;
}

.drawer-nav-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: all var(--transition-speed);
    border: 1px solid transparent;
}

.drawer-nav-item:hover {
    background-color: var(--bg-card);
    transform: translateX(4px);
}

.drawer-nav-item.active-mode {
    background: linear-gradient(135deg, rgba(255, 0, 0, 0.12) 0%, rgba(230, 161, 0, 0.05) 100%);
    border: 1px solid rgba(255, 0, 0, 0.2);
}

body.light-theme .drawer-nav-item.active-mode {
    background: linear-gradient(135deg, rgba(255, 0, 0, 0.08) 0%, rgba(230, 161, 0, 0.03) 100%);
    border: 1px solid rgba(255, 0, 0, 0.15);
}

body.high-contrast .drawer-nav-item.active-mode {
    background: linear-gradient(135deg, rgba(245, 121, 58, 0.12) 0%, rgba(133, 193, 233, 0.05) 100%);
    border: 1px solid rgba(245, 121, 58, 0.2);
}

body.high-contrast .drawer-nav-item.active-mode .nav-label {
    color: var(--color-correct);
}

.drawer-nav-item.active-mode .nav-label {
    color: var(--canadian-red);
    font-weight: 700;
}

.nav-icon {
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
}

.nav-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-color);
}

.nav-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.drawer-nav-divider {
    height: 1px;
    background-color: var(--border-modal);
    margin: 12px 16px;
}

.drawer-footer {
    padding: 0 28px;
    text-align: center;
    margin-top: 20px;
}

.drawer-footer-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ================= CONTENT SECTIONS STYLING ================= */
.content-container {
    width: 100%;
    max-width: var(--max-width);
    margin-top: 40px;
    padding: 0 16px 60px 16px;
    display: flex;
    flex-direction: column;
    gap: 36px;
    box-sizing: border-box;
    flex-shrink: 0;
}

.info-section {
    background-color: var(--bg-card);
    border: 1px solid var(--border-modal);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    transition: border-color var(--transition-speed), transform var(--transition-speed);
    box-sizing: border-box;
}

body.light-theme .info-section {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.info-section:hover {
    border-color: rgba(255, 0, 0, 0.3);
}

body.high-contrast .info-section:hover {
    border-color: rgba(245, 121, 58, 0.3);
}

.section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::after {
    content: "";
    flex-grow: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border-modal) 0%, transparent 100%);
    margin-left: 12px;
}

.section-subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    line-height: 1.5;
}

/* How to Play Section Details */
.rules-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.rule-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.88rem;
    line-height: 1.45;
}

.rule-icon {
    font-size: 1.1rem;
    line-height: 1;
    flex-shrink: 0;
}

.examples-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    border-top: 1px solid var(--border-modal);
    padding-top: 20px;
}

.example-explain {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.4;
}

/* About Section Grid */
.about-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 480px) {
    .about-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.about-card {
    background-color: var(--bg-pill);
    border: 1px solid var(--border-modal);
    border-radius: 12px;
    padding: 18px;
    transition: transform var(--transition-speed);
    box-sizing: border-box;
}

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

.about-card-icon {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.about-card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.about-card-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.45;
}

/* FAQ Details/Summary Accordion */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.faq-item {
    background-color: var(--bg-pill);
    border: 1px solid var(--border-modal);
    border-radius: 12px;
    overflow: hidden;
    transition: all var(--transition-speed);
}

.faq-item[open] {
    border-color: var(--canadian-red);
    box-shadow: 0 4px 15px rgba(255, 0, 0, 0.05);
}

body.high-contrast .faq-item[open] {
    border-color: var(--color-correct);
    box-shadow: 0 4px 15px rgba(245, 121, 58, 0.05);
}

.faq-item summary {
    padding: 16px 20px;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    outline: none;
    gap: 12px;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--text-color);
    border-bottom: 2px solid var(--text-color);
    transform: rotate(45deg);
    transition: transform var(--transition-speed);
    margin-right: 4px;
    flex-shrink: 0;
}

.faq-item[open] summary::after {
    transform: rotate(-135deg);
}

.faq-content {
    padding: 0 20px 20px 20px;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-muted);
    border-top: 1px solid transparent;
    animation: faqSlideDown 0.25s ease-out;
}

.faq-item[open] .faq-content {
    border-top-color: var(--border-modal);
}

@keyframes faqSlideDown {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

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

/* Footer Styling */
.info-footer {
    border-top: 1px solid var(--border-modal);
    margin-top: 12px;
    padding-top: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    text-align: center;
}

.footer-logo {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--canadian-red);
    letter-spacing: 0.5px;
}

body.high-contrast .footer-logo {
    color: var(--color-correct);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 18px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 500;
    transition: color var(--transition-speed);
}

.footer-links a:hover {
    color: var(--text-color);
}

.footer-credit {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.4;
}