:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --fg: #1d1c1a;
  --muted: #6b6862;
  --border: #dedbd3;
  --accent: #2563a8;
  --accent-soft: #d6e6f7;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.app { max-width: 920px; margin: 0 auto; padding: 16px; }

.bar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 20px; }
.title { margin: 0; font-size: 28px; line-height: 1.1; font-weight: 650; letter-spacing: -0.01em; }
.controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-size: 12px; color: var(--muted); letter-spacing: 0.02em; }
select, .btn {
  min-height: 44px; font: inherit; font-size: 15px; color: var(--fg);
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); padding: 0 12px;
}
.btn { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; letter-spacing: 0.02em; padding: 0 18px; cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
select:focus-visible, .btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.board { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 32px; align-items: start; }
.grid {
  --n: 12;
  display: grid; grid-template-columns: repeat(var(--n), 1fr);
  width: 100%; max-width: 600px; aspect-ratio: 1;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 6px;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.cell {
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: clamp(14px, 4.4vw, 22px); border-radius: 6px; cursor: pointer;
  transition: background-color 120ms ease-out;
}
.cell.sel { background: var(--accent-soft) !important; color: var(--accent); }

.status { margin: 0 0 12px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.words { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.words li { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: 14px; font-weight: 600; letter-spacing: 0.06em; }
.words li.done { text-decoration: line-through; color: var(--muted); border-color: transparent; }
.message { margin: 16px 0 0; font-size: 14px; color: var(--fg); }

@media (max-width: 720px) {
  .board { grid-template-columns: 1fr; gap: 20px; }
  .grid { max-width: none; }
  .title { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) { .cell { transition: none; } }
