/*
 * Query Noir styles: the SQL detective game mounted at #as-qn (page-query-noir.hbs and
 * the local harness paste-ready/demos/query-noir.html).
 * Everything is scoped under #as-qn so theme styles never leak in or out; theme resets
 * (margins, max-width on prose) are neutralised with !important only where Ghost forces them.
 */
/* Ghost page (page-query-noir.hbs): edge to edge under the fixed site nav, footer hidden so
   the game is the whole screen. Page notes (the Ghost editor content) sit below the game. */
body.page-query-noir .site-footer { display: none; }
.qn-page { padding-top: var(--nav-h, 0px); background: #0d111d; }
.qn-page #as-qn { --qn-top: var(--nav-h, 0px); }
.qn-page-notes { max-width: 720px; margin: 0 auto; padding: 40px 24px; color: rgba(238, 241, 248, 0.74); }

#as-qn, #as-qn * { box-sizing: border-box; }
#as-qn {
  --qn-bg: #0d111d;
  --qn-panel: #151a2b;
  --qn-panel2: #1c2238;
  --qn-line: rgba(238, 241, 248, 0.1);
  --qn-ink: #eef1f8;
  --qn-ink2: rgba(238, 241, 248, 0.74);
  --qn-ink3: rgba(238, 241, 248, 0.5);
  --qn-accent: #ff6a00;
  --qn-accent2: #ff3d00;
  --qn-good: #3ddc97;
  --qn-bad: #ff5c7a;
  --qn-gold: #ffc94d;
  --qn-paper: #f3ead7;
  --qn-paper-ink: #2b2118;
  --qn-ease: cubic-bezier(0.23, 1, 0.32, 1);
  --qn-sans: "SF Pro Text", -apple-system, BlinkMacSystemFont, ui-sans-serif, system-ui, "Segoe UI", Helvetica, Arial, sans-serif;
  --qn-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --qn-fs: 14px;
  --qn-code: 14px;
  position: relative;
  font-family: var(--qn-sans);
  font-size: var(--qn-fs) !important;
  line-height: 1.5 !important;
  color: var(--qn-ink);
  background: var(--qn-bg);
  overflow: hidden;
  width: 100%;
  margin: 0;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
#as-qn.qn-presenter { --qn-fs: 17px; --qn-code: 19px; }
#as-qn h2, #as-qn h3, #as-qn h4, #as-qn p, #as-qn ul, #as-qn ol, #as-qn li, #as-qn table, #as-qn pre, #as-qn code {
  margin: 0 !important; padding: 0; max-width: none !important; border: none; background: transparent;
  color: inherit; font-family: inherit; letter-spacing: normal; text-transform: none;
}
#as-qn button, #as-qn input, #as-qn textarea { font: inherit; color: inherit; }
#as-qn button { cursor: pointer; }
#as-qn code { font-family: var(--qn-mono); font-size: 0.92em; background: rgba(255, 106, 0, 0.14); color: #ffb37a; padding: 1px 6px; border-radius: 6px; }
#as-qn [hidden] { display: none !important; }

/* ── Buttons ── */
#as-qn .qn-btn {
  appearance: none; border: 0; border-radius: 12px; padding: 10px 16px; min-height: 40px;
  background: var(--qn-panel2); color: var(--qn-ink); font-weight: 600; font-size: 0.95em;
  box-shadow: inset 0 0 0 1px var(--qn-line);
  transition: transform 140ms var(--qn-ease), background-color 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}
#as-qn .qn-btn:hover { background: #252c47; }
#as-qn .qn-btn:active { transform: scale(0.96); }
#as-qn .qn-btn:disabled { opacity: 0.45; cursor: not-allowed; }
#as-qn .qn-btn-primary { background: linear-gradient(180deg, var(--qn-accent), var(--qn-accent2)); color: #fff; box-shadow: 0 8px 24px -10px rgba(255, 106, 0, 0.8); }
#as-qn .qn-btn-primary:hover { background: linear-gradient(180deg, #ff7a1a, var(--qn-accent2)); }
#as-qn .qn-btn-ghost { background: transparent; box-shadow: none; color: var(--qn-ink2); }
#as-qn .qn-btn-ghost:hover { background: rgba(255, 255, 255, 0.06); color: var(--qn-ink); }
#as-qn .qn-icon-btn { min-width: 40px; padding: 8px 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
#as-qn .qn-icon-btn svg { width: 18px; height: 18px; }

/* ── HUD ── */
#as-qn .qn-hud { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; background: #0a0d17; box-shadow: inset 0 -1px 0 var(--qn-line); }
#as-qn .qn-brand { font-weight: 800; letter-spacing: 0.12em; font-size: 1.05em; }
#as-qn .qn-brand span { color: var(--qn-accent); }
#as-qn .qn-company { font-size: 0.85em; color: var(--qn-ink2); background: var(--qn-panel2); padding: 4px 10px; border-radius: 999px; }
#as-qn .qn-meter { display: flex; align-items: center; gap: 8px; margin-left: auto; }
#as-qn .qn-meter-label { font-size: 0.8em; color: var(--qn-ink3); text-transform: uppercase; letter-spacing: 0.08em; }
#as-qn .qn-meter-num { font-weight: 800; font-size: 1.2em; min-width: 2.2ch; text-align: right; }
#as-qn .qn-meter-bar { width: 110px; height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
#as-qn .qn-meter-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--qn-accent), var(--qn-gold)); transition: width 600ms var(--qn-ease); }
#as-qn .qn-rank { font-size: 0.85em; font-weight: 700; color: var(--qn-gold); }
#as-qn .qn-stat { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 0.9em; }
#as-qn .qn-stat svg { width: 16px; height: 16px; }
#as-qn .qn-combo { color: var(--qn-accent); transition: transform 200ms var(--qn-ease); }
#as-qn .qn-combo.is-hot svg { filter: drop-shadow(0 0 6px rgba(255, 106, 0, 0.9)); }
#as-qn .qn-combo.is-bump { transform: scale(1.25); }
#as-qn .qn-hud-actions { display: flex; gap: 4px; }

