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

body {
    font-family: Arial, Helvetica, sans-serif;
    background: #f4f4f5;
    color: #18181b;
    min-height: 100vh;
}

.container {
    width: min(1000px, 94%);
    margin: 0 auto;
    padding: 40px 0 60px;
}

.header {
    text-align: center;
    margin-bottom: 35px;
}

.header h1 {
    font-size: 48px;
    font-weight: 800;
    letter-spacing: -2px;
}

.header p {
    margin-top: 8px;
    color: #71717a;
    font-size: 17px;
}

.game-info {
    text-align: center;
    margin-bottom: 25px;
}

.game-info h2 {
    font-size: 24px;
}

.game-info p {
    color: #71717a;
    margin-top: 5px;
}

/* GAME GRID */

.grid {
    display: grid;
    grid-template-columns: 100px repeat(3, minmax(0, 1fr));
    grid-template-rows: 55px repeat(3, auto);

    gap: 5px;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
}

.corner {
    background: transparent;
}

.category {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;

    background: #18181b;
    color: white;

    border-radius: 8px;

    padding: 8px;
    font-weight: 700;
    font-size: 14px;
}

.cell {
    width: 100%;
    aspect-ratio: 3 / 4;
    min-width: 0;
    min-height: 0;

    border: 2px solid #d4d4d8;
    background: white;
    border-radius: 8px;

    padding: 0;
    overflow: hidden;

    font-size: 38px;
    font-weight: 700;
    cursor: pointer;

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

.cell:not(:disabled):hover {
    background: #fafafa;
    border-color: #a1a1aa;
    transform: scale(1.02);
}

.cell:not(:disabled):active {
    transform: scale(0.98);
}

.cell:disabled {
    cursor: default;
}

.cell.selected {
    border-color: #18181b;
    background: #f4f4f5;
    transform: scale(1.03);
}

.cell img {
    box-sizing: border-box;
    border: 2px solid #444853;
    border-radius: inherit;
}

/* GUESS AREA */

.guess-area {
    max-width: 600px;
    margin: 40px auto 0;
    text-align: center;
}

.guess-area h2 {
    margin-bottom: 15px;
}

#game-search {
    width: 70%;
    padding: 14px 16px;

    border: 2px solid #d4d4d8;
    border-radius: 8px;

    font-size: 16px;
    outline: none;
}

#game-search:focus {
    border-color: #18181b;
}

#submit-guess {
    padding: 14px 18px;
    margin-left: 6px;
    border: none;
    border-radius: 8px;
    background: #18181b;
    color: white;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

#submit-guess:hover {
    background: #27272a;
}

/* SEARCH RESULTS */

#search-results {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.game-result {
    width: 100%;
    min-height: 78px;
    display: flex;
    align-items: center;
    gap: 12px;

    padding: 10px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;

    cursor: pointer;
    text-align: left;
    font-size: 16px;

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

.game-result:hover {
    background: #f0f0f0;
}

.game-result:focus-visible {
    outline: 3px solid #52525b;
    outline-offset: 2px;
}

.game-result:disabled {
    cursor: wait;
    opacity: 0.65;
}

.game-result-cover,
.game-result-cover-placeholder {
    width: 48px;
    height: 64px;
    flex: 0 0 48px;
    border-radius: 4px;
}

.game-result-cover {
    display: block;
    object-fit: cover;
    background: #e4e4e7;
}

.game-result-cover-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;

    background: #e4e4e7;
    color: #71717a;

    text-align: center;
    font-size: 10px;
}

.game-result-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.game-result-title {
    font-size: 16px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

/* MOBILE */

@media (max-width: 700px) {
    .container {
        padding-top: 25px;
    }

    .header h1 {
        font-size: 38px;
    }

    .grid {
        grid-template-columns: 75px repeat(3, minmax(0, 1fr));
        grid-template-rows: 50px repeat(3, auto);
        gap: 4px;

        max-width: 420px;
    }

    .category {
        font-size: 13px;
        padding: 5px;
    }

    .cell {
        font-size: 28px;
    }

    #game-search {
        width: 100%;
        margin-bottom: 10px;
    }

    #submit-guess {
        width: 100%;
        margin-left: 0;
    }
}

