/* Life: Night studio.
   Layout: a thin icon rail, a stage of live glass tiles that open into apps, and Lana's
   bar anchored at the bottom of every screen. Dark first; a light set follows the Mac.
   Colour: each app has its own glow; Lana is ember (coral into amber). */
:root {
  color-scheme: dark;
  --bg: #070A14;
  --solid: #10152A;
  --ink: #EEF1FA;
  --muted: #9BA3C2;
  --faint: #6A7294;
  --glass: rgba(255, 255, 255, .045);
  --glass-2: rgba(255, 255, 255, .085);
  --stroke: rgba(255, 255, 255, .09);
  --stroke-2: rgba(255, 255, 255, .2);
  --sheen: rgba(255, 255, 255, .07);
  --scrim: rgba(4, 6, 14, .55);
  --ember-1: #FF6B4A;
  --ember-2: #FFB23E;
  --on-ember: #1B0E08;
  --good: #3DDC97;
  --warn: #FFB23E;
  --bad: #FF7A7A;
  --c-home: #FFB23E; --c-lana: #FF8A5C; --c-documents: #5CB8FF; --c-money: #3DDC97; --c-learn: #A78BFA;
  --c-journal: #2DD4BF; --c-studio: #FF6FA3; --c-guitar: #B6E05A; --c-plan: #F6C453; --c-settings: #9BA3C2; --c-play: #8EA2FF; --c-music: #B6E05A; --c-career: #FF9B6B; --c-memory: #D08CFF; --c-books: #E0A46A; --c-body: #FF7D6B; --c-tasks: #E3F05B;
  --a-surgeon: #2DD4BF; --a-body: #FF6B4A; --a-people: #FF6FA3; --a-voice: #FFB23E; --a-mind: #A78BFA;
  --a-guitar: #B6E05A; --a-money: #3DDC97; --a-sleep: #8EA2FF; --a-admin: #9BA3C2;
  --amb-1: #3B2A6B; --amb-2: #0E5A6B; --amb-3: #6B2A45;
  --shadow: 0 24px 60px rgba(0, 0, 0, .45);
  --r: 22px;
  --r-s: 13px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font-display: "Avenir Next", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #ECEEF6; --solid: #FFFFFF; --ink: #12162A; --muted: #586182; --faint: #8A91AD;
    --glass: rgba(255, 255, 255, .6); --glass-2: rgba(255, 255, 255, .86);
    --stroke: rgba(18, 22, 42, .09); --stroke-2: rgba(18, 22, 42, .22); --sheen: rgba(255, 255, 255, .7);
    --scrim: rgba(18, 22, 42, .28);
    --ember-1: #F0553A; --ember-2: #F49B1B; --on-ember: #FFFFFF;
    --good: #12986A; --warn: #B06D00; --bad: #C8372D;
    --c-home: #B97500; --c-lana: #E4572E; --c-documents: #1C7FD6; --c-money: #12986A; --c-learn: #6D4FE0;
    --c-journal: #0E9C8C; --c-studio: #D9417B; --c-guitar: #5E8F1A; --c-plan: #A67B00; --c-settings: #586182; --c-play: #4A5FE0; --c-music: #5E8F1A; --c-career: #C2571F; --c-memory: #8A3FD1; --c-books: #98622A; --c-body: #D64A32; --c-tasks: #6F7A00;
    --a-surgeon: #0E9C8C; --a-body: #E4572E; --a-people: #D9417B; --a-voice: #B97500; --a-mind: #6D4FE0;
    --a-guitar: #5E8F1A; --a-money: #12986A; --a-sleep: #5566EA; --a-admin: #586182;
    --amb-1: #D9CCFF; --amb-2: #BFEDEA; --amb-3: #FFD6C2;
    --shadow: 0 18px 44px rgba(18, 22, 42, .14);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ECEEF6; --solid: #FFFFFF; --ink: #12162A; --muted: #586182; --faint: #8A91AD;
  --glass: rgba(255, 255, 255, .6); --glass-2: rgba(255, 255, 255, .86);
  --stroke: rgba(18, 22, 42, .09); --stroke-2: rgba(18, 22, 42, .22); --sheen: rgba(255, 255, 255, .7);
  --scrim: rgba(18, 22, 42, .28);
  --ember-1: #F0553A; --ember-2: #F49B1B; --on-ember: #FFFFFF;
  --good: #12986A; --warn: #B06D00; --bad: #C8372D;
  --c-home: #B97500; --c-lana: #E4572E; --c-documents: #1C7FD6; --c-money: #12986A; --c-learn: #6D4FE0;
  --c-journal: #0E9C8C; --c-studio: #D9417B; --c-guitar: #5E8F1A; --c-plan: #A67B00; --c-settings: #586182; --c-play: #4A5FE0; --c-music: #5E8F1A; --c-career: #C2571F; --c-memory: #8A3FD1; --c-books: #98622A; --c-body: #D64A32; --c-tasks: #6F7A00;
  --a-surgeon: #0E9C8C; --a-body: #E4572E; --a-people: #D9417B; --a-voice: #B97500; --a-mind: #6D4FE0;
  --a-guitar: #5E8F1A; --a-money: #12986A; --a-sleep: #5566EA; --a-admin: #586182;
  --amb-1: #D9CCFF; --amb-2: #BFEDEA; --amb-3: #FFD6C2;
  --shadow: 0 18px 44px rgba(18, 22, 42, .14);
}
body[data-tod="dawn"] { --amb-1: #6B2F5A; --amb-2: #A4532B; --amb-3: #3B2A6B; }
body[data-tod="day"] { --amb-1: #1F4F8A; --amb-2: #0E6B66; --amb-3: #3B2A6B; }
body[data-tod="dusk"] { --amb-1: #7A2E4B; --amb-2: #8A5A1E; --amb-3: #2A2F6B; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
/* slow-moving light behind the glass */
body::before {
  content: "";
  position: fixed; inset: -25%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(34% 30% at 20% 18%, color-mix(in srgb, var(--amb-1) 62%, transparent), transparent 72%),
    radial-gradient(30% 28% at 84% 22%, color-mix(in srgb, var(--amb-2) 52%, transparent), transparent 72%),
    radial-gradient(38% 34% at 58% 92%, color-mix(in srgb, var(--amb-3) 46%, transparent), transparent 72%);
  filter: blur(48px);
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--c-documents); }
:focus-visible { outline: 2px solid var(--ember-2); outline-offset: 2px; border-radius: 8px; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; text-wrap: balance; letter-spacing: -0.015em; }
h1 { font-size: clamp(1.9rem, 3.4vw, 2.7rem); font-weight: 700; line-height: 1.05; }
h2 { font-size: 1.08rem; font-weight: 600; }
h3 { font-size: .98rem; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .84rem; }
.num { font-variant-numeric: tabular-nums; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: .75rem; min-width: 0; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-width: 0; }
.eyebrow { font-size: .74rem; font-weight: 650; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.clip1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clip2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- frame ---------- */
.app { display: grid; grid-template-columns: 78px minmax(0, 1fr); height: 100%; }
.rail {
  display: flex; flex-direction: column; align-items: center; gap: .35rem;
  padding: .9rem 0;
  border-right: 1px solid var(--stroke);
  background: linear-gradient(180deg, var(--glass-2), var(--glass));
  backdrop-filter: blur(22px) saturate(150%);
  overflow-y: auto; scrollbar-width: none;
}
.rail .spacer { flex: 1; }
.nav {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  width: 62px; padding: .5rem 0 .4rem;
  border: 0; border-radius: 16px; background: none;
  color: var(--muted); font-size: .66rem; font-weight: 600;
  transition: color .2s, background-color .2s, transform .2s var(--ease);
}
.nav svg { width: 21px; height: 21px; }
.nav:hover { color: var(--ink); transform: translateY(-1px); }
.nav[aria-current="page"] { color: var(--c); background: color-mix(in srgb, var(--c) 15%, transparent); box-shadow: 0 0 22px color-mix(in srgb, var(--c) 22%, transparent); }
.stage { overflow-y: auto; height: 100%; padding: 2rem clamp(1rem, 3vw, 2.4rem) 9rem; scroll-behavior: smooth; }
.stage-inner { max-width: 1220px; margin: 0 auto; display: flex; flex-direction: column; gap: 1.3rem; }
.demo-flag { position: fixed; top: .7rem; right: .9rem; z-index: 30; }

/* ---------- glass ---------- */
.panel {
  position: relative;
  border-radius: var(--r);
  border: 1px solid var(--stroke);
  background: linear-gradient(180deg, var(--glass-2), var(--glass));
  backdrop-filter: blur(22px) saturate(150%);
  box-shadow: inset 0 1px 0 var(--sheen);
  padding: 1.15rem;
  min-width: 0;
}
.bento { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1rem; }
.tile {
  grid-column: span var(--span, 4);
  display: flex; flex-direction: column; gap: .85rem;
  overflow: hidden; isolation: isolate;
  transition: transform .3s var(--ease), border-color .3s, box-shadow .3s;
}
.tile::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(460px circle at var(--mx, 10%) var(--my, 0%), color-mix(in srgb, var(--c) 24%, transparent), transparent 62%);
  opacity: .8; transition: opacity .3s;
}
.tile:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--c) 42%, var(--stroke)); box-shadow: inset 0 1px 0 var(--sheen), 0 18px 44px color-mix(in srgb, var(--c) 12%, transparent); }
.tile.pulse { animation: pulse 1.2s var(--ease); }
.tile-head { display: flex; align-items: center; gap: .65rem; }
.glyph {
  width: 36px; height: 36px; flex: none; border-radius: 12px;
  display: grid; place-items: center;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 16%, transparent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--c) 22%, transparent);
}
.glyph svg { width: 19px; height: 19px; }
.open {
  display: inline-flex; align-items: center; gap: .25rem;
  border: 0; background: none; padding: .3rem .1rem; color: var(--muted); font-size: .82rem; font-weight: 600;
}
.open svg { width: 15px; height: 15px; transition: transform .2s var(--ease); }
.open:hover { color: var(--ink); }
.open:hover svg { transform: translateX(3px); }
.big { font-family: var(--font-display); font-size: 2.1rem; font-weight: 700; line-height: 1.05; letter-spacing: -0.02em; }
.mid { font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; line-height: 1.25; }

