/* ==========================================================
   AI U ALL v3 — three-scene themed chassis (light + dark)
   ==========================================================
   themes are driven by [data-scene] + [data-mode] on <body>:
     learn  : warm letterpress / sepia
     work   : technical mono / cyan + amber
     life   : aurora dusk / coral + violet
   ========================================================== */

/* [hidden] override — prevent display:flex/grid from showing hidden elements */
[hidden] {
    display: none !important;
}

:root {
    --radius: 16px;
    --radius-sm: 10px;
    --t-fast: .14s ease;
    --t: .28s cubic-bezier(.22, .61, .36, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    min-height: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.62;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color .5s ease, color .35s ease;
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    cursor: pointer;
}

input,
textarea,
select {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    outline: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-2);
    border-radius: 4px;
}

::selection {
    background: var(--accent-soft);
    color: var(--text);
}

.mono {
    font-family: var(--font-mono);
}

.display {
    font-family: var(--font-display);
    letter-spacing: -.01em;
}

/* ==========================================================
   THEMES — 3 scenes × {light, dark}
   ========================================================== */

/* ---------- LEARN — letterpress / sepia ---------- */
body[data-scene="learn"][data-mode="light"] {
    --bg: #f5efe1;
    --bg-elev: #ece4d2;
    --surface: rgba(255, 248, 232, .55);
    --surface-2: rgba(220, 205, 170, .35);
    --surface-3: rgba(196, 166, 107, .18);
    --border: rgba(98, 73, 33, .18);
    --border-2: rgba(98, 73, 33, .32);
    --text: #1d1812;
    --muted: #5a4a32;
    --faint: #8a7659;
    --accent: #b4521a;
    --accent-2: #c87b2c;
    --accent-soft: rgba(180, 82, 26, .18);
    --teal: #2f6b58;
    --coral: #c2410c;
    --violet: #6b4e8a;
    --grad-1: linear-gradient(135deg, #b4521a 0%, #d97706 60%, #a8581b 100%);
    --shadow: 0 1px 0 rgba(255, 250, 235, .6) inset, 0 14px 40px -22px rgba(80, 55, 20, .45);
    --font-display: 'Fraunces', 'Noto Serif SC', serif;
    --font-body: 'Lora', 'Noto Serif SC', Georgia, serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

body[data-scene="learn"][data-mode="dark"] {
    --bg: #1c160e;
    --bg-elev: #271f14;
    --surface: rgba(60, 42, 18, .55);
    --surface-2: rgba(82, 58, 25, .42);
    --surface-3: rgba(120, 86, 38, .30);
    --border: rgba(255, 232, 182, .10);
    --border-2: rgba(255, 232, 182, .22);
    --text: #f5e9cf;
    --muted: #c7a674;
    --faint: #8a7656;
    --accent: #f59e0b;
    --accent-2: #fcd34d;
    --accent-soft: rgba(245, 158, 11, .18);
    --teal: #5eead4;
    --coral: #f87171;
    --violet: #a5b4fc;
    --grad-1: linear-gradient(135deg, #fcd34d 0%, #f59e0b 60%, #d97706 100%);
    --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 18px 50px -22px rgba(0, 0, 0, .7);
    --font-display: 'Fraunces', 'Noto Serif SC', serif;
    --font-body: 'Lora', 'Noto Serif SC', Georgia, serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

/* ---------- WORK — deep tech / cyan + amber ---------- */
body[data-scene="work"][data-mode="dark"] {
    --bg: #07090d;
    --bg-elev: #0d1118;
    --surface: rgba(20, 26, 36, .62);
    --surface-2: rgba(34, 42, 56, .55);
    --surface-3: rgba(60, 72, 92, .5);
    --border: rgba(180, 200, 230, .10);
    --border-2: rgba(180, 200, 230, .22);
    --text: #e6ecf3;
    --muted: #9aa6b8;
    --faint: #5a6677;
    --accent: #f59e0b;
    --accent-2: #06b6d4;
    --accent-soft: rgba(6, 182, 212, .18);
    --teal: #06b6d4;
    --coral: #fb7185;
    --violet: #a78bfa;
    --grad-1: linear-gradient(135deg, #06b6d4 0%, #f59e0b 100%);
    --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 20px 60px -24px rgba(0, 0, 0, .8);
    --font-display: 'IBM Plex Sans', system-ui, sans-serif;
    --font-body: 'IBM Plex Sans', system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
}

body[data-scene="work"][data-mode="light"] {
    --bg: #f4f5f8;
    --bg-elev: #ffffff;
    --surface: rgba(255, 255, 255, .7);
    --surface-2: rgba(240, 243, 248, .7);
    --surface-3: rgba(220, 228, 240, .7);
    --border: rgba(30, 42, 60, .12);
    --border-2: rgba(30, 42, 60, .25);
    --text: #0f1620;
    --muted: #4b5563;
    --faint: #8a93a3;
    --accent: #b45309;
    --accent-2: #0e7490;
    --accent-soft: rgba(14, 116, 144, .14);
    --teal: #0e7490;
    --coral: #be123c;
    --violet: #6d28d9;
    --grad-1: linear-gradient(135deg, #0e7490 0%, #b45309 100%);
    --shadow: 0 1px 0 rgba(255, 255, 255, .8) inset, 0 12px 32px -16px rgba(0, 30, 60, .18);
    --font-display: 'IBM Plex Sans', system-ui, sans-serif;
    --font-body: 'IBM Plex Sans', system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
}

/* ---------- LIFE — aurora dusk / coral + violet ---------- */
body[data-scene="life"][data-mode="light"] {
    --bg: #fff6ee;
    --bg-elev: #fff;
    --surface: rgba(255, 255, 255, .62);
    --surface-2: rgba(255, 232, 212, .6);
    --surface-3: rgba(252, 205, 177, .55);
    --border: rgba(190, 80, 90, .15);
    --border-2: rgba(190, 80, 90, .3);
    --text: #281320;
    --muted: #6b4256;
    --faint: #9a7388;
    --accent: #ec4899;
    --accent-2: #f97316;
    --accent-soft: rgba(236, 72, 153, .18);
    --teal: #14b8a6;
    --coral: #f97316;
    --violet: #a855f7;
    --grad-1: linear-gradient(135deg, #f97316 0%, #ec4899 50%, #a855f7 100%);
    --shadow: 0 1px 0 rgba(255, 255, 255, .8) inset, 0 18px 50px -24px rgba(160, 40, 100, .25);
    --font-display: 'Quicksand', 'Caveat', system-ui, sans-serif;
    --font-body: 'Quicksand', system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

body[data-scene="life"][data-mode="dark"] {
    --bg: #1a0f26;
    --bg-elev: #2a1638;
    --surface: rgba(60, 32, 80, .55);
    --surface-2: rgba(82, 40, 100, .5);
    --surface-3: rgba(120, 70, 140, .5);
    --border: rgba(255, 180, 220, .14);
    --border-2: rgba(255, 180, 220, .30);
    --text: #fbe9f5;
    --muted: #c79cb8;
    --faint: #8a6c80;
    --accent: #f472b6;
    --accent-2: #fb923c;
    --accent-soft: rgba(244, 114, 182, .18);
    --teal: #5eead4;
    --coral: #fb7185;
    --violet: #c084fc;
    --grad-1: linear-gradient(135deg, #fb923c 0%, #f472b6 50%, #c084fc 100%);
    --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 20px 60px -24px rgba(0, 0, 0, .7);
    --font-display: 'Quicksand', system-ui, sans-serif;
    --font-body: 'Quicksand', system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

/* ==========================================================
   Ambient backgrounds — fixed layer behind everything
   ========================================================== */
.ambient {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.amb {
    position: absolute;
    inset: -10%;
    opacity: 0;
    transition: opacity .9s ease;
}

body[data-scene="learn"] .amb-learn {
    opacity: 1;
}

/* blank scene — very faint neutral shimmer so workbench isn't dead white */
body[data-scene="blank"][data-mode="light"] .amb-work {
    opacity: 0.06;
}

body[data-scene="blank"][data-mode="dark"] .amb-work {
    opacity: 0.10;
}

body[data-scene="work"] .amb-work {
    opacity: 1;
}

body[data-scene="life"] .amb-life {
    opacity: 1;
}

/* learn — paper grain + sepia bloom */
.amb-learn {
    background:
        radial-gradient(58% 48% at 18% 12%, var(--accent-soft), transparent 65%),
        radial-gradient(46% 50% at 88% 20%, rgba(217, 119, 6, .10), transparent 65%),
        radial-gradient(40% 50% at 55% 100%, rgba(106, 78, 46, .10), transparent 65%);
}

.amb-learn::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(0deg, rgba(106, 78, 46, .05) 0 1px, transparent 1px 4px),
        repeating-linear-gradient(90deg, rgba(106, 78, 46, .04) 0 1px, transparent 1px 4px);
    mix-blend-mode: multiply;
    opacity: .6;
}

body[data-mode="dark"] .amb-learn::before {
    mix-blend-mode: overlay;
    opacity: .3;
}

/* work — grid + scan + spotlight */
.amb-work {
    background:
        radial-gradient(60% 40% at 75% 12%, var(--accent-soft), transparent 65%),
        radial-gradient(52% 50% at 8% 80%, rgba(6, 182, 212, .12), transparent 65%);
}

.amb-work::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(78% 64% at 50% 28%, #000 24%, transparent 82%);
    -webkit-mask-image: radial-gradient(78% 64% at 50% 28%, #000 24%, transparent 82%);
    opacity: .55;
}

/* life — aurora drifting blobs */
.amb-life {
    background:
        radial-gradient(38% 32% at 18% 28%, rgba(249, 115, 22, .30), transparent 65%),
        radial-gradient(40% 32% at 80% 38%, rgba(236, 72, 153, .28), transparent 65%),
        radial-gradient(45% 38% at 50% 92%, rgba(168, 85, 247, .26), transparent 65%),
        radial-gradient(32% 28% at 72% 8%, rgba(20, 184, 166, .18), transparent 65%);
    animation: aurora 22s ease-in-out infinite alternate;
    filter: saturate(1.08);
}

@keyframes aurora {
    0% {
        transform: translate3d(-2%, -1%, 0) scale(1.04);
    }

    100% {
        transform: translate3d(3%, 2%, 0) scale(1.08);
    }
}

.amb-noise {
    opacity: .25;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
}

/* ==========================================================
   Top bar
   ========================================================== */
.top {
    position: sticky;
    top: 0;
    z-index: 10;
    height: 40px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 20px;
    background: linear-gradient(180deg, var(--bg) 60%, transparent);
    backdrop-filter: blur(8px);
    /* needed for absolute-positioned scene-tabs child */
    isolation: isolate;
    /* Fixed to life-scene font regardless of active scene */
    --font-display: 'Quicksand', system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-body: 'Quicksand', system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* Top-bar icon buttons: unified with workbench style */
.top-actions .icon-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: none;
    display: inline-grid;
    place-items: center;
    color: #6b7280;
    transition: background var(--t-fast), color var(--t-fast);
    flex-shrink: 0;
}

body[data-mode="dark"] .top-actions .icon-btn {
    color: #9ca3af;
}

.top-actions .icon-btn:hover {
    background: var(--surface-2);
    color: var(--text);
}

/* Sun/Moon icon CSS toggle based on data-mode */
body[data-mode="dark"] #modeIconSun {
    display: none;
}

body[data-mode="light"] #modeIconMoon {
    display: none;
}

body[data-mode="dark"] #modeIconMoon {
    display: block;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.5px;
    color: var(--text);
    text-decoration: none;
}

.brand-text {
    font-size: 14px;
    letter-spacing: 0.5px;
}

.brand-beta {
    font-size: 9.5px;
    padding: 2px 6px;
    border-radius: 999px;
    border: 1px solid var(--border-2);
    color: var(--accent);
    margin-left: 2px;
    font-family: var(--font-mono);
}

.scene-tabs {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    z-index: 1;
}

.scene-tab {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 13px;
    font-size: 12.5px;
    font-weight: 600;
    border-radius: 999px;
    color: var(--muted);
    font-family: var(--font-display);
    letter-spacing: .01em;
    border: 1px solid transparent;
    transition: all var(--t-fast);
}

.scene-tab .num {
    display: none;
}

.scene-tab.is-active {
    color: var(--accent);
    background: var(--accent-soft);
}

.scene-tab:hover {
    color: var(--text);
}

.scene-ink {
    display: none;
}

.top-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* ==========================================================
   Views
   ========================================================== */
.view {
    display: none;
    flex: 1;
}

.view.is-active {
    display: flex;
    flex-direction: column;
}

.view-home {
    align-items: center;
    padding: 28px 24px 100px;
}

.view-gen {
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

.view-result {
    flex-direction: column;
    padding: 0 28px 60px;
}

/* ==========================================================
   Hero
   ========================================================== */
.hero {
    text-align: center;
    max-width: 760px;
    margin: 2.5vh auto 28px;
}

.hero-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .06em;
    text-transform: uppercase;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--muted);
    margin-bottom: 18px;
}

.hero-tag::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent);
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(40px, 6.4vw, 76px);
    line-height: 1.02;
    letter-spacing: -0.025em;
    margin-bottom: 16px;
}

.hero-title .grad {
    background: var(--grad-1);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: inline-block;
    padding-right: 0.22em;
}

body[data-scene="learn"] .hero-title {
    font-style: italic;
}

.hero-sub {
    font-size: 15px;
    color: var(--muted);
    max-width: 580px;
    margin: 0 auto;
    font-style: italic;
    letter-spacing: .03em;
}

/* ==========================================================
   Composer — flat, no outer card
   ========================================================== */
.composer {
    width: 100%;
    max-width: 780px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* input-mode tabs */
.mode-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}

/* center group of mode tabs */
.mode-tabs-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.mode-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 13px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
    font-family: var(--font-display);
    letter-spacing: .01em;
    transition: all var(--t-fast);
    border: 1px solid transparent;
}

.mode-tab:hover {
    color: var(--text);
}

.mode-tab.is-active {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: transparent;
}

/* ghost button — left side of mode-row */
.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    font-family: var(--font-display);
    color: var(--muted);
    border: 1px solid var(--border);
    background: var(--surface);
    transition: all var(--t-fast);
    white-space: nowrap;
    opacity: 0.6;
}

.btn-ghost:hover {
    color: var(--text);
    opacity: 0.9;
    border-color: var(--border-2);
}

.mode-hint {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--faint);
}

/* the input itself — a single tall pill */
.input-wrap {
    position: relative;
    display: flex;
    align-items: stretch;
    border-radius: 22px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.input-wrap:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow);
}

.input-wrap textarea {
    flex: 1;
    padding: 18px 20px 18px 22px;
    resize: none;
    min-height: 86px;
    max-height: 280px;
    font-size: 15.5px;
    line-height: 1.55;
    font-family: var(--font-body);
}

.input-wrap textarea::placeholder {
    color: var(--faint);
}

.input-tools {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding: 0 12px 12px 6px;
    gap: 6px;
}

.input-tools .icon-mini,
.icon-mini {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: 1px solid var(--border);
    display: inline-grid;
    place-items: center;
    background: var(--surface);
    color: var(--muted);
    transition: all var(--t-fast);
}

.icon-mini:hover {
    color: var(--accent);
    border-color: var(--border-2);
}

#inputSpin {
    position: absolute;
    right: 56px;
    top: 14px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* enrich card (compact) */
.enrich {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--surface);
    border: 1px dashed var(--border-2);
    font-size: 13px;
}

