/* ═══════════════════════════════════════════════════════════
   Aethernumi — Alpha
   Aesthetic: gold on stone, Jungian mandala motifs.
   Themes: six palettes, switched via [data-theme]. `data-theme-mode`
   carries "dark" or "light" so a refinement can target every light
   palette at once rather than naming each one.

   Each palette also carries --bg-top / --bg-bottom: the page ground is a
   vertical wash from a neutral extreme (black on a dark palette, white on
   a light one) down to the palette's own surrounding tone one step above
   its ground, so the light falls visibly across the viewport.
   ═══════════════════════════════════════════════════════════ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* ── Theme tokens ─────────────────────────────────────────── */
:root,
:root[data-theme="dark"] {
    color-scheme: dark;

    --black:       #0b0a0c;
    --bg:          #0b0a0c;
    --bg-top:      #000000;
    --bg-bottom:   #1c191e;
    --text:        #f5f3f0;
    --text-soft:   #dedad3;
    --on-gold:     #0b0a0c;

    --stone:       #141215;
    --stone-2:     #1c191e;
    --stone-3:     #262229;

    --muted:       #9b958d;
    --muted-dim:   #6d6862;
    --neutral-col: #9b958d;

    --gold:        #c9a96c;
    --gold-dim:    #a8884e;
    --gold-glow:   rgba(201, 169, 108, .14);
    --gold-edge:        rgba(201, 169, 108, .35);
    --gold-edge-soft:   rgba(201, 169, 108, .25);
    --gold-edge-faint:  rgba(201, 169, 108, .2);
    --gold-edge-strong: rgba(201, 169, 108, .4);

    --positive:    #7ec98f;
    --negative:    #e0787a;

    /* Translucent overlays, flipped per theme */
    --line:            rgba(255, 255, 255, .07);
    --line-strong:     rgba(255, 255, 255, .12);
    --surface-edge:    rgba(255, 255, 255, .014);
    --surface-1:       rgba(255, 255, 255, .022);
    --surface-2:       rgba(255, 255, 255, .025);
    --surface-3:       rgba(255, 255, 255, .03);
    --surface-4:       rgba(255, 255, 255, .04);
    --surface-5:       rgba(255, 255, 255, .05);
    --inset:           rgba(0, 0, 0, .32);
    --inset-strong:    rgba(0, 0, 0, .45);
    --well:            rgba(0, 0, 0, .25);
    --ai-surface:      rgba(201, 169, 108, .085);
    --ai-edge:         rgba(201, 169, 108, .22);
    --sidebar-bg:      rgba(20, 18, 21, .72);

    --placeholder: #57534d;
    --moon-lit:    #f5f3f0;

    --aura-1: rgba(201, 169, 108, .07);
    --aura-2: rgba(107, 92, 75, .06);

    --pos-glow: rgba(126, 201, 143, .1);
    --pos-edge: rgba(126, 201, 143, .35);
    --neg-glow: rgba(224, 120, 122, .1);
    --neg-edge: rgba(224, 120, 122, .35);

    --shadow:      0 18px 50px rgba(0, 0, 0, .45);
    /* Scrim behind a panel that covers the page (the mobile history drawer). */
    --scrim:       rgba(0, 0, 0, .55);

    --radius:      16px;
    --radius-sm:   10px;
    --ease:        .3s cubic-bezier(.25, .8, .25, 1);
}

:root[data-theme="light"] {
    color-scheme: light;

    --black:       #f7f5f1;
    --bg:          #f7f5f1;
    --bg-top:      #ffffff;
    --bg-bottom:   #efece6;
    --text:        #17151a;
    --text-soft:   #33303a;
    --on-gold:     #ffffff;

    --stone:       #efece6;
    --stone-2:     #ffffff;
    --stone-3:     #dcd7cf;

    --muted:       #5f5a53;
    --muted-dim:   #8a847c;
    --neutral-col: #6f6a62;

    --gold:        #8a6a2f;
    --gold-dim:    #6f5423;
    --gold-glow:   rgba(138, 106, 47, .12);
    --gold-edge:        rgba(138, 106, 47, .32);
    --gold-edge-soft:   rgba(138, 106, 47, .22);
    --gold-edge-faint:  rgba(138, 106, 47, .16);
    --gold-edge-strong: rgba(138, 106, 47, .45);

    --positive:    #2f7d4f;
    --negative:    #b03a3d;

    --line:            rgba(23, 21, 26, .1);
    --line-strong:     rgba(23, 21, 26, .16);
    --surface-edge:    rgba(23, 21, 26, .022);
    --surface-1:       rgba(23, 21, 26, .028);
    --surface-2:       rgba(23, 21, 26, .034);
    --surface-3:       rgba(23, 21, 26, .04);
    --surface-4:       rgba(23, 21, 26, .05);
    --surface-5:       rgba(23, 21, 26, .064);
    --inset:           rgba(23, 21, 26, .04);
    --inset-strong:    rgba(23, 21, 26, .06);
    --well:            rgba(23, 21, 26, .035);
    --ai-surface:      rgba(138, 106, 47, .075);
    --ai-edge:         rgba(138, 106, 47, .22);
    --sidebar-bg:      rgba(250, 248, 245, .85);

    --placeholder: #a8a29a;
    --moon-lit:    #ffffff;

    --aura-1: rgba(138, 106, 47, .07);
    --aura-2: rgba(107, 92, 75, .05);

    --pos-glow: rgba(47, 125, 79, .1);
    --pos-edge: rgba(47, 125, 79, .35);
    --neg-glow: rgba(176, 58, 61, .1);
    --neg-edge: rgba(176, 58, 61, .35);

    --shadow:      0 14px 40px rgba(30, 25, 20, .12);
    --scrim:       rgba(30, 25, 20, .38);
}

/* ── Palette: white ───────────────────────────────────────────
   The same paper as `light`, with the gold pulled back to a neutral
   graphite so the page reads as ink on white rather than as parchment.
   ───────────────────────────────────────────────────────────── */
:root[data-theme="white"] {
    color-scheme: light;

    --black:       #ffffff;
    --bg:          #ffffff;
    --bg-top:      #ffffff;
    --bg-bottom:   #e9ebef;
    --text:        #14161a;
    --text-soft:   #2f333a;
    --on-gold:     #ffffff;

    --stone:       #f4f5f7;
    --stone-2:     #ffffff;
    --stone-3:     #e3e5e9;

    --muted:       #5a5f68;
    --muted-dim:   #868b94;
    --neutral-col: #6b7078;

    --gold:        #3f4650;
    --gold-dim:    #2c323a;
    --gold-glow:   rgba(63, 70, 80, .1);
    --gold-edge:        rgba(63, 70, 80, .3);
    --gold-edge-soft:   rgba(63, 70, 80, .2);
    --gold-edge-faint:  rgba(63, 70, 80, .14);
    --gold-edge-strong: rgba(63, 70, 80, .42);

    --positive:    #2f7d4f;
    --negative:    #b03a3d;

    --line:            rgba(20, 22, 26, .1);
    --line-strong:     rgba(20, 22, 26, .16);
    --surface-edge:    rgba(20, 22, 26, .02);
    --surface-1:       rgba(20, 22, 26, .026);
    --surface-2:       rgba(20, 22, 26, .032);
    --surface-3:       rgba(20, 22, 26, .04);
    --surface-4:       rgba(20, 22, 26, .05);
    --surface-5:       rgba(20, 22, 26, .062);
    --inset:           rgba(20, 22, 26, .04);
    --inset-strong:    rgba(20, 22, 26, .06);
    --well:            rgba(20, 22, 26, .032);
    --ai-surface:      rgba(63, 70, 80, .06);
    --ai-edge:         rgba(63, 70, 80, .2);
    --sidebar-bg:      rgba(255, 255, 255, .88);

    --placeholder: #a9adb4;
    --moon-lit:    #ffffff;

    --aura-1: rgba(63, 70, 80, .05);
    --aura-2: rgba(63, 70, 80, .04);

    --pos-glow: rgba(47, 125, 79, .1);
    --pos-edge: rgba(47, 125, 79, .35);
    --neg-glow: rgba(176, 58, 61, .1);
    --neg-edge: rgba(176, 58, 61, .35);

    --shadow:      0 14px 40px rgba(20, 22, 26, .1);
    --scrim:       rgba(20, 22, 26, .34);
}

/* ── Palette: purple ──────────────────────────────────────────
   A violet night. The accent is a pale amethyst rather than gold, so
   the mandala motifs read as moonlight on deep blue-violet.
   ───────────────────────────────────────────────────────────── */
:root[data-theme="purple"] {
    color-scheme: dark;

    --black:       #100c18;
    --bg:          #100c18;
    --bg-top:      #000000;
    --bg-bottom:   #221a31;
    --text:        #f2eefb;
    --text-soft:   #d8d1ea;
    --on-gold:     #100c18;

    --stone:       #191325;
    --stone-2:     #221a31;
    --stone-3:     #2d2340;

    --muted:       #a49bbd;
    --muted-dim:   #756c8d;
    --neutral-col: #a49bbd;

    --gold:        #b9a3f0;
    --gold-dim:    #9a82d8;
    --gold-glow:   rgba(185, 163, 240, .15);
    --gold-edge:        rgba(185, 163, 240, .36);
    --gold-edge-soft:   rgba(185, 163, 240, .26);
    --gold-edge-faint:  rgba(185, 163, 240, .2);
    --gold-edge-strong: rgba(185, 163, 240, .42);

    --positive:    #7fd6a8;
    --negative:    #f08a9a;

    --line:            rgba(255, 255, 255, .08);
    --line-strong:     rgba(255, 255, 255, .14);
    --surface-edge:    rgba(255, 255, 255, .016);
    --surface-1:       rgba(255, 255, 255, .026);
    --surface-2:       rgba(255, 255, 255, .03);
    --surface-3:       rgba(255, 255, 255, .036);
    --surface-4:       rgba(255, 255, 255, .046);
    --surface-5:       rgba(255, 255, 255, .058);
    --inset:           rgba(0, 0, 0, .34);
    --inset-strong:    rgba(0, 0, 0, .48);
    --well:            rgba(0, 0, 0, .26);
    --ai-surface:      rgba(185, 163, 240, .09);
    --ai-edge:         rgba(185, 163, 240, .24);
    --sidebar-bg:      rgba(25, 19, 37, .74);

    --placeholder: #5f5677;
    --moon-lit:    #f2eefb;

    --aura-1: rgba(185, 163, 240, .09);
    --aura-2: rgba(120, 90, 190, .08);

    --pos-glow: rgba(127, 214, 168, .1);
    --pos-edge: rgba(127, 214, 168, .35);
    --neg-glow: rgba(240, 138, 154, .1);
    --neg-edge: rgba(240, 138, 154, .35);

    --shadow:      0 18px 50px rgba(0, 0, 0, .5);
    --scrim:       rgba(0, 0, 0, .58);
}

/* ── Palette: forest ──────────────────────────────────────────
   Deep green with a moss accent. The quietest of the dark palettes:
   the accent sits close to the background so the page reads as a
   single surface rather than as text on a card.
   ───────────────────────────────────────────────────────────── */
:root[data-theme="forest"] {
    color-scheme: dark;

    --black:       #0a1210;
    --bg:          #0a1210;
    --bg-top:      #000000;
    --bg-bottom:   #16231e;
    --text:        #eef5f0;
    --text-soft:   #d2e0d6;
    --on-gold:     #0a1210;

    --stone:       #101a17;
    --stone-2:     #16231e;
    --stone-3:     #1e2f28;

    --muted:       #93a89b;
    --muted-dim:   #66796d;
    --neutral-col: #93a89b;

    --gold:        #8fc9a4;
    --gold-dim:    #6ea886;
    --gold-glow:   rgba(143, 201, 164, .14);
    --gold-edge:        rgba(143, 201, 164, .34);
    --gold-edge-soft:   rgba(143, 201, 164, .24);
    --gold-edge-faint:  rgba(143, 201, 164, .18);
    --gold-edge-strong: rgba(143, 201, 164, .4);

    --positive:    #8fd6a0;
    --negative:    #e08a7a;

    --line:            rgba(255, 255, 255, .07);
    --line-strong:     rgba(255, 255, 255, .12);
    --surface-edge:    rgba(255, 255, 255, .014);
    --surface-1:       rgba(255, 255, 255, .022);
    --surface-2:       rgba(255, 255, 255, .026);
    --surface-3:       rgba(255, 255, 255, .032);
    --surface-4:       rgba(255, 255, 255, .042);
    --surface-5:       rgba(255, 255, 255, .052);
    --inset:           rgba(0, 0, 0, .32);
    --inset-strong:    rgba(0, 0, 0, .46);
    --well:            rgba(0, 0, 0, .24);
    --ai-surface:      rgba(143, 201, 164, .08);
    --ai-edge:         rgba(143, 201, 164, .22);
    --sidebar-bg:      rgba(16, 26, 23, .74);

    --placeholder: #4f6156;
    --moon-lit:    #eef5f0;

    --aura-1: rgba(143, 201, 164, .07);
    --aura-2: rgba(70, 120, 95, .07);

    --pos-glow: rgba(143, 214, 160, .1);
    --pos-edge: rgba(143, 214, 160, .35);
    --neg-glow: rgba(224, 138, 122, .1);
    --neg-edge: rgba(224, 138, 122, .35);

    --shadow:      0 18px 50px rgba(0, 0, 0, .46);
    --scrim:       rgba(0, 0, 0, .56);
}

/* ── Palette: rose ────────────────────────────────────────────
   Warm dusk. A dusty rose accent on a brown-black ground, for reading
   in the evening without the blue of the default palette.
   ───────────────────────────────────────────────────────────── */
:root[data-theme="rose"] {
    color-scheme: dark;

    --black:       #150e10;
    --bg:          #150e10;
    --bg-top:      #000000;
    --bg-bottom:   #2a1c20;
    --text:        #f8eef0;
    --text-soft:   #e6d3d7;
    --on-gold:     #150e10;

    --stone:       #1f1518;
    --stone-2:     #2a1c20;
    --stone-3:     #37252a;

    --muted:       #b39aa0;
    --muted-dim:   #826a70;
    --neutral-col: #b39aa0;

    --gold:        #e8a8b4;
    --gold-dim:    #c98895;
    --gold-glow:   rgba(232, 168, 180, .14);
    --gold-edge:        rgba(232, 168, 180, .34);
    --gold-edge-soft:   rgba(232, 168, 180, .24);
    --gold-edge-faint:  rgba(232, 168, 180, .18);
    --gold-edge-strong: rgba(232, 168, 180, .4);

    --positive:    #9ed6a8;
    --negative:    #f08a8a;

    --line:            rgba(255, 255, 255, .075);
    --line-strong:     rgba(255, 255, 255, .13);
    --surface-edge:    rgba(255, 255, 255, .015);
    --surface-1:       rgba(255, 255, 255, .024);
    --surface-2:       rgba(255, 255, 255, .028);
    --surface-3:       rgba(255, 255, 255, .034);
    --surface-4:       rgba(255, 255, 255, .044);
    --surface-5:       rgba(255, 255, 255, .054);
    --inset:           rgba(0, 0, 0, .33);
    --inset-strong:    rgba(0, 0, 0, .47);
    --well:            rgba(0, 0, 0, .25);
    --ai-surface:      rgba(232, 168, 180, .085);
    --ai-edge:         rgba(232, 168, 180, .22);
    --sidebar-bg:      rgba(31, 21, 24, .74);

    --placeholder: #6b5459;
    --moon-lit:    #f8eef0;

    --aura-1: rgba(232, 168, 180, .08);
    --aura-2: rgba(160, 90, 100, .07);

    --pos-glow: rgba(158, 214, 168, .1);
    --pos-edge: rgba(158, 214, 168, .35);
    --neg-glow: rgba(240, 138, 138, .1);
    --neg-edge: rgba(240, 138, 138, .35);

    --shadow:      0 18px 50px rgba(0, 0, 0, .48);
    --scrim:       rgba(0, 0, 0, .57);
}

/* Suppress transitions during a theme switch so the swap is instant. */
.no-theme-transition,
.no-theme-transition *,
.no-theme-transition *::before,
.no-theme-transition *::after {
    transition: none !important;
    animation-duration: 0s !important;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background-color: var(--bg-bottom);
    color: var(--text);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* The viewport-sized ground: a vertical wash from a neutral extreme at the
   top (black on a dark palette, white on a light one) settling into the
   palette's own colour at the bottom, with the auras floating over it. */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 55% 45% at 12% 8%, var(--aura-1) 0%, transparent 65%),
        radial-gradient(ellipse 50% 50% at 88% 85%, var(--aura-2) 0%, transparent 70%),
        linear-gradient(to bottom, var(--bg-top) 0%, var(--bg-bottom) 100%);
    z-index: 0;
}

h1, h2, h3, h4 { font-weight: 400; letter-spacing: -.02em; line-height: 1.25; }
h1 { font-size: clamp(1.9rem, 3.4vw, 2.6rem); }
h2 { font-size: clamp(1.35rem, 2.2vw, 1.7rem); }
h3 { font-size: 1.05rem; }

a { color: var(--gold); text-decoration: none; transition: color var(--ease); }
a:hover { color: var(--text); }

p { color: var(--muted); }

.gold { color: var(--gold); }
.muted { color: var(--muted); }
.small-caps {
    font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
    color: var(--muted-dim); font-weight: 500;
}
.hidden { display: none !important; }
.spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Shell ────────────────────────────────────────────────── */
#app { position: relative; z-index: 1; }

.shell {
    display: grid;
    grid-template-columns: 244px 1fr;
    min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
    background: var(--sidebar-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-right: 1px solid var(--line);
    padding: 1.6rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 1.6rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: .7rem; padding: 0 .5rem; }
.mobile-menu-toggle { display: none; }
.mobile-sidebar-foot { display: none; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 50%;
    border: 1px solid var(--gold-dim);
    position: relative; flex: 0 0 auto;
}
.brand-mark::before, .brand-mark::after {
    content: ''; position: absolute; border-radius: 50%;
    border: 1px solid var(--gold-edge);
}
.brand-mark::before { inset: 6px; }
.brand-mark::after  { inset: 12px; background: var(--gold); border: none; opacity: .75; }
.brand-name { font-size: 1.05rem; letter-spacing: -.02em; }
.brand-name span { color: var(--gold); }

/* The menu lives inside the scrolling sidebar and takes the height it needs;
   sections fold so it stays short, and `flex: 0 0 auto` keeps it from being
   squeezed when every section is open on a short window. */
.nav { display: flex; flex-direction: column; gap: .55rem; flex: 0 0 auto; }
.nav-group { display: flex; flex-direction: column; gap: .18rem; }
/* A section heading: a small caps line with a caret, foldable. It is a button
   so it is reachable by keyboard, but styled as a label rather than a link. */
.nav-group-head {
    display: flex; align-items: center; gap: .5rem;
    width: 100%; padding: .3rem .75rem .3rem .8rem;
    background: transparent; border: 0; font-family: inherit;
    font-size: .68rem; font-weight: 500; letter-spacing: .14em;
    text-transform: uppercase; color: var(--muted-dim);
    cursor: pointer; text-align: left; border-radius: var(--radius-sm);
    transition: var(--ease);
}
.nav-group-head:hover { color: var(--text); }
.nav-group-head:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.nav-group-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-group-caret {
    flex: 0 0 auto; width: 6px; height: 6px;
    border-right: 1px solid currentColor;
    border-bottom: 1px solid currentColor;
    transform: rotate(45deg) translate(-1px, -1px);
    transition: transform var(--ease);
}
.nav-group.open .nav-group-caret { transform: rotate(-135deg) translate(-1px, -1px); }
/* The items fold away rather than disappearing, so the caret has something to
   point at and the section keeps its heading where the eye left it. */
.nav-group-items { display: none; flex-direction: column; gap: .1rem; }
.nav-group.open .nav-group-items { display: flex; }
/* Rows inside a section are a touch tighter than the old flat list, so four
   sections of links still fit a laptop viewport. */
.nav-group-items button[data-view] { padding: .5rem .75rem; line-height: 1.3; }
/* A section holding a view, folded shut, still marks that view with a dot so
   a closed menu never loses your place. */
.nav-group:not(.open):has([data-view].active) .nav-group-label { color: var(--gold); }
.nav-group:not(.open):has([data-view].active) .nav-group-label::after {
    content: ''; display: inline-block; vertical-align: middle;
    width: 4px; height: 4px; margin-left: .4rem; border-radius: 50%;
    background: var(--gold);
}
.nav button[data-view] {
    display: flex; align-items: center; gap: .7rem;
    width: 100%; padding: .62rem .75rem;
    background: transparent; border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--muted); font-size: .9rem; font-family: inherit;
    cursor: pointer; text-align: left;
    transition: var(--ease);
}
.nav button[data-view]:hover { background: var(--surface-4); color: var(--text); }
.nav button[data-view].active {
    background: var(--gold-glow);
    border-color: var(--gold-edge-soft);
    color: var(--gold);
}
.nav .ico { width: 18px; text-align: center; font-size: .95rem; opacity: .9; }
/* The chat glyph is an inline SVG so it stays monochrome; the text glyphs
   around it are sized in rem, so match their optical weight here. */
.nav .ico svg { width: 15px; height: 15px; display: block; margin: 0 auto; }
/* ── Chat ─────────────────────────────────────────────────── */
/* The chat fills the viewport instead of growing with the conversation, so the
   composer stays put and only the transcript scrolls. */