/* GAME SEARCH MODAL */

.modal-overlay[hidden] {
    display: none;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;

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

    padding: 20px;
    background: rgba(0, 0, 0, 0.65);
}

.modal-content {
    width: 100%;
    max-width: 560px;
    max-height: 85vh;

    display: flex;
    flex-direction: column;

    padding: 24px;
    background: #ffffff;
    border-radius: 14px;

    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}


.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;

    margin-bottom: 20px;
}

.modal-heading h2 {
    font-size: 24px;
    margin-bottom: 6px;
}

.modal-heading p {
    font-size: 14px;
    color: #71717a;
}

.modal-close {
    width: 36px;
    height: 36px;
    flex-shrink: 0;

    border: none;
    border-radius: 8px;

    background: #f4f4f5;
    color: #18181b;

    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.modal-close:hover {
    background: #e4e4e7;
}


.modal-content .guess-area {
    width: 100%;
    max-width: none;
    min-height: 0;

    margin: 0;
    text-align: left;

    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.search-controls {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.modal-content #game-search {
    flex: 1;
    width: 100%;
    min-width: 0;
    margin: 0;
}

.modal-content #submit-guess {
    flex-shrink: 0;
    width: auto;
    margin: 0;
}


#search-message {
    margin-top: 12px;
    font-size: 14px;
    color: #52525b;
}

#search-message:empty {
    display: none;
}


.modal-content #search-results {
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
    margin-top: 12px;
}


#game-message {
    max-width: 850px;
    margin: 18px auto 0;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
}

#game-message:empty {
    display: none;
}

/* Prevent page scrolling while modal is open */

html.search-open,
body.modal-open {
    overflow: hidden;
}


@media (max-width: 600px) {
    .modal-overlay {
        padding: 12px;
    }

    .modal-content {
        padding: 18px;
        max-height: 90vh;
    }

    .modal-heading h2 {
        font-size: 21px;
    }

    .modal-content #game-search {
        font-size: 16px;
    }

    .modal-content #submit-guess {
        padding: 12px;
        font-size: 14px;
    }
}

/* INCORRECT GUESS FEEDBACK */

.cell.incorrect,
.cell.incorrect:hover {
    border: 3px solid #dc2626;
    background: #fee2e2;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
    transform: none;
}

/* RARITY PERCENTAGE BADGE */

.cell.solved {
    position: relative;
}

.rarity-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    z-index: 2;

    padding: 4px 6px;
    border-radius: 5px;

    background: rgba(48, 51, 61, 0.75);
    border: 1px solid #787d8b;
    color: #f4f4f5;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);

    font-size: 12px;
    font-weight: 800;
    font-family: inherit;
    line-height: 1.2;
    white-space: nowrap;

    pointer-events: none;
}

@media (max-width: 480px) {
    .rarity-badge {
        top: 3px;
        right: 3px;
        padding: 3px 4px;
        font-size: 10px;
    }
}


/* SOLVED GAME COVER */

.cell.solved,
.cell.solved:hover {
    border: none;
    padding: 0;
    background: transparent;
    cursor: default;
    overflow: hidden;
    transform: none;
}

.cell.solved img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cell.solved:disabled {
    opacity: 1;
}

/* STATUS FEEDBACK */

#game-message[data-type="success"] {
    color: #15803d;
}

#game-message[data-type="error"],
#search-message[data-type="error"] {
    color: #dc2626;
}


.modal-content .search-controls {
    display: block;
}

.modal-content #game-search {
    width: 100%;
}

.solved-fallback {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;

    padding: 8px;
    background: #e4e4e7;
    color: #18181b;

    font-size: 13px;
    font-weight: 700;
    text-align: center;
    overflow-wrap: anywhere;
}

/* GAMERDOKU DARK THEME */

:root {
    color-scheme: dark;
}

body {
    background: #12141a;
    color: #f4f4f5;
}


.header p,
.game-info p {
    color: #a1a1aa;
}


.category {
    background: #30333d;
    color: #f4f4f5;

    border: 1px solid #444853;
    border-radius: 8px;

    font-size: 14px;
    line-height: 1.3;
    overflow-wrap: anywhere;
}


