/* KinoviKids design system: a real AI-agent look, made friendly for kids. Light and dark mode. */
:root {
  --accent: #C2531B;          /* send button, main actions (kids can change it) */
  --accent-ink: #FFFFFF;
  --bg: #FFFFFF;              /* main area */
  --side: #F6F7F9;            /* sidebar and side panel */
  --card: #FFFFFF;
  --sunk: #F0F1F4;            /* user bubble, inputs on side */
  --line: #E2E4EA;
  --line-strong: #CFD3DC;
  --text: #1C1F2E;
  --muted: #5B6176;
  --faint: #8A90A2;
  --ink: #1C1F2E;             /* dark buttons and term cards */
  --ink-text: #FFFFFF;
  --teal: #0F7A6C; --teal-soft: #E3F4F0;
  --indigo: #2D3192; --indigo-soft: #ECECFB;
  --peach: #A3401A; --peach-soft: #FCE9DF;
  --gold: #7A5A00; --gold-soft: #FFF6DC; --gold-line: #F0D68A;
  --red: #B42318; --red-soft: #FDECEA;
  --chip1: #E6E8FB; --chip1-t: #2D3192;
  --chip2: #DDF3EE; --chip2-t: #0B5E53;
  --chip3: #FCE6DA; --chip3-t: #9A3A12;
  --r: 14px; --r-sm: 10px; --r-pill: 999px;
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --title: 'Nunito', system-ui, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --shadow: 0 8px 30px rgba(20, 22, 35, .12);
  --pattern: none;
  color-scheme: light;
}
:root[data-mode="dark"] {
  --bg: #15171F; --side: #1B1E28; --card: #20232F; --sunk: #272B38; --line: #2F3342; --line-strong: #3C4153;
  --text: #ECEEF5; --muted: #A5ABBE; --faint: #7D8396;
  --ink: #ECEEF5; --ink-text: #15171F;
  --teal: #45C2AE; --teal-soft: #173A36; --indigo: #A9ADFF; --indigo-soft: #262A4D; --peach: #F2A27E; --peach-soft: #3B261E;
  --gold: #F2D27A; --gold-soft: #332B16; --gold-line: #5C4C1F; --red: #FF8A80; --red-soft: #3A1E1E;
  --chip1: #2B2F55; --chip1-t: #C9CBFF; --chip2: #193D38; --chip2-t: #8FE3D3; --chip3: #43291E; --chip3-t: #FFC2A6;
  --shadow: 0 10px 34px rgba(0, 0, 0, .45);
  color-scheme: dark;
}
:root[data-font="bubbly"] { --title: 'Fredoka', 'Nunito', sans-serif; }
:root[data-font="clean"] { --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; --title: var(--font); }
:root[data-font="pixel"] { --title: 'Silkscreen', 'Nunito', monospace; }
:root[data-font="handwritten"] { --title: 'Patrick Hand', 'Nunito', cursive; }
:root[data-corners="soft"] { --r: 8px; --r-sm: 6px; }
:root[data-corners="square"] { --r: 3px; --r-sm: 2px; --r-pill: 6px; }
:root[data-bg="dots"] { --pattern: radial-gradient(color-mix(in srgb, var(--accent) 22%, transparent) 1.2px, transparent 1.3px) 0 0 / 22px 22px; }
:root[data-bg="waves"] { --pattern: repeating-radial-gradient(circle at 0 100%, transparent 0 18px, color-mix(in srgb, var(--accent) 9%, transparent) 18px 20px); }
:root[data-bg="stars"] { --pattern: radial-gradient(color-mix(in srgb, var(--accent) 30%, transparent) 1px, transparent 1.6px) 0 0 / 46px 46px, radial-gradient(color-mix(in srgb, var(--accent) 18%, transparent) 1.4px, transparent 2px) 23px 23px / 46px 46px; }

