/*
 * Tokens. Every colour on every page comes from here: the base (dark by default, light under
 * [data-theme="light"]), the semantic accents, the surfaces, and the planets. The chart palette
 * (Phase 3) overrides only --gold/--gold-rgb/--sky/--sky-rgb and the two atmosphere washes as
 * inline variables on <html>, over either base.
 */
:root {
    color-scheme: dark;
    /* base */
    --bg: #08090f;
    --bg-rgb: 8, 9, 15;
    --bg-2: #10131c;
    --bg-2-rgb: 16, 19, 28;
    --panel: rgba(var(--bg-2-rgb), 0.82);
    --cream: #f3eadc;
    --cream-dim: #d2c6b0;
    --cream-rgb: 244, 234, 216;
    --line: rgba(var(--cream-rgb), 0.14);
    /* accents */
    --gold: #d4b483;
    --gold-rgb: 212, 180, 131;
    --gold-2: #9a7b4f;
    --inner: #c9a0d4;
    --sky: #8fb0e4;
    --sky-rgb: 143, 176, 228;
    --accent-hover: #ffffff;
    --text-on-accent: #14110c;
    /* verdicts */
    --ok: #9bc4a0;
    --ok-rgb: 155, 196, 160;
    --warn: #e07a6a;
    --warn-rgb: 224, 122, 106;
    --danger: #e7b6b6;
    --danger-rgb: 231, 182, 182;
    --danger-text: #e8a0a0;
    /* surfaces: translucent tints over the base, solid fills for fields and sheets */
    --surface-rgb: 255, 255, 255;
    --surface-1: rgba(var(--surface-rgb), 0.03);
    --surface-2: rgba(var(--surface-rgb), 0.05);
    --surface-3: rgba(var(--surface-rgb), 0.08);
    --surface-solid: #171b27;
    --field-bg: #0c0e16;
    --sheet-top: #1c2130;
    --sheet-bottom: #0c0f18;
    --orb-deep: #4a3a6a;
    --star: #ffffff;
    --shadow-rgb: 0, 0, 0;
    --shadow: 0 24px 80px rgba(var(--shadow-rgb), 0.45);
    /* the room's washes */
    --atmosphere-a: rgba(92, 64, 140, 0.35);
    --atmosphere-b: rgba(40, 70, 130, 0.28);
    --glow-b: rgba(120, 90, 180, 0.18);
    /* the planets, as the wheel, the mandala and the tables draw them */
    --planet-sun: #e3b04b;
    --planet-moon: #dfe6ee;
    --planet-mars: #e07a6a;
    --planet-mercury: #7fc8a9;
    --planet-jupiter: #f2d16b;
    --planet-venus: #f0b7d3;
    --planet-saturn: #8fb0e4;
    --planet-rahu: #a99bb8;
    --planet-ketu: #b89b7c;
    --planet-outer: #99aaaa;
    /* the mandala's six petals */
    --petal-kama: #e7a8b8;
    --petal-krodha: #e08a6a;
    --petal-lobha: #e0c36a;
    --petal-moha: #9bb7e3;
    --petal-mada: #c9a0d4;
    --petal-matsarya: #8ecfbf;
    --serif: "Fraunces", "Palatino Linotype", serif;
    --sans: "Outfit", system-ui, sans-serif;
    --type-label: 0.6875rem;
    --type-meta: 0.8125rem;
    --type-you: 0.9375rem;
    --type-chat: 0.9375rem;
    --type-title: 1.375rem;
    --leading-chat: 1.68;
    --measure: 44rem;
}

/* The light room: parchment and ink; the same tokens, darker accents so text keeps its contrast. */
[data-theme="light"] {
    color-scheme: light;
    --bg: #f6f1e8;
    --bg-rgb: 246, 241, 232;
    --bg-2: #fffdf9;
    --bg-2-rgb: 255, 253, 249;
    --panel: rgba(var(--bg-2-rgb), 0.9);
    --cream: #1d1a16;
    --cream-dim: #5c5346;
    --cream-rgb: 29, 26, 22;
    --line: rgba(var(--cream-rgb), 0.14);
    --gold: #7a5c2a;
    --gold-rgb: 122, 92, 42;
    --gold-2: #7f6130;
    --inner: #7a4f8a;
    --sky: #3b5f9e;
    --sky-rgb: 59, 95, 158;
    --accent-hover: #5e4620;
    --text-on-accent: #fff8ec;
    --ok: #2f7a45;
    --ok-rgb: 47, 122, 69;
    --warn: #b8412e;
    --warn-rgb: 184, 65, 46;
    --danger: #a83a3a;
    --danger-rgb: 168, 58, 58;
    --danger-text: #9a2f2f;
    --surface-rgb: 29, 26, 22;
    --surface-solid: #ffffff;
    --field-bg: #ffffff;
    --sheet-top: #fffdf9;
    --sheet-bottom: #f1eadf;
    --orb-deep: #b9a3c9;
    --star: #7a5c2a;
    --shadow: 0 24px 80px rgba(var(--shadow-rgb), 0.14);
    --atmosphere-a: rgba(180, 150, 220, 0.3);
    --atmosphere-b: rgba(150, 180, 230, 0.28);
    --glow-b: rgba(160, 130, 210, 0.16);
    --planet-sun: #b4780a;
    --planet-moon: #5b6b7c;
    --planet-mars: #b8412e;
    --planet-mercury: #2c8a5c;
    --planet-jupiter: #a8840e;
    --planet-venus: #b45a86;
    --planet-saturn: #3b5f9e;
    --planet-rahu: #6d5d84;
    --planet-ketu: #7d6142;
    --planet-outer: #5f6f6f;
    --petal-kama: #b8536f;
    --petal-krodha: #b8542e;
    --petal-lobha: #9c7d12;
    --petal-moha: #3f6cae;
    --petal-mada: #7a4f8a;
    --petal-matsarya: #2b8272;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    min-height: 100%;
    color: var(--cream);
    font-family: var(--sans);
    background: var(--bg);
}
html:has(body.sitting-page),
body.sitting-page {
    height: 100%;
    overflow: hidden;
}
body.sitting-page {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    max-height: 100dvh;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.atmosphere {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    background:
        radial-gradient(900px 500px at 18% -10%, var(--atmosphere-a), transparent 55%),
        radial-gradient(700px 480px at 100% 90%, var(--atmosphere-b), transparent 50%),
        var(--bg);
}
.glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.45;
}
.glow-a {
    width: 280px;
    height: 280px;
    left: 18%;
    top: 22%;
    background: rgba(var(--gold-rgb), 0.16);
}
.glow-b {
    width: 360px;
    height: 360px;
    right: -40px;
    bottom: 10%;
    background: var(--glow-b);
}
.star-field span {
    position: absolute;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background: var(--star);
    opacity: 0.55;
}

.site-header, .sitting-layout, .arrive, .sheet, .crisis {
    position: relative;
    z-index: 1;
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.1rem 1.25rem;
    max-width: 1680px;
    width: 100%;
    margin: 0 auto;
    flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 0.9rem; }
.brand-mark {
    width: 34px;
    height: 34px;
    color: var(--gold);
}
.brand h1 {
    margin: 0;
    font-family: var(--serif);
    font-size: 1.45rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.brand-sub {
    margin: 0.1rem 0 0;
    color: var(--cream-dim);
    font-size: 0.8rem;
}
.header-meta {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}
.header-link {
    appearance: none;
    background: none;
    border: 0;
    color: var(--cream-dim);
    font: inherit;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-decoration: none;
    cursor: pointer;
    padding: 0.2rem 0;
}
.header-link:hover { color: var(--gold); }
.header-link[hidden] { display: none; }

/* Reviewer / admin toolbelt — only rendered for those roles; the pages behind it refuse everyone else. */
.toolbelt {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.9rem;
    max-width: 1680px;
    width: 100%;
    margin: 0 auto;
    padding: 0.45rem 1.25rem 0.6rem;
    border-top: 1px solid var(--line);
    background: rgba(var(--bg-rgb), 0.72);
    backdrop-filter: blur(8px);
    font-size: 0.74rem;
    letter-spacing: 0.04em;
}
.toolbelt[hidden] { display: none; }
.toolbelt-label {
    color: var(--gold);
    text-transform: uppercase;
    font-size: 0.62rem;
    letter-spacing: 0.14em;
    margin-right: 0.3rem;
}
.toolbelt a { color: var(--cream-dim); text-decoration: none; padding: 0.15rem 0; }
.toolbelt a:hover { color: var(--gold); }
.turn-tools { margin-top: 0.4rem; display: flex; gap: 0.5rem; }
.turn-tools a {
    font-size: 0.66rem;
    letter-spacing: 0.06em;
    color: var(--sky);
    text-decoration: none;
    border: 1px solid rgba(var(--sky-rgb), 0.35);
    border-radius: 999px;
    padding: 0.1rem 0.55rem;
}
.turn-tools a:hover { border-color: var(--sky); }

.sitting-layout {
    max-width: 1680px;
    width: 100%;
    margin: 0 auto;
    padding: 0 1.25rem 0.85rem;
    display: grid;
    grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
    gap: 1.1rem;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    align-items: stretch;
}
body.has-chart .sitting-layout {
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr) minmax(220px, 280px);
}