.cell {
    background: #1f222b;
    color: #f4f4f5;
    border-color: #444853;
}

.cell:not(:disabled):hover {
    background: #2b2e39;
    border-color: #71717a;
}

.cell.selected {
    background: #30333d;
    border-color: #a5b4fc;
}


.modal-overlay {
    background: rgba(0, 0, 0, 0.78);
}

.modal-content {
    background: #20232c;
    color: #f4f4f5;
    border: 1px solid #3f4350;
}

.modal-heading p {
    color: #a1a1aa;
}

.modal-close {
    background: #30333d;
    color: #f4f4f5;
}

.modal-close:hover {
    background: #444853;
}


#game-search {
    background: #14161d;
    color: #f4f4f5;
    border-color: #444853;
}

#game-search::placeholder {
    color: #9295a1;
}

#game-search:focus {
    border-color: #a5b4fc;
}


.game-result {
    background: #2b2e39;
    color: #f4f4f5;
    border-color: #444853;
}

.game-result-cover-placeholder {
    background: #393d49;
    color: #a1a1aa;
}

#search-message {
    color: #a1a1aa;
}

/* Correctly solved cells remain cover-only */

.cell.solved,
.cell.solved:hover {
    background: transparent;
    border: none;
}


.cell.incorrect,
.cell.incorrect:hover {
    background: #451f28;
    border: 3px solid #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}


#game-message[data-type="success"] {
    color: #4ade80;
}

#game-message[data-type="error"],
#search-message[data-type="error"] {
    color: #f87171;
}


.solved-fallback {
    background: #30333d;
    color: #f4f4f5;
}

/* CATEGORY HEADER POLISH */

.category {
    display: flex;
    align-items: center;
    justify-content: center;

    padding: 8px 6px;

    background: #30333d;
    color: #f4f4f5;

    border: 1px solid #444853;
    border-radius: 8px;

    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: 0.1px;

    text-align: center;
    overflow-wrap: break-word;
    hyphens: manual;
}

/* Long category names stay inside their headers */

.category {
    min-width: 0;
    min-height: 0;
}


@media (max-width: 700px) {
    .category {
        font-size: 11px;
        padding: 5px 3px;
        line-height: 1.25;
    }
}

/* PAGE HEADER POLISH */


.container {
    padding-top: 28px;
    padding-bottom: 40px;
}


.header {
    text-align: center;
    margin-bottom: 24px;
}

.header h1 {
    font-size: 46px;
    font-weight: 800;
    letter-spacing: -1.5px;
    line-height: 1.1;
    color: #f4f4f5;
}

.header p {
    margin-top: 8px;
    font-size: 14px;
    line-height: 1.5;
    color: #a1a1aa;
}


.game-info {
    text-align: center;
    margin-bottom: 20px;
}

.game-info h2 {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: 0.2px;
    color: #e4e4e7;
}

.game-info p {
    margin-top: 5px;
    font-size: 13px;
    color: #9295a1;
}


@media (max-width: 700px) {
    .container {
        padding-top: 20px;
    }

    .header {
        margin-bottom: 20px;
    }

    .header h1 {
        font-size: 36px;
        letter-spacing: -1px;
    }

    .header p {
        font-size: 13px;
    }

    .game-info {
        margin-bottom: 16px;
    }

    .game-info h2 {
        font-size: 17px;
    }
}

/* GRID AND GUESSES LAYOUT */

.grid-layout {
    position: relative;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
}


.grid-layout .grid {
    width: 100%;
    max-width: 520px;
    margin: 0;
}


.score-panels {
    position: absolute;
    top: 50%;
    left: calc(100% + 20px);
    transform: translateY(-50%);

    display: flex;
    flex-direction: column;
    gap: 12px;

    width: 150px;
}


#guesses-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;

    width: 100%;
    padding: 20px 14px;

    background: #20232c;
    border: 1px solid #444853;
    border-radius: 12px;

    text-align: center;
}

.guesses-label {
    color: #a1a1aa;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    line-height: 1.4;
}