* { box-sizing: border-box; }
svg { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex: none; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; font-weight: 800; letter-spacing: -.01em; }
h1 { font-size: 2.1rem; } h2 { font-size: 1.35rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
a { color: var(--indigo); }
button, input, textarea, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: .875rem; } .xs { font-size: .78rem; }
.mono { font-family: var(--mono); font-size: .9em; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 14px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.caps { font-size: .78rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.logo { font-family: 'Fredoka', 'Nunito', sans-serif; font-weight: 600; font-size: 1.6rem; color: var(--accent); text-decoration: none; letter-spacing: -.01em; }
.logo.k { font-size: 1.5rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line-strong); background: var(--card); color: var(--text); border-radius: var(--r-pill); padding: 9px 18px; font-weight: 800; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s, transform .05s; }
.btn:hover { border-color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ink { background: var(--ink); color: var(--ink-text); border-color: var(--ink); border-radius: var(--r-sm); }
.btn.accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--sunk); }
.btn.sq { border-radius: var(--r-sm); }
.btn.sm { padding: 5px 12px; font-size: .875rem; }
.btn.danger { color: var(--red); }
.btn.block { width: 100%; }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--card); cursor: pointer; color: var(--text); padding: 0; }
.icon-btn:hover { border-color: var(--text); }
.icon-btn.round { border-radius: 50%; }
.icon-btn.plain { border-color: transparent; background: transparent; }
.icon-btn.plain:hover { background: var(--sunk); }
.icon-btn svg, .btn svg { width: 20px; height: 20px; }
.send { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; cursor: pointer; flex: none; }
.send:disabled { opacity: .5; }
.send svg { width: 22px; height: 22px; }
kbd { font-family: var(--mono); font-size: .75rem; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; background: var(--card); color: var(--muted); white-space: nowrap; }

/* Inputs */
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input:not([type]), textarea, select {
  width: 100%; background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 11px 14px; outline: none; }