/* greeting */
.hello { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; padding: .4rem .2rem .2rem; }
.hello .lead { max-width: 62ch; margin-top: .5rem; font-size: 1.04rem; color: var(--muted); }
.clock { font-family: var(--font-display); font-size: 2.6rem; font-weight: 600; letter-spacing: -0.03em; line-height: 1; color: var(--muted); }

/* app pages */
.app-head {
  display: flex; align-items: center; gap: .9rem; flex-wrap: wrap;
  padding: 1.1rem 1.2rem; overflow: hidden; isolation: isolate;
}
.app-head::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(520px circle at 0% 0%, color-mix(in srgb, var(--c) 30%, transparent), transparent 64%);
}
.app-head .glyph { width: 46px; height: 46px; border-radius: 15px; }
.app-head .glyph svg { width: 24px; height: 24px; }
.app-head h1 { font-size: 1.7rem; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 38px; padding: .45rem .95rem;
  border: 1px solid var(--stroke); border-radius: var(--r-s);
  background: var(--glass-2); font-weight: 600; white-space: nowrap;
  transition: transform .15s var(--ease), border-color .2s, background-color .2s;
}
.btn svg { width: 17px; height: 17px; flex: none; }
.btn:hover { border-color: var(--stroke-2); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn.primary { border-color: transparent; background: linear-gradient(135deg, var(--ember-1), var(--ember-2)); color: var(--on-ember); box-shadow: 0 8px 26px color-mix(in srgb, var(--ember-1) 34%, transparent); }
.btn.tint { border-color: color-mix(in srgb, var(--c) 40%, transparent); background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); }
.btn.ghost { border-color: transparent; background: none; }
.btn.danger { color: var(--bad); }
.btn.round { width: 38px; padding: 0; border-radius: 50%; }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field > span { font-size: .78rem; font-weight: 600; color: var(--muted); }
.input {
  width: 100%; min-height: 40px; padding: .5rem .75rem;
  border: 1px solid var(--stroke); border-radius: var(--r-s);
  background: color-mix(in srgb, var(--solid) 55%, transparent);
  transition: border-color .2s, box-shadow .2s;
}
.input:focus { outline: none; border-color: color-mix(in srgb, var(--ember-2) 70%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ember-2) 18%, transparent); }
textarea.input { resize: vertical; line-height: 1.45; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .7rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  min-height: 31px; padding: .28rem .75rem;
  border: 1px solid var(--stroke); border-radius: 999px;
  background: var(--glass); color: var(--muted); font-size: .84rem; font-weight: 600;
  transition: color .2s, border-color .2s, background-color .2s, transform .15s var(--ease);
}
button.chip:hover { color: var(--ink); border-color: var(--stroke-2); transform: translateY(-1px); }
.chip svg { width: 15px; height: 15px; flex: none; color: var(--c, currentColor); }
.chip[aria-pressed="true"] { border-color: transparent; background: color-mix(in srgb, var(--c, var(--ember-2)) 22%, transparent); color: var(--c, var(--ember-2)); }
.tag {
  display: inline-block; padding: .12rem .5rem; border-radius: 7px;
  font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  background: color-mix(in srgb, var(--c, var(--muted)) 16%, transparent); color: var(--c, var(--muted));
}
.seg { display: inline-flex; padding: 4px; border-radius: 14px; background: var(--glass); border: 1px solid var(--stroke); }
.seg button { border: 0; background: none; padding: .38rem .9rem; border-radius: 10px; font-weight: 600; color: var(--muted); transition: color .2s, background-color .2s; }
.seg button[aria-pressed="true"] { background: color-mix(in srgb, var(--c, var(--ember-2)) 20%, transparent); color: var(--c, var(--ink)); }