.chat-view {
    display: flex; flex-direction: column;
    height: calc(100vh - 6.2rem); min-height: 540px;
}
.chat-page-head { margin-bottom: 1.1rem; align-items: flex-start; }
.chat-page-head > div:first-child { flex: 1 1 auto; min-width: 0; }
.chat-page-head p { margin-top: 0; }
.chat-page-head h1 {
    font-size: clamp(1.35rem, 2.2vw, 1.75rem);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* The history opener. On a wide screen the history is a column beside the
   transcript, so this button is not needed; below the breakpoint it is the
   only way in, and it sits in the page head where the title already is. */
.chat-history-toggle {
    display: none; align-items: center; gap: .45rem;
    padding: .45rem .8rem; border-radius: 100px;
    border: 1px solid var(--line-strong); background: var(--surface-2);
    color: var(--text); font: inherit; font-size: .78rem; cursor: pointer;
    transition: var(--ease);
}
.chat-history-toggle:hover { border-color: var(--gold-edge); color: var(--gold); }
.chat-history-toggle:focus-visible { outline: 2px solid var(--gold-edge); outline-offset: 2px; }
.chat-history-toggle[aria-expanded="true"] {
    border-color: var(--gold-edge); background: var(--gold-glow); color: var(--gold);
}
.chat-history-toggle-icon { display: grid; place-items: center; opacity: .85; }
.chat-history-toggle-icon svg { width: 15px; height: 15px; display: block; }
.chat-history-toggle .chat-count-badge { padding: 0 .4rem; }

/* The drawer's own header: only shown while the panel is a drawer. */
.chat-side-head-mobile { display: none; }
.chat-side-close {
    width: 30px; height: 30px; flex: 0 0 auto;
    display: grid; place-items: center;
    border: 1px solid var(--line); border-radius: 50%;
    background: transparent; color: var(--muted);
    font: inherit; font-size: 1.1rem; line-height: 1; cursor: pointer;
    transition: var(--ease);
}
.chat-side-close:hover { border-color: var(--gold-edge); color: var(--gold); }
.chat-side-close:focus-visible { outline: 2px solid var(--gold-edge); outline-offset: 2px; }

.chat-layout {
    flex: 1; min-height: 0;
    display: grid; grid-template-columns: minmax(0, 1fr) 300px;
    gap: 1.25rem; align-items: stretch;
}
/* .card sets its own padding later in this file, so the chat card needs the
   extra specificity to keep the transcript flush with its edges. */
.card.chat-card {
    display: flex; flex-direction: column; gap: 0;
    padding: 0; min-height: 0; height: 100%;
    overflow: hidden;
}
.chat-scroll { position: relative; flex: 1; min-height: 0; display: flex; }

/* Context toolbar: the record selection reads as toggle chips, not checkboxes. */
.chat-toolbar {
    display: flex; flex-direction: column; gap: .55rem;
    padding: .85rem 1.1rem;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
}
.chat-toolbar-row { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.chat-toolbar-label {
    font-size: .68rem; letter-spacing: .12em; text-transform: uppercase;
    color: var(--muted-dim); font-weight: 500;
}

/* The context panel folds away once a conversation is under way: the
   transcript is what the person came back for, and the folded row still names
   the records the next message will carry. */
.chat-context-toggle {
    display: flex; align-items: center; gap: .55rem;
    width: 100%; padding: 0; border: 0; background: transparent;
    font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.chat-context-toggle:hover .chat-toolbar-label { color: var(--text); }
.chat-context-toggle:focus-visible { outline: 2px solid var(--gold-edge); outline-offset: 3px; border-radius: 4px; }
.chat-context-summary {
    flex: 1; min-width: 0;
    font-size: .76rem; color: var(--gold-dim); text-align: left;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-context-summary.is-empty { color: var(--muted-dim); }
.chat-context-caret {
    flex: none; width: .5rem; height: .5rem; margin-right: .15rem;
    border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted);
    transform: rotate(45deg) translate(-2px, -2px);
    transition: transform .18s var(--ease);
}
.chat-context-toggle[aria-expanded="true"] .chat-context-caret {
    transform: rotate(-135deg) translate(-2px, -2px);
}
.chat-context-panel {
    display: flex; flex-direction: column; gap: .55rem;
    animation: chat-in .18s var(--ease);
}
.chat-context-panel[hidden] { display: none; }
.chat-context-folded .chat-toolbar { padding-top: .6rem; padding-bottom: .6rem; }
.chat-context-chips { display: flex; gap: .35rem; flex-wrap: wrap; }
.chat-chip {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .3rem .72rem; border-radius: 100px;
    border: 1px solid var(--line); background: transparent;
    color: var(--muted); font: inherit; font-size: .78rem; cursor: pointer;
    transition: var(--ease);
}
.chat-chip:hover { border-color: var(--line-strong); color: var(--text); }
.chat-chip[aria-pressed="true"] {
    border-color: var(--gold-edge); background: var(--gold-glow); color: var(--gold);
}
.chat-chip:focus-visible { outline: 2px solid var(--gold-edge); outline-offset: 2px; }
.chat-chip-glyph { font-size: .85rem; opacity: .85; }

/* Knowledge pins: which documents this conversation may draw on. */
.chat-knowledge {
    padding: .6rem .7rem;
    border: 1px solid var(--line); border-left: 2px solid var(--gold-edge-faint);
    border-radius: var(--radius-sm); background: var(--surface-1);
    animation: chat-in .22s var(--ease);
}
.chat-knowledge[hidden] { display: none; }
.chat-knowledge-head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
.chat-knowledge-mode { font-size: .72rem; color: var(--gold-dim); }
.chat-knowledge-chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .45rem; }
.chat-knowledge-collections { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .45rem; }
.chat-knowledge-sources { margin-top: .1rem; }
.chat-pin {
    display: inline-flex; align-items: center; gap: .3rem;
    max-width: 30ch; padding: .24rem .65rem; border-radius: 100px;
    border: 1px solid var(--line); background: transparent; cursor: pointer;
    font: inherit; font-size: .74rem; color: var(--muted);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    transition: var(--ease);
}
.chat-pin:hover { border-color: var(--line-strong); color: var(--text); }
.chat-pin.active { border-color: var(--gold-edge); color: var(--gold); background: var(--gold-glow); }
.chat-pin:focus-visible { outline: 2px solid var(--gold-edge); outline-offset: 2px; }
.chat-pin-mark { opacity: .8; }
.chat-action.remembered { color: var(--gold); }

/* Astrology detail selector: only visible while the birth-chart chip is on. */
.chat-astro-scope {
    padding: .6rem .7rem;
    border: 1px solid var(--line); border-left: 2px solid var(--gold-edge-faint);
    border-radius: var(--radius-sm); background: var(--surface-1);
    animation: chat-in .22s var(--ease);
}
.chat-astro-scope[hidden] { display: none; }
.chat-astro-scope-label {
    display: block; font-size: .68rem; letter-spacing: .1em;
    text-transform: uppercase; color: var(--muted-dim); margin-bottom: .45rem;
}
.chat-astro-scope-options { display: flex; flex-wrap: wrap; gap: .35rem; }
.chat-scope-option {
    display: inline-flex; align-items: center;
    padding: .26rem .7rem; border-radius: 100px;
    border: 1px solid var(--line); background: transparent; cursor: pointer;
    font: inherit; font-size: .76rem; color: var(--muted);
    transition: var(--ease);
}
.chat-scope-option:hover { border-color: var(--line-strong); color: var(--text); }
.chat-scope-option.active {
    border-color: var(--gold-edge); color: var(--gold); background: var(--gold-glow);
}
.chat-scope-option:focus-visible { outline: 2px solid var(--gold-edge); outline-offset: 2px; }
.chat-astro-hint { margin-top: .45rem; font-size: .74rem; color: var(--muted-dim); line-height: 1.55; }

/* Privacy note collapses so it does not compete with the conversation. */
.chat-privacy { font-size: .78rem; color: var(--muted-dim); }
.chat-privacy summary {
    display: inline-flex; align-items: center; gap: .35rem;
    cursor: pointer; color: var(--muted); list-style: none;
}
.chat-privacy summary::-webkit-details-marker { display: none; }
.chat-privacy summary::before { content: 'ⓘ'; color: var(--gold-dim); }
.chat-privacy summary:hover { color: var(--text); }
.chat-privacy summary:focus-visible { outline: 2px solid var(--gold-edge); outline-offset: 2px; border-radius: 4px; }
.chat-privacy p { margin-top: .45rem; line-height: 1.6; max-width: 72ch; }

/* ── Conversation ─────────────────────────────────────────── */
.chat-messages {
    flex: 1; display: flex; flex-direction: column; gap: 1rem;
    min-height: 0; overflow-y: auto; padding: 1rem .8rem .85rem;
    scroll-behavior: smooth; overscroll-behavior: contain;
}
.chat-day {
    display: flex; align-items: center; gap: .75rem;
    font-size: .66rem; letter-spacing: .12em; text-transform: uppercase;
    color: var(--muted-dim);
}
.chat-day::before, .chat-day::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* Bubbles use the whole transcript width: a capped row left a dead gutter on
   the far side, and the avatar column cost another 30px beside every bubble.
   The speaker is still named in the bubble head, so no avatar is rendered. */
.chat-message {
    display: flex; align-items: flex-start;
    max-width: 100%;
    animation: chat-in .28s var(--ease);
}
.chat-bubble {
    flex: 1 1 auto; min-width: 0; padding: .7rem .95rem .5rem;
    border: 1px solid var(--line); border-radius: 14px 14px 14px 4px;
    background: var(--surface-2);
}
.chat-message.user .chat-bubble {
    border-radius: 14px 14px 4px 14px;
    border-color: var(--gold-edge-soft); background: var(--gold-glow);
}
.chat-message-head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
.chat-message-head strong { color: var(--gold); font-size: .74rem; letter-spacing: .04em; }
.chat-message-head time { font-size: .66rem; color: var(--muted-dim); font-variant-numeric: tabular-nums; }

/* Actions stay out of the way until the message is hovered or focused. */
.chat-message-actions {
    display: flex; justify-content: flex-end; gap: .1rem;
    margin-top: .3rem; opacity: 0; transition: opacity .18s var(--ease);
}
.chat-message:hover .chat-message-actions,
.chat-message:focus-within .chat-message-actions { opacity: 1; }
.chat-action {
    display: inline-grid; place-items: center;
    width: 26px; height: 26px; border: 0; border-radius: 7px;
    background: transparent; color: var(--muted-dim);
    font: inherit; font-size: .95rem; line-height: 1; cursor: pointer;
    transition: var(--ease);
}
.chat-action svg { width: 14px; height: 14px; }
.chat-action:hover { color: var(--gold); background: var(--surface-4); }
.chat-action:focus-visible { outline: 2px solid var(--gold-edge); outline-offset: 1px; }
.chat-action.copied { color: var(--positive); }
.chat-favorite.active { color: var(--gold); }
.chat-message-focus .chat-bubble { border-color: var(--gold-edge); box-shadow: 0 0 0 2px var(--gold-glow); }

/* Typing indicator while the reply is being generated. */
.chat-typing .chat-bubble { flex: 0 0 auto; display: flex; align-items: center; gap: .6rem; }
.chat-dots { display: inline-flex; gap: .22rem; }
.chat-dots span {
    width: 5px; height: 5px; border-radius: 50%;
    background: var(--gold); opacity: .3;
    animation: chat-dot 1.2s infinite ease-in-out;
}
.chat-dots span:nth-child(2) { animation-delay: .15s; }
.chat-dots span:nth-child(3) { animation-delay: .3s; }
.chat-typing-label { font-size: .74rem; color: var(--muted-dim); }

/* Empty conversation: an invitation plus three ways in. */
.chat-empty {
    margin: auto; max-width: 460px; padding: 1.5rem 1rem;
    display: grid; gap: .5rem; justify-items: center; text-align: center;
}
.chat-empty-mark {
    width: 46px; height: 46px; border-radius: 50%;
    display: grid; place-items: center; font-size: 1.1rem;
    color: var(--gold); border: 1px solid var(--gold-edge-soft); background: var(--gold-glow);
}
.chat-empty h2 { font-size: 1.15rem; }
.chat-empty p { font-size: .88rem; }
.chat-starters { display: grid; gap: .4rem; width: 100%; margin-top: .6rem; }
.chat-starter {
    padding: .6rem .8rem; text-align: left;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface-2); color: var(--text-soft);
    font: inherit; font-size: .84rem; cursor: pointer;
    transition: var(--ease);
}
.chat-starter:hover {
    border-color: var(--gold-edge-soft); background: var(--gold-glow);
    color: var(--text); transform: translateX(2px);
}
.chat-starter:focus-visible { outline: 2px solid var(--gold-edge); outline-offset: 2px; }

/* Ready-made analyses: one picker, so the list stays short however many exist. */
.chat-template-picker {
    display: grid; gap: .4rem; width: 100%; margin-top: .6rem; text-align: left;
}
.chat-template-row { display: flex; gap: .4rem; align-items: stretch; }
.chat-template-row select {
    flex: 1; min-width: 0;
    padding: .5rem .6rem; border-radius: var(--radius-sm);
    border: 1px solid var(--line); background: var(--surface-2);
    color: var(--text); font: inherit; font-size: .84rem; cursor: pointer;
}
.chat-template-row select:focus-visible { outline: 2px solid var(--gold-edge); outline-offset: 2px; }
.chat-template-row .btn { flex: 0 0 auto; }
.chat-template-sub { font-size: .78rem; color: var(--muted-dim); line-height: 1.5; }

/* Chat templates (administrator screen): a list beside one editor. */
.template-layout {
    display: grid; gap: 1.25rem;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    align-items: start;
}
@media (max-width: 900px) {
    .template-layout { grid-template-columns: minmax(0, 1fr); }
}
.template-row {
    display: flex; align-items: stretch; gap: .4rem;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface-2); margin-bottom: .45rem;
    transition: var(--ease);
}
.template-row.active { border-color: var(--gold-edge); background: var(--gold-glow); }
.template-row-main {
    flex: 1; display: grid; gap: .3rem; padding: .6rem .7rem;
    text-align: left; background: transparent; border: 0; cursor: pointer;
    font: inherit; color: var(--text-soft);
}
.template-row-head { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.template-row-sub { font-size: .8rem; color: var(--muted-dim); line-height: 1.5; }
.template-row-contexts { display: flex; flex-wrap: wrap; gap: .3rem; }
.template-row > .btn { align-self: center; margin-right: .4rem; }
.template-context-options { display: flex; flex-wrap: wrap; gap: .5rem .9rem; }
.template-context-option {
    display: inline-flex; align-items: center; gap: .4rem;
    font-size: .82rem; color: var(--text-soft); cursor: pointer;
}
.template-context-option input { accent-color: var(--gold); }

.chat-jump {
    position: absolute; right: 1.1rem; bottom: 1rem; z-index: 2;
    width: 34px; height: 34px; border-radius: 50%;
    border: 1px solid var(--line-strong); background: var(--stone-2);
    color: var(--text); font-size: .95rem; cursor: pointer;
    box-shadow: var(--shadow); transition: var(--ease);
}
.chat-jump[hidden] { display: none; }
.chat-jump:hover { border-color: var(--gold-edge); color: var(--gold); }

/* ── Composer ─────────────────────────────────────────────── */
.composer { padding: .85rem 1.1rem 1.1rem; border-top: 1px solid var(--line); background: var(--surface-1); }
.composer-box {
    padding: .5rem .55rem .4rem;
    border: 1px solid var(--line-strong); border-radius: 14px;
    background: var(--inset); transition: var(--ease);
}
.composer-box:focus-within { border-color: var(--gold-edge); box-shadow: 0 0 0 3px var(--gold-glow); }
.composer textarea {
    width: 100%; min-height: 44px; max-height: 180px;
    padding: .25rem .3rem; border: 0; background: transparent;
    color: var(--text); font-family: inherit; font-size: .92rem; line-height: 1.6;
    resize: none;
}
.composer textarea:focus { outline: none; background: transparent; }
.composer-foot { display: flex; align-items: center; gap: .6rem; padding: .1rem .2rem 0; }
.composer-hint {
    flex: 1; min-width: 0; font-size: .7rem; color: var(--muted-dim);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.composer-count { font-size: .7rem; color: var(--muted-dim); font-variant-numeric: tabular-nums; }
.composer-count.near { color: var(--negative); }
.composer-send {
    display: grid; place-items: center; flex: 0 0 auto;
    width: 34px; height: 34px; border: 0; border-radius: 50%;
    background: var(--gold); color: var(--on-gold); cursor: pointer;
    transition: var(--ease);
}
.composer-send svg { width: 16px; height: 16px; }
.composer-send:hover:not(:disabled) { background: var(--gold-dim); transform: translateY(-1px); }
.composer-send:disabled { opacity: .35; cursor: not-allowed; }
.composer.sending .composer-send { opacity: .6; }

/* ── Chat sidebar ─────────────────────────────────────────── */
.chat-side {
    display: flex; flex-direction: column; gap: 1rem;
    min-height: 0; overflow-y: auto; padding-right: .15rem;
}
.chat-side-block {
    display: flex; flex-direction: column; gap: .6rem;
    padding: .9rem; border: 1px solid var(--line);
    border-radius: var(--radius); background: var(--surface-1);
}
.chat-new {
    display: flex; align-items: center; justify-content: center; gap: .4rem;
    width: 100%; padding: .5rem .8rem;
    border: 1px solid var(--gold-edge-soft); border-radius: 100px;
    background: var(--gold-glow); color: var(--gold);
    font: inherit; font-size: .82rem; cursor: pointer;
    transition: var(--ease);
}
.chat-new:hover { border-color: var(--gold-edge); background: var(--surface-4); }
.chat-new:focus-visible { outline: 2px solid var(--gold-edge); outline-offset: 2px; }
.chat-side-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.chat-side-head h2 {
    font-size: .72rem; font-weight: 500; letter-spacing: .12em;
    text-transform: uppercase; color: var(--muted-dim);
}
.chat-count-badge {
    padding: .05rem .45rem; border-radius: 100px;
    border: 1px solid var(--line); color: var(--muted);
    font-size: .68rem; font-variant-numeric: tabular-nums;
}
.chat-search {
    display: flex; align-items: center; gap: .45rem;
    padding: .4rem .65rem; border: 1px solid var(--line); border-radius: 100px;
    background: var(--inset); color: var(--muted-dim);
    transition: var(--ease);
}
.chat-search:focus-within { border-color: var(--gold-edge); color: var(--gold); }
.chat-search svg { width: 14px; height: 14px; flex: 0 0 auto; }
.chat-search input {
    width: 100%; padding: 0; border: 0; background: transparent;
    color: var(--text); font-family: inherit; font-size: .8rem;
}
.chat-search input:focus { outline: none; background: transparent; }
.chat-history-list {
    display: grid; gap: .2rem; max-height: 46vh; overflow-y: auto;
    margin: 0 -.2rem; padding: 0 .2rem;
}
.chat-history-item {
    display: flex; align-items: flex-start; gap: .5rem; width: 100%;
    padding: .5rem .55rem; border: 1px solid transparent; border-radius: 10px;
    background: transparent; color: var(--muted);
    text-align: left; font: inherit; cursor: pointer;
    transition: var(--ease);
}
/* The search filter sets [hidden]; display:flex would otherwise win. */
.chat-history-item[hidden] { display: none; }
.chat-history-item:hover { background: var(--surface-3); color: var(--text); }
.chat-history-item.active {
    background: var(--gold-glow); border-color: var(--gold-edge-soft); color: var(--text);
}
.chat-history-item:focus-visible { outline: 2px solid var(--gold-edge); outline-offset: 1px; }
.chat-history-main { display: grid; gap: .1rem; flex: 1; min-width: 0; }
.chat-history-title { font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-history-preview { font-size: .72rem; color: var(--muted-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-history-meta { display: grid; justify-items: end; gap: .2rem; flex: 0 0 auto; }
.chat-history-time { font-size: .66rem; color: var(--muted-dim); white-space: nowrap; }
.chat-history-delete {
    font-size: .95rem; line-height: 1; color: var(--muted-dim);
    opacity: 0; transition: var(--ease);
}
.chat-history-item:hover .chat-history-delete,
.chat-history-item:focus-within .chat-history-delete { opacity: .8; }
.chat-history-delete:hover { color: var(--negative); }
.chat-side-empty, .chat-history-empty { font-size: .78rem; color: var(--muted-dim); padding: .3rem .1rem; }

.chat-favorites-list { display: grid; gap: .35rem; max-height: 32vh; overflow-y: auto; }
.chat-favorite-item {
    display: grid; gap: .15rem; width: 100%; text-align: left; font: inherit;
    padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 10px;
    background: var(--surface-2); color: var(--text); cursor: pointer;
    transition: var(--ease);
}
.chat-favorite-item:hover, .chat-favorite-item:focus-visible {
    border-color: var(--gold-edge-soft); background: var(--gold-glow);
}
.chat-favorite-text { font-size: .78rem; line-height: 1.45; color: var(--text-soft); }
.chat-favorite-meta { font-size: .68rem; color: var(--muted-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@keyframes chat-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes chat-dot {
    0%, 60%, 100% { opacity: .25; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-2px); }
}

/* Slim scrollbars keep the transcript and the sidebar quiet. */
.chat-messages, .chat-side, .chat-history-list, .chat-favorites-list {
    scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.chat-messages::-webkit-scrollbar,
.chat-side::-webkit-scrollbar,
.chat-history-list::-webkit-scrollbar,
.chat-favorites-list::-webkit-scrollbar { width: 8px; }
.chat-messages::-webkit-scrollbar-track,
.chat-side::-webkit-scrollbar-track,
.chat-history-list::-webkit-scrollbar-track,
.chat-favorites-list::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb,
.chat-side::-webkit-scrollbar-thumb,
.chat-history-list::-webkit-scrollbar-thumb,
.chat-favorites-list::-webkit-scrollbar-thumb {
    background: var(--line-strong); border-radius: 100px;
    border: 2px solid transparent; background-clip: content-box;
}
.chat-messages::-webkit-scrollbar-thumb:hover,
.chat-side::-webkit-scrollbar-thumb:hover,
.chat-history-list::-webkit-scrollbar-thumb:hover,
.chat-favorites-list::-webkit-scrollbar-thumb:hover {
    background: var(--gold-edge-faint); background-clip: content-box;
}

@media (prefers-reduced-motion: reduce) {
    .chat-message, .chat-astro-scope, .chat-knowledge, .chat-context-panel { animation: none; }
    .chat-context-caret { transition: none; }
    .chat-dots span { animation: none; opacity: .6; }
    .chat-messages { scroll-behavior: auto; }
    .chat-side, .chat-view::after { transition: none; }
    .search-skeleton-row { animation: none; opacity: .6; }
    .search-result:hover, .search-result:focus-visible { transform: none; }
}

/* Touch devices have no hover, so the message actions stay visible. */
@media (hover: none) {
    .chat-message-actions { opacity: 1; }
    .chat-history-delete { opacity: .7; }
}

.chat-body { margin-top: .35rem; overflow-wrap: anywhere; }
.chat-message.user .chat-body p { white-space: pre-wrap; }
.chat-body p { margin: 0 0 .6rem; }
.chat-body p:last-child { margin-bottom: 0; }
.chat-body ul, .chat-body ol { margin: .35rem 0 .6rem; padding-left: 1.25rem; }
.chat-body li { margin: .15rem 0; }
.chat-body strong { color: var(--text); font-size: inherit; }
.chat-body code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .86em; background: var(--surface-4); border-radius: 4px; padding: .1rem .3rem; }
.chat-body .md-code { background: var(--well); border: 1px solid var(--line); border-radius: 8px; padding: .6rem .75rem; overflow-x: auto; margin: .4rem 0 .6rem; }
.chat-body .md-code code { background: none; padding: 0; }
.chat-body .md-heading { font-weight: 600; color: var(--text); margin: .5rem 0 .35rem; }

/* Model prose rendered from light Markdown (dream readings, chart synthesis). */
.md-prose p { margin: 0 0 .6rem; }
.md-prose p:last-child { margin-bottom: 0; }
.md-prose ul, .md-prose ol { margin: .35rem 0 .6rem; padding-left: 1.25rem; }
.md-prose li { margin: .15rem 0; }
.md-prose code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .86em; background: var(--surface-4); border-radius: 4px; padding: .1rem .3rem; }
.md-prose .md-code { background: var(--well); border: 1px solid var(--line); border-radius: 8px; padding: .6rem .75rem; overflow-x: auto; margin: .4rem 0 .6rem; }
.md-prose .md-code code { background: none; padding: 0; }
.md-prose .md-heading { font-weight: 600; color: var(--text); margin: .5rem 0 .35rem; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: .75rem; }

.user-chip {
    display: flex; align-items: center; gap: .65rem;
    padding: .65rem .75rem;
    background: var(--surface-3);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}
.user-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--gold-glow); border: 1px solid var(--gold-edge-soft);
    display: flex; align-items: center; justify-content: center;
    font-size: .8rem; color: var(--gold); flex: 0 0 auto;
}
.user-meta { min-width: 0; }
.user-meta strong { display: block; font-size: .85rem; font-weight: 500; }
.user-meta em {
    font-style: normal; font-size: .7rem; color: var(--muted-dim);
    text-transform: uppercase; letter-spacing: .1em;
}

/* ── Main ─────────────────────────────────────────────────── */
.main { padding: 2.2rem 2.4rem 4rem; max-width: 1180px; }

.page-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 1.5rem; flex-wrap: wrap; margin-bottom: 2rem;
}
.page-head p { max-width: 620px; margin-top: .4rem; font-size: .95rem; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
    background: var(--surface-1);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.6rem 1.75rem;
    transition: border-color var(--ease);
}
.card + .card { margin-top: 1.25rem; }
.card:hover { border-color: var(--line-strong); }
.card-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem;
}
.card-head h2, .card-head h3 { margin: 0; }
.card-sub { font-size: .82rem; color: var(--muted-dim); margin-top: .2rem; }

.grid { display: grid; gap: 1.25rem; }
/* minmax(320px, 1fr) sets a 320px floor, but a grid item's own min-content can
   still exceed it — a nowrap line of text, for instance — and the track then
   grows past the viewport. minmax(0, 1fr) in the responsive block removes that
   floor so the track can shrink and the text ellipsises instead. */
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 1.25rem; }
.row   { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; min-width: 0; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .62rem 1.4rem; border-radius: 100px;
    font-size: .88rem; font-weight: 500; font-family: inherit;
    cursor: pointer; border: 1px solid transparent;
    transition: var(--ease); white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--gold); color: var(--on-gold); }