.enrich-tag {
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--accent);
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--accent-soft);
    flex-shrink: 0;
}

.enrich-body {
    flex: 1;
}

.enrich-title {
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text);
}

.enrich-text {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.enrich-close {
    margin-left: auto;
    font-size: 18px;
    color: var(--faint);
}

/* ==========================================================
   Pill rails
   ========================================================== */
.rail {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.rail-label {
    flex-shrink: 0;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--faint);
    padding-top: 4px;
    width: 44px;
}

/* Capsule label — same row as example chips */
.rail-cap {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-display);
    color: var(--muted);
    border: 1px solid var(--border);
    background: var(--surface);
    letter-spacing: .02em;
    white-space: nowrap;
}

.rail-track {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    min-width: 0;
    flex: 1;
    padding: 2px 0 6px;
    scrollbar-width: none;
}

.rail-track::-webkit-scrollbar {
    display: none;
}

/* the standard pill */
.pill {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--muted);
    border: 1px solid var(--border);
    background: var(--surface);
    white-space: nowrap;
    transition: all var(--t-fast);
    font-family: var(--font-body);
}

.pill:hover {
    color: var(--text);
    border-color: var(--border-2);
}

.pill.is-active {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
    font-weight: 600;
}

.pill.example {
    background: transparent;
    border-color: var(--border);
}