/* ── Scene ── */
#as-qn .qn-scene { position: relative; background: #0a0d17; }
#as-qn .qn-canvas { display: block; width: 100%; aspect-ratio: 320 / 110; image-rendering: pixelated; }
#as-qn .qn-bubble {
  position: absolute; left: 21%; top: 7%; max-width: 40%; padding: 10px 14px; border-radius: 14px;
  background: var(--qn-paper); color: var(--qn-paper-ink); font-size: 0.92em; font-weight: 500; line-height: 1.4;
  box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.7); transform-origin: 0 100%;
  transition: opacity 200ms ease, transform 240ms var(--qn-ease);
}
#as-qn .qn-bubble::after { content: ""; position: absolute; left: -7px; bottom: 14px; border: 8px solid transparent; border-right-color: var(--qn-paper); border-left: 0; }
#as-qn .qn-bubble.is-hidden { opacity: 0; transform: scale(0.95); }
#as-qn .qn-bubble code { background: rgba(0, 0, 0, 0.08); color: #b24a00; }
#as-qn .qn-scene-view { position: relative; }
#as-qn .qn-deck { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 12px; padding: 0 14px; }
#as-qn .qn-deck > .qn-panel:not([hidden]) { margin: 14px 0; }
/* Laptop and up: the case card sits inside the office, the detective works the left side. */
@media (min-width: 900px) {
  #as-qn .qn-scene-view { display: grid; grid-template-columns: minmax(0, 40%) minmax(0, 1fr); min-height: 340px; }
  /* In-flow spacer keeps the room at its 320:110 shape (padding % = 40% column width), yet lets a tall case card grow the scene. */
  #as-qn .qn-scene-view::before { content: ""; grid-column: 1; grid-row: 1; padding-top: calc(100% * 110 / 320 / 0.4); }
  #as-qn .qn-scene-view > .qn-canvas { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; object-fit: cover; object-position: left center; }
  /* The case card is the detective's laptop, seen zoomed in: bezel + webcam + hinge/base. */
  #as-qn .qn-deck {
    grid-column: 2; grid-row: 1; align-self: center; margin: 18px 22px 34px 4px; padding: 16px 14px 14px;
    border-radius: 18px 18px 8px 8px; background: linear-gradient(180deg, #1d2130, #10131c);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 36px 60px -24px rgba(0, 0, 0, 0.95);
    animation: qn-laptop-in 420ms var(--qn-ease);
  }
  #as-qn .qn-deck::before {
    content: ""; position: absolute; top: 6px; left: 50%; width: 5px; height: 5px; border-radius: 50%; transform: translateX(-50%);
    background: #1b2233; box-shadow: 0 0 0 1px #07090e, inset 0 0 1px 1px rgba(90, 140, 255, 0.5);
  }
  #as-qn .qn-deck::after {
    content: ""; position: absolute; left: -3%; right: -3%; bottom: -16px; height: 16px; border-radius: 2px 2px 16px 16px;
    background: linear-gradient(90deg, transparent 42%, rgba(0, 0, 0, 0.28) 42%, rgba(0, 0, 0, 0.28) 58%, transparent 58%) top / 100% 5px no-repeat, linear-gradient(180deg, #cfd4de, #8b91a1);
    box-shadow: 0 14px 22px -10px rgba(0, 0, 0, 0.9);
  }
  #as-qn .qn-deck > .qn-panel:not([hidden]) {
    position: relative; margin: 0; border-radius: 6px; overflow: hidden;
    background: radial-gradient(ellipse at 25% 0%, #1f2846, #121626 70%);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.7), inset 0 0 50px rgba(90, 140, 255, 0.07);
  }
  #as-qn .qn-deck > .qn-panel::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(115deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0) 38%);
  }
  #as-qn .qn-deck:not(:has(> .qn-panel:not([hidden]))) { visibility: hidden; }
  /* Boss round: the laptop screen glows red. */
  #as-qn.qn-boss .qn-deck > .qn-panel:not([hidden]) {
    background: radial-gradient(ellipse at 25% 0%, #4a1622, #1a0c12 70%);
    box-shadow: inset 0 0 0 1px rgba(255, 59, 78, 0.55), inset 0 0 60px rgba(255, 59, 78, 0.2);
    transition: background 400ms ease, box-shadow 400ms ease;
  }
  @keyframes qn-laptop-in { from { opacity: 0; transform: translateY(14px) scale(0.96); } to { opacity: 1; transform: none; } }
  #as-qn .qn-bubble { left: 2%; top: auto; bottom: 14px; max-width: 36%; transform-origin: 20px 0; }
  #as-qn .qn-bubble::after { left: 26px; top: -7px; bottom: auto; border: 8px solid transparent; border-bottom-color: var(--qn-paper); border-top: 0; }
}
#as-qn .qn-cabinets { display: flex; gap: 8px; padding: 10px 16px 12px; overflow-x: auto; background: linear-gradient(180deg, #2a1f17, #1f1711); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06); }
#as-qn .qn-cab {
  flex: 1 0 130px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 8px 12px; border: 0; border-radius: 10px;
  background: linear-gradient(180deg, #5b6378, #434a5c); color: #f5f6fa; text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 -2px 0 rgba(0, 0, 0, 0.3), 0 4px 10px -6px rgba(0, 0, 0, 0.8);
  transition: transform 140ms var(--qn-ease), filter 160ms ease;
}
#as-qn .qn-cab:hover { filter: brightness(1.12); }
#as-qn .qn-cab:active { transform: scale(0.96); }
#as-qn .qn-cab-handle { width: 34px; height: 5px; border-radius: 3px; background: #c9ced9; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4); }
#as-qn .qn-cab-name { font-family: var(--qn-mono); font-weight: 700; font-size: 0.9em; }
#as-qn .qn-cab-rows { font-size: 0.75em; opacity: 0.75; }
#as-qn .qn-pulse { animation: qn-pulse 1.1s var(--qn-ease) infinite; }
@keyframes qn-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 106, 0, 0.7); } 50% { box-shadow: 0 0 0 6px rgba(255, 106, 0, 0); } }