input:focus, textarea:focus, select:focus, [contenteditable]:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 1px; }
label.lbl { display: block; font-weight: 800; font-size: .9rem; margin: 0 0 6px; }
.field { margin-bottom: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { width: auto; margin-top: 5px; }
.err { color: var(--red); font-weight: 700; min-height: 1.3em; font-size: .9rem; }

/* Pills (bubbles) */
.pills { display: flex; flex-wrap: wrap; gap: 10px; }
.pill { border: 1.5px solid var(--line-strong); background: var(--card); color: var(--text); border-radius: var(--r-pill); padding: 8px 18px; font-weight: 700; cursor: pointer; line-height: 1.3; text-align: left; }
.pill:hover { border-color: var(--text); }
.pill.on, .pill.chosen { border-color: var(--teal); background: var(--teal-soft); color: var(--teal); }
.pill.on.c1 { border-color: var(--indigo); background: var(--chip1); color: var(--chip1-t); }
.pill.on.c2 { border-color: var(--teal); background: var(--chip2); color: var(--chip2-t); }
.pill.on.c3 { border-color: var(--peach); background: var(--chip3); color: var(--chip3-t); }
.pill.dashed { border-style: dashed; }
.pill.sm { padding: 4px 12px; font-size: .875rem; }
.tag { display: inline-block; font-size: .75rem; font-weight: 800; letter-spacing: .05em; padding: 3px 10px; border-radius: 8px; background: var(--indigo-soft); color: var(--indigo); text-transform: uppercase; }
.tag.teal { background: var(--teal-soft); color: var(--teal); } .tag.peach { background: var(--peach-soft); color: var(--peach); } .tag.gold { background: var(--gold-soft); color: var(--gold); } .tag.plain { background: var(--sunk); color: var(--muted); }
.tag.lower { text-transform: none; letter-spacing: 0; }
.chip { display: inline; padding: 2px 8px; margin: 0 1px; border-radius: 8px; font-weight: 800; white-space: nowrap; }
.chip.c1 { background: var(--chip1); color: var(--chip1-t); } .chip.c2 { background: var(--chip2); color: var(--chip2-t); } .chip.c3 { background: var(--chip3); color: var(--chip3-t); }

/* Dotted real terms */
.term { text-decoration: underline dotted var(--indigo) 2px; text-underline-offset: 4px; cursor: help; font-weight: 800; }
.tip { position: fixed; z-index: 200; max-width: 320px; background: var(--ink); color: var(--ink-text); padding: 10px 14px; border-radius: 12px; font-size: .9rem; line-height: 1.4; pointer-events: auto; box-shadow: var(--shadow); }
.tip b { font-weight: 800; }
.termcard { background: var(--ink); color: var(--ink-text); border-radius: var(--r); padding: 12px 18px; max-width: 600px; line-height: 1.45; }
.termcard b { font-weight: 800; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; }
.card.sunk { background: var(--side); }
.card.tight { padding: 12px 16px; }
.card.click { cursor: pointer; } .card.click:hover { border-color: var(--line-strong); box-shadow: 0 2px 10px rgba(0,0,0,.05); }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid.g3 { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.callout { border-radius: var(--r); padding: 14px 18px; border: 1px solid; display: flex; gap: 14px; align-items: center; }
.callout.spark { background: var(--gold-soft); border-color: var(--gold-line); }
.callout.spark .caps { color: var(--gold); }
.callout.good { background: var(--teal-soft); border-color: color-mix(in srgb, var(--teal) 35%, transparent); }
.callout.good .caps, .callout.good .ic { color: var(--teal); }
.callout.warn { background: var(--gold-soft); border-color: var(--gold-line); }
.callout.info { background: var(--indigo-soft); border-color: color-mix(in srgb, var(--indigo) 25%, transparent); }
.callout.info .caps { color: var(--indigo); }
.callout.bad { background: var(--peach-soft); border-color: color-mix(in srgb, var(--peach) 35%, transparent); }
.callout .ic { flex: none; width: 28px; height: 28px; }
.callout .grow { flex: 1; min-width: 0; }
.callout.col { flex-direction: column; align-items: stretch; }

/* Toggle switch */
.switch { position: relative; width: 52px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: .15s; }
.switch span::after { content: ''; position: absolute; left: 4px; top: 4px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: .15s; }
.switch input:checked + span { background: var(--teal); }
.switch input:checked + span::after { transform: translateX(22px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ====== App shell ====== */
.app { display: grid; grid-template-columns: 280px minmax(0, 1fr) auto; height: 100vh; height: 100dvh; }
.app.rail { grid-template-columns: 72px minmax(0, 1fr) auto; }
.side { background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; padding: 18px 16px 12px; gap: 10px; }
.side .top { display: flex; align-items: center; gap: 8px; }
.side .newbtn { justify-content: flex-start; border-radius: var(--r); padding: 12px 18px; font-size: 1.05rem; }
.side .scroll { flex: 1; overflow-y: auto; margin: 0 -8px; padding: 0 8px; }
.side .sec { margin: 14px 0 6px 10px; }
.nav { display: block; width: 100%; border: 0; background: transparent; text-align: left; padding: 9px 12px; border-radius: var(--r-sm); cursor: pointer; font-weight: 700; color: var(--text); text-decoration: none; font-size: 1rem; }
.nav:hover { background: var(--sunk); }
.nav.on { background: color-mix(in srgb, var(--text) 9%, transparent); }
.nav small { display: block; color: var(--muted); font-weight: 600; font-size: .85rem; }
.nav.sub { padding-left: 28px; font-weight: 600; }
.nav .ico { width: 20px; height: 20px; vertical-align: -4px; margin-right: 10px; }
.side .foot { border-top: 1px solid var(--line); padding-top: 10px; }
.who { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; border: 0; background: transparent; width: 100%; text-align: left; }
.who:hover { background: var(--sunk); }
.av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; flex: none; font-size: 1.05rem; }
.av.sm { width: 30px; height: 30px; font-size: .85rem; }
.who b { display: block; line-height: 1.2; } .who small { color: var(--muted); }
.app.rail .side { padding: 18px 12px; align-items: center; }
.app.rail .side .hide-rail { display: none !important; }
.side .show-rail { display: none; }
.app.rail .side .show-rail { display: inline-grid; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.bar { display: flex; align-items: center; gap: 12px; padding: 14px 28px; border-bottom: 1px solid var(--line); min-height: 64px; }
.bar .title { font-weight: 800; font-size: 1.3rem; border: 0; background: transparent; padding: 2px 6px; margin-left: -6px; border-radius: 8px; min-width: 60px; flex: 1 1 auto; width: auto; text-overflow: ellipsis; }
.bar .title:hover { background: var(--sunk); }
.bar .meta { color: var(--muted); font-weight: 800; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.menu-only { display: none; }
.page { flex: 1; overflow-y: auto; padding: 36px 48px 60px; }
.page.narrow > * { max-width: 980px; }
.page h1 { font-size: 2.4rem; }

/* Chat */
.chat { flex: 1; overflow-y: auto; padding: 28px 28px 12px; display: flex; flex-direction: column; gap: 18px; background: var(--pattern), var(--bg); }
.chat > * { max-width: 920px; width: 100%; margin-left: auto; margin-right: auto; }
.m-user { align-self: flex-end; width: auto !important; max-width: min(80%, 720px) !important; margin-right: 0 !important; background: var(--sunk); padding: 12px 20px; border-radius: 22px; white-space: pre-wrap; }
.m-ai { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.m-ai .txt { font-size: 1.05rem; line-height: 1.6; }
.m-ai .txt b { font-weight: 800; }
.m-ai .q { font-size: 1.05rem; }
.m-event { display: inline-flex !important; width: auto !important; margin-left: 0 !important; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: var(--r); padding: 10px 16px; background: var(--card); }
.m-event svg { width: 18px; height: 18px; color: var(--indigo); }
.thinking { color: var(--muted); display: flex; gap: 6px; align-items: center; }
.thinking i { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); animation: blink 1.2s infinite; }
.thinking i:nth-child(2) { animation-delay: .2s; } .thinking i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25 } 40% { opacity: 1 } }

/* Agent run cards */
.agentrun { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--indigo); border-radius: var(--r); padding: 14px 16px; width: 100%; max-width: 760px; }
.agentrun + .agentrun { margin-top: 10px; }
.agentrun .item { background: var(--side); }
/* Composer */
.composer { padding: 10px 28px 18px; }
.composer > * { max-width: 920px; margin-left: auto; margin-right: auto; }
.trybar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.trybar .caps { text-transform: none; letter-spacing: 0; font-size: .9rem; }
.ctxbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; font-size: .8rem; }
.ctxchip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: var(--sunk); color: var(--muted); font-weight: 700; border: 1px solid var(--line); cursor: default; }
.ctxchip button { border: 0; background: transparent; cursor: pointer; color: inherit; padding: 0 0 0 2px; font-weight: 800; }
.ctxchip.add { cursor: pointer; border-style: dashed; }
.box.col { flex-direction: column; align-items: stretch; padding: 8px 10px 10px 14px; gap: 4px; }
.box .boxrow { display: flex; gap: 8px; align-items: center; }
.box { display: flex; align-items: flex-end; gap: 10px; border: 1.5px solid var(--line-strong); border-radius: 24px; padding: 10px 10px 10px 12px; background: var(--card); position: relative; }
.box:focus-within { border-color: color-mix(in srgb, var(--accent) 60%, var(--line-strong)); }
.editor { flex: 1; min-height: 46px; max-height: 200px; overflow-y: auto; padding: 10px 6px; font-size: 1.08rem; line-height: 1.7; outline: none !important; word-break: break-word; }
.editor:empty::before { content: attr(data-ph); color: var(--faint); pointer-events: none; }
.box .tools-btn { border-radius: 999px; height: 40px; padding: 0 14px; }
.box.col .send { width: 42px; height: 42px; }
.box.col .icon-btn { width: 40px; height: 40px; }
.hint { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 8px; }
.popover { position: fixed; z-index: 150; background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--r); box-shadow: var(--shadow); padding: 8px; min-width: 300px; max-width: 420px; max-height: 420px; overflow-y: auto; }
.popover .caps { padding: 8px 10px 4px; display: block; }
.opt { display: block; width: 100%; border: 0; background: transparent; text-align: left; padding: 10px 12px; border-radius: var(--r-sm); cursor: pointer; }
.opt:hover, .opt.sel { background: var(--sunk); }
.opt b { display: block; font-weight: 800; } .opt small { color: var(--muted); font-size: .88rem; }
.opt .row { flex-wrap: nowrap; }