.pill.example:hover {
    color: var(--accent);
    background: var(--accent-soft);
}

/* card-style chip for sub-scene / audience */
.chip-card {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    padding: 7px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    border: 1px solid var(--border);
    background: var(--surface);
    white-space: nowrap;
    transition: all var(--t-fast);
    font-family: var(--font-display);
}

.chip-card:hover {
    color: var(--text);
    border-color: var(--border-2);
    background: var(--surface-2);
}

.chip-card.is-active {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
    font-weight: 600;
}

/* agent inline dropdown */
.agent-wrap {
    position: relative;
    flex-shrink: 0;
}

.agent-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    border: 1px solid var(--border-2);
    background: var(--surface-2);
    font-family: var(--font-display);
}

.agent-btn .ag-tag {
    font-family: var(--font-mono);
    font-size: 9.5px;
    letter-spacing: .12em;
    color: var(--accent);
    text-transform: uppercase;
}

.agent-pop {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 280px;
    background: var(--bg-elev);
    border: 1px solid var(--border-2);
    border-radius: 14px;
    padding: 6px;
    box-shadow: var(--shadow);
    z-index: 20;
}

.agent-pop button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 9px 12px;
    border-radius: 9px;
    font-size: 13px;
    color: var(--text);
    transition: background var(--t-fast);
}