/* ── Main layout ── */
#as-qn .qn-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 14px; }
@media (min-width: 900px) { #as-qn .qn-main { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
#as-qn .qn-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
#as-qn .qn-panel { background: var(--qn-panel); border-radius: 16px; padding: 16px; box-shadow: inset 0 0 0 1px var(--qn-line); }
#as-qn .qn-kicker { font-size: 0.75em; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--qn-accent); }
#as-qn .qn-title { font-size: 1.25em; font-weight: 800; margin-top: 2px !important; text-wrap: balance; }
#as-qn .qn-prompt { font-size: 1.05em; line-height: 1.55; margin-top: 10px !important; text-wrap: pretty; }
#as-qn .qn-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#as-qn .qn-spread { justify-content: space-between; }
#as-qn .qn-gap-top { margin-top: 12px; }
#as-qn .qn-kicker-boss { color: #ff8a96; }
#as-qn .qn-sub { font-size: 0.85em; color: var(--qn-ink2); }
#as-qn .qn-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8em; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--qn-panel2); color: var(--qn-ink2); }
#as-qn .qn-chip-accent { background: rgba(255, 106, 0, 0.16); color: #ffb37a; }
#as-qn .qn-chip button { border: 0; background: rgba(255, 255, 255, 0.12); border-radius: 999px; width: 20px; height: 20px; font-weight: 800; font-size: 12px; line-height: 20px; padding: 0; }
#as-qn .qn-dots { display: flex; gap: 6px; align-items: center; }
#as-qn .qn-dot { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, 0.12); transition: background-color 300ms ease, transform 300ms var(--qn-ease); }
#as-qn .qn-dot.is-done { background: var(--qn-good); }
#as-qn .qn-dot.is-now { background: var(--qn-accent); transform: scale(1.3); }
#as-qn .qn-dot.is-boss { width: 16px; height: 16px; border-radius: 4px; background: rgba(255, 92, 122, 0.25); box-shadow: inset 0 0 0 1px var(--qn-bad); }
#as-qn .qn-dot.is-boss.is-now { background: var(--qn-bad); }
#as-qn .qn-hints { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
#as-qn .qn-hint { font-size: 0.92em; padding: 8px 12px; border-radius: 10px; background: rgba(255, 201, 77, 0.1); color: #ffe3a3; animation: qn-in 300ms var(--qn-ease); }
/* Clues are sticky notes on the laptop: on laptop screens it covers the room's evidence board. */
#as-qn .qn-clues { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 10px; }
#as-qn .qn-clue { flex: 1 1 150px; max-width: 220px; font-size: 0.82em; line-height: 1.35; padding: 14px 10px 10px; border-radius: 2px 2px 10px 2px; background: #ffe98a; color: #3d3310; position: relative; transform: rotate(-1.2deg); box-shadow: 0 8px 14px -8px rgba(0, 0, 0, 0.8); animation: qn-pin 420ms var(--qn-ease); }
#as-qn .qn-clue:nth-child(even) { transform: rotate(1deg); background: #ffd3a8; }
#as-qn .qn-clue:nth-child(3n) { background: #c9f0c4; }
#as-qn .qn-clue::before { content: ""; position: absolute; left: 50%; top: -6px; width: 44px; height: 12px; transform: translateX(-50%) rotate(-2deg); background: rgba(255, 255, 255, 0.45); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15); }
@keyframes qn-pin { from { opacity: 0; transform: translateY(-10px) scale(1.06) rotate(-3deg); } to { opacity: 1; } }
@keyframes qn-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Tutorial */
#as-qn .qn-analogy { margin-top: 12px !important; padding: 10px 14px; border-radius: 12px; background: rgba(61, 220, 151, 0.1); color: #bff5dc; font-size: 0.95em; }
#as-qn .qn-goal { margin-top: 12px !important; font-weight: 700; color: var(--qn-gold); }
#as-qn .qn-rule { margin-top: 10px !important; padding: 8px 12px; border-left: 3px solid var(--qn-gold); border-radius: 0 10px 10px 0; background: rgba(255, 201, 77, 0.08); font-size: 0.92em; }
#as-qn .qn-choice-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
#as-qn .qn-choice { text-align: left; font-family: var(--qn-mono); font-size: var(--qn-code); padding: 10px 14px; border: 0; border-radius: 10px; background: var(--qn-panel2); box-shadow: inset 0 0 0 1px var(--qn-line); transition: transform 140ms var(--qn-ease), background-color 160ms ease; }
#as-qn .qn-choice:hover { background: #252c47; }
#as-qn .qn-choice:active { transform: scale(0.98); }
#as-qn .qn-choice.is-wrong { background: rgba(255, 92, 122, 0.18); animation: qn-buzz 300ms linear; }
#as-qn .qn-choice.is-right { background: rgba(61, 220, 151, 0.2); }
#as-qn .qn-link { background: none; border: 0; padding: 0; color: var(--qn-ink3); text-decoration: underline; font-size: 0.85em; }

/* ── Editor ── */
#as-qn .qn-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
#as-qn .qn-editor { position: relative; border-radius: 12px; background: #0a0d17; box-shadow: inset 0 0 0 1px var(--qn-line); min-height: 120px; }
#as-qn .qn-editor.is-buzz { animation: qn-buzz 320ms linear; box-shadow: inset 0 0 0 2px var(--qn-bad); }
@keyframes qn-buzz { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
#as-qn .qn-hl, #as-qn .qn-textarea {
  font-family: var(--qn-mono) !important; font-size: var(--qn-code) !important; line-height: 1.6 !important; padding: 14px 16px !important;
  white-space: pre-wrap; word-break: break-word; tab-size: 2; letter-spacing: 0 !important;
}
#as-qn .qn-hl { position: absolute; inset: 0; pointer-events: none; color: var(--qn-ink); overflow: hidden; }
#as-qn .qn-textarea { position: relative; display: block; width: 100%; min-height: 120px; resize: vertical; border: 0; outline: none; background: transparent; color: transparent; caret-color: var(--qn-accent); }
#as-qn .qn-textarea::placeholder { color: var(--qn-ink3); }
#as-qn .qn-textarea:focus-visible { box-shadow: inset 0 0 0 2px rgba(255, 106, 0, 0.5); border-radius: 12px; }
#as-qn .qn-textarea:disabled { cursor: not-allowed; }
#as-qn .tk-kw { color: #ff9a4d; font-weight: 700; }
#as-qn .tk-fn { color: #c792ea; }
#as-qn .tk-str { color: #a5e075; }
#as-qn .tk-num { color: #7fd1ff; }
#as-qn .tk-com { color: var(--qn-ink3); font-style: italic; }
#as-qn .tk-blank { color: #0d111d; background: var(--qn-gold); border-radius: 4px; animation: qn-blink 1s steps(2) infinite; }
@keyframes qn-blink { 50% { background: #ffe3a3; } }
#as-qn .qn-options { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
#as-qn .qn-options-label { font-size: 0.85em; color: var(--qn-ink2); }
#as-qn .qn-schema { margin: 12px 0; }
#as-qn .qn-chip-btn { border: 0; font-family: inherit; cursor: pointer; transition: background-color 150ms ease, color 150ms ease, transform 150ms var(--qn-ease); }
#as-qn .qn-chip-btn:hover { background: rgba(255, 106, 0, 0.18); color: var(--qn-ink); }
#as-qn .qn-chip-btn:active { transform: scale(0.96); }
#as-qn .qn-words { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
#as-qn .qn-words-label { width: 100%; font-size: 0.75em; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--qn-ink2); }
#as-qn .qn-word { border: 0; padding: 5px 10px; border-radius: 8px; font: 600 0.85em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--qn-panel2); color: var(--qn-ink); box-shadow: inset 0 0 0 1px var(--qn-line); cursor: pointer; transition: transform 150ms var(--qn-ease), background-color 150ms ease; }
#as-qn .qn-word:hover { background: rgba(255, 255, 255, 0.08); }
#as-qn .qn-word:active { transform: scale(0.95); }
#as-qn .qn-word.is-keyword { color: #ff9d57; }
#as-qn .qn-word.is-value { color: #9be7b8; }
#as-qn .qn-plain { margin: 10px 0 0; padding: 8px 12px; border-radius: 10px; background: rgba(127, 209, 255, 0.07); color: var(--qn-ink2); font-size: 0.88em; line-height: 1.5; }
#as-qn .qn-plain strong { color: #7fd1ff; }
#as-qn .qn-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
#as-qn .qn-run { padding: 12px 20px; font-size: 1em; }
#as-qn .qn-kbd { font-size: 0.75em; opacity: 0.8; margin-left: 6px; }
#as-qn .qn-cost { margin-top: 12px; font-size: 0.85em; color: var(--qn-ink2); }
#as-qn .qn-cost-bar { height: 6px; margin-top: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
#as-qn .qn-cost-fill { height: 100%; width: 0; background: var(--qn-good); transition: width 500ms var(--qn-ease), background-color 300ms ease; }
#as-qn .qn-cost-fill.is-over { background: var(--qn-bad); }
#as-qn .qn-error { margin-top: 12px; padding: 10px 14px; border-radius: 12px; background: rgba(255, 92, 122, 0.12); color: #ffc2cf; font-size: 0.95em; animation: qn-in 240ms var(--qn-ease); }
#as-qn .qn-error .qn-btn { margin-top: 8px; min-height: 34px; padding: 6px 12px; }

/* ── Stage (query animation) ── */
#as-qn .qn-stage { position: relative; height: 210px; overflow: hidden; border-radius: 16px; background: radial-gradient(ellipse at 50% 0%, #232a45, #121626 70%); box-shadow: inset 0 0 0 1px var(--qn-line); cursor: pointer; }
#as-qn .qn-stage-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 20px; color: var(--qn-ink3); font-size: 0.9em; }
#as-qn .qn-cards { position: absolute; inset: 14px 14px 44px; padding: 8px 8px 0 0; display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; overflow-y: auto; }
#as-qn .qn-card {
  width: calc(25% - 6px); min-width: 92px; padding: 6px 8px; border-radius: 6px; background: var(--qn-paper); color: var(--qn-paper-ink);
  font-family: var(--qn-mono); font-size: 11px; line-height: 1.35; box-shadow: 0 6px 12px -6px rgba(0, 0, 0, 0.7);
  opacity: 0; transform: translateX(-140%) rotate(-8deg);
  transition: transform 420ms var(--qn-ease), opacity 320ms ease, filter 300ms ease;
}
#as-qn .qn-card.is-in { opacity: 1; transform: none; }
#as-qn .qn-card.qn-answer { opacity: 1; transform: none; animation: qn-in 260ms var(--qn-ease) backwards; }
#as-qn .qn-answer:nth-child(n+3) { animation-delay: 40ms; }
#as-qn .qn-answer-head { width: 100%; font-size: 0.75em; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--qn-accent); }
#as-qn .qn-answer-empty { color: var(--qn-ink2); font-size: 0.9em; }
#as-qn .qn-card.qn-drop { opacity: 0; transform: translateY(160px) rotate(14deg); }
#as-qn .qn-card.qn-bin { opacity: 0; transform: translateY(90px) scale(0.4); }
#as-qn .qn-card.qn-trash { opacity: 0; transform: translate(300px, 120px) rotate(40deg) scale(0.3); }
#as-qn .qn-card.qn-shuffle { animation: qn-shuffle 360ms var(--qn-ease); }
@keyframes qn-shuffle { 30% { transform: translateY(-10px) rotate(3deg); } 60% { transform: translateY(4px) rotate(-2deg); } }
#as-qn .qn-field { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity 300ms ease; }
#as-qn .qn-field b { font-weight: 700; color: #7a5a3a; }
#as-qn .qn-field.qn-snip { opacity: 0.18; text-decoration: line-through; }
#as-qn .qn-lens { position: absolute; top: 20px; left: -60px; width: 56px; height: 56px; border-radius: 50%; border: 5px solid #d9dde8; background: rgba(160, 220, 255, 0.18); box-shadow: 0 0 20px rgba(160, 220, 255, 0.4); opacity: 0; pointer-events: none; transition: left 520ms cubic-bezier(0.77, 0, 0.175, 1), opacity 160ms ease; }
#as-qn .qn-lens::after { content: ""; position: absolute; width: 28px; height: 7px; background: #d9dde8; border-radius: 4px; right: -24px; bottom: -8px; transform: rotate(45deg); }
#as-qn .qn-lens.is-on { opacity: 1; }
#as-qn .qn-scissors { position: absolute; right: 16px; top: 14px; width: 26px; height: 26px; opacity: 0; transition: opacity 160ms ease, transform 300ms var(--qn-ease); transform: rotate(-30deg) scale(0.6); }
#as-qn .qn-scissors.is-on { opacity: 1; transform: rotate(0) scale(1); }
#as-qn .qn-bins { position: absolute; left: 14px; right: 14px; bottom: 44px; display: flex; gap: 8px; justify-content: center; }
#as-qn .qn-binbox { flex: 0 1 110px; padding: 8px; border-radius: 10px 10px 4px 4px; background: #3b3222; box-shadow: inset 0 3px 0 #574a33; text-align: center; color: #f3ead7; font-size: 11px; transition: transform 380ms var(--qn-ease), opacity 380ms ease; animation: qn-in 260ms var(--qn-ease); }
#as-qn .qn-binbox strong { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
#as-qn .qn-binbox.qn-knock { transform: rotate(-80deg) translateY(30px); opacity: 0.25; }
/* JOIN: the partner row from the other cabinet hangs under the card on a red string. */
#as-qn .qn-partner { position: relative; margin: 10px -4px -2px; padding: 4px 6px; border-radius: 4px; background: #dfe9f5; color: #1c2a3a; animation: qn-in 320ms var(--qn-ease); }
#as-qn .qn-partner::before { content: ""; position: absolute; left: 50%; top: -10px; height: 10px; border-left: 2px dashed #d7263d; }
#as-qn .qn-partner.is-alone { background: rgba(0, 0, 0, 0.08); color: #7a6a58; font-style: italic; }
/* Window functions: the result is stamped onto the card's corner. */
#as-qn .qn-card { position: relative; }
#as-qn .qn-stamp-badge { position: absolute; top: -7px; right: -6px; min-width: 22px; padding: 2px 6px; border-radius: 999px; background: var(--qn-accent); color: #1a0f05; font-weight: 800; font-size: 10px; text-align: center; font-variant-numeric: tabular-nums; box-shadow: 0 3px 8px -3px rgba(0, 0, 0, 0.8); animation: qn-stamp-in 260ms cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes qn-stamp-in { from { transform: scale(2.2) rotate(-20deg); opacity: 0; } to { transform: none; opacity: 1; } }
/* CTE: a manila folder for the temporary table. */
#as-qn .qn-folder { position: relative; margin: 18px auto 0; width: min(280px, 90%); padding: 18px 16px 14px; border-radius: 4px 10px 10px 10px; background: #d9b56a; color: #3a2a12; display: flex; flex-direction: column; gap: 4px; font-size: 0.85em; box-shadow: 0 12px 24px -12px rgba(0, 0, 0, 0.9); animation: qn-pop 420ms var(--qn-ease); }
#as-qn .qn-folder strong { font-family: var(--qn-mono); font-size: 1.25em; }
#as-qn .qn-folder-tab { position: absolute; top: -14px; left: 0; padding: 2px 12px; border-radius: 6px 6px 0 0; background: #d9b56a; font-weight: 800; font-size: 0.8em; letter-spacing: 0.1em; }
#as-qn .qn-trashcan { position: absolute; right: 12px; bottom: 44px; width: 34px; height: 40px; border-radius: 4px 4px 8px 8px; background: #4a5068; opacity: 0.6; }
#as-qn .qn-steps { position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 6px; padding: 8px 10px; overflow-x: auto; background: rgba(0, 0, 0, 0.35); }
#as-qn .qn-step { flex: none; font-size: 11px; padding: 4px 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); color: var(--qn-ink3); transition: background-color 200ms ease, color 200ms ease; white-space: nowrap; }
#as-qn .qn-step code { font-size: 10px; padding: 0 4px; }
#as-qn .qn-step.is-on { background: var(--qn-accent); color: #fff; }
#as-qn .qn-step.is-on code { background: rgba(0, 0, 0, 0.2); color: #fff; }
#as-qn .qn-skip-note { position: absolute; right: 10px; top: 8px; font-size: 10px; color: var(--qn-ink3); }

/* ── Results ── */
#as-qn .qn-results-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
#as-qn .qn-table-wrap { max-height: 260px; overflow: auto; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--qn-line); }
#as-qn .qn-table { width: 100%; border-collapse: collapse; font-family: var(--qn-mono); font-size: var(--qn-code); }
#as-qn .qn-table th { position: sticky; top: 0; background: var(--qn-panel2); text-align: left; padding: 8px 12px; font-size: 0.85em; color: var(--qn-accent); white-space: nowrap; }
#as-qn .qn-table td { padding: 6px 12px; border-top: 1px solid var(--qn-line); white-space: nowrap; animation: qn-in 260ms var(--qn-ease) backwards; }
#as-qn .qn-null { color: var(--qn-ink3); font-style: italic; }
#as-qn .qn-more { padding: 8px 12px; font-size: 0.8em; color: var(--qn-ink3); }
#as-qn .qn-feedback { margin-top: 12px; padding: 14px; border-radius: 14px; animation: qn-in 280ms var(--qn-ease); }
#as-qn .qn-feedback.is-good { background: rgba(61, 220, 151, 0.12); box-shadow: inset 0 0 0 1px rgba(61, 220, 151, 0.35); }
#as-qn .qn-feedback.is-bad { background: rgba(255, 92, 122, 0.1); box-shadow: inset 0 0 0 1px rgba(255, 92, 122, 0.3); }
#as-qn .qn-feedback-title { font-weight: 800; font-size: 1.1em; }
#as-qn .qn-stars { display: flex; gap: 6px; margin: 8px 0; }
#as-qn .qn-star { width: 30px; height: 30px; color: rgba(255, 255, 255, 0.15); transform: scale(0.25); opacity: 0; filter: blur(4px); transition: transform 360ms cubic-bezier(0.34, 1.56, 0.64, 1), opacity 200ms ease, filter 200ms ease, color 200ms ease; }
#as-qn .qn-star.is-in { transform: scale(1); opacity: 1; filter: blur(0); }
#as-qn .qn-star.is-earned { color: var(--qn-gold); filter: drop-shadow(0 0 8px rgba(255, 201, 77, 0.7)); }
#as-qn .qn-star-reasons { font-size: 0.82em; color: var(--qn-ink2); }

/* ── Overlays ── */
#as-qn .qn-overlay { position: absolute; inset: 0; z-index: 27; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(5, 7, 13, 0.78); backdrop-filter: blur(3px); animation: qn-fade 200ms ease; }
@keyframes qn-fade { from { opacity: 0; } to { opacity: 1; } }
#as-qn .qn-modal { width: min(560px, 100%); max-height: 100%; overflow: auto; background: var(--qn-panel); border-radius: 20px; padding: 22px; box-shadow: inset 0 0 0 1px var(--qn-line), 0 30px 60px -20px rgba(0, 0, 0, 0.8); animation: qn-pop 280ms var(--qn-ease); }
#as-qn .qn-modal-wide { width: min(760px, 100%); }
#as-qn .qn-howto { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
#as-qn .qn-howto-card { position: relative; padding: 12px 14px 12px 46px; border-radius: 14px; background: var(--qn-panel2); box-shadow: inset 0 0 0 1px var(--qn-line); }
#as-qn .qn-howto-card strong { display: block; color: var(--qn-ink); }
#as-qn .qn-howto-card p { margin: 4px 0 0; font-size: 0.9em; color: var(--qn-ink2); line-height: 1.45; }
#as-qn .qn-howto-num { position: absolute; left: 12px; top: 12px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--qn-accent); color: #fff; font-weight: 800; font-size: 0.8em; font-variant-numeric: tabular-nums; }
@keyframes qn-pop { from { opacity: 0; transform: translateY(10px) scale(0.97); } to { opacity: 1; transform: none; } }
#as-qn .qn-modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
#as-qn .qn-start { position: absolute; inset: 0; z-index: 25; display: flex; align-items: center; justify-content: center; padding: 24px; background: radial-gradient(ellipse at 50% 30%, rgba(30, 36, 64, 0.94), rgba(5, 7, 13, 0.97)); }
#as-qn .qn-start-card { text-align: center; max-width: 520px; animation: qn-pop 420ms var(--qn-ease); }
#as-qn .qn-logo { font-size: clamp(38px, 7vw, 64px); font-weight: 900; letter-spacing: 0.16em; line-height: 1; text-shadow: 0 0 30px rgba(255, 106, 0, 0.45); }
#as-qn .qn-logo span { color: var(--qn-accent); }
#as-qn .qn-tagline { margin-top: 12px !important; color: var(--qn-ink2); font-size: 1.05em; text-wrap: balance; }
#as-qn .qn-casefile { margin: 18px auto 0 !important; padding: 12px 16px; border-radius: 12px; background: var(--qn-paper); color: var(--qn-paper-ink); font-weight: 600; transform: rotate(-1deg); max-width: 400px; }
#as-qn .qn-start-actions { display: flex; flex-direction: column; gap: 10px; align-items: center; margin-top: 22px; }
#as-qn .qn-start-actions .qn-btn { min-width: 260px; }
#as-qn .qn-check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.9em; color: var(--qn-ink2); cursor: pointer; }
#as-qn .qn-check input { width: 16px; height: 16px; accent-color: var(--qn-accent); }
#as-qn .qn-loading-bar { width: 260px; height: 6px; margin: 16px auto 0; border-radius: 999px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
#as-qn .qn-loading-bar div { height: 100%; width: 40%; background: var(--qn-accent); animation: qn-load 1.1s ease-in-out infinite; }
@keyframes qn-load { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

/* Learn card (comic) */
#as-qn .qn-learn { background: var(--qn-paper); color: var(--qn-paper-ink); border-radius: 18px; padding: 22px; width: min(520px, 100%); box-shadow: 8px 8px 0 #000, 0 30px 60px -20px rgba(0, 0, 0, 0.8); animation: qn-pop 320ms var(--qn-ease); transform: rotate(-0.6deg); }
#as-qn .qn-learn-burst { display: inline-block; background: var(--qn-accent); color: #fff; font-weight: 900; letter-spacing: 0.1em; padding: 4px 12px; border-radius: 6px; transform: rotate(-3deg); }
#as-qn .qn-learn h3 { font-size: 1.5em; font-weight: 900; margin-top: 10px !important; }
#as-qn .qn-learn p { margin-top: 10px !important; font-size: 1.02em; }
#as-qn .qn-learn .qn-analogy-bubble { margin-top: 14px !important; padding: 12px 14px; border-radius: 14px; background: #fff; border: 2px solid var(--qn-paper-ink); position: relative; }
#as-qn .qn-learn pre { margin-top: 14px !important; padding: 12px 14px; border-radius: 10px; background: #0d111d; color: var(--qn-ink); font-family: var(--qn-mono); font-size: var(--qn-code); white-space: pre-wrap; }
#as-qn .qn-learn code { background: rgba(0, 0, 0, 0.08); color: #b24a00; }

/* Detective file */
#as-qn .qn-file-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 14px; }
@media (min-width: 640px) { #as-qn .qn-file-grid { grid-template-columns: 260px minmax(0, 1fr); } }
#as-qn .qn-big-level { font-size: 56px; font-weight: 900; line-height: 1; }
#as-qn .qn-radar { width: 100%; max-width: 260px; }
#as-qn .qn-radar text { font-size: 8px; fill: var(--qn-ink2); font-family: var(--qn-sans); }
#as-qn .qn-kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin-top: 12px; font-size: 0.92em; }
#as-qn .qn-kv span:nth-child(even) { font-weight: 700; text-align: right; }
#as-qn .qn-lb { margin-top: 12px; display: flex; flex-direction: column; gap: 4px; font-size: 0.9em; }
#as-qn .qn-lb div { display: flex; justify-content: space-between; padding: 6px 10px; border-radius: 8px; background: var(--qn-panel2); }

/* Glossary drawer */
#as-qn .qn-drawer { position: absolute; top: 0; right: 0; bottom: 0; z-index: 22; width: min(360px, 100%); background: var(--qn-panel); box-shadow: -20px 0 40px -20px rgba(0, 0, 0, 0.8), inset 1px 0 0 var(--qn-line); padding: 18px; overflow: auto; animation: qn-drawer 300ms cubic-bezier(0.32, 0.72, 0, 1); }
@keyframes qn-drawer { from { transform: translateX(100%); } to { transform: none; } }
#as-qn .qn-search { width: 100%; margin-top: 12px; padding: 10px 12px; border-radius: 10px; border: 0; background: #0a0d17; box-shadow: inset 0 0 0 1px var(--qn-line); outline: none; }
#as-qn .qn-search:focus { box-shadow: inset 0 0 0 2px rgba(255, 106, 0, 0.5); }
#as-qn .qn-gloss { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
#as-qn .qn-gloss div { padding: 10px 12px; border-radius: 10px; background: var(--qn-panel2); font-size: 0.9em; }
#as-qn .qn-gloss strong { display: block; font-family: var(--qn-mono); color: #ffb37a; margin-bottom: 2px; }

/* Cutscenes */
#as-qn .qn-cutscene { position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 24px; background: rgba(5, 7, 13, 0.9); animation: qn-fade 200ms ease; cursor: pointer; }
#as-qn .qn-stamp { font-size: clamp(36px, 8vw, 72px); font-weight: 900; letter-spacing: 0.08em; color: #ff3b4e; border: 8px solid #ff3b4e; border-radius: 14px; padding: 6px 22px; transform: rotate(-8deg); animation: qn-stamp 420ms cubic-bezier(0.34, 1.56, 0.64, 1); text-shadow: 0 0 1px #ff3b4e; }
@keyframes qn-stamp { from { transform: rotate(-8deg) scale(2.4); opacity: 0; } 60% { opacity: 1; } to { transform: rotate(-8deg) scale(1); } }
#as-qn .qn-promoted { font-size: 1em; letter-spacing: 0.3em; font-weight: 800; color: var(--qn-ink2); animation: qn-in 400ms var(--qn-ease); }
#as-qn .qn-rankname { font-size: clamp(34px, 7vw, 60px); font-weight: 900; color: var(--qn-gold); text-shadow: 0 0 30px rgba(255, 201, 77, 0.5); animation: qn-pop 500ms var(--qn-ease) 150ms backwards; }
#as-qn .qn-badge { width: 96px; height: 96px; animation: qn-badge 700ms cubic-bezier(0.34, 1.56, 0.64, 1) 300ms backwards; }
@keyframes qn-badge { from { transform: scale(0.2) rotate(-180deg); opacity: 0; } to { transform: none; opacity: 1; } }
/* Coat pins: one per rank earned, coloured by the rank's --pin (from content RANKS). */
#as-qn .qn-pins { display: flex; gap: 8px; }
#as-qn .qn-pin { width: 16px; height: 16px; border-radius: 50%; background: var(--pin); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.3), 0 0 10px var(--pin); animation: qn-pop 360ms var(--qn-ease) backwards; }
#as-qn .qn-pin:last-child { animation-delay: 700ms; transform-origin: center; }
#as-qn .qn-rankname.is-pinned { color: var(--pin); text-shadow: 0 0 30px var(--pin); }
/* Detective file */
#as-qn .qn-big-level small { font-size: 18px; color: var(--qn-ink3); }
#as-qn .qn-file-rank { font-size: 1.1em; margin-top: 4px; }
#as-qn .qn-file-note { font-size: 0.85em; color: var(--qn-ink3); }
#as-qn .qn-file-signin { font-size: 0.88em; color: var(--qn-ink2); }
#as-qn .qn-file-lb-title { margin-top: 14px; }
#as-qn .qn-skill-ranks { display: grid; gap: 8px; margin-top: 14px; }
#as-qn .qn-skill-rank { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 0.8em; }
#as-qn .qn-skill-rank > span:first-child { flex: 0 0 120px; font-weight: 700; color: var(--pin); }
#as-qn .qn-skill-dot { padding: 2px 7px; border-radius: 999px; background: var(--qn-panel2); color: var(--qn-ink3); }
#as-qn .qn-skill-dot.is-done { background: var(--pin); color: #10131c; font-weight: 700; }
#as-qn .qn-verdict { max-width: 520px; font-size: 1.1em; color: var(--qn-ink); animation: qn-in 500ms var(--qn-ease) 350ms backwards; text-wrap: balance; }
#as-qn .qn-tap { font-size: 0.8em; color: var(--qn-ink3); }
#as-qn .qn-boss-bar { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: linear-gradient(90deg, rgba(255, 59, 78, 0.25), rgba(255, 59, 78, 0.05)); box-shadow: inset 0 0 0 1px rgba(255, 59, 78, 0.4); animation: qn-in 300ms var(--qn-ease); }
#as-qn .qn-portrait { width: 48px; height: 56px; border-radius: 8px; background: #2a1f2a; box-shadow: inset 0 0 0 2px #ff3b4e; display: flex; align-items: flex-end; justify-content: center; overflow: hidden; flex: none; }
#as-qn .qn-portrait svg { width: 40px; height: 44px; }
#as-qn .qn-timer { margin-left: auto; font-size: 1.5em; font-weight: 900; color: #ff8a96; font-variant-numeric: tabular-nums; }
#as-qn .qn-timer.is-low { animation: qn-blink 0.6s steps(2) infinite; color: #fff; }
#as-qn .qn-toast { position: absolute; left: 50%; bottom: 18px; z-index: 35; transform: translateX(-50%); padding: 10px 16px; border-radius: 12px; background: var(--qn-paper); color: var(--qn-paper-ink); font-weight: 700; box-shadow: 0 16px 30px -12px rgba(0, 0, 0, 0.8); animation: qn-toast 3.2s var(--qn-ease) forwards; pointer-events: none; max-width: 90%; text-align: center; }
@keyframes qn-toast { 0% { opacity: 0; transform: translate(-50%, 12px); } 10%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, 4px); } }
#as-qn .qn-fx { position: absolute; inset: 0; z-index: 40; pointer-events: none; }
#as-qn.qn-shake { animation: qn-shake 380ms linear; }
@keyframes qn-shake { 0%, 100% { transform: translate(0, 0); } 20% { transform: translate(-4px, 2px); } 40% { transform: translate(4px, -2px); } 60% { transform: translate(-3px, 1px); } 80% { transform: translate(2px, -1px); } }
#as-qn .qn-selftest { font-size: 12px; font-family: var(--qn-mono); }

/* ── One screen, no page scrolling (.qn-fit: laptop-size windows and fullscreen) ──
   game.js sets .qn-fit from matchMedia('(min-width: 900px) and (min-height: 600px)').
   --qn-top is the site chrome above the game (nav height on the Ghost page, 0 in fullscreen).
   Rows: HUD, scene (room + laptop + cabinets), then editor | answer + evidence. Every panel
   scrolls inside itself so the page never has to. */
#as-qn.qn-fs { --qn-top: 0px; }
#as-qn.qn-fit { height: calc(100dvh - var(--qn-top, 0px)); display: grid; grid-template-rows: auto minmax(0, 47fr) minmax(0, 53fr); }
#as-qn.qn-fit .qn-hud { padding: 8px 16px; flex-wrap: nowrap; }
#as-qn.qn-fit .qn-scene { display: flex; flex-direction: column; min-height: 0; }
/* A definite row height lets the laptop's max-height bite; an auto row would grow with its content. */
#as-qn.qn-fit .qn-scene-view { flex: 1 1 auto; min-height: 0; grid-template-rows: minmax(0, 1fr); }
#as-qn.qn-fit .qn-scene-view::before { display: none; }
#as-qn.qn-fit .qn-deck { max-height: calc(100% - 44px); margin: 12px 22px 30px 4px; padding: 14px 12px 12px; }
#as-qn.qn-fit .qn-deck > .qn-panel:not([hidden]) { flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px; }
#as-qn.qn-fit .qn-cabinets { flex: none; padding: 6px 16px; gap: 6px; }
#as-qn.qn-fit .qn-cab { flex: 1 0 auto; flex-direction: row; align-items: baseline; gap: 8px; padding: 5px 10px; border-radius: 8px; }
#as-qn.qn-fit .qn-cab-handle { display: none; }
#as-qn.qn-fit .qn-main { min-height: 0; grid-template-rows: minmax(0, 1fr); gap: 12px; padding: 10px 14px 12px; }
#as-qn.qn-fit .qn-col { min-height: 0; gap: 10px; }
#as-qn.qn-fit .qn-editor-panel { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 12px 14px; }
#as-qn.qn-fit .qn-editor, #as-qn.qn-fit .qn-textarea { min-height: 96px; }
#as-qn.qn-fit .qn-stage { flex: 0 0 auto; height: 48%; min-height: 140px; }
#as-qn.qn-fit .qn-results { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding: 12px 14px; }
#as-qn.qn-fit .qn-table-wrap { flex: 1 1 auto; min-height: 0; max-height: none; }

@media (max-width: 640px) {
  #as-qn .qn-meter { margin-left: 0; width: 100%; }
  #as-qn .qn-bubble { left: 4%; top: 8px; max-width: 92%; font-size: 0.85em; }
  #as-qn .qn-bubble::after { display: none; }
  #as-qn .qn-card { width: calc(50% - 4px); }
}
@media (prefers-reduced-motion: reduce) {
  #as-qn *, #as-qn *::before, #as-qn *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  #as-qn.qn-shake { animation: none; }
}
