.crossword-player { color: var(--ink); min-width: 0; }
.is-crossword .game-play-dialog { display: flex; flex-direction: column; overflow: hidden; max-height: calc(100dvh - 24px); }
.is-crossword .game-play-dialog > .modal-close { position: absolute; right: 16px; top: 12px; margin: 0; float: none; }
.crossword-dialog-toolbar { flex: 0 0 44px; border-bottom: 1px solid var(--line); margin-bottom: 16px; padding-right: 52px; font-size: 14px; color: var(--muted); }
.is-crossword .game-play-area { overflow: auto; min-height: 0; overscroll-behavior: contain; padding-right: 4px; }
.crossword-heading { display: flex; justify-content: space-between; align-items: start; gap: 16px; padding: 4px 0 20px; border-bottom: 1px solid var(--line); }
.crossword-heading h2 { font-size: 24px; line-height: 1.3; margin: 10px 0 6px; overflow-wrap: anywhere; }
.crossword-heading p { color: var(--muted); margin: 0; }
.crossword-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(240px, 1fr); gap: 24px; margin-top: 20px; }
.crossword-board-area { min-width: 0; }
.crossword-active-clue { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 62px; margin-bottom: 12px; }
.crossword-active-clue > span { font-weight: 600; line-height: 1.5; }
.crossword-active-clue button { flex-shrink: 0; }
.crossword-scroll { overflow: auto; max-width: 100%; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); padding: 12px; }
.crossword-grid { --cw-size: 36px; display: grid; grid-template-columns: repeat(var(--cw-cols), var(--cw-size)); grid-auto-rows: var(--cw-size); gap: 2px; width: max-content; margin: auto; }
.crossword-cell { display: flex; position: relative; align-items: center; justify-content: center; background: var(--surface-strong); border: 1px solid var(--line); border-radius: 3px; min-width: 0; color: var(--ink); }
.crossword-cell input { appearance: none; width: 100%; height: 100%; min-width: 0; min-height: 0; padding: 9px 1px 1px; border: 0; border-radius: 2px; outline: 0; background: transparent; color: inherit; font: 600 18px/1 system-ui, sans-serif; text-align: center; box-shadow: none; }
.crossword-number { position: absolute; left: 3px; top: 1px; font: 600 9px/1.2 system-ui, sans-serif; pointer-events: none; }
.crossword-cell.is-active { background: color-mix(in srgb, var(--teal) 14%, var(--surface-strong)); border-color: var(--teal); }
.crossword-cell b { padding-top: 6px; font: 600 17px/1 system-ui, sans-serif; }
.crossword-cell:focus-within { outline: 2px solid var(--teal); outline-offset: 0; z-index: 1; }
.crossword-cell.is-wrong { background: #fbe6e4; color: #9c2927; border-color: #c34b49; }
.crossword-cell.is-correct { background: #e0f1e6; color: #246342; border-color: #3c8d63; }
[data-theme="dark"] .crossword-cell.is-wrong { background: #493233; color: #ffbeb9; border-color: #d48581; }
[data-theme="dark"] .crossword-cell.is-correct { background: #29453a; color: #b7e9c9; border-color: #77b88e; }
.crossword-block { background: #344247; border-radius: 2px; }
[data-theme="dark"] .crossword-block { background: #172023; }
[data-theme="sun"] .crossword-block { background: #49443b; }
.game-type-icon.is-puzzle > span { font-size: 32px; line-height: 1; }
.crossword-clues { min-width: 0; border-left: 1px solid var(--line); padding-left: 20px; }
.crossword-clues h3 { font-size: 16px; margin: 8px 0 12px; }
.crossword-clues ol { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 4px; }
.crossword-clues button { display: grid; grid-template-columns: 24px minmax(0, 1fr) 16px; width: 100%; text-align: left; gap: 8px; background: transparent; color: var(--ink); border: 1px solid transparent; border-radius: 6px; padding: 10px 8px; font: 400 14px/1.5 system-ui, sans-serif; cursor: pointer; }
.crossword-clues button.is-active { background: color-mix(in srgb, var(--teal) 12%, transparent); border-color: var(--line); }
.crossword-clues small { color: var(--muted); white-space: nowrap; }
.crossword-clues [data-cw-clue-status] { color: var(--teal); }
.crossword-answer-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; margin-top: 16px; }
.crossword-answer-form label { grid-column: 1 / -1; color: var(--muted); font-size: 13px; }
.crossword-answer-form input { width: 100%; min-width: 0; min-height: 44px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-strong); color: var(--ink); font: 500 16px/1.3 system-ui, sans-serif; }
.crossword-footer { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.crossword-footer p { flex: 1 1 180px; margin: 0; font-size: 14px; }
.crossword-footer button, .crossword-answer-form button { min-height: 44px; white-space: nowrap; }
.crossword-preview-summary { font-weight: 600; color: var(--ink); }
.admin-crossword-row { grid-template-columns: 32px minmax(0, 1fr) minmax(140px, .7fr) 42px !important; }
.admin-crossword-row label { min-width: 0; }
.admin-game-form-panel, #gameForm, #gameForm > *, .admin-crossword-preview { min-width: 0; }
#gameForm { grid-template-columns: minmax(0, 1fr); }
.admin-crossword-preview { margin-top: 16px; max-width: 100%; }
.crossword-preview-status { color: var(--muted); }
@media (max-width: 800px) {
  .crossword-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .crossword-clues { border-left: 0; border-top: 1px solid var(--line); padding: 16px 0 0; }
  .crossword-heading h2 { font-size: 21px; }
  .admin-crossword-row { grid-template-columns: 28px minmax(0, 1fr) 40px !important; }
  .admin-crossword-row label { grid-column: 2; }
  .admin-crossword-row .admin-game-pair-remove { grid-column: 3; grid-row: 1; }
}
@media (max-width: 420px) {
  .crossword-grid { --cw-size: 32px; }
  .crossword-scroll { padding: 6px; }
  .crossword-active-clue { flex-wrap: wrap; }
  .crossword-footer button { flex: 1 1 120px; }
  .crossword-answer-form { grid-template-columns: minmax(0, 1fr); }
}