.agent-pop button:hover {
    background: var(--surface-2);
}

.agent-pop button.is-active {
    background: var(--accent-soft);
    color: var(--accent);
}

.agent-pop .ag-name {
    font-weight: 700;
    font-family: var(--font-display);
}

.agent-pop .ag-desc {
    font-size: 11.5px;
    color: var(--muted);
    margin-top: 2px;
}

/* ==========================================================
   Output rail — CAPSULE pills, scrollable, with SVG icons
   ========================================================== */
.out-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
}

.out-head {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--faint);
}

.out-head .grow {
    flex: 1;
}

.out-count {
    color: var(--accent);
}

.link-btn {
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .12em;
}

.link-btn:hover {
    color: var(--accent);
}

.out-rail {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 168px;
    overflow-y: auto;
    padding: 2px;
    scrollbar-width: thin;
}

.out-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px 7px 11px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 500;
    font-family: var(--font-display);
    letter-spacing: .01em;
    transition: all var(--t-fast);
    white-space: nowrap;
    position: relative;
}

.out-pill svg {
    flex-shrink: 0;
    opacity: .85;
}

.ic-emoji {
    font-size: 14px;
    line-height: 1;
    flex-shrink: 0;
    font-style: normal;
}

.ic-lucide {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
    color: currentColor;
}

.ic-lucide svg {
    display: block;
}

/* Twemoji img tag — normalise size to match system emoji baseline */
.ic-emoji img.emoji,
.res-tab img.emoji,
.out-pill img.emoji {
    width: 1.1em;
    height: 1.1em;
    vertical-align: -0.15em;
    display: inline-block;
    flex-shrink: 0;
}

/* badge icon — monogram tile, hue-keyed colour */
.ic-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    font-size: 9.5px;
    font-weight: 700;
    font-family: var(--font-mono);
    letter-spacing: -.01em;
    line-height: 1;
    color: hsl(var(--ic-hue), 62%, 32%);
    background: hsl(var(--ic-hue), 72%, 91%);
}

body[data-mode="dark"] .ic-badge {
    color: hsl(var(--ic-hue), 80%, 76%);
    background: hsl(var(--ic-hue), 40%, 22%);
}

.out-pill:hover {
    color: var(--text);
    border-color: var(--border-2);
}

.out-pill.is-active {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
    font-weight: 600;
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.out-pill.is-active svg {
    opacity: 1;
}

.out-pill .oc-tag {
    font-family: var(--font-mono);
    font-size: 8.5px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    padding: 1px 5px;
    border-radius: 3px;
    background: var(--surface-3);
    color: var(--muted);
}

.out-pill.is-base .oc-tag {
    background: var(--accent-soft);
    color: var(--accent);
}

.out-pill.is-adv .oc-tag {
    background: rgba(168, 85, 247, .18);
    color: var(--violet);
}

/* ==========================================================
   Go bar
   ========================================================== */
.go-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 6px;
}

.go-hint {
    font-size: 12px;
    color: var(--muted);
    flex: 1;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 13px 26px;
    border-radius: 999px;
    background: var(--grad-1);
    color: #fff;
    font-weight: 700;
    font-family: var(--font-display);
    font-size: 14.5px;
    letter-spacing: .02em;
    border: 0;
    transition: transform var(--t-fast), box-shadow var(--t-fast), filter var(--t-fast);
    box-shadow: 0 8px 24px -10px var(--accent), 0 2px 0 rgba(0, 0, 0, .08) inset;
}

.btn-primary:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
}

.btn-primary:active {
    transform: translateY(0);
    filter: brightness(.95);
}

body[data-scene="learn"][data-mode="light"] .btn-primary {
    color: #fff8e7;
}

body[data-scene="work"][data-mode="light"] .btn-primary {
    color: #fff;
}

/* features under composer */
.features {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 22px;
    justify-content: center;
    margin-top: 30px;
    font-size: 12.5px;
    color: var(--muted);
}

.features li {
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.features .tk {
    color: var(--accent);
    font-weight: 700;
    font-family: var(--font-mono);
}

/* card (used inside renderers) — keep simple */
.card {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
}

/* ==========================================================
   responsive
   ========================================================== */
@media (max-width: 820px) {
    .top {
        padding: 14px 16px;
        gap: 12px;
    }

    .brand-text {
        display: none;
    }

    .scene-tab {
        padding: 6px 11px;
        font-size: 12px;
    }

    .view-home {
        padding: 18px 14px 80px;
    }

    .hero {
        margin: 1vh auto 20px;
    }

    .input-wrap textarea {
        min-height: 72px;
        padding: 14px 16px;
    }

    .rail-label {
        width: 36px;
    }
}

/* ==========================================================
   Generating view
   ========================================================== */
.gen-box {
    width: 100%;
    max-width: 620px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.gen-ring {
    position: relative;
    width: 76px;
    height: 76px;
    display: grid;
    place-items: center;
    margin-bottom: 8px;
}

.gen-ring .gr-core {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, rgba(252, 211, 77, .6), rgba(245, 158, 11, .15));
    border: 1px solid rgba(245, 158, 11, .5);
    animation: blink 1.8s ease-in-out infinite;
}

.gen-ring .gr-arc {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--amber);
    border-right-color: rgba(245, 158, 11, .35);
    animation: spin 1.4s linear infinite;
}