.btn-primary:hover:not(:disabled) { background: var(--gold-dim); transform: translateY(-1px); }
.btn-outline { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-outline:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }
.btn-ghost {
    background: transparent; color: var(--muted); border-color: transparent;
    padding: .4rem .75rem; font-size: .82rem;
}
.btn-ghost:hover:not(:disabled) { color: var(--text); background: var(--surface-5); }
.btn-danger { background: transparent; color: var(--negative); border-color: var(--neg-edge); }
.btn-danger:hover:not(:disabled) { background: var(--neg-glow); }
.btn-sm { padding: .38rem .9rem; font-size: .8rem; }

/* ── Forms ────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1rem; }
.field label { font-size: .78rem; letter-spacing: .07em; text-transform: uppercase; color: var(--muted-dim); }
.field .hint { font-size: .76rem; color: var(--muted-dim); text-transform: none; letter-spacing: 0; }

input[type="text"], input[type="password"], input[type="email"],
input[type="date"], input[type="time"], input[type="number"],
select, textarea {
    width: 100%; padding: .68rem .85rem;
    background: var(--inset);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--text); font-family: inherit; font-size: .92rem;
    transition: var(--ease);
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--gold);
    background: var(--inset-strong);
}
input::placeholder, textarea::placeholder { color: var(--placeholder); }
textarea { resize: vertical; min-height: 120px; line-height: 1.7; }
select { cursor: pointer; appearance: none; background-image: none; }
select option { background: var(--stone-2); color: var(--text); }

.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .9rem; }

/* Place lookup: the birth city resolves to coordinates. */
.place-results { display: grid; gap: .3rem; margin-top: .35rem; }
.place-option {
    display: grid; grid-template-columns: 1fr auto; gap: .1rem .6rem;
    width: 100%; padding: .5rem .65rem; text-align: left; font: inherit; font-size: .84rem;
    color: var(--text); background: var(--surface-3); border: 1px solid var(--line);
    border-radius: var(--radius-sm); cursor: pointer;
}
.place-option:hover, .place-option:focus-visible { border-color: var(--gold-edge-soft); background: var(--gold-glow); }
.place-option-name { font-weight: 500; }
.place-option-detail { grid-column: 1; font-size: .76rem; color: var(--muted); }
.place-option-coords { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: .74rem; color: var(--muted-dim); font-variant-numeric: tabular-nums; }
.place-status { font-size: .76rem; color: var(--muted-dim); min-height: 1em; }
.place-status.ok { color: var(--positive); }
.place-status.error { color: var(--negative); }

/* ── Search ───────────────────────────────────────────────── */
/* Plain inline search used by the knowledge base card. */
.search-form { display: flex; gap: .6rem; align-items: center; }
.search-form input[type="search"] { flex: 1; min-width: 0; }

.search-head { margin-bottom: 1.6rem; }

.search-panel {
    position: relative;
    padding: 1.35rem 1.5rem 1.5rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        radial-gradient(ellipse 60% 120% at 50% -20%, var(--gold-glow) 0%, transparent 70%),
        var(--surface-1);
    box-shadow: 0 1px 0 var(--surface-edge) inset;
}

/* The bar is the hero: one pill, icon, input, clear, submit. */
.search-bar {
    display: flex; align-items: center; gap: .55rem;
    padding: .4rem .45rem .4rem 1rem;
    border: 1px solid var(--line-strong);
    border-radius: 100px;
    background: var(--inset);
    transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
}
.search-bar:focus-within {
    border-color: var(--gold-edge);
    background: var(--inset-strong);
    box-shadow: 0 0 0 3px var(--gold-glow);
}
.search-bar-icon {
    display: flex; flex: 0 0 auto; color: var(--muted-dim);
    transition: color var(--ease);
}
.search-bar-icon svg { width: 17px; height: 17px; }
.search-bar:focus-within .search-bar-icon { color: var(--gold); }
.search-bar input[type="search"] {
    flex: 1; min-width: 0;
    padding: .55rem 0; border: 0; background: transparent;
    color: var(--text); font-family: inherit; font-size: 1rem;
}
.search-bar input[type="search"]:focus { outline: none; background: transparent; }
.search-bar input[type="search"]::-webkit-search-cancel-button { display: none; }
.search-clear {
    flex: 0 0 auto; width: 26px; height: 26px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 0; border-radius: 50%; background: var(--surface-4);
    color: var(--muted); font-size: .72rem; line-height: 1; cursor: pointer;
    transition: var(--ease);
}
.search-clear:hover { background: var(--surface-5); color: var(--text); }
.search-clear:focus-visible { outline: 2px solid var(--gold-edge); outline-offset: 2px; }
/* display:inline-flex would otherwise beat the [hidden] attribute. */
.search-clear[hidden] { display: none; }
.search-submit { flex: 0 0 auto; padding: .55rem 1.5rem; }

/* Source filters, shown once there is something to filter. */
.search-filters {
    display: flex; gap: .4rem; flex-wrap: wrap;
    margin-top: 1rem;
}
.search-filters[hidden] { display: none; }
.search-chip {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .34rem .8rem; border-radius: 100px;
    border: 1px solid var(--line); background: transparent;
    color: var(--muted); font: inherit; font-size: .8rem;
    cursor: pointer; transition: var(--ease);
}
.search-chip:hover:not(:disabled) { border-color: var(--line-strong); color: var(--text); }
.search-chip.active {
    border-color: var(--gold-edge); background: var(--gold-glow); color: var(--gold);
}
.search-chip:disabled { opacity: .38; cursor: default; }
.search-chip:focus-visible { outline: 2px solid var(--gold-edge); outline-offset: 2px; }
.search-chip-count {
    font-size: .7rem; font-variant-numeric: tabular-nums;
    color: var(--muted-dim);
}
.search-chip.active .search-chip-count { color: var(--gold); }

.search-results { margin-top: 1.35rem; }

.search-group + .search-group { margin-top: 1.6rem; }
.search-group-head {
    display: flex; align-items: center; gap: .5rem;
    padding-bottom: .5rem; margin-bottom: .55rem;
    border-bottom: 1px solid var(--line);
}
.search-group-icon {
    display: flex; color: var(--gold-dim); font-size: .82rem;
}
.search-group-icon svg { width: 14px; height: 14px; }
.search-group-title {
    font-size: .72rem; letter-spacing: .13em; text-transform: uppercase;
    color: var(--muted-dim); font-weight: 500;
}
.search-group-count {
    margin-left: auto; padding: .02rem .45rem; border-radius: 100px;
    border: 1px solid var(--line); color: var(--muted-dim);
    font-size: .68rem; font-variant-numeric: tabular-nums;
}

.search-list { display: grid; gap: .45rem; }
.search-result {
    display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .8rem;
    width: 100%; text-align: left; font: inherit;
    padding: .75rem .9rem;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface-2); color: var(--text); cursor: pointer;
    transition: var(--ease);
}
.search-result:hover, .search-result:focus-visible {
    border-color: var(--gold-edge-soft);
    background: var(--gold-glow);
    transform: translateY(-1px);
}
.search-result:focus-visible { outline: 2px solid var(--gold-edge); outline-offset: 2px; }
.search-result-icon {
    display: flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 50%;
    border: 1px solid var(--line); background: var(--surface-3);
    color: var(--gold-dim); font-size: .82rem;
}
.search-result-icon svg { width: 14px; height: 14px; }
.search-result:hover .search-result-icon { border-color: var(--gold-edge-soft); color: var(--gold); }
.search-result-main { display: grid; gap: .18rem; min-width: 0; }
.search-result-head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: .75rem; min-width: 0;
}
.search-result-title {
    font-size: .92rem; font-weight: 500;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.search-result-snippet {
    font-size: .82rem; color: var(--muted); line-height: 1.55;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.search-result-snippet mark {
    background: var(--gold-glow); color: var(--gold);
    border-radius: 3px; padding: 0 .1em;
}
.search-result-kind {
    font-size: .68rem; letter-spacing: .1em; text-transform: uppercase;
    color: var(--muted-dim);
}

/* Empty and loading states share one centred block. */
.search-empty {
    display: grid; justify-items: center; gap: .45rem;
    padding: 2.6rem 1rem; text-align: center;
}
.search-empty-mark {
    display: flex; align-items: center; justify-content: center;
    width: 46px; height: 46px; margin-bottom: .3rem;
    border: 1px solid var(--line); border-radius: 50%;
    background: var(--surface-2); color: var(--muted-dim);
}
.search-empty-mark svg { width: 19px; height: 19px; }
.search-empty-title { font-size: .95rem; color: var(--text-soft); }
.search-empty-body {
    font-size: .84rem; color: var(--muted-dim);
    max-width: 44ch; line-height: 1.6;
}

.search-skeleton { display: grid; gap: .45rem; }
.search-skeleton-row {
    display: block; height: 62px; border-radius: var(--radius-sm);
    border: 1px solid var(--line); background: var(--surface-2);
    animation: search-pulse 1.4s ease-in-out infinite;
}
.search-skeleton-row:nth-child(2) { animation-delay: .12s; }
.search-skeleton-row:nth-child(3) { animation-delay: .24s; }
.search-skeleton-row:nth-child(4) { animation-delay: .36s; }
@keyframes search-pulse { 0%, 100% { opacity: .45; } 50% { opacity: .9; } }

.entry-focus { border-color: var(--gold-edge); box-shadow: 0 0 0 1px var(--gold-edge-soft); }

/* Segmented control (valence, mood) */
.segmented { display: flex; gap: .4rem; flex-wrap: wrap; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
    padding: .42rem .95rem; border-radius: 100px;
    border: 1px solid var(--line-strong);
    font-size: .82rem; color: var(--muted); cursor: pointer;
    transition: var(--ease); text-transform: none; letter-spacing: 0;
}
.segmented label:hover { border-color: var(--muted); color: var(--text); }
.segmented input:checked + label { border-color: var(--gold); color: var(--gold); background: var(--gold-glow); }
.segmented input:focus-visible + label { outline: 2px solid var(--gold); outline-offset: 2px; }
.segmented input[value="positive"]:checked + label { border-color: var(--positive); color: var(--positive); background: var(--pos-glow); }
.segmented input[value="negative"]:checked + label { border-color: var(--negative); color: var(--negative); background: var(--neg-glow); }

/* ── Knowledge base ───────────────────────────────────────── */
/* The upload well: a real file input, styled as a drop target so the browser's
   own picker and the drag path share one control. */
.kb-drop {
    position: relative;
    padding: 1.35rem 1rem;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--inset);
    text-align: center;
    transition: var(--ease);
}
.kb-drop:hover, .kb-drop.dragging {
    border-color: var(--gold-edge);
    background: var(--gold-glow);
}
.kb-drop input[type="file"] {
    width: 100%; padding: 0; border: 0; background: transparent;
    color: var(--muted); font-size: .82rem; cursor: pointer;
}
.kb-drop input[type="file"]::file-selector-button {
    margin-right: .6rem; padding: .38rem .9rem;
    border: 1px solid var(--line-strong); border-radius: 100px;
    background: var(--surface-4); color: var(--text);
    font-family: inherit; font-size: .8rem; cursor: pointer;
    transition: var(--ease);
}
.kb-drop input[type="file"]::file-selector-button:hover {
    border-color: var(--gold-edge); color: var(--gold);
}
.kb-drop-hint { font-size: .78rem; color: var(--muted-dim); margin-top: .55rem; }
.kb-file-list { display: grid; gap: .25rem; margin-top: .5rem; }
.kb-file-row {
    display: flex; justify-content: space-between; gap: .75rem;
    padding: .3rem .55rem; border: 1px solid var(--line);
    border-radius: 8px; font-size: .8rem; color: var(--muted);
    background: var(--surface-2);
}
.kb-file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-soft); }
.kb-file-size { flex: 0 0 auto; color: var(--muted-dim); font-variant-numeric: tabular-nums; }
.kb-upload-note { margin-top: .7rem; font-size: .76rem; color: var(--muted-dim); line-height: 1.55; }

/* Which embedder is in use: this decides whether retrieval is lexical or
   semantic, so it is stated rather than hidden in a config file. */
.kb-capability {
    margin-top: 1.4rem; padding-top: 1.1rem;
    border-top: 1px solid var(--line);
}
.kb-capability-body { font-size: .8rem; color: var(--muted-dim); line-height: 1.6; margin-top: .35rem; }

.kb-documents { display: grid; gap: .7rem; }

/* Collections: the first screen. A collection row is one large click target
   that opens the detail view, with delete kept outside it so a mis-click
   cannot destroy a subject. */
/* Administration: a dense table, because the point of the screen is comparing
   accounts at a glance. It scrolls horizontally rather than wrapping, so the
   numeric columns stay aligned on a narrow viewport. */
.admin-table-wrap { overflow-x: auto; margin-top: .75rem; }
.admin-table {
    width: 100%; border-collapse: collapse;
    font-size: .84rem;
}
.admin-table th {
    text-align: left; font-weight: 500;
    font-size: .72rem; letter-spacing: .06em; text-transform: uppercase;
    color: var(--muted-dim);
    padding: .5rem .7rem; border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.admin-table td {
    padding: .65rem .7rem; border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
.admin-table tbody tr[data-admin-user] {
    cursor: pointer; transition: var(--ease);
}
.admin-table tbody tr[data-admin-user]:hover,
.admin-table tbody tr[data-admin-user]:focus-visible {
    background: var(--surface-edge);
    outline: none;
}
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.admin-user-name { display: block; font-weight: 600; }
.admin-user-handle { display: block; font-size: .76rem; color: var(--muted-dim); }
.admin-sub { display: block; font-size: .72rem; color: var(--muted-dim); }

/* A select inside a table row: narrow, so it never widens the numeric columns,
   and compact enough to sit on one line with the person's name. */
.admin-tier-select {
    width: auto; min-width: 8.5rem;
    padding: .32rem .55rem;
    font-size: .8rem;
    background: var(--inset);
}
.admin-tier-field { display: flex; align-items: center; gap: .45rem; }
.admin-tier-field .small-caps { color: var(--muted-dim); }
.admin-tier-field .small-caps {
    font-size: .7rem; letter-spacing: .07em; text-transform: uppercase;
}

.admin-stats {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr));
    gap: .6rem; margin-top: .5rem;
}
.admin-stat {
    display: grid; gap: .15rem;
    padding: .7rem .8rem;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface-edge);
}
.admin-stat-value { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.admin-stat-label { font-size: .72rem; color: var(--muted-dim); }

.admin-recent { display: grid; gap: .45rem; margin-top: .5rem; }
.admin-recent-row {
    display: flex; align-items: center; gap: .55rem; flex-wrap: wrap;
    padding: .5rem .7rem;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface-edge);
}
.admin-recent-title { flex: 1 1 10rem; min-width: 0; font-size: .84rem; }
.admin-recent-when { font-size: .74rem; color: var(--muted-dim); white-space: nowrap; }

.kb-collections { display: grid; gap: .7rem; }
.kb-collection {
    display: flex; align-items: stretch; justify-content: space-between;
    gap: .75rem; flex-wrap: wrap;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface-edge);
    transition: var(--ease);
}
.kb-collection:hover { border-color: var(--gold-dim); }
.kb-collection-open {
    flex: 1 1 16rem; min-width: 0;
    display: grid; gap: .3rem;
    padding: .9rem 1.1rem;
    background: none; border: 0; cursor: pointer;
    text-align: left; color: inherit; font: inherit;
}
.kb-collection-name { font-weight: 600; }
.kb-collection-meta {
    display: flex; align-items: center; gap: .45rem; flex-wrap: wrap;
    font-size: .78rem; color: var(--muted-dim);
}
.kb-collection-desc { font-size: .82rem; color: var(--muted); line-height: 1.5; }
.kb-collection-actions { display: flex; align-items: center; gap: .4rem; padding: 0 .7rem; flex-wrap: wrap; }

/* Visibility of a collection: a state the person reads, so it is a select
   showing the current answer rather than a button naming the next action. */
.kb-scope-field { display: flex; align-items: center; gap: .4rem; }
.kb-scope-field .small-caps { font-size: .68rem; letter-spacing: .06em; color: var(--muted-dim); white-space: nowrap; }
.kb-scope-select {
    width: auto; min-width: 7.5rem;
    padding: .3rem .55rem;
    font-size: .78rem;
}
.kb-back {
    background: none; border: 0; padding: 0; cursor: pointer;
    color: var(--gold); font: inherit; letter-spacing: inherit;
}
.kb-back:hover { text-decoration: underline; }

.kb-document {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap;
    padding: .9rem 1.1rem;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface-edge);
    transition: var(--ease);
}
.kb-document:hover { border-color: var(--line-strong); }
.kb-document-main { flex: 1 1 340px; min-width: 0; }
.kb-document-head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.kb-document-title { font-size: .96rem; color: var(--text); overflow-wrap: anywhere; }
.kb-document-meta {
    display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
    margin-top: .4rem; font-size: .74rem; color: var(--muted-dim);
}
.kb-document-file { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 22ch; }
.kb-document-error { margin-top: .45rem; font-size: .78rem; color: var(--negative); }
.kb-document-actions { display: flex; gap: .2rem; flex-wrap: wrap; flex: 0 0 auto; }
.kb-preview-host:empty { display: none; }
.kb-preview-host { flex: 1 1 100%; }