/* ---------- tasks ---------- */
.task {
  display: flex; align-items: flex-start; gap: .65rem; padding: .55rem .65rem;
  border: 1px solid var(--stroke); border-left: 3px solid color-mix(in srgb, var(--c) 70%, transparent);
  border-radius: 14px; background: var(--glass);
  transition: background-color .25s, border-color .25s, opacity .3s, transform .35s var(--ease);
}
.task .box { width: 24px; height: 24px; flex: none; margin-top: 1px; border-radius: 8px; display: grid; place-items: center; padding: 0; background: none; border: 1.5px solid color-mix(in srgb, var(--c) 60%, transparent); color: transparent; transition: background-color .25s, color .25s, transform .2s var(--ease); }
.task .box svg { width: 15px; height: 15px; }
.task .box:hover { transform: scale(1.08); }
.task .body { border: 0; background: none; padding: 0; text-align: left; display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.task .t { font-weight: 550; line-height: 1.3; overflow-wrap: anywhere; }
.task .meta { display: flex; flex-wrap: wrap; gap: .55rem; }
.task .meta .dot { color: var(--c); font-weight: 600; }
.task.done { background: color-mix(in srgb, var(--c) 10%, transparent); }
.task.done .box { background: var(--c); color: var(--bg); }
.task.done .t { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.task.leaving { opacity: 0; transform: translateX(24px); }
.late { color: var(--warn); font-weight: 600; }
.warn { color: var(--warn); }
.dumpbox { min-height: 7.5rem; resize: vertical; }
.btn.live { color: var(--bad, #ff6b6b); border-color: currentColor; }
.quickadd .input { width: auto; flex: 0 0 auto; }
.lana-head .btn.voice { font-size: .8rem; }
@media (max-width: 560px) { .lana-head .btn.voice { font-size: 0; gap: 0; } }
.li .fav { flex: none; display: grid; color: var(--c-learn); }
.li .fav svg { width: 16px; height: 16px; }
.quickadd .input.grow { flex: 1 1 16rem; min-width: 0; }

/* ---------- pieces ---------- */
.grid { display: grid; gap: 1rem; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.move {
  display: flex; align-items: center; gap: .6rem; width: 100%;
  padding: .55rem .65rem; text-align: left;
  border: 1px solid var(--stroke); border-radius: 14px; background: var(--glass);
  transition: background-color .25s, border-color .25s, transform .15s var(--ease);
}
.move:hover { transform: translateX(2px); border-color: var(--stroke-2); }
.move .box { width: 24px; height: 24px; flex: none; border-radius: 8px; display: grid; place-items: center; border: 1.5px solid color-mix(in srgb, var(--c) 60%, transparent); color: transparent; transition: background-color .25s, color .25s; }
.move .box svg { width: 15px; height: 15px; }
.move.done { background: color-mix(in srgb, var(--c) 12%, transparent); border-color: color-mix(in srgb, var(--c) 34%, transparent); }
.move.done .box { background: var(--c); color: var(--bg); }
.move.done .t { color: var(--muted); }
.move .t { font-weight: 550; line-height: 1.3; }
.shortv { border: 0; background: none; padding: .1rem 0 .1rem 2.3rem; text-align: left; font-size: .8rem; color: var(--faint); text-decoration: underline dotted; text-underline-offset: 3px; }
.shortv[aria-pressed="true"] { color: var(--c); text-decoration: none; font-weight: 600; }
.ringrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(44px, 1fr)); gap: .6rem .3rem; }
.ring { display: flex; flex-direction: column; align-items: center; gap: .15rem; min-width: 0; font-size: .72rem; font-weight: 600; color: var(--muted); }
.ring svg { width: 42px; height: 42px; transform: rotate(-90deg); filter: drop-shadow(0 0 6px color-mix(in srgb, var(--c) 45%, transparent)); }
.ring circle { fill: none; stroke-width: 6; }
.ring .bg { stroke: var(--stroke); }
.ring .fg { stroke: var(--c); stroke-linecap: round; }
.ring b { color: var(--ink); }
.bar { height: 8px; border-radius: 4px; background: var(--stroke); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; background: var(--c, var(--ember-2)); box-shadow: 0 0 12px color-mix(in srgb, var(--c, var(--ember-2)) 60%, transparent); }
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: .8rem; padding: .65rem .3rem; border-top: 1px solid var(--stroke); min-width: 0; }
.li:first-child { border-top: 0; }
button.li { width: 100%; border-left: 0; border-right: 0; border-bottom: 0; background: none; text-align: left; border-radius: 10px; transition: background-color .2s; }
button.li:hover { background: var(--glass-2); }
.li .ttl { font-weight: 600; overflow-wrap: anywhere; }
.li .amt { font-weight: 700; white-space: nowrap; }
.thumb { width: 44px; height: 44px; flex: none; border-radius: 11px; object-fit: cover; background: var(--glass-2); border: 1px solid var(--stroke); display: grid; place-items: center; color: var(--muted); }
.thumb svg { width: 20px; height: 20px; }
.fan { display: flex; padding-left: 14px; }
.fan > * { width: 64px; height: 82px; margin-left: -14px; border-radius: 12px; border: 1px solid var(--stroke-2); object-fit: cover; background: var(--solid); box-shadow: 0 8px 20px rgba(0, 0, 0, .3); transition: transform .3s var(--ease); display: grid; place-items: center; color: var(--muted); }
.fan > *:nth-child(odd) { transform: rotate(-4deg); }
.fan > *:nth-child(even) { transform: rotate(3deg) translateY(4px); }
.tile:hover .fan > * { transform: rotate(0) translateY(-3px); margin-left: -6px; }
.docgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .9rem; }
.doc { display: flex; flex-direction: column; padding: 0; overflow: hidden; text-align: left; transition: transform .3s var(--ease), border-color .3s; }
.doc:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--c-documents) 45%, var(--stroke)); }
.doc .pic { aspect-ratio: 4 / 3; width: 100%; object-fit: cover; background: var(--glass-2); display: grid; place-items: center; color: var(--muted); }
.doc .meta { padding: .65rem .8rem .8rem; display: flex; flex-direction: column; gap: .2rem; }
.empty { padding: 1.6rem; text-align: center; color: var(--muted); border: 1px dashed var(--stroke-2); border-radius: var(--r); }
.drop { width: 100%; background: none; border: 1.5px dashed var(--stroke-2); border-radius: 16px; padding: 1rem; text-align: center; color: var(--muted); transition: border-color .2s, background-color .2s; }
.drop.over { border-color: var(--c-documents); background: color-mix(in srgb, var(--c-documents) 10%, transparent); color: var(--ink); }
.prose { max-width: 68ch; }
.prose p + p { margin-top: .75rem; }
.quote { font-family: var(--font-display); font-size: 1.3rem; line-height: 1.3; font-weight: 600; }
.thinking { display: inline-flex; gap: 4px; align-items: center; }
.thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--ember-2); opacity: .35; }
.stat .v { font-family: var(--font-display); font-size: 1.75rem; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
.cols { display: flex; align-items: flex-end; gap: 6px; height: 64px; }
.cols i { flex: 1; min-width: 6px; border-radius: 5px 5px 2px 2px; background: color-mix(in srgb, var(--c) 70%, transparent); }
.wave { display: flex; align-items: center; gap: 3px; height: 44px; }
.wave i { width: 4px; border-radius: 2px; background: var(--c-studio); height: 20%; transition: height .12s linear; }

/* spark deck: one card at a time */
.deck { display: grid; flex: 1; }
.deck > * { grid-area: 1 / 1; display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
.dots { display: flex; gap: 6px; }
.dots button { width: 7px; height: 7px; padding: 0; border: 0; border-radius: 50%; background: var(--stroke-2); transition: width .3s var(--ease), background-color .3s; }
.dots button[aria-current="true"] { width: 22px; border-radius: 4px; background: var(--c); }

/* flip card */
.flip { perspective: 1400px; }
.flip-inner { display: grid; transition: transform .7s var(--ease); transform-style: preserve-3d; }
.flip.on .flip-inner { transform: rotateY(180deg); }
.face { grid-area: 1 / 1; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.face.back { transform: rotateY(180deg); }

/* document reading */
.scan { position: relative; overflow: hidden; border-radius: 16px; border: 1px solid var(--stroke); background: var(--glass-2); }
.scan img { display: block; width: 100%; }
.scan.reading::after {
  content: ""; position: absolute; left: 0; right: 0; top: -30%; height: 30%;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--c-documents) 60%, transparent) 78%, #fff 79%, transparent 80%);
}

/* ---------- Lana ---------- */
.orb {
  --s: 30px;
  position: relative; flex: none; width: var(--s); height: var(--s); border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #FFE9C4 0 10%, var(--ember-2) 34%, var(--ember-1) 64%, #7A2140 100%);
  box-shadow: 0 0 calc(var(--s) * .7) color-mix(in srgb, var(--ember-1) 55%, transparent), inset 0 0 calc(var(--s) * .22) rgba(255, 255, 255, .4);
}
.orb::before {
  content: ""; position: absolute; inset: -16%; border-radius: 50%; opacity: 0;
  background: conic-gradient(from 0deg, transparent 0 50%, color-mix(in srgb, var(--ember-2) 85%, transparent) 78%, transparent 100%);
  filter: blur(calc(var(--s) * .1)); transition: opacity .3s;
}
.orb::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--ember-2) 80%, transparent); opacity: 0; }
.orb[data-state="thinking"]::before { opacity: .95; }
.orb.big { --s: 92px; }
.lana { position: fixed; z-index: 50; bottom: 1.1rem; left: calc(78px + (100% - 78px) / 2); transform: translateX(-50%); width: min(740px, calc(100% - 78px - 2rem)); }
.lana-bar {
  display: flex; align-items: center; gap: .5rem;
  padding: .45rem .5rem .45rem .7rem;
  border-radius: 999px; border: 1px solid var(--stroke-2);
  background: color-mix(in srgb, var(--solid) 78%, transparent);
  backdrop-filter: blur(26px) saturate(160%);
  box-shadow: var(--shadow), 0 0 44px color-mix(in srgb, var(--ember-1) 16%, transparent);
  transition: box-shadow .3s, border-color .3s;
}
.lana-bar:focus-within { border-color: color-mix(in srgb, var(--ember-2) 60%, transparent); box-shadow: var(--shadow), 0 0 60px color-mix(in srgb, var(--ember-1) 30%, transparent); }
.lana-bar textarea { flex: 1; min-width: 0; height: 40px; max-height: 140px; resize: none; border: 0; background: none; outline: none; padding: .55rem .2rem; line-height: 1.4; }
.lana-bar kbd { font: inherit; font-size: .72rem; color: var(--faint); border: 1px solid var(--stroke); border-radius: 6px; padding: .05rem .35rem; }
.lana-scrim { position: fixed; inset: 0; z-index: 49; background: var(--scrim); backdrop-filter: blur(4px); }
.lana-panel {
  position: absolute; left: 0; right: 0; bottom: calc(100% + .6rem);
  height: min(68vh, 640px);
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: 26px; border: 1px solid var(--stroke-2);
  background: color-mix(in srgb, var(--solid) 90%, transparent);
  backdrop-filter: blur(30px) saturate(160%);
  box-shadow: var(--shadow);
  transform-origin: 50% 100%;
}
.lana-head { display: flex; align-items: center; gap: .6rem; padding: .8rem 1rem; border-bottom: 1px solid var(--stroke); }
.msgs { flex: 1 1 auto; overflow-y: auto; padding: 1.1rem; display: flex; flex-direction: column; gap: .7rem; }
.welcome { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 1rem; text-align: center; max-width: 46ch; }
.msg { max-width: 88%; padding: .65rem .9rem; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: color-mix(in srgb, var(--ember-1) 20%, var(--glass-2)); border: 1px solid color-mix(in srgb, var(--ember-1) 30%, transparent); border-bottom-right-radius: 6px; }
.msg.bot { align-self: flex-start; background: var(--glass-2); border: 1px solid var(--stroke); border-bottom-left-radius: 6px; }
.msg img { display: block; max-width: 170px; border-radius: 12px; margin-bottom: .45rem; }
.act {
  align-self: flex-start; display: flex; align-items: center; gap: .55rem;
  padding: .45rem .8rem .45rem .5rem; border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--good) 35%, transparent);
  background: color-mix(in srgb, var(--good) 10%, transparent);
  font-size: .86rem; font-weight: 600;
}
.act.fail { border-color: color-mix(in srgb, var(--bad) 40%, transparent); background: color-mix(in srgb, var(--bad) 10%, transparent); }
.act svg { width: 20px; height: 20px; color: var(--good); }
.act.fail svg { color: var(--bad); }
.act svg path { stroke-dasharray: 30; stroke-dashoffset: 30; }
.suggest { display: flex; flex-wrap: wrap; justify-content: center; gap: .45rem; }
.attach { display: flex; gap: .4rem; padding: 0 1rem .6rem; flex-wrap: wrap; }
.attach .chip button { border: 0; background: none; padding: 0; color: inherit; }