.gen-ring .gr-arc-2 {
    inset: 8px;
    border-top-color: var(--teal);
    border-right-color: transparent;
    animation: spin 2.2s linear infinite reverse;
}

.gen-title {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 22px;
}

.gen-sub {
    color: var(--muted);
    font-size: 13px;
}

.gen-bar {
    width: 100%;
    height: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.gen-bar-fill {
    height: 100%;
    width: 8%;
    background: var(--grad-1);
    transition: width .4s ease;
}

.gen-meta {
    display: flex;
    width: 100%;
    font-size: 11.5px;
    color: var(--muted);
    font-family: 'Syne', sans-serif;
    font-weight: 600;
}

.gen-stream {
    width: 100%;
    max-height: 220px;
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 12px;
    line-height: 1.55;
    color: var(--muted);
    text-align: left;
    white-space: pre-wrap;
    word-break: break-word;
}

.gen-stream:empty {
    display: none;
}

/* ==========================================================
   Result view
   ========================================================== */
.result-head {
    position: sticky;
    top: 58px;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 28px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(10, 10, 12, .9), rgba(10, 10, 12, .7));
    backdrop-filter: blur(14px);
}

.res-meta {
    flex: 1;
    min-width: 0;
}

.res-title {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.res-sub {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

.res-actions {
    display: inline-flex;
    gap: 6px;
}

.result-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 28px;
    overflow-x: auto;
    border-bottom: 1px solid var(--border);
    background: rgba(10, 10, 12, .4);
}

.res-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    font-family: 'Syne', sans-serif;
    font-weight: 600;
    font-size: 12.5px;
    color: var(--faint);
    border: 1px solid transparent;
    white-space: nowrap;
    transition: all var(--t-fast);
}

.res-tab:hover {
    color: var(--text);
}

.res-tab.is-active {
    color: var(--text);
    background: var(--surface-2);
    border-color: var(--border);
}

.res-tab .rt-status {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    background: var(--surface-3);
    color: var(--faint);
    font-family: 'JetBrains Mono', monospace;
}

.res-tab .rt-status.ok {
    background: rgba(20, 184, 166, .18);
    color: var(--teal-l);
}

.res-tab .rt-status.err {
    background: rgba(248, 113, 113, .18);
    color: #fca5a5;
}

.res-tab .rt-status.loading {
    background: rgba(245, 158, 11, .18);
    color: var(--amber-l);
}

.result-body {
    flex: 1;
    overflow: auto;
    padding: 24px 28px 80px;
}

.pane {
    display: none;
    max-width: 980px;
    margin: 0 auto;
}

.pane.is-active {
    display: block;
    animation: heroIn .35s ease;
}

.refine-bar {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    align-items: center;
    width: min(720px, calc(100% - 32px));
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    border-radius: 14px;
    padding: 8px 8px 8px 16px;
    box-shadow: var(--shadow-pop);
    z-index: 40;
}

.refine-bar input {
    flex: 1;
    background: transparent;
    border: 0;
    outline: 0;
    padding: 8px 0;
    font-size: 14px;
}

.refine-bar input::placeholder {
    color: var(--faint);
}

/* ==========================================================
   Renderer styles (shared)
   ========================================================== */
.result-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
}

.rc-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(10, 10, 12, .4);
    border-bottom: 1px solid var(--border);
    font-size: 12.5px;
    color: var(--muted);
}

.rc-toolbar .rc-title {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    color: var(--text);
}

.rc-toolbar .grow {
    flex: 1;
}

.rc-toolbar button {
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    font-size: 11.5px;
    font-family: 'Syne', sans-serif;
    font-weight: 600;
    transition: all var(--t-fast);
}

.rc-toolbar button:hover {
    color: var(--text);
    border-color: var(--border-2);
    background: var(--surface-2);
}

.rc-toolbar .rc-amber {
    color: var(--amber-l);
    border-color: rgba(245, 158, 11, .4);
}

.rc-toolbar .rc-amber:hover {
    background: rgba(245, 158, 11, .1);
}

.rc-body {
    padding: 22px;
}

/* Document renderer (markdown render) */
.doc-view {
    font-size: 15px;
    line-height: 1.75;
    color: var(--text);
}

.doc-view h1,
.doc-view h2,
.doc-view h3 {
    font-family: 'Syne', sans-serif;
    line-height: 1.25;
    margin-top: 1.4em;
    margin-bottom: .5em;
}

.doc-view h1 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -.02em;
}

.doc-view h2 {
    font-size: 22px;
    font-weight: 700;
    padding-bottom: .25em;
    border-bottom: 1px solid var(--border);
}

.doc-view h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--amber-l);
}

.doc-view p {
    margin: .6em 0;
    color: var(--text);
}

.doc-view ul,
.doc-view ol {
    padding-left: 1.6em;
    margin: .6em 0;
}

.doc-view li {
    margin: .25em 0;
}

.doc-view blockquote {
    border-left: 3px solid var(--amber);
    padding: 6px 14px;
    color: var(--muted);
    margin: 1em 0;
    background: rgba(245, 158, 11, .04);
    border-radius: 0 8px 8px 0;
}

.doc-view code {
    background: var(--surface-2);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: .92em;
}

.doc-view pre {
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 14px 18px;
    border-radius: 10px;
    overflow-x: auto;
}

.doc-view pre code {
    background: transparent;
    padding: 0;
}

.doc-view table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
    font-size: 14px;
}

.doc-view th,
.doc-view td {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
}

.doc-view th {
    background: var(--surface-2);
    font-family: 'Syne', sans-serif;
    font-weight: 700;
}

.doc-view hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 2em 0;
}

.doc-view a {
    color: var(--amber-l);
    border-bottom: 1px solid rgba(245, 158, 11, .3);
}

