@font-face{font-family:Inter;font-style:normal;font-weight:100 900;font-display:swap;src:url('/ui/fonts/inter-cyrillic-wght-normal.woff2') format('woff2');unicode-range:U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}
@font-face{font-family:Inter;font-style:normal;font-weight:100 900;font-display:swap;src:url('/ui/fonts/inter-latin-wght-normal.woff2') format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:Playfair;font-style:italic;font-weight:400 900;font-display:swap;src:url('/ui/fonts/playfair-display-cyrillic-wght-italic.woff2') format('woff2');unicode-range:U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}
@font-face{font-family:Playfair;font-style:italic;font-weight:400 900;font-display:swap;src:url('/ui/fonts/playfair-display-latin-wght-italic.woff2') format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}

/* Shared visual language: plum, rose ivory and champagne.
   Semantic tokens are the single source of truth for both entry points. */
:root {
  color-scheme: light;
  --plum: #25122e;
  --plum-deep: #1b0c21;
  --plum-mid: #462b49;
  --mauve: #7c587e;
  --mauve-deep: #654568;
  --paper: #f4ebe6;
  --surface: #fff8f3;
  --rose: #decbc5;
  --champagne: #d0ab90;
  --ink: #302135;
  --muted: #6e586b;
  --line: #d9c7cb;
  --line-dark: #75566e;
  --display: Georgia, "Times New Roman", serif;
  --accent: Playfair, Georgia, serif;
  --sans: Inter, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.22,1,.36,1);
  --gutter: clamp(20px, 5vw, 76px);
  --radius: 5px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; scroll-padding-top: 24px; }