.instrument-column {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 0.15rem 0;
    gap: 0.55rem;
    min-height: 0;
    overflow: hidden;
}
/* Phone only: the strip that opens the chart sheet, the sheet's own head, and its foot that leads back to the sitting. */
.instrument-dock, .instrument-sheet-head, .sheet-foot { display: none; }
.wheel-wait {
    margin: 0;
    padding: 2.5rem 1rem;
    color: var(--cream-dim);
    font-size: 0.85rem;
    text-align: center;
}
.instrument-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.instrument-toolbar:not(:has(:not([hidden]))) { display: none; }
.toggle {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 999px;
    overflow: hidden;
}
.toggle[hidden] { display: none !important; }
.toggle button {
    appearance: none;
    background: none;
    border: 0;
    color: var(--cream-dim);
    font: inherit;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    padding: 0.3rem 0.75rem;
    cursor: pointer;
}
.toggle button.active {
    background: rgba(var(--gold-rgb), 0.18);
    color: var(--gold);
}
.chart-pane, .inner-pane {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
    overflow: hidden;
}
.inner-pane { align-items: center; }
.chart-pane[hidden], .inner-pane[hidden] { display: none !important; }
.instrument-wheel {
    width: 100%;
    max-height: min(380px, calc(100% - 4.5rem));
    flex: 1 1 auto;
    min-height: 180px;
}
/* Scales with its box (the generic .wheel svg rule below would keep the aspect-ratio height and overflow into the inspector). */
.chart-pane .instrument-wheel svg { width: 100%; height: 100%; display: block; }
.instrument-inspector {
    flex-shrink: 0;
    max-height: 7.5rem;
    overflow-y: auto;
    background: rgba(var(--surface-rgb), 0.03);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.55rem 0.7rem;
    font-size: 0.78rem;
    line-height: 1.45;
}
.instrument-inspector h3 {
    margin: 0 0 0.2rem;
    font-family: var(--serif);
    font-weight: 500;
    font-size: 0.95rem;
}
.instrument-inspector .meta { margin: 0; color: var(--cream-dim); font-size: 0.78rem; }
.instrument-inspector .kv {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.1rem 0.55rem;
    margin: 0.25rem 0 0;
    font-size: 0.74rem;
}
.instrument-inspector .kv span:nth-child(odd) {
    color: var(--gold);
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
/* A house the last reading weighed: its band and role beside the title, the lit houses to move between, and what was said of it. */
.instrument-inspector.has-reading {
    /* Takes the room the wheel leaves in the column; when the column is short it gives way first and scrolls. */
    flex: 0 6 auto;
    min-height: 8rem;
    max-height: none;
}
/* …but the wheel stays large enough to keep tapping houses on. */
body:not(.instrument-open) .chart-pane:has(.instrument-inspector.has-reading) .instrument-wheel { min-height: 300px; }
.instrument-inspector .house-band {
    display: inline-block;
    vertical-align: middle;
    margin-left: 0.4rem;
    padding: 0.08rem 0.5rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-family: var(--sans);
    font-size: 0.6rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--cream-dim);
}
.instrument-inspector .house-band.strong { color: var(--ok); border-color: rgba(var(--ok-rgb), 0.45); }
.instrument-inspector .house-band.strained { color: var(--danger); border-color: rgba(var(--danger-rgb), 0.45); }
.instrument-inspector .house-band.mixed { color: var(--gold); border-color: rgba(var(--gold-rgb), 0.45); }
.instrument-inspector .lit-strip { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.3rem 0 0.15rem; }
.instrument-inspector .lit-chip {
    appearance: none;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(var(--surface-rgb), 0.03);
    color: var(--cream-dim);
    font: inherit;
    font-family: var(--sans);
    font-size: 0.66rem;
    letter-spacing: 0.04em;
    padding: 0.12rem 0.55rem;
    cursor: pointer;
}
.instrument-inspector .lit-chip:hover { color: var(--cream); }
.instrument-inspector .lit-chip.active { background: rgba(var(--gold-rgb), 0.18); border-color: rgba(var(--gold-rgb), 0.5); color: var(--gold); }
.instrument-inspector .told { margin-top: 0.45rem; padding-top: 0.4rem; border-top: 1px solid var(--line); }
.instrument-inspector .told-head {
    margin: 0 0 0.2rem;
    color: var(--gold);
    font-family: var(--sans);
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.instrument-inspector .told p.fact, .instrument-inspector .told p.meaning { margin: 0.15rem 0; font-size: 0.76rem; line-height: 1.45; }
.instrument-inspector .told p.meaning { color: var(--cream-dim); font-style: italic; }
.instrument-inspector .told p.heard { opacity: 0.68; }
.instrument-inspector .told-none { margin-top: 0.35rem; }

.wheel svg { width: 100%; height: auto; display: block; }
.wheel .cell { fill: rgba(var(--surface-rgb), 0.02); stroke: var(--line); stroke-width: 1; cursor: pointer; transition: fill 0.15s; }
.wheel .cell:hover, .wheel .cell.lit { fill: rgba(var(--gold-rgb), 0.14); }
.wheel .cell.hit { fill: rgba(var(--gold-rgb), 0.2); stroke: var(--gold); }
.wheel .cell.lagna { fill: rgba(var(--sky-rgb), 0.12); }
.wheel .cell.lagna.hit { fill: rgba(var(--gold-rgb), 0.22); }
.wheel .sign-no { font-family: var(--sans); font-size: 10px; fill: var(--cream-dim); pointer-events: none; }
.wheel .sign-name { font-family: var(--sans); font-size: 8.5px; fill: var(--cream-dim); pointer-events: none; letter-spacing: 0.04em; }
.wheel .planet { font-family: var(--sans); font-size: 11px; font-weight: 600; cursor: pointer; }
.wheel .planet.retro { text-decoration: underline; }
.wheel .planet.hit { filter: drop-shadow(0 0 3px currentColor); }
.wheel .lagna-mark { stroke: var(--sky); stroke-width: 1.5; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 0.35rem; vertical-align: middle; }
.ov-label {
    font-size: 0.62rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gold);
}

