/* Black study surfaces, original framed artwork, and a compact response animation. */
:root { --sidebar-offset: var(--sidebar-w); --shell-height: 144px; --composer-height: 186px; --cut: 20px; }
html { overflow-x: clip; scroll-padding-top: calc(var(--shell-height) + 76px); scroll-padding-bottom: calc(var(--composer-height) + 36px); }
body { min-height: 100dvh; height: auto; background: #080808; }
.t-app { display: block; height: auto; min-height: 100dvh; overflow: visible; background: transparent; }
.t-main { margin-left: var(--sidebar-offset); min-height: 100dvh; isolation: isolate; background: #080808; --bone-muted: #bdb9b0; --bone-faint: #bdb9b0; --bone-dim: #d4d0c5; --ink-1: #111111; --ink-2: #191919; }
.t-main > .grain { display: block; opacity: .035; }
.t-particles { position: relative; inset: auto; width: 100%; height: 220px; display: block; z-index: 0; background: transparent; }
.t-sidebar { position: fixed; top: 0; left: 0; height: 100dvh; z-index: 12; background: linear-gradient(135deg,#141412,#090909 70%); box-shadow: 10px 0 38px #0004; }
.t-source, .t-scrim { position: fixed; }
.t-source { z-index: 30; height: 100dvh; background: #111111; }
.t-scrim { z-index: 20; }
body:has(.t-source.is-open), body:has(.is-drawer-open), body:has(dialog[open]) { overflow: hidden; }
.t-top { position: sticky; top: 0; z-index: 10; background: linear-gradient(115deg,rgba(13,13,12,.99),rgba(8,8,8,.99)); border-bottom: 1px solid #c8c0ad22; box-shadow: 0 12px 30px #0005; }
.t-top .t-header { height: 56px; border-bottom: 1px solid #c8c0ad22; padding: 0 30px; }
.t-top .theoria-modebar { padding: 12px 24px 14px; }
.t-main .theoria-modes { background: #0c0c0b; border-color: #5e5b53; border-radius: 13px 3px; box-shadow: 0 7px 16px #0005, inset 0 1px #d1cbb133; }
.t-main .theoria-modes a { border-radius: 9px 2px; }
.t-main .theoria-modes a[aria-current="page"] { background: linear-gradient(120deg,#292925,#161615); border-color: #88816b; box-shadow: inset 0 1px #ded4b444, 0 3px 8px #0005; }

/* The document owns vertical scrolling. There is no nested transcript viewport. */
.t-app[data-state] .t-workspace { flex: 1; min-height: calc(100dvh - var(--shell-height)); overflow: visible; padding: 26px max(264px, calc((100% - 1040px) / 2 + 240px)) calc(var(--composer-height) + 42px) max(24px, calc((100% - 1040px) / 2)); }
.t-app[data-state] .t-messages { flex: 0 0 auto; overflow: visible; padding: 0; width: 100%; }
.t-app[data-state="welcome"] .t-messages { display: none; }
.t-app[data-state] .t-column { max-width: none; margin: 0; padding: 0; gap: 28px; border: 0; border-radius: 0; background: none; }
.t-workspace:focus-visible { outline: none; }
.t-notice { padding: 16px 0; }

/* Raised, bevelled cards: the clipped surface is separate from the shadow. */
.t-how-card, .t-app[data-state] .t-composer, .t-main .msg--assistant, .t-main .msg--user {
  position: relative; isolation: isolate; border: 0; border-radius: 0; background: none;
  filter: drop-shadow(0 18px 20px #0008) drop-shadow(6px 6px 0 #000000bb);
}
.t-how-card::before, .t-app[data-state] .t-composer::before, .t-main .msg--assistant::before, .t-main .msg--user::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  clip-path: polygon(0 0,calc(100% - var(--cut)) 0,100% var(--cut),100% 100%,var(--cut) 100%,0 calc(100% - var(--cut)));
  background: linear-gradient(145deg,rgba(24,24,23,.99),rgba(10,10,10,.99) 55%,rgba(5,5,5,.99));
  box-shadow: inset 0 1px 0 #d5d0bd55, inset 1px 0 0 #96908266, inset 0 -2px 0 #000000;
}
.t-how-card::after, .t-app[data-state] .t-composer::after, .t-main .msg--assistant::after, .t-main .msg--user::after {
  content: ''; position: absolute; width: 28px; height: 1px; right: -4px; top: 10px; transform: rotate(45deg); background: #d5d0bd88; pointer-events: none;
}
.t-main .msg { animation: none; }
.t-main .msg--assistant { padding: 26px; }
.t-main .msg--assistant > .t-seal { display: none; }
.t-main .msg--user { align-self: flex-end; max-width: min(620px,94%); padding: 20px 24px; }
.t-main .msg--user::before { background: linear-gradient(135deg,rgba(28,28,26,.99),rgba(12,12,11,.99)); }
.t-main .msg--user .plate, .t-main .msg--user .plate__in { clip-path: none; padding: 0; background: none; }
.t-main .t-activity { background: #050505bb; border-color: #b9b19b33; }
.t-main .chip { background: #10100e; border-color: #b9b19b55; }

/* Central explanation becomes a compact card at the upper right of the inquiry. */
.t-app[data-state] .t-how-card { display: block; width: 100%; max-width: none; margin: 0; padding: 0; overflow: visible; scroll-margin-top: calc(var(--shell-height) + 18px); }
.t-how-toggle { display: flex; justify-content: space-between; align-items: center; gap: 20px; width: 100%; padding: 20px 26px 10px; text-align: left; }
.t-how-toggle > span { display: grid; gap: 8px; }
.t-how-eyebrow { font: 10px/1.5 var(--font-ui); letter-spacing: .16em; color: #b9b19b; }
.t-how-title { font: 400 28px/1.2 var(--font-ui); letter-spacing: -.03em; color: #f1ede2; }
.t-how-toggle svg { width: 24px; height: 24px; fill: none; stroke: #d5cbb0; stroke-width: 1.4; flex-shrink: 0; }
.t-how-content { padding: 0 26px 16px; }
.t-how-content[hidden] { display: none; }
.t-how-intro { max-width: 640px; color: #d3cfc5; font: 12px/1.7 var(--font-ui); }
.t-how-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 20px; border-top: 1px solid #b9b19b33; margin-top: 14px; padding-top: 4px; }
.t-how-foot p { color: #bdb9b0; font: 10px/1.7 var(--font-ui); }
.t-how-foot p span { padding: 0 8px; color: #c7b276; }
#explainer-open { min-height: 38px; font: 12px/1.5 var(--font-ui); color: #eeeade; text-align: left; }
#explainer-open span { padding-left: 12px; }
.t-app[data-state="conversation"] .t-how-card { margin: 0 0 22px; }
.t-how-dock { position: absolute; right: 24px; top: 50%; transform: translateY(-50%); width: 220px; }
.t-how-dock:empty { display: none; }
.t-app[data-state] .t-how-card.is-collapsed { width: 100%; margin: 0; position: relative; z-index: 3; --cut: 12px; }
.t-how-card.is-collapsed .t-how-toggle { padding: 14px 18px; gap: 16px; }
.t-how-card.is-collapsed .t-how-title { font-size: 13px; letter-spacing: 0; }
.t-how-card.is-collapsed .t-how-eyebrow { display: none; }
.t-how-card.is-collapsed .t-how-toggle svg { width: 16px; height: 16px; transform: rotate(180deg); }

/* A dedicated corner beside the input keeps particles outside the reading column. */
.t-composer-dock { position: fixed; left: calc(var(--sidebar-offset) + (100% - var(--sidebar-offset)) / 2); bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 8; width: min(1040px,calc(100% - var(--sidebar-offset) - 48px)); display: grid; grid-template-columns: minmax(0,1fr) 220px; grid-template-rows: 1fr auto; gap: 10px 20px; align-items: end; }
.t-composer-dock > .t-traditions { grid-column: 1; margin: 0; padding: 8px 16px 0; background: #080808; }
.t-app[data-state] .t-composer { grid-column: 1; grid-row: 2; position: relative; inset: auto; transform: none; width: 100%; max-width: none; margin: 0; padding: 12px 16px 4px; box-shadow: none; backdrop-filter: none; align-self: end; }
.t-particle-dock { grid-column: 2; grid-row: 1 / 3; width: 100%; display: flex; flex-direction: column; align-items: center; align-self: end; }
.t-app[data-state] .t-composer::before { background: linear-gradient(135deg,#171716fc,#080808fc); }
.t-app[data-state] .t-composer > .plate { max-width: none; background: #817b6c; box-shadow: 0 5px 14px #0004; }
.t-app[data-state] .t-composer > .plate > .plate__in { background: #080808; }
.t-composer__meta { width: 100%; max-width: none; min-height: 26px; justify-content: flex-end; }
.t-main .t-tradition { min-height: 34px; background: #10100f; border-color: #817b6c77; }
.t-main .t-tradition:disabled { opacity: 1; color: var(--bone-muted); }
.t-main .t-tradition[aria-pressed="true"] { color: #f1ede2; background: #34332d; border-color: #8a8166; box-shadow: inset 0 -2px #c7b276; }
.t-main .send { background: #ded8c9; color: #151512; border-radius: 8px 1px; box-shadow: 2px 3px 0 #000000; }
.t-main .send:disabled { opacity: 1; background: #37352f; color: #c9c4b5; box-shadow: none; }
.t-latest { position: fixed; right: max(264px,calc((100% - var(--sidebar-offset) - 1040px) / 2 + 240px)); bottom: calc(var(--composer-height) + 28px); z-index: 9; background: #191918; border-color: #817b6c; }
.t-explainer { background: #10100f; box-shadow: 16px 26px 80px #000a; border-color: #817b6c; border-radius: 18px 3px; --bone-muted: #bdb9b0; --bone-dim: #d4d0c5; }

/* Restore the original, uncropped reading-specific engraving and parchment mat. */
.t-welcome-art { align-self: center; flex-shrink: 0; margin: 0 0 22px; gap: 10px; }
.t-app[data-state="conversation"] .t-welcome-art { display: none; }
.t-welcome-art .t-plate__mat { padding: 10px; background: #d6ceb7; box-shadow: 0 12px 38px #000b, 0 0 0 1px #eee4c966; }
.t-welcome-art .t-plate__mat::before { inset: 4px; }
.t-welcome-art .t-plate__mat::after { inset: 9px; }
.t-welcome-art .t-plate__img { max-width: 100%; width: auto; max-height: clamp(160px,27vh,290px); object-fit: contain; }
.t-welcome-art .t-plate__title { font-size: 9px; line-height: 1.5; }
.t-welcome-art .t-plate__credit { font-size: 10px; line-height: 1.5; }

@media (max-width: 1150px) {
  .t-top .theoria-modebar { flex-wrap: wrap; gap: 10px; }
  .t-how-dock { position: static; width: 100%; transform: none; display: flex; justify-content: flex-end; }
  .t-app[data-state] .t-how-card.is-collapsed { width: 220px; }
  .t-composer-dock { grid-template-columns: minmax(0,1fr) 160px; gap: 10px 16px; }
  .t-particles { height: 180px; }
  .t-app[data-state] .t-workspace { padding-right: 200px; }
  .t-latest { right: 200px; }
}

@media (max-width: 900px) {
  :root { --sidebar-offset: 0px; }
  .t-sidebar { z-index: 30; }
  .t-top .t-header { padding: 0 20px; }
  .t-app[data-state] .t-workspace { padding-left: 24px; padding-right: 200px; }
}
@media (max-width: 600px) {
  :root { --cut: 16px; }
  .t-top .t-header { height: 52px; padding: 0 16px; }
  .t-top .theoria-modebar { padding: 10px 16px 12px; }
  .t-header__title, .t-app[data-state] .t-header__title { max-width: none; }
  .t-app[data-state] .t-workspace { padding-top: 20px; padding-left: 16px; padding-right: 16px; }
  .t-welcome-art { margin-bottom: 20px; max-width: 100%; }
  .t-welcome-art .t-plate__img { max-height: 175px; }
  .t-how-toggle { padding: 18px 22px 10px; }
  .t-how-title { font-size: 24px; }
  .t-how-content { padding: 0 22px 18px; }
  .t-how-toggle > span { gap: 6px; }
  .t-how-intro { font-size: 12px; }
  .t-how-foot p { display: none; }
  .t-composer-dock { width: calc(100% - 24px); bottom: max(10px,env(safe-area-inset-bottom)); grid-template-columns: minmax(0,1fr) 88px; gap: 8px 10px; background: #080808; padding-top: 10px; }
  .t-composer-dock > .t-traditions { grid-column: 1 / 3; grid-row: 1; padding-left: 6px; }
  .t-particle-dock { grid-row: 2; }
  .t-particles { height: 116px; }
  .t-app[data-state] .t-composer { width: 100%; padding: 10px 10px 4px; }
  .t-composer__input, .t-app[data-state="conversation"] .t-composer__input { min-height: 88px; padding: 14px 12px; }
  .t-composer__foot { padding: 8px; }
  .t-main .send { width: 44px; height: 44px; min-width: 44px; }
  .t-composer__meta { display: none; }
  .t-main .msg--assistant { padding: 20px; }
  .t-main .msg--user { padding: 18px 20px; }
  .t-latest { right: 16px; bottom: calc(var(--composer-height) + 22px); }
}
@media (max-width: 360px) {
  .t-how-toggle { padding-left: 18px; padding-right: 18px; }
  .t-how-content { padding-left: 18px; padding-right: 18px; }
  .t-how-title { font-size: 20px; }
  .t-how-intro { display: none; }
  .t-how-foot { margin-top: 4px; }
  .t-welcome-art .t-plate__img { max-height: 128px; }
  .t-composer-dock { grid-template-columns: minmax(0,1fr) 72px; }
  .t-main .msg--assistant { padding: 18px; }
}
@media (max-height: 540px) {
  html { scroll-padding-top: 20px; }
  .t-top { position: relative; }
  .t-app[data-state] .t-how-card { scroll-margin-top: 20px; }
  .t-top .t-header { height: 44px; }
  .t-top .theoria-modebar { padding-top: 6px; padding-bottom: 6px; }
  .t-composer-dock { bottom: 6px; }
  .t-particles { height: 96px; }
  .t-app[data-state] .t-composer { padding-top: 8px; padding-bottom: 0; }
  .t-main .t-traditions { margin-bottom: 6px; }
  .t-composer__meta { min-height: 26px; }
}