body {
  margin: 0; min-height: 100vh; min-height: 100svh;
  background: var(--paper); color: var(--ink);
  font: 400 1rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
::selection { background: var(--rose); color: var(--plum); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
a, button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--mauve-deep); outline-offset: 4px; }
img { max-width: 100%; }
.icon { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.eyebrow { font-size: .69rem; font-weight: 650; letter-spacing: .16em; text-transform: uppercase; color: var(--mauve-deep); }
.section-mark { display: inline-block; width: 28px; height: 1px; background: currentColor; vertical-align: middle; margin-right: 12px; }
.primary {
  min-height: 48px; border: 1px solid var(--plum); background: var(--plum); color: var(--surface);
  border-radius: var(--radius); padding: 12px 20px; display: inline-flex; justify-content: center;
  align-items: center; gap: 12px; font-weight: 600; font-size: .875rem;
  transition: background .18s, border-color .18s;
}
.primary:hover:not(:disabled) { background: var(--mauve-deep); border-color: var(--mauve-deep); }

/* Access — a quiet editorial spread, rather than a second unrelated theme. */
.access-page { background: var(--paper); }
.atmosphere { display: none; }
.masthead { min-height: 86px; max-width: 1512px; margin: auto; padding: 15px var(--gutter); display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 7px; color: var(--plum); line-height: 1; font-weight: 700; white-space: nowrap; }
.brand img { width: 40px; height: 40px; border-radius: 4px; object-fit: contain; margin-right: 6px; }
.brand span { font-size: 1.3rem; letter-spacing: -.05em; }
.brand i { font: italic 500 1.4rem/1 var(--accent); color: var(--mauve-deep); }
.clock { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .76rem; }
.clock .icon { width: 16px; height: 16px; }
.clock time { border-left: 1px solid var(--line); padding-left: 8px; font-variant-numeric: tabular-nums; }
.access-shell { max-width: 1450px; min-height: calc(100svh - 86px); margin: auto; padding: clamp(28px,5vw,72px) var(--gutter); display: grid; grid-template-columns: minmax(0,1.05fr) minmax(360px,.95fr); align-items: stretch; }
.institution {
  background: var(--plum); color: var(--paper); min-height: 610px; position: relative; overflow: hidden;
  isolation: isolate; padding: clamp(28px,5vw,64px); display: flex; align-items: flex-end;
}
.institution::before, .institution::after {
  content: ""; position: absolute; width: 125%; height: 72%; border: 1px solid var(--champagne);
  border-radius: 50%; transform: rotate(-38deg); top: -18%; left: -38%; opacity: .55; z-index: -1; pointer-events: none;
}
.institution::after { width: 140%; height: 100%; top: -40%; left: -21%; border: 44px solid var(--plum-mid); opacity: .75; transform: rotate(-42deg); }
.institution .art { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: -1; }
.art-light,.sculpture,.star-field { display: none; }
.map-ring { position: absolute; width: 105%; height: 48%; border: 1px solid var(--line-dark); border-radius: 50%; top: 12%; left: -12%; transform: rotate(-37deg); }
.ring-two { top: 1%; left: -1%; width: 117%; border-color: var(--mauve); }
.ring-three { top: 23%; left: -31%; width: 115%; border-color: var(--champagne); opacity: .38; }
.institute-title { position: relative; max-width: 100%; }
.institute-title .section-mark { color: var(--champagne); margin-bottom: 22px; }
.institute-title p { margin: 0; }
.institute-title > p:first-of-type { font-size: clamp(1rem,1.8vw,1.5rem); font-weight: 450; }
.institute-title h2 { font: 400 clamp(4rem,7vw,7.5rem)/1.12 var(--display); letter-spacing: -.065em; margin: .06em 0 .18em; color: var(--paper); }
.institute-name { color: var(--rose); font-size: .9rem; }
.access-card { background: var(--surface); border: 1px solid var(--line); border-left: 0; padding: clamp(26px,4.5vw,60px); align-self: stretch; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); margin-bottom: 28px; }
.mode-switch button { background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 12px 5px; font-size: .85rem; color: var(--muted); }
.mode-switch button[aria-pressed=true] { border-color: var(--plum); color: var(--plum); font-weight: 650; }
.access-card h1 { font: 400 clamp(2rem,3.3vw,3rem)/1.15 var(--display); letter-spacing: -.035em; color: var(--plum); margin: 0 0 12px; }
.access-card h1 em { color: var(--mauve-deep); font-family: var(--accent); }
#access-help { font-size: .875rem; color: var(--muted); margin: 0 0 25px; }
#account-form { display: grid; gap: 17px; }
.name-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px; }
#account-form label { display: grid; min-width: 0; gap: 6px; font-size: .78rem; font-weight: 600; color: var(--plum); }
#account-form input,#account-form select {
  width: 100%; min-width: 0; height: 48px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper); font-size: .88rem; font-weight: 400; color: var(--ink);
}
#account-form input::placeholder { color: var(--muted); opacity: .85; }
#account-form input:focus,#account-form select:focus { border-color: var(--mauve-deep); outline: 1px solid var(--mauve-deep); outline-offset: 0; }
.input-shell { display: flex; align-items: center; position: relative; }
.input-shell > .icon { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--mauve-deep); pointer-events: none; }
#account-form .input-shell input,#account-form .input-shell select { padding-left: 38px; }
#account-form select { appearance: none; padding-right: 35px; }
.input-shell .select-chevron { right: 12px; left: auto; }
#account-form [name=password] { padding-right: 46px; }
.eye { position: absolute; right: 5px; background: transparent; border: 0; padding: 10px; color: var(--muted); }
.eye .icon { width: 18px; height: 18px; }
.auth-submit { margin-top: 4px; width: 100%; justify-content: space-between; }
.error { color: var(--plum); font-size: .8rem; background: var(--rose); padding: 10px; margin: 0; border-left: 3px solid var(--mauve-deep); }