.mandala-root {
    width: min(420px, 100%);
    max-height: min(420px, calc(100% - 3.5rem));
    min-height: 160px;
    aspect-ratio: 1;
    flex: 1 1 auto;
    margin: 0 auto;
    filter: drop-shadow(0 20px 50px rgba(var(--shadow-rgb), 0.35));
}
.mandala-root svg { width: 100%; height: 100%; display: block; }
.mandala-caption {
    margin: 0;
    max-width: 26rem;
    text-align: center;
    color: var(--cream-dim);
    font-size: 0.88rem;
    line-height: 1.4;
    flex-shrink: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.sky-weather {
    margin: 0;
    max-width: 24rem;
    text-align: center;
    color: var(--gold);
    cursor: pointer;
    font-style: italic;
    font-family: var(--serif);
    font-size: 0.92rem;
    line-height: 1.35;
    flex-shrink: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.lens-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    justify-content: center;
    max-width: 28rem;
    flex-shrink: 0;
}
.chip {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.28rem 0.75rem;
    font-size: 0.72rem;
    color: var(--cream-dim);
    background: rgba(var(--surface-rgb), 0.03);
    cursor: pointer;
    font-family: var(--sans);
}

.sitting-column {
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: 100%;
    height: 100%;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    overflow: hidden;
}
/* The sitting head is one slim row so the thread keeps the height: the friend's name on the left; the
   tone picker, the chart's reason for the tone and the clock (lord · topic) in a line on the right. */
.sitting-head {
    padding: 0.55rem 1.5rem 0.45rem;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}
.sitting-head .eyebrow { display: none; }
.sitting-head h2 {
    margin: 0;
    font-family: var(--serif);
    font-weight: 400;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
    line-height: 1.2;
    white-space: nowrap;
}
.session-status {
    margin: 0;
    color: var(--gold);
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    line-height: 1.35;
    flex: 0 0 auto;
    max-width: 20rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.session-status[hidden] { display: none; }
/* A dot between the tone's reason and the clock when both are there. */
.tone-why:not([hidden]) + .session-status::before { content: "\00b7"; margin-right: 0.5rem; color: var(--cream-dim); }
.sitting-head-side {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 1;
    min-width: 0;
    max-width: 78%;
}
.tone-pick {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.2rem 0.4rem 0.2rem 0.75rem;
    background: rgba(var(--surface-rgb), 0.02);
    color: var(--cream-dim);
    cursor: pointer;
    flex-shrink: 0;
}
.tone-label {
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.tone-pick select {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    background: transparent;
    color: var(--gold);
    font-family: var(--sans);
    font-size: 0.78rem;
    padding: 0.1rem 1.1rem 0.1rem 0.2rem;
    cursor: pointer;
    background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%);
    background-position: calc(100% - 0.55rem) 55%, calc(100% - 0.3rem) 55%;
    background-size: 0.25rem 0.25rem, 0.25rem 0.25rem;
    background-repeat: no-repeat;
}
.tone-pick select:focus-visible { outline: 1px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.tone-pick select option { background: var(--field-bg); color: var(--cream); }
.tone-why {
    margin: 0;
    font-family: var(--sans);
    font-size: 0.7rem;
    line-height: 1.4;
    color: var(--cream-dim);
    flex: 0 1 auto; /* the first to give way: the clock keeps its words */
    min-width: 0;
    max-width: 22rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tone-why[hidden] { display: none; }
/* Friend | Astrologer: the two voicings of one reply, switched on the card. */
.voice-tabs {
    display: inline-flex;
    gap: 0.15rem;
    margin: 0 0 0.6rem;
    padding: 0.15rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(var(--surface-rgb), 0.02);
}
.voice-tabs button {
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--cream-dim);
    font-family: var(--sans);
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.28rem 0.75rem;
    cursor: pointer;
}
.voice-tabs button.active {
    background: rgba(var(--gold-rgb), 0.18);
    color: var(--gold);
}
.voice-tabs button:focus-visible { outline: 1px solid var(--gold); outline-offset: 1px; }
.turn-card .friend.astrologer { color: var(--cream-dim); }
/* The composer closed to visitors. */
.composer.locked textarea { opacity: 0.55; cursor: not-allowed; }
.composer-lock {
    margin: 0.45rem max(1.25rem, calc((100% - var(--measure)) / 2)) 0.9rem;
    font-family: var(--sans);
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--cream-dim);
}
.composer-lock a { color: var(--gold); }
.composer-lock[hidden] { display: none; }
.arrive-signin { display: flex; flex-direction: column; gap: 0.6rem; }
.arrive-btn { text-align: center; text-decoration: none; }
.cards {
    flex: 1;
    overflow-y: auto;
    padding: 0.35rem max(1.25rem, calc((100% - var(--measure)) / 2)) 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
    min-height: 0;
    scroll-padding-bottom: 1.25rem;
    -webkit-overflow-scrolling: touch;
}
.cards::-webkit-scrollbar { width: 8px; }
.cards::-webkit-scrollbar-thumb {
    background: rgba(var(--cream-rgb), 0.16);
    border-radius: 99px;
}
.empty-state {
    margin: auto 0;
    max-width: var(--measure);
    padding: 1.25rem 0.15rem 1.75rem;
    color: var(--cream-dim);
    font-family: var(--serif);
    font-size: 1.15rem;
    line-height: 1.5;
    font-style: italic;
}
.empty-state[hidden] { display: none !important; }
.history-item {
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--line);
    color: var(--cream-dim);
    padding: 0.5rem 0;
    font-family: var(--sans);
    font-size: var(--type-meta);
    line-height: 1.4;
    cursor: pointer;
}
.history-item:hover { color: var(--cream); }
.turn-card {
    width: 100%;
    background: rgba(var(--surface-rgb), 0.035);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 1rem 1.15rem 1.1rem;
}
.turn-card.user {
    align-self: flex-end;
    width: auto;
    max-width: 85%;
    background: transparent;
    border: 0;
    padding: 0.15rem 0.1rem 0;
    text-align: right;
}
.turn-who {
    display: block;
    margin: 0 0 0.35rem;
    font-family: var(--sans);
    font-size: var(--type-label);
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gold-2);
}
.turn-card.user .turn-who { color: var(--cream-dim); }
.turn-card.user .you {
    font-family: var(--sans);
    font-size: var(--type-you);
    font-weight: 500;
    line-height: 1.5;
    margin: 0;
    color: var(--cream-dim);
}
.turn-card .friend {
    font-family: var(--sans);
    font-size: var(--type-chat);
    font-weight: 400;
    line-height: var(--leading-chat);
    letter-spacing: 0.01em;
    margin: 0;
    color: var(--cream);
    overflow-wrap: anywhere;
    text-wrap: pretty;
}
.turn-card .friend p {
    margin: 0 0 0.85em;
}
.turn-card .friend p:last-child {
    margin-bottom: 0;
}
.turn-card .friend p.ask {
    color: var(--gold);
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.02em;
}
/* The small note under a reply while something is missing: sign in, or add the birth. */
.turn-card .turn-note {
    margin: 0.7rem 0 0;
    padding-top: 0.55rem;
    border-top: 1px dashed rgba(var(--gold-rgb), 0.25);
    font-family: var(--sans);
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--cream-dim);
}
.turn-card .turn-note .link-btn,
.turn-card .turn-note a {
    color: var(--gold);
    font-size: inherit;
    text-decoration: underline;
    text-underline-offset: 0.15em;
    white-space: nowrap;
}
/* The arrival: the chart's first word after the birth is saved. */
.turn-card.arrival {
    border-color: rgba(var(--gold-rgb), 0.35);
    background: linear-gradient(180deg, rgba(var(--gold-rgb), 0.07), rgba(var(--surface-rgb), 0.03));
}
.turn-card.arrival .arrival-head {
    margin: 0 0 0.7rem;
    font-family: var(--serif);
    font-size: 1.08rem;
    line-height: 1.45;
    color: var(--gold);
}
.turn-card.arrival.pending .arrival-wait {
    margin: 0;
    font-family: var(--sans);
    font-size: var(--type-chat);
    color: var(--cream-dim);
    animation: arrival-breathe 1.6s ease-in-out infinite;
}
@keyframes arrival-breathe {
    0%, 100% { opacity: 0.45; }
    50% { opacity: 1; }
}
/* The reply's place while it is made: three breathing dots and a line that turns over. */
.turn-card.pending .friend.waiting {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 1.6rem;
}
.turn-card.pending .wait-line {
    margin: 0;
    font-family: var(--sans);
    font-size: 0.88rem;
    color: var(--cream-dim);
    animation: arrival-breathe 1.6s ease-in-out infinite;
}
.wait-dots {
    display: inline-flex;
    gap: 0.3rem;
    flex: none;
}
.wait-dots i {
    width: 0.42rem;
    height: 0.42rem;
    border-radius: 50%;
    background: var(--gold);
    opacity: 0.3;
    animation: wait-dot 1.2s ease-in-out infinite;
}
.wait-dots i:nth-child(2) { animation-delay: 0.2s; }
.wait-dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes wait-dot {
    0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) {
    .wait-dots i, .turn-card.pending .wait-line { animation: none; opacity: 0.8; }
}
.arrival-areas {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.4rem;
    margin-top: 0.9rem;
}
.arrival-area {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(var(--surface-rgb), 0.03);
    color: var(--cream);
    font-family: var(--sans);
    text-align: left;
    cursor: pointer;
}
.arrival-area:hover { border-color: var(--gold); }
.arrival-area .area-name { font-size: 0.78rem; letter-spacing: 0.04em; }
.arrival-area .area-band {
    font-size: 0.66rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--cream-dim);
}
.arrival-area.band-strong .area-band { color: var(--sky); }
.arrival-area.band-strained .area-band { color: var(--danger); }
.arrival-area.band-mixed .area-band { color: var(--gold); }
/* The wall: the free readings are spent; the reply says so, the card under it opens Plus. */
.turn-card.paywall {
    border-color: rgba(var(--gold-rgb), 0.45);
    background: linear-gradient(180deg, rgba(var(--gold-rgb), 0.09), rgba(var(--surface-rgb), 0.03));
}
.paywall-card {
    margin-top: 0.9rem;
    padding-top: 0.8rem;
    border-top: 1px dashed rgba(var(--gold-rgb), 0.35);
}
.paywall-card.paid { opacity: 0.55; }
.paywall-card.paid .plan-actions { display: none; }
.paywall-what {
    margin: 0 0 0.7rem;
    font-family: var(--sans);
    font-size: 0.86rem;
    line-height: 1.5;
    color: var(--cream-dim);
}
/* The month under the day pass: its own line and buttons, set apart by a hair. */
.paywall-monthly {
    margin-top: 0.9rem;
    padding-top: 0.7rem;
    border-top: 1px dashed rgba(var(--gold-rgb), 0.25);
}
.paywall-card.paid .paywall-monthly { display: none; }
/* "Have a code?" under the buttons: one line, an input that opens on demand. */
.plan-code { margin-top: 0.6rem; font-family: var(--sans); }
.plan-code-line { margin: 0; font-size: 0.8rem; color: var(--cream-dim); }
.plan-code-line a { color: var(--gold); }
.plan-code-form { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-top: 0.45rem; }
.plan-code-form[hidden] { display: none; }
.plan-code-form input { flex: 0 1 11rem; min-width: 0; padding: 0.4rem 0.6rem; font: inherit; font-size: 0.85rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--cream); background: rgba(var(--surface-rgb), 0.04); border: 1px solid var(--line); border-radius: 8px; }
.plan-code-form input:focus { outline: none; border-color: rgba(var(--gold-rgb), 0.6); }
.plan-code .form-error { margin: 0.3rem 0 0; }
.paywall-card.paid .plan-code { display: none; }
.plan-founding { margin: 0.4rem 0 0; font-family: var(--sans); font-size: 0.8rem; color: var(--gold); }
.plan-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
}
.plan-note {
    margin: 0;
    font-family: var(--sans);
    font-size: 0.8rem;
    color: var(--cream-dim);
}
/* The one-tap offer after the arrival: the room in the chart's colours, three swatches, two buttons. */
.turn-card.offer {
    border-style: dashed;
    border-color: rgba(var(--gold-rgb), 0.35);
}
.offer-ask {
    margin: 0 0 0.6rem;
    font-family: var(--serif);
    font-size: 1.02rem;
    line-height: 1.45;
    color: var(--cream);
}
.offer-why {
    margin: 0.55rem 0 0.75rem;
    font-family: var(--sans);
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--cream-dim);
}
.palette-swatches {
    display: flex;
    gap: 0.45rem;
    margin: 0.2rem 0 0.4rem;
}
.swatch {
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 50%;
    border: 1px solid rgba(var(--surface-rgb), 0.18);
    box-shadow: 0 0 0 3px rgba(var(--bg-rgb), 0.6);
}
/* The chip by the composer: what is left free, or the Plus pass and its end. */
.plan-chip {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.6rem;
    padding: 0 max(1.2rem, calc((100% - var(--measure)) / 2)) 0.35rem;
    font-family: var(--sans);
    font-size: 0.74rem;
    letter-spacing: 0.03em;
    color: var(--cream-dim);
    flex-shrink: 0;
}
.plan-chip[hidden] { display: none; }
.plan-chip-text.short { display: none; }
.plan-chip.plus .plan-chip-text { color: var(--gold); }
.plan-chip.spent .plan-chip-text { color: var(--danger); }
.plan-chip-link {
    color: var(--gold);
    text-decoration: none;
    border: 1px solid rgba(var(--gold-rgb), 0.4);
    border-radius: 999px;
    padding: 0.12rem 0.55rem;
}
.plan-chip-link:hover { background: rgba(var(--gold-rgb), 0.12); }
.plan-chip.spent .plan-chip-link {
    background: var(--gold);
    color: var(--text-on-accent);
    border-color: var(--gold);
}
.fact-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.75rem;
}
.fact-chip {
    border: 1px solid rgba(var(--gold-rgb), 0.35);
    color: var(--gold);
    background: rgba(var(--gold-rgb), 0.08);
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    cursor: pointer;
    font-family: var(--sans);
}
.fact-chip:hover { border-color: var(--gold); }
.lens-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.lens-block h3 {
    margin: 0 0 0.4rem;
    font-size: var(--type-label);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-weight: 600;
}
.lens-block.inner h3 { color: var(--inner); }
.lens-block.sky h3 { color: var(--sky); }
.lens-block p {
    margin: 0;
    font-family: var(--sans);
    font-size: var(--type-chat);
    line-height: var(--leading-chat);
    color: var(--cream);
    white-space: pre-wrap;
}
.rhyme {
    margin: 0.9rem 0 0;
    padding-top: 0.8rem;
    border-top: 1px solid var(--line);
    font-style: italic;
    color: var(--gold);
    font-family: var(--serif);
    font-size: 1.05rem;
}
.question { margin: 0.75rem 0 0; color: var(--cream); line-height: 1.5; }
.experiment { margin: 0.4rem 0 0; color: var(--cream-dim); font-size: 0.9rem; line-height: 1.45; }

