
:root {
    --bg: #6e1423;
    --ink: #f7e9e4;
    --panel: #85212f;
    --red: #e63946;
    --muted: #e1bfc0;
    --border: rgba(247, 233, 228, 0.16);
    --cell: #f7e9e4;
    --cell-text: #6e1423;
}

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

body {
    position: relative;
    isolation: isolate;
    background: var(--bg);
    color: var(--ink);
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    min-height: 100vh;
    transition: background 0.35s ease;
}

/* Decorative background symbols */

body::before,
body::after {
    position: fixed;
    z-index: -1;
    pointer-events: none;
    user-select: none;
    opacity: 0.12;
    font-size: clamp(130px, 23vw, 260px);
    line-height: 1;
}

body::before {
    content: "✦";
    top: 12%;
    right: 5%;
}

body::after {
    content: "✧";
    bottom: 8%;
    left: 4%;
}

/* CATEGORY BACKGROUNDS */

body[data-theme="mixed"] {
    background:
        radial-gradient(ellipse at 85% 15%, #a32b40 0%, transparent 38%),
        radial-gradient(ellipse at 10% 85%, #4b1020 0%, transparent 45%),
        #6e1423;
}

body[data-theme="countries"] {
    background:
        radial-gradient(ellipse at 80% 20%, #287b8c 0%, transparent 38%),
        radial-gradient(ellipse at 10% 85%, #174c60 0%, transparent 45%),
        #123344;
}

body[data-theme="countries"]::before { content: "🌍"; }
body[data-theme="countries"]::after { content: "✈️"; }

body[data-theme="food"] {
    background:
        radial-gradient(ellipse at 80% 20%, #b76c32 0%, transparent 38%),
        radial-gradient(ellipse at 10% 85%, #743c24 0%, transparent 45%),
        #51291e;
}

body[data-theme="food"]::before { content: "🍊"; }
body[data-theme="food"]::after { content: "🍓"; }

body[data-theme="christmas"] {
    background:
        radial-gradient(ellipse at 80% 15%, #277b59 0%, transparent 38%),
        radial-gradient(ellipse at 10% 85%, #a52b3a 0%, transparent 45%),
        #153b32;
}

body[data-theme="christmas"]::before { content: "❄️"; }
body[data-theme="christmas"]::after { content: "🎄"; }

body[data-theme="halloween"] {
    background:
        radial-gradient(ellipse at 80% 20%, #7435a5 0%, transparent 38%),
        radial-gradient(ellipse at 10% 85%, #b45b20 0%, transparent 45%),
        #241532;
}

body[data-theme="halloween"]::before { content: "🎃"; }
body[data-theme="halloween"]::after { content: "🦇"; }

body[data-theme="easter"] {
    background:
        radial-gradient(ellipse at 80% 20%, #a879b8 0%, transparent 38%),
        radial-gradient(ellipse at 10% 85%, #679e75 0%, transparent 45%),
        #44334e;
}

body[data-theme="easter"]::before { content: "🌸"; }
body[data-theme="easter"]::after { content: "🐰"; }

body[data-theme="animals"] {
    background:
        radial-gradient(ellipse at 80% 20%, #668b50 0%, transparent 38%),
        radial-gradient(ellipse at 10% 85%, #345a3c 0%, transparent 45%),
        #203b2b;
}

body[data-theme="animals"]::before { content: "🦋"; }
body[data-theme="animals"]::after { content: "🐾"; }

body[data-theme="nature"] {
    background:
        radial-gradient(ellipse at 80% 20%, #398b71 0%, transparent 38%),
        radial-gradient(ellipse at 10% 85%, #245c48 0%, transparent 45%),
        #193b32;
}

body[data-theme="nature"]::before { content: "🌿"; }
body[data-theme="nature"]::after { content: "🌼"; }

body[data-theme="sport"] {
    background:
        radial-gradient(ellipse at 80% 20%, #3976ae 0%, transparent 38%),
        radial-gradient(ellipse at 10% 85%, #244a80 0%, transparent 45%),
        #182d4b;
}

body[data-theme="sport"]::before { content: "⚽"; }
body[data-theme="sport"]::after { content: "🏆"; }

body[data-theme="gaming"] {
    background:
        radial-gradient(ellipse at 80% 20%, #7546a8 0%, transparent 38%),
        radial-gradient(ellipse at 10% 85%, #354b9c 0%, transparent 45%),
        #201d43;
}

body[data-theme="gaming"]::before { content: "🎮"; }
body[data-theme="gaming"]::after { content: "👾"; }

body[data-theme="music"] {
    background:
        radial-gradient(ellipse at 80% 20%, #a34875 0%, transparent 38%),
        radial-gradient(ellipse at 10% 85%, #563a9c 0%, transparent 45%),
        #35213e;
}

body[data-theme="music"]::before { content: "🎵"; }
body[data-theme="music"]::after { content: "🎧"; }

body[data-theme="science"] {
    background:
        radial-gradient(ellipse at 80% 20%, #277e9c 0%, transparent 38%),
        radial-gradient(ellipse at 10% 85%, #354d91 0%, transparent 45%),
        #172d4b;
}

body[data-theme="science"]::before { content: "🧪"; }
body[data-theme="science"]::after { content: "⚛️"; }

body[data-theme="geography"] {
    background:
        radial-gradient(ellipse at 80% 20%, #9a8043 0%, transparent 38%),
        radial-gradient(ellipse at 10% 85%, #456b65 0%, transparent 45%),
        #263c3b;
}

body[data-theme="geography"]::before { content: "🧭"; }
body[data-theme="geography"]::after { content: "🌎"; }

/* HEADER */

header {
    height: 72px;
    padding: 0 7%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.logo {
    color: var(--ink);
    text-decoration: none;
    font-size: 23px;
    font-weight: 800;
    letter-spacing: -1px;
}

.logo span,
h1 span {
    color: #ff8790;
}

.back-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
}

main {
    max-width: 850px;
    margin: 65px auto;
    padding: 0 20px;
}

/* INTRO */

.intro {
    margin-bottom: 32px;
}

.eyebrow {
    color: #ff9ca2;
    font-size: 11px;
    letter-spacing: 2.5px;
    margin-bottom: 13px;
    font-weight: 700;
}

h1 {
    font-size: clamp(40px, 7vw, 62px);
    letter-spacing: -3px;
    margin-bottom: 9px;
}

.intro > p:last-child {
    color: var(--muted);
    font-size: 15px;
}

/* GAME PANEL */

.game {
    background: var(--panel);
    padding: 25px;
    border: 1px solid var(--border);
    border-radius: 17px;
    box-shadow: 0 15px 45px rgba(0,0,0,0.12);
}

/* TOOLBAR */

.toolbar {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 30px;
}

.toolbar > div {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.toolbar label {
    font-size: 10px;
    letter-spacing: 1.5px;
    color: var(--muted);
    font-weight: 700;
}

select,
button {
    font: inherit;
    border-radius: 8px;
    padding: 11px 14px;
}

select {
    background: var(--bg);
    color: var(--ink);
    border: 1px solid var(--border);
    cursor: pointer;
}

button {
    cursor: pointer;
    border: none;
    font-weight: 700;
    transition: transform 0.15s, background 0.15s;
}

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

.assist-button {
    background: #fff;
    color: #6e1423;
    border: 1px solid rgba(255,255,255,0.35);
    box-shadow: 0 3px 10px rgba(0,0,0,0.12);
}

.assist-button:hover {
    background: #ffe8eb;
}

.assist-button.active {
    background: #ffb5dc;
    color: #57152f;
    box-shadow: 0 0 0 3px rgba(255,181,220,0.2);
}

.new-button {
    background: var(--red);
    color: white;
    margin-left: auto;
}

/* GAME INFO */

.game-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.game-info h2 {
    font-size: 20px;
    margin-bottom: 5px;
}

.game-info p {
    color: var(--muted);
    font-size: 13px;
}

.game-stats {
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat span {
    color: var(--muted);
    font-size: 9px;
    letter-spacing: 1px;
    font-weight: 700;
}

.stat strong {
    font-size: 17px;
    font-variant-numeric: tabular-nums;
}

.counter {
    color: #ffb1b6;
    font-weight: 700;
    font-size: 14px;
}

/* WORDSEARCH GRID */

.grid {
    display: grid;
    grid-template-columns: repeat(var(--grid-size, 10), minmax(0, 1fr));
    gap: 5px;
    max-width: 540px;
    margin: auto;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.cell {
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--cell);
    color: var(--cell-text);
    border-radius: 6px;
    font-size: clamp(11px, 2.5vw, 19px);
    font-weight: 750;
    cursor: crosshair;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    transition: background 0.12s, color 0.12s;
}

.cell.selected {
    background: #ff8790;
    color: #57101d !important;
}

.cell.found {
    background: #b7e4c7;
    color: #185c36 !important;
}

/* ASSIST MODE */

.grid.assist-mode {
    padding: 10px;
    border-radius: 12px;
    background: rgba(255,255,255,0.08);
}

.grid.assist-mode .cell:not(.selected):not(.found) {
    background: #fff;
    color: var(--letter-color);
    -webkit-text-stroke: 0;
    paint-order: fill;
    border: 1px solid rgba(0,0,0,0.12);
    box-shadow: 0 2px 4px rgba(0,0,0,0.12);
    border-radius: 7px;
}

.grid.assist-mode .cell.selected {
    background: #ff8790;
    color: #57101d !important;
    -webkit-text-stroke: 0;
    box-shadow: 0 0 0 2px #fff;
}

.grid.assist-mode .cell.found {
    background: #b7e4c7;
    color: #185c36 !important;
    -webkit-text-stroke: 0;
}

/* WORD LIST */

.words-section {
    margin-top: 30px;
    border-top: 1px solid var(--border);
    padding-top: 22px;
}

.words-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 16px;
}

.words-heading h3 {
    font-size: 16px;
}

.words-heading span {
    font-size: 11px;
    color: var(--muted);
}

.word-list {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.word {
    background: rgba(247, 233, 228, 0.12);
    border: 1px solid var(--border);
    color: var(--ink);
    padding: 9px 13px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 700;
}

.word.completed {
    text-decoration: line-through;
    color: #b7e4c7;
    background: rgba(183, 228, 199, 0.12);
}

/* MESSAGE */

#message {
    min-height: 22px;
    margin-top: 22px;
    color: #b7e4c7;
    font-size: 14px;
    font-weight: 700;
}

/* FOOTER */

footer {
    display: flex;
    justify-content: space-between;
    margin-top: 35px;
    padding: 20px 0;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 10px;
    letter-spacing: 1px;
}

/* MOBILE */

@media (max-width: 550px) {
    main {
        margin: 38px auto;
    }

    header {
        padding: 0 20px;
    }

    .game {
        padding: 15px 11px;
    }

    .toolbar {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .toolbar select,
    .toolbar button {
        width: 100%;
    }

    .new-button {
        margin-left: 0;
    }

    .grid {
        gap: 3px;
    }

    .cell {
        border-radius: 4px;
        font-size: clamp(10px, 3.2vw, 17px);
    }

    .words-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .game-stats {
        gap: 12px;
        flex-wrap: wrap;
    }

    .stat strong {
        font-size: 14px;
    }

    .counter {
        font-size: 12px;
    }
}

