:root {
    --accent: #0f766e;
    --ink: #10201d;
    --surface: #fffdf7;
    --background: #f4efe4;
    --line: rgba(16, 32, 29, .16);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--background);
    position: static;
    width: auto;
    height: auto;
}

body {
    margin: 0;
    min-height: 100%;
    color: var(--ink);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .64), rgba(255, 255, 255, 0) 280px),
        var(--background);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    position: static;
    width: auto;
    height: auto;
}

a {
    color: inherit;
}

.site-header,
.game-header {
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px clamp(16px, 4vw, 44px);
    border-bottom: 1px solid var(--line);
    background: rgba(255, 253, 247, .86);
    backdrop-filter: blur(14px);
}

.logo {
    text-decoration: none;
    font-weight: 900;
    font-size: clamp(20px, 3vw, 28px);
}

.site-header nav a {
    text-decoration: none;
    font-weight: 750;
}

main {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.hero {
    min-height: min(56vh, 520px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: clamp(34px, 7vw, 88px) 0;
}

.hero h1 {
    max-width: 780px;
    margin: 0;
    font-size: clamp(42px, 8vw, 92px);
    line-height: .96;
    letter-spacing: 0;
}

.hero p {
    max-width: 560px;
    margin: 18px 0 0;
    color: rgba(16, 32, 29, .72);
    font-size: 20px;
    line-height: 1.45;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 16px;
    color: #fff;
    background: var(--accent);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 800;
    white-space: nowrap;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
    padding: 0 0 48px;
}

.category-card {
    position: relative;
    min-height: 180px;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid var(--line);
    color: #fff;
    background: #10201d;
    text-decoration: none;
    isolation: isolate;
}

.category-card img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -2;
    transition: transform .25s ease;
}

.category-card::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(180deg, rgba(16, 32, 29, .08), rgba(16, 32, 29, .82));
}

.category-card:hover img {
    transform: scale(1.04);
}

.category-card span {
    position: absolute;
    inset: auto 0 0;
    padding: 18px;
}

.category-card strong,
.category-card small {
    display: block;
}

.category-card strong {
    font-size: 20px;
}

.category-card small {
    margin-top: 4px;
    color: rgba(255, 255, 255, .78);
}

.site-footer {
    padding: 26px clamp(16px, 4vw, 44px);
    color: rgba(16, 32, 29, .7);
}

.game-page {
    overflow-x: hidden;
    overflow-y: auto;
    background:
        radial-gradient(circle at 10% 8%, rgba(255, 255, 255, .82), transparent 30%),
        linear-gradient(135deg, rgba(15, 118, 110, .12), rgba(217, 119, 6, .06)),
        var(--background);
}

.game-header {
    position: sticky;
    top: 0;
    z-index: 10;
}

.game-header > div {
    display: grid;
    justify-items: end;
}

.game-header span {
    color: rgba(16, 32, 29, .68);
    font-size: 14px;
}

.game-shell {
    width: 100%;
    min-height: calc(100vh - 68px);
    display: grid;
    place-items: center;
    padding: 18px;
}

#wordsearch-container {
    width: min(100%, 1180px);
    height: calc(100vh - 110px);
    min-height: 620px;
    border: 1px solid rgba(16, 32, 29, .1);
    border-radius: 8px;
    background: rgba(255, 253, 247, .9);
    box-shadow: 0 24px 60px rgba(16, 32, 29, .16);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.wordsearch {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100%;
}

.html5-wordsearch {
    margin: 0 auto;
    filter: drop-shadow(0 10px 18px rgba(16, 32, 29, .08));
}

div.html5-wordsearch-toolbar {
    height: 56px;
    padding: 9px 12px;
    border-bottom: 1px solid rgba(16, 32, 29, .1);
    box-shadow: none;
    background: rgba(255, 253, 247, .96);
}

div.html5-wordsearch-toolbar ul {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
}

div.html5-wordsearch-toolbar ul li {
    margin-left: 0;
}

.html5-soup {
    padding: 78px 14px 24px;
    margin-inline: auto;
    max-width: 100%;
    min-height: 100%;
}

.html5-wordsearch .list {
    background: #fffaf0;
}

.html5-wordsearch .list {
    border-left: 1px solid rgba(16, 32, 29, .12);
    width: 360px;
    max-width: min(360px, calc(100vw - 36px));
    padding: 12px;
    overflow: visible;
    scrollbar-width: auto;
    touch-action: pan-y;
}

.word-list-hidden .html5-wordsearch .list,
body.disable-hints .html5-wordsearch .list {
    display: none !important;
}

.html5-wordsearch .list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--ink);
    border: 1px solid rgba(16, 32, 29, .1);
    border-radius: 8px;
    background: rgba(255, 255, 255, .78);
    line-height: 20px;
    margin-bottom: 8px;
    padding: 9px 10px;
    font-size: 16px;
    font-weight: 800;
}