.doc-key-terms {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 14px 0 24px;
}

.doc-key-terms .kt {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12px;
    color: var(--muted);
}

.doc-key-terms .kt b {
    color: var(--amber-l);
    font-weight: 700;
    margin-right: 5px;
}

/* PPT */
.ppt-deck {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}

.slide-card {
    aspect-ratio: 16 / 9;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.slide-card .sc-no {
    position: absolute;
    top: 8px;
    right: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--faint);
}

.slide-card .sc-title {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 17px;
    line-height: 1.25;
    color: var(--amber-l);
    margin-bottom: 8px;
}

.slide-card .sc-bullets {
    font-size: 12px;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.slide-card .sc-bullets li {
    list-style: none;
    padding-left: 14px;
    position: relative;
}

.slide-card .sc-bullets li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    width: 8px;
    height: 1px;
    background: var(--amber);
}

/* Mindmap */
.mm-view {
    height: 560px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.mm-view svg {
    width: 100%;
    height: 100%;
}

/* Poster */
.poster {
    aspect-ratio: 3 / 4;
    max-width: 560px;
    margin: 0 auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 36px 28px;
    background: linear-gradient(155deg, #1a1c2e 0%, #0e1020 100%);
    color: var(--text);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.poster::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(50% 40% at 100% 0%, rgba(245, 158, 11, .4), transparent 60%),
        radial-gradient(40% 30% at 0% 100%, rgba(20, 184, 166, .3), transparent 60%);
    pointer-events: none;
}

.poster .pst-eyebrow {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--amber-l);
    letter-spacing: .2em;
    text-transform: uppercase;
    margin-bottom: 14px;
}

.poster .pst-title {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 36px;
    line-height: 1.05;
    letter-spacing: -.02em;
    margin-bottom: 12px;
}

.poster .pst-sub {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 22px;
}

.poster .pst-points {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 22px;
}

.poster .pst-points li {
    font-size: 13px;
    padding-left: 20px;
    position: relative;
    color: var(--text);
}

.poster .pst-points li::before {
    content: counter(item, decimal-leading-zero);
    counter-increment: item;
    position: absolute;
    left: 0;
    font-family: 'JetBrains Mono', monospace;
    color: var(--amber);
    font-size: 11px;
    top: 2px;
}

.poster .pst-points {
    counter-reset: item;
}

.poster .pst-foot {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--faint);
    font-family: 'JetBrains Mono', monospace;
}

/* Timeline */
.tl-view {
    padding: 8px 8px 8px 28px;
    border-left: 2px solid var(--border);
}

.tl-view .tli {
    position: relative;
    padding-bottom: 18px;
}

.tl-view .tli::before {
    content: '';
    position: absolute;
    left: -36px;
    top: 6px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--amber);
    box-shadow: 0 0 0 4px rgba(245, 158, 11, .18);
}

.tl-view .tl-date {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
    color: var(--amber-l);
    margin-bottom: 3px;
    letter-spacing: .04em;
}

.tl-view .tl-title {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 4px;
}

.tl-view .tl-desc {
    color: var(--muted);
    font-size: 13.5px;
}

/* Quiz */
.quiz-view {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.quiz-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 18px;
}

.quiz-q {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 10px;
    display: flex;
    gap: 8px;
}

.quiz-q .qi {
    font-family: 'JetBrains Mono', monospace;
    color: var(--amber);
    font-size: 14px;
}

.quiz-opts {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.quiz-opt {
    text-align: left;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--muted);
    font-size: 13.5px;
    transition: all var(--t-fast);
}

.quiz-opt:hover:not(:disabled) {
    color: var(--text);
    border-color: var(--border-2);
    background: var(--surface-3);
}

.quiz-opt.correct {
    background: rgba(20, 184, 166, .12);
    color: var(--teal-l);
    border-color: rgba(20, 184, 166, .4);
}

.quiz-opt.wrong {
    background: rgba(248, 113, 113, .12);
    color: #fca5a5;
    border-color: rgba(248, 113, 113, .4);
}

.quiz-explain {
    margin-top: 10px;
    padding: 10px 12px;
    border-left: 2px solid var(--amber);
    background: rgba(245, 158, 11, .05);
    font-size: 13px;
    color: var(--muted);
    border-radius: 0 8px 8px 0;
}

/* Flashcards */
.flash-deck {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.fc {
    perspective: 1000px;
    aspect-ratio: 5 / 3;
    cursor: pointer;
}

.fc-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform .55s;
    transform-style: preserve-3d;
}

.fc.flipped .fc-inner {
    transform: rotateY(180deg);
}

.fc-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.fc-front .ft {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 16px;
}

