/* A single quiet playing surface, matching the other Wordch puzzles. */
.crossword-page {
    --bg: var(--play-surface);
    --ink: var(--play-ink);
    --muted: var(--play-muted);
    --border: var(--play-border);
    --accent: var(--play-accent);
    --soft: var(--play-soft);
    --error: #af293a;
    margin: 0;
    font: 16px/1.5 sans-serif;
    color-scheme: light;
}
.crossword-page.dark-mode { color-scheme: dark; }
.crossword-page * { box-sizing: border-box; }
.crossword-page a { color: inherit; text-decoration: none; }
.crossword-page a:hover { text-decoration: underline; }
.crossword-page button, .crossword-page input { font: inherit; }
.crossword-page button { cursor: pointer; color: inherit; background: transparent; border: 1px solid var(--border); border-radius: 6px; padding: 10px 14px; min-height: 44px; touch-action: manipulation; }
.crossword-page button:hover { background: var(--soft); }
.crossword-page :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.cw-main, .cw-footer { width: min(1200px, 94%); margin: auto; }
body.crossword-page #top-menu .game-menu-more .game-menu-tools { display: flex; }
body.crossword-page #top-menu #cw-theme { margin-left: auto; }
body.crossword-page #top-menu #cw-theme[aria-pressed="true"] .menu-moon { display: none; }
body.crossword-page #top-menu #cw-theme[aria-pressed="true"] .menu-sun { display: block; }
.cw-main { position: relative; isolation: isolate; padding: 24px 20px 36px; background: var(--bg); }
.cw-main::before { content: ''; position: absolute; inset: 0; z-index: -1; background: var(--bg); box-shadow: 0 0 0 100vmax var(--bg); clip-path: inset(0 -100vmax); }
#cw-progress { margin: 0 0 20px; padding-bottom: 14px; border-bottom: 3px solid var(--soft); color: var(--accent); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cw-play { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); align-items: start; gap: 40px; }
.cw-board-panel { min-width: 0; position: sticky; top: 16px; }
.cw-current { display: grid; grid-template-columns: minmax(0, 1fr) 36px 36px; align-items: start; gap: 8px; min-height: 106px; padding: 0 0 20px; }
.cw-current button { width: 36px; min-height: 36px; padding: 0; border-color: var(--border); font-size: 24px; line-height: 1; }
#cw-prev { grid-column: 2; grid-row: 1; }
#cw-next-word { grid-column: 3; grid-row: 1; }
#cw-current { display: contents; }
.cw-current-meta { grid-column: 1; grid-row: 1; display: block; min-height: 36px; padding-top: 7px; font-size: 12px; color: var(--accent); font-weight: 650; }
.cw-current-text { grid-column: 1 / -1; grid-row: 2; display: block; margin-top: 0; font-size: 18px; line-height: 1.45; font-weight: 600; }
.cw-board-scroll { overflow: auto; max-height: 62vh; padding: 5px; overscroll-behavior: contain; scrollbar-width: thin; }
.crossword-page #cw-grid { --cw-line: #92969b; --cw-outline: #30343b; position: relative; display: grid; grid-template-columns: repeat(var(--cols), var(--cell)); gap: 0; width: max-content; margin: auto; padding: 3px; }
.crossword-page .cw-cell { position: relative; width: var(--cell); height: var(--cell); min-height: 0; padding: clamp(3px, calc(var(--cell) * .14), 7px) 0 0; border: 0;  border-radius: 0; font-size: calc(var(--cell) * .55); line-height: 1; font-weight: 600; background: #fff; color: hsl(var(--hue), 30%, 18%); box-shadow: none; }
.cw-blank { width: var(--cell); height: var(--cell); }
.cw-block { background: #30343b; }
.cw-grid-lines { position: absolute; inset: 3px; width: calc(100% - 6px); height: calc(100% - 6px); overflow: visible; pointer-events: none; z-index: 2; fill: none; stroke: var(--cw-line); stroke-width: 1; stroke-linecap: square; }
.cw-grid-lines .cw-contour { stroke: var(--cw-outline); stroke-width: 2; }
.cw-cell small { position: absolute; top: 2px; left: 3px; font: 500 clamp(8px, calc(var(--cell) * .25), 11px)/1 system-ui; color: hsl(var(--hue), 11%, 36%); }
.crossword-page .cw-cell:hover { background: hsl(var(--hue), 30%, 96%); }
.crossword-page .cw-active-word, .crossword-page .cw-active-word:hover { color: hsl(var(--hue), 37%, 27%); background: hsl(var(--hue), 45%, 89%); }
.crossword-page .cw-cursor, .crossword-page .cw-cursor:hover { color: hsl(var(--hue), 37%, 23%); background: hsl(var(--hue), 45%, 84%); box-shadow: inset 0 0 0 2px hsl(var(--hue), 38%, 31%); z-index: 1; }
.crossword-page .cw-cell:focus-visible { outline-offset: 1px; }
.crossword-page .cw-error { color: var(--error); background: #fff; }
.cw-error::after { content: '!'; position: absolute; right: 3px; bottom: 2px; font: bold 11px system-ui; }
.cw-revealed::before { content: ''; position: absolute; right: 2px; top: 2px; border-top: 5px solid hsl(var(--hue), 34%, 31%); border-left: 5px solid transparent; }
.cw-won { outline: 2px solid var(--accent); outline-offset: 3px; }
.cw-board-tools { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px; padding: 14px 0 4px; color: var(--muted); font-size: 13px; }
.cw-board-tools input { width: 100px; min-height: 32px; accent-color: var(--accent); }
.crossword-page #cw-fit { padding: 4px 8px; min-height: 36px; border-color: transparent; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.cw-input-hint { margin: 6px 0 18px; color: var(--muted); text-align: center; font-size: 13px; }
.cw-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.cw-actions button { font-size: 14px; }
#cw-message { color: var(--accent); font-size: 14px; margin: 12px 0; }
#cw-message:empty { display: none; }
.cw-result { scroll-margin-top: 16px; }
#cw-message.cw-victory { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 0 0 16px; padding: 20px; border: 1px solid var(--accent); border-radius: 12px; background: var(--soft); color: var(--ink); font-size: clamp(20px, 2.4vw, 26px); line-height: 1.4; font-weight: 700; text-wrap: balance; }
#cw-message.cw-victory::before { content: '✓'; flex: none; color: var(--accent); font-size: 32px; line-height: 1; }
.cw-win-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 28px; }
.cw-win-actions[hidden], .cw-bottom[hidden] { display: none; }
.crossword-page #cw-restart-win { min-height: 52px; 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%); box-shadow: 0 2px 0 hsl(var(--hue), 35%, 35%, .12); font-size: 16px; line-height: 1.4; font-weight: 700; }
.crossword-page.dark-mode #cw-restart-win { background: var(--soft); border-color: var(--border); color: var(--ink); box-shadow: 0 2px 0 #0002; }
.crossword-page .cw-win-actions .cw-next-puzzle { margin-bottom: 0; }
@media (max-width: 700px) { .cw-win-actions { grid-template-columns: 1fr; } }
.crossword-page .cw-next-puzzle { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 52px; margin: 0 0 16px; padding: 12px 16px; border: 1px solid hsl(var(--hue), 55%, 30%); border-radius: 12px; background: linear-gradient(135deg, hsl(var(--hue), 58%, 40%), hsl(var(--hue), 58%, 32%)); color: #fff; box-shadow: 0 3px 0 hsl(var(--hue), 48%, 24%), 0 6px 14px hsl(var(--hue), 50%, 25%, .16); font-size: 16px; line-height: 1.4; font-weight: 700; text-align: center; text-decoration: none; touch-action: manipulation; }
.crossword-page .cw-next-puzzle[hidden] { display: none; }
.cw-next-puzzle svg { flex: 0 0 20px; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.crossword-page.dark-mode .cw-next-puzzle { 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; }
@media (hover: hover) { .crossword-page .cw-next-puzzle:hover { filter: brightness(1.06); transform: translateY(-1px); text-decoration: none; } }
.crossword-page .cw-next-puzzle:active { transform: translateY(1px); box-shadow: none; }
.cw-muted { color: var(--muted); font-size: 12px; text-align: center; margin: 16px 0; }
.cw-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 16px; margin-top: 18px; border-top: 1px solid var(--border); font-size: 14px; }
.crossword-page #cw-restart { border-color: transparent; padding-inline: 0; color: var(--muted); }
.cw-primary { display: inline-flex; align-items: center; min-height: 44px; color: inherit; font-weight: 650; }
.cw-clues { min-width: 0; }
.cw-clues section + section { margin-top: 24px; }
.cw-clues h2 { font-size: 19px; margin: 0 0 12px; padding: 0 0 12px; border-bottom: 1px solid var(--border); }
.cw-clues ol { list-style: none; padding: 0; margin: 0; }
.crossword-page .cw-clue { display: flex; gap: 12px; text-align: left; border: 0; border-left: 2px solid transparent; border-radius: 0; width: 100%; padding: 11px 10px; font-size: 16px; line-height: 1.5; }
.cw-clue strong { flex: none; min-width: 22px; color: var(--muted); font-size: 14px; padding-top: 2px; }
.cw-clue small { font-size: 13px; color: var(--muted); white-space: nowrap; }
.cw-clue-status { margin-left: auto; color: var(--accent); }
.crossword-page .cw-clue.cw-selected { border-left-color: var(--accent); color: var(--accent); font-weight: 600; }
.cw-clue.cw-selected strong { color: var(--accent); }
.cw-rules { border-top: 1px solid var(--border); margin-top: 32px; padding-top: 20px; color: var(--muted); font-size: 14px; }
.cw-rules summary { cursor: pointer; font-weight: 600; color: var(--ink); min-height: 44px; }
.cw-footer { padding: 0 20px 24px; color: #e6f3eb; font-size: 12px; padding-top: 20px; }
#cw-keyboard { display: none; }
@media (max-width: 950px) { .cw-play { gap: 24px; grid-template-columns: minmax(0, 1.2fr) minmax(280px, 1fr); } }
@media (max-width: 700px) {
    .cw-main, .cw-footer { width: 100%; padding-inline: 16px; }
    .cw-play { display: flex; flex-direction: column; gap: 32px; }
    .cw-board-panel { position: static; width: 100%; }
    .cw-current { min-height: 100px; gap: 6px; padding-bottom: 16px; }
    .cw-current-text { font-size: 16px; }
    .cw-board-scroll { max-height: 48vh; }
    .cw-clues { width: 100%; }
    .cw-input-hint { display: none; }
    .cw-bottom { gap: 8px; }
}
@media (max-width: 700px), (pointer: coarse) {
    #cw-keyboard { display: block; padding: 10px 0 0; }
    #cw-keyboard > div { display: flex; justify-content: center; gap: 3px; margin: 5px 0; }
    #cw-keyboard button { min-width: 0; flex: 1; max-width: 44px; min-height: 44px; padding: 0; border-color: transparent; border-bottom-color: var(--border); border-radius: 3px; font-size: 17px; font-weight: 600; }
}
@media (prefers-reduced-motion: no-preference) {
    .cw-clue, .cw-cell { transition: background-color .12s ease, color .12s ease, border-color .12s ease; }
}

@media (max-width: 950px) {
    body.crossword-page #top-menu .game-menu-tools #cw-theme { margin-left: 0; }
}