/* AI assistant — unobtrusive reading and composing surfaces. */
.chat-shell { width: 100%; max-width: 850px; margin: auto; min-width: 0; }
.welcome { padding: 8px 0 28px; }
.welcome .art { display: none; }
.welcome h1 { margin: 16px 0 0; font: 400 clamp(2.4rem,5vw,4rem)/1.15 var(--display); color: var(--plum); letter-spacing: -.035em; }
.welcome h1 em { color: var(--mauve-deep); font-family: var(--accent); }
.composer-wrap { position: relative; }
#composer { background: var(--surface); border: 1px solid var(--line); padding: 18px 20px 14px; border-radius: 8px; transition: border-color .18s; }
#composer:focus-within { border-color: var(--mauve-deep); }
#question { display: block; width: 100%; min-height: 65px; max-height: 155px; border: 0; background: transparent; resize: none; padding: 6px 2px; color: var(--ink); font-size: 1rem; line-height: 1.6; }
#question:focus-visible { outline: none; }
#question::placeholder { color: var(--muted); }
.composer-foot,.group-context,.send-controls { display: flex; align-items: center; gap: 12px; }
.composer-foot { justify-content: space-between; border-top: 1px solid var(--line); padding-top: 12px; gap: 16px; }
.group-context { color: var(--muted); font-size: .75rem; min-width: 0; }
.group-context .icon { width: 16px; height: 16px; color: var(--mauve-deep); }
.key-hint { font-size: .67rem; color: var(--muted); white-space: nowrap; }
kbd { font: inherit; border: 1px solid var(--line); padding: 2px 4px; border-radius: 3px; }
.send { min-height: 44px; padding: 9px 14px; }
.send .icon { width: 17px; height: 17px; }
#suggestions { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin-top: 20px; }
.suggest { text-align: left; background: transparent; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; transition: background .2s, border-color .2s; }
.suggest:hover { background: var(--surface); border-color: var(--mauve); }
.suggest-top { display: flex; align-items: center; gap: 8px; color: var(--mauve-deep); font-size: .75rem; font-weight: 650; }
.suggest-top .icon { width: 17px; height: 17px; }
.suggest-text { display: block; margin-top: 14px; color: var(--ink); font-size: .84rem; line-height: 1.5; }
#log:empty { display: none; }
.in-dialog .welcome,.in-dialog #suggestions { display: none; }
#log { display: flex; flex-direction: column; gap: 27px; padding: 10px 0 28px; }
.message { min-width: 0; overflow-wrap: anywhere; font-size: .95rem; }
.message.user { align-self: flex-end; max-width: 85%; white-space: pre-wrap; background: var(--plum); color: var(--surface); padding: 13px 19px; border-radius: 8px 8px 2px 8px; }
.message.assistant { width: 100%; }
.byline { display: flex; align-items: center; gap: 9px; font-size: .78rem; font-weight: 700; color: var(--plum); margin-bottom: 12px; }
.byline img { width: 30px; height: 30px; object-fit: contain; border-radius: 4px; }
.response { line-height: 1.78; }
.response p,.response ul,.response ol,.response pre,.table-frame { margin: 0 0 15px; }
.response h3 { font: 650 1.13rem/1.4 var(--sans); color: var(--plum); margin: 24px 0 12px; }
.response > :first-child { margin-top: 0; }
.response > :last-child { margin-bottom: 0; }
.response strong { color: var(--plum); font-weight: 650; }
.response ul,.response ol { padding-left: 24px; }
.response li::marker { color: var(--mauve-deep); }
.response code { font-size: .9em; background: var(--rose); padding: 2px 5px; border-radius: 3px; }
.response pre { padding: 16px; border-radius: var(--radius); background: var(--plum); color: var(--paper); white-space: pre; overflow: auto; }
.table-frame { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.response table { border-collapse: collapse; width: 100%; font-size: .85rem; }
.response th,.response td { text-align: left; padding: 10px 13px; border-bottom: 1px solid var(--line); }
.response th { background: var(--rose); color: var(--plum); }
.response tr:last-child td { border-bottom: 0; }
.room-ref { color: var(--mauve-deep); font-weight: 650; }
#status { font-size: .82rem; color: var(--muted); padding: 0 0 15px; }
#status.thinking { display: flex; align-items: center; gap: 9px; }
.thinking::before { content: ""; width: 11px; height: 11px; border: 1px solid var(--line); border-top-color: var(--plum); border-radius: 50%; animation: spin .85s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.in-dialog .composer-wrap { position: sticky; bottom: 12px; z-index: 2; background: var(--paper); padding-top: 8px; }
@media (max-width: 850px) {
  .access-shell { grid-template-columns: minmax(0,1fr); max-width: 650px; }
  .institution { min-height: 230px; padding: 26px; }
  .institute-title h2 { font-size: 3.75rem; }
  .institute-title .section-mark { margin-bottom: 10px; }
  .access-card { border-left: 1px solid var(--line); border-top: 0; }
  .key-hint { display: none; }
}
@media (max-width: 580px) {
  .masthead { min-height: 68px; }
  .access-shell { padding-top: 20px; }
  .institution { min-height: 200px; }
  .access-card { padding: 25px 20px; }
  #suggestions { grid-template-columns: minmax(0,1fr); gap: 8px; }
  .suggest { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px; }
  .suggest-text { margin-top: 0; text-align: right; }
  #composer { padding: 12px; }
  .group-context { font-size: .68rem; }
  .send { padding: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Signature finish — tactile surfaces, controlled depth and motion. */
:root {
  --shadow-soft: 0 12px 36px -22px #462b4966, 0 2px 6px #25122e0b;
  --shadow-lift: 0 20px 48px -20px #462b4977, 0 4px 12px #25122e12;
  --shadow-dark: 0 26px 60px -24px #25122e88;
  --metal: linear-gradient(125deg,#462b49 0%,#25122e 48%,#654568 100%);
  --light-surface: linear-gradient(145deg,#fff8f3 0%,#f4ebe6 100%);
  --radius: 12px;
}
body { background: radial-gradient(ellipse at 95% 8%,#decbc566,transparent 34rem),var(--paper); }
.primary,.action {
  position: relative; isolation: isolate; overflow: hidden;
  border-radius: 11px; background: var(--metal); box-shadow: 0 6px 18px -7px #25122e99, inset 0 1px 0 #f4ebe630;
  transition: transform .28s var(--ease),box-shadow .28s var(--ease),border-color .28s,background .28s;
}
.primary::before,.action::before {
  content:""; position:absolute; inset:0; z-index:-1; pointer-events:none;
  background: radial-gradient(ellipse at var(--px,50%) var(--py,50%),#ab899e55,transparent 65%);
  opacity:0; transition:opacity .3s;
}
.primary::after,.action::after {
  content:""; position:absolute; inset:-35% auto -35% -65%; width:45%; pointer-events:none;
  transform:skewX(-23deg); background:linear-gradient(90deg,transparent,#f4ebe638,transparent);
  transition:left .7s var(--ease);
}
.primary:not(:disabled):active,.action:active { transform:translateY(1px) scale(.98); }
.primary .icon { transition:transform .3s var(--ease); }
@media (hover:hover) and (pointer:fine) {
  .primary:not(:disabled):hover,.action:hover { background:var(--metal); transform:translateY(-3px); border-color:var(--mauve); box-shadow:0 14px 30px -12px #25122eaa,inset 0 1px 0 #f4ebe650; }
  .primary:not(:disabled):hover::before,.action:hover::before { opacity:1; }
  .primary:not(:disabled):hover::after,.action:hover::after { left:130%; }
  .primary:not(:disabled):hover .icon { transform:translate(2px,-2px); }
}
.silk-art { position:absolute; inset:0; width:100%; height:100%; z-index:-1; display:block; pointer-events:none; }
.silk-drift { transform-origin: 50% 50%; transform-box: view-box; animation: silk-breathe 16s ease-in-out infinite alternate; }
.silk-orbit { transform-origin: 50% 50%; transform-box: view-box; animation: orbit-breathe 20s ease-in-out infinite alternate; }
@keyframes silk-breathe { from {transform:translate(-8px,3px) rotate(-1.8deg) scale(1.03)} to {transform:translate(11px,-6px) rotate(1.5deg) scale(1.075)} }
@keyframes orbit-breathe { from {transform:rotate(-3deg)} to {transform:rotate(4deg)} }
@keyframes rise-in { from { opacity:0;transform:translateY(20px); } to {opacity:1;transform:translateY(0);} }
@keyframes line-grow { from {transform:scaleX(0)} to {transform:scaleX(1)} }
@keyframes jewel-in { from {opacity:0;transform:translateY(12px) scale(.94)} to {opacity:1;transform:translateY(0) scale(1)} }
@keyframes ring-pulse { 0%,100% {opacity:.55;} 50% {opacity:1;} }
.access-shell { gap:0; animation:rise-in .7s var(--ease) both; }
.institution { border-radius:24px 0 0 24px; box-shadow:var(--shadow-dark); min-height:640px; }
.institution::before,.institution::after { display:none; }
.institution-index { position:absolute; top:28px; left:clamp(28px,5vw,64px); color:var(--champagne); font-size:.66rem; letter-spacing:.18em; }
.institution .institute-title { text-shadow:0 3px 22px #1b0c2177; }
.institute-title h2 { animation:rise-in .85s .15s var(--ease) both; }
.access-card { border-radius:0 24px 24px 0; background:var(--light-surface); box-shadow:var(--shadow-soft); }
.mode-switch { position:relative; background:#decbc544; padding:5px; border:1px solid var(--line); border-radius:12px; gap:4px; }
.mode-switch button { border:0; border-radius:8px; transition:background .24s,box-shadow .24s,color .24s; }
.mode-switch button[aria-pressed=true] { background:var(--surface); box-shadow:0 3px 10px #462b4920; }
#account-form input,#account-form select { background:#fff8f3; transition:border-color .2s,box-shadow .2s,background .2s; }
#account-form input:hover,#account-form select:hover { border-color:var(--mauve); }
#account-form input:focus,#account-form select:focus { background:var(--surface); outline:none; box-shadow:0 0 0 4px #7c587e20; }
.auth-submit { min-height:52px; }
.welcome { position:relative; isolation:isolate; overflow:hidden; padding:clamp(30px,5vw,60px) clamp(22px,4vw,44px); background:var(--light-surface); border:1px solid var(--line); border-radius:20px; box-shadow:var(--shadow-soft); margin-bottom:22px; }
.welcome-text { position:relative; z-index:1; max-width:76%; }
.assistant-orbit { position:absolute; right:-35px; top:-45px; width:220px; height:220px; color:var(--mauve); transform:rotate(-26deg); pointer-events:none; opacity:.65; }
.assistant-orbit i { position:absolute; inset:25px; border:1px solid currentColor; border-radius:50%; transform:scaleY(.49) rotate(25deg); animation:ring-pulse 5s ease-in-out infinite; }
.assistant-orbit i:nth-child(2) { transform:scaleY(.7) rotate(78deg); inset:12px; opacity:.5; }
.assistant-orbit i:nth-child(3) { transform:scaleY(.57) rotate(-41deg); inset:3px; }
.assistant-orbit span { position:absolute; top:43%; left:44%; font-size:32px; color:var(--mauve-deep); }
#composer { border-radius:18px; background:var(--surface); box-shadow:var(--shadow-soft); transition:border-color .25s,box-shadow .25s; }
#composer:focus-within { box-shadow:0 0 0 4px #7c587e1a,var(--shadow-lift); }
.suggest { position:relative; overflow:hidden; isolation:isolate; border-radius:14px; background:var(--light-surface); box-shadow:var(--shadow-soft); transition:transform .25s var(--ease),box-shadow .25s,border-color .25s; }
.suggest::before { content:""; position:absolute; inset:0; z-index:-1; opacity:0; pointer-events:none; background:radial-gradient(ellipse at var(--px,50%) var(--py,50%),#decbc599,transparent 75%); transition:opacity .25s; }
@media (hover:hover) and (pointer:fine) {
  .suggest:hover { transform:translateY(-4px); box-shadow:var(--shadow-lift); }
  .suggest:hover::before { opacity:1; }
}
.message { animation:rise-in .36s var(--ease) backwards; }
.message.user { background:var(--metal); border-radius:16px 16px 4px 16px; box-shadow:var(--shadow-soft); }
.message.assistant { padding:clamp(16px,3vw,26px); background:var(--surface); border:1px solid var(--line); border-radius:16px; box-shadow:var(--shadow-soft); }
.in-dialog .composer-wrap { background:transparent; backdrop-filter:blur(12px); border-radius:18px; }
@media (max-width:850px) {
 .institution { min-height:250px; border-radius:20px 20px 0 0; }
 .access-card { border-radius:0 0 20px 20px; }
 .institution-index { top:18px; }
}
@media (max-width:580px) {
 .institution { min-height:215px; }
 .welcome-text { max-width:100%; }
 .assistant-orbit { right:-115px; opacity:.3; }
 .welcome { padding:25px 19px; }
}
@media (prefers-reduced-motion:reduce) {
 .silk-drift,.silk-orbit,.assistant-orbit i,.message,.access-shell,.institute-title h2 { animation:none!important; }
 .primary:hover,.action:hover,.suggest:hover { transform:none!important; }
}