.starters[hidden], .follow-ups[hidden] { display: none; }
.starters, .follow-ups {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    flex-shrink: 0;
}
/* The openers: a row under the thread while the sitting is empty. */
.starters { padding: 0 max(1.25rem, calc((100% - var(--measure)) / 2)) 0.75rem; }
/* Follow-ups sit at the foot of the friend's latest card (main.js renderFollowUps), so they scroll with
   the reply instead of taking a fixed row off the thread. */
.follow-ups {
    margin-top: 0.85rem;
    padding: 0.75rem 0 0;
    border-top: 1px solid var(--line);
}
.follow-ups:empty { display: none; }
.starter, .follow-up {
    border: 1px solid var(--line);
    background: rgba(var(--surface-rgb), 0.03);
    color: var(--cream);
    border-radius: 999px;
    padding: 0.45rem 0.9rem;
    font-size: 0.82rem;
    cursor: pointer;
    font-family: var(--sans);
}
.starter:hover, .follow-up:hover { border-color: var(--gold); color: var(--gold); }

.composer {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.7rem;
    width: 100%;
    margin: 0;
    padding: 0.7rem max(1.2rem, calc((100% - var(--measure)) / 2)) calc(0.7rem + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(var(--bg-rgb), 0.35);
    align-items: end;
    flex-shrink: 0;
}
/* One line to begin with; it grows with the question (main.js autosize) up to max-height. */
.composer textarea {
    width: 100%;
    resize: none;
    min-height: 2.75rem;
    max-height: 8.5rem;
    background: var(--field-bg);
    color: var(--cream);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0.6rem 1rem;
    font-family: var(--sans);
    font-size: 1rem;
    line-height: 1.5;
}
.composer .primary-btn { min-height: 44px; padding: 0.65rem 1.15rem; }
.composer textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(var(--gold-rgb), 0.15);
}

.sky-rail {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    min-height: 0;
    overflow-y: auto;
    padding: 0.2rem 0 0.4rem;
}
.sky-rail[hidden] { display: none !important; }
.sky-rail > .eyebrow { margin: 0.1rem 0 0; }
.rail-tile {
    background: rgba(var(--surface-rgb), 0.03);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0.7rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.rail-tile strong {
    font-family: var(--serif);
    font-weight: 500;
    font-size: 1.02rem;
}
.rail-tile small {
    color: var(--cream-dim);
    font-size: 0.75rem;
    line-height: 1.4;
}
.rail-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.35rem;
}
.rail-chips .chip { cursor: pointer; }
.rail-open {
    align-self: stretch;
    text-align: center;
    text-decoration: none;
    margin-top: 0.2rem;
}

.primary-btn {
    background: var(--cream);
    color: var(--text-on-accent);
    border: none;
    border-radius: 14px;
    padding: 0.85rem 1.25rem;
    font-family: var(--sans);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    min-height: 48px;
}
.primary-btn:hover { background: var(--accent-hover); }
.primary-btn:disabled { opacity: 0.45; cursor: default; }
.ghost-btn {
    background: transparent;
    color: var(--gold);
    border: 1px solid rgba(var(--gold-rgb), 0.45);
    border-radius: 999px;
    padding: 0.55rem 1.1rem;
    font-family: var(--sans);
    font-size: 0.86rem;
    cursor: pointer;
}
.ghost-btn:hover { background: rgba(var(--gold-rgb), 0.1); }
.text-btn {
    background: none;
    border: none;
    color: var(--cream-dim);
    cursor: pointer;
    font-family: var(--sans);
    font-size: 0.9rem;
}
.text-btn.skip { margin-top: 1rem; display: block; width: 100%; text-align: center; }

.arrive, .crisis {
    position: fixed;
    inset: 0;
    background: rgba(var(--bg-rgb), 0.78);
    backdrop-filter: blur(10px);
    display: grid;
    place-items: center;
    z-index: 20;
    padding: 1rem;
}
.sheet {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    background: rgba(var(--bg-rgb), 0.55);
    backdrop-filter: blur(18px);
}
.arrive[hidden], .sheet[hidden], .crisis[hidden], .sky-weather[hidden],
#unlock-sky[hidden], #rite-back[hidden], #rite-error[hidden], #toast[hidden],
#rite-confirm[hidden] {
    display: none !important;
}