.kb-chunks { display: grid; gap: .4rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.kb-chunk {
    display: flex; gap: .6rem; align-items: flex-start;
    padding: .5rem .7rem; border-radius: 8px;
    background: var(--well); border: 1px solid var(--line);
}
.kb-chunk-index {
    flex: 0 0 auto; font-size: .7rem; color: var(--gold-dim);
    font-variant-numeric: tabular-nums; padding-top: .15rem;
}
.kb-chunk-text { font-size: .82rem; color: var(--muted); line-height: 1.6; }

.kb-matches { display: grid; gap: .55rem; margin-top: 1rem; }
.kb-match {
    padding: .7rem .9rem; border: 1px solid var(--line);
    border-radius: var(--radius-sm); background: var(--surface-2);
}
.kb-match-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.kb-match-title { font-size: .88rem; color: var(--text); }
.kb-match-score { margin-left: auto; font-size: .72rem; color: var(--muted-dim); font-variant-numeric: tabular-nums; }
.kb-match-text { margin-top: .4rem; font-size: .82rem; color: var(--muted); line-height: 1.65; }

.kb-memory-form { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.kb-memory-form input { flex: 1 1 260px; min-width: 0; }
.kb-memory-list { display: grid; gap: .5rem; }
.kb-memory-note {
    display: grid; gap: .25rem;
    padding: .65rem .85rem; border: 1px solid var(--line);
    border-radius: var(--radius-sm); background: var(--surface-2);
}
.kb-memory-body { font-size: .88rem; color: var(--text-soft); line-height: 1.6; overflow-wrap: anywhere; }
.kb-memory-meta { display: flex; gap: .35rem; font-size: .72rem; color: var(--muted-dim); }
.kb-memory-actions { display: flex; gap: .2rem; flex-wrap: wrap; }

/* ── Private wellbeing check-in ───────────────────────────── */
.mental-question {
    min-width: 0; border: 0; margin: 0 0 1.4rem; padding: 0;
}
.mental-question legend {
    width: 100%; margin-bottom: .65rem; color: var(--text-soft);
    font-size: .94rem;
}
.mental-question .segmented label { padding: .4rem .75rem; }
.mental-result { border-color: var(--gold-edge-soft); }
.mental-result > p { margin-bottom: 1rem; }
.mental-disclaimer { font-size: .82rem; }
.mental-responses { display: grid; gap: .45rem; margin: 1rem 0; }
.mental-response {
    display: flex; justify-content: space-between; gap: 1rem;
    padding: .55rem .75rem; border: 1px solid var(--line);
    border-radius: var(--radius-sm); color: var(--muted);
}
.mental-response strong { color: var(--text-soft); font-weight: 500; text-align: right; }
.mental-suggestion { margin: .9rem 0; padding: .85rem 1rem; border: 1px solid var(--gold-edge-soft); border-radius: var(--radius-sm); background: var(--gold-glow); }
.mental-suggestion strong { color: var(--gold); font-size: .82rem; font-weight: 600; }
.mental-suggestion p { margin-top: .35rem; }
.mental-note { padding: .8rem 0; border-top: 1px solid var(--line); }
.mental-note strong { color: var(--text-soft); font-size: .82rem; font-weight: 500; }
.mental-note p { margin-top: .3rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.mental-history { border-top: 1px solid var(--line); }
.mental-history-entry { border-bottom: 1px solid var(--line); }
.mental-history-entry summary {
    display: flex; justify-content: space-between; gap: 1rem;
    padding: .85rem .1rem; cursor: pointer; color: var(--text-soft);
}
.mental-history-entry summary:focus-visible {
    outline: 2px solid var(--gold); outline-offset: 2px;
}
.mental-history-entry[open] summary { color: var(--gold); }
.mental-history-entry .mental-responses { margin-top: .25rem; }

/* ── Badges & chips ───────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .22rem .65rem; border-radius: 100px;
    font-size: .72rem; letter-spacing: .05em;
    border: 1px solid var(--line-strong); color: var(--muted);
}
.badge.gold   { border-color: var(--gold-edge); color: var(--gold); background: var(--gold-glow); }
.badge.pos    { border-color: var(--pos-edge); color: var(--positive); }
.badge.neg    { border-color: var(--neg-edge); color: var(--negative); }
.badge.neu    { border-color: var(--line-strong); color: var(--muted); }

/* ── Stats ────────────────────────────────────────────────── */
.stat {
    background: var(--surface-1);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 1rem 1.15rem;
}
.stat-num { font-size: 1.9rem; font-weight: 300; color: var(--gold); line-height: 1.15; }
.stat-label { font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-dim); margin-top: .2rem; }

/* ── Guide (the hero card) ────────────────────────────────── */
.guide {
    position: relative; overflow: hidden;
    background:
        radial-gradient(ellipse 70% 100% at 50% 0%, var(--gold-glow) 0%, transparent 70%),
        var(--surface-2);
    border: 1px solid var(--gold-edge-faint);
    border-radius: var(--radius);
    padding: 2.2rem 2.4rem;
}
.guide-date {
    display: flex; align-items: center; gap: .8rem;
    margin-bottom: 1.4rem; flex-wrap: wrap;
}
.guide-section + .guide-section { margin-top: 1.75rem; }
.guide-section .small-caps { display: block; margin-bottom: .45rem; }
.guide-insight { font-size: 1.08rem; color: var(--text-soft); line-height: 1.8; max-width: 68ch; }
.guide-practice { font-size: .98rem; color: var(--muted); line-height: 1.8; max-width: 68ch; }
.guide-question {
    font-size: 1.15rem; font-style: italic; color: var(--gold);
    line-height: 1.65; max-width: 56ch;
    border-left: 2px solid var(--gold-dim); padding-left: 1.25rem;
}
.guide-empty { text-align: center; padding: 2.5rem 1rem; }
.guide-empty p { max-width: 46ch; margin: .6rem auto 1.4rem; }

/* ── Archetype cards ──────────────────────────────────────── */
.arch {
    background: var(--surface-1);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.35rem 1.5rem;
    display: flex; flex-direction: column; gap: .7rem;
    transition: var(--ease);
}
.arch:hover { border-color: var(--gold-edge-faint); }
.arch.active { border-color: var(--gold-edge-strong); background: var(--gold-glow); }
.arch-glyph { font-size: 1.5rem; color: var(--gold); }
.arch-type { font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-dim); }
.arch-label { font-size: 1rem; color: var(--text); }
.arch-desc { font-size: .85rem; color: var(--muted); flex: 1; }
.meter { height: 3px; background: var(--line); border-radius: 100px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--gold); border-radius: 100px; transition: width .6s var(--ease); }
.meter-label { font-size: .72rem; color: var(--muted-dim); }

/* ── Astrology ────────────────────────────────────────────── */
.planet-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .85rem; }
.planet {
    background: var(--well); border: 1px solid var(--line);
    border-radius: var(--radius-sm); padding: .8rem .9rem;
}
.planet-top { display: flex; align-items: center; gap: .5rem; margin-bottom: .25rem; }
.planet-glyph { color: var(--gold); font-size: 1.05rem; }
.planet-name { font-size: .8rem; color: var(--muted); }
.planet-sign { font-size: .95rem; color: var(--text); }
/* Astrological glyphs are not in Inter/Segoe UI; without a symbol fallback
   they render as tofu boxes. */
.planet-glyph, .planet-sign, .hour .g, .entry-glyph, .nav .ico {
    font-family: 'Segoe UI Symbol', 'Apple Symbols', 'Noto Sans Symbols 2', 'DejaVu Sans', sans-serif;
}
.planet-degree { font-size: .74rem; color: var(--muted-dim); }

/* ── Info icon: a term explained on hover or focus ─────────── */
.info { position: relative; display: inline-flex; vertical-align: middle; margin-left: .3rem; }
.info-btn {
    width: 14px; height: 14px; padding: 0; border-radius: 50%;
    border: 1px solid var(--line-strong); background: none;
    color: var(--muted-dim); font-size: 9px; font-style: italic; line-height: 1;
    font-family: Georgia, serif; cursor: help;
    display: inline-flex; align-items: center; justify-content: center;
    transition: color .15s, border-color .15s;
}
.info-btn:hover, .info-btn:focus-visible {
    color: var(--gold); border-color: var(--gold-edge); outline: none;
}
/* The panel opens to the right of the icon, level with it, so it never covers
   the term it explains. */
.info-panel {
    position: absolute; z-index: 40;
    left: calc(100% + 7px); top: 50%;
    transform: translateY(-50%) translateX(-3px);
    width: max-content; max-width: min(240px, 60vw);
    padding: .5rem .65rem; border-radius: var(--radius-sm);
    background: var(--well); border: 1px solid var(--line-strong);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
    color: var(--text-soft); font-size: .74rem; line-height: 1.5;
    text-align: left; white-space: normal;
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity .15s, transform .15s, visibility .15s;
}
.info:hover .info-panel,
.info:focus-within .info-panel {
    opacity: 1; visibility: visible; transform: translateY(-50%) translateX(0);
}
/* On a narrow screen the panel opens below the icon instead of beside it, so
   it cannot run past the right edge of the viewport. */
@media (max-width: 620px) {
    .info-panel {
        left: 0; right: auto; top: calc(100% + 7px);
        transform: translateY(-3px);
        max-width: min(240px, calc(100vw - 4rem));
    }
    .info:hover .info-panel,
    .info:focus-within .info-panel { transform: translateY(0); }
}
.planet-principle { font-size: .74rem; color: var(--muted-dim); margin-top: .35rem; line-height: 1.5; }
.planet-explainer { font-size: .78rem; color: var(--muted); margin-top: .45rem; line-height: 1.55; }
.astro-today .planet p { font-size: .88rem; color: var(--text-soft); margin-top: .45rem; line-height: 1.6; }
.astro-reading .planet p { font-size: .86rem; color: var(--text-soft); margin-top: .4rem; line-height: 1.6; }
.astro-holistic { margin-bottom: 1rem; }

/* ── AI reading block ─────────────────────────────────────── */
/* The generate button sits directly above the panel it fills, and the
   regenerate button sits inside that panel, so the action that replaces a
   text is next to the text. The panel is tinted so generated prose reads as
   its own layer against the chart data around it. */
.ai-reading { display: flex; flex-direction: column; gap: .7rem; }
.ai-reading-cta { display: flex; }
.ai-reading-panel {
    background: var(--ai-surface);
    border: 1px solid var(--ai-edge);
    border-radius: var(--radius-sm);
    padding: 1.1rem 1.25rem;
}
.ai-reading-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: .75rem; flex-wrap: wrap; margin-bottom: .7rem;
}
.ai-reading-label { color: var(--gold); }
.ai-reading-tools { display: inline-flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.ai-reading-body .empty { padding: 1rem .5rem; text-align: left; }
/* A short answer sits above the detailed sections, set apart so it can be
   read on its own without working through the whole interpretation. */
.reading-summary {
    border-left: 2px solid var(--gold);
    background: var(--gold-glow);
    border-radius: var(--radius-sm);
    padding: .75rem 1rem;
    margin-bottom: 1rem;
}
.reading-summary-label {
    color: var(--gold);
    font-size: .74rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    margin-bottom: .35rem;
}
.reading-summary .md-prose { font-size: .92rem; line-height: 1.65; color: var(--text); }
/* The panel already carries the tint, so the reading's own blocks sit on it
   rather than stacking a second well inside the first. */
.ai-reading-body .planet { background: transparent; border-color: var(--line); }
@media (max-width: 620px) {
    .ai-reading-panel { padding: .9rem 1rem; }
}
.astro-quote-text { color: var(--text-soft); font-family: Georgia, serif; font-size: 1.18rem; line-height: 1.7; text-align: center; padding: .75rem 1rem; }

/* The closing poem of a chart reading: set apart from the prose, centred,
   with the line breaks the model wrote preserved. */
.chart-poem {
    margin: 1.5rem 0 0; padding: 1.5rem 1rem 1.25rem;
    border-top: 1px solid var(--line);
    text-align: center;
}
.chart-poem blockquote {
    margin: 0; white-space: pre-line;
    color: var(--text-soft); font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.02rem; font-style: italic; line-height: 1.95;
    letter-spacing: .01em;
}

.moon-phase { display: flex; align-items: center; gap: 1rem; }
.moon-disc {
    width: 54px; height: 54px; border-radius: 50%; flex: 0 0 auto;
    background: var(--stone-3);
    box-shadow: inset 0 0 0 1px var(--line-strong);
    position: relative; overflow: hidden;
}
.moon-disc::after {
    content: ''; position: absolute; inset: 0; border-radius: 50%;
    background: var(--moon-lit); opacity: var(--illum, .5);
    transform: translateX(var(--shift, 0));
}

.hours { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .75rem; }.hour {
    width: 34px; padding: .3rem 0; text-align: center;
    border: 1px solid var(--line); border-radius: 7px;
    font-size: .68rem; color: var(--muted-dim);
}
.hour.current { border-color: var(--gold); color: var(--gold); background: var(--gold-glow); }
.hour .g { display: block; font-size: .85rem; color: inherit; }

/* ── Chart wheel ──────────────────────────────────────────── */
.chart-wheel-wrap {
    display: flex; justify-content: center;
    padding: .5rem 0 0;
}
.chart-wheel-wrap svg { width: 100%; max-width: 560px; height: auto; }

.chart-wheel { overflow: visible; }
.chart-wheel text {
    font-family: 'Segoe UI Symbol', 'Apple Symbols', 'Noto Sans Symbols 2', 'DejaVu Sans', sans-serif;
}
.wheel-halo { pointer-events: none; }

.wheel-sign-wedge { stroke: none; }
.wheel-sign-wedge.fire  { fill: rgba(224, 120, 122, .10); }
.wheel-sign-wedge.earth { fill: rgba(180, 150, 100, .10); }
.wheel-sign-wedge.air   { fill: rgba(150, 175, 210, .10); }
.wheel-sign-wedge.water { fill: rgba(120, 160, 190, .12); }
/* On paper the same alpha reads much heavier, so the wedges are softened.
   Keyed on the mode rather than the palette, so every light palette gets the
   same correction without naming each one. */
:root[data-theme-mode="light"] .wheel-sign-wedge.fire  { fill: rgba(190, 90, 92, .07); }
:root[data-theme-mode="light"] .wheel-sign-wedge.earth { fill: rgba(150, 120, 70, .08); }
:root[data-theme-mode="light"] .wheel-sign-wedge.air   { fill: rgba(110, 140, 180, .08); }
:root[data-theme-mode="light"] .wheel-sign-wedge.water { fill: rgba(90, 130, 165, .09); }
:root[data-theme-mode="light"] .wheel-hub-disc { fill: rgba(0, 0, 0, .03); }
.wheel-sign-edge { stroke: var(--line-strong); stroke-width: .7; }
.wheel-spoke { stroke: var(--line-strong); stroke-width: .6; opacity: .7; }
.wheel-spoke.cardinal { stroke: var(--gold-edge-faint); stroke-width: .9; opacity: .9; }
.wheel-sign-glyph { fill: var(--gold); font-size: 15px; opacity: .85; }
.wheel-rim { stroke: var(--line-strong); stroke-width: 1; }
.wheel-tick { stroke: var(--line); stroke-width: .5; }
.wheel-tick.major { stroke: var(--line-strong); stroke-width: .9; }
.wheel-cusp { stroke: var(--line-strong); stroke-width: .6; opacity: .7; }
.wheel-cusp.angular { stroke: var(--gold-edge-soft); stroke-width: 1; opacity: 1; }
.wheel-house-number {
    fill: var(--muted-dim); font-size: 9px;
    font-family: 'Inter', var(--ui-font, system-ui), sans-serif;
}
.wheel-axis { stroke: var(--gold-edge); stroke-width: 1; stroke-dasharray: 3 4; }
.wheel-axis.mc { stroke: var(--gold-edge-soft); stroke-dasharray: 2 5; }
.wheel-angle-label {
    fill: var(--gold); font-size: 11px; letter-spacing: .06em;
    font-family: 'Inter', var(--ui-font, system-ui), sans-serif;
}

.wheel-body-glyph { fill: var(--text); font-size: 20px; }
.wheel-body.overlay .wheel-body-glyph { fill: var(--gold); }
.wheel-body.retrograde .wheel-body-glyph { opacity: .72; }
.wheel-body-degree {
    fill: var(--muted-dim); font-size: 8.5px;
    font-family: 'Inter', var(--ui-font, system-ui), sans-serif;
}
.wheel-body-dot { fill: var(--muted-dim); }
.wheel-body-dot.overlay { fill: var(--gold); }
.chart-wheel.compact .wheel-body-glyph { font-size: 17px; }
.chart-wheel.compact .wheel-body-degree { font-size: 8px; }
.chart-wheel.compact .wheel-sign-glyph { font-size: 12px; }

.wheel-aspect { stroke-width: .9; opacity: .55; }
.wheel-aspect.conjunction { stroke: var(--muted-dim); stroke-width: 1.4; }
.wheel-aspect.opposition  { stroke: var(--negative); }
.wheel-aspect.square      { stroke: var(--negative); opacity: .45; }
.wheel-aspect.trine       { stroke: var(--positive); opacity: .45; }
.wheel-aspect.sextile     { stroke: var(--positive); opacity: .3; }
.wheel-aspect.quincunx    { stroke: var(--gold-dim); opacity: .35; stroke-dasharray: 4 4; }
.wheel-aspect.semisextile { stroke: var(--gold-dim); opacity: .25; stroke-dasharray: 2 4; }
.wheel-aspect.exact { stroke-width: 1.6; opacity: .8; }

.wheel-cross-aspect { stroke-width: .8; opacity: .3; stroke-dasharray: 3 3; }
.wheel-cross-aspect.conjunction, .wheel-cross-aspect.opposition, .wheel-cross-aspect.square { stroke: var(--negative); }
.wheel-cross-aspect.trine, .wheel-cross-aspect.sextile { stroke: var(--positive); }
.wheel-cross-aspect.quincunx, .wheel-cross-aspect.semisextile { stroke: var(--gold-dim); }
.wheel-cross-aspect.exact { opacity: .6; stroke-width: 1.3; }
.wheel-cross-aspect.to-angle { stroke-dasharray: 1 3; opacity: .38; }

.wheel-hub-disc { fill: var(--well); stroke: none; }
.wheel-hub-mark { fill: none; stroke: var(--gold-edge-faint); stroke-width: 1; }
.wheel-hub-dot { fill: var(--gold); }
.wheel-hub-label {
    fill: var(--muted-dim); font-size: 9px; letter-spacing: .16em; text-transform: uppercase;
    font-family: 'Inter', var(--ui-font, system-ui), sans-serif;
}
.wheel-hub-note {
    fill: var(--muted-dim); font-size: 7.5px; opacity: .8;
    font-family: 'Inter', var(--ui-font, system-ui), sans-serif;
}

/* Legend under a wheel */
.wheel-legend {
    display: flex; flex-wrap: wrap; gap: .4rem 1rem;
    justify-content: center; margin-top: 1rem;
    font-size: .74rem; color: var(--muted-dim);
}
.wheel-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.wheel-legend i {
    display: inline-block; width: 14px; height: 2px; border-radius: 2px;
    background: currentColor;
}
.wheel-legend .easy  { color: var(--positive); }
.wheel-legend .hard  { color: var(--negative); }
.wheel-legend .minor { color: var(--gold-dim); }

/* ── Placement cards with per-planet insight ──────────────── */
.placement-card {
    display: flex; flex-direction: column; gap: .55rem;
    background: var(--well); border: 1px solid var(--line);
    border-radius: var(--radius-sm); padding: .9rem 1rem;
    transition: var(--ease);
}
.placement-card:hover { border-color: var(--line-strong); }
.placement-card.expanded { border-color: var(--gold-edge-soft); }
.placement-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .6rem; }
.placement-title { display: flex; align-items: center; gap: .5rem; }
.placement-meta { font-size: .74rem; color: var(--muted-dim); }
.placement-insight { margin-top: .5rem; display: flex; flex-direction: column; gap: .8rem; }
.placement-insight .planet-explainer + .planet-explainer { margin-top: 0; }
.placement-insight-item {
    border-left: 2px solid var(--gold-edge-faint);
    padding-left: .75rem;
}
.placement-insight-item .planet-name { color: var(--gold); font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; }
.placement-insight-item p {
    font-size: .86rem; color: var(--text-soft); line-height: 1.65; margin-top: .25rem;
}
.placement-insight-actions { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .3rem; }

/* Wide detail panel that opens below the placement grid */
.placement-detail-host:empty { display: none; }
.placement-detail-host { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.25rem; }
.placement-detail-panel {
    width: 100%;
    background: var(--ai-surface); border: 1px solid var(--ai-edge);
    border-radius: var(--radius-sm); padding: 1.25rem 1.5rem;
    animation: placement-open .28s var(--ease);
}
@keyframes placement-open { from { opacity: 0; transform: translateY(-6px); } }
.placement-detail-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap;
    padding-bottom: .9rem; margin-bottom: 1rem;
    border-bottom: 1px solid var(--line);
}
.placement-detail-panel .placement-insight {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem 2rem; margin-top: 0;
}
.placement-detail-panel .placement-insight-item { padding-left: 1rem; }
.placement-detail-panel .placement-insight-item p,
.placement-detail-panel .placement-insight-item div { max-width: 78ch; }
@media (max-width: 620px) {
    .placement-detail-panel { padding: 1rem 1.1rem; }
    .placement-detail-panel .placement-insight { grid-template-columns: minmax(0, 1fr); }
}

/* ── Lunar node axis ──────────────────────────────────────── */
/* The two nodes are drawn as one object with a bridge between them: they are
   a single axis, and separating them into two cards would lose the movement
   from habit to direction that the section is about. */
.node-axis {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 1rem; align-items: stretch;
    margin-top: 1rem;
}
.node-side {
    background: var(--well); border: 1px solid var(--line);
    border-radius: var(--radius-sm); padding: 1rem 1.15rem;
}
.node-side.south { border-left: 2px solid var(--muted-dim); }
.node-side.north { border-left: 2px solid var(--gold-edge); }
.node-side-head { display: flex; align-items: center; gap: .6rem; }
.node-glyph {
    font-size: 1.5rem; line-height: 1; color: var(--gold);
    font-family: 'Segoe UI Symbol', 'Apple Symbols', 'Noto Sans Symbols 2', 'DejaVu Sans', sans-serif;
}
.node-side.south .node-glyph { color: var(--muted-dim); }
.node-meta { font-size: .74rem; color: var(--muted-dim); margin-top: .5rem; }
.node-axis-bridge {
    display: flex; align-items: center; justify-content: center;
    color: var(--gold-dim); font-size: 1.1rem;
}
.node-ruler {
    font-size: .8rem; color: var(--muted); line-height: 1.65;
    margin-top: .9rem; padding-left: .75rem;
    border-left: 2px solid var(--gold-edge-faint);
}
.node-aspects { margin-top: 1.25rem; }
.node-aspects .small-caps { margin-bottom: .5rem; }
@media (max-width: 620px) {
    .node-axis { grid-template-columns: minmax(0, 1fr); }
    .node-axis-bridge { transform: rotate(90deg); padding: .15rem 0; }
}

/* Aspect list */
.aspect-list { display: flex; flex-direction: column; gap: .45rem; }
.aspect-row {
    display: grid; grid-template-columns: 1fr auto 1fr auto;
    gap: .5rem; align-items: center;
    font-size: .82rem; padding: .35rem 0;
    border-bottom: 1px solid var(--line);
}
.aspect-row:last-child { border-bottom: none; }
.aspect-row .aspect-end { color: var(--text); }
.aspect-row .aspect-end.end-b { text-align: right; }
.aspect-row .aspect-glyph {
    color: var(--gold); font-size: .95rem;
    font-family: 'Segoe UI Symbol', 'Apple Symbols', 'Noto Sans Symbols 2', 'DejaVu Sans', sans-serif;
}
.aspect-row.hard .aspect-glyph { color: var(--negative); }
.aspect-row.easy .aspect-glyph { color: var(--positive); }
.aspect-row .aspect-orb { font-size: .72rem; color: var(--muted-dim); text-align: right; }
.aspect-row.exact .aspect-orb { color: var(--gold); }

/* Two-chart panel */
.synastry-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.25rem; align-items: start;
}
@media (max-width: 780px) { .synastry-grid { grid-template-columns: 1fr; } }
.synastry-wheels { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
@media (max-width: 620px) { .synastry-wheels { grid-template-columns: 1fr; } }
.synastry-wheel-label {
    text-align: center; font-size: .72rem; letter-spacing: .12em;
    text-transform: uppercase; color: var(--muted-dim); margin-bottom: .35rem;
}
.synastry-wheel-label.gold { color: var(--gold); }
.chart-tabs { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: 1rem; }
.chart-tab {
    padding: .4rem .85rem; font-size: .78rem; border-radius: 100px;
    border: 1px solid var(--line); background: transparent;
    color: var(--muted); cursor: pointer; transition: var(--ease);
    font-family: inherit;
}
.chart-tab:hover { border-color: var(--line-strong); color: var(--text); }
.chart-tab.active { border-color: var(--gold-edge); color: var(--gold); background: var(--gold-glow); }

.tally { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .75rem; }
.tally-chip {
    display: inline-flex; align-items: center; gap: .3rem;
    font-size: .72rem; color: var(--muted-dim);
    border: 1px solid var(--line); border-radius: 100px; padding: .18rem .55rem;
}
.tally-chip strong { color: var(--text); font-weight: 500; }

.cross-aspect-summary {
    font-size: .8rem; color: var(--muted); line-height: 1.65;
    margin-top: .75rem;
}
/* ── Lists (diary, activity) ──────────────────────────────── */
.entry {
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    padding: 1rem 1.15rem; background: var(--surface-edge);
    transition: var(--ease);
}
.entry + .entry { margin-top: .7rem; }
.entry:hover { border-color: var(--line-strong); }
.entry-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: .75rem; flex-wrap: wrap; margin-bottom: .5rem;
}
.entry-title { font-size: .96rem; color: var(--text); }
.entry-date { font-size: .78rem; color: var(--muted-dim); }
.entry-body {
    font-size: .89rem; color: var(--muted); line-height: 1.75;
    white-space: pre-wrap; word-break: break-word;
}
.entry.clamped .entry-body {
    display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
    overflow: hidden;
}
.entry-actions { display: flex; gap: .3rem; }

