/* Word-search layout; shared colours live in gameplay-palette.css. */
body.puzzle.arcade-site #puzzle.content {
    width: min(1200px, 94%);
    box-sizing: border-box;
    margin: 4px auto 0;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}
body.puzzle.arcade-site #puzzle .puzzle-content {
    display: grid;
    box-sizing: border-box;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
    align-items: start;
    gap: 0;
    width: 100%;
    padding: 0;
    background: var(--play-surface);
    border: 1px solid var(--play-border);
    border-inline-color: transparent;
    border-radius: 0;
}
/* Extend each section's own colour without changing the content width. */
body.puzzle.arcade-site #puzzle .puzzle-content,
body.puzzle.arcade-site .glossary {
    position: relative;
    isolation: isolate;
}
body.puzzle.arcade-site #puzzle .puzzle-content::before,
body.puzzle.arcade-site .glossary::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    clip-path: inset(0 -100vmax);
}
body.puzzle.arcade-site #puzzle .puzzle-content::before {
    inset-block: -1px;
    border-block: 1px solid var(--play-border);
    background: var(--play-surface);
    box-shadow: 0 0 0 100vmax var(--play-surface);
}
body.puzzle.arcade-site .glossary::before {
    background: var(--support-bg);
    box-shadow: 0 0 0 100vmax var(--support-bg);
}
body.puzzle.arcade-site #puzzle .left_side,
body.puzzle.arcade-site #puzzle .right_side {
    display: block !important;
    box-sizing: border-box;
    min-width: 0;
    width: 100%;
    height: auto;
    margin: 0;
    padding: 22px;
    background: transparent;
    border: 0;
    border-radius: 0;
    color: var(--play-ink);
    box-shadow: none;
}
body.puzzle.arcade-site #puzzle .left_side { position: sticky; top: 16px; }
body.puzzle.arcade-site #puzzle .ls_text { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0; margin: 0 0 20px; color: var(--play-muted); }
.wordsearch-board-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 14px; }
.wordsearch-difficulty { border-radius: 0; background: var(--play-soft); padding: 6px 10px; color: var(--play-accent); font-weight: 700; }
body.puzzle.arcade-site #puzzle .timer { display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 6px 0; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--play-muted); white-space: nowrap; }
body.puzzle.arcade-site .timer svg { fill: none; stroke: currentColor; stroke-width: 1.6; }
body.puzzle.arcade-site #puzzle .canvas-box { position: relative; display: flex; justify-content: center; width: 100%; max-width: 560px; padding: 0 !important; margin: 0 auto; line-height: 0; }
body.puzzle.arcade-site #cv { position: static; display: block; max-width: 100%; background: transparent; border: 0; border-radius: 0; touch-action: none; }
body.puzzle.arcade-site #puzzle .wordsearch-gesture-hint { max-width: 500px; margin: 18px auto 0; padding: 0; color: var(--play-muted); font-size: 14px; line-height: 1.5; text-align: center; }
body.puzzle.arcade-site #puzzle .right_side { align-self: stretch; text-align: start; border-left: 1px solid transparent; }
body.puzzle.arcade-site #puzzle .right_side h3 { margin: 0; padding: 0; color: var(--play-ink); text-align: start; text-shadow: none; font-size: 19px; line-height: 1.4; }
.wordsearch-progress { display: flex; align-items: center; gap: 14px; margin: 14px 0 18px; }
.wordsearch-progress strong { color: var(--play-accent); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
#wordsearch-progress { display: block; flex: 1; min-width: 0; width: 100%; height: 7px; border: 0; border-radius: 0; overflow: hidden; background: var(--play-soft); color: var(--play-accent); appearance: none; }
#wordsearch-progress::-webkit-progress-bar { background: var(--play-soft); border-radius: 0; }
#wordsearch-progress::-webkit-progress-value { background: var(--play-accent); border-radius: 0; }
#wordsearch-progress::-moz-progress-bar { background: var(--play-accent); border-radius: 0; }
body.puzzle.arcade-site #puzzle .legend { width: 100%; box-sizing: border-box; margin: 0; padding: 0; }
body.puzzle.arcade-site #puzzle .legend ul { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
body.puzzle.arcade-site #puzzle .legend ul li { display: block; max-width: 100%; margin: 0; padding: 0; border: 1px solid var(--word-border); border-radius: 10px; background: var(--word-fill); text-shadow: none; box-shadow: 0 2px 0 hsl(var(--hue), 30%, 25%, .12); }
body.puzzle.arcade-site #puzzle .legend ul li a { display: inline-flex; align-items: center; box-sizing: border-box; min-height: 44px; max-width: 100%; margin: 0; padding: 8px 12px; color: var(--play-ink); text-shadow: none; line-height: 1.4; font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
body.puzzle.arcade-site #puzzle .legend ul li a:first-letter { color: inherit; }
body.puzzle.arcade-site #puzzle .legend ul li:has(a[style*="line-through"]) { opacity: .6; border-style: dashed; }
body.puzzle.arcade-site #puzzle .legend ul li:has(a[style*="line-through"]) a { color: var(--play-accent); }
body.puzzle.arcade-site .glossary {
    display: grid;
    box-sizing: border-box;
    width: 100%;
    grid-template-columns: minmax(240px, .8fr) minmax(0, 1.4fr);
    grid-template-areas: "rules dictionary" "records dictionary";
    gap: 0 32px;
    margin-top: 0px;
    padding: 28px;
    background: var(--support-bg);
    border: 0px solid var(--support-border);
    border-radius: 0px;
    color: var(--support-muted);
    text-align: start;
}
.wordsearch-rules { grid-area: rules; min-width: 0; }
.wordsearch-records { grid-area: records; min-width: 0; align-self: start; }
.wordsearch-dictionary { grid-area: dictionary; min-width: 0; padding-inline-start: 32px; border-inline-start: 1px solid transparent; }
body.puzzle.arcade-site #rules-title,
body.puzzle.arcade-site #dict-title,
body.puzzle.arcade-site #scores-title { display: flex; align-items: center; gap: 10px; margin: 0; padding: 0 0 16px; border: 0; border-radius: 0; background: transparent; color: var(--support-ink); text-align: start; text-shadow: none; font-size: 18px; line-height: 1.5; cursor: pointer; }
body.puzzle.arcade-site .glossary h3 .plus,
body.puzzle.arcade-site .glossary h3 .minus { flex: 0 0 24px; width: 24px; height: 24px; border-radius: 6px; background: var(--support-raised); color: var(--support-accent); text-align: center; font: 18px/24px sans-serif; }
body.puzzle.arcade-site .rules { margin: 0 0 24px; padding: 0; background: transparent; color: var(--support-muted); font-size: 15px; line-height: 1.8; }
body.puzzle.arcade-site .glossary ul { margin: 0; padding: 0; list-style: none; }
body.puzzle.arcade-site .glossary ul li:first-letter { color: inherit; }
body.puzzle.arcade-site .glossary ul li { margin: 0; padding: 14px 0; border-bottom: 1px solid hsl(var(--hue), 20%, 31%, .6); color: inherit; font-size: 15px; line-height: 1.75; overflow-wrap: anywhere; }
body.puzzle.arcade-site .glossary ul li:first-child { padding-top: 0; }
body.puzzle.arcade-site .glossary ul li:last-child { border-bottom: 0; padding-bottom: 0; }
body.puzzle.arcade-site .glossary .gls_word { padding: 0 4px; background: transparent; color: var(--support-accent); font-weight: 700; text-shadow: none; }
body.puzzle.arcade-site .glossary button { border: 1px solid var(--support-border); border-radius: 6px; background-color: var(--support-raised); color: var(--support-ink); box-shadow: none; }
body.puzzle.arcade-site .glossary button:hover { background-color: var(--support-border); }
body.puzzle.arcade-site .glossary .play { background-color: var(--support-accent); border-color: transparent; }
body.puzzle.arcade-site .glossary .play:hover { background-color: var(--support-ink); }
body.puzzle.arcade-site #scores { overflow-x: auto; }
body.puzzle.arcade-site #scores-panel table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
body.puzzle.arcade-site #scores-panel td { padding: 10px 8px; border-bottom: 1px solid var(--support-border); background: transparent; color: var(--support-muted); text-align: start; }
body.puzzle.arcade-site #scores-panel thead td { color: var(--support-ink); font-weight: 600; }
body.puzzle.arcade-site .phon { color: var(--support-muted); }
body.puzzle.arcade-site .dictionary-attribution { font-size: 13px; line-height: 1.6; }
body.puzzle.arcade-site .dictionary-attribution a { color: var(--support-accent); }
body.puzzle.arcade-site .buttonsOnWin,
body.puzzle.arcade-site #restart,
body.puzzle.arcade-site #next-unresolved {
    box-sizing: border-box;
    min-height: 52px;
    width: 100%;
    margin: 0 0 12px;
    padding: 12px 16px;
    border: 1px solid hsl(var(--hue), 44%, 72%);
    border-radius: 12px;
    background: hsl(var(--hue), 42%, 92%);
    color: hsl(var(--hue), 42%, 27%);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    text-shadow: none;
    box-shadow: 0 2px 0 hsl(var(--hue), 35%, 35%, .12);
    cursor: pointer;
    touch-action: manipulation;
    transition: background .15s ease, box-shadow .15s ease, transform .15s ease;
}
body.puzzle.arcade-site #next-unresolved {
    background: linear-gradient(135deg, hsl(var(--hue), 58%, 40%), hsl(var(--hue), 58%, 32%));
    border-color: hsl(var(--hue), 55%, 30%);
    color: #fff;
    box-shadow: 0 3px 0 hsl(var(--hue), 48%, 24%), 0 6px 14px hsl(var(--hue), 50%, 25%, .16);
}
.wordsearch-action-content { display: flex; align-items: center; justify-content: center; gap: 10px; }
.wordsearch-action-content > span { min-width: 0; overflow-wrap: anywhere; }
.wordsearch-action-content svg { flex: 0 0 20px; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
body.puzzle.arcade-site.dark-mode .buttonsOnWin,
body.puzzle.arcade-site.dark-mode #restart { background: hsl(var(--hue), 24%, 25%); border-color: hsl(var(--hue), 30%, 45%); color: hsl(var(--hue), 45%, 88%); }
body.puzzle.arcade-site.dark-mode #next-unresolved { background: linear-gradient(135deg, hsl(var(--hue), 62%, 67%), hsl(var(--hue), 56%, 56%)); border-color: hsl(var(--hue), 45%, 47%); color: hsl(var(--hue), 38%, 13%); box-shadow: 0 3px 0 hsl(var(--hue), 35%, 34%), 0 6px 14px #0003; }
@media (hover: hover) {
    body.puzzle.arcade-site .buttonsOnWin:hover { filter: brightness(1.06); transform: translateY(-1px); }
}
body.puzzle.arcade-site :is(#restart, #next-unresolved):active { transform: translateY(1px); box-shadow: none; }
body.puzzle.arcade-site .buttonsOnWin:focus-visible { outline: 3px solid var(--play-accent); outline-offset: 4px; }
body.puzzle.arcade-site footer.page-container { width: min(1200px, 94%); color: var(--support-muted); border-color: var(--support-border); padding-top: 20px; padding-bottom: 24px; }
body.puzzle.arcade-site footer a { color: hsl(var(--hue), 53%, 76%); }
body.puzzle.arcade-site .puzzle-selection-hint { color: hsl(var(--hue), 14%, 82%); }
body.puzzle.arcade-site a:focus-visible,
body.puzzle.arcade-site button:focus-visible { outline-color: var(--play-accent); }
@media (min-width: 951px) {
    body.puzzle.arcade-site #puzzle .canvas-box { max-width: min(560px, max(280px, calc((100svh - 300px) * var(--board-ratio, 1)))); }
}
@media (max-width: 950px) {
    body.puzzle.arcade-site #puzzle.content { width: calc(100% - 16px); margin-top: 12px; }
    body.puzzle.arcade-site #puzzle .puzzle-content { grid-template-columns: minmax(0, 1fr); gap: 0; border-radius: 0; }
    body.puzzle.arcade-site #puzzle .left_side { position: static; }
    body.puzzle.arcade-site #puzzle .left_side,
    body.puzzle.arcade-site #puzzle .right_side { padding: 16px; border-radius: 0; }
    body.puzzle.arcade-site #puzzle .right_side { border-left: 0; border-top: 1px solid var(--play-border); }
    body.puzzle.arcade-site #puzzle .ls_text { margin-bottom: 12px; }
    body.puzzle.arcade-site #puzzle .wordsearch-gesture-hint { font-size: 13px; margin-top: 12px; }
    body.puzzle.arcade-site .glossary { grid-template-columns: minmax(0, 1fr); grid-template-areas: "rules" "dictionary" "records"; padding: 20px; margin-top: 16px; gap: 24px; }
    .wordsearch-dictionary { padding-inline-start: 0; border-inline-start: 0; }
    .wordsearch-records { padding-top: 20px; border-top: 1px solid var(--support-border); }
    body.puzzle.arcade-site .rules { margin-bottom: 0; }
    body.puzzle.arcade-site #rules-title,
    body.puzzle.arcade-site #dict-title,
    body.puzzle.arcade-site #scores-title { font-size: 16px; }
}
@media (max-width: 380px) {
    body.puzzle.arcade-site #puzzle .left_side,
    body.puzzle.arcade-site #puzzle .right_side { padding: 12px; }
    .wordsearch-board-meta { gap: 6px; font-size: 12px; }
    body.puzzle.arcade-site #puzzle .timer { font-size: 12px; gap: 4px; }
}
@media (min-width: 641px) and (max-width: 950px) and (max-height: 560px) {
    body.puzzle.arcade-site #puzzle .puzzle-content { grid-template-columns: minmax(0, 1fr) minmax(220px, .85fr); gap: 0; }
    body.puzzle.arcade-site #puzzle .right_side { border-left: 1px solid transparent; border-top: 0; }
    body.puzzle.arcade-site #puzzle .left_side { position: sticky; top: 8px; padding: 12px; }
    body.puzzle.arcade-site #puzzle .canvas-box { max-width: min(420px, max(160px, calc((100svh - 190px) * var(--board-ratio, 1)))); }
    body.puzzle.arcade-site #puzzle .ls_text { margin-bottom: 6px; }
    body.puzzle.arcade-site #puzzle .timer { font-size: 12px; }
    body.puzzle.arcade-site #puzzle .wordsearch-gesture-hint { display: none; }
    .wordsearch-difficulty { padding: 4px 8px; }
}




body.puzzle.arcade-site:not(.dark-mode) #puzzle .legend ul li {
    box-shadow: 0 2px 0 hsl(var(--hue), 25%, 35%, .08);
}
body.puzzle.arcade-site:not(.dark-mode) .glossary {
    --support-bg: hsl(var(--hue), 24%, 93%);
    --support-raised: hsl(var(--hue), 30%, 87%);
    --support-border: hsl(var(--hue), 20%, 78%);
    --support-ink: hsl(var(--hue), 23%, 18%);
    --support-muted: hsl(var(--hue), 13%, 33%);
    --support-accent: hsl(var(--hue), 40%, 28%);
}
body.puzzle.arcade-site:not(.dark-mode) .glossary ul li {
    border-bottom-color: hsl(var(--hue), 20%, 80%, .7);
}
body.puzzle.arcade-site:not(.dark-mode) .glossary .play {
    background-color: hsl(var(--hue), 34%, 81%);
}
body.puzzle.arcade-site:not(.dark-mode) .glossary .play:hover {
    background-color: hsl(var(--hue), 34%, 74%);
}
body.puzzle.arcade-site:not(.dark-mode) footer {
    --support-muted: hsl(var(--hue), 22%, 87%);
    --support-border: hsl(var(--hue), 28%, 70%, .35);
}
body.puzzle.arcade-site:not(.dark-mode) footer a {
    color: hsl(var(--hue), 48%, 85%);
}
body.puzzle.arcade-site:not(.dark-mode) footer a:hover {
    color: hsl(var(--hue), 30%, 98%);
}
body.puzzle.arcade-site:not(.dark-mode) footer a:focus-visible {
    outline-color: hsl(var(--hue), 48%, 85%);
}
body.puzzle.arcade-site:not(.dark-mode) .puzzle-selection-hint {
    color: hsl(var(--hue), 22%, 87%);
}
/* Night colours stay local to Word Search, including shared menu elements. */
body.puzzle.arcade-site.dark-mode #top-menu .game-menu-more { border-top-color: var(--support-border); }
body.puzzle.arcade-site.dark-mode #top-menu :focus-visible { outline-color: var(--play-accent); }
body.puzzle.arcade-site.dark-mode #puzzle .legend ul li { box-shadow: 0 2px 0 #0002; }
body.puzzle.arcade-site.dark-mode #puzzle .legend ul li:has(a[style*="line-through"]) { opacity: .8; }
body.puzzle.arcade-site.dark-mode #puzzle .legend ul li:has(a[style*="line-through"]) a { color: hsl(var(--hue), 20%, 78%); }
body.puzzle.arcade-site.dark-mode .glossary ul li { border-bottom-color: var(--support-border); }
body.puzzle.arcade-site.dark-mode footer a { color: var(--play-accent); }
body.puzzle.arcade-site.dark-mode .puzzle-selection-hint { color: var(--play-muted); }
body.puzzle.arcade-site.dark-mode #next-unresolved { background: linear-gradient(135deg, hsl(var(--hue), 50%, 65%), hsl(var(--hue), 46%, 54%)); border-color: hsl(var(--hue), 36%, 43%); color: hsl(var(--hue), 32%, 12%); box-shadow: 0 3px 0 hsl(var(--hue), 28%, 29%), 0 6px 14px #0003; }
body.puzzle.arcade-site.dark-mode #restart { background: var(--play-soft); border-color: var(--play-border); color: var(--play-ink); box-shadow: 0 2px 0 #0002; }
body.puzzle.arcade-site.dark-mode .owindow { background: var(--play-surface); border-color: var(--play-border); color: var(--play-ink); box-shadow: 0 24px 80px #0006; }
body.puzzle.arcade-site.dark-mode .owindow h2,
body.puzzle.arcade-site.dark-mode .owindow h3 { color: var(--play-ink); }
body.puzzle.arcade-site.dark-mode .owindow .greenbutton { background: var(--play-accent); border-color: var(--word-border); color: hsl(var(--hue), 32%, 12%); text-shadow: none; }
body.puzzle.arcade-site.dark-mode .owindow .greybutton { background: var(--play-soft); border-color: var(--play-border); color: var(--play-ink); text-shadow: none; }
/* Restart confirmation follows the active game palette. */
body.puzzle.arcade-site #restart-window {
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
    padding: 24px;
    height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: hsl(var(--hue), 25%, 8%, .5);
    backdrop-filter: blur(5px);
    cursor: default;
    z-index: 1000;
}
body.puzzle.arcade-site #restart-window .restart-dialog {
    box-sizing: border-box;
    position: relative;
    top: auto;
    width: 440px;
    max-width: 100%;
    margin: auto;
    padding: 30px;
    border: 1px solid var(--play-border);
    border-radius: 20px;
    background: var(--play-surface);
    color: var(--play-ink);
    box-shadow: 0 24px 80px #102a2340;
    text-align: start;
}
.restart-dialog svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.restart-dialog-icon { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; margin-bottom: 20px; border-radius: 15px; background: var(--play-soft); color: var(--play-accent); }
body.puzzle.arcade-site #restart-dialog-title { margin: 0 0 12px; color: var(--play-ink); font-size: 24px; font-weight: 700; line-height: 1.25; text-align: start; }
body.puzzle.arcade-site #restart-dialog-description { padding: 0; margin: 0 0 26px; color: var(--play-muted); font-size: 15px; font-weight: 400; line-height: 1.65; text-align: start; }
body.puzzle.arcade-site #restart-window .restart-dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 0; }
body.puzzle.arcade-site #restart-window button { box-sizing: border-box; margin: 0; padding: 12px 16px; min-height: 48px; max-width: 100%; border: 1px solid var(--play-border); border-radius: 11px; font: 600 15px/1.4 sans-serif; cursor: pointer; overflow-wrap: anywhere; touch-action: manipulation; transition: filter .15s ease, transform .15s ease; }
body.puzzle.arcade-site #restart-window .restart-dialog-cancel { flex: 1 1 100px; background: var(--play-soft); color: var(--play-ink); }
body.puzzle.arcade-site #restart-window .restart-dialog-confirm { flex: 1.5 1 160px; background: linear-gradient(135deg, #bd5658, #a44046); border-color: #973a40; color: #fff; box-shadow: 0 2px 0 #7e3037; }
body.puzzle.arcade-site.dark-mode #restart-window .restart-dialog-confirm { background: linear-gradient(135deg, #d68b87, #c77675); border-color: #b56b6c; color: #30191c; box-shadow: 0 2px 0 #844447; }
body.puzzle.arcade-site #restart-window .restart-dialog-close { position: absolute; top: 14px; right: 14px; display: flex; align-items: center; justify-content: center; width: 36px; min-height: 36px; padding: 6px; background: transparent; border-color: transparent; color: var(--play-muted); }
@media (hover: hover) {
    body.puzzle.arcade-site #restart-window button:hover { filter: brightness(1.08); }
    body.puzzle.arcade-site #restart-window .restart-dialog-close:hover { background: var(--play-soft); }
}
body.puzzle.arcade-site #restart-window button:active { transform: translateY(1px); }
body.puzzle.arcade-site #restart-window button:focus-visible { outline: 3px solid var(--play-accent); outline-offset: 3px; }
@media (max-width: 480px) {
    body.puzzle.arcade-site #restart-window { padding: 16px; }
    body.puzzle.arcade-site #restart-window .restart-dialog { padding: 24px; }
    body.puzzle.arcade-site #restart-dialog-title { font-size: 22px; }
}
body.puzzle.arcade-site.dark-mode #restart-window { background: hsl(var(--hue), 25%, 5%, .68); }
@media print {
    body.puzzle.arcade-site { background: #fff; color: #111; }
    body.puzzle.arcade-site #puzzle .left_side,
    body.puzzle.arcade-site #cv { background: #fff; border-color: #aaa; }
}
