/* Mini Crossword - uses the shared tokens from /css/fd.css */
.cw { margin-bottom: 8px; }
.cw-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.cw-timer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--muted); min-width: 4.5em; }
.cw-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.cw-tools[hidden] { display: none; }
.cw-tools .btn { padding: 8px 14px; font-size: .92rem; }
.cw-tools .cw-quit { color: var(--muted); }

.cw-cluebar { display: flex; align-items: stretch; gap: 4px; background: var(--tint); border-radius: 12px; margin: 0 auto 12px;
  max-width: 420px; min-height: 56px; cursor: pointer; user-select: none; }
.cw-clue-now { flex: 1; margin: 0; padding: 8px 4px; display: flex; align-items: center; gap: 8px; line-height: 1.3; font-size: 1.02rem; }
.cw-clue-now b { color: var(--accent); font-variant-numeric: tabular-nums; min-width: 2.2em; }
.cw-arrow { appearance: none; border: 0; background: transparent; color: var(--accent); font: 700 1.6rem/1 var(--font);
  min-width: 44px; min-height: 44px; border-radius: 12px; cursor: pointer; }
.cw-arrow:hover { background: rgb(0 0 0 / 5%); }

.cw-board { position: relative; width: min(100%, 420px); margin: 0 auto; }
.cw-grid { position: relative; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-template-rows: repeat(5, minmax(0, 1fr)); aspect-ratio: 1; background: var(--card);
  border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; touch-action: manipulation; cursor: pointer;
  transition: border-color .4s, box-shadow .4s; }
.cw-grid.focused { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.cw-cell { position: relative; z-index: 1; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; overflow: hidden; transition: background-color .18s; }
.cw-cell:nth-child(5n + 6) { border-right: 0; } /* child 1 is the highlight tile, so right-column cells are 6, 11, ... */
.cw-cell:nth-last-child(-n + 5) { border-bottom: 0; }
.cw-cell.black { background: var(--ink); }
.cw-cell.cur { background: color-mix(in srgb, var(--accent) 38%, transparent); }
.cw-num { position: absolute; top: 3px; left: 5px; font-size: clamp(.6rem, 2.6vw, .78rem); font-weight: 600; color: var(--muted); line-height: 1; }
.cw-letter { font-size: clamp(1.5rem, 9vw, 2.3rem); font-weight: 700; text-transform: uppercase; line-height: 1; }
.cw-cell.wrong .cw-letter { color: var(--bad); }
.cw-cell.wrong::after { content: "✗"; position: absolute; right: 4px; bottom: 2px; font-size: .7rem; color: var(--bad); font-weight: 700; }
.cw-cell.revealed .cw-letter { color: #1c7ed6; }
.cw-cell.revealed::before { content: ""; position: absolute; top: 0; right: 0; border: 7px solid transparent;
  border-top-color: #1c7ed6; border-right-color: #1c7ed6; }

/* the sliding word highlight */
.cw-hi { position: absolute; z-index: 0; background: var(--tint); border-radius: 6px; pointer-events: none;
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent);
  transition: left .22s cubic-bezier(.3, .7, .2, 1), top .22s cubic-bezier(.3, .7, .2, 1),
    width .22s cubic-bezier(.3, .7, .2, 1), height .22s cubic-bezier(.3, .7, .2, 1), opacity .2s; }

/* the hidden input sits under the board so the phone keyboard opens without page jumps */
.cw-input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0;
  font-size: 16px; pointer-events: none; caret-color: transparent; }

.cw-live { min-height: 1.5em; text-align: center; color: var(--muted); font-size: .92rem; margin: 8px 0 0; }

.cw-lists { display: grid; grid-template-columns: 1fr; gap: 0 20px; }
@media (min-width: 560px) { .cw-lists { grid-template-columns: 1fr 1fr; } }
.cw-lists h2 { margin: 18px 0 6px; font-size: .95rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.cw-list { list-style: none; margin: 0; padding: 0; }
.cw-clue { appearance: none; display: flex; gap: 10px; width: 100%; text-align: left; border: 0; background: transparent; color: var(--ink);
  font: .98rem/1.35 var(--font); padding: 10px 10px; min-height: 44px; border-radius: 10px; cursor: pointer;
  border-left: 3px solid transparent; transition: background-color .18s, border-color .18s; }
.cw-clue b { min-width: 1.4em; color: var(--muted); }
.cw-clue.on { background: var(--tint); border-left-color: var(--accent); }
.cw-clue.on b { color: var(--accent); }
.cw-clue.filled span { color: var(--muted); }

/* solved: the board turns green and every square flips in a diagonal wave */
.cw-grid.solved { border-color: var(--good); box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 25%, transparent); cursor: default; }
.cw-grid.solved .cw-cell:not(.black) { background: color-mix(in srgb, var(--good) 14%, transparent); }
.cw-grid.pop .cw-cell:not(.black) { animation: cw-flip .55s cubic-bezier(.3, .7, .3, 1) both; animation-delay: var(--d, 0ms); }
@keyframes cw-flip { 0% { transform: rotateX(0); } 45% { transform: rotateX(90deg) scale(1.04); }
  100% { transform: rotateX(0); background: color-mix(in srgb, var(--good) 14%, transparent); } }

.cw-verdict { margin: 0; font-weight: 700; color: var(--good); text-transform: uppercase; letter-spacing: .08em; font-size: .85rem; }
.cw-sub { margin: 0 0 6px; }
.cw-links { margin: 14px 0 0; }

.cw-archive { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.cw-archive a { display: flex; gap: 12px; align-items: center; min-height: 48px; padding: 8px 14px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.cw-archive a:hover { border-color: var(--accent); }
.cw-archive small { color: var(--muted); }
.cw-archive .done { margin-left: auto; color: var(--good); font-weight: 600; }
.cw-cluebar[hidden] { display: none; }