.arrive-card, .crisis-card {
    width: min(460px, 100%);
    background: linear-gradient(180deg, var(--surface-solid) 0%, var(--bg-2) 100%);
    border: 1px solid var(--line);
    border-radius: 28px;
    padding: 2rem 1.8rem 1.7rem;
    box-shadow: var(--shadow);
    text-align: left;
}
.sheet-card {
    width: min(480px, 100%);
    position: relative;
    overflow: hidden;
    padding: 0.65rem 1.55rem calc(1.45rem + env(safe-area-inset-bottom));
    text-align: left;
    border-radius: 28px 28px 0 0;
    border: 1px solid rgba(var(--gold-rgb), 0.22);
    border-bottom: 0;
    box-shadow: 0 -24px 80px rgba(var(--shadow-rgb), 0.45);
    background:
        radial-gradient(90% 70% at 80% -10%, rgba(var(--sky-rgb), 0.16), transparent 50%),
        radial-gradient(80% 60% at 10% 0%, rgba(var(--gold-rgb), 0.2), transparent 46%),
        linear-gradient(180deg, var(--sheet-top) 0%, var(--sheet-bottom) 72%);
    animation: sheet-rise 0.48s cubic-bezier(0.22, 1, 0.36, 1);
}
.sheet-handle {
    width: 44px;
    height: 4px;
    border-radius: 999px;
    margin: 0.15rem auto 0.95rem;
    background: rgba(var(--cream-rgb), 0.28);
}
.sheet-progress {
    display: flex;
    gap: 0.4rem;
    margin: 0 0 1.15rem;
}
.sheet-progress span {
    flex: 1;
    height: 3px;
    border-radius: 99px;
    background: rgba(var(--cream-rgb), 0.1);
    transition: background 0.25s ease;
}
.sheet-progress span.on {
    background: linear-gradient(90deg, var(--gold-2), var(--cream));
}
.sheet-card .eyebrow { margin-bottom: 0.35rem; }
.sheet-card h2 {
    font-family: var(--serif);
    font-size: 1.85rem;
    font-weight: 400;
    margin: 0 0 0.45rem;
    letter-spacing: -0.02em;
}
.sheet-card .arrive-copy { margin-bottom: 1.05rem; }
.rite-confirm {
    display: grid;
    gap: 0.55rem;
    margin: 0 0 1.2rem;
}
.rite-fact {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: 0.8rem 0.95rem;
    border-radius: 16px;
    background: rgba(var(--cream-rgb), 0.04);
    border: 1px solid rgba(var(--cream-rgb), 0.1);
}
.rite-fact small {
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-size: 0.62rem;
    color: var(--gold);
    flex-shrink: 0;
}
.rite-fact strong {
    font-family: var(--serif);
    font-weight: 400;
    font-size: 1.08rem;
    text-align: right;
    color: var(--cream);
}
@keyframes sheet-rise {
    from { transform: translateY(40px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@media (min-width: 720px) {
    .sheet {
        align-items: center;
        padding: 1.5rem;
    }
    .sheet-card {
        border-radius: 28px;
        border-bottom: 1px solid rgba(var(--gold-rgb), 0.22);
        box-shadow: var(--shadow);
    }
}
.arrive-orb {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    margin-bottom: 1.1rem;
    background: radial-gradient(circle at 35% 30%, var(--cream), var(--gold) 45%, var(--orb-deep) 100%);
    box-shadow: 0 0 40px rgba(var(--gold-rgb), 0.35);
}
.eyebrow {
    margin: 0 0 0.45rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    font-size: 0.68rem;
    color: var(--gold);
}
.arrive-card h2, .crisis-card h2 {
    font-family: var(--serif);
    font-size: 2.15rem;
    font-weight: 400;
    margin: 0 0 0.55rem;
    letter-spacing: -0.02em;
}
.arrive-copy { color: var(--cream-dim); margin: 0 0 1.3rem; line-height: 1.55; }
.field { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1.1rem; font-size: 0.82rem; color: var(--cream-dim); }
.field input, .field select {
    background: var(--field-bg);
    border: 1px solid var(--line);
    color: var(--cream);
    border-radius: 12px;
    padding: 0.75rem 0.85rem;
    font-family: var(--sans);
    font-size: 1rem;
}
.sheet-card .field { margin-bottom: 0.75rem; }
.sheet-card .field span {
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 0.68rem;
    color: var(--gold);
}
.sheet-card .field input,
.sheet-card .field select {
    background: rgba(var(--bg-rgb), 0.72);
    border: 1px solid rgba(var(--cream-rgb), 0.14);
    border-radius: 14px;
    padding: 0.85rem 0.9rem;
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%),
        linear-gradient(135deg, var(--gold) 50%, transparent 50%);
    background-position: calc(100% - 16px) calc(50% - 3px), calc(100% - 10px) calc(50% - 3px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}
.sheet-card .field input {
    background-image: none;
}
.sheet-card .field select:focus,
.sheet-card .field input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(var(--gold-rgb), 0.14);
}
.place-list {
    list-style: none;
    margin: 0.15rem 0 0.8rem;
    padding: 0.25rem;
    border: 1px solid rgba(var(--cream-rgb), 0.1);
    border-radius: 16px;
    max-height: 148px;
    overflow-y: auto;
    background: rgba(var(--bg-rgb), 0.5);
}
.place-list:empty { display: none; }
.place-list button {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    color: var(--cream);
    padding: 0.65rem 0.8rem;
    cursor: pointer;
    font-family: var(--sans);
    border-radius: 10px;
    font-size: 0.88rem;
}
.place-list button:hover { background: rgba(var(--cream-rgb), 0.07); }
.rite-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 0.2rem;
}
.sheet-card .rite-actions .primary-btn { min-width: 8.5rem; }
.sheet-card .text-btn.skip {
    margin-top: 0.85rem;
    opacity: 0.75;
}
.form-error { color: var(--danger); font-size: 0.85rem; }
.date-row { display: grid; grid-template-columns: 1fr 1.2fr 1.15fr; gap: 0.55rem; }
.time-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem; }

.toast {
    position: fixed;
    bottom: 1.4rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface-solid);
    border: 1px solid var(--gold);
    color: var(--cream);
    padding: 0.7rem 1.1rem;
    border-radius: 999px;
    z-index: 30;
    font-size: 0.9rem;
}

.petal, .house-seg { cursor: pointer; }
.petal:hover, .house-seg:hover { filter: brightness(1.12); }
.house-seg.unlock { animation: ring-draw 0.9s ease; }
@keyframes ring-draw {
    from { opacity: 0; }
    to { opacity: 1; }
}

.crisis-card { text-align: center; }
.crisis-card p { color: var(--cream-dim); line-height: 1.55; }

/* ---- people alongside the speaker: scope pills, scope tags, gather card, koota strip, pair wheel ---- */
/* The row above the composer holds the scope pills and the plan chip side by side: the pills keep the
   left, the chip the right, and the row is gone when both are hidden (the phone block narrows it). */
.thread-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0 max(1.25rem, calc((100% - var(--measure)) / 2)) 0.45rem;
    flex-shrink: 0;
}
.thread-meta:not(:has(> :not([hidden]))) { display: none; }
.thread-meta .scope-pills { flex: 1 1 auto; min-width: 0; padding: 0; }
.thread-meta .plan-chip { flex: 0 1 auto; min-width: 0; margin-left: auto; padding: 0; white-space: nowrap; }
.scope-pills[hidden] { display: none; }
.scope-pills {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    padding: 0 max(1.25rem, calc((100% - var(--measure)) / 2)) 0.5rem;
    flex-shrink: 0;
}
.scope-pill {
    border: 1px solid var(--line);
    background: rgba(var(--surface-rgb), 0.03);
    color: var(--cream-dim);
    border-radius: 999px;
    padding: 0.28rem 0.75rem;
    font-size: 0.74rem;
    letter-spacing: 0.03em;
    cursor: pointer;
    font-family: var(--sans);
    transition: border-color 0.15s, color 0.15s;
}
.scope-pill:hover { border-color: var(--gold); color: var(--cream); }
.scope-pill.active { border-color: rgba(var(--gold-rgb), 0.7); color: var(--gold); background: rgba(var(--gold-rgb), 0.1); }
.scope-pill.pinned { border-color: var(--gold); color: var(--cream); background: rgba(var(--gold-rgb), 0.22); box-shadow: 0 0 0 1px rgba(var(--gold-rgb), 0.35); }
.scope-pill.waiting { border-style: dashed; }
.scope-pill.add { color: var(--gold); border-color: rgba(var(--gold-rgb), 0.35); }
.scope-hint { font-size: 0.72rem; color: var(--cream-dim); margin-left: 0.3rem; font-family: var(--sans); }
.scope-tag {
    display: inline-block;
    margin: 0 0 0.35rem 0.6rem;
    font-family: var(--sans);
    font-size: 0.66rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gold);
    border: 1px solid rgba(var(--gold-rgb), 0.4);
    border-radius: 999px;
    padding: 0.1rem 0.55rem;
    vertical-align: middle;
}
/* Confidence on the card: the verdict's band and how many of the chart's views read it that way. */
.verdict-tag {
    display: inline-block;
    margin: 0 0 0.35rem 0.6rem;
    font-family: var(--sans);
    font-size: 0.66rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--cream-dim);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.1rem 0.55rem;
    vertical-align: middle;
}
.verdict-tag.support { color: var(--ok); border-color: var(--ok); }
.verdict-tag.strain { color: var(--warn); border-color: var(--warn); }
.gather-card {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.8rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--line);
}
.primary-btn.small, .ghost-btn.small { padding: 0.45rem 0.9rem; font-size: 0.8rem; }
/* The koota strip: the read figure as the hero, the plain count beside it, eight rows (solid counted,
   hatched exempt, empty lost), a chip per dosha that stands, the ground of the exemptions. The friend's
   words show by default; .voice-astrologer on the card or the inspector swaps in the Sanskrit names. */
