/* Kwantum stand-alone simulations: shared look. Light and dark, phone to whiteboard. */
:root {
  --bg: #F4F6F9; --surface: #FFFFFF; --ink: #0F1726; --muted: #4A5568; --line: #D9DEE6; --chip: #E9EDF3; --hover: #EEF2F7;
  --acc: #4B3FA6; --acc-ink: #FFFFFF; --acc-soft: #ECEAFA; --acc-text: #4B3FA6;
  --good: #14784A; --good-soft: #E1F4EA; --warn: #A55A00; --warn-soft: #FDF0DC; --bad: #B3261E; --bad-soft: #FBE7E5;
  --stage: #FFFFFF; --stage-line: #C9D0DB;
  --r: 10px;
  --font: "Lexend", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B111C; --surface: #121A28; --ink: #E9EDF4; --muted: #A4AEC0; --line: #2A364C; --chip: #1B2536; --hover: #172131;
    --acc: #7C6FE0; --acc-ink: #0B111C; --acc-soft: #221F45; --acc-text: #B4ABF5;
    --good: #5FD39A; --good-soft: #12301F; --warn: #F2B866; --warn-soft: #3A2A10; --bad: #FF8A80; --bad-soft: #3D1614;
    --stage: #0F1623; --stage-line: #2A364C;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B111C; --surface: #121A28; --ink: #E9EDF4; --muted: #A4AEC0; --line: #2A364C; --chip: #1B2536; --hover: #172131;
  --acc: #7C6FE0; --acc-ink: #0B111C; --acc-soft: #221F45; --acc-text: #B4ABF5;
  --good: #5FD39A; --good-soft: #12301F; --warn: #F2B866; --warn-soft: #3A2A10; --bad: #FF8A80; --bad-soft: #3D1614;
  --stage: #0F1623; --stage-line: #2A364C;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 1rem; line-height: 1.5; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--acc); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg text { font-family: var(--font); }

.sim-wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px 48px; }
.sim-head { display: flex; align-items: center; gap: 12px; padding: 14px 0 12px; flex-wrap: wrap; }
.sim-head h1 { font-size: clamp(1.25rem, 1rem + 1.2vw, 1.6rem); line-height: 1.15; margin: 0; font-weight: 700; letter-spacing: -.01em; }
.sim-tag { font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--acc-text); margin: 0 0 2px; }
.sim-head-end { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.sim-sym { width: 44px; height: 44px; border-radius: 8px; background: var(--acc); color: var(--acc-ink); display: grid; place-items: center; font-weight: 700; font-size: 1.15rem; flex: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 500; font-size: .92rem; text-decoration: none; line-height: 1.2; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); background: var(--acc); }
.btn[aria-pressed="true"], .btn.on { background: var(--acc-soft); border-color: var(--acc); color: var(--acc-text); font-weight: 600; }
.btn.icon { width: 40px; padding: 0; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.sm { min-height: 34px; padding: 4px 11px; font-size: .85rem; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.panel h2 { font-size: 1rem; margin: 0 0 8px; font-weight: 650; }
.panel h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 8px; font-weight: 600; }
.panel p { margin: 0 0 8px; }
.panel p:last-child { margin-bottom: 0; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }

.stage { background: var(--stage); border: 1px solid var(--stage-line); border-radius: var(--r); overflow: hidden; position: relative; }
.stage svg, .stage canvas { display: block; width: 100%; height: auto; touch-action: manipulation; }

.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.seg { display: inline-flex; background: var(--chip); border-radius: 999px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; border-radius: 999px; min-height: 36px; padding: 4px 13px; font-size: .9rem; font-weight: 500; color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 2px rgba(15, 23, 38, .18); font-weight: 650; color: var(--acc-text); }

.slider { display: grid; gap: 2px; min-width: 150px; flex: 1; }
.slider label { font-size: .85rem; font-weight: 550; display: flex; justify-content: space-between; gap: 8px; }
.slider label b { font-weight: 650; color: var(--acc-text); font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; accent-color: var(--acc); height: 28px; margin: 0; }

.say { border-left: 4px solid var(--acc); background: var(--acc-soft); border-radius: 0 var(--r) var(--r) 0; padding: 10px 14px; font-size: .98rem; min-height: 3.2em; }
.say b { color: var(--acc-text); }
.say.good { border-color: var(--good); background: var(--good-soft); }
.say.warn { border-color: var(--warn); background: var(--warn-soft); }
.say.bad { border-color: var(--bad); background: var(--bad-soft); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--chip); font-size: .82rem; font-weight: 550; }
.lvl { display: inline-block; padding: 1px 8px; border-radius: 999px; border: 1.5px solid var(--acc); color: var(--acc-text); font-size: .72rem; font-weight: 650; letter-spacing: .02em; vertical-align: 1px; white-space: nowrap; }

/* Try this: small tasks with a tick */
.tasks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tasks li { display: flex; gap: 9px; align-items: flex-start; font-size: .93rem; }
.tasks .tick { width: 20px; height: 20px; flex: none; border-radius: 50%; border: 2px solid var(--line); margin-top: 1px; display: grid; place-items: center; }
.tasks li.done .tick { background: var(--good); border-color: var(--good); }
.tasks li.done .tick::after { content: ""; width: 9px; height: 5px; border-left: 2.5px solid var(--surface); border-bottom: 2.5px solid var(--surface); transform: rotate(-45deg) translate(1px, -1px); }
.tasks li.done { color: var(--muted); }

/* Quick check */
.quiz { display: grid; gap: 10px; }
.quiz .q { font-weight: 600; margin: 0; }
.quiz .opts { display: grid; gap: 6px; }
.quiz .opts button { text-align: left; border: 1.5px solid var(--line); background: var(--surface); border-radius: 8px; padding: 9px 12px; min-height: 42px; }
.quiz .opts button:hover:not(:disabled) { background: var(--hover); }
.quiz .opts button.right { border-color: var(--good); background: var(--good-soft); font-weight: 600; }
.quiz .opts button.wrong { border-color: var(--bad); background: var(--bad-soft); }
.quiz .fb { font-size: .93rem; margin: 0; min-height: 1.4em; }
.quiz .count { font-size: .8rem; color: var(--muted); }

details.more { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 8px; }
details.more summary { cursor: pointer; font-weight: 600; font-size: .93rem; min-height: 32px; display: flex; align-items: center; gap: 6px; list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: "+"; width: 20px; height: 20px; border-radius: 50%; background: var(--chip); display: grid; place-items: center; font-weight: 700; flex: none; }
details.more[open] summary::before { content: "\2212"; }

.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.side { display: grid; gap: 12px; }
.below { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-top: 14px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }

.credit { font-size: .75rem; color: var(--muted); }
.credit a { color: inherit; }
@media print { .sim-head-end, #kwbar { display: none !important; } }