.empty {
    text-align: center; padding: 2rem 1rem;
    color: var(--muted-dim); font-size: .9rem;
}

/* ── Valence bars ─────────────────────────────────────────── */
.bars { display: flex; flex-direction: column; gap: .55rem; }
.bar-row { display: grid; grid-template-columns: 92px 1fr 34px; gap: .75rem; align-items: center; font-size: .82rem; }
.bar-track { height: 5px; background: var(--line); border-radius: 100px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 100px; transition: width .6s var(--ease); }
.bar-fill.pos { background: var(--positive); }
.bar-fill.neu { background: var(--neutral-col); }
.bar-fill.neg { background: var(--negative); }
.bar-count { text-align: right; color: var(--muted-dim); }

/* ── Reflection output ────────────────────────────────────── */
.chips { display: flex; gap: .45rem; flex-wrap: wrap; }
.prompt-list { list-style: none; display: flex; flex-direction: column; gap: .7rem; }
.prompt-list li {
    padding-left: 1.4rem; position: relative;
    font-size: .92rem; color: var(--muted); line-height: 1.7;
}
.prompt-list li::before { content: '—'; position: absolute; left: 0; color: var(--gold-dim); }

/* ── Auth gate ────────────────────────────────────────────── */
.gate {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 2rem 1.5rem; position: relative; z-index: 1;
}
.gate-inner { width: 100%; max-width: 440px; }
.gate-brand { text-align: center; margin-bottom: 2rem; }
.gate-brand .brand-mark { margin: 0 auto .9rem; width: 52px; height: 52px; }
.gate-brand .brand-mark::before { inset: 10px; }
.gate-brand .brand-mark::after  { inset: 19px; }
.gate h1 { font-size: 1.7rem; }
.gate p  { font-size: .92rem; margin-top: .5rem; }
.gate-tabs { display: flex; gap: .4rem; margin-bottom: 1.5rem; }
.gate-tabs button {
    flex: 1; padding: .6rem; border-radius: var(--radius-sm);
    background: transparent; border: 1px solid var(--line-strong);
    color: var(--muted); font-family: inherit; font-size: .88rem; cursor: pointer;
    transition: var(--ease);
}
.gate-tabs button.active { background: var(--gold-glow); border-color: var(--gold-edge); color: var(--gold); }
.gate-foot { text-align: center; margin-top: 1.5rem; font-size: .78rem; color: var(--muted-dim); }
.alpha-seats { text-align: center; font-size: .78rem; color: var(--muted-dim); margin-top: 1.25rem; }

/* ── Toast ────────────────────────────────────────────────── */
#toast-host {
    position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 500;
    display: flex; flex-direction: column; gap: .6rem; max-width: 380px;
}
.toast {
    background: var(--stone-2); border: 1px solid var(--line-strong);
    border-left: 2px solid var(--gold);
    border-radius: var(--radius-sm); padding: .8rem 1.1rem;
    font-size: .88rem; color: var(--text); box-shadow: var(--shadow);
    animation: slide-in .3s var(--ease);
}
.toast.error { border-left-color: var(--negative); }
.toast.ok    { border-left-color: var(--positive); }
@keyframes slide-in { from { opacity: 0; transform: translateX(24px); } }

/* ── Loading ──────────────────────────────────────────────── */
.boot {
    min-height: 100vh; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 1.2rem;
    position: relative; z-index: 1;
}
.boot .spin { font-size: 1.6rem; color: var(--gold); }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
    /* The shell is a single column here, so the bar and the page are two grid
       rows. A grid item stretches to its row by default, and an auto row grows
       when the shell is taller than its content. On a phone that is always the
       case: 100vh is the large viewport (URL bar hidden), so the shell is
       taller than the visible screen and the leftover space was handed to the
       bar's row — the header rendered about twice its height, most visibly on
       the chat view, whose own height is measured in dvh and therefore leaves
       the most slack. Naming the rows keeps the bar at its content height and
       gives the page everything else, and sizing the shell in dvh removes the
       slack in the first place. */
    .shell {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        min-height: 100vh;
        min-height: 100dvh;
    }
    .sidebar {
        position: sticky; top: 0; z-index: 80; height: auto; flex-direction: column;
        align-items: stretch; gap: .8rem; overflow: visible;
        border-right: none; border-bottom: 1px solid var(--line);
        padding: .7rem 1rem; min-width: 0;
    }
    .brand { flex: 0 0 auto; }
    .mobile-menu-toggle {
        display: inline-flex; align-items: center; justify-content: center;
        margin-left: auto; width: 42px; height: 42px;
        color: var(--text); background: var(--surface-3);
        border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
        font-size: 1.25rem; cursor: pointer;
    }
    .mobile-navigation { display: none; }
    .mobile-navigation.open { display: grid; gap: .8rem; }
    /* The sections stack; the items inside one are still two columns, which
       keeps the folding menu short on a phone. */
    .nav { display: flex; flex-direction: column; gap: .45rem; min-width: 0; }
    .nav-group { gap: .25rem; }
    .nav-group-head { padding-left: .65rem; padding-right: .65rem; }
    .nav-group-items { display: none; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .25rem; }
    .nav-group.open .nav-group-items { display: grid; }
    .nav button[data-view] { min-width: 0; white-space: normal; padding: .58rem .65rem; }
    .nav .lbl { display: inline; }
    /* The chat header is a label, not a page title: on a phone every pixel it
       takes is a line of conversation lost. The eyebrow goes, the title stays
       on one line, and the page padding above it shrinks. */
    .main.main-chat { padding-top: .55rem; padding-bottom: .6rem; }
    .chat-page-head { margin-bottom: .5rem; align-items: center; gap: .5rem; flex-wrap: nowrap; }
    .chat-page-head .small-caps { display: none; }
    /* A zero basis keeps the long title from claiming its full width and
       pushing the opener onto a second line. */
    .chat-page-head > div:first-child { flex: 1 1 0; min-width: 0; }
    .chat-page-head .chat-history-toggle { flex: 0 0 auto; }
    .chat-page-head h1 {
        font-size: 1.02rem; line-height: 1.3;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }

    /* Stacked layout: the page scrolls again, so the transcript gets a fixed
       height instead of the viewport-derived one. */
    .chat-view { height: auto; min-height: 0; }
    .chat-layout { grid-template-columns: minmax(0, 1fr); }
    .chat-card { height: auto; min-height: 0; }
    .chat-scroll { flex: none; }
    .chat-messages { height: 58vh; min-height: 320px; }

    /* The conversation fills what is left of the screen instead of growing
       past it: the transcript scrolls inside the card and the composer stays
       where the thumb already is. --chat-chrome is the height of everything
       above and below the view (the sticky bar, the page head, the page
       padding), measured in js/chat.js because the bar changes height when
       the menu opens. */
    .chat-view {
        height: calc(100vh - var(--chat-chrome, 13.5rem));
        height: calc(100dvh - var(--chat-chrome, 13.5rem));
        min-height: 22rem;
    }
    .chat-layout { flex: 1; min-height: 0; }
    .chat-card { height: 100%; min-height: 0; }
    .chat-scroll { flex: 1; min-height: 0; }
    .chat-messages { height: auto; min-height: 0; flex: 1; }

    /* The context panel can be taller than the phone. Capping it keeps the
       transcript readable while the panel is open, and the panel scrolls
       inside itself instead of pushing the conversation out of the card. */
    .chat-toolbar { max-height: 45%; overflow-y: auto; overscroll-behavior: contain; }
    .chat-toolbar::-webkit-scrollbar { width: 6px; }
    .chat-toolbar::-webkit-scrollbar-thumb {
        background: var(--line-strong); border-radius: 100px;
        border: 2px solid transparent; background-clip: content-box;
    }

    /* The history becomes a drawer over the transcript instead of a block
       below it: on a phone the column pushed the composer off the screen and
       the conversation had to be scrolled past the whole list to be read. */
    .chat-history-toggle { display: inline-flex; }
    .chat-side {
        position: fixed; z-index: 120;
        top: 0; bottom: 0; left: 0;
        width: min(84vw, 320px);
        padding: 1rem 1rem 1.5rem;
        gap: .8rem;
        background: var(--stone-2);
        border-right: 1px solid var(--line-strong);
        box-shadow: var(--shadow);
        overflow-y: auto;
        transform: translateX(-102%);
        visibility: hidden;
        transition: transform .28s cubic-bezier(.25, .8, .25, 1), visibility .28s;
    }
    .chat-side.open { transform: none; visibility: visible; }
    .chat-side-head-mobile {
        display: flex; align-items: center; gap: .5rem;
        padding-bottom: .2rem;
    }
    .chat-side-head-mobile h2 {
        flex: 1; min-width: 0;
        font-size: .72rem; font-weight: 500; letter-spacing: .12em;
        text-transform: uppercase; color: var(--muted-dim);
    }
    /* The drawer's own header already names the list, so the block's header
       would repeat it. */
    .chat-side-head-mobile + .chat-side-block .chat-side-head { display: none; }
    /* The drawer scrolls as a whole, so the inner lists must not cap their
       own height and trap the scroll inside a panel that already scrolls. */
    .chat-history-list, .chat-favorites-list { max-height: none; overflow: visible; }
    .chat-side-block { padding: .8rem; }

    /* Dim the conversation behind the drawer. The panel is fixed, so this
       pseudo-element on the view is enough and no extra node is needed. */
    .chat-view::after {
        content: ''; position: fixed; inset: 0; z-index: 110;
        background: var(--scrim);
        opacity: 0; visibility: hidden; pointer-events: none;
        transition: opacity .28s var(--ease), visibility .28s;
    }
    .chat-drawer-open .chat-view::after {
        opacity: 1; visibility: visible; pointer-events: auto;
    }
    /* The drawer is fixed, so the page behind it must not scroll with it. */
    body.chat-drawer-open { overflow: hidden; }
    .mobile-sidebar-foot { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .6rem .25rem 0; border-top: 1px solid var(--line); }
    .mobile-sidebar-foot .btn { width: auto; }
    .sidebar-foot { display: none; }
    .main { padding: 1.5rem 1.15rem 3rem; min-width: 0; }
    .search-panel { padding: 1rem 1rem 1.15rem; }
    .search-bar { padding-left: .8rem; }
    .search-submit { padding: .55rem 1.1rem; }
    .guide { padding: 1.6rem 1.4rem; }
    /* Drop the 320px floor: on a narrow screen it is wider than the viewport,
       and a grid item's min-content (a nowrap line, say) would push the track
       past the edge instead of letting the text ellipsise. */
    .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
    .card { min-width: 0; }
}

@media (max-width: 560px) {
    .user-meta { display: none; }
    .chat-toolbar, .composer { padding-left: .8rem; padding-right: .8rem; }
    /* The composer is the tallest fixed block on the screen; trimming its
       padding and the textarea's floor gives the transcript two more lines. */
    .composer { padding-top: .55rem; padding-bottom: .6rem; }
    .composer-box { padding: .35rem .45rem .3rem; }
    .composer textarea { min-height: 34px; font-size: .9rem; }
    .composer-foot { gap: .45rem; }
    .composer-hint { display: none; }
    /* Without the hint there is no flex spacer, so the counter takes its place. */
    .composer-count { margin-left: auto; }
    .chat-page-head h1 { white-space: nowrap; }
    /* The opener keeps its glyph and count; the word would crowd the title. */
    .chat-history-toggle-label { display: none; }
    .chat-history-toggle { padding: .4rem .6rem; }
    /* The pill cannot hold icon, input, clear and a labelled button on a
       phone; the submit drops to its own full-width row. */
    .search-bar { flex-wrap: wrap; border-radius: var(--radius); padding: .55rem .7rem; }
    .search-bar input[type="search"] { font-size: .95rem; }
    .search-submit { width: 100%; margin-top: .15rem; }
    .search-result { padding: .7rem .75rem; gap: .65rem; }
    .search-result-icon { width: 26px; height: 26px; }
    .mobile-sidebar-foot .lang-toggle button { padding: 0 .45rem; font-size: .74rem; }
    #toast-host { left: 1rem; right: 1rem; bottom: 1rem; max-width: none; }
}

/* ── Theme swatches ───────────────────────────────────────── */
/* One circle per palette. The circle is the palette's own background with its
   accent as a ring, so the choice is made by looking rather than by reading a
   label. The name is still there for a screen reader and as a tooltip. */
.theme-toggle {
    display: flex; flex-wrap: wrap; gap: .4rem; align-items: center;
}
.theme-swatch {
    position: relative;
    width: 26px; height: 26px; padding: 0;
    border-radius: 50%; cursor: pointer;
    border: 1px solid var(--line-strong);
    background: var(--swatch-bg, var(--surface-2));
    box-shadow: inset 0 0 0 3px var(--swatch-accent, transparent);
    transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease);
}
.theme-swatch:hover { transform: scale(1.1); border-color: var(--gold-edge); }
.theme-swatch:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.theme-swatch.active {
    border-color: var(--gold);
    box-shadow: inset 0 0 0 3px var(--swatch-accent, transparent), 0 0 0 2px var(--gold-glow);
}
/* A tick inside the active swatch, so the choice is legible without relying on
   the ring alone — which is hard to see on a pale palette. */
.theme-swatch.active::after {
    content: '';
    position: absolute; inset: 0; margin: auto;
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--swatch-accent, var(--gold));
}

/* The palette each swatch stands for. These are literal colours, not tokens:
   a swatch must show the palette it selects, not the palette in use. The
   gradient is the palette's own page ground, top to bottom. */