/* ---------- sheet, toast, lock ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); backdrop-filter: blur(4px); z-index: 60; }
.sheet {
  position: fixed; top: .8rem; right: .8rem; bottom: .8rem; z-index: 61;
  width: min(540px, calc(100% - 1.6rem)); overflow-y: auto;
  padding: 1.2rem; border-radius: 26px; border: 1px solid var(--stroke-2);
  background: color-mix(in srgb, var(--solid) 92%, transparent);
  backdrop-filter: blur(30px);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 1rem;
}
.toasts { position: fixed; left: 50%; top: 1rem; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: .4rem; align-items: center; }
.toast { padding: .55rem 1rem; border-radius: 999px; border: 1px solid var(--stroke-2); background: color-mix(in srgb, var(--solid) 92%, transparent); backdrop-filter: blur(20px); font-weight: 600; box-shadow: var(--shadow); }
.toast.bad { border-color: color-mix(in srgb, var(--bad) 60%, transparent); color: var(--bad); }
.lock { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: var(--bg); }
.lock form { width: min(340px, 90%); display: flex; flex-direction: column; align-items: center; gap: 1rem; text-align: center; }

/* ---------- small screens ---------- */
.tabbar { display: none; }
@media (max-width: 1100px) {
  .bento { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .tile { grid-column: span min(var(--span, 3), 6); }
  .tile[style*="--span: 3"], .tile[style*="--span: 4"] { grid-column: span 3; }
  .tile[style*="--span: 5"], .tile[style*="--span: 6"], .tile[style*="--span: 7"], .tile[style*="--span: 8"] { grid-column: span 6; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .stage { padding: 1.1rem max(16px, env(safe-area-inset-right, 0px)) 11rem max(16px, env(safe-area-inset-left, 0px)); }
  .bento { grid-template-columns: minmax(0, 1fr); }
  .tile, .tile[style] { grid-column: auto; }
  .clock { display: none; }
  .lana { left: 50%; width: calc(100% - 1.4rem); bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }
  .lana-bar kbd { display: none; }
  .lana-panel { height: min(72vh, 620px); }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 48;
    padding: .3rem .4rem calc(.3rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--stroke);
    background: color-mix(in srgb, var(--solid) 88%, transparent);
    backdrop-filter: blur(24px);
  }
  .tabbar .nav { width: auto; }
  .more { position: fixed; left: .6rem; right: .6rem; bottom: calc(70px + env(safe-area-inset-bottom, 0px)); z-index: 61; padding: .8rem; border-radius: 22px; border: 1px solid var(--stroke-2); background: color-mix(in srgb, var(--solid) 94%, transparent); backdrop-filter: blur(26px); display: grid; grid-template-columns: repeat(4, 1fr); gap: .3rem; justify-items: center; }
  .sheet { top: auto; left: .5rem; right: .5rem; bottom: .5rem; width: auto; max-height: 88vh; }
}

/* ---------- motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  body::before { animation: drift 46s ease-in-out infinite alternate; }
  .orb { animation: breathe 4.6s ease-in-out infinite; }
  .orb[data-state="thinking"]::before { animation: spin 1.1s linear infinite; }
  .orb[data-state="listening"]::after { animation: ripple 1.4s ease-out infinite; }
  .orb[data-state="speaking"]::after { animation: ripple 1.9s ease-out infinite; }
  .orb[data-state="acting"] { animation: actpulse .45s var(--ease) 2; }
  .thinking i { animation: blink 1.1s infinite ease-in-out; }
  .thinking i:nth-child(2) { animation-delay: .15s; }
  .thinking i:nth-child(3) { animation-delay: .3s; }
  .rise { animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 55ms); }
  .deck > *:not([hidden]) { animation: rise .45s var(--ease) both; }
  .grow-w { animation: growW .9s var(--ease) both; }
  .grow-h { animation: growH .9s var(--ease) both; }
  .ring .fg { animation: ringin 1s var(--ease) both; }
  @keyframes growW { from { width: 0; } }
  @keyframes growH { from { height: 0; } }
  @keyframes ringin { from { stroke-dashoffset: var(--len); } }
  .lana-panel { animation: grow .32s var(--ease) both; }
  .lana-scrim, .scrim { animation: fadein .25s ease both; }
  .sheet { animation: slidein .34s var(--ease) both; }
  .toast { animation: drop .3s var(--ease) both; }
  .msg, .act { animation: rise .3s var(--ease) both; }
  .act svg path { animation: draw .45s .15s var(--ease) forwards; }
  .scan.reading::after { animation: scan 1.5s ease-in-out infinite; }
  .field.typed { animation: rise .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 90ms); }
  ::view-transition-group(*) { animation-duration: .38s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
  @keyframes drift { to { transform: translate3d(3%, -2%, 0) rotate(4deg) scale(1.06); } }
  @keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
  @keyframes spin { to { transform: rotate(360deg); } }
  @keyframes ripple { 0% { opacity: .9; transform: scale(1); } 100% { opacity: 0; transform: scale(2.1); } }
  @keyframes actpulse { 50% { transform: scale(1.22); } }
  @keyframes blink { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
  @keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
  @keyframes grow { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
  @keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
  @keyframes slidein { from { opacity: 0; transform: translateX(26px); } to { opacity: 1; transform: none; } }
  @keyframes drop { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
  @keyframes draw { to { stroke-dashoffset: 0; } }
  @keyframes scan { 0% { top: -30%; } 100% { top: 100%; } }
  @keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 60%, transparent); } 100% { box-shadow: 0 0 0 26px transparent; } }
}
@media (prefers-reduced-motion: reduce) {
  .act svg path { stroke-dashoffset: 0; }
  .flip-inner { transition: none; }
}

/* ---------- Play ---------- */
.stones { display: flex; flex-direction: column; gap: .7rem; }
.river {
  position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem;
  padding: 1rem; border-radius: 18px; border: 1px solid var(--stroke);
  background: linear-gradient(180deg, color-mix(in srgb, var(--c-play) 14%, transparent), color-mix(in srgb, var(--c-journal) 10%, transparent));
}
.stone {
  min-height: 78px; padding: .7rem 1rem; border-radius: 38px 46px 40px 44px / 44px 38px 46px 40px;
  border: 1px solid var(--stroke-2); background: color-mix(in srgb, var(--solid) 80%, transparent);
  font-weight: 600; line-height: 1.25; text-align: center;
  transition: transform .35s var(--ease), opacity .35s, background-color .3s, border-color .3s;
}
.stone:hover { transform: translateY(-3px) scale(1.02); border-color: var(--c-play); }
.stone.right { background: color-mix(in srgb, var(--good) 26%, var(--solid)); border-color: var(--good); }
.stone.sunk { opacity: .28; transform: translateY(14px) scale(.9); pointer-events: none; }
.bank { display: flex; align-items: center; gap: .6rem; padding: .6rem .9rem; border-radius: 14px; border: 1px solid var(--stroke); background: var(--glass); font-weight: 600; }
.path { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.path .chip { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.sky { position: relative; width: 100%; aspect-ratio: 16 / 9; min-height: 300px; border-radius: 18px; border: 1px solid var(--stroke); overflow: hidden; background: radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--c-play) 18%, transparent), transparent 70%), color-mix(in srgb, var(--solid) 70%, transparent); touch-action: none; }
.sky svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.sky line { stroke: var(--c-play); stroke-width: 2; stroke-linecap: round; filter: drop-shadow(0 0 6px var(--c-play)); }
.sky line.good { stroke: var(--good); filter: drop-shadow(0 0 6px var(--good)); }
.star {
  position: absolute; transform: translate(-50%, -50%);
  max-width: 34%; padding: .35rem .7rem; border-radius: 999px;
  border: 1px solid var(--stroke-2); background: color-mix(in srgb, var(--solid) 84%, transparent);
  font-size: .84rem; font-weight: 600; text-align: center;
  transition: border-color .2s, box-shadow .2s, background-color .2s;
}
.star.pick { border-color: var(--c-play); box-shadow: 0 0 18px color-mix(in srgb, var(--c-play) 60%, transparent); }
.star.locked { border-color: var(--good); background: color-mix(in srgb, var(--good) 18%, var(--solid)); pointer-events: none; }
.star.wrong { border-color: var(--bad); }
.claim { text-align: left; padding: .9rem 1rem; border-radius: 16px; border: 1px solid var(--stroke); background: var(--glass); font-weight: 550; line-height: 1.35; transition: transform .2s var(--ease), border-color .25s, background-color .25s; }
.claim:hover { transform: translateY(-2px); border-color: var(--stroke-2); }
.claim.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 14%, transparent); }
.claim.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
@media (max-width: 760px) { .river { grid-template-columns: minmax(0, 1fr); } .star { font-size: .76rem; max-width: 44%; } }
@media (prefers-reduced-motion: no-preference) {
  .stone.sunk { animation: sink .5s var(--ease) both; }
  .star.wrong { animation: shake .35s ease; }
  @keyframes sink { 0% { transform: none; opacity: 1; } 40% { transform: translateY(-4px) rotate(-3deg); } 100% { transform: translateY(14px) scale(.9); opacity: .28; } }
  @keyframes shake { 25% { margin-left: -5px; } 75% { margin-left: 5px; } }
}