.guesses-count {
    color: #f4f4f5;
    font-size: 38px;
    font-weight: 800;
    line-height: 1;
}

.guesses-total {
    color: #9295a1;
    font-size: 13px;
}


#total-score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;

    width: 100%;
    padding: 20px 14px;

    background: #20232c;
    border: 1px solid #444853;
    border-radius: 12px;

    text-align: center;
}

.total-score-count {
    color: #f4f4f5;
    font-size: 38px;
    font-weight: 800;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}


@media (max-width: 900px) {
    .score-panels {
        position: static;
        transform: none;

        flex-direction: row;
        align-items: stretch;
        justify-content: center;
        gap: 12px;

        width: 100%;
        max-width: 420px;
        margin: 18px auto 0;
    }

    #guesses-display,
    #total-score-display {
        flex: 1;
        min-width: 0;
        width: auto;
        margin: 0;
        padding: 12px;
        gap: 4px;
    }
    
    .guesses-count,
    .total-score-count {
        font-size: 38px;
        line-height: 1;
    }

}

/* SEARCH RESULT GAME TYPES */

.game-result-details {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.game-result-type {
    display: block;
    color: #a1a1aa;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.3;
}

/* CATEGORY PREFIX AND TITLE */

.category-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 100%;
    text-align: center;
}

.category-prefix,
.category-title {
    max-width: 100%;
}

.category-prefix {
    color: #a1a1aa;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
}

.category-prefix-company {
    max-width: none;
    white-space: nowrap;
}

.category-title {
    color: #f4f4f5;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    overflow-wrap: break-word;
}

@media (max-width: 700px) {
    .category-prefix {
        font-size: 10px;
    }

    .category-title {
        font-size: 11px;
    }
}

/* PLATFORMS FOR DUPLICATE TITLES */

.game-result-platforms {
    display: block;
    color: #a1a1aa;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.guess-confirmation[hidden] {
    display: none;
}

.confirmation-actions button {
    flex: 1;
    min-height: 44px;
    padding: 10px;
    cursor: pointer;
}

@media (max-width: 480px) {
    .confirmation-actions {
        gap: 6px;
    }

    .confirmation-actions button {
        font-size: 14px;
    }
}

.game-result {
    display: flex;
    align-items: center;
    gap: 12px;
}

.game-result-details {
    flex: 1;
    min-width: 0;
}

.game-select-button {
    flex-shrink: 0;
    margin-left: auto;
    width: 70px;
    min-height: 44px;
    padding: 10px 8px;
    text-align: center;

    background: #3b3f4b;
    color: white;

    border: 1px solid #777;
    border-radius: 6px;

    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.game-select-button:hover {
    background: #505563;
}

.game-select-button.awaiting-confirmation {
    background: #2563eb;
    border-color: #3b82f6;
}

@media (max-width: 480px) {
    .game-result {
        gap: 8px;
    }

    .game-select-button {
        padding: 8px;
        font-size: 12px;
    }
}

.game-result {
    cursor: default;
}

.game-result:hover {
    background: #2b2e39;
    border-color: #444853;
}

.game-result:hover .game-result-title,
.game-result-title:hover {
    color: inherit;
    text-decoration: none;
    cursor: default;
}

.game-select-button {
    background: #3b3f4b;
    border: 1px solid #777;
    color: white;
    cursor: pointer;
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease;
}

.game-select-button:hover:not(:disabled) {
    background: #505563;
}

.game-select-button.awaiting-confirmation {
    background: #2563eb;
    border-color: #3b82f6;
    color: white;
}

.game-select-button.awaiting-confirmation:hover:not(:disabled) {
    background: #3b82f6;
    border-color: #60a5fa;
}

.game-select-button:disabled {
    opacity: 0.75;
    cursor: wait;
}

/* SEARCH MODAL CATEGORY NOTES */

#modal-category-notes[hidden] {
    display: none;
}

#modal-category-notes {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#modal-category-notes p {
    color: #828aab;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.45;
    padding-left: 12px;
    position: relative;
}

#modal-category-notes p::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #828aab;
}

/* GAMERDOKU RESULTS WINDOW */

