/* The Sursum web app. Layout: a rail on the left, the work in the middle, a folio panel on the right when one is open. */

html, body { height: 100%; overflow: hidden; }
#app { height: 100dvh; }
.boot { height: 100%; display: grid; place-content: center; justify-items: center; gap: 14px; text-align: center; padding: 24px; }
.boot .mark { font-size: 84px; }
.boot p { margin: 0; font: 500 15px var(--sans); letter-spacing: 0.3em; text-transform: uppercase; color: var(--gold); }

#toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 60; width: min(92vw, 460px); pointer-events: none; }
.toast { background: var(--navy); color: var(--ivory); padding: 11px 16px; border-radius: var(--radius); box-shadow: var(--shadow); font-size: 15.5px; text-align: center; animation: rise 0.2s ease-out; }
.toast.bad { background: #6E1F1F; color: #fff; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---- the gate */
.gate { min-height: 100dvh; height: 100dvh; overflow: auto; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr); }
.gate-art { position: relative; background: #0C1630 url("../brand/sursum-hero-bg.jpg") center / cover; color: var(--ivory); display: grid; align-content: center; justify-items: center; text-align: center; padding: 48px 32px; gap: 18px; }
.gate-art .mark { font-size: clamp(96px, 16vw, 168px); }
.gate-art h1 { margin: 0; font-size: clamp(34px, 4.6vw, 58px); color: var(--ivory); }
.gate-art p { margin: 0; max-width: 30ch; font: 400 20px/1.45 var(--serif); color: #D9D0BE; }
.gate-art .caps { color: var(--gilt); }
.gate-card { align-self: center; justify-self: center; width: min(100%, 440px); padding: 40px 32px; }
.gate-card h2 { margin: 0 0 6px; font-size: 32px; }
.gate-card .sub { margin: 0 0 22px; color: var(--dim); }
.gate-card .fine { margin-top: 26px; }
.code-input { font: 500 30px/1 var(--serif); letter-spacing: 0.3em; text-align: center; padding: 14px 8px; }
@media (max-width: 820px) {
  .gate { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .gate-art { padding: 34px 24px; gap: 10px; }
  .gate-art .mark { font-size: 84px; }
  .gate-art p { font-size: 18px; }
  .gate-card { align-self: start; padding: 28px 22px 40px; }
}

/* ---- the shell */
.shell { height: 100dvh; display: grid; grid-template-columns: 292px minmax(0, 1fr); }
.shell.with-side { grid-template-columns: 292px minmax(0, 1fr) minmax(380px, 44%); }
.rail { display: flex; flex-direction: column; min-height: 0; background: var(--card); border-right: 1px solid var(--line); border-top: 3px solid var(--lit); }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 14px 12px 18px; }
.brand .mark { font-size: 30px; }
.brand b { font: 500 17px/1 var(--sans); letter-spacing: 0.32em; text-transform: uppercase; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; background: none; border: 1px solid transparent; border-radius: var(--radius); color: var(--dim); cursor: pointer; flex: none; }
.icon-btn:hover { color: var(--text); border-color: var(--line); }
.nav { display: grid; padding: 4px 10px 10px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 10px; color: var(--text); text-decoration: none; border-radius: var(--radius); font: 400 16.5px/1.2 var(--sans); }
.nav a small { color: var(--dim); font-size: 13.5px; margin-left: auto; }
.nav a svg { color: var(--gold); }
.nav a:hover { background: var(--sunk); }
.nav a[aria-current="page"] { background: var(--sunk); font-weight: 500; box-shadow: inset 2px 0 0 var(--gold); }
.search { padding: 2px 14px 8px; }
.search .field { min-height: 38px; font-size: 15.5px; padding: 7px 10px; }
.rail-head { padding: 10px 20px 6px; font: 500 12px/1 var(--sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); }
.chatlist { flex: 1; min-height: 0; overflow: auto; padding: 0 10px 10px; }
.chatrow { display: grid; grid-template-columns: 8px minmax(0, 1fr); column-gap: 8px; padding: 8px 10px; border-radius: var(--radius); color: var(--text); text-decoration: none; }
.chatrow:hover { background: var(--sunk); }
.chatrow[aria-current="page"] { background: var(--sunk); box-shadow: inset 2px 0 0 var(--gold); }
.chatrow .dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 8px; }
.chatrow.unread .dot { background: var(--gold); }
.chatrow.live .dot { background: var(--ok); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
.chatrow .t { font-size: 15.5px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chatrow .p { grid-column: 2; font-size: 13.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag { font: 500 10.5px/1 var(--sans); letter-spacing: 0.1em; color: var(--gold); border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent); padding: 1px 5px; border-radius: 999px; margin-right: 6px; vertical-align: 1px; }
.rail-foot { border-top: 1px solid var(--line); padding: 10px; display: grid; gap: 4px; }
.meter { display: grid; gap: 6px; padding: 8px 10px; color: var(--text); text-decoration: none; border-radius: var(--radius); }
.meter:hover, .me:hover { background: var(--sunk); }
.meter .n { font: 500 15px var(--sans); }
.meter .bar { height: 3px; background: var(--line); }
.meter .bar i { display: block; height: 100%; background: var(--gold); }
.me { display: flex; align-items: center; gap: 10px; padding: 8px 10px; color: var(--text); text-decoration: none; border-radius: var(--radius); }
.me .who { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15.5px; }
.me svg { width: 18px; height: 18px; fill: none; stroke: var(--dim); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: #fff; font: 500 15px/1 var(--serif); flex: none; text-transform: uppercase; }
.avatar.sm { width: 22px; height: 22px; font-size: 12px; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.topbar { display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 8px 18px; border-bottom: 1px solid var(--line); }
.topbar h2 { margin: 0; font: 500 21px/1.2 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title-btn { background: none; border: 0; padding: 4px 6px; margin-left: -6px; cursor: pointer; min-width: 0; border-radius: var(--radius); }
.title-btn:hover { background: var(--sunk); }
.menu-btn { display: none; }
.people { display: inline-flex; }
.people .avatar { margin-left: -6px; border: 2px solid var(--bg); }
.page { flex: 1; min-height: 0; overflow: auto; }
.page .inner { max-width: 880px; margin: 0 auto; padding: 28px 24px 80px; }
.lede { font: 400 20px/1.5 var(--serif); color: var(--dim); margin: 0 0 24px; max-width: 62ch; }
.section { margin-top: 34px; }
.section > h2 { margin: 0 0 12px; font: 500 12.5px/1.2 var(--sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card { display: grid; gap: 6px; align-content: start; text-align: left; padding: 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-decoration: none; cursor: pointer; font: inherit; }
button.card:hover, a.card:hover { border-color: var(--gold); }
.card.still { cursor: default; }
.card.current { border-color: var(--gold); box-shadow: inset 0 3px 0 var(--gold); }
.card .kind { font: 500 11.5px/1.2 var(--sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); }
.card h3 { margin: 0; font: 500 23px/1.2 var(--serif); }
.card p { margin: 0; color: var(--dim); font-size: 15.5px; line-height: 1.45; }
.card .price { font: 500 30px/1.1 var(--serif); color: var(--text); }
.card .price small { font: 400 15px var(--sans); color: var(--dim); }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.big { font: 500 clamp(34px, 6vw, 48px)/1 var(--serif); }
.list { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.list > * { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--line); color: var(--text); text-decoration: none; }
.list > *:first-child { border-top: 0; }
.list > button { background: none; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; text-align: left; cursor: pointer; font: inherit; }
.list > a:hover, .list > button:hover { background: var(--sunk); }
.list svg { width: 18px; height: 18px; fill: none; stroke: var(--gold); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.list .grow { flex: 1; min-width: 0; display: grid; }
.list .grow b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .grow span { color: var(--dim); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 56px 20px; color: var(--dim); }
.empty .mark { font-size: 64px; opacity: 0.85; }
.empty h3 { margin: 6px 0 0; font-size: 24px; color: var(--text); }
.empty p { margin: 0; max-width: 46ch; }

/* ---- popovers and dialogs */
.pop { position: fixed; z-index: 50; min-width: 240px; max-width: min(92vw, 380px); max-height: 70dvh; overflow: auto; padding: 6px; background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow); }
.pop .head { padding: 8px 11px 6px; font: 500 11.5px/1 var(--sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); }
.pop .sep { height: 1px; background: var(--line); margin: 6px 0; }
.item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px; background: none; border: 0; border-radius: var(--radius); color: var(--text); text-align: left; text-decoration: none; cursor: pointer; font: inherit; }
.item:hover { background: var(--sunk); }
.item.danger { color: var(--bad); }
.opt { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; width: 100%; padding: 10px 11px; background: none; border: 0; border-radius: var(--radius); color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.opt:hover { background: var(--sunk); }
.opt b { font: 500 18px/1.2 var(--serif); }
.opt b small { font: 400 14px var(--sans); color: var(--gold); margin-left: 8px; }
.opt .desc { grid-column: 1 / -1; color: var(--dim); font-size: 14.5px; line-height: 1.4; }
.opt .check { color: var(--gold); }
.opt.locked b { color: var(--dim); }
.scrim { position: fixed; inset: 0; z-index: 40; background: rgb(12 22 48 / 45%); display: grid; place-items: center; padding: 18px; overflow: auto; }
.dialog { width: min(100%, 520px); background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; }
.dialog > h2 { margin: 0 0 10px; font-size: 26px; }
.dialog .foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; flex-wrap: wrap; }

/* ---- the home screen */
.home { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; align-items: center; padding: 28px 22px 10px; }
.home-inner { width: min(100%, 720px); margin: auto; display: grid; gap: 22px; justify-items: center; text-align: center; }
.home .mark { font-size: 76px; }
.home h1 { margin: 0; font-size: clamp(32px, 5vw, 46px); }
.day { width: 100%; display: grid; gap: 6px; padding: 16px 20px; background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--lit); border-radius: var(--radius); text-align: left; }
.day .when { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.day h2 { margin: 0; font-size: 24px; }
.day p { margin: 0; color: var(--dim); font-size: 15.5px; }
.day .swatch { width: 10px; height: 10px; border-radius: 50%; background: var(--lit); border: 1px solid var(--line-strong); display: inline-block; }
.verse { margin: 0; font: 400 21px/1.45 var(--serif); max-width: 34em; }
.verse cite { display: block; margin-top: 6px; font: 500 12.5px/1.2 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); font-style: normal; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { padding: 8px 14px; background: var(--card); border: 1px solid var(--line-strong); border-radius: 999px; cursor: pointer; font-size: 15.5px; color: var(--text); }
.chip:hover { border-color: var(--gold); }

/* ---- a chat */
.thread { flex: 1; min-height: 0; overflow: auto; outline: none; }
.thread-inner { max-width: 800px; margin: 0 auto; padding: 26px 22px 30px; display: grid; gap: 26px; }
.msg { display: grid; gap: 8px; min-width: 0; }
.msg.user { justify-items: end; }
.msg.user.theirs { justify-items: start; }
.msg .who { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--dim); }
.bubble { max-width: min(100%, 640px); padding: 11px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user:not(.theirs) .bubble { background: var(--navy); border-color: var(--navy); color: var(--ivory); }
.acts { display: flex; gap: 2px; opacity: 0; transition: opacity 0.12s; }
.msg:hover .acts, .msg:focus-within .acts { opacity: 1; }
.acts .icon-btn { width: 32px; height: 32px; }
@media (hover: none) { .acts { opacity: 1; } }
.tier { display: flex; align-items: center; gap: 8px; font: 500 12px/1.2 var(--sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); }
.tier .mark { font-size: 20px; }
.tier .cost { margin-left: auto; color: var(--dim); letter-spacing: 0.06em; text-transform: none; font-weight: 400; font-size: 13px; }
.tier .flag { color: var(--dim); }
.attach { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.attach img { max-width: 260px; max-height: 260px; border: 1px solid var(--line); border-radius: var(--radius); display: block; }
.attach video { max-width: min(100%, 420px); max-height: 320px; border-radius: var(--radius); display: block; background: #000; }
.attach audio { width: min(100%, 360px); display: block; }
.attach .media { display: grid; gap: 4px; justify-items: end; }
.attach .media small { color: var(--dim); font-size: 13px; }
.filechip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 7px 11px; background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--text); text-decoration: none; font-size: 15px; }
.filechip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filechip button { background: none; border: 0; cursor: pointer; color: var(--dim); font-size: 18px; line-height: 1; padding: 0 2px; }
.event { text-align: center; color: var(--dim); font-size: 14px; }

/* The answer: set like a page. */
.md { font: 400 19.5px/1.62 var(--serif); overflow-wrap: anywhere; min-width: 0; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md blockquote, .md table, .md pre { margin: 0 0 0.85em; }
.md h1, .md h2, .md h3, .md h4 { margin: 1.3em 0 0.45em; font-weight: 500; }
.md h1 { font-size: 1.55em; } .md h2 { font-size: 1.32em; } .md h3 { font-size: 1.14em; } .md h4 { font-size: 1em; font-weight: 600; }
.md ul, .md ol { padding-left: 1.4em; }
.md li { margin: 0.2em 0; }
.md blockquote { margin-left: 0; padding: 2px 0 2px 18px; border-left: 2px solid var(--gilt); color: color-mix(in srgb, var(--text) 88%, var(--dim)); }
.md hr { border: 0; height: 1px; background: var(--line); margin: 1.4em 0; }
.md code { font: 0.8em/1.5 var(--mono); background: var(--sunk); padding: 1px 5px; border-radius: var(--radius); }
.md pre { background: var(--navy-deep); color: #E9E4D6; border-radius: var(--radius); overflow: hidden; }
.md pre code { display: block; padding: 14px 16px; overflow: auto; background: none; color: inherit; font-size: 14px; line-height: 1.55; }
.md pre .bar { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 6px 16px; background: rgb(255 255 255 / 6%); font: 500 11.5px var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: #B4B9C9; }
.md pre .bar button { background: none; border: 0; color: #D7B46A; cursor: pointer; font: inherit; letter-spacing: inherit; text-transform: inherit; padding: 4px 8px; }
.md table { border-collapse: collapse; display: block; overflow: auto; font: 16px/1.45 var(--sans); }
.md th, .md td { border: 1px solid var(--line); padding: 7px 11px; text-align: left; vertical-align: top; }
.md th { background: var(--sunk); font-weight: 500; }
.md img { max-width: 100%; }
.md.cursor::after { content: ""; display: inline-block; width: 7px; height: 1em; margin-left: 3px; vertical-align: -2px; background: var(--gold); animation: pulse 1s infinite; }
.hljs-comment, .hljs-quote { color: #8F97AD; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-built_in { color: #E3BD6E; }
.hljs-string, .hljs-attr, .hljs-symbol { color: #A8D1A0; }
.hljs-number, .hljs-title, .hljs-section, .hljs-name { color: #9EC3EE; }
.hljs-type, .hljs-variable, .hljs-template-variable { color: #E2A9A0; }

.think, .tool { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); font-size: 15px; }
.think summary, .tool summary { display: flex; align-items: center; gap: 9px; padding: 8px 12px; cursor: pointer; color: var(--dim); list-style: none; min-width: 0; }
.think summary::-webkit-details-marker, .tool summary::-webkit-details-marker { display: none; }
.think.live summary { color: var(--gold); }
.think .body { padding: 2px 14px 12px; white-space: pre-wrap; color: var(--dim); font: 400 16.5px/1.5 var(--serif); }
.tool .st { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); flex: none; }
.tool.running .st { background: var(--gold); animation: pulse 1s infinite; }
.tool.done .st { background: var(--ok); }
.tool.error .st { background: var(--bad); }
.tool .lbl { color: var(--text); white-space: nowrap; }
.tool .in { color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; min-width: 0; }
.tool pre { margin: 0; padding: 10px 12px; border-top: 1px solid var(--line); font: 13px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 300px; overflow: auto; }
.sources { display: flex; flex-wrap: wrap; gap: 6px; }
.sources a { padding: 3px 10px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 13.5px; text-decoration: none; color: var(--dim); background: var(--card); }
.sources a:hover { color: var(--text); border-color: var(--gold); }
.ccard { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; background: var(--card); border: 1px solid var(--line-strong); border-left: 3px solid var(--gold); border-radius: var(--radius); color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.ccard:hover { border-color: var(--gold); }
.ccard small { display: block; font: 500 11.5px var(--sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); }
.ccard b { font: 500 21px/1.2 var(--serif); }

/* ---- the composer */
.composer-wrap { padding: 4px 22px 18px; }
.composer { max-width: 800px; margin: 0 auto; background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 1px 2px rgb(20 33 63 / 5%); }
.composer:focus-within { border-color: var(--gold); }
.composer.drag { border-style: dashed; border-color: var(--gold); }
.composer textarea { display: block; width: 100%; border: 0; outline: none; resize: none; background: none; padding: 14px 16px 6px; font: 400 19px/1.45 var(--serif); min-height: 52px; }
.composer .tools { display: flex; align-items: center; gap: 4px; padding: 6px 8px 8px; flex-wrap: wrap; }
.pending { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 12px 0; }
.model-chip { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 4px 11px; background: none; border: 1px solid var(--line-strong); border-radius: 999px; cursor: pointer; font: 500 14px var(--sans); }
.model-chip:hover { border-color: var(--gold); }
.model-chip .mark { font-size: 16px; }
.toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 4px 10px; background: none; border: 1px solid transparent; border-radius: 999px; color: var(--dim); cursor: pointer; font: 400 14px var(--sans); }
.toggle b { font-weight: 400; }
.toggle:hover { border-color: var(--line-strong); }
.toggle[aria-pressed="true"] { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 50%, transparent); background: color-mix(in srgb, var(--gilt) 12%, transparent); }
.send { display: inline-grid; place-items: center; width: 40px; height: 40px; background: var(--navy); color: var(--ivory); border: 0; border-radius: 50%; cursor: pointer; }
.send.stop { background: var(--bad); }
.send svg { width: 20px; height: 20px; stroke-width: 2; }
.hint { max-width: 800px; margin: 8px auto 0; color: var(--dim); font-size: 14px; min-height: 1px; text-align: center; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .send { background: var(--gilt); color: #101C34; } :root:not([data-theme="light"]) .msg.user:not(.theirs) .bubble { background: #22335F; border-color: #2E4175; } }
:root[data-theme="dark"] .send { background: var(--gilt); color: #101C34; }
:root[data-theme="dark"] .msg.user:not(.theirs) .bubble { background: #22335F; border-color: #2E4175; }

/* ---- the folio panel */
.side { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--card); border-left: 1px solid var(--line); }
.side .bar { display: flex; align-items: center; gap: 6px; min-height: 58px; padding: 8px 10px 8px 18px; border-bottom: 1px solid var(--line); }
.side .bar h2 { margin: 0; font: 500 20px/1.2 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; flex: none; }
.seg button { background: none; border: 0; padding: 6px 12px; cursor: pointer; font: 500 12.5px var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); }
.seg button[aria-pressed="true"] { background: var(--navy); color: var(--ivory); }
.side .view { flex: 1; min-height: 0; overflow: auto; background: var(--bg); }
.side .view iframe { width: 100%; height: 100%; border: 0; background: #fff; display: block; }
.side .view .src { margin: 0; padding: 16px 18px; font: 13.5px/1.55 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.side .view .doc { max-width: 720px; margin: 0 auto; padding: 26px 24px 60px; }
.side .foot { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); flex-wrap: wrap; font-size: 15px; }
.side .foot select { background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 6px 8px; }

/* ---- the Scriptorium's terminal */
.term { background: var(--navy-deep); color: #E9E4D6; border-radius: var(--radius); font: 13.5px/1.5 var(--mono); overflow: hidden; }
.term .out { height: 220px; overflow: auto; padding: 12px 14px; white-space: pre-wrap; overflow-wrap: anywhere; outline: none; }
.term .out .dim { color: #8F97AD; }
.term .cmd { color: #E3BD6E; }
.term .bad { color: #F0A0A0; }
.term form { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-top: 1px solid rgb(255 255 255 / 10%); color: #E3BD6E; }
.term input { flex: 1; background: none; border: 0; outline: none; color: #fff; font: inherit; }

/* ---- small screens: the rail becomes a drawer, the folio covers the chat */
@media (max-width: 860px) {
  .shell, .shell.with-side { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; inset: 0 auto 0 0; width: min(86vw, 320px); z-index: 30; transform: translateX(-102%); transition: transform 0.2s ease; box-shadow: var(--shadow); }
  .shell.drawer .rail { transform: none; }
  .shell.drawer::before { content: ""; position: fixed; inset: 0; background: rgb(12 22 48 / 40%); z-index: 20; }
  .menu-btn { display: inline-grid; }
  .side { position: fixed; inset: 0; z-index: 35; border-left: 0; }
  .thread-inner { padding: 18px 14px 22px; }
  .composer-wrap { padding: 4px 10px 12px; }
  .page .inner { padding: 20px 16px 70px; }
  .md { font-size: 18.5px; }
  .toggle b { display: none; }
  .topbar { padding: 8px 10px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