/* ---------- flipbook (drawing) ---------- */
.easel { position: relative; width: 100%; max-width: 720px; aspect-ratio: 4 / 3; border-radius: 16px; overflow: hidden; border: 1px solid var(--stroke-2); background: #fff; touch-action: none; }
.easel canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.easel canvas.ghost { opacity: .22; pointer-events: none; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--stroke-2); padding: 0; }
.swatch[aria-pressed="true"] { outline: 2px solid var(--ember-2); outline-offset: 2px; }
.strip { display: flex; gap: .5rem; overflow-x: auto; padding: .2rem .1rem .5rem; }
.strip button { flex: none; width: 96px; aspect-ratio: 4 / 3; padding: 0; border-radius: 10px; border: 2px solid var(--stroke); background: #fff center / cover no-repeat; position: relative; }
.strip button[aria-current="true"] { border-color: var(--c-studio); box-shadow: 0 0 14px color-mix(in srgb, var(--c-studio) 50%, transparent); }
.strip button span { position: absolute; left: 4px; bottom: 2px; font-size: .68rem; font-weight: 700; color: #333; }

/* ---------- the book ---------- */
.book-scrim { position: fixed; inset: 0; z-index: 70; background: var(--scrim); backdrop-filter: blur(8px); display: grid; place-items: center; padding: 1rem; }
.book-wrap { display: flex; flex-direction: column; align-items: center; gap: 1rem; width: min(980px, 100%); }
.book { position: relative; width: 100%; aspect-ratio: 16 / 10; max-height: 74vh; perspective: 2400px; }
.leaf { position: absolute; top: 0; right: 0; width: 50%; height: 100%; transform-origin: left center; transform-style: preserve-3d; transition: transform .9s cubic-bezier(.3, .1, .2, 1); }
.leaf.turned { transform: rotateY(-180deg); }
.page {
  position: absolute; inset: 0; overflow-y: auto; padding: clamp(1rem, 3vw, 2.2rem);
  background: #FBF7EE; color: #22201B; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; gap: .7rem;
  box-shadow: inset 0 0 40px rgba(60, 40, 10, .08);
}
.page.front { border-radius: 4px 14px 14px 4px; background-image: linear-gradient(90deg, rgba(60, 40, 10, .14), transparent 9%); }
.page.back { transform: rotateY(180deg); border-radius: 14px 4px 4px 14px; background-image: linear-gradient(270deg, rgba(60, 40, 10, .14), transparent 9%); }
.page h2 { font-size: 1.35rem; color: #1b1915; }
.page .folio { margin-top: auto; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: #8a8071; }
.page .muted { color: #6f675a; }
@media (max-width: 760px) { .book { aspect-ratio: 3 / 4; } .leaf { width: 100%; } .page.back { display: none; } .leaf.turned { transform: translateX(-104%) rotateY(-30deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .leaf { transition: none; } }