.fc-back {
    transform: rotateY(180deg);
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

/* Table */
.tbl-view {
    overflow-x: auto;
}

.tbl-view table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.tbl-view th,
.tbl-view td {
    border: 1px solid var(--border);
    padding: 9px 12px;
    text-align: left;
}

.tbl-view th {
    background: var(--surface-2);
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    color: var(--amber-l);
}

.tbl-view tr:hover td {
    background: rgba(245, 158, 11, .04);
}

/* Chart */
.chart-wrap {
    height: 340px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
}

/* Compare table */
.cmp-view {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.cmp-col {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
}

.cmp-col h4 {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 14px;
    color: var(--amber-l);
    border-bottom: 1px dashed var(--border-2);
    padding-bottom: 6px;
    margin-bottom: 10px;
}

.cmp-col .cmp-row {
    display: flex;
    gap: 6px;
    font-size: 13px;
    padding: 4px 0;
}

.cmp-col .cmp-row .k {
    color: var(--faint);
    width: 70px;
    flex-shrink: 0;
    font-family: 'Syne', sans-serif;
    font-weight: 600;
    font-size: 11.5px;
    padding-top: 2px;
}

.cmp-col .cmp-row .v {
    color: var(--text);
    flex: 1;
}

/* SWOT */
.swot-view {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.swot-cell {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
}

.swot-cell h4 {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 16px;
    letter-spacing: .04em;
    margin-bottom: 12px;
}

.swot-cell ul {
    padding-left: 18px;
    font-size: 13.5px;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.swot-cell.s {
    border-color: rgba(20, 184, 166, .4);
}

.swot-cell.s h4 {
    color: var(--teal-l);
}

.swot-cell.w {
    border-color: rgba(248, 113, 113, .4);
}

.swot-cell.w h4 {
    color: #fca5a5;
}

.swot-cell.o {
    border-color: rgba(245, 158, 11, .4);
}

.swot-cell.o h4 {
    color: var(--amber-l);
}

.swot-cell.t {
    border-color: rgba(129, 140, 248, .4);
}

.swot-cell.t h4 {
    color: #a5b4fc;
}

/* BMC */
.bmc-view {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: 1fr 1fr 1fr;
    gap: 6px;
    min-height: 520px;
}

.bmc-cell {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    overflow: auto;
    font-size: 12px;
}

.bmc-cell h5 {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 11px;
    color: var(--amber-l);
    letter-spacing: .08em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.bmc-cell ul {
    padding-left: 16px;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.bmc-kp {
    grid-column: 1;
    grid-row: 1 / 3;
}

.bmc-ka {
    grid-column: 2;
    grid-row: 1;
}

.bmc-kr {
    grid-column: 2;
    grid-row: 2;
}

.bmc-vp {
    grid-column: 3;
    grid-row: 1 / 3;
    background: rgba(245, 158, 11, .06);
    border-color: rgba(245, 158, 11, .3);
}

.bmc-cr {
    grid-column: 4;
    grid-row: 1;
}

.bmc-ch {
    grid-column: 4;
    grid-row: 2;
}

.bmc-cs {
    grid-column: 5;
    grid-row: 1 / 3;
}

.bmc-co {
    grid-column: 1 / 4;
    grid-row: 3;
}

.bmc-rs {
    grid-column: 4 / 6;
    grid-row: 3;
    background: rgba(20, 184, 166, .05);
    border-color: rgba(20, 184, 166, .3);
}

/* MECE Tree */
.mece-view {
    padding: 8px;
}

.mece-node {
    display: flex;
    gap: 10px;
    margin-bottom: 6px;
}

.mece-node .mn-bar {
    width: 3px;
    background: var(--amber);
    border-radius: 2px;
    flex-shrink: 0;
}

.mece-node .mn-content {
    flex: 1;
}

.mece-node .mn-title {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 14px;
}

.mece-node .mn-children {
    padding-left: 16px;
    margin-top: 6px;
    border-left: 1px dashed var(--border-2);
}

/* Q&A */
.qa-view {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.qa-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 18px;
}

.qa-q {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 8px;
    color: var(--amber-l);
}

.qa-q::before {
    content: 'Q · ';
    color: var(--faint);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}

.qa-a {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.65;
}

.qa-a::before {
    content: 'A · ';
    color: var(--teal);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 700;
}

/* Script */
.script-view {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px 22px;
    font-size: 14px;
    line-height: 1.75;
}

.script-view .sc-scene {
    font-family: 'JetBrains Mono', monospace;
    color: var(--amber-l);
    font-size: 12px;
    letter-spacing: .12em;
    text-transform: uppercase;
    margin: 16px 0 10px;
    padding-bottom: 4px;
    border-bottom: 1px dashed var(--border-2);
}

.script-view .sc-char {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    color: var(--text);
    margin-top: 8px;
}

.script-view .sc-line {
    color: var(--muted);
    padding-left: 12px;
}

.script-view .sc-dir {
    color: var(--faint);
    font-style: italic;
    padding-left: 12px;
}

/* Speech */
.speech-view {
    font-size: 17px;
    line-height: 1.85;
    font-family: 'Instrument Sans', sans-serif;
}

.speech-view .sp-tag {
    font-family: 'JetBrains Mono', monospace;
    color: var(--amber);
    font-size: 11px;
    letter-spacing: .12em;
}

.speech-view .sp-para {
    margin: 1em 0;
    color: var(--text);
}

.speech-view .sp-pause {
    color: var(--faint);
    font-style: italic;
}

/* Social */
.social-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.social-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    font-size: 13.5px;
    line-height: 1.55;
}

.social-card .so-plat {
    display: inline-block;
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 4px;
    background: var(--surface-3);
    color: var(--amber-l);
    margin-bottom: 8px;
    letter-spacing: .06em;
}

.social-card .so-body {
    color: var(--text);
    white-space: pre-wrap;
}

.social-card .so-tags {
    margin-top: 6px;
    color: var(--teal-l);
    font-size: 12px;
}

/* SVG illust */
.svg-view {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.svg-view svg {
    width: 100%;
    max-width: 560px;
    height: auto;
    background: transparent;
}

.svg-view .svg-cap {
    font-size: 13px;
    color: var(--muted);
    text-align: center;
}

/* Icon set */
.icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.icon-cell {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 8px;
    text-align: center;
}

.icon-cell svg {
    width: 38px;
    height: 38px;
    margin-bottom: 6px;
    color: var(--amber-l);
}

.icon-cell .ic-name {
    font-size: 11.5px;
    color: var(--muted);
}

/* Emoji pack */
.emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
}

.emoji-cell {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 6px;
    text-align: center;
}

.emoji-cell .em-art {
    font-size: 34px;
    line-height: 1;
    margin-bottom: 4px;
}

.emoji-cell .em-name {
    font-size: 11px;
    color: var(--muted);
}

/* Guide / Checklist / Recipe / Itinerary / Email / Resume / Proposal / Meeting / Jokes */
.steps {
    counter-reset: step;
}

.steps .step {
    display: flex;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px dashed var(--border-2);
}

.steps .step::before {
    counter-increment: step;
    content: counter(step, decimal-leading-zero);
    font-family: 'JetBrains Mono', monospace;
    color: var(--amber);
    font-size: 12px;
    width: 28px;
    flex-shrink: 0;
    padding-top: 4px;
}

.steps .step .stp-title {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 3px;
}

.steps .step .stp-body {
    color: var(--muted);
    font-size: 13.5px;
}

.checklist .ckl-group {
    margin-bottom: 18px;
}

.checklist h4 {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 14px;
    color: var(--amber-l);
    margin-bottom: 8px;
}

.checklist .ckl {
    display: flex;
    gap: 8px;
    padding: 6px 0;
    font-size: 13.5px;
    color: var(--text);
    align-items: flex-start;
}

.checklist .ckl input {
    margin-top: 4px;
    accent-color: var(--amber);
}

.bizdoc {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 22px;
}

.bizdoc h3 {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 18px;
    margin-bottom: 6px;
    color: var(--text);
}

.bizdoc .bd-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
    color: var(--faint);
    margin-bottom: 16px;
}

.bizdoc .bd-section {
    margin: 12px 0;
}

.bizdoc h4 {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 13px;
    color: var(--amber-l);
    margin-bottom: 6px;
    letter-spacing: .04em;
}

.bizdoc p,
.bizdoc li {
    font-size: 13.5px;
    color: var(--muted);
    line-height: 1.65;
}

.bizdoc ul {
    padding-left: 18px;
}

/* Code */
.code-view pre {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px;
    overflow: auto;
    font-size: 12.5px;
    line-height: 1.55;
    color: #e4e4e7;
}

/* Interactive page */
.web-view {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.web-view .browser-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--surface-3);
    border-bottom: 1px solid var(--border);
}

.web-view .bb-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-2);
}

.web-view .bb-dot.r {
    background: #f87171;
}

.web-view .bb-dot.y {
    background: var(--amber);
}

.web-view .bb-dot.g {
    background: var(--teal);
}

.web-view .bb-url {
    flex: 1;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
    color: var(--faint);
    padding: 0 8px;
}

.web-view iframe {
    width: 100%;
    height: 640px;
    border: 0;
    background: white;
}

/* Locked */
.locked-view {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}

.locked-view .lock-ic {
    font-size: 36px;
    margin-bottom: 14px;
}

.locked-view h3 {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 6px;
    color: var(--text);
}

/* Error */
.err-box {
    background: rgba(248, 113, 113, .06);
    border: 1px solid rgba(248, 113, 113, .4);
    border-radius: 10px;
    padding: 18px;
    color: #fca5a5;
}

.err-box h4 {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 6px;
}

.err-box pre {
    white-space: pre-wrap;
    font-size: 12px;
    color: var(--muted);
    margin-top: 6px;
}

/* ==========================================================
   Dialogs + toasts
   ========================================================== */
.dlg {
    border: 0;
    padding: 0;
    background: transparent;
    max-width: min(520px, 92vw);
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}

.dlg::backdrop {
    background: rgba(0, 0, 0, .7);
    backdrop-filter: blur(6px);
}

.dlg[open] {
    animation: heroIn .2s ease;
}

.dlg-form {
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: 14px;
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: var(--shadow-pop);
}

.dlg-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dlg-head h3 {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 18px;
    flex: 1;
}

.dlg-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
}