.results-controls {
    display: flex;
    justify-content: center;
    margin: 20px auto;
}

.results-controls [hidden],
.results-actions [hidden] {
    display: none;
}

.results-modal-content {
    max-width: 440px;
    overflow-y: auto;
}

.results-modal-content .results-actions {
    position: sticky;
    bottom: -24px;
    z-index: 10;

    flex-shrink: 0;
    padding: 14px 0 24px;
    margin-top: auto;

    background: #20232c;
}

.results-summary {
    text-align: center;
    margin-bottom: 24px;
}

.results-score {
    font-size: 27px;
    font-weight: 800;
    color: #f4f4f5;
    line-height: 1.2;
}

.results-summary p {
    margin-top: 5px;
    color: #a1a1aa;
    font-size: 14px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    width: 100%;
    max-width: 280px;
    margin: 0 auto 24px;
}

.results-grid-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #30333d;
    color: #f4f4f5;
    font-size: 20px;
    font-weight: 700;
}

.results-grid-cell.correct {
    background: #166534;
    color: #ffffff;
}

.results-grid-cell.missed {
    background: #3f4350;
    color: #a1a1aa;
}

.results-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.results-button {
    min-height: 44px;
    padding: 12px 20px;
    border: 1px solid #6366f1;
    border-radius: 8px;
    background: #4f46e5;
    color: white;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.results-button:hover {
    background: #6366f1;
}

.results-button-secondary {
    background: #30333d;
    border-color: #444853;
}

.results-button-secondary:hover {
    background: #444853;
}


.results-statistics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;

    width: 100%;
    margin: -8px auto 24px;
}

.results-stat {
    display: flex;
    align-items: center;
    justify-content: center;

    min-width: 0;
    text-align: center;
}

.results-stat span {
    color: #f4f4f5;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
}

/* GIVE UP CONFIRMATION */

.results-controls {
    gap: 12px;
    flex-wrap: wrap;
}

.give-up-button {
    background: #3f3035;
    border-color: #80505a;
    color: #fca5a5;
}

.give-up-button:hover {
    background: #58363e;
}

.give-up-modal-content {
    max-width: 420px;
}

.give-up-summary {
    padding: 14px;
    margin-bottom: 20px;

    background: #30333d;
    border: 1px solid #444853;
    border-radius: 8px;

    color: #d4d4d8;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
}

.give-up-actions {
    display: flex;
    gap: 12px;
}

.give-up-actions .results-button {
    flex: 1;
}

.give-up-confirm-button {
    background: #b91c1c;
    border-color: #dc2626;
    color: #ffffff;
}

.give-up-confirm-button:hover {
    background: #dc2626;
}

.give-up-confirm-button:disabled {
    opacity: 0.5;
    cursor: wait;
}

@media (max-width: 480px) {
    .give-up-actions {
        gap: 8px;
    }

    .give-up-actions .results-button {
        padding: 12px 8px;
    }
}

/* MOST AND LEAST COMMON ANSWERS */

.common-answers-section {
    width: 100%;
    margin-bottom: 24px;
}

.common-answers-heading {
    margin: 24px 0 14px;
    color: #f4f4f5;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
}

.common-answers-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;

    width: 100%;
    max-width: 360px;
    margin: 0 auto;
}

.common-answer-cell {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;

    overflow: hidden;
    border-radius: 8px;
    background: #30333d;
    border: 2px solid #444853;
}

.common-answer-cell img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.common-answer-cell .rarity-badge {
    position: absolute;
    top: 5px;
    right: 5px;
}

.common-answer-cell.empty {
    background: #3f4350;
    border-color: #444853;
}

/* NEXT DAILY PUZZLE COUNTDOWN */

.next-puzzle-countdown {
    text-align: center;
    margin: 0 auto;
    padding: 12px 12px;
    background: #30333d;
    border: 1px solid #444853;
    border-radius: 10px;
}

.countdown-label {
    color: #a1a1aa;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

#next-puzzle-timer {
    margin: 10px 0;
    color: #f4f4f5;
    font-size: 27px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: 2px;
}

/* NEW DAILY PUZZLE NOTIFICATION */

