:root {
    --bg: #0f1115;
    --panel: #171a21;
    --panel-edge: #232837;
    --text: #e7e9ee;
    --muted: #9aa3b2;
    --accent: #6c8cff;
    --moderator: #6c8cff;
    --optimist: #3fbf7f;
    --skeptic: #e8694a;
    --pragmatist: #d9a13b;
    --you: #8b93a7;
    --other: #9aa3b2;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    font-family: "Segoe UI", system-ui, sans-serif;
    background:
        radial-gradient(ellipse 90% 45% at 50% -5%, rgba(108, 140, 255, .07), transparent 70%),
        var(--bg);
    color: var(--text);
}

.page { min-height: 100vh; }

.council {
    max-width: 1040px;
    margin: 0 auto;
    padding: 2rem 1.25rem 4rem;
}

/* ---- Session layout: sticky agent rail left, transcript right ---- */

.session {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.stage-rail {
    position: sticky;
    top: 1rem;
}

.session-main { min-width: 0; }

/* ---- Header ---- */

.council-header { text-align: center; margin-bottom: 1.75rem; }

.crest {
    font-size: 2.4rem;
    line-height: 1;
    margin-bottom: .4rem;
    filter: drop-shadow(0 0 14px rgba(108, 140, 255, .45));
}

.council-header h1 {
    margin: 0 0 .3rem;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2.3rem;
    letter-spacing: .03em;
}

.council-header p { color: var(--muted); margin: 0; }

/* ---- Start stages: pick your company, then the topic ---- */

.council-header .subtitle {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.3rem;
    font-style: italic;
    color: var(--text);
}

/* Every stage change (company → topic → session) blurs in; keyed elements replay it. */
.step, .session, .council-header .subtitle { animation: stage-in .5s cubic-bezier(.2, .8, .2, 1) backwards; }

@keyframes stage-in {
    from { opacity: 0; transform: translateY(18px); filter: blur(6px); }
}

/* ---- Stage 1: the round table ----
   Every character is one absolutely-positioned token whose transform comes from the page
   (Council.razor's Spot). Inviting someone re-spaces the seats, and because only the transform
   changes, the whole company glides around the table instead of jumping. */

.table-stage {
    position: relative;
    /* --lift pulls the table up over the empty roster row once everyone is seated. */
    --lift: -134px;
    height: 344px;
    margin: 0 0 1.5rem;
    transition: height .45s cubic-bezier(.2, .8, .2, 1);
}

.table-stage.has-bench {
    --lift: 0px;
    height: 478px;
}

/* 2 x TableRx by 2 x TableRy, centred on (50%, TableCy): the seats sit on this rim. */
.round-table {
    position: absolute;
    left: 50%;
    top: 292px;
    width: 392px;
    height: 188px;
    transform: translate(-50%, -50%) translateY(var(--lift));
    transition: transform .55s cubic-bezier(.2, .8, .2, 1);
    border-radius: 50%;
    background: radial-gradient(ellipse at 50% 28%, #2b3142, #171b24 72%);
    border: 2px solid #363d51;
    box-shadow: inset 0 0 50px rgba(0, 0, 0, .55), 0 20px 45px rgba(0, 0, 0, .45);
}

/* A slow glint travelling round the rim, so the table reads as "live" on a projector.
   The gradient's start angle is animated, not the element: rotating an ellipse would swing
   the highlight off the rim. */
@property --sweep {
    syntax: "<angle>";
    inherits: false;
    initial-value: 0deg;
}

.round-table::after {
    content: "";
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    background: conic-gradient(from var(--sweep), transparent 0 72%, rgba(108, 140, 255, .55) 86%, transparent 100%);
    mask: radial-gradient(closest-side, transparent 89%, #000 91%);
    animation: table-sweep 11s linear infinite;
}

@keyframes table-sweep {
    to { --sweep: 1turn; }
}

/* Not the table's centre: it sits in the clear band between the top seat and your crown. */
.table-center {
    position: absolute;
    left: 50%;
    top: 314px;
    display: grid;
    justify-items: center;
    transform: translate(-50%, -50%) translateY(var(--lift));
    transition: transform .55s cubic-bezier(.2, .8, .2, 1);
    pointer-events: none;
}

.table-count {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2.6rem;
    line-height: 1;
    color: var(--text);
}

.table-label {
    font-size: .72rem;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--muted);
}

/* Sits under the roster row; only ever visible while someone is still standing there. */
.bench-label {
    position: absolute;
    left: 50%;
    top: 124px;
    margin: 0;
    transform: translateX(-50%);
    font-size: .72rem;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--muted);
    transition: opacity .4s;
}

.bench-label.empty { opacity: 0; }

.seat-token {
    --seat-color: var(--other);
    position: absolute;
    left: 50%;
    top: 0;
    width: 104px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .25rem;
    padding: 0;
    background: none;
    border: 0;
    color: var(--text);
    font: inherit;
    cursor: pointer;
    /* -2.15rem = half the head, so --y lands on the face, not the middle of the plate column. */
    transform: translate(-50%, -2.15rem) translate(var(--x), calc(var(--y) + var(--lift)));
    transition: transform .75s cubic-bezier(.34, 1.2, .4, 1), opacity .35s, filter .35s;
}

.token-icon {
    display: grid;
    place-items: center;
    width: 4.3rem;
    height: 4.3rem;
    border-radius: 50%;
    font-size: 2.1rem;
    background: radial-gradient(circle at 50% 32%, color-mix(in srgb, var(--seat-color) 26%, #222732), #191d26 72%);
    border: 2px solid color-mix(in srgb, var(--seat-color) 55%, #2e3546);
    transition: box-shadow .3s, transform .3s;
}

/* The token budget, drawn as an arc around the head. */
.token-ring {
    position: absolute;
    top: -6px;
    left: 50%;
    width: 5.1rem;
    height: 5.1rem;
    border-radius: 50%;
    transform: translateX(-50%);
    background: conic-gradient(var(--seat-color) var(--gauge, 0%), color-mix(in srgb, var(--seat-color) 14%, transparent) 0);
    mask: radial-gradient(closest-side, transparent 80%, #000 82%);
    transition: background .3s;
}

.token-plate {
    padding: .1rem .5rem;
    border-radius: .4rem;
    background: color-mix(in srgb, var(--seat-color) 16%, #1b1f28);
    border: 1px solid color-mix(in srgb, var(--seat-color) 32%, transparent);
    font-family: Georgia, "Times New Roman", serif;
    font-size: .82rem;
    color: var(--seat-color);
    white-space: nowrap;
}

.token-budget {
    font-size: .68rem;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
}

.seat-token.seated .token-icon {
    box-shadow: 0 0 0 1px var(--seat-color), 0 10px 26px color-mix(in srgb, var(--seat-color) 28%, transparent);
}

.seat-token.waiting {
    opacity: .82;
    filter: saturate(.75);
}

/* Uninvited guests glow in their own colour, one after another, like candles asking to be picked. */
.seat-token.waiting .token-icon {
    transform: scale(.88);
    animation: beckon 3.2s ease-in-out infinite;
    animation-delay: var(--beckon-delay, 0s);
}
.seat-token.optimist { --beckon-delay: .8s; }
.seat-token.skeptic { --beckon-delay: 1.6s; }
.seat-token.pragmatist { --beckon-delay: 2.4s; }

.seat-token.waiting:hover, .seat-token.waiting:focus-visible { opacity: 1; filter: none; }
.seat-token.waiting:hover .token-icon, .seat-token.waiting:focus-visible .token-icon {
    transform: scale(.96) translateY(-3px);
    animation: none;
    border-color: var(--seat-color);
    box-shadow: 0 0 0 1px var(--seat-color), 0 0 30px 6px color-mix(in srgb, var(--seat-color) 55%, transparent);
}
.seat-token.waiting .token-ring, .seat-token.waiting .token-budget { opacity: 0; }

@keyframes beckon {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--seat-color) 0%, transparent); }
    40% {
        border-color: var(--seat-color);
        box-shadow: 0 0 0 1px color-mix(in srgb, var(--seat-color) 70%, transparent),
                    0 0 24px 5px color-mix(in srgb, var(--seat-color) 45%, transparent);
    }
}

.seat-token.you {
    cursor: default;
    opacity: .85;
}

/* Only after the first click, so the opening line-up doesn't hop while the page loads. */
.table-stage.touched .seat-token.seated .token-icon { animation: hop .6s cubic-bezier(.3, 1.5, .5, 1); }

@keyframes hop {
    0% { transform: scale(.88) rotate(-8deg); }
    45% { transform: translateY(-14px) scale(1.12) rotate(8deg); }
    100% { transform: none; }
}

.seat-token:focus-visible, .mode-card:focus-visible, .effort-chip:focus-visible,
.file-list button:focus-visible, .link-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

/* ---- Per-agent tuning: how much each character may spend, and how hard it thinks ---- */

.tuning {
    display: grid;
    gap: .5rem;
    margin: 0 0 1.25rem;
}

.tuning.hidden { display: none; }

.tuning-row {
    --seat-color: var(--other);
    display: grid;
    grid-template-columns: minmax(170px, 1fr) minmax(210px, 1.3fr) auto;
    align-items: center;
    gap: 1rem;
    padding: .55rem .85rem;
    border-radius: .7rem;
    background: color-mix(in srgb, var(--seat-color) 7%, var(--panel));
    border: 1px solid color-mix(in srgb, var(--seat-color) 24%, var(--panel-edge));
    border-left: 3px solid var(--seat-color);
    animation: stage-in .35s ease backwards;
}

.tuning-who { display: grid; gap: .1rem; min-width: 0; }

.tuning-name {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 700;
    color: var(--seat-color);
}

.tuning-quote {
    font-size: .78rem;
    font-style: italic;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tuning-budget { display: grid; gap: .2rem; }

.tuning-cap { font-size: .78rem; color: var(--muted); }
.tuning-cap b { color: var(--text); font-variant-numeric: tabular-nums; }
.tuning-cap em { color: var(--seat-color); font-style: normal; }

.tuning-budget input[type="range"] {
    width: 100%;
    accent-color: var(--seat-color);
}

.tuning-effort { display: flex; gap: .25rem; }

.effort-chip {
    padding: .3rem .55rem;
    border-radius: .45rem;
    background: #1b1f28;
    border: 1px solid var(--panel-edge);
    color: var(--muted);
    font: inherit;
    font-size: .78rem;
    cursor: pointer;
    transition: background .2s, color .2s, border-color .2s;
}

.effort-chip.on {
    background: color-mix(in srgb, var(--seat-color) 22%, #1b1f28);
    border-color: var(--seat-color);
    color: var(--text);
}

@media (max-width: 820px) {
    .tuning-row { grid-template-columns: 1fr; gap: .45rem; }
}

@media (prefers-reduced-motion: reduce) {
    .round-table::after { animation: none; }
    .round-table, .table-center { transition: none; }
    .seat-token { transition: opacity .35s, filter .35s; }
    .table-stage.touched .seat-token.seated .token-icon { animation: none; }
    .seat-token.waiting .token-icon { animation: none; box-shadow: 0 0 18px 2px color-mix(in srgb, var(--seat-color) 35%, transparent); }
}

.step-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
}

/* The chosen company, hopping in above the topic stage. */
.party {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    margin: 0 0 1.1rem;
}

.party-member {
    display: grid;
    place-items: center;
    width: 2.9rem;
    height: 2.9rem;
    border-radius: 50%;
    font-size: 1.45rem;
    background: #222732;
    border: 2px solid var(--seat-color);
    box-shadow: 0 0 12px color-mix(in srgb, var(--seat-color) 30%, transparent);
    animation: hop-in .5s cubic-bezier(.3, 1.5, .5, 1) backwards;
    animation-delay: calc(var(--i, 0) * 80ms + .15s);
}

@keyframes hop-in {
    from { opacity: 0; transform: translateY(-16px) scale(.6); }
}

.link-btn {
    margin-left: .4rem;
    padding: 0;
    border: none;
    background: none;
    color: var(--accent);
    font: inherit;
    font-size: .88rem;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

/* ---- Orchestration mode picker ---- */

.mode-row {
    display: flex;
    gap: .75rem;
    margin: 0 0 .75rem;
}

.mode-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .3rem;
    text-align: left;
    padding: .9rem 1rem;
    border-radius: .6rem;
    border: 1px solid #2a2f3a;
    background: var(--panel);
    color: var(--text);
    font: inherit;
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s;
}

.mode-card.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), 0 0 18px rgba(108, 140, 255, .25);
}

.mode-name { font-weight: 700; }
.mode-desc { color: var(--muted); font-size: .85rem; line-height: 1.35; }

.rounds-row {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin: 0 0 .75rem;
    color: var(--muted);
    font-size: .95rem;
}

.rounds-input.resume-select { width: auto; max-width: 100%; }

.rounds-input {
    width: 4.5rem;
    padding: .45rem .6rem;
    border-radius: .5rem;
    border: 1px solid #2a2f3a;
    background: var(--panel);
    color: var(--text);
    font-size: 1rem;
}

/* ---- Council stage: seats + travelling floor token ---- */

.stage {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    padding: 1.1rem 1rem;
    border-radius: .8rem;
    background:
        radial-gradient(ellipse 90% 60% at 0% 0%, rgba(108, 140, 255, .09), transparent 70%),
        var(--panel);
    border: 1px solid var(--panel-edge);
}

/* Vertical track running through the avatar column. */
.stage-track {
    position: absolute;
    left: 2.6rem;
    top: 8%;
    bottom: 8%;
    width: 2px;
    background: linear-gradient(180deg, transparent, #2e3546 15%, #2e3546 85%, transparent);
}

.seat {
    --seat-color: var(--muted);
    animation: deal .5s cubic-bezier(.2, .8, .2, 1) backwards;
    animation-delay: calc(var(--i, 0) * 90ms + .2s);
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: .7rem;
}

.seat.moderator, .msg.moderator, .seat-token.moderator, .tuning-row.moderator, .party-member.moderator { --seat-color: var(--moderator); }
.seat.optimist, .msg.optimist, .seat-token.optimist, .tuning-row.optimist, .party-member.optimist { --seat-color: var(--optimist); }
.seat.skeptic, .msg.skeptic, .seat-token.skeptic, .tuning-row.skeptic, .party-member.skeptic { --seat-color: var(--skeptic); }
.seat.pragmatist, .msg.pragmatist, .seat-token.pragmatist, .tuning-row.pragmatist, .party-member.pragmatist { --seat-color: var(--pragmatist); }
.seat.you, .msg.you, .seat-token.you { --seat-color: var(--you); }
.msg.other { --seat-color: var(--other); }

.seat-avatar {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 1.35rem;
    background: #222732;
    border: 2px solid #2e3546;
    transition: transform .35s ease, border-color .35s ease, box-shadow .35s ease;
}

.seat-name {
    font-size: .9rem;
    color: var(--muted);
    transition: color .35s ease;
}

.seat.active .seat-avatar {
    transform: scale(1.18);
    border-color: var(--seat-color);
    animation: pulse 1.6s ease-out infinite;
}

.seat.active .seat-name { color: var(--seat-color); font-weight: 700; }

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--seat-color) 45%, transparent); }
    100% { box-shadow: 0 0 0 14px transparent; }
}

