/* Crossword — page styles (uses tokens from ../assets/site.css) */

.picker { display: flex; align-items: center; gap: 8px; }
.btn.icon { width: 40px; height: 40px; padding: 0; font-size: 22px; line-height: 1; display: grid; place-items: center; }
.picker-label { display: flex; flex-direction: column; align-items: center; min-width: 120px; }
.picker-num { font-family: var(--font-display); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.picker-title { font-family: var(--font-display); font-weight: 600; font-size: 17px; white-space: nowrap; }
.picker-title .done-tick { color: var(--good); margin-left: 6px; }

.cw-layout { display: grid; grid-template-columns: minmax(0, 460px) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 860px) { .cw-layout { grid-template-columns: minmax(0, 1fr); } }

.board-panel { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.board-top { display: flex; justify-content: space-between; align-items: center; }
.stat.right { align-items: flex-end; }

/* ---- clue bar ---- */
.clue-bar {
  display: flex; align-items: stretch; gap: 0;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  min-height: 56px;
}
.clue-nav {
  appearance: none; border: 0; background: transparent; color: var(--muted); font-size: 24px; width: 40px; flex: none;
  cursor: pointer; font-family: var(--font-display);
}
.clue-nav:hover { color: var(--text); background: rgba(255,255,255,.04); }
.clue-bar-text {
  appearance: none; border: 0; background: transparent; color: var(--text); cursor: pointer; flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px 4px; font: 500 15px/1.3 var(--font-body);
}
.clue-bar-num {
  flex: none; font-family: var(--font-display); font-weight: 700; font-size: 13px; color: var(--accent-ink);
  background: var(--accent); border-radius: 6px; padding: 4px 7px;
}

/* ---- grid ---- */
.grid-wrap { position: relative; width: 100%; max-width: 420px; margin: 0 auto; }
.cw-grid {
  display: grid; gap: 3px; padding: 3px; border-radius: 12px; background: var(--line);
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.cell {
  position: relative; aspect-ratio: 1 / 1; background: #f4f5ff; color: #12132b; border-radius: 4px;
  display: grid; place-items: center; cursor: pointer; transition: background .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.cell.block { background: #0b0c1c; cursor: default; }
.cell .num {
  position: absolute; top: 3px; left: 5px; font: 600 clamp(9px, 2.6vw, 12px)/1 var(--font-display); color: #4a4e86;
}
.cell .letter {
  font: 700 clamp(22px, 8vw, 38px)/1 var(--font-display); text-transform: uppercase; margin-top: 6%;
}
.cell.in-word { background: #c9f0ec; }
.cell.active { background: var(--accent); }
.cell.wrong .letter { color: #d12f3f; }
.cell.wrong::after {
  content: ""; position: absolute; inset: 0; border-radius: 4px;
  background: linear-gradient(to top right, transparent calc(50% - 1.5px), rgba(209,47,63,.75) calc(50% - 1.5px), rgba(209,47,63,.75) calc(50% + 1.5px), transparent calc(50% + 1.5px));
  pointer-events: none;
}
.cell.revealed .letter { color: #2a6fdb; }
.cell.revealed::before {
  content: ""; position: absolute; top: 0; right: 0; width: 0; height: 0;
  border-top: 9px solid #2a6fdb; border-left: 9px solid transparent; border-top-right-radius: 4px;
}
.cell.good-flash { animation: goodflash .5s ease; }
@keyframes goodflash { 50% { background: #9be8ad; } }
.cw-grid.solved .cell:not(.block) { background: #d8f7df; }
.cw-grid.solved .cell.active, .cw-grid.solved .cell.in-word { background: #d8f7df; }

.hidden-input {
  position: absolute; top: 0; left: 0; width: 40px; height: 40px; opacity: 0; border: 0; padding: 0; margin: 0;
  font-size: 16px; /* prevents iOS zoom-on-focus */ background: transparent; color: transparent; caret-color: transparent;
  pointer-events: none; z-index: -1;
}

/* ---- actions ---- */
.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.btn.sm { padding: 8px 12px; font-size: 13px; }
.hint-line { margin: 0; text-align: center; color: var(--muted); font-size: 12.5px; }
@media (hover: none) { .kbd-only { display: none; } }

/* ---- clue lists ---- */
.clues-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; min-width: 0; }
@media (max-width: 520px) { .clues-panel { grid-template-columns: 1fr; } }
.clue-col h3 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.clue-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.clue-list li {
  display: flex; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; line-height: 1.35; font-size: 15px;
  border-left: 3px solid transparent; transition: background .12s ease;
}
.clue-list li:hover { background: rgba(255,255,255,.04); }
.clue-list li .n { font-family: var(--font-display); font-weight: 700; min-width: 18px; color: var(--muted); }
.clue-list li.active { background: rgba(255, 204, 51, .14); border-left-color: var(--accent); }
.clue-list li.active .n { color: var(--accent); }
.clue-list li.cross { background: rgba(79, 209, 197, .09); border-left-color: var(--accent-2); }
.clue-list li.filled .t { color: var(--muted); }
.clue-list li.correct .t { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(94,224,122,.6); }

/* ---- toast ---- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text); padding: 10px 16px; border-radius: 999px;
  box-shadow: var(--shadow); font-weight: 500; font-size: 14px; transition: opacity .2s ease, transform .2s ease; z-index: 60;
  max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- modal extras ---- */
.win-badge {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 12px; display: grid; place-items: center;
  background: var(--accent-2); color: #062a27; font-size: 32px; font-weight: 700;
}
.btn-row.center { justify-content: center; margin-top: 8px; }

@media (max-width: 420px) {
  .panel { padding: 12px; }
  .picker-label { min-width: 0; }
  .game-head { align-items: center; }
}