.new-puzzle-notification {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    width: calc(100% - 32px);
    max-width: 420px;
    padding: 16px;

    background: #30333d;
    border: 1px solid #555965;
    border-radius: 12px;

    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

.new-puzzle-notification[hidden] {
    display: none;
}

.new-puzzle-notification-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.new-puzzle-notification-text strong {
    font-size: 14px;
}

.new-puzzle-notification-text span {
    color: #a1a1aa;
    font-size: 12px;
}

#play-new-puzzle {
    flex-shrink: 0;
    padding: 10px 12px;

    background: #4ade80;
    color: #111827;
    border: none;
    border-radius: 8px;

    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

#play-new-puzzle:hover {
    background: #86efac;
}

/* PUZZLE ARCHIVE NAVIGATION */

.archive-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.archive-select-button,
.archive-today-button {
    min-height: 40px;
    padding: 9px 16px;

    background: #30333d;
    color: #f4f4f5;

    border: 1px solid #444853;
    border-radius: 8px;

    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;

    transition: background 0.15s ease;
}

.archive-select-button:hover,
.archive-today-button:hover {
    background: #444853;
}

.archive-today-button {
    background: #4f46e5;
    border-color: #6366f1;
}

.archive-today-button:hover {
    background: #6366f1;
}

.archive-navigation button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.archive-navigation [hidden] {
    display: none;
}

@media (max-width: 480px) {
    .archive-navigation {
        gap: 7px;
    }

    .archive-select-button,
    .archive-today-button {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* ARCHIVE DATE PICKER */

.archive-date-picker[hidden] {
    display: none;
}

.archive-date-picker {
    min-height: 40px;
    padding: 8px 12px;

    background: #30333d;
    color: #f4f4f5;

    border: 1px solid #444853;
    border-radius: 8px;

    font-family: inherit;
    font-size: 14px;
    color-scheme: dark;
}

.archive-date-picker:focus {
    outline: 2px solid #a5b4fc;
    outline-offset: 2px;
}

/* CUSTOM ARCHIVE CALENDAR */

.archive-navigation {
    position: relative;
}

.archive-calendar[hidden] {
    display: none;
}

.archive-calendar {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;

    width: 320px;
    max-width: calc(100vw - 32px);
    padding: 16px;

    background: #20212b;
    border: 1px solid #444853;
    border-radius: 12px;

    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}


.archive-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;

    color: #f4f4f5;
    font-size: 15px;
    font-weight: 700;
}

.archive-month-button {
    width: 32px;
    height: 32px;

    background: transparent;
    color: #c4c4d0;
    border: none;
    border-radius: 6px;

    cursor: pointer;
    font-size: 16px;
}

.archive-month-button:hover:not(:disabled) {
    background: #383a49;
}

.archive-month-button:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}


.archive-calendar-weekdays,
.archive-calendar-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
}

.archive-calendar-weekdays {
    margin-bottom: 8px;
}

.archive-calendar-weekdays span {
    text-align: center;
    color: #a1a1aa;
    font-size: 12px;
    font-weight: 600;
}

.archive-calendar-day {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    height: 36px;
    padding: 0;

    background: transparent;
    color: #f4f4f5;
    border: 1px solid transparent;
    border-radius: 7px;

    font-family: inherit;
    font-size: 13px;

    cursor: pointer;
}

.archive-calendar-day:hover:not(:disabled) {
    background: #383a49;
}

.archive-calendar-day:disabled {
    color: #626472;
    cursor: not-allowed;
}

.archive-calendar-day.completed {
    background: #166534;
    color: #ffffff;
    font-weight: 700;
}

.archive-calendar-day.completed:hover:not(:disabled) {
    background: #15803d;
}

/* Keep the selected date purple, even when completed */
.archive-calendar-day.completed.selected {
    background: #4f46e5;
    color: #ffffff;
}

.archive-calendar-day.selected {
    background: #4f46e5;
    color: #ffffff;
    font-weight: 700;
}

.archive-calendar-day.selected:hover {
    background: #6366f1;
}

.archive-calendar-day.today:not(.selected) {
    border-color: #818cf8;
    font-weight: 700;
}

