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

body {
    font-family: system-ui, Arial, sans-serif;
    background: linear-gradient(45deg, #9c640c 0%, #d68910 55%, #f5b041 120%);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    color: white;
    overflow-x: hidden;
    padding: 1rem;
}

.game-container {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-width: 500px;
    width: 100%;
    text-align: center;
    position: relative;
}

.header {
    position: relative;
    z-index: 20;
}

@font-face {
    font-family: 'Righteous';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/assets/fonts/righteous.woff2') format('woff2');
}

@font-face {
    font-family: 'Silkscreen';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/assets/fonts/silkscreen-700.woff2') format('woff2');
}

.nav-mini {
    display: flex;
    width: max-content;
    align-items: center;
    gap: 5px;
    background: linear-gradient(90deg, #ffb700, #ffd700);
    border: none;
    border-radius: 999px;
    padding: 7px 13px 7px 9px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #241a3d;
    text-decoration: none;
    margin-bottom: 0.6rem;
    box-shadow: 0 3px 9px rgba(0, 0, 0, 0.3);
    touch-action: manipulation;
}

.nav-mini svg path {
    stroke: #241a3d;
}

.nav-mini:hover {
    background: linear-gradient(90deg, #ffc61a, #ffe14d);
}

.lockup {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 11px;
    margin-bottom: 0.9rem;
}

.badge {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    flex: none;
}

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

.game-name {
    font-family: 'Righteous', 'Arial Rounded MT Bold', Arial, sans-serif;
    font-size: 23px;
    font-weight: 400;
    letter-spacing: 1.5px;
    line-height: 1;
    margin: 0;
    text-shadow: 1px 2px 5px rgba(0, 0, 0, 0.45);
}

.game-tag {
    font-family: 'Silkscreen', 'Courier New', monospace;
    font-weight: 700;
    font-size: 8px;
    letter-spacing: 2px;
    margin-top: 3px;
    color: #ffe36e;
}

.button-container {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
    flex-wrap: wrap;
}

.new-game-button,
.share-button,
.control-button {
    border: none;
    border-radius: 999px;
    color: #ffffff;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    white-space: nowrap;
    cursor: pointer;
    touch-action: manipulation;
}

.share-button { background: linear-gradient(45deg, #27ae60, #2ecc71); }
.control-button { background: linear-gradient(45deg, #8e44ad, #b06ee0); }
.new-game-button { background: linear-gradient(45deg, #d94a3a, #ff7a6e); }

.new-game-button:active,
.share-button:active,
.control-button:active {
    transform: scale(0.95);
}

.game-mode-selector {
    display: flex;
    background: rgba(10, 10, 25, 0.32);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    padding: 4px;
    gap: 4px;
    margin-bottom: 0.8rem;
}

.mode-button {
    flex: 1;
    background: transparent;
    border: none;
    border-radius: 999px;
    padding: 8px 4px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    touch-action: manipulation;
    transition: background 0.2s ease, color 0.2s ease;
}

.mode-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mode-button.active {
    background: linear-gradient(90deg, #ffb700, #ffd700);
    color: #241a3d;
}

.mode-button.active:hover {
    background: linear-gradient(90deg, #ffb700, #ffd700);
}

/* The daily theme (hidden thread) banner */
.theme-banner {
    background: rgba(10, 10, 25, 0.4);
    border: 2px solid rgba(255, 215, 0, 0.5);
    border-radius: 14px;
    padding: 0.55rem 0.8rem;
    margin-bottom: 0.8rem;
}

.theme-label {
    display: block;
    font-family: 'Silkscreen', 'Courier New', monospace;
    font-weight: 700;
    font-size: 8px;
    letter-spacing: 2px;
    color: #ffe36e;
    margin-bottom: 2px;
}

.theme-clue {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.35);
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.45rem 0.6rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 0.8rem;
}

.pause-mini,
.hint-mini {
    background: rgba(10, 10, 25, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 999px;
    color: #ffffff;
    padding: 6px 12px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
    cursor: pointer;
    touch-action: manipulation;
}

.pause-mini:active,
.hint-mini:active {
    transform: scale(0.95);
}

.hint-mini:disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* A hint-revealed word: you know WHAT to hunt, not where */
.word-chip.peeked {
    border: 1px dashed rgba(255, 215, 0, 0.85);
    color: #ffe36e;
}

.found-count {
    font-size: 0.9rem;
    font-weight: 700;
    color: #ffeb3b;
    font-variant-numeric: tabular-nums;
}

.timer {
    font-size: 0.85rem;
    font-weight: 700;
    color: #e0e0e0;
    font-variant-numeric: tabular-nums;
}

.message {
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0.6rem;
    margin-bottom: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.85rem;
    font-weight: 600;
}

.message.success {
    background: rgba(76, 175, 80, 0.3);
    border-color: rgba(76, 175, 80, 0.5);
}

.message.error {
    background: rgba(244, 67, 54, 0.3);
    border-color: rgba(244, 67, 54, 0.5);
}

.message.info {
    background: rgba(255, 193, 7, 0.3);
    border-color: rgba(255, 193, 7, 0.5);
}

/* The letter grid */
.grid-wrap {
    position: relative;
    background: rgba(10, 10, 25, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 14px;
    padding: 8px;
    margin-bottom: 0.8rem;
}

/* Anti-cheat pause cover: fully hides the letters while the clock is stopped */
.pause-overlay {
    position: absolute;
    inset: 0;
    background: rgba(13, 10, 28, 0.97);
    border-radius: 14px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out;
    cursor: pointer;
}

.pause-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.po-title {
    font-family: 'Righteous', 'Arial Rounded MT Bold', Arial, sans-serif;
    font-size: 26px;
    letter-spacing: 2px;
    text-shadow: 1px 2px 6px rgba(0, 0, 0, 0.6);
}

.po-sub {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.5;
}

.word-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 19px;
    font-weight: 700;
    color: #ffffff;
    transition: background 0.12s ease, transform 0.12s ease;
}

.cell.sel {
    background: rgba(255, 215, 0, 0.55);
    border-color: rgba(255, 215, 0, 0.9);
    color: #241a3d;
    transform: scale(1.08);
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.8);
}

.cell.found {
    color: #ffffff;
    border-color: transparent;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.35);
}

/* Juice: cascade intro + found pop */
.cell.drop-in {
    animation: cellDropIn 0.38s cubic-bezier(0.2, 0.9, 0.3, 1.2) backwards;
}

@keyframes cellDropIn {
    from { opacity: 0; transform: translateY(-10px) scale(0.7); }
    to { opacity: 1; transform: none; }
}

.cell.pop {
    animation: cellPop 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}

@keyframes cellPop {
    0% { transform: scale(1); }
    45% { transform: scale(1.28) rotate(-3deg); }
    100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .cell.drop-in,
    .cell.pop {
        animation: none;
    }

    .pause-overlay {
        transition: none;
    }
}

/* Word list chips */
.word-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
    margin-bottom: 0.8rem;
}

.word-chip {
    background: rgba(10, 10, 25, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    font-family: 'Courier New', monospace;
}

.word-chip.hit {
    text-decoration: line-through;
    color: #ffffff;
    border-color: transparent;
}

/* Bottom stats */
.stats {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 70px;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffd700;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 0.65rem;
    color: #e0e0e0;
    margin-top: 0.25rem;
}

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

.modal-content {
    background: #2c2c2e;
    color: #fff;
    padding: 25px;
    border-radius: 12px;
    width: 90%;
    max-width: 480px;
    position: relative;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4);
}

.modal-close-button {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin: 20px 0;
}

/* Mobile */
@media (max-width: 600px) {
    body {
        padding: 0;
    }

    .game-container {
        border-radius: 0;
        max-width: none;
        min-height: 100vh;
        min-height: 100dvh;
        padding: 0.8rem;
    }

    .cell {
        font-size: 17px;
        border-radius: 7px;
    }
}

@media (max-width: 360px) {
    .cell {
        font-size: 15px;
    }

    .word-chip {
        font-size: 11px;
        padding: 5px 10px;
    }

    .stats-grid {
        gap: 10px;
    }
}