/* Start screen */
.start { position: relative; flex: 1; overflow-y: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 28px; background: var(--pattern), var(--bg); }
.start h1 { font-size: 2.6rem; text-align: center; margin-bottom: 26px; font-family: var(--title); }
.start .box { width: 100%; max-width: 980px; flex-direction: column; align-items: stretch; padding: 18px 20px 14px; border-radius: 28px; }
.start .editor { min-height: 90px; font-size: 1.25rem; }
.start .boxrow { display: flex; gap: 10px; align-items: center; }
.rows { width: 100%; max-width: 900px; margin-top: 24px; display: grid; grid-template-columns: 90px 1fr; gap: 12px 20px; align-items: center; }
.rows .caps { text-transform: none; letter-spacing: 0; font-size: .95rem; }
.levelsel { position: absolute; top: 18px; left: 24px; }

/* Side panel (spec, tools) */
.panel { width: min(40vw, 600px); background: var(--side); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.panel.wide { width: min(56vw, 1000px); }
.ptabs { display: flex; gap: 4px; padding: 16px 16px 10px; align-items: center; overflow-x: auto; scrollbar-width: none; }
.ptab { border: 0; background: transparent; padding: 8px 10px; border-radius: var(--r-sm); font-weight: 700; color: var(--muted); cursor: pointer; font-size: .97rem; white-space: nowrap; }
.ptab:hover { color: var(--text); }
.ptab.on { background: color-mix(in srgb, var(--text) 9%, transparent); color: var(--text); font-weight: 800; }
.phead { display: flex; align-items: center; gap: 12px; padding: 16px 24px; border-bottom: 1px solid var(--line); min-height: 64px; }
.phead h2 { margin: 0; font-size: 1.3rem; }
.stagebar { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; padding: 8px 24px 16px; border-bottom: 1px solid var(--line); }
.stagebar button { border: 0; background: transparent; padding: 0; text-align: left; cursor: pointer; color: var(--muted); font-weight: 800; font-size: .9rem; }
.stagebar button i { display: block; height: 7px; border-radius: 99px; background: var(--line); margin-bottom: 8px; }
.stagebar button.done i { background: var(--teal); }
.stagebar button.cur i { background: var(--ink); }
.stagebar button.cur, .stagebar button.done { color: var(--text); }
.pbody { flex: 1; overflow-y: auto; padding: 18px 24px 24px; }
.pfoot { border-top: 1px solid var(--line); padding: 12px 24px; color: var(--muted); font-size: .9rem; display: flex; align-items: center; gap: 10px; }
.path { font-family: var(--mono); color: var(--muted); font-size: .92rem; margin-bottom: 14px; }
.sh { font-size: .92rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 20px 0 8px; display: flex; align-items: center; gap: 8px; }
.sh:first-child { margin-top: 0; }
.sh .add { margin-left: auto; text-transform: none; letter-spacing: 0; }
.sv { font-size: 1.02rem; line-height: 1.55; }
.sv.empty { color: var(--faint); }
.item { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 16px; margin: 8px 0; display: flex; gap: 12px; align-items: flex-start; }
.item .grow { flex: 1; min-width: 0; }
.item .x { opacity: 0; border: 0; background: transparent; cursor: pointer; color: var(--faint); padding: 0 2px; font-size: 1.1rem; }
.item:hover .x, .item:focus-within .x { opacity: 1; }
.item.story { display: block; }
.item.story b { font-weight: 800; }
.item.num .n { font-weight: 800; width: 22px; color: var(--muted); }
.item.good { border-color: var(--teal); border-width: 2px; }
.item.fix { border-color: var(--peach); border-width: 2px; background: var(--peach-soft); }
.note { border-radius: var(--r-sm); padding: 10px 16px; margin: -2px 0 10px 28px; font-size: .95rem; }
.note.good { background: var(--teal-soft); color: var(--teal); }
.note.fix { background: var(--peach-soft); color: var(--peach); }
.guess { display: inline-flex; gap: 8px; align-items: center; border: 1.5px dashed var(--line-strong); border-radius: 999px; padding: 6px 8px 6px 16px; margin: 4px 6px 4px 0; background: transparent; font-size: .98rem; }
.guess .gbtn { border: 0; background: var(--sunk); border-radius: 999px; padding: 2px 10px; cursor: pointer; font-weight: 800; font-size: .8rem; color: var(--muted); }
.guess .gbtn:hover { color: var(--text); }
.writing { border: 1.5px dashed var(--line-strong); border-radius: var(--r-sm); padding: 12px 16px; color: var(--muted); margin: 8px 0; }
.mvpline { display: flex; align-items: center; gap: 12px; color: var(--peach); font-weight: 800; font-size: .92rem; margin: 10px 0; }
.mvpline::before, .mvpline::after { content: ''; flex: 1; height: 2px; background: color-mix(in srgb, var(--peach) 45%, transparent); }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.sw { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer; padding: 0; }
.sw.on { outline: 3px solid var(--text); outline-offset: 2px; }
.asset { display: flex; gap: 14px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; margin: 10px 0; }
.asset.waiting { border-style: dashed; border-width: 1.5px; }
.asset .thumb { width: 64px; height: 64px; border-radius: 10px; flex: none; background: var(--sunk); background-size: cover; background-position: center; display: grid; place-items: center; color: var(--muted); }
.asset .thumb svg { width: 26px; height: 26px; }
.asset b { font-family: var(--mono); font-weight: 700; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adder { width: 100%; border: 1.5px dashed var(--line-strong); background: transparent; border-radius: var(--r); padding: 14px; font-weight: 800; cursor: pointer; color: var(--text); margin-top: 8px; }
.adder:hover { border-color: var(--text); }

/* Ready check */
.score { font-size: 3.4rem; font-weight: 800; line-height: 1; }
.meter { height: 14px; border-radius: 99px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 99px; background: var(--gold); }
.meter.ok i { background: var(--teal); }
.meter.low i { background: var(--peach); }
.rc { display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 18px; margin: 10px 0; }
.rc .yn { font-weight: 800; font-size: 1.1rem; width: 36px; }
.rc .yn.y { color: var(--teal); } .rc .yn.n { color: var(--peach); }
.rc .grow { flex: 1; min-width: 0; }
.rc .grow small { display: block; color: var(--muted); }
.rc .pts { font-weight: 800; white-space: nowrap; }

/* Tool boards */
.board { display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); }
.board.c6 { grid-template-columns: repeat(3, 1fr); }
.quad { border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 10px; min-height: 220px; border: 1px solid; }
.quad .qh { display: flex; gap: 12px; align-items: center; }
.quad .qh .L { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 1.3rem; flex: none; }
.quad .qh b { font-size: 1.15rem; display: block; }
.quad .qh small { color: var(--muted); }
.quad .it { background: var(--card); border-radius: var(--r-sm); padding: 10px 14px; font-weight: 700; display: flex; gap: 8px; }
.quad .it span { flex: 1; }
.quad .it button { border: 0; background: transparent; cursor: pointer; color: var(--faint); }
.quad .addq { margin-top: auto; align-self: flex-start; border: 1.5px dashed currentColor; background: transparent; border-radius: 10px; padding: 6px 14px; font-weight: 800; cursor: pointer; }
.q0 { background: var(--teal-soft); border-color: color-mix(in srgb, var(--teal) 30%, transparent); color: var(--teal); } .q0 .L { background: var(--teal); }
.q1 { background: var(--peach-soft); border-color: color-mix(in srgb, var(--peach) 30%, transparent); color: var(--peach); } .q1 .L { background: var(--peach); }
.q2 { background: var(--indigo-soft); border-color: color-mix(in srgb, var(--indigo) 25%, transparent); color: var(--indigo); } .q2 .L { background: var(--indigo); }
.q3 { background: var(--gold-soft); border-color: var(--gold-line); color: var(--gold); } .q3 .L { background: #8A6A10; }
.q4 { background: var(--sunk); border-color: var(--line); color: var(--text); } .q4 .L { background: #5B6176; }
.q5 { background: var(--chip1); border-color: var(--line); color: var(--chip1-t); } .q5 .L { background: #4C51C6; }
.quad .it, .quad .qh b { color: var(--text); }
.sticky { border-radius: var(--r); padding: 16px; min-height: 120px; font-weight: 800; background: #FFEFC0; color: #3A3000; cursor: pointer; border: 3px solid transparent; position: relative; }
:root[data-mode="dark"] .sticky { background: #4A3F18; color: #FFF0C2; }
.sticky.tw { background: var(--chip1); color: var(--chip1-t); }
.sticky.sel { border-color: var(--text); }
.sticky small { display: block; margin-top: 8px; font-size: .82rem; color: var(--indigo); }
.sticky .votes { position: absolute; right: 10px; bottom: 8px; color: var(--accent); letter-spacing: 2px; }
.stickies { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
canvas.draw { background: #fff; border: 1px solid var(--line); border-radius: var(--r); touch-action: none; width: 100%; aspect-ratio: 3 / 4; cursor: crosshair; display: block; }
.wire { position: relative; width: 100%; aspect-ratio: 3 / 4; border: 3px solid var(--line-strong); border-radius: 24px; background: var(--card); }
.wire .part { position: absolute; border-radius: 10px; background: var(--sunk); display: grid; place-items: center; font-weight: 800; font-size: .85rem; text-align: center; padding: 4px; color: var(--text); border: 1px solid var(--line); overflow: hidden; }
.wire .part.q { border: 1.5px dashed var(--line-strong); background: transparent; }
.level-grid { display: grid; gap: 2px; background: var(--line); border-radius: 10px; overflow: hidden; border: 2px solid var(--line); user-select: none; touch-action: none; }
.level-grid div { aspect-ratio: 1; background: var(--card); display: grid; place-items: center; font-size: 1.1rem; cursor: pointer; }
.kitgrid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.kitcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.kitcard .pv { background: var(--sunk); border-radius: 12px; height: 230px; display: grid; place-items: center; overflow: hidden; margin-bottom: 12px; }
.kitcard canvas { width: auto; height: auto; max-width: 92%; max-height: 210px; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.results { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.res { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r); padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.res.in { border-color: var(--teal); border-width: 2.5px; }
.res img { width: 100%; height: 130px; object-fit: cover; border-radius: 10px; background: #1B2340; }
.res b { font-size: .95rem; }
.res small { color: var(--muted); font-size: .8rem; line-height: 1.3; }

/* Modal, toast, command menu */
.overlay { position: fixed; inset: 0; background: rgba(15, 17, 26, .5); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: var(--card); color: var(--text); border-radius: 26px; padding: 28px 32px; width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow); position: relative; }
.modal.wide { max-width: 1060px; }
.modal.mid { max-width: 720px; }
.modal .close { position: absolute; top: 20px; right: 20px; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: var(--ink-text); padding: 12px 22px; border-radius: 14px; font-weight: 700; z-index: 300; max-width: 92vw; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; }
.toast svg { width: 22px; height: 22px; color: #F2C14E; flex: none; }
.cmd { max-width: 620px; padding: 0; overflow: hidden; align-self: start; margin-top: 12vh; }
.cmd input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 18px 22px; font-size: 1.15rem; outline: none !important; }
.cmd .list { max-height: 50vh; overflow-y: auto; padding: 8px; }
.cmd .foot { border-top: 1px solid var(--line); padding: 10px 18px; font-size: .85rem; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; }
.pinboxes { display: flex; gap: 12px; }
.pinboxes input { width: 58px; height: 64px; text-align: center; font-size: 1.6rem; font-weight: 800; padding: 0; }
.relcards { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.relcard { border: 1.5px solid var(--line); border-radius: 20px; padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.relcard.pick { border: 2.5px solid var(--text); }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; align-items: center; }
.keys .k { display: flex; gap: 4px; justify-content: flex-end; }

/* Public pages */
.public { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.ptop { display: flex; align-items: center; gap: 14px; padding: 18px 32px; border-bottom: 1px solid var(--line); }
.hero { flex: 1; display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; max-width: 1180px; margin: 0 auto; padding: 48px 32px; width: 100%; }
.hero h1 { font-size: 3.2rem; line-height: 1.08; margin-bottom: 18px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.authcard { border-radius: 26px; padding: 28px; }
.seg { display: inline-flex; background: var(--sunk); border-radius: 999px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 7px 16px; font-weight: 800; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 12px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.tablewrap { overflow-x: auto; }
.stat b { display: block; font-size: 2.2rem; font-weight: 800; line-height: 1.1; }

@media (max-width: 1500px) { .hide-narrow { display: none !important; } }
/* Phone and tablet */
.sheetbtn { display: none; }
@media (max-width: 1180px) {
  .panel { width: min(50vw, 520px); }
  .panel.wide { width: min(60vw, 720px); }
}
@media (max-width: 980px) {
  .app, .app.rail { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 80; left: 0; top: 0; bottom: 0; width: 290px; transform: translateX(-105%); transition: transform .2s; box-shadow: var(--shadow); }
  .app.rail .side { align-items: stretch; padding: 18px 16px 12px; }
  .app.rail .side .hide-rail { display: initial !important; }
  .app.rail .side .show-rail { display: none; }
  .app.sideopen .side { transform: none; }
  .menu-only { display: inline-grid; }
  .panel, .panel.wide { position: fixed; z-index: 70; left: 0; right: 0; top: 64px; bottom: 0; width: auto; border-left: 0; border-top: 1px solid var(--line); transform: translateY(-110%); transition: transform .2s; box-shadow: var(--shadow); }
  .app.sheet .panel { transform: none; }
  .sheetbtn { display: inline-flex; }
  .bar { padding: 10px 14px; }
  .chat { padding: 18px 14px 8px; }
  .composer { padding: 8px 12px 12px; }
  .page { padding: 24px 18px 50px; }
  .hero { grid-template-columns: 1fr; padding: 28px 18px; gap: 24px; }
  .hero h1 { font-size: 2.3rem; }
  .relcards { grid-template-columns: 1fr; }
  .board.c6 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .start h1 { font-size: 1.8rem; }
  .rows { grid-template-columns: 1fr; gap: 6px; }
  .board, .board.c6 { grid-template-columns: 1fr; }
  .bar .meta { display: none; }
  .ptop { padding: 14px 16px; }
  .modal { padding: 22px 18px; border-radius: 20px; }
  .levelsel { position: static; margin-bottom: 14px; }
  .hide-phone { display: none !important; }
  .page h1 { font-size: 1.9rem; }
  .pinboxes input { width: 50px; height: 56px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Makers (characters, vehicles, items, places, anything) ---------- */
.mk-samples { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: thin; }
.mk-sample { flex: none; width: 88px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--card, var(--bg)); cursor: pointer; font: inherit; color: var(--text); }
.mk-sample:hover { border-color: var(--text); }
.mk-sample svg { width: 72px; height: 54px; }
.mk-sample span { font-size: .72rem; font-weight: 800; line-height: 1.15; text-align: center; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.mk-sample.new { justify-content: center; border-style: dashed; font-size: 1.3rem; min-height: 86px; }
.mk-sample.new span { font-size: .72rem; }
.mk-main { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(260px, 1.15fr); gap: 18px; align-items: start; }
.mk-stage { position: relative; aspect-ratio: 1; border-radius: 18px; border: 1.5px solid var(--line); background: var(--sunk); overflow: hidden; touch-action: none; }
.mk-stage.wide { aspect-ratio: 3 / 2; }
.mk-stage.checker { background-color: #fff; background-image: linear-gradient(45deg, #EEF0F4 25%, transparent 25%), linear-gradient(-45deg, #EEF0F4 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #EEF0F4 75%), linear-gradient(-45deg, transparent 75%, #EEF0F4 75%); background-size: 22px 22px; background-position: 0 0, 0 11px, 11px -11px, -11px 0; }
.mk-stage > svg { position: relative; z-index: 2; width: 100%; height: 100%; display: block; }
.mk-stage [data-pi] { cursor: grab; }
.mk-stage .mk-pix { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; z-index: 1; }
.mk-stage.px > svg { opacity: .02; }
.mk-selbox { fill: none; stroke: var(--accent, #E8590C); stroke-width: 1.6; stroke-dasharray: 5 4; pointer-events: none; }
.mk-row { margin-top: 12px; }
.mk-row .caps { display: block; margin-bottom: 6px; }
.mk-row .pills { gap: 6px; }
.mk-sw { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mk-sw .sw { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid rgba(0,0,0,.18); cursor: pointer; padding: 0; }
.mk-sw .sw.on { outline: 3px solid var(--text); outline-offset: 2px; }
.mk-sw .sw.none { background: repeating-linear-gradient(45deg, #fff 0 4px, #DEE2E6 4px 8px); }
.mk-sw input[type=color] { width: 34px; height: 28px; padding: 0 2px; border-radius: 8px; }
.mk-slots { gap: 6px; margin-bottom: 10px; }
.dotmark { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--teal, #0F7A6C); vertical-align: middle; margin-left: 2px; }
.mk-opts { max-height: 300px; overflow-y: auto; padding: 2px; }
.mk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.mk-grid.big { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); max-height: 56vh; overflow-y: auto; }
.mk-opt { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 4px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card, var(--bg)); cursor: pointer; font: inherit; color: var(--text); min-height: 76px; justify-content: center; }
.mk-opt:hover { border-color: var(--text); }
.mk-opt.on { border: 2.5px solid var(--text); background: var(--sunk); }
.mk-opt svg { width: 52px; height: 52px; }
.mk-grid.big .mk-opt svg { width: 64px; height: 64px; }
.mk-opt span { font-size: .68rem; font-weight: 700; text-align: center; line-height: 1.15; }
.mk-sel { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.mk-colrow { display: flex; align-items: center; gap: 8px; margin: 6px 0; flex-wrap: wrap; }
.mk-sliders { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin: 10px 0; }
.mk-sliders label { font-size: .78rem; font-weight: 800; display: flex; flex-direction: column; gap: 2px; }
.mk-sliders input[type=range] { width: 100%; accent-color: var(--accent, #E8590C); }
.mk-btns { gap: 6px; }
.mk-btns .icon-btn { width: 34px; height: 34px; font-weight: 800; }
.mk-foot { gap: 8px; flex-wrap: wrap; }
.mk-foot #mk-name { max-width: 200px; }
.mk-main { grid-template-columns: minmax(220px, 1fr) minmax(240px, 1.15fr); }
.mk-left { position: sticky; top: 0; align-self: start; }
@media (max-width: 560px) { .mk-main { grid-template-columns: 1fr; } .mk-left { position: static; } }

/* Phones: KinoviKids is for tablets and computers */
.phone-gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.phone-gate .card { max-width: 420px; text-align: center; padding: 28px 24px; }
.phone-gate .pg-logo { font-family: Fredoka, Nunito, sans-serif; font-weight: 700; font-size: 1.6rem; color: var(--accent, #E8590C); margin-bottom: 10px; }
.phone-gate h1 { font-size: 1.5rem; margin: 0 0 12px; }
.phone-gate p { margin: 0 0 10px; }

/* Learning pages: a full page for every real word */
.tip-more { display: inline-block; margin-left: 4px; background: var(--ink-text); color: var(--ink); border: 0; border-radius: 999px; padding: 2px 10px; font: inherit; font-size: .8rem; font-weight: 800; cursor: pointer; }
.learn-hero { margin: 18px 0 6px; padding: 24px; border-radius: 22px; background: var(--sunk); border: 1px solid var(--line); }
.learn-hero h1 { margin: 6px 0 8px; font-size: 2.4rem; }
.learn-mean { font-size: 1.25rem; font-weight: 700; margin: 0 0 12px; max-width: 760px; }
.learn-mine { margin-top: 16px; border: 2px solid var(--teal, #0F7A6C); }
.learn-list { margin: 0; padding-left: 20px; line-height: 1.8; }
.learn-try { border: 2px solid var(--accent, #E8590C); }
.grid.g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.start .start-sub { text-align: center; color: var(--muted); font-size: 1.1rem; font-weight: 700; margin: -14px 0 22px; }
.mk-guide { border: 2px solid var(--accent, #E8590C); border-radius: 16px; padding: 12px 16px; margin-bottom: 12px; background: var(--sunk); }
.mk-guide ol { margin: 6px 0 10px; padding-left: 20px; line-height: 1.6; }
.mk-next { border: 2px solid var(--teal, #0F7A6C); border-radius: 16px; padding: 12px 14px; margin-bottom: 12px; background: var(--sunk); }
.font-sample { font-size: 1.6rem; padding: 14px 6px; text-align: center; background: var(--sunk); border-radius: 10px; margin-bottom: 6px; }