.dlg-row.inline {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.dlg-row>span {
    color: var(--muted);
    font-size: 12.5px;
}

.dlg-row input[type=text],
.dlg-row input[type=password],
.dlg-row select {
    padding: 10px 12px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: 8px;
    outline: 0;
}

.dlg-row input[type=text]:focus,
.dlg-row input[type=password]:focus,
.dlg-row select:focus {
    border-color: rgba(245, 158, 11, .5);
}

.dlg-row input[type=checkbox] {
    accent-color: var(--amber);
    width: 14px;
    height: 14px;
}

.dlg-foot {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 6px;
}

.hist-list {
    list-style: none;
    max-height: 60vh;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hist-item {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    align-items: center;
    transition: all var(--t-fast);
    cursor: pointer;
}

.hist-item:hover {
    background: var(--surface-2);
    border-color: var(--border-2);
}

.hist-item .hi-title {
    font-weight: 600;
    font-size: 13.5px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hist-item .hi-meta {
    font-size: 11px;
    color: var(--faint);
    font-family: 'JetBrains Mono', monospace;
}

.hist-item .hi-del {
    color: var(--faint);
    padding: 4px 8px;
}

.hist-item .hi-del:hover {
    color: #fca5a5;
}

.hist-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

.toast-slot {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text);
    box-shadow: var(--shadow-pop);
    animation: heroIn .25s ease;
}

.toast.ok {
    border-left: 3px solid var(--teal);
}

.toast.err {
    border-left: 3px solid var(--coral);
}

.toast.info {
    border-left: 3px solid var(--amber);
}

/* ==========================================================
   Responsive
   ========================================================== */
@media (max-width: 860px) {
    .top {
        padding: 12px 16px;
        gap: 8px;
    }

    .brand-text {
        display: none;
    }

    .scene-tab {
        padding: 6px 10px;
        font-size: 12px;
    }

    .view-home {
        padding: 24px 16px 60px;
    }

    .composer {
        padding: 14px;
    }

    #mainInput {
        font-size: 14px;
        min-height: 76px;
    }

    .features {
        gap: 10px;
        font-size: 11px;
    }

    .bmc-view {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto;
    }

    .bmc-kp,
    .bmc-ka,
    .bmc-kr,
    .bmc-vp,
    .bmc-cr,
    .bmc-ch,
    .bmc-cs,
    .bmc-co,
    .bmc-rs {
        grid-column: auto;
        grid-row: auto;
    }

    .swot-view {
        grid-template-columns: 1fr;
    }

    .result-head {
        padding: 10px 16px;
    }

    .result-tabs {
        padding: 6px 16px;
    }

    .result-body {
        padding: 16px 16px 100px;
    }
}