.archive-calendar-empty {
    height: 36px;
}


.archive-calendar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;

    margin-top: 14px;
    padding-top: 12px;

    border-top: 1px solid #383a49;

    color: #a1a1aa;
    font-size: 11px;
}

.archive-calendar-legend {
    display: flex;
    align-items: center;
    gap: 6px;
}

.archive-legend-dot {
    width: 9px;
    height: 9px;
    background: #4f46e5;
    border-radius: 50%;
}

/* MOBILE SEARCH MODAL LAYOUT */

@media (max-width: 700px) {

    html.search-open,
    body.modal-open {
        overflow: hidden;
        overscroll-behavior: none;
    }

    #search-modal.modal-overlay {
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100dvh;

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

        padding: 12px;
        background: rgba(0, 0, 0, 0.78);

        overflow: hidden;
        overscroll-behavior: none;
        touch-action: pan-y pinch-zoom;
    }

    #search-modal .modal-content {
        width: 100%;
        max-height: calc(100dvh - 24px);

        display: flex;
        flex-direction: column;

        overflow: hidden;
        transform: none;
        transition: none;
    }

    #search-modal #search-results {
        flex: 1 1 auto;
        min-height: 0;

        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y pinch-zoom;
    }
}

/* Always hide the search modal when JavaScript closes it */
#search-modal.modal-overlay[hidden] {
    display: none;
}

/* MOBILE RESULTS WINDOW */

@media (max-width: 700px) {

    #results-modal.modal-overlay {
        padding: 12px;
    }

    #results-modal .results-modal-content {
        width: 100%;
        max-height: calc(100dvh - 24px);
        overflow-y: auto;

        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
}

/* Welcome and how to play */
.header {
    position: relative;
}

.help-button {
    position: absolute;
    top: -4px;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #d4d4d8;
    cursor: pointer;
}

.help-button span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid #71717a;
    border-radius: 50%;
    font-size: 18px;
    font-weight: 700;
}

.help-button:hover span {
    background: #30333d;
    color: #ffffff;
}

.help-button:focus-visible {
    outline: 2px solid #818cf8;
    outline-offset: 2px;
}

.welcome-modal {
    width: min(600px, calc(100% - 24px));
    max-height: calc(100dvh - 24px);
    margin: auto;
    padding: 24px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    background: #242731;
    color: #f4f4f5;
    border: 1px solid #444853;
    border-radius: 14px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
}

.welcome-modal::backdrop {
    background: rgba(0, 0, 0, 0.7);
}

.welcome-body {
    font-size: 14px;
    line-height: 1.65;
    color: #d4d4d8;
}

.welcome-body h3 {
    margin: 20px 0 8px;
    color: #f4f4f5;
    font-size: 16px;
}

.welcome-body ol {
    padding-left: 22px;
}

.welcome-body li + li {
    margin-top: 10px;
}

.welcome-start {
    width: 100%;
    margin-top: 24px;
}

@media (max-width: 600px) {
    .welcome-modal {
        padding: 18px;
    }

    .welcome-modal .modal-heading h2 {
        font-size: 21px;
    }
}

/* Independent mobile results close button */
.results-mobile-close {
    display: none;
}

/* Site credits and contact */
.privacy-link-note {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.site-footer {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 28px;
    width: min(1000px, 94%);
    margin: 0 auto;
    padding: 20px 0 28px;
    color: #a1a1aa;
    font-size: 12px;
    line-height: 1.6;
    text-align: center;
}

.site-footer a {
    color: inherit;
    text-underline-offset: 3px;
}

.site-footer a:hover {
    color: #f4f4f5;
}

.site-footer a:focus-visible {
    outline: 2px solid #818cf8;
    outline-offset: 3px;
}

@media (max-width: 600px) {
    .site-footer {
        flex-direction: column;
        gap: 6px;
    }
}

@media (max-width: 700px) {

    #results-modal .modal-header .modal-close {
        display: none;
    }

    #results-modal .results-mobile-close {
        display: block;
        position: fixed;
        top: 24px;
        right: 24px;
        z-index: 50;

        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.20);
    }
}