.html5-wordsearch .list li span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.html5-wordsearch .list li a {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    background: rgba(15, 118, 110, .1);
    text-shadow: none;
    font-size: 15px;
    font-weight: 900;
    padding: 0;
}

div.html5-wordsearch-toolbar .button,
#modal-window .button {
    min-height: 36px;
    border: 1px solid rgba(16, 32, 29, .12);
    border-radius: 8px;
    padding: 7px 12px;
    background: linear-gradient(180deg, #ffffff, #f5fbf8);
    color: var(--ink);
    font-weight: 800;
    text-decoration: none;
    box-shadow: none;
    text-shadow: none;
    transition: transform .15s ease, border-color .15s ease, color .15s ease, background .15s ease;
}

div.html5-wordsearch-toolbar .tool-button:hover,
div.html5-wordsearch-toolbar .icon-button:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
}

div.html5-wordsearch-toolbar .metric {
    border-color: rgba(15, 118, 110, .22);
    background: rgba(15, 118, 110, .11);
    color: #0f5f58;
    font-variant-numeric: tabular-nums;
}

div.html5-wordsearch-toolbar .icon-button {
    width: 38px;
    padding-inline: 0;
}

#html5-wordsearch-score,
#html5-wordsearch-timer {
    width: auto;
    min-width: 76px;
}

#download-puzzle {
    position: static;
}

.html5-wordsearch canvas {
    border-radius: 12px;
}

.html5-wordsearch canvas.grid {
    z-index: 1;
    background: transparent;
    box-shadow: 0 0 0 2px rgba(16, 32, 29, .12);
}

.html5-wordsearch canvas.lines {
    z-index: 2;
    pointer-events: none;
}

.html5-wordsearch canvas.layer {
    z-index: 3;
    background: transparent;
    pointer-events: none;
}

.html5-wordsearch canvas.grid {
    pointer-events: auto;
}

.desktop .html5-wordsearch .list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    height: auto !important;
    max-height: none;
    right: 0;
    left: auto;
    border-left: 1px solid rgba(16, 32, 29, .12);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(16, 32, 29, .08);
}

.desktop .html5-wordsearch .list li {
    margin-bottom: 0;
}

.desktop.word-list-definitions .html5-wordsearch .list {
    grid-template-columns: 1fr;
}

.desktop.word-list-definitions .html5-wordsearch .list li {
    align-items: flex-start;
    line-height: 1.35;
    font-size: clamp(11px, .95vw, 14px);
    font-weight: 700;
}

.desktop .html5-wordsearch .list li {
    font-size: clamp(12px, 1vw, 16px);
}

.html5-wordsearch .description span.word {
    background: var(--accent);
}

.html5-wordsearch .list li.crossed.good {
    border-color: rgba(15, 118, 110, .32);
    background: rgba(15, 118, 110, .1);
    background-image: none !important;
    color: rgba(16, 32, 29, .58);
}

.html5-wordsearch .list li.crossed.bad {
    border-color: rgba(217, 119, 6, .34);
    background: rgba(217, 119, 6, .1);
    background-image: none !important;
    color: rgba(16, 32, 29, .58);
}

.html5-wordsearch .list li.crossed span {
    text-decoration-line: line-through;
    text-decoration-thickness: 2px;
    text-decoration-color: rgba(15, 118, 110, .55);
}

#puzzle-description {
    color: var(--ink);
}

@media (max-width: 720px) {
    .hero {
        align-items: flex-start;
        flex-direction: column;
        min-height: auto;
    }

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

    .game-header > div {
        justify-items: start;
    }

    #wordsearch-container {
        min-height: 640px;
        height: calc(100vh - 124px);
    }

    div.html5-wordsearch-toolbar {
        height: auto;
        min-height: 46px;
    }

    div.html5-wordsearch-toolbar ul {
        justify-content: flex-start;
    }

    .html5-soup {
        padding: 106px 10px 28px;
    }

    .phone .html5-wordsearch .list {
        left: 0;
        right: auto;
        top: calc(100% + 14px);
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
        gap: 8px;
        width: 100%;
        max-width: 100%;
        height: auto !important;
        max-height: none;
        overflow: visible;
        border-left: 0;
        border-top: 1px solid rgba(16, 32, 29, .12);
        padding: 12px 0 28px;
        text-align: left;
    }

    .phone .html5-wordsearch .list li {
        display: flex;
        margin: 0;
        padding: 8px 9px;
    }

    .phone.word-list-definitions .html5-wordsearch .list {
        grid-template-columns: 1fr;
    }

    .phone #show-help,
    .phone #restart {
        text-indent: 0;
        background-image: none;
        background-position: initial;
    }

    .phone #download-puzzle {
        display: none !important;
    }
}