.koota-strip { margin-top: 0.8rem; display: flex; flex-direction: column; gap: 0.4rem; font-family: var(--sans); }
.koota-head { font-family: var(--sans); font-size: 0.76rem; color: var(--gold); letter-spacing: 0.04em; margin-bottom: 0.15rem; }
.koota-hero { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.55rem; }
.koota-hero .k-hero-label { font-size: 0.7rem; color: var(--cream-dim); letter-spacing: 0.08em; text-transform: uppercase; }
.koota-hero .k-hero-num { font-size: 1.45rem; line-height: 1; color: var(--gold); font-weight: 600; }
.koota-hero .k-hero-num small { font-size: 0.8rem; color: var(--cream-dim); font-weight: 400; }
.koota-hero .k-verdict { font-size: 0.8rem; color: var(--cream); }
.koota-hero .k-counted { margin-left: auto; font-size: 0.72rem; color: var(--cream-dim); border: 1px solid var(--line); border-radius: 999px; padding: 0.1rem 0.55rem; white-space: nowrap; }
.koota-rows { display: flex; flex-direction: column; gap: 0.25rem; }
.koota-row { display: grid; grid-template-columns: minmax(6.4rem, 9rem) 1fr 3.6rem; gap: 0 0.6rem; align-items: center; font-size: 0.74rem; color: var(--cream-dim); }
.koota-row .k-name { color: var(--cream); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.koota-row .k-bar { display: flex; height: 6px; border-radius: 3px; background: rgba(var(--surface-rgb), 0.06); overflow: hidden; }
.koota-row .k-bar i { display: block; height: 100%; }
.koota-row .k-bar i.solid { background: var(--gold); border-radius: 3px 0 0 3px; }
.koota-row .k-bar i.hatched { background: repeating-linear-gradient(135deg, var(--ok) 0 3px, rgba(var(--ok-rgb), 0.18) 3px 6px); border-radius: 0 3px 3px 0; }
.koota-row.zero .k-bar { box-shadow: inset 0 0 0 1px rgba(var(--warn-rgb), 0.45); }
.koota-row .k-pts { text-align: right; color: var(--cream); white-space: nowrap; }
.koota-row .k-pts small { color: var(--cream-dim); }
.koota-row .k-pts s { color: var(--cream-dim); }
.koota-row.zero .k-pts { color: var(--warn); }
.koota-row.exempt .k-pts { color: var(--ok); }
.koota-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.koota-chip { font-size: 0.7rem; color: var(--warn); border: 1px solid rgba(var(--warn-rgb), 0.5); border-radius: 999px; padding: 0.1rem 0.55rem; }
.koota-why { font-size: 0.72rem; line-height: 1.45; color: var(--cream-dim); }
.koota-why a { color: var(--gold); text-decoration: underline; text-underline-offset: 2px; }
.koota-strip .k-sanskrit { display: none; }
.voice-astrologer .koota-strip .k-sanskrit { display: inline; }
.voice-astrologer .koota-strip .k-plain { display: none; }
#chart-inspector .koota-strip { margin-top: 0.4rem; }
/* The gender nudge: a birth saved before the question was asked; two taps in the sitting head. */
.gender-nudge[hidden] { display: none; }
.gender-nudge { margin: 0 max(1.25rem, calc((100% - var(--measure)) / 2)) 0.6rem; padding: 0.7rem 0.9rem; border: 1px solid var(--line); border-radius: 12px; background: rgba(var(--surface-rgb), 0.03); font-family: var(--sans); }
.gender-nudge p { margin: 0 0 0.5rem; font-size: 0.82rem; color: var(--cream-dim); line-height: 1.45; }
.gender-nudge-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
/* Today's line: two sentences from the sky over the chart, at the head of the thread, on the thread's measure. */
.today-line { margin: 0 max(1.25rem, calc((100% - var(--measure)) / 2)) 0.6rem; padding: 0.75rem 0.95rem 0.7rem; border: 1px solid rgba(var(--gold-rgb), 0.35); border-radius: 14px; background: linear-gradient(180deg, rgba(var(--gold-rgb), 0.07), rgba(var(--surface-rgb), 0.02)); font-family: var(--sans); }
.today-line[hidden] { display: none !important; }
/* Once the thread has turns the card folds to one line — the day, the tone and the first sentence —
   and a click opens it; another folds it back (main.js loadToday). The phone has its own fold below. */
@media (min-width: 961px) {
    body.has-turns .today-line:not(.open) {
        display: flex;
        align-items: baseline;
        gap: 0.7rem;
        padding: 0.42rem 0.95rem;
        cursor: pointer;
    }
    body.has-turns .today-line:not(.open):hover { border-color: rgba(var(--gold-rgb), 0.6); }
    body.has-turns .today-line:not(.open) .today-line-head { flex-shrink: 0; gap: 0.5rem; }
    body.has-turns .today-line:not(.open) .today-text {
        flex: 1;
        min-width: 0;
        margin: 0;
        font-size: 0.9rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    body.has-turns .today-line:not(.open) .today-more,
    body.has-turns .today-line:not(.open) .today-actions { display: none; }
    body.has-turns .today-line:not(.open)::after { content: "\25BE"; color: var(--gold); font-size: 0.72rem; flex-shrink: 0; }
    body.has-turns .today-line.open { cursor: pointer; }
}
.today-line-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; }
.today-line-head .eyebrow { margin: 0; }
.today-tone { font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cream-dim); }
.today-tone[data-tone="support"] { color: var(--ok); }
.today-tone[data-tone="pressure"] { color: var(--warn); }
.today-text { margin: 0.35rem 0 0; font-family: var(--serif); font-size: 0.98rem; line-height: 1.45; color: var(--cream); }
.today-more { margin: 0.35rem 0 0; font-size: 0.86rem; line-height: 1.45; color: var(--cream-dim); }
.today-more[hidden] { display: none !important; }
.today-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; margin-top: 0.55rem; }
.today-actions .share-row { display: flex; flex-wrap: wrap; align-items: center; margin: 0; gap: 0.35rem; }
.today-actions .share-row .ghost-btn.small, .today-actions .share-row .primary-btn.small { border-radius: 999px; min-height: 0; text-decoration: none; }
.today-actions .share-row .share-note { font-size: 0.78rem; color: var(--gold); }
.today-actions .text-btn { font-size: 0.78rem; }
.badge-missing { display: inline-block; margin-left: 0.4rem; padding: 0.05rem 0.45rem; border-radius: 999px; border: 1px solid rgba(var(--warn-rgb), 0.5); color: var(--warn); font-family: var(--sans); font-size: 0.66rem; letter-spacing: 0.03em; vertical-align: middle; }
.rite-gender { margin-top: 0.7rem; }
.rail-match strong { font-size: 0.95rem; }
.koota-mini { display: flex; flex-direction: column; gap: 0.25rem; margin-top: 0.3rem; }
.koota-mini-bars { display: flex; align-items: flex-end; gap: 3px; height: 22px; }
.koota-mini-bars i { flex: 1; display: block; background: var(--gold); border-radius: 2px 2px 0 0; opacity: 0.85; }
.koota-mini-bars i.zero { background: var(--warn); }
.koota-mini-bars i.cancelled { background: var(--ok); }
.subject-toggle button { min-width: 3.2rem; }
.subject-toggle { flex-wrap: wrap; }
.overlay-picker { display: inline-flex; align-items: center; gap: 0.35rem; margin-left: 0.4rem; font-family: var(--sans); font-size: 0.72rem; color: var(--cream-dim); }
.overlay-picker select { background: rgba(var(--surface-rgb), 0.05); color: var(--cream); border: 1px solid var(--line); border-radius: 8px; padding: 0.15rem 0.35rem; font-size: 0.72rem; }
/* The group card: one row per member still missing a birth, and the N×N bond grid. */
.gather-row { display: flex; align-items: center; gap: 0.5rem; flex-basis: 100%; }
.gather-row .gather-name { font-family: var(--sans); font-size: 0.82rem; color: var(--cream); min-width: 5rem; }
.group-grid { margin-top: 0.8rem; }
.group-matrix { border-collapse: separate; border-spacing: 3px; font-family: var(--sans); font-size: 0.7rem; margin-top: 0.2rem; }
.group-matrix th { color: var(--cream-dim); font-weight: 400; padding: 0.1rem 0.3rem; text-align: left; white-space: nowrap; }
.group-matrix td { min-width: 2.6rem; padding: 0.25rem 0.35rem; text-align: center; border-radius: 6px; color: var(--cream); cursor: pointer; background: rgba(var(--surface-rgb), 0.05); }
.group-matrix td.support { background: rgba(var(--ok-rgb), 0.28); }
.group-matrix td.mixed { background: rgba(var(--gold-rgb), 0.22); }
.group-matrix td.strain { background: rgba(var(--warn-rgb), 0.28); }
.group-matrix td.diag { background: transparent; cursor: default; }
/* The rail tile for a group: the 24-month strip, one row per member. */
.rail-group strong { font-size: 0.95rem; }
.rail-group small { display: block; }
.timeline-strip { display: flex; flex-direction: column; gap: 3px; margin: 0.35rem 0; }
.tl-row { display: grid; grid-template-columns: 3.6rem 1fr; align-items: center; gap: 0.35rem; }
.tl-name { font-family: var(--sans); font-size: 0.68rem; color: var(--cream-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-cells { display: grid; grid-template-columns: repeat(24, 1fr); gap: 1px; height: 9px; }
.tl-cell { display: block; border-radius: 1px; background: rgba(var(--surface-rgb), 0.08); }
.tl-cell.rising { background: rgba(var(--ok-rgb), 0.85); }
.tl-cell.pressure { background: rgba(var(--warn-rgb), 0.8); }
.tl-cell.neutral { background: rgba(var(--surface-rgb), 0.12); }
.wheel .planet.overlay { font-style: italic; font-weight: 400; opacity: 0.8; }
.wheel .planet.overlay:hover { opacity: 1; }
.wheel-legend { margin: 0.35rem 0 0; font-family: var(--sans); font-size: 0.7rem; color: var(--cream-dim); text-align: center; }
.people-card { max-width: 40rem; }
.people-form { display: flex; flex-direction: column; gap: 0.7rem; }
.people-form .form-row { display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: flex-end; }
.people-form .form-row label { display: flex; flex-direction: column; gap: 0.25rem; font-family: var(--sans); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cream-dim); }
.people-form .form-row label.grow { flex: 1 1 200px; }
.people-form label.check { flex-direction: row; align-items: center; text-transform: none; letter-spacing: 0; font-size: 0.85rem; gap: 0.45rem; }
.people-form label.check.consent { align-items: flex-start; line-height: 1.45; color: var(--cream-dim); }
.people-form label.check.consent input { margin-top: 0.2rem; }
.people-form label small { text-transform: none; letter-spacing: 0; }
.people-form input, .people-form select {
    background: rgba(var(--surface-rgb), 0.04); border: 1px solid var(--line); color: var(--cream); font: inherit; font-family: var(--sans); font-size: 0.9rem;
    padding: 0.5rem 0.65rem; border-radius: 10px; min-width: 120px;
}
.people-form input:focus, .people-form select:focus { outline: 1px solid var(--gold); }
.people-form input[type=checkbox], .people-form input[type=radio] { min-width: 0; width: auto; }
.people-form .results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.people-form .results button { appearance: none; background: rgba(var(--surface-rgb), 0.03); border: 1px solid var(--line); color: var(--cream-dim); font: inherit; font-family: var(--sans); font-size: 0.8rem; text-align: left; padding: 0.4rem 0.6rem; border-radius: 8px; cursor: pointer; }
.people-form .results button:hover { color: var(--cream); border-color: var(--gold); }
.people-form .meta { font-family: var(--sans); font-size: 0.8rem; color: var(--cream-dim); margin: 0; }
.people-form .entry-mode { gap: 0.4rem 1.4rem; }

@media (max-width: 1180px) {
    body.has-chart .sitting-layout {
        grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
    }
    /* No room for a third column; on phones the rail moves into the chart sheet (main.js placeRail). */
    .sitting-layout > .sky-rail { display: none !important; }
}

@media (max-width: 960px) {
    /* Phone: the thread owns the screen. The chart / mandala is a strip that opens a full sheet. */
    .sitting-layout,
    body.has-chart .sitting-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr);
        gap: 0.45rem;
        padding: 0 0.7rem 0.5rem;
        min-height: 0;
    }
    /* One line: the brand, My chart, New sitting. The name chip, the light/dark flip and Sign out are on My chart. */
    .site-header {
        padding: 0.5rem 0.9rem 0.35rem;
        flex-wrap: nowrap;
        gap: 0.6rem;
        flex-shrink: 0;
    }
    .brand { gap: 0.55rem; min-width: 0; }
    .brand-mark { width: 24px; height: 24px; flex-shrink: 0; }
    .brand h1 { font-size: 1.1rem; white-space: nowrap; }
    .brand-sub { display: none; }
    .header-meta { gap: 0.9rem; flex-wrap: nowrap; flex-shrink: 0; }
    .header-link, .pill { font-size: 0.74rem; }
    .header-link { padding: 0.35rem 0; white-space: nowrap; }
    .site-header #who-chip, .site-header #theme-control, .site-header #logout-link { display: none; }
}
@media (max-width: 480px) {
    /* A phone: the name, Today's world, My chart and New sitting do not fit one line (about 420px),
       so the brand is the mark alone and the three links keep their words. */
    body.sitting-page .site-header .brand h1 { display: none; }
    body.sitting-page .site-header .brand-mark { width: 26px; height: 26px; }
    body.sitting-page .site-header .header-meta { gap: 1rem; }
}
@media (max-width: 960px) {
    .instrument-dock {
        display: flex;
        align-items: center;
        gap: 0.6rem;
        width: 100%;
        appearance: none;
        background: var(--panel);
        border: 1px solid var(--line);
        border-radius: 14px;
        color: var(--cream);
        font: inherit;
        padding: 0.55rem 0.85rem;
        text-align: left;
        cursor: pointer;
    }
    .instrument-dock .dock-title {
        font-family: var(--serif);
        font-size: 0.95rem;
        flex-shrink: 0;
    }
    .instrument-dock .dock-sub {
        flex: 1;
        min-width: 0;
        color: var(--cream-dim);
        font-size: 0.74rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .instrument-dock .dock-caret {
        color: var(--gold);
        font-size: 0.68rem;
        letter-spacing: 0.12em;
        text-transform: uppercase;
        flex-shrink: 0;
    }

    .instrument-column { display: none; }
    body.instrument-open .instrument-column {
        display: flex;
        position: fixed;
        inset: 0;
        z-index: 18;
        max-height: none;
        padding: calc(0.7rem + env(safe-area-inset-top)) 1rem calc(1.2rem + env(safe-area-inset-bottom));
        gap: 0.75rem;
        background: var(--bg);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .instrument-sheet-head {
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-shrink: 0;
    }
    .instrument-sheet-head .eyebrow { margin: 0; }
    .instrument-close {
        display: inline-block;
        color: var(--gold);
        font-size: 0.9rem;
        padding: 0.35rem 0.2rem;
    }
    body.instrument-open .chart-pane,
    body.instrument-open .inner-pane {
        flex: 0 0 auto;
        overflow: visible;
    }
    body.instrument-open .instrument-wheel {
        width: min(100%, 60dvh);
        max-height: none;
        min-height: 0;
        aspect-ratio: 1;
        margin: 0 auto;
        flex: 0 0 auto;
    }
    body.instrument-open .instrument-inspector {
        max-height: none;
        font-size: 0.85rem;
    }
    body.instrument-open .mandala-root {
        width: min(100%, 58dvh);
        max-height: none;
        flex: 0 0 auto;
    }
    /* The sheet's foot: where the meaning is, and one tap to get there. Sticks to the bottom while the sheet scrolls. */
    body.instrument-open .sheet-foot:not([hidden]) {
        display: flex;
        flex-direction: column;
        gap: 0.55rem;
        position: sticky;
        bottom: 0;
        /* Pushed to the foot when the sheet is short; the negative bottom margin swallows the sheet's own padding so it sits flush. */
        margin: auto -1rem calc(-1.2rem - env(safe-area-inset-bottom));
        padding: 0.8rem 1rem calc(0.9rem + env(safe-area-inset-bottom));
        background: linear-gradient(to bottom, rgba(var(--bg-rgb), 0), var(--bg) 28%);
        z-index: 2;
    }
    .sheet-foot-copy {
        margin: 0;
        color: var(--cream-dim);
        font-size: 0.86rem;
        line-height: 1.45;
    }
    .sheet-foot .primary-btn { width: 100%; }
    /* Just after the birth is saved: the button breathes once so the eye finds the way down. */
    .sheet-foot.fresh .primary-btn { animation: sheet-foot-pulse 1.6s ease-in-out 2; }
    @keyframes sheet-foot-pulse {
        0%, 100% { box-shadow: 0 0 0 0 rgba(var(--gold-rgb), 0); }
        50% { box-shadow: 0 0 0 8px rgba(var(--gold-rgb), 0.22); }
    }
    .chart-pane > .sky-rail {
        margin-top: 0.6rem;
        overflow: visible;
        padding: 0;
    }
    .chart-pane > .sky-rail > .eyebrow { display: none; }
    .mandala-caption { font-size: 0.85rem; line-height: 1.4; }

    .sitting-column { min-height: 0; height: 100%; border-radius: 18px; }
    .lens-grid { grid-template-columns: 1fr; }
    /* The friend's name and tone: one slim row. */
    .sitting-head { padding: 0.4rem 0.9rem 0.2rem; align-items: center; gap: 0.6rem; }
    .sitting-head .eyebrow { display: none; }
    .sitting-head h2 { font-size: 0.95rem; }
    .session-status { display: none; }
    .sitting-head-side { align-items: center; max-width: 60%; }
    .tone-pick { padding: 0.1rem 0.3rem 0.1rem 0.55rem; }
    .tone-pick select { font-size: 0.72rem; }
    .tone-label { display: none; }
    .tone-why { display: none; }

    /* Today's line: a slim card with one row of actions — the device's share sheet stands in for
       WhatsApp and Copy link. Once the thread has turns it folds to two lines; a tap opens it again. */
    .today-line { margin: 0 0.6rem 0.45rem; padding: 0.55rem 0.8rem 0.5rem; border-radius: 12px; }
    .today-line-head { align-items: center; gap: 0.5rem; }
    .today-line-head .eyebrow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .today-tone { flex-shrink: 0; white-space: nowrap; }
    .today-text { margin-top: 0.25rem; font-size: 0.92rem; line-height: 1.4; }
    .today-more { font-size: 0.82rem; }
    .today-actions { margin-top: 0.4rem; gap: 0.3rem 0.7rem; flex-wrap: nowrap; }
    .today-actions .share-row { margin-left: auto; flex-wrap: nowrap; }
    .today-actions .share-row > .ghost-btn { display: none; }
    body.has-turns .today-line:not(.open) { padding: 0.4rem 0.8rem 0.45rem; cursor: pointer; }
    body.has-turns .today-line:not(.open) .today-text { margin-top: 0.1rem; font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    body.has-turns .today-line:not(.open) .today-more,
    body.has-turns .today-line:not(.open) .today-actions { display: none; }
    .voice-tabs button { padding: 0.24rem 0.6rem; font-size: 0.64rem; }
    .cards { padding: 0.25rem 0.9rem 0.8rem; gap: 0.9rem; }
    .starters { padding: 0 0.9rem 0.45rem; }
    /* People and the plan share one row above the composer: the pills swipe, the chip keeps the right. */
    .thread-meta { padding: 0 0.9rem 0.4rem; }
    .thread-meta .scope-pills {
        flex: 1 1 45%;
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .thread-meta .scope-pills::-webkit-scrollbar { display: none; }
    .thread-meta .scope-pill { white-space: nowrap; flex-shrink: 0; padding: 0.24rem 0.65rem; font-size: 0.72rem; }
    .thread-meta .scope-hint { display: none; }
    .thread-meta .plan-chip { max-width: 58%; gap: 0.4rem; font-size: 0.7rem; }
    .thread-meta .plan-chip-text.long { display: none; }
    .thread-meta .plan-chip-text.short { display: inline; overflow: hidden; text-overflow: ellipsis; }
    .thread-meta .plan-chip-link { flex-shrink: 0; }
    /* Follow-ups on the friend's card: one swipeable row, so they cost the card a single line. */
    .follow-ups {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .follow-ups::-webkit-scrollbar { display: none; }
    .follow-up { white-space: nowrap; flex-shrink: 0; }
    .starter, .follow-up { font-size: 0.78rem; padding: 0.38rem 0.75rem; }
    .arrival-areas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .turn-card { padding: 0.85rem 0.95rem 0.9rem; border-radius: 14px; }
    .turn-card.user { max-width: 92%; }
    .turn-card .friend { font-size: 0.95rem; line-height: 1.62; }
    .turn-card.user .you { font-size: 0.9rem; }
    .fact-chips { margin-top: 0.6rem; }
    .empty-state { font-size: 1rem; padding: 0.75rem 0.1rem 1rem; }
    .composer {
        grid-template-columns: 1fr auto;
        gap: 0.5rem;
        padding: 0.6rem 0.75rem calc(0.6rem + env(safe-area-inset-bottom));
    }
    .composer textarea { min-height: 2.9rem; padding: 0.7rem 0.85rem; font-size: 0.98rem; }
    .composer .primary-btn { padding: 0.7rem 0.95rem; min-height: 44px; font-size: 0.9rem; }
    /* The admin lab links stay off the phone (the thread needs the line); the pages are a URL away. */
    .toolbelt { display: none; }
}

.wedge-label {
    font-family: var(--serif);
    font-size: 11px;
    fill: var(--cream-dim);
    pointer-events: none;
}
.planet-glyph, .sign-glyph {
    font-size: 12px;
    fill: var(--gold);
    pointer-events: none;
}
.sign-glyph {
    font-size: 13px;
    fill: var(--sky);
    opacity: 0.9;
}

.gate-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem 1rem 4rem;
}
.gate-card, .admin-shell {
    width: min(560px, 100%);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 1.4rem;
    padding: 1.6rem 1.5rem 1.4rem;
    backdrop-filter: blur(16px);
}
.admin-shell {
    width: min(1080px, 100%);
}
.gate-card h2, .admin-shell h2 {
    font-family: var(--serif);
    margin: 0.2rem 0 0.6rem;
}
.gate-card .field, .admin-toolbar .field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin: 0.85rem 0;
}
.gate-card input, .admin-toolbar input, .admin-toolbar select {
    background: rgba(var(--bg-rgb), 0.55);
    border: 1px solid var(--line);
    color: var(--cream);
    border-radius: 0.7rem;
    padding: 0.65rem 0.8rem;
    font: inherit;
}
.admin-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem 1rem;
    align-items: end;
    margin: 1rem 0 1.2rem;
}
.admin-toolbar .field { margin: 0; min-width: 180px; flex: 1 1 200px; }
.admin-toolbar select {
    min-height: 2.6rem;
    min-width: 200px;
    width: 100%;
    cursor: pointer;
}
.turn-list { display: flex; flex-direction: column; gap: 0.7rem; }
.accounts { margin-top: 1.4rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.accounts h2 { font-family: var(--serif); font-weight: 500; font-size: 1.2rem; margin: 0 0 0.4rem; }
.accounts .table-wrap { overflow-x: auto; }
.accounts .role { font-size: 0.72rem; margin-right: 0.5rem; white-space: nowrap; }
.accounts .ghost-btn.small { font-size: 0.68rem; padding: 0.25rem 0.55rem; margin: 0.1rem 0; }
.accounts small { color: var(--cream-dim); }
/* The admin page: the place at a glance, then the accounts with their filters, one sitting, the payments. */
.admin-shell.admin-wide { width: min(1280px, 100%); }
.admin-note { font-size: 0.76rem; color: var(--cream-dim); align-self: center; }
.admin-section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 0.8rem; margin: 0 0 0.5rem; }
.admin-section-head h2 { margin: 0; }
.admin-section-head small { color: var(--cream-dim); font-size: 0.76rem; }
.admin-section-head .ghost-btn.small { align-self: center; }
.admin-sub { font-family: var(--serif); font-weight: 500; font-size: 1rem; margin: 1rem 0 0.3rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0.7rem; margin: 0.2rem 0 0.4rem; }
.stat {
    appearance: none;
    text-align: left;
    font: inherit;
    color: var(--cream);
    border: 1px solid var(--line);
    border-radius: 1rem;
    padding: 0.75rem 0.9rem;
    background: rgba(var(--bg-rgb), 0.35);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.stat:hover { border-color: rgba(var(--gold-rgb), 0.55); background: rgba(var(--gold-rgb), 0.06); }
.stat b { font-family: var(--serif); font-size: 1.5rem; font-weight: 500; line-height: 1.1; color: var(--gold); }
.stat span { font-size: 0.78rem; }
.stat small { font-size: 0.7rem; color: var(--cream-dim); line-height: 1.4; }
.admin-filters { display: flex; flex-wrap: wrap; gap: 0.5rem 0.7rem; align-items: end; margin: 0.4rem 0 0.9rem; }
.admin-filters .field { display: flex; flex-direction: column; gap: 0.25rem; margin: 0; flex: 1 1 150px; min-width: 140px; font-size: 0.72rem; color: var(--cream-dim); }
.admin-filters .field.grow { flex: 2 1 240px; }
.admin-filters .field input, .admin-filters .field select {
    background: rgba(var(--bg-rgb), 0.55);
    border: 1px solid var(--line);
    color: var(--cream);
    border-radius: 0.7rem;
    padding: 0.45rem 0.7rem;
    font: inherit;
    font-size: 0.84rem;
    min-height: 2.3rem;
    width: 100%;
}
.admin-filters .check { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.78rem; color: var(--cream-dim); padding: 0 0 0.6rem; white-space: nowrap; }
.admin-filters .check[hidden] { display: none; }
.admin-filters .ghost-btn.small { margin-bottom: 0.3rem; }
.accounts-table td { font-size: 0.76rem; line-height: 1.45; }
.accounts-table tr.selected td { background: rgba(var(--gold-rgb), 0.08); }
.admin-paging { display: flex; align-items: center; gap: 0.8rem; font-size: 0.78rem; color: var(--cream-dim); margin: 0.6rem 0 0; }
.pill { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 0.05rem 0.5rem; font-size: 0.68rem; color: var(--cream-dim); white-space: nowrap; }
.pill.paid { color: var(--gold); border-color: rgba(var(--gold-rgb), 0.5); }
.link-btn { appearance: none; background: none; border: 0; padding: 0; color: var(--gold); font: inherit; font-size: 0.76rem; cursor: pointer; text-align: left; }
.link-btn:hover { text-decoration: underline; }
/* Referrals: the programme cards are facts, not filters; a deactivated code fades; the forms sit in a row like the filters. */
#referral-programme .stat { cursor: default; }
#referral-programme .stat:hover { border-color: var(--line); background: rgba(var(--bg-rgb), 0.35); }
#referral-codes-table tr.inactive td { opacity: 0.55; }
.referral-form { align-items: end; }
.referral-form button { margin-bottom: 0.3rem; }
#referral-ledger { margin-top: 1rem; border-top: 1px dashed var(--line); padding-top: 0.6rem; }
#referral-ledger .admin-sub { margin-top: 0.4rem; }
#referral-ledger h4.admin-sub { font-size: 0.92rem; }
/* Admin history: question, friend's reply, astrologer's reply — long text wraps in its column. */
.history-table { table-layout: fixed; min-width: 720px; }
.history-table th:nth-child(1), .history-table td.history-when { width: 11%; color: var(--cream-dim); white-space: nowrap; }
.history-table th:nth-child(2), .history-table td.history-asked { width: 19%; font-weight: 500; }
.history-table th:nth-child(3), .history-table th:nth-child(4) { width: 28%; }
.history-table td.history-reply { line-height: 1.5; overflow-wrap: anywhere; }
.history-table td.history-meta { width: 14%; font-size: 0.7rem; color: var(--cream-dim); overflow-wrap: anywhere; }
.trace-card {
    border: 1px solid var(--line);
    border-radius: 1rem;
    padding: 0.85rem 1rem;
    background: rgba(var(--bg-rgb), 0.35);
}
.trace-card summary {
    cursor: pointer;
    color: var(--gold);
    font-size: 0.92rem;
}
.trace-meta {
    color: var(--cream-dim);
    font-size: 0.8rem;
    margin: 0.35rem 0 0.6rem;
}
.step-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}
.step-table th, .step-table td {
    border-top: 1px solid var(--line);
    padding: 0.4rem 0.35rem;
    text-align: left;
    vertical-align: top;
}
.step-table code {
    font-size: 0.72rem;
    color: var(--cream-dim);
    white-space: pre-wrap;
}
.gate-error { color: var(--danger-text); font-size: 0.85rem; min-height: 1.2em; }
.gate-switch { margin: 0.4rem 0 0; }
.gate-switch .text-btn { color: var(--gold); }
.gate-card .field small { color: var(--cream-dim); font-weight: 400; }
.gate-card .field .field-hint { font-size: 0.78rem; line-height: 1.45; }
/* The yes to a WhatsApp line at sign-up: a checkbox with its reason beside it, ticked to begin with. */
.gate-card .gate-check { display: flex; align-items: flex-start; gap: 0.6rem; margin: 0.6rem 0 0.9rem; font-size: 0.82rem; line-height: 1.45; color: var(--cream-dim); cursor: pointer; }
.gate-card .gate-check input { flex: 0 0 auto; width: 1.05rem; height: 1.05rem; margin: 0.15rem 0 0; padding: 0; border: 0; background: none; accent-color: var(--gold); }