/* The floor token: slides down the track to whoever holds the floor. */
.orb {
    --orb-color: var(--accent);
    position: absolute;
    left: 2.6rem;
    top: 10%;
    width: .85rem;
    height: .85rem;
    border-radius: 50%;
    background: var(--orb-color);
    box-shadow: 0 0 10px var(--orb-color), 0 0 26px var(--orb-color);
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: top .7s cubic-bezier(.5, 0, .2, 1.2), opacity .3s, background .4s, box-shadow .4s;
}

.orb.visible { opacity: 1; }

.stage-caption {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .45rem;
    margin: .7rem 0 0;
    color: var(--muted);
    font-size: .88rem;
}

.mode-badge {
    padding: .18rem .6rem;
    border-radius: 1rem;
    border: 1px solid #2a2f3a;
    background: var(--panel);
    font-size: .78rem;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
}

.floor-note { font-style: italic; }

.chips { display: flex; flex-wrap: wrap; gap: .35rem; }

.harness-mode.execute { color: var(--pragmatist); border-color: color-mix(in srgb, var(--pragmatist) 45%, #2a2f3a); }
.researching { color: var(--moderator); border-color: color-mix(in srgb, var(--moderator) 45%, #2a2f3a); }

/* ---- Rail panels: the Pragmatist's todos + the workspace ---- */

.rail-panel {
    margin-top: .9rem;
    padding: .75rem .9rem;
    border-radius: .8rem;
    background: var(--panel);
    border: 1px solid var(--panel-edge);
}

.rail-panel h2 {
    margin: 0 0 .5rem;
    font-size: .76rem;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--muted);
}

.rail-panel .hint { margin: 0; font-size: .82rem; }

.todo-list, .file-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .3rem;
    font-size: .86rem;
}

.todo-list li { overflow-wrap: anywhere; }
.todo-list li.done { color: var(--muted); text-decoration: line-through; }

.file-list button {
    width: 100%;
    text-align: left;
    padding: .3rem .45rem;
    border: 1px solid transparent;
    border-radius: .4rem;
    background: none;
    color: var(--text);
    font: inherit;
    cursor: pointer;
    overflow-wrap: anywhere;
}

.file-list button:hover { border-color: var(--panel-edge); background: #1d212b; }

.file-list li { display: flex; gap: .2rem; }

.file-list .file-delete { width: auto; flex: none; color: var(--muted); }
.file-list .file-delete:hover { color: #f87171; }

/* ---- Plan confirmation ---- */

.plan-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    margin-top: 1rem;
    padding: .7rem .9rem;
    border-radius: .6rem;
    background: var(--panel);
    border: 1px solid color-mix(in srgb, var(--pragmatist) 45%, #2a2f3a);
    font-size: .9rem;
}

.plan-bar .btn { padding: .55rem 1rem; }

/* ---- Topic / reply ---- */

.topic-box, .reply-box {
    display: flex;
    gap: .5rem;
    margin: 1rem 0;
}

.topic-input, .reply-input {
    flex: 1;
    padding: .8rem 1rem;
    border-radius: .6rem;
    border: 1px solid #2a2f3a;
    background: var(--panel);
    color: var(--text);
    font-size: 1rem;
}

.reply-input:disabled { opacity: .5; }

.btn {
    padding: .8rem 1.2rem;
    border: none;
    border-radius: .6rem;
    background: var(--accent);
    color: white;
    font-weight: 600;
    cursor: pointer;
}

.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.secondary { background: #2c3345; }
.btn.danger { background: #8f3b2d; }

/* ---- Modals: approval gate + file preview ---- */

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(5, 6, 9, .72);
}

.modal {
    width: min(560px, 100%);
    max-height: 85vh;
    overflow: auto;
    padding: 1.1rem 1.25rem;
    border-radius: .9rem;
    background: var(--panel);
    border: 1px solid var(--panel-edge);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
    animation: rise .25s ease both;
}

.modal.wide { width: min(760px, 100%); }

.modal h2 { margin: 0 0 .75rem; font-size: 1.05rem; overflow-wrap: anywhere; }

.modal pre {
    margin: 0;
    padding: .7rem .9rem;
    max-height: 45vh;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-family: Consolas, "Cascadia Mono", monospace;
    font-size: .85rem;
    background: #0c0e12;
    border: 1px solid var(--panel-edge);
    border-radius: .5rem;
}

.modal-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .5rem;
    margin-top: 1rem;
}

.hint { color: var(--muted); font-style: italic; }

.thinking {
    display: flex;
    align-items: center;
    gap: .3rem;
    color: var(--muted);
    font-style: italic;
    padding: .25rem 0;
}

.thinking .dot {
    width: .4rem;
    height: .4rem;
    border-radius: 50%;
    background: var(--muted);
    animation: bob 1.2s ease-in-out infinite;
}

.thinking .dot:nth-child(2) { animation-delay: .15s; }
.thinking .dot:nth-child(3) { animation-delay: .3s; }

@keyframes bob {
    0%, 60%, 100% { transform: none; opacity: .5; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* ---- Transcript ---- */

.transcript {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1.25rem 0;
}

.msg {
    display: flex;
    gap: .75rem;
    max-width: 88%;
    animation: rise .35s ease both;
}

/* Council messages sit left; yours sit right, mirrored. */
.msg.from-you {
    align-self: flex-end;
    flex-direction: row-reverse;
}

@keyframes rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

.avatar {
    width: 2.5rem;
    height: 2.5rem;
    flex: 0 0 2.5rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 1.15rem;
    background: #222732;
    border: 2px solid var(--seat-color);
    box-shadow: 0 0 10px color-mix(in srgb, var(--seat-color) 30%, transparent);
}

.msg-body {
    flex: 1;
    min-width: 0;
    padding: .7rem 1rem .8rem;
    border-radius: .8rem;
    background: color-mix(in srgb, var(--seat-color) 7%, var(--panel));
    border: 1px solid color-mix(in srgb, var(--seat-color) 25%, var(--panel-edge));
    border-top-left-radius: .2rem;
}

.msg.from-you .msg-body {
    border-top-left-radius: .8rem;
    border-top-right-radius: .2rem;
    background: #12151b;
}

.msg-header {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    margin-bottom: .25rem;
}

.msg.from-you .msg-header { flex-direction: row-reverse; }

.speaker { font-weight: 700; color: var(--seat-color); }

.role-chip {
    font-size: .72rem;
    font-style: italic;
    color: var(--muted);
}

/* ---- Markdown content ---- */

.text { line-height: 1.55; overflow-wrap: break-word; }

.text > *:first-child { margin-top: 0; }
.text > *:last-child { margin-bottom: 0; }

.text p { margin: .4rem 0; }
.text ul, .text ol { margin: .4rem 0; padding-left: 1.4rem; }
.text li { margin: .15rem 0; }
.text a { color: var(--accent); }
.text strong { color: color-mix(in srgb, var(--seat-color) 70%, var(--text)); }
.text blockquote {
    margin: .5rem 0;
    padding: .2rem .9rem;
    border-left: 3px solid var(--seat-color);
    color: var(--muted);
}

.text code {
    font-family: Consolas, "Cascadia Mono", monospace;
    font-size: .88em;
    background: #0c0e12;
    border: 1px solid var(--panel-edge);
    border-radius: .3rem;
    padding: .1rem .35rem;
}

.text pre {
    background: #0c0e12;
    border: 1px solid var(--panel-edge);
    border-radius: .5rem;
    padding: .7rem .9rem;
    overflow-x: auto;
}

.text pre code { background: none; border: none; padding: 0; }

.text table { border-collapse: collapse; margin: .5rem 0; }
.text th, .text td { border: 1px solid var(--panel-edge); padding: .35rem .6rem; }
.text th { background: #12151b; }

/* Blinking caret on the message that is currently streaming. */
.msg.streaming .text::after {
    content: "▋";
    margin-left: .1rem;
    color: var(--muted);
    animation: blink 1s steps(1) infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

.error {
    background: #3a1d1d;
    color: #ffb4a8;
    border-radius: .6rem;
    padding: .75rem 1rem;
    margin: 1rem 0;
}

@media (max-width: 760px) {
    .mode-row { flex-direction: column; }
    /* The table is laid out in px, so shrink the whole stage rather than re-doing the geometry. */
    .table-stage { transform: scale(.7); transform-origin: top center; height: 241px; }
    .table-stage.has-bench { height: 335px; }
    .reply-box { flex-wrap: wrap; }
    .reply-input { flex-basis: 100%; }
    .msg { max-width: 100%; }

    /* Single column: rail sits above the transcript, seats fold into a compact row. */
    .session { grid-template-columns: 1fr; }
    .stage-rail { position: static; }
    .stage { flex-direction: row; padding: .9rem .6rem; }
    .stage-track, .orb { display: none; }
    .seat { flex: 1; flex-direction: column; gap: .35rem; }
    .seat-name { font-size: .68rem; }
    .seat-avatar { width: 2.4rem; height: 2.4rem; font-size: 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
    .orb { transition: opacity .3s; }
    .seat.active .seat-avatar { animation: none; transform: none; }
    .msg, .modal { animation: none; }
    .step, .session, .council-header .subtitle, .seat, .party-member, .tuning-row { animation: none; }
    .msg.streaming .text::after { animation: none; }
    .thinking .dot { animation: none; }
}
