/* Cross Quiz (/games/quizzes/cross-quiz/) */
.cq [hidden] { display: none !important; }

/* options row */
.cq-opts { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 12px; }
.cq-opts > label { display: grid; gap: 4px; color: var(--muted); font-size: 13px; }
.cq-opts .field { min-width: 0; }
.cq-cats { position: relative; }
.cq-cats summary { display: block; min-width: 160px; cursor: pointer; list-style: none; }
.cq-cats summary::-webkit-details-marker { display: none; }
.cq-cats summary::after { content: ""; display: inline-block; margin-left: 10px; border: 5px solid transparent; border-top-color: var(--muted); vertical-align: -2px; }
.cq-cats-box {
    position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; display: grid; gap: 12px;
    width: min(340px, calc(100vw - 32px)); max-height: 60vh; overflow-y: auto; padding: 14px 16px;
    background: var(--sunken); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--lift);
}
.cq-cats-box p { margin: 0; font-size: 13px; }
.cq-cats-box fieldset { display: grid; margin: 0; padding: 0; border: 0; }
.cq-cats-box legend { margin-bottom: 4px; padding: 0; color: var(--muted); font-size: 13px; }
.cq-cats-box small { margin-left: auto; font-size: 12px; }
.cq-meta { margin: 0 0 16px; font-size: 13px; }

/* board and clues side by side when there's room */
.cq-play { display: grid; gap: 24px; align-items: start; }
@media (min-width: 900px) {
    .cq-play { grid-template-columns: minmax(0, auto) minmax(300px, 1fr); }
    .cq-board { position: sticky; top: 12px; }
    .cq-clues { max-height: calc(100vh - 40px); overflow-y: auto; }
}
.cq-board { display: grid; gap: 12px; min-width: 0; }

/* the clue you're on */
.cq-now { position: sticky; top: 0; z-index: 40; padding: 10px 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.cq-now p { margin: 0; }
.cq-now-q b { color: var(--accent); }
.cq-now .cq-now-meta { margin: 4px 0 10px; font-size: 13px; }
.cq-opts-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
@media (min-width: 900px) { .cq-now { position: static; } }

/* grid: squares shrink to fit narrow screens */
.cq-grid-wrap { position: relative; justify-self: start; max-width: 100%; }
.cq-grid {
    --cell: min(36px, calc((100vw - 34px - (var(--cols) - 1) * 1px) / var(--cols)));
    display: grid; grid-template-columns: repeat(var(--cols), var(--cell)); grid-auto-rows: var(--cell);
    gap: 1px; user-select: none; -webkit-user-select: none;
}
.cq-x { background: transparent; }
.cq-c {
    position: relative; display: grid; place-items: center; background: var(--card2); border: 1px solid var(--line-strong);
    border-radius: 4px; cursor: pointer; transition: background-color var(--fast), border-color var(--fast);
}
.cq-c small { position: absolute; top: 1px; left: 3px; color: var(--muted); font-size: max(8px, calc(var(--cell) * .26)); line-height: 1; }
.cq-c b { font-size: calc(var(--cell) * .55); font-weight: 600; line-height: 1; }
.cq-c.word { background: var(--accent-soft); }
.cq-grid.focus .cq-c.cur, .cq-c.cur { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cq-c.bad { background: var(--danger-bg); border-color: var(--danger-line); }
.cq-c.rev b { color: var(--muted); }
.cq-grid.done .cq-c { background: var(--ok-bg); border-color: var(--ok-line); }
.cq-input {
    position: absolute; top: 0; left: 0; width: 1px; height: 1px; padding: 0; border: 0;
    opacity: 0; font-size: 16px; caret-color: transparent; pointer-events: none;
}
.cq-time { min-width: 48px; color: var(--muted); font-size: 13px; }

/* clue lists */
.cq-clues .sec-h { margin: 0 0 12px; }
.cq-clues section + section { margin-top: 28px; }
.cq-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.cq-list li { display: flex; gap: 10px; padding: 8px 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); font-size: 14px; cursor: pointer; transition: border-color var(--fast), background-color var(--fast); }
.cq-list li:hover { border-color: var(--accent); }
.cq-list li.on { background: var(--accent-soft); border-color: var(--btn-line); }
.cq-list li > b { flex: none; min-width: 20px; color: var(--muted); }
.cq-credit { margin-top: 28px; font-size: 13px; }

@media print {
    .site-header, .site-footer, .crumbs, .cq-opts, .cq-now, .cq-tools, .cq-credit, .toasts { display: none !important; }
    .cq-play { grid-template-columns: 1fr; }
    .cq-clues { max-height: none; overflow: visible; }
    .cq-c, .cq-c.word, .cq-grid.done .cq-c { background: #fff; border-color: #000; box-shadow: none; color: #000; }
    .cq-list li, .cq-list li.on { background: none; border: 0; padding: 2px 0; color: #000; }
}