.theme-swatch[data-theme-option="dark"]   { --swatch-bg: linear-gradient(to bottom, #000000, #0b0a0c); --swatch-accent: #c9a96c; }
.theme-swatch[data-theme-option="light"]  { --swatch-bg: linear-gradient(to bottom, #ffffff, #f7f5f1); --swatch-accent: #8a6a2f; }
.theme-swatch[data-theme-option="white"]  { --swatch-bg: linear-gradient(to bottom, #ffffff, #f2f3f5); --swatch-accent: #3f4650; }
.theme-swatch[data-theme-option="purple"] { --swatch-bg: linear-gradient(to bottom, #000000, #100c18); --swatch-accent: #b9a3f0; }
.theme-swatch[data-theme-option="forest"] { --swatch-bg: linear-gradient(to bottom, #000000, #0a1210); --swatch-accent: #8fc9a4; }
.theme-swatch[data-theme-option="rose"]   { --swatch-bg: linear-gradient(to bottom, #000000, #150e10); --swatch-accent: #e8a8b4; }

/* In the sidebar the swatches sit under the user chip, where a row of six
   fits; on a phone the row wraps rather than shrinking below a usable size. */
.sidebar-foot .theme-toggle { margin: .5rem 0 .35rem; }
.mobile-sidebar-foot .theme-toggle { margin: .5rem 0; }

/* ── Admin settings switches ──────────────────────────────── */
/* One row per installation-wide switch: the label on the left, the switch on
   the right, so the list reads as a set of answers rather than a form. */
.admin-setting {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 1rem; padding: .7rem 0;
    border-bottom: 1px solid var(--line);
}
.admin-setting:last-child { border-bottom: none; padding-bottom: 0; }
.admin-setting-text { display: flex; flex-direction: column; gap: .2rem; }
.admin-setting-text strong { font-size: .9rem; font-weight: 500; }
.admin-setting-text .hint { font-size: .78rem; line-height: 1.5; }

.admin-switch {
    display: inline-flex; align-items: center; gap: .5rem;
    flex: none; padding: .2rem .1rem; border: none; background: transparent;
    font: inherit; font-size: .76rem; color: var(--muted-dim);
    cursor: pointer; transition: var(--ease);
}
.admin-switch:hover { color: var(--text); }
.admin-switch:disabled { opacity: .55; cursor: progress; }
.admin-switch:focus-visible { outline: 2px solid var(--gold-edge); outline-offset: 2px; border-radius: var(--radius-sm); }
.admin-switch-track {
    position: relative; display: block; width: 34px; height: 18px;
    border: 1px solid var(--line-strong); border-radius: 100px;
    background: var(--surface-1); transition: var(--ease);
}
.admin-switch-knob {
    position: absolute; top: 2px; left: 2px; width: 12px; height: 12px;
    border-radius: 50%; background: var(--muted-dim); transition: var(--ease);
}
.admin-switch.on { color: var(--gold); }
.admin-switch.on .admin-switch-track { border-color: var(--gold-edge); background: var(--gold-glow); }
.admin-switch.on .admin-switch-knob { left: 18px; background: var(--gold); }

/* A setting with two named answers: both stay visible, the active one is
   marked, so the choice reads as a decision rather than a toggle. */
.admin-choice {
    display: flex; flex: none; gap: .2rem; padding: .22rem;
    border: 1px solid var(--line); border-radius: 100px;
    background: var(--surface-1);
}
.admin-choice-option {
    padding: .28rem .7rem; border: none; border-radius: 100px;
    background: transparent; color: var(--muted-dim);
    font: inherit; font-size: .76rem; cursor: pointer;
    white-space: nowrap; transition: var(--ease);
}
.admin-choice-option:hover { color: var(--text); }
.admin-choice-option.active { background: var(--gold-glow); color: var(--gold); }
.admin-choice-option:disabled { opacity: .55; cursor: progress; }
.admin-choice-option:focus-visible { outline: 2px solid var(--gold-edge); outline-offset: 1px; }

/* ── Language toggle ──────────────────────────────────────── */
/* Same shape as the theme toggle so the two read as one control group. */
.lang-toggle {
    display: flex; gap: .2rem; padding: .22rem;
    border: 1px solid var(--line); border-radius: 100px;
    background: var(--surface-1);
}
.lang-toggle button {
    flex: 1; height: 26px; padding: 0 .55rem; border: none; border-radius: 100px;
    background: transparent; color: var(--muted-dim);
    font-size: .78rem; font-family: inherit; cursor: pointer;
    white-space: nowrap; transition: var(--ease);
}
.lang-toggle button:hover { color: var(--text); }
.lang-toggle button.active { background: var(--gold-glow); color: var(--gold); }
.lang-toggle button:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

/* The gate stacks the seat line and the switcher on one row. */
.gate-foot-row {
    display: flex; align-items: center; justify-content: center;
    gap: 1rem; flex-wrap: wrap; margin-top: 1.25rem;
}
.gate-foot-row .alpha-seats { margin: 0; }
.gate-foot-row .lang-toggle { background: transparent; }

/* ── Light-mode refinements ───────────────────────────────── */
:root[data-theme-mode="light"] .moon-disc {
    box-shadow: inset 0 0 0 1px var(--line-strong);
}

:root[data-theme-mode="light"] input::-webkit-calendar-picker-indicator {
    filter: invert(.45);
    cursor: pointer;
}

:root[data-theme-mode="light"] ::-webkit-scrollbar { width: 10px; height: 10px; }
:root[data-theme-mode="light"] ::-webkit-scrollbar-track { background: transparent; }
:root[data-theme-mode="light"] ::-webkit-scrollbar-thumb {
    background: var(--line-strong); border-radius: 100px;
}
/* ═══════════════════════════════════════════════════════════
   Depth work — the four-stage "Red Book" surface
   ═══════════════════════════════════════════════════════════ */

.entry-glyph { color: var(--gold); }

/* ── Today callout ────────────────────────────────────────── */
.depth-callout {
    border-color: var(--gold-edge-faint);
    background:
        radial-gradient(ellipse 60% 100% at 92% 0%, var(--gold-glow) 0%, transparent 65%),
        var(--surface-1);
}
.depth-threshold {
    font-size: 1.02rem; font-style: italic; color: var(--gold);
    line-height: 1.7; max-width: 58ch;
    border-left: 2px solid var(--gold-dim); padding-left: 1.15rem;
    margin: .35rem 0 .9rem;
}
.depth-threshold-large { font-size: 1.3rem; margin: 1.5rem 0; }

/* ── Layout: editor + ledger ──────────────────────────────── */
.depth-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 1.5rem;
    align-items: start;
}
.depth-aside { position: sticky; top: 1.5rem; }
.depth-sheet { padding: 1.85rem 2rem; }

.save-state {
    font-size: .74rem; letter-spacing: .06em; text-transform: uppercase;
    color: var(--muted-dim); transition: color var(--ease);
}
.save-state-saving { color: var(--muted); }
.save-state-unsaved { color: var(--gold-dim); }
.save-state-saved   { color: var(--positive); }
.save-state-failed  { color: var(--negative); }

/* ── The stages ───────────────────────────────────────────── */
.depth-stages { list-style: none; display: flex; flex-direction: column; gap: .6rem; margin: 1.5rem 0 0; }

.depth-stage {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-edge);
    transition: border-color var(--ease), background var(--ease);
    overflow: hidden;
}
.depth-stage.active { border-color: var(--gold-edge); background: var(--gold-glow); }
.depth-stage.written:not(.active) { border-color: var(--line-strong); }
.depth-stage.locked { opacity: .55; }
.depth-stage.locked .depth-stage-head { cursor: not-allowed; }

.depth-stage-head {
    display: flex; align-items: center; gap: .85rem;
    width: 100%; padding: .95rem 1.1rem;
    background: transparent; border: none; cursor: pointer;
    font-family: inherit; color: var(--text); text-align: left;
    transition: color var(--ease);
}
.depth-stage-head:hover:not(:disabled) { color: var(--gold); }
.depth-stage-head:disabled { cursor: not-allowed; }
.depth-stage-head:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }

.depth-stage-num {
    font-size: 1.35rem; font-weight: 300; line-height: 1;
    color: var(--gold-edge-strong); flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
}
.depth-stage.active .depth-stage-num { color: var(--gold); }
.depth-stage-name { flex: 1; font-size: .98rem; }
.depth-stage-state {
    font-size: .72rem; letter-spacing: .06em; text-transform: uppercase;
    color: var(--muted-dim); flex: 0 0 auto;
}
.depth-stage.written .depth-stage-state { color: var(--positive); }
.depth-stage.locked .depth-stage-state { color: var(--muted-dim); }

/* Collapsed by default; only the active stage shows its field. */
.depth-stage-body { display: none; padding: 0 1.1rem 1.1rem; }
.depth-stage.active .depth-stage-body { display: block; }
.depth-stage-hint {
    font-size: .82rem; color: var(--muted-dim); line-height: 1.6;
    max-width: 62ch; margin-bottom: .6rem;
}
.depth-stage textarea {
    min-height: 130px; background: var(--inset); border-color: var(--line);
    font-size: .95rem; line-height: 1.8;
}
.depth-stage textarea:focus { border-color: var(--gold-edge); }
.depth-stage textarea:disabled { opacity: .5; cursor: not-allowed; }

/* ── Felt sense ───────────────────────────────────────────── */
.felt-sense {
    margin-top: 1.85rem; padding-top: 1.6rem;
    border-top: 1px solid var(--line);
}
.felt-marks { display: flex; gap: .55rem; flex-wrap: wrap; }
.felt-mark {
    display: flex; flex-direction: column; align-items: center; gap: .2rem;
    min-width: 88px; padding: .7rem .85rem;
    background: var(--inset); border: 1px solid var(--line);
    border-radius: var(--radius-sm); cursor: pointer;
    font-family: inherit; color: var(--muted);
    transition: var(--ease);
}
.felt-mark:hover { border-color: var(--gold-edge-soft); color: var(--text); }
.felt-mark.active {
    border-color: var(--gold); color: var(--gold);
    background: var(--gold-glow);
}
.felt-mark:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.felt-symbol { font-size: 1.35rem; line-height: 1; }
.felt-label { font-size: .74rem; letter-spacing: .05em; text-transform: uppercase; }
.felt-note {
    margin-top: .9rem; font-size: .88rem; font-style: italic;
    color: var(--gold); border-left: 2px solid var(--gold-dim);
    padding-left: 1rem;
}
.depth-footer {
    display: flex; align-items: center; gap: 1rem;
    flex-wrap: wrap; margin-top: 1.6rem;
}

/* ── Ledger ───────────────────────────────────────────────── */
.ledger-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: .65rem; width: 100%; text-align: left;
    padding: .7rem .8rem; margin-bottom: .35rem;
    background: transparent; border: 1px solid transparent;
    border-radius: var(--radius-sm); cursor: pointer;
    font-family: inherit; color: var(--muted);
    transition: var(--ease);
}
.ledger-row:hover { background: var(--surface-4); color: var(--text); }
.ledger-row.active {
    background: var(--gold-glow); border-color: var(--gold-edge-soft); color: var(--text);
}
.ledger-main { display: flex; flex-direction: column; gap: .15rem; min-width: 0; flex: 1; }
.ledger-title {
    font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ledger-date { font-size: .72rem; color: var(--muted-dim); }
.ledger-state { display: flex; align-items: center; gap: .4rem; flex: 0 0 auto; }
.ledger-mark { font-size: 1rem; color: var(--gold); }

@media (max-width: 1000px) {
    .depth-layout { grid-template-columns: 1fr; }
    .depth-aside { position: static; }
    .depth-sheet { padding: 1.5rem 1.35rem; }
}
@media (max-width: 560px) {
    .felt-mark { flex: 1 1 calc(50% - .3rem); min-width: 0; }
    .depth-stage-num { font-size: 1.1rem; }
}
/* ── Numerology ───────────────────────────────────────────── */
.num-tiles {
    display: grid; gap: .85rem; margin-top: 1.25rem;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
.num-tile {
    background: var(--well); border: 1px solid var(--line);
    border-radius: var(--radius-sm); padding: .9rem 1rem;
}
.num-tile-label { font-size: .72rem; letter-spacing: .07em; text-transform: uppercase; color: var(--muted-dim); }
.num-tile-value {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 2rem; line-height: 1.15; color: var(--gold); margin-top: .3rem;
}
.num-tile-text { font-size: 1.05rem; color: var(--text); margin-top: .35rem; }
.num-tile-sub { font-size: .76rem; color: var(--muted); margin-top: .3rem; line-height: 1.5; }

.numerology-head { align-items: flex-start; }
.num-value { display: flex; flex-direction: column; align-items: flex-end; gap: .15rem; flex: 0 0 auto; }
.num-digits {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 2.4rem; line-height: 1; color: var(--gold);
}
.num-master {
    font-size: .64rem; letter-spacing: .1em; text-transform: uppercase;
    color: var(--gold-dim); border: 1px solid var(--gold-edge-faint);
    border-radius: 100px; padding: .1rem .45rem;
}
.num-breakdown {
    font-size: .8rem; color: var(--muted-dim);
    font-variant-numeric: tabular-nums; margin-top: .5rem;
}
.num-meaning { font-size: .9rem; color: var(--text-soft); margin-top: .5rem; line-height: 1.6; }

/* The reading block follows the last line of the card's own content, which
   carries no bottom margin of its own — without this the generate button sits
   flush against the text above it. */
.numerology-card .ai-reading { margin-top: 1.35rem; }

/* The seven centres: a bar per centre, with the emptiest and fullest marked.
   The bar is a proportion of the fullest centre, not of the whole name, so a
   short name still reads as a shape rather than as seven near-empty rows. */
.chakra-list { display: flex; flex-direction: column; gap: .4rem; margin-top: .85rem; }
.chakra-row { display: grid; grid-template-columns: 7.5rem 1fr 1.75rem; align-items: center; gap: .6rem; }
.chakra-name { font-size: .78rem; color: var(--muted); }
.chakra-bar { height: 5px; background: var(--line); border-radius: 100px; overflow: hidden; }
.chakra-bar span { display: block; height: 100%; background: var(--gold-dim); border-radius: 100px; transition: width .5s var(--ease); }
.chakra-count { font-size: .76rem; color: var(--muted-dim); text-align: right; font-variant-numeric: tabular-nums; }
.chakra-row.strongest .chakra-name { color: var(--text); }
.chakra-row.strongest .chakra-bar span { background: var(--gold); }
.chakra-row.weakest .chakra-name { color: var(--muted-dim); font-style: italic; }
.chakra-row.weakest .chakra-bar span { background: var(--line-strong); }

@media (max-width: 560px) {
    .chakra-row { grid-template-columns: 5.5rem 1fr 1.5rem; gap: .45rem; }
    .num-digits { font-size: 2rem; }
}

/* ═══════════════════════════════════════════════════════════
   Tarot — spreads, cards and the reading written about them
   ═══════════════════════════════════════════════════════════ */

/* ── Layout: draw panel, board, reading, history ──────────── */
.tarot-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 290px;
    gap: 1.25rem;
    align-items: start;
}
.tarot-main { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }
.tarot-aside { position: sticky; top: 1.5rem; }

@media (max-width: 1000px) {
    .tarot-layout { grid-template-columns: minmax(0, 1fr); }
    .tarot-aside { position: static; }
}

/* ── Draw panel ───────────────────────────────────────────── */
/* Ten spreads no longer fit one row of pills, so the picker is a grid: two
   columns on a wide panel, one on a narrow one. Each pill keeps its card count
   on the right, so the size of a spread is visible before it is chosen. */
.tarot-spread-picker {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .4rem;
}
.tarot-spread-picker label {
    display: flex; align-items: center; justify-content: space-between;
    gap: .45rem; min-width: 0; text-align: left;
}
.tarot-spread-count {
    flex: 0 0 auto;
    font-size: .68rem; color: var(--muted-dim);
    border: 1px solid var(--line); border-radius: 100px;
    padding: .02rem .4rem; font-variant-numeric: tabular-nums;
}
.tarot-spread-picker input:checked + label .tarot-spread-count {
    border-color: var(--gold-edge-faint); color: var(--gold);
}
@media (max-width: 560px) {
    .tarot-spread-picker { grid-template-columns: minmax(0, 1fr); }
}

/* ── Board ────────────────────────────────────────────────── */
.tarot-board { overflow: hidden; }
.tarot-board-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap; margin-bottom: 1.35rem;
}
.tarot-question {
    margin-top: .45rem; font-family: Georgia, 'Times New Roman', serif;
    font-style: italic; font-size: .98rem; color: var(--text-soft);
    max-width: 60ch;
}

.tarot-board-empty { padding: 2rem 1.5rem; }
.tarot-empty {
    display: grid; justify-items: center; gap: .4rem;
    padding: 1.5rem 1rem 1rem; text-align: center;
}
/* Three card backs, fanned: the deck waiting to be cut. */
.tarot-empty-deck {
    position: relative; width: 74px; height: 108px; margin-bottom: 1rem;
}
.tarot-empty-card {
    position: absolute; inset: 0;
    border-radius: 7px;
    border: 1px solid var(--gold-edge-faint);
    background:
        repeating-linear-gradient(45deg, transparent 0 5px, var(--gold-glow) 5px 6px),
        var(--stone-2);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .35);
}
.tarot-empty-card:nth-child(1) { transform: rotate(-9deg) translate(-14px, 3px); }
.tarot-empty-card:nth-child(2) { transform: rotate(-2deg); }
.tarot-empty-card:nth-child(3) { transform: rotate(7deg) translate(14px, 3px); }

/* The field lays the cards out; each spread places its own positions. */
.tarot-field {
    display: grid;
    gap: 1.15rem .9rem;
    justify-items: center;
    align-items: start;
    padding: .5rem 0 .25rem;
}

/* Three-card spread: one row of three. */
.tarot-board[data-tarot-spread="three"] .tarot-field {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-width: 640px;
    margin: 0 auto;
}

/* Celtic Cross: the cross on the left, the staff on the right, in deal order.
 *
 *                  3 (above)                          7
 *          5 (left)  1+2 (centre)  6 (right)          8
 *                  4 (below)                          9
 *                                                    10
 *
 * Positions 1 and 2 share one cell: the situation, and laid across it what
 * crosses it. They are one figure, so the grid sees a single item there. The
 * staff runs top to bottom, ending on the outcome. */
.tarot-board[data-tarot-spread="celtic"] .tarot-field {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-width: 620px;
    margin: 0 auto;
    align-items: center;
}
.tarot-board[data-tarot-spread="celtic"] .tarot-slot { max-width: 100px; }
.tarot-board[data-tarot-spread="celtic"] .tarot-slot[data-tarot-pos="0"]  { grid-area: 2 / 2; }
.tarot-board[data-tarot-spread="celtic"] .tarot-slot[data-tarot-pos="2"]  { grid-area: 1 / 2; }
.tarot-board[data-tarot-spread="celtic"] .tarot-slot[data-tarot-pos="3"]  { grid-area: 3 / 2; }
.tarot-board[data-tarot-spread="celtic"] .tarot-slot[data-tarot-pos="4"]  { grid-area: 2 / 1; }
.tarot-board[data-tarot-spread="celtic"] .tarot-slot[data-tarot-pos="5"]  { grid-area: 2 / 3; }
.tarot-board[data-tarot-spread="celtic"] .tarot-slot[data-tarot-pos="6"]  { grid-area: 1 / 4; }
.tarot-board[data-tarot-spread="celtic"] .tarot-slot[data-tarot-pos="7"]  { grid-area: 2 / 4; }
.tarot-board[data-tarot-spread="celtic"] .tarot-slot[data-tarot-pos="8"]  { grid-area: 3 / 4; }
.tarot-board[data-tarot-spread="celtic"] .tarot-slot[data-tarot-pos="9"]  { grid-area: 4 / 4; }

/* The crossing card, laid over the first and turned on its side. Both live in
   the same grid cell, so the cross is centred on the card it crosses rather
   than offset from it. */
.tarot-slot-cross .tarot-cross {
    display: grid; place-items: center; width: 100%;
}
.tarot-slot-cross .tarot-cross > .tarot-tilt { grid-area: 1 / 1; width: 100%; }
/* The crossing card is turned on its side and shrunk, so the card it crosses
   stays visible underneath it. Both children share one grid cell, which is what
   keeps their centres on the same point; absolute positioning drifted. */
.tarot-tilt-cross {
    transform: rotate(90deg);
    scale: .8;
    pointer-events: none;
}
/* The crossing card is turned on its side, so its number is turned back to
   stay readable. */
.tarot-tilt-cross .tarot-pos-badge { transform: rotate(-90deg); }


/* Opening of the Key: five triads, one per column, dealt left to right.
 *
 *   col 1     col 2      col 3        col 4      col 5
 *   given     opening    at hand      ending     hidden
 *   taken     obstacle   supports     resists    surfacing
 *   remains   resolved   moves to     after      asks of you
 *
 * The third triad is the matter itself; the four beside it read the same
 * question from four other angles. Nothing here is a "future" — the spread is
 * a portrait of one question, not a sequence in time, so keep the centre in
 * the middle. Positions 3-14 fill columns 1, 2, 4 and 5 in deal order. */
.tarot-board[data-tarot-spread="opening"] .tarot-field {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    max-width: 980px;
    margin: 0 auto;
    row-gap: .6rem;
}
.tarot-board[data-tarot-spread="opening"] .tarot-slot { max-width: 104px; }

.tarot-board[data-tarot-spread="opening"] .tarot-slot[data-tarot-pos="0"]  { grid-area: 1 / 3; }
.tarot-board[data-tarot-spread="opening"] .tarot-slot[data-tarot-pos="1"]  { grid-area: 2 / 3; }
.tarot-board[data-tarot-spread="opening"] .tarot-slot[data-tarot-pos="2"]  { grid-area: 3 / 3; }
.tarot-board[data-tarot-spread="opening"] .tarot-slot[data-tarot-pos="3"]  { grid-area: 1 / 2; }
.tarot-board[data-tarot-spread="opening"] .tarot-slot[data-tarot-pos="4"]  { grid-area: 2 / 2; }
.tarot-board[data-tarot-spread="opening"] .tarot-slot[data-tarot-pos="5"]  { grid-area: 3 / 2; }
.tarot-board[data-tarot-spread="opening"] .tarot-slot[data-tarot-pos="6"]  { grid-area: 1 / 1; }
.tarot-board[data-tarot-spread="opening"] .tarot-slot[data-tarot-pos="7"]  { grid-area: 2 / 1; }
.tarot-board[data-tarot-spread="opening"] .tarot-slot[data-tarot-pos="8"]  { grid-area: 3 / 1; }
.tarot-board[data-tarot-spread="opening"] .tarot-slot[data-tarot-pos="9"]  { grid-area: 1 / 4; }
.tarot-board[data-tarot-spread="opening"] .tarot-slot[data-tarot-pos="10"] { grid-area: 2 / 4; }
.tarot-board[data-tarot-spread="opening"] .tarot-slot[data-tarot-pos="11"] { grid-area: 3 / 4; }
.tarot-board[data-tarot-spread="opening"] .tarot-slot[data-tarot-pos="12"] { grid-area: 1 / 5; }
.tarot-board[data-tarot-spread="opening"] .tarot-slot[data-tarot-pos="13"] { grid-area: 2 / 5; }
.tarot-board[data-tarot-spread="opening"] .tarot-slot[data-tarot-pos="14"] { grid-area: 3 / 5; }

/* Relationship: your side on the left, their side on the right, the bond
 * itself down the middle. The two outer columns are the two people; the centre
 * column is the thing between them, which is why it is the taller one.
 *
 *   you think      bond now        they think
 *   you feel       what holds it   they feel
 *                  where it goes
 */
.tarot-board[data-tarot-spread="relationship"] .tarot-field {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-width: 560px;
    margin: 0 auto;
    align-items: center;
}
.tarot-board[data-tarot-spread="relationship"] .tarot-slot { max-width: 104px; }
.tarot-board[data-tarot-spread="relationship"] .tarot-slot[data-tarot-pos="0"] { grid-area: 1 / 1; }
.tarot-board[data-tarot-spread="relationship"] .tarot-slot[data-tarot-pos="1"] { grid-area: 2 / 1; }
.tarot-board[data-tarot-spread="relationship"] .tarot-slot[data-tarot-pos="2"] { grid-area: 1 / 2; }
.tarot-board[data-tarot-spread="relationship"] .tarot-slot[data-tarot-pos="3"] { grid-area: 2 / 2; }
.tarot-board[data-tarot-spread="relationship"] .tarot-slot[data-tarot-pos="4"] { grid-area: 3 / 2; }
.tarot-board[data-tarot-spread="relationship"] .tarot-slot[data-tarot-pos="5"] { grid-area: 1 / 3; }
.tarot-board[data-tarot-spread="relationship"] .tarot-slot[data-tarot-pos="6"] { grid-area: 2 / 3; }

/* Heart's Choice: the bond across the top, then two futures side by side —
 * staying on the left, leaving on the right — and what to weigh beneath them.
 *
 *            the bond as it stands
 *   stay gives              leave gives
 *   stay costs              leave costs
 *   what the heart knows    what to weigh
 */
.tarot-board[data-tarot-spread="heart"] .tarot-field {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 420px;
    margin: 0 auto;
    align-items: center;
}
.tarot-board[data-tarot-spread="heart"] .tarot-slot { max-width: 104px; }
.tarot-board[data-tarot-spread="heart"] .tarot-slot[data-tarot-pos="0"] { grid-area: 1 / 1 / 2 / 3; }
.tarot-board[data-tarot-spread="heart"] .tarot-slot[data-tarot-pos="1"] { grid-area: 2 / 1; }
.tarot-board[data-tarot-spread="heart"] .tarot-slot[data-tarot-pos="2"] { grid-area: 3 / 1; }
.tarot-board[data-tarot-spread="heart"] .tarot-slot[data-tarot-pos="3"] { grid-area: 2 / 2; }
.tarot-board[data-tarot-spread="heart"] .tarot-slot[data-tarot-pos="4"] { grid-area: 3 / 2; }
.tarot-board[data-tarot-spread="heart"] .tarot-slot[data-tarot-pos="5"] { grid-area: 4 / 1; }
.tarot-board[data-tarot-spread="heart"] .tarot-slot[data-tarot-pos="6"] { grid-area: 4 / 2; }

/* Crossroads: the decision across the top, then the two paths as two columns
 * read downward — what each gives, what each costs, where each leads.
 *
 *              the decision
 *   A gives                    B gives
 *   A costs                    B costs
 *   A leads                    B leads
 */
.tarot-board[data-tarot-spread="crossroads"] .tarot-field {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 420px;
    margin: 0 auto;
    align-items: center;
}
.tarot-board[data-tarot-spread="crossroads"] .tarot-slot { max-width: 104px; }
.tarot-board[data-tarot-spread="crossroads"] .tarot-slot[data-tarot-pos="0"] { grid-area: 1 / 1 / 2 / 3; }
.tarot-board[data-tarot-spread="crossroads"] .tarot-slot[data-tarot-pos="1"] { grid-area: 2 / 1; }
.tarot-board[data-tarot-spread="crossroads"] .tarot-slot[data-tarot-pos="2"] { grid-area: 3 / 1; }
.tarot-board[data-tarot-spread="crossroads"] .tarot-slot[data-tarot-pos="3"] { grid-area: 4 / 1; }
.tarot-board[data-tarot-spread="crossroads"] .tarot-slot[data-tarot-pos="4"] { grid-area: 2 / 2; }
.tarot-board[data-tarot-spread="crossroads"] .tarot-slot[data-tarot-pos="5"] { grid-area: 3 / 2; }
.tarot-board[data-tarot-spread="crossroads"] .tarot-slot[data-tarot-pos="6"] { grid-area: 4 / 2; }

/* Yes or no: three cards in one row, the same shape as the three-card spread. */
.tarot-board[data-tarot-spread="yesno"] .tarot-field {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-width: 640px;
    margin: 0 auto;
}

/* Blind spot: the four fields of the Johari window, as a window.
 *
 *   what you know      what you hide
 *   what others see    what nobody knows
 */
.tarot-board[data-tarot-spread="blindspot"] .tarot-field {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 420px;
    margin: 0 auto;
}
.tarot-board[data-tarot-spread="blindspot"] .tarot-slot { max-width: 132px; }

/* Chakra: one card per centre, root at the top of the column and crown at the
 * bottom, each card with its caption beside it rather than beneath. A vertical
 * stack of seven captioned cards would be a page long; a row per centre reads
 * as the ladder it is. */
.tarot-board[data-tarot-spread="chakra"] .tarot-field {
    grid-template-columns: minmax(0, 1fr);
    max-width: 460px;
    margin: 0 auto;
    gap: .55rem;
    justify-items: stretch;
}
.tarot-board[data-tarot-spread="chakra"] .tarot-slot {
    flex-direction: row;
    align-items: center;
    gap: .9rem;
    max-width: none;
}
.tarot-board[data-tarot-spread="chakra"] .tarot-tilt { flex: 0 0 62px; width: 62px; }
.tarot-board[data-tarot-spread="chakra"] .tarot-slot-caption {
    text-align: left;
    min-height: 0;
    width: auto;
    flex: 1 1 auto;
    min-width: 0;
}

/* Year cycle: twelve months, four to a row, in deal order. */
.tarot-board[data-tarot-spread="cycle"] .tarot-field {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-width: 620px;
    margin: 0 auto;
}
.tarot-board[data-tarot-spread="cycle"] .tarot-slot { max-width: 104px; }
/* ── A card ───────────────────────────────────────────────── */
.tarot-slot {
    display: flex; flex-direction: column; align-items: center;
    gap: .5rem; width: 100%; max-width: 132px; margin: 0;
}
/* The tilt wrapper carries any rotation the spread asks for (a card laid
   sideways, say), so the card itself is free to flip on its own axis. */
.tarot-tilt {
    position: relative; width: 100%;
    transition: transform var(--ease);
}
.tarot-card {
    position: relative;
    width: 100%; aspect-ratio: 370 / 650;
    border-radius: 8px;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform .45s cubic-bezier(.3, .9, .3, 1);
    outline: none;
}
.tarot-card:focus-visible { box-shadow: 0 0 0 2px var(--gold); border-radius: 10px; }
.tarot-slot.sideways .tarot-card { cursor: default; }
.tarot-slot:hover .tarot-card { transform: translateY(-3px); }
.tarot-slot:hover .tarot-card.flipped { transform: rotateY(180deg) translateY(-3px); }
.tarot-card.flipped { transform: rotateY(180deg); }

.tarot-face {
    position: absolute; inset: 0;
    backface-visibility: hidden; -webkit-backface-visibility: hidden;
    border-radius: 8px; overflow: hidden;
}
.tarot-face-back {
    border: 1px solid var(--gold-edge-faint);
    background: url("../img/tarot/back.png") center / cover no-repeat, var(--stone-2);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .38);
}
.tarot-face-front {
    transform: rotateY(180deg);
    background: var(--stone-2);
    border: 1px solid var(--line-strong);
    display: grid; place-items: center;
}
.tarot-face-front img {
    display: block; width: 100%; height: 100%; object-fit: cover;
    -webkit-user-drag: none;
}
.tarot-face-front img.reversed { transform: rotate(180deg); }

/* The reversed marker sits on the frame, not on the image, so it stays
   readable when the picture is upside down. */
.tarot-reversed-flag {
    position: absolute; right: 4px; bottom: 4px; z-index: 3;
    width: 17px; height: 17px; border-radius: 50%;
    display: grid; place-items: center;
    font-size: .62rem; line-height: 1;
    color: var(--gold); background: var(--stone-2);
    border: 1px solid var(--gold-edge);
    font-family: 'Segoe UI Symbol', 'Apple Symbols', 'Noto Sans Symbols 2', 'DejaVu Sans', sans-serif;
    opacity: 0; transition: opacity var(--ease);
}
.tarot-card.flipped ~ .tarot-reversed-flag { opacity: 1; }

.tarot-slot-caption {
    display: grid; gap: .1rem; text-align: center;
    min-height: 2.6rem; width: 100%;
}
/* A caption is a list of card rows: most spreads have one, the Celtic Cross's
   centre has two. */
.tarot-caption-row { display: grid; gap: .1rem; min-width: 0; }
.tarot-slot-position {
    font-size: .62rem; letter-spacing: .1em; text-transform: uppercase;
    color: var(--gold-dim);
}
.tarot-slot-name { font-size: .78rem; color: var(--text); line-height: 1.35; }
.tarot-slot-gloss {
    font-size: .68rem; color: var(--muted-dim); line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}

/* On a dense board each card wears its position number, so the key below the
   table can be read against the layout. */
.tarot-pos-badge {
    position: absolute; left: 4px; top: 4px; z-index: 4;
    min-width: 18px; height: 18px; padding: 0 .25rem;
    display: grid; place-items: center;
    border-radius: 100px;
    font-size: .66rem; line-height: 1; font-variant-numeric: tabular-nums;
    color: var(--gold); background: var(--stone);
    border: 1px solid var(--gold-edge);
}

/* ── The key beneath a dense spread ───────────────────────── */
.tarot-key {
    list-style: none; margin: 1.4rem 0 0;
    padding: 1.25rem 0 0;
    border-top: 1px solid var(--line);
    display: grid; gap: .55rem;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}
.tarot-key-row {
    display: flex; align-items: flex-start; gap: .6rem;
    min-width: 0;
}
.tarot-key-num {
    flex: 0 0 auto; width: 20px; height: 20px;
    display: grid; place-items: center; border-radius: 100px;
    font-size: .68rem; font-variant-numeric: tabular-nums;
    color: var(--gold-dim); border: 1px solid var(--line-strong);
}
.tarot-key-text { display: grid; gap: .05rem; min-width: 0; }
.tarot-key-position {
    font-size: .64rem; letter-spacing: .1em; text-transform: uppercase;
    color: var(--gold-dim);
}
.tarot-key-name { font-size: .82rem; color: var(--text); line-height: 1.35; }
.tarot-key-gloss { font-size: .72rem; color: var(--muted-dim); line-height: 1.45; }
/* ── Reading panel ────────────────────────────────────────── */
.tarot-reading .ai-reading-panel { padding: 1.25rem 1.4rem; }
/* The reading is four long movements — the whole spread, each card, the story
   between them, the counsel — so it reads down the page rather than as a grid
   of short paragraphs. */
.tarot-reading-sections { display: flex; flex-direction: column; gap: .9rem; }
.tarot-reading-sections .planet { padding: .9rem 1rem; }
.tarot-reading-sections .planet-name {
    font-size: .72rem; letter-spacing: .1em; text-transform: uppercase;
    color: var(--gold-dim); margin-bottom: .35rem;
}
.tarot-reading-sections .planet-explainer { font-size: .88rem; line-height: 1.7; }
.tarot-reading-sections .planet-explainer strong { color: var(--text); }
.tarot-language-note {
    margin-bottom: .9rem; padding: .5rem .7rem;
    border-left: 2px solid var(--gold-edge);
    background: var(--gold-glow); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: .8rem; color: var(--text-soft); line-height: 1.55;
}

/* ── History ──────────────────────────────────────────────── */
.tarot-history {
    display: grid; gap: .2rem;
    max-height: 62vh; overflow-y: auto;
    margin: 0 -.2rem; padding: 0 .2rem;
    scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.tarot-history-entry {
    display: flex; align-items: flex-start; gap: .15rem;
    border: 1px solid transparent; border-radius: 10px;
    transition: var(--ease);
}
.tarot-history-entry:hover { background: var(--surface-3); }
.tarot-history-entry.active {
    background: var(--gold-glow); border-color: var(--gold-edge-soft);
}
.tarot-history-open {
    flex: 1; min-width: 0;
    display: block; padding: .55rem .6rem;
    background: none; border: 0; cursor: pointer;
    text-align: left; font: inherit; color: var(--muted);
    border-radius: 10px;
}
.tarot-history-open:focus-visible { outline: 2px solid var(--gold-edge); outline-offset: 1px; }
.tarot-history-entry.active .tarot-history-open { color: var(--text); }
.tarot-history-main { display: grid; gap: .2rem; min-width: 0; }
.tarot-history-head { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.tarot-history-head .badge { font-size: .66rem; padding: .12rem .5rem; }
.tarot-history-head .entry-date { font-size: .7rem; }
.tarot-history-read { color: var(--gold-dim); font-size: .78rem; margin-left: auto; }
.tarot-history-question {
    font-family: Georgia, 'Times New Roman', serif; font-style: italic;
    font-size: .78rem; color: var(--text-soft); line-height: 1.4;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tarot-history-cards {
    font-size: .72rem; color: var(--muted-dim); line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.tarot-history-delete {
    flex: 0 0 auto; opacity: 0; color: var(--muted-dim);
    padding: .35rem .45rem; font-size: .8rem; line-height: 1;
}
.tarot-history-entry:hover .tarot-history-delete,
.tarot-history-entry:focus-within .tarot-history-delete { opacity: 1; }
.tarot-history-delete:hover { color: var(--negative); }

/* ── Narrow screens ───────────────────────────────────────── */
@media (max-width: 900px) {
    /* The Celtic Cross cannot keep its cross on a phone; the positions become
       a two-up grid in deal order, which is still readable card by card. The
       same is true of every spread whose layout carries meaning in its shape:
       the shape is a reading aid, not the reading. */
    .tarot-board[data-tarot-spread="celtic"] .tarot-field,
    .tarot-board[data-tarot-spread="opening"] .tarot-field,
    .tarot-board[data-tarot-spread="relationship"] .tarot-field,
    .tarot-board[data-tarot-spread="heart"] .tarot-field,
    .tarot-board[data-tarot-spread="crossroads"] .tarot-field,
    .tarot-board[data-tarot-spread="cycle"] .tarot-field {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        max-width: none;
    }
    .tarot-board[data-tarot-spread="celtic"] .tarot-slot,
    .tarot-board[data-tarot-spread="opening"] .tarot-slot,
    .tarot-board[data-tarot-spread="relationship"] .tarot-slot,
    .tarot-board[data-tarot-spread="heart"] .tarot-slot,
    .tarot-board[data-tarot-spread="crossroads"] .tarot-slot,
    .tarot-board[data-tarot-spread="cycle"] .tarot-slot {
        grid-area: auto !important;
        transform: none !important;
        pointer-events: auto;
    }
    .tarot-slot.sideways .tarot-tilt { transform: none; }
    .tarot-slot.sideways .tarot-slot-caption { display: grid; }
    .tarot-history { max-height: 40vh; }
    .tarot-history-delete { opacity: .7; }
}

@media (max-width: 620px) {
    .tarot-board[data-tarot-spread="three"] .tarot-field,
    .tarot-board[data-tarot-spread="celtic"] .tarot-field,
    .tarot-board[data-tarot-spread="opening"] .tarot-field,
    .tarot-board[data-tarot-spread="relationship"] .tarot-field,
    .tarot-board[data-tarot-spread="heart"] .tarot-field,
    .tarot-board[data-tarot-spread="crossroads"] .tarot-field,
    .tarot-board[data-tarot-spread="yesno"] .tarot-field,
    .tarot-board[data-tarot-spread="blindspot"] .tarot-field,
    .tarot-board[data-tarot-spread="cycle"] .tarot-field {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .9rem .6rem;
    }
    /* The chakra column keeps its row-per-centre shape on a phone; only the
       card shrinks, so the ladder still reads top to bottom. */
    .tarot-board[data-tarot-spread="chakra"] .tarot-tilt { flex-basis: 48px; width: 48px; }
    .tarot-board { padding: 1.15rem 1rem; }
    .tarot-slot-name { font-size: .74rem; }
    .tarot-slot-gloss { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .tarot-card, .tarot-slot { transition: none; }
    .tarot-slot:hover .tarot-card,
    .tarot-slot:hover .tarot-card.flipped { transform: none; }
    .tarot-slot:hover .tarot-card.flipped { transform: rotateY(180deg); }
}
/* ═══════════════════════════════════════════════════════════
   Poetry — the picker, the sheet and the kept poems
   ═══════════════════════════════════════════════════════════ */

/* ── Layout: form, sheet, history ─────────────────────────── */
.poetry-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 290px;
    gap: 1.25rem;
    align-items: start;
}
.poetry-main { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }
.poetry-aside { position: sticky; top: 1.5rem; }

@media (max-width: 1000px) {
    .poetry-layout { grid-template-columns: minmax(0, 1fr); }
    .poetry-aside { position: static; }
}

/* ── The sheet: the poem itself ───────────────────────────── */
.poetry-sheet { padding: 2rem 2.25rem; }
.poetry-sheet-empty { padding: 2rem 1.5rem; }

.poetry-sheet-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem;
}
.poetry-topic {
    margin-top: .45rem; font-family: Georgia, 'Times New Roman', serif;
    font-style: italic; font-size: .98rem; color: var(--text-soft);
    max-width: 60ch;
}
.poetry-language-note { margin-bottom: 1rem; }

.poem-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-weight: 400; font-size: 1.35rem; letter-spacing: .01em;
    color: var(--text); margin-bottom: 1.35rem;
}

/* The poem is set as verse, not prose: one line per line, generous leading,
   and a measure narrow enough that the eye returns to the left margin. */
.poem-body {
    display: flex; flex-direction: column; gap: .18rem;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.06rem; line-height: 1.85;
    color: var(--text-soft);
    max-width: 46ch;
    white-space: pre-wrap;
}
.poem-line { display: block; }

.poem-note {
    margin-top: 1.75rem; padding-top: 1.1rem;
    border-top: 1px solid var(--line);
    font-size: .84rem; line-height: 1.65; color: var(--muted-dim);
    max-width: 60ch;
}

/* ── The Turkish rendering and the explanation ────────────── */
.poem-section-label {
    color: var(--gold);
    margin-bottom: .85rem;
}

.poem-translation {
    margin-top: 2rem; padding-top: 1.5rem;
    border-top: 1px solid var(--line);
}

/* The rendering is set as verse too, but a shade quieter than the poem: it is
   a way into the poem, not a second poem competing with it. */
.poem-body-translation {
    font-size: .98rem;
    line-height: 1.8;
    color: var(--muted);
}

.poem-explanation {
    margin-top: 1.75rem; padding-top: 1.35rem;
    border-top: 1px solid var(--line);
}
.poem-explanation p {
    font-size: .9rem; line-height: 1.75; color: var(--text-soft);
    max-width: 62ch;
}

/* ── History ──────────────────────────────────────────────── */
.poetry-history { display: flex; flex-direction: column; gap: .3rem; margin-top: .75rem; }

.poetry-history-entry {
    display: flex; align-items: stretch; gap: .25rem;
    border-radius: var(--radius-sm);
    transition: background var(--ease);
}
.poetry-history-entry:hover { background: var(--surface-3); }
.poetry-history-entry.active { background: var(--gold-glow); }

.poetry-history-open {
    flex: 1; min-width: 0; text-align: left;
    background: none; border: 0; cursor: pointer;
    padding: .55rem .6rem; border-radius: var(--radius-sm);
    color: var(--muted); font: inherit;
}
.poetry-history-open:focus-visible { outline: 2px solid var(--gold-edge); outline-offset: 1px; }
.poetry-history-entry.active .poetry-history-open { color: var(--text); }

.poetry-history-main { display: grid; gap: .2rem; min-width: 0; }
.poetry-history-head { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.poetry-history-head .badge { font-size: .66rem; padding: .12rem .5rem; }
.poetry-history-head .entry-date { font-size: .7rem; }
.poetry-history-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: .86rem; color: var(--text-soft);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.poetry-history-line {
    font-size: .76rem; color: var(--muted-dim); font-style: italic;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.poetry-history-delete {
    align-self: center; opacity: 0; transition: opacity var(--ease), color var(--ease);
}
.poetry-history-entry:hover .poetry-history-delete,
.poetry-history-entry:focus-within .poetry-history-delete { opacity: 1; }
.poetry-history-delete:hover { color: var(--negative); }

/* ═══════════════════════════════════════════════════════════
   Stories — the picker, the sheet and the kept stories
   ═══════════════════════════════════════════════════════════ */

/* ── Layout: form, sheet, history ─────────────────────────── */
.story-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 290px;
    gap: 1.25rem;
    align-items: start;
}
.story-main { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }
.story-aside { position: sticky; top: 1.5rem; }

@media (max-width: 1000px) {
    .story-layout { grid-template-columns: minmax(0, 1fr); }
    .story-aside { position: static; }
}

/* ── The sheet: the story itself ──────────────────────────── */
.story-sheet { padding: 2rem 2.25rem; }
.story-sheet-empty { padding: 2rem 1.5rem; }

.story-sheet-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem;
}
.story-topic {
    margin-top: .45rem; font-family: Georgia, 'Times New Roman', serif;
    font-style: italic; font-size: .98rem; color: var(--text-soft);
    max-width: 60ch;
}
.story-language-note { margin-bottom: 1rem; }

.story-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-weight: 400; font-size: 1.45rem; letter-spacing: .01em;
    color: var(--text); margin-bottom: 1.35rem;
}

/* A story is prose, so it is set as prose: a reading measure, generous
   leading, and a first-line indent on every paragraph but the first — the
   convention a printed story uses, and the one that makes a page of dialogue
   readable. */
.story-body {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.02rem; line-height: 1.85;
    color: var(--text-soft);
    max-width: 62ch;
}
.story-body p { margin: 0 0 1.05rem; }
.story-body p:last-child { margin-bottom: 0; }
.story-body p + p { text-indent: 1.6em; }

/* ── The Turkish rendering and the explanation ────────────── */
.story-section-label {
    color: var(--gold);
    margin-bottom: .85rem;
}

.story-translation {
    margin-top: 2rem; padding-top: 1.5rem;
    border-top: 1px solid var(--line);
}

/* The rendering is set as prose too, but a shade quieter than the story: it
   is a way into the story, not a second story competing with it. */
.story-body-translation {
    font-size: .96rem;
    line-height: 1.8;
    color: var(--muted);
}

.story-explanation {
    margin-top: 1.75rem; padding-top: 1.35rem;
    border-top: 1px solid var(--line);
}
.story-explanation p {
    font-size: .9rem; line-height: 1.75; color: var(--text-soft);
    max-width: 62ch;
}

/* ── History ──────────────────────────────────────────────── */
.story-history { display: flex; flex-direction: column; gap: .3rem; margin-top: .75rem; }

.story-history-entry {
    display: flex; align-items: stretch; gap: .25rem;
    border-radius: var(--radius-sm);
    transition: background var(--ease);
}
.story-history-entry:hover { background: var(--surface-3); }
.story-history-entry.active { background: var(--gold-glow); }

.story-history-open {
    flex: 1; min-width: 0; text-align: left;
    background: none; border: 0; cursor: pointer;
    padding: .55rem .6rem; border-radius: var(--radius-sm);
    color: var(--muted); font: inherit;
}
.story-history-open:focus-visible { outline: 2px solid var(--gold-edge); outline-offset: 1px; }
.story-history-entry.active .story-history-open { color: var(--text); }

.story-history-main { display: grid; gap: .2rem; min-width: 0; }
.story-history-head { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.story-history-head .badge { font-size: .66rem; padding: .12rem .5rem; }
.story-history-head .entry-date { font-size: .7rem; }
.story-history-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: .86rem; color: var(--text-soft);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.story-history-line {
    font-size: .76rem; color: var(--muted-dim); font-style: italic;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.story-history-delete {
    align-self: center; opacity: 0; transition: opacity var(--ease), color var(--ease);
}
.story-history-entry:hover .story-history-delete,
.story-history-entry:focus-within .story-history-delete { opacity: 1; }
.story-history-delete:hover { color: var(--negative); }

/* ═══════════════════════════════════════════════════════════
   Reading aloud — the control, and the block being read
   ═══════════════════════════════════════════════════════════ */

/* The button carries two icons and swaps them by state, so the label never
   has to be rebuilt in JS and the control keeps its width. */
.speech-button {
    display: inline-flex; align-items: center; gap: .4rem;
    white-space: nowrap;
}
.speech-button .speech-icon { display: inline-flex; }
.speech-button .speech-icon svg { width: 14px; height: 14px; }
.speech-button .speech-icon-stop { display: none; }
.speech-button.speaking { color: var(--gold); border-color: var(--gold-edge); }
.speech-button.speaking .speech-icon-play { display: none; }
.speech-button.speaking .speech-icon-stop { display: inline-flex; }

/* The icon-only variant sits in the chat action row, so it inherits that
   row's size and hover behaviour rather than the button's. */
.chat-action.speech-button { gap: 0; }
.chat-action.speech-button .speech-icon svg { width: 14px; height: 14px; }

/* The block being read is marked, so the eye can follow the voice. The mark
   is a tint and an inset rule rather than a border: nothing shifts while a
   paragraph is being spoken, and a poem's measure is not narrowed. */
.is-speaking {
    background: var(--gold-glow);
    box-shadow: inset 2px 0 0 var(--gold-edge);
    border-radius: 2px;
    transition: background var(--ease);
}

/* A poem or story is read as one block, so its tools sit under it rather
   than in the header where they would compete with the poet's name. */
.poem-tools, .story-tools {
    display: flex; justify-content: flex-end;
    margin-top: 1rem;
}

.chart-poem figcaption { display: flex; justify-content: center; margin-top: .75rem; }

/* The settings card's speed slider reads as a value, not a mystery. */
#speech-rate { width: 100%; accent-color: var(--gold); }
#speech-rate-value { color: var(--gold); font-variant-numeric: tabular-nums; }

/* ═══════════════════════════════════════════════════════════
   Dictation — the microphone in the chat composer
   ═══════════════════════════════════════════════════════════ */

/* The microphone sits beside Send, at the same size, so the two controls read
   as one pair: speak the message, or send it. */
.composer-mic {
    display: grid; place-items: center; flex: 0 0 auto;
    width: 34px; height: 34px; border-radius: 50%;
    border: 1px solid var(--line-strong); background: transparent;
    color: var(--muted); cursor: pointer; transition: var(--ease);
}
.composer-mic svg { width: 16px; height: 16px; }
.composer-mic:hover { color: var(--gold); border-color: var(--gold-edge); }
.composer-mic:focus-visible { outline: 2px solid var(--gold-edge); outline-offset: 2px; }

/* Listening is a state the person has to be able to see from across the
   room: the microphone is open, and the browser is hearing the room. */
.composer-mic.listening {
    color: var(--negative);
    border-color: var(--negative);
    background: var(--neg-glow);
    animation: dictation-pulse 1.6s ease-in-out infinite;
}
.composer-mic.listening:hover { color: var(--negative); border-color: var(--negative); }

@keyframes dictation-pulse {
    0%, 100% { box-shadow: 0 0 0 0 var(--neg-glow); }
    50% { box-shadow: 0 0 0 5px var(--neg-glow); }
}

/* The note under the composer says what is happening, and — once — that the
   voice leaves the device. It is a line of text, not a banner: dictation is
   an aid, not an alarm. */
.composer-dictation-note {
    margin: .45rem .2rem 0;
    font-size: .72rem; line-height: 1.5; color: var(--muted-dim);
}
.composer-dictation-note[hidden] { display: none; }
.composer-dictation-note.error { color: var(--negative); }

@media (prefers-reduced-motion: reduce) {
    .composer-mic.listening { animation: none; }
}

/* ═══════════════════════════════════════════════════════════
   I Ching — the six lines, the two hexagrams and the reading
   ═══════════════════════════════════════════════════════════ */

/* ── Layout: toss panel, board, reading, history ──────────── */
.iching-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 290px;
    gap: 1.25rem;
    align-items: start;
}
.iching-main { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }
.iching-aside { position: sticky; top: 1.5rem; }

@media (max-width: 1000px) {
    .iching-layout { grid-template-columns: minmax(0, 1fr); }
    .iching-aside { position: static; }
}

/* ── Board ────────────────────────────────────────────────── */
.iching-board { overflow: hidden; }
.iching-board-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap; margin-bottom: 1.35rem;
}
.iching-question {
    margin-top: .45rem; font-family: Georgia, 'Times New Roman', serif;
    font-style: italic; font-size: .98rem; color: var(--text-soft);
    max-width: 60ch;
}

/* The two hexagrams, side by side, with the arrow between them. */
.iching-hex-head {
    display: flex; align-items: stretch; gap: 1rem; flex-wrap: wrap;
    padding: 1rem 1.1rem; margin-bottom: 1.5rem;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface-1);
}
.iching-hex-block { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.iching-hex-block.iching-hex-still { justify-content: center; }
.iching-hex-label { font-size: .68rem; color: var(--muted-dim); }
.iching-hex-number {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.9rem; line-height: 1; color: var(--gold);
    font-variant-numeric: tabular-nums;
}
.iching-hex-name { font-size: .95rem; color: var(--text); }
.iching-hex-trigrams { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .3rem; }
.iching-hex-arrow {
    align-self: center; color: var(--muted-dim); font-size: 1.2rem;
}

/* ── The six lines ────────────────────────────────────────── */
.iching-figure {
    display: flex; justify-content: center;
    padding: 1.5rem 1rem 1rem;
}
.iching-lines {
    display: flex; flex-direction: column; gap: .55rem;
    width: min(100%, 340px);
}
.iching-line {
    display: grid;
    grid-template-columns: 1.4rem 1fr 1.2rem;
    align-items: center; gap: .7rem;
}
.iching-line-num {
    font-size: .68rem; color: var(--muted-dim);
    font-variant-numeric: tabular-nums; text-align: right;
}
.iching-line-glyph { display: flex; gap: .55rem; align-items: center; }
.iching-bar {
    flex: 1; height: 9px; border-radius: 2px;
    background: var(--text-soft);
    transition: background var(--ease), opacity var(--ease);
}
.iching-line.yin .iching-bar { flex: 1 1 0; }
.iching-line.changing .iching-bar { background: var(--gold); }
.iching-line-mark {
    font-size: .8rem; color: var(--gold); text-align: center;
    line-height: 1;
}
.iching-line-kind {
    grid-column: 2 / 4; font-size: .68rem; color: var(--muted-dim);
    margin-top: -.15rem;
}

/* ── Empty board ──────────────────────────────────────────── */
.iching-board-empty { padding: 2rem 1.5rem; text-align: center; }
.iching-empty {
    display: flex; flex-direction: column; gap: .5rem; align-items: center;
    width: min(100%, 220px); margin: 0 auto 1.4rem; opacity: .35;
}
.iching-empty-line {
    width: 100%; height: 8px; border-radius: 2px;
    background: var(--muted-dim);
}
.iching-empty-line.yin {
    background: linear-gradient(to right,
        var(--muted-dim) 0 42%, transparent 42% 58%, var(--muted-dim) 58% 100%);
}

/* ── History ──────────────────────────────────────────────── */
.iching-history { display: flex; flex-direction: column; gap: .5rem; }
.iching-history-entry {
    display: flex; align-items: stretch; gap: .35rem;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface-1);
    transition: border-color var(--ease), background var(--ease);
}
.iching-history-entry:hover { border-color: var(--line-strong); }
.iching-history-entry.active {
    border-color: var(--gold-edge); background: var(--gold-glow);
}
.iching-history-open {
    flex: 1; min-width: 0; text-align: left; background: none; border: 0;
    color: inherit; font: inherit; cursor: pointer; padding: .6rem .7rem;
}
.iching-history-main { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.iching-history-head { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.iching-history-read { color: var(--gold); font-size: .8rem; }
.iching-history-question {
    font-family: Georgia, 'Times New Roman', serif; font-style: italic;
    font-size: .82rem; color: var(--text-soft);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.iching-history-cards {
    font-size: .78rem; color: var(--muted-dim);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.iching-history-delete { align-self: center; margin-right: .3rem; }

.iching-language-note { color: var(--gold); }

/* A regeneration keeps the old reading on screen, so the panel says it is
   working rather than looking untouched for half a minute. */
.iching-refreshing {
    display: flex; align-items: center; gap: .45rem;
    margin-bottom: .75rem; color: var(--gold);
}
.iching-refreshing .spin { font-size: .9rem; }

@media (max-width: 560px) {
    .iching-hex-head { gap: .75rem; }
    .iching-hex-number { font-size: 1.6rem; }
    .iching-line { grid-template-columns: 1.1rem 1fr 1rem; gap: .5rem; }
}

/* ═══════════════════════════════════════════════════════════
   Today — the latest work from each symbolic feature
   ═══════════════════════════════════════════════════════════ */

.latest-work-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: .85rem;
}

/* A card is a button: the whole tile opens the view that holds the work. */
.latest-work-card {
    display: flex; flex-direction: column; gap: .35rem;
    min-width: 0; padding: .85rem .95rem;
    text-align: left; font: inherit; color: inherit; cursor: pointer;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface-1);
    transition: border-color var(--ease), background var(--ease), transform var(--ease);
}
.latest-work-card:hover {
    border-color: var(--gold-edge);
    background: var(--gold-glow);
    transform: translateY(-1px);
}
.latest-work-card:focus-visible {
    outline: 2px solid var(--gold); outline-offset: 2px;
}

.latest-work-head { display: flex; align-items: center; gap: .4rem; }
.latest-work-glyph { color: var(--gold); font-size: .95rem; line-height: 1; }
/* Not uppercased: CSS uppercase follows the document language, and in Turkish
   "I Ching" would become "I CHİNG" — a dotted İ in a proper noun. */
.latest-work-label {
    font-size: .7rem; letter-spacing: .06em;
    color: var(--muted-dim); font-weight: 500;
}

.latest-work-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: .95rem; line-height: 1.3; color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.latest-work-body {
    font-size: .8rem; line-height: 1.45; color: var(--muted);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.latest-work-meta {
    font-family: Georgia, 'Times New Roman', serif; font-style: italic;
    font-size: .78rem; color: var(--text-soft);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.latest-work-foot {
    display: flex; align-items: center; justify-content: space-between;
    gap: .5rem; margin-top: auto; padding-top: .35rem;
}
.latest-work-mark { color: var(--gold); font-size: .78rem; }

/* An empty card is an invitation, not a blank: it keeps the same height so
   the row stays even, and says what to do rather than that nothing exists. */
.latest-work-card.is-empty { justify-content: flex-start; }
.latest-work-empty {
    font-size: .82rem; line-height: 1.45; color: var(--muted-dim);
    margin-top: .15rem;
}
.latest-work-card.is-empty:hover .latest-work-empty { color: var(--text-soft); }

/* ═══════════════════════════════════════════════════════════
   Timeline, calendar, trends
   ═══════════════════════════════════════════════════════════ */

.cal-weekdays {
    display: grid; grid-template-columns: repeat(7, 1fr);
    gap: .35rem; margin-bottom: .35rem;
}
.cal-weekdays span {
    font-size: .68rem; letter-spacing: .1em; text-transform: uppercase;
    color: var(--muted-dim); text-align: center;
}

.cal-grid {
    display: grid; grid-template-columns: repeat(7, 1fr);
    gap: .35rem;
}

.cal-cell {
    position: relative;
    display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between;
    min-height: 62px; padding: .4rem .45rem;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--surface-1); color: var(--text-soft);
    font: inherit; text-align: left; cursor: pointer;
    transition: border-color var(--ease), background var(--ease);
}
.cal-cell:hover { border-color: var(--gold-edge-soft); background: var(--surface-3); }
.cal-cell.is-blank { visibility: hidden; cursor: default; }
.cal-cell.has-items { background: var(--surface-2); }
.cal-cell.is-today { border-color: var(--gold-edge); }
.cal-cell.is-selected { border-color: var(--gold); background: var(--gold-glow); }

.cal-day { font-size: .82rem; color: var(--text); }
.cal-cell.is-today .cal-day { color: var(--gold); font-weight: 500; }
.cal-marks { display: flex; flex-wrap: wrap; gap: .1rem; }
.cal-mark { font-size: .68rem; color: var(--gold-dim); line-height: 1; }
.cal-more { font-size: .62rem; color: var(--muted-dim); }

.cal-day-panel {
    margin-top: 1.25rem; padding-top: 1.25rem;
    border-top: 1px solid var(--line);
}
.cal-day-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: .75rem; margin-bottom: .75rem;
}
.cal-day-items { display: flex; flex-direction: column; gap: .4rem; }
.cal-day-item {
    display: flex; align-items: flex-start; gap: .7rem;
    padding: .6rem .75rem; border-radius: var(--radius-sm);
    border: 1px solid var(--line); background: var(--surface-1);
    color: var(--text-soft); font: inherit; text-align: left; cursor: pointer;
    transition: border-color var(--ease), background var(--ease);
}
.cal-day-item:hover { border-color: var(--gold-edge-soft); background: var(--surface-3); }
.cal-day-glyph { color: var(--gold); font-size: .95rem; line-height: 1.4; }
.cal-day-body { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.cal-day-kind {
    font-size: .66rem; letter-spacing: .1em; text-transform: uppercase;
    color: var(--muted-dim);
}
.cal-day-title { font-size: .88rem; color: var(--text); }
.cal-day-text {
    font-size: .8rem; color: var(--muted); line-height: 1.5;
    overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* ── Year heat strip ──────────────────────────────────────── */

.heat-strip {
    display: grid;
    grid-template-rows: repeat(7, 1fr);
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 2px;
    margin-top: .5rem;
}
.heat-cell {
    display: block; aspect-ratio: 1; border-radius: 2px;
    background: var(--surface-2);
}
.heat-cell.level-1 { background: var(--gold-edge-faint); }
.heat-cell.level-2 { background: var(--gold-edge-soft); }
.heat-cell.level-3 { background: var(--gold-edge); }
.heat-cell.level-4 { background: var(--gold); }

.heat-legend {
    display: flex; align-items: center; gap: .3rem;
    margin-top: .85rem; justify-content: flex-end;
}
.heat-legend .heat-cell { width: 11px; height: 11px; aspect-ratio: auto; }

/* ── Trend line ───────────────────────────────────────────── */

.trend-svg { width: 100%; height: auto; display: block; margin-top: .5rem; }
.trend-grid { stroke: var(--line); stroke-width: 1; }
.trend-axis { fill: var(--muted-dim); font-size: 10px; }
.trend-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.trend-line.mood { stroke: var(--gold); }
.trend-line.valence { stroke: var(--positive); stroke-dasharray: 4 3; }

.trend-key {
    display: inline-flex; align-items: center; gap: .35rem;
    font-size: .74rem; color: var(--muted);
}
.trend-swatch { width: 14px; height: 2px; border-radius: 1px; display: inline-block; }
.trend-swatch.mood { background: var(--gold); }
.trend-swatch.valence { background: var(--positive); }

/* ═══════════════════════════════════════════════════════════
   Intentions, reviews, memory, account
   ═══════════════════════════════════════════════════════════ */

.intention-row, .review-row, .memory-row {
    display: flex; align-items: center; gap: .5rem;
    padding: .55rem 0; border-bottom: 1px solid var(--line);
}
.intention-row:last-child, .review-row:last-child, .memory-row:last-child { border-bottom: 0; }

.intention-open, .review-open {
    flex: 1; display: flex; flex-direction: column; gap: .2rem;
    background: none; border: 0; padding: .2rem 0;
    color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.intention-open:hover .intention-title,
.review-open:hover .review-window { color: var(--gold); }

.intention-title { font-size: .92rem; color: var(--text); }
.intention-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }

.intention-records { display: flex; flex-direction: column; gap: .35rem; }
.intention-record {
    display: flex; align-items: center; gap: .6rem;
    padding: .45rem .6rem; border-radius: var(--radius-sm);
    border: 1px solid var(--line); background: var(--surface-1);
    color: var(--text-soft); font: inherit; font-size: .84rem;
    text-align: left; cursor: pointer;
}
.intention-record:hover { border-color: var(--gold-edge-soft); }

.review-window { font-size: .92rem; color: var(--text); }
.review-range { font-size: .76rem; color: var(--muted-dim); }
.review-preview {
    font-size: .8rem; color: var(--muted); line-height: 1.5;
    overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

.memory-form { display: flex; gap: .5rem; margin-bottom: 1rem; }
.memory-form input { flex: 1; }
.memory-body { flex: 1; display: flex; flex-direction: column; gap: .2rem; }
.memory-text { font-size: .88rem; color: var(--text-soft); line-height: 1.55; }
.memory-edit-form { display: flex; gap: .4rem; flex: 1; }
.memory-edit-form input { flex: 1; }

.plain-list { list-style: none; padding: 0; margin: .4rem 0 0; }
.plain-list li {
    position: relative; padding-left: 1rem; margin-bottom: .35rem;
    font-size: .88rem; color: var(--muted); line-height: 1.6;
}
.plain-list li::before {
    content: '·'; position: absolute; left: .25rem; color: var(--gold);
}

.switch-row {
    display: flex; align-items: flex-start; gap: .75rem;
    padding: .75rem 0; cursor: pointer;
}
.switch-row input { margin-top: .3rem; accent-color: var(--gold); }
.switch-row span { display: flex; flex-direction: column; gap: .15rem; }
.switch-row strong { font-weight: 500; font-size: .9rem; color: var(--text); }
.switch-row em { font-style: normal; font-size: .8rem; color: var(--muted); line-height: 1.55; }

.danger-card { border-color: var(--neg-edge); }
.btn-danger {
    background: transparent; border: 1px solid var(--neg-edge);
    color: var(--negative); border-radius: 999px; padding: .6rem 1.2rem;
    font: inherit; cursor: pointer; transition: background var(--ease);
}
.btn-danger:hover { background: var(--neg-glow); }

/* ── Usage table ──────────────────────────────────────────── */

.usage-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.usage-table th {
    text-align: left; padding: .5rem .4rem;
    font-size: .68rem; letter-spacing: .1em; text-transform: uppercase;
    color: var(--muted-dim); font-weight: 500;
    border-bottom: 1px solid var(--line-strong);
}
.usage-table td {
    padding: .5rem .4rem; color: var(--text-soft);
    border-bottom: 1px solid var(--line);
}
.usage-table td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.usage-table th:not(:first-child) { text-align: right; }

/* ═══════════════════════════════════════════════════════════
   Depth additions: transits, synastry, dream series, forecast
   ═══════════════════════════════════════════════════════════ */

.transit-strip {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: .4rem; margin-top: .5rem;
}
.transit-day {
    padding: .5rem .55rem; border-radius: var(--radius-sm);
    border: 1px solid var(--line); background: var(--surface-1);
    display: flex; flex-direction: column; gap: .2rem;
}
.transit-day.has-aspects { border-color: var(--gold-edge-faint); background: var(--surface-2); }
.transit-date { font-size: .74rem; color: var(--muted-dim); }
.transit-moon { font-size: .8rem; color: var(--text-soft); }
.transit-aspects { display: flex; flex-direction: column; gap: .1rem; }
.transit-aspect { font-size: .7rem; color: var(--gold-dim); line-height: 1.4; }
.transit-note {
    margin: .35rem 0 0; font-size: .74rem; line-height: 1.5;
    color: var(--text-soft); border-top: 1px solid var(--line); padding-top: .35rem;
}
.transit-note.is-pending { color: var(--muted-dim); font-style: italic; }
.transit-notes-status {
    display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
    margin-top: .85rem;
}

.dream-series-list { display: flex; flex-direction: column; gap: .85rem; }
.dream-series-item {
    padding-bottom: .85rem; border-bottom: 1px solid var(--line);
}
.dream-series-item:last-child { border-bottom: 0; padding-bottom: 0; }
.dream-series-head { display: flex; align-items: baseline; gap: .6rem; margin-bottom: .3rem; }
.dream-series-head strong { font-weight: 500; font-size: .9rem; color: var(--text); }
.dream-series-item p { font-size: .85rem; line-height: 1.65; }

.forecast-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: .5rem; margin-top: .5rem;
}
.forecast-month {
    padding: .7rem .75rem; border-radius: var(--radius-sm);
    border: 1px solid var(--line); background: var(--surface-1);
    display: flex; flex-direction: column; gap: .2rem;
    text-align: left; cursor: pointer; font: inherit; color: inherit;
    transition: border-color .15s, background .15s;
}
.forecast-month:hover { border-color: var(--gold-edge-faint); }
.forecast-month.active {
    border-color: var(--gold-edge); background: var(--surface-2);
}
.forecast-month.active .forecast-name { color: var(--gold); }
.forecast-name { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-dim); }
.forecast-number { font-size: 1.5rem; color: var(--gold); line-height: 1.1; }
.forecast-meaning { font-size: .74rem; color: var(--muted); line-height: 1.45; }

.forecast-days {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: .4rem; margin-top: .5rem;
}
.forecast-day {
    padding: .5rem .55rem; border-radius: var(--radius-sm);
    border: 1px solid var(--line); background: var(--surface-1);
    display: flex; flex-direction: column; gap: .2rem;
}
.forecast-day-date { font-size: .74rem; color: var(--muted-dim); }
.forecast-day-note {
    margin: 0; font-size: .74rem; line-height: 1.5; color: var(--text-soft);
}
.forecast-day-note.is-pending { color: var(--muted-dim); font-style: italic; }

/* ── Practice done ────────────────────────────────────────── */

.practice-done {
    display: inline-flex; align-items: center; gap: .5rem;
    margin-top: .75rem; font-size: .82rem; color: var(--muted);
    cursor: pointer;
}
.practice-done input { accent-color: var(--gold); }

/* ═══════════════════════════════════════════════════════════
   Offline banner
   ═══════════════════════════════════════════════════════════ */

#offline-host { position: relative; z-index: 60; }

.offline-banner {
    position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%);
    display: flex; align-items: center; gap: .6rem;
    padding: .55rem 1.1rem; border-radius: 999px;
    background: var(--stone-2); border: 1px solid var(--line-strong);
    box-shadow: var(--shadow); color: var(--text-soft);
    font-size: .82rem; z-index: 60;
}
.offline-banner.update { border-color: var(--gold-edge); }
.offline-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--negative); display: inline-block;
}

/* ═══════════════════════════════════════════════════════════
   Print
   ═══════════════════════════════════════════════════════════ */

@media print {
    /* Only the element marked for printing survives. The shell, the sidebar,
       the composer and every control are removed rather than hidden, so the
       printed page has no blank space where they were. */
    body.printing > *:not(#app) { display: none !important; }
    body.printing .sidebar,
    body.printing .page-head,
    body.printing .nav,
    body.printing .btn,
    body.printing .ai-reading-tools,
    body.printing .speech-btn,
    body.printing .latest-work,
    body.printing .composer,
    body.printing .chat-sidebar,
    body.printing .chat-context-panel { display: none !important; }

    body.printing .shell { display: block; }
    body.printing .main { padding: 0; }

    /* Everything except the marked scope is hidden, so a reading prints as a
       reading rather than as a screenshot of the application. */
    body.printing [data-print-target] ~ * { display: none !important; }

    body.printing {
        background: #fff !important;
        color: #111 !important;
    }
    body.printing::before { display: none !important; }
    body.printing .card,
    body.printing .guide {
        background: #fff !important;
        border: 0 !important;
        box-shadow: none !important;
        color: #111 !important;
    }
    body.printing h1, body.printing h2, body.printing h3,
    body.printing p, body.printing li, body.printing div {
        color: #111 !important;
    }
    body.printing .small-caps,
    body.printing .gold { color: #6f5423 !important; }
    body.printing .badge {
        border: 1px solid #ccc !important;
        color: #333 !important;
        background: transparent !important;
    }

    @page { margin: 18mm 16mm; }
}

/* A reading printed from a phone should not be cut at the fold. */
@media print and (max-width: 620px) {
    body.printing .main { padding: 0 !important; }
}


/* ── Chat: sources ───────────────────────────────────────── */
/* The installation answers every conversation with one model, configured on
   the server, so the chat carries no model picker. */

.chat-sources {
    display: flex; flex-wrap: wrap; align-items: center; gap: .35rem;
    padding: .5rem 1rem; border-top: 1px solid var(--line);
    background: var(--surface-1);
}
.chat-sources-label {
    font-size: .66rem; letter-spacing: .1em; text-transform: uppercase;
    color: var(--muted-dim); margin-right: .2rem;
}
.chat-source {
    font-size: .72rem; color: var(--gold-dim);
    padding: .1rem .45rem; border-radius: 999px;
    border: 1px solid var(--gold-edge-faint);
    max-width: 18rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════
   Help
   ═══════════════════════════════════════════════════════════ */

.help-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: .75rem;
    margin-bottom: 1.75rem;
}

.help-search {
    position: relative; flex: 1 1 260px; display: flex; align-items: center;
}
.help-search-icon {
    position: absolute; left: .85rem; color: var(--muted-dim);
    font-size: .95rem; pointer-events: none;
}
.help-search input {
    width: 100%; padding: .6rem .9rem .6rem 2.2rem;
    border: 1px solid var(--line); border-radius: 100px;
    background: var(--surface-1); color: var(--text);
    font: inherit; font-size: .9rem;
}
.help-search input:focus {
    outline: none; border-color: var(--gold-edge);
    background: var(--surface-2);
}
.help-search input::placeholder { color: var(--placeholder); }

.help-jump { display: flex; flex-wrap: wrap; gap: .35rem; }
.help-jump-chip {
    padding: .35rem .8rem; border-radius: 100px;
    border: 1px solid var(--line); background: var(--surface-1);
    color: var(--muted); font: inherit; font-size: .78rem; cursor: pointer;
    transition: border-color var(--ease), color var(--ease);
}
.help-jump-chip:hover { border-color: var(--gold-edge-soft); color: var(--text); }

.help-group { margin-bottom: 2rem; scroll-margin-top: 1.5rem; }
.help-group-title {
    font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
    color: var(--muted-dim); font-weight: 500;
    margin-bottom: .85rem; padding-bottom: .5rem;
    border-bottom: 1px solid var(--line);
}

/* ── One section ──────────────────────────────────────────── */

.help-card { padding: 0; overflow: hidden; }

.help-card-head {
    display: flex; align-items: flex-start; gap: .85rem;
    width: 100%; padding: 1rem 1.15rem;
    background: none; border: 0; color: inherit; font: inherit;
    text-align: left; cursor: pointer;
    transition: background var(--ease);
}
.help-card-head:hover { background: var(--surface-1); }
.help-card-head:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }

.help-glyph {
    flex: 0 0 auto; width: 1.6rem; text-align: center;
    color: var(--gold); font-size: 1.05rem; line-height: 1.5;
}
.help-head-text { flex: 1; display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.help-title { font-size: .98rem; color: var(--text); }
.help-summary { font-size: .84rem; color: var(--muted); line-height: 1.55; }

/* A caret that turns when the card opens, so the control reads as a
   disclosure rather than as a link. */
.help-caret {
    flex: 0 0 auto; width: .5rem; height: .5rem; margin-top: .45rem;
    border-right: 1.5px solid var(--muted-dim);
    border-bottom: 1.5px solid var(--muted-dim);
    transform: rotate(45deg);
    transition: transform var(--ease), border-color var(--ease);
}
.help-card.is-open .help-caret {
    transform: rotate(-135deg); border-color: var(--gold);
}

.help-body {
    padding: 0 1.15rem 1.15rem 3.6rem;
    border-top: 1px solid var(--line);
    padding-top: 1rem;
}
.help-body p {
    font-size: .88rem; line-height: 1.75; color: var(--text-soft);
    margin-bottom: .85rem;
}
.help-body p:last-child { margin-bottom: 0; }
.help-body strong { color: var(--text); font-weight: 500; }

.help-list {
    list-style: none; padding: 0; margin: 0 0 .85rem;
}
.help-list:last-child { margin-bottom: 0; }
.help-list li {
    position: relative; padding-left: 1.1rem; margin-bottom: .4rem;
    font-size: .88rem; line-height: 1.7; color: var(--text-soft);
}
.help-list li::before {
    content: '·'; position: absolute; left: .3rem;
    color: var(--gold); font-weight: 600;
}

.help-actions { margin-top: 1rem; }

@media (max-width: 620px) {
    .help-body { padding-left: 1.15rem; }
    .help-card-head { padding: .85rem 1rem; }
    .help-jump { width: 100%; }
}
