:root {
  color-scheme: light;
  --blue: #05509f;
  --deep: #12345b;
  --orange: #f45928;
  --text: #162b43;
  --muted: #48627b;
  --line: #dce5ee;
  --paper: #f5f8fc;
  --white: #fff;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; color: var(--text); background: var(--paper); }
.landing { min-height: 100dvh; display: flex; flex-direction: column; }
a { color: inherit; }
button, textarea { font: inherit; }
a:focus-visible, button:focus-visible, textarea:focus-visible { outline: 3px solid var(--orange); outline-offset: 4px; }
[hidden] { display: none !important; }
.shell { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
.masthead { background: var(--white); border-bottom: 1px solid var(--line); }
.masthead-inner { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.college { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.college-mark { display: grid; place-items: center; width: 42px; height: 42px; flex: none; background: var(--blue); border-radius: 11px; }
.college strong { display: block; color: var(--blue); font-size: 18px; line-height: 1.1; letter-spacing: .04em; font-weight: 800; }
.college small { display: block; color: var(--muted); margin-top: 4px; font-size: 12px; }
.upper-link { display: inline-flex; align-items: center; gap: 7px; border: 0; color: var(--blue); background: transparent; font-weight: 650; font-size: 14px; text-decoration: none; cursor: pointer; }
.upper-link:hover, .footer a:hover { text-decoration: underline; text-underline-offset: 4px; }
.landing-main { flex: 1 0 auto; padding-top: clamp(34px, 6vw, 79px); }
.hero { align-items: center; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .95fr); gap: clamp(30px, 6vw, 92px); }
.orange-rule { display: block; background: var(--orange); width: 44px; height: 4px; border-radius: 2px; margin-bottom: 23px; }
.hero h1 { margin: 0; color: var(--deep); font-size: clamp(46px, 6vw, 84px); letter-spacing: -.064em; line-height: 1.015; font-weight: 780; }
.hero h1 span { color: var(--blue); }
.hero p { max-width: 36ch; margin: 22px 0 0; color: var(--muted); font-size: clamp(16px, 1.7vw, 19px); line-height: 1.58; }
.hero-art { min-height: 328px; aspect-ratio: 1.22; display: grid; place-items: center; position: relative; isolation: isolate; overflow: hidden; border-radius: 30px; background: radial-gradient(ellipse at 26% 18%, #1769b9, transparent 58%), linear-gradient(145deg, #0a529c, #083165); }
.wave { position: absolute; z-index: -1; top: 50%; left: 50%; width: 75%; aspect-ratio: 1; border: 1px solid #ffffff32; border-radius: 50%; transform: translate(-50%, -50%); }
.wave-a { width: 65%; }
.wave-c { width: 94%; }
.hero-avatar { width: 59%; border: 1px solid #ffffff5a; border-radius: 24%; overflow: hidden; transform: rotate(-6deg); background: var(--blue); box-shadow: 0 24px 50px #00234b8c, 0 3px 12px #001d4833; }
.hero-avatar img { width: 100%; height: auto; display: block; }
.channels { margin-top: clamp(35px, 6vw, 66px); }
.channels h2 { font-size: clamp(20px, 2.6vw, 26px); color: var(--deep); margin: 0 0 15px; letter-spacing: -.025em; }
.channel-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.channel { min-height: 110px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; border: 1px solid var(--line); border-radius: 14px; padding: 19px; background: var(--white); text-decoration: none; transition: border-color .15s, background .15s; }
.channel:hover { border-color: #7ba3ca; background: #fafdff; }
.channel strong { display: block; color: var(--deep); font-size: 20px; }
.channel-icon { display: grid; place-items: center; height: 52px; width: 52px; border-radius: 13px; }
.telegram-icon { background: #e6f4fe; }
.telegram-icon img { filter: invert(28%) sepia(67%) saturate(2566%) hue-rotate(181deg); }
.max-icon { background: #eeeaff; }
.web-icon { background: #05509f18; color: var(--blue); }
.channel-arrow { color: var(--blue); font-size: 22px; padding-inline: 7px; }
.footer { margin-top: 44px; border-top: 1px solid var(--line); padding-block: 20px 26px; color: var(--muted); font-size: 13px; }
.footer a { text-decoration: none; }
.chat-page { --chat-width: 840px; --chat-inset: 20px; --history-toolbar-inset: 20px; --history-button-height: 42px; --history-width: clamp(245px, 23vw, 306px); --history-motion: 250ms cubic-bezier(.2, .75, .2, 1); min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr auto; grid-template-areas: "header" "chat" "compose"; }
.chat-page > .masthead { grid-area: header; }
.chat-page.history-overlay { overflow: hidden; }
.chat-page .masthead-inner { width: 100%; margin: 0; padding-inline: 52px 14px; justify-content: flex-start; }
.history-dock { --history-mobile-width: min(var(--history-width), calc(100vw - 54px)); position: fixed; inset: 0 auto 0 0; z-index: 5; width: 0; pointer-events: none; transition: width var(--history-motion); }
.history-open .history-dock { width: var(--history-mobile-width); }
.history-toggle { position: absolute; z-index: 1; top: 13px; left: calc(100% + 7px); display: grid; place-items: center; width: 36px; height: var(--history-button-height); transition: top var(--history-motion); padding: 0; border: 1px solid #b6cde1; border-radius: 9px; color: var(--blue); background: var(--white); font-size: 20px; line-height: 1; font-weight: 700; cursor: pointer; pointer-events: auto; }
.history-overlay .history-toggle { top: var(--history-toolbar-inset); }
.history-toggle:hover { border-color: #7ba3ca; background: #eaf3ff; }
.history-toggle > span { display: block; transform: rotate(0deg); transition: transform 140ms ease-out; }
.history-toggle[aria-expanded="true"] > span { transform: rotate(180deg); }
.history-panel { position: absolute; inset: 0 0 0 auto; width: var(--history-mobile-width); min-width: 0; background: var(--paper); color: var(--text); visibility: hidden; transition: visibility 0s 250ms; }
.history-open .history-panel { visibility: visible; pointer-events: auto; transition-delay: 0s; }
.history-surface { height: 100%; padding: var(--history-toolbar-inset) 17px; border-right: 1px solid var(--line); overflow-y: auto; overscroll-behavior: contain; }
.history-backdrop { position: fixed; inset: 0; z-index: 4; border: 0; padding: 0; background: #12345b60; opacity: 0; visibility: hidden; transition: opacity var(--history-motion), visibility 0s 250ms; }
.history-overlay .history-backdrop { opacity: 1; visibility: visible; transition-delay: 0s; }
.history-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 22px; }
.history-new { display: flex; flex: 1; align-items: center; justify-content: center; gap: 7px; min-height: var(--history-button-height); padding: 6px 10px; border: 1px dashed #6d9bc5; border-radius: 9px; background: var(--white); color: var(--blue); font-weight: 650; font-size: 15px; cursor: pointer; }
.history-new:hover:not(:disabled) { background: #eaf3ff; border-color: var(--blue); }
.history-new span { font-size: 18px; line-height: 1; }
.history-title { margin: 0 0 13px; color: var(--deep); font-size: 21px; letter-spacing: -.025em; }
.history-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.history-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding-right: 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); }
.history-row:hover, .history-row.current { border-color: #7ba3ca; background: #eaf3ff; }
.history-entry { display: grid; gap: 5px; width: 100%; min-width: 0; text-align: left; overflow-wrap: anywhere; padding: 11px 9px 11px 13px; border: 0; border-radius: 9px; background: transparent; color: var(--text); cursor: pointer; }
.history-delete { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.history-delete:hover:not(:disabled) { background: #feeceb; color: #aa2922; }
.history-entry:disabled, .history-delete:disabled, .history-new:disabled { opacity: .55; cursor: wait; }
.history-entry time, .history-empty { color: var(--muted); font-size: 13px; }
.chat-shell { grid-area: chat; width: min(var(--chat-width), calc(100% - 2 * var(--chat-inset))); min-width: 0; margin: 0 auto; }
.chat-intro { display: grid; justify-items: center; text-align: center; padding: clamp(38px, 9vh, 98px) 0 35px; }
.intro-avatar { border-radius: 23px; box-shadow: 0 9px 24px #0b4c9e25; }
.chat-intro h1 { margin: 20px 0 7px; color: var(--deep); font-size: clamp(29px, 5vw, 44px); line-height: 1.12; letter-spacing: -.045em; }
.chat-intro p { margin: 0; max-width: 42ch; color: var(--muted); line-height: 1.55; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 23px; }
.suggestions button { color: var(--blue); background: var(--white); border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; cursor: pointer; font-size: 14px; }
.suggestions button:hover { border-color: #8eb6dd; }
.transcript { display: grid; grid-template-columns: minmax(0, 1fr); gap: 19px; padding: 32px 0; overflow-wrap: anywhere; }
.turn { width: fit-content; min-width: 0; max-width: min(100%, 70ch); border-radius: 15px; line-height: 1.55; padding: 13px 17px; }
.turn.user { justify-self: end; background: #e2efff; border-bottom-right-radius: 4px; color: #133d69; white-space: pre-wrap; }
.turn.assistant { justify-self: start; background: white; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.turn.assistant > :first-child { margin-top: 0; }
.turn.assistant > :last-child { margin-bottom: 0; }
.turn.assistant a { color: var(--blue); }
.turn.assistant pre { max-width: 100%; background: var(--paper); padding: 9px; overflow-x: auto; border-radius: 7px; }
.turn.pending { color: var(--muted); }
.turn.pending::after { content: ""; display: inline-block; width: 4px; height: 4px; margin: 0 12px 2px 7px; border-radius: 50%; background: var(--blue); box-shadow: 6px 0 0 #78a4cc, 12px 0 0 #bbd1e7; animation: reply-wait 1.2s ease-in-out infinite; }
@keyframes reply-wait { 50% { opacity: .3; } }
.turn.failed { color: #a1301a; }
.composer-wrap { grid-area: compose; width: 100%; position: sticky; bottom: 0; padding: 12px var(--chat-inset) clamp(10px, 2vh, 20px); background: var(--paper); }
.composer { width: min(var(--chat-width), 100%); display: flex; align-items: end; gap: 12px; margin: 0 auto; padding: 8px; border: 1px solid #bfd0e1; border-radius: 13px; background: white; box-shadow: 0 4px 14px #12345b0b; }
.composer:focus-within { border-color: var(--blue); }
.composer textarea { resize: vertical; min-width: 0; flex: 1; min-height: 40px; max-height: 9em; line-height: 1.5; padding: 8px; outline: none; border: 0; color: var(--text); background: white; }
.composer textarea:focus-visible { outline: none; }
.composer button { flex: none; display: grid; place-items: center; width: 42px; height: 42px; background: var(--blue); border: 0; border-radius: 9px; color: white; cursor: pointer; }
.composer button:disabled { opacity: .45; cursor: wait; }
.composer-note { margin: 7px auto 0; max-width: var(--chat-width); color: var(--muted); font-size: 12px; text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (min-width: 980px) {
  .chat-page { grid-template-columns: 0px 48px minmax(0, 1fr); grid-template-areas: "header header header" "history rail chat" "history rail compose"; transition: grid-template-columns var(--history-motion); }
  .chat-page.history-open { grid-template-columns: var(--history-width) 48px minmax(0, 1fr); }
  .chat-page .masthead-inner { padding-inline: 17px; }
  .history-dock, .history-open .history-dock { position: relative; inset: auto; grid-row: 2 / 4; grid-column: 1 / 3; display: grid; grid-template-columns: minmax(0, 1fr) 48px; width: 100%; transition: none; }
  .history-panel { position: relative; grid-row: 1; grid-column: 1; inset: auto; width: 100%; overflow: clip; }
  .history-toggle { position: sticky; grid-row: 1; grid-column: 2; justify-self: center; align-self: start; top: var(--history-toolbar-inset); left: auto; margin-top: var(--history-toolbar-inset); }
  .history-surface { position: sticky; top: 0; width: var(--history-width); height: min(100%, calc(100dvh - 77px)); transform: translateX(-12px); opacity: 0; transition: transform var(--history-motion), opacity var(--history-motion); }
  .history-open .history-surface { transform: none; opacity: 1; }
  .history-backdrop { display: none; }
}
@media (max-width: 740px) {
  .shell { width: calc(100% - 36px); }
  .masthead-inner { min-height: 66px; }
  .hero { grid-template-columns: 1fr; gap: 25px; }
  .hero h1 { font-size: clamp(46px, 10vw, 64px); }
  .hero-art { aspect-ratio: 1.65; min-height: 0; border-radius: 20px; }
  .hero-avatar { width: 45%; }
  .channels { margin-top: 30px; }
  .channel-grid { gap: 8px; }
  .channel { position: relative; min-height: 104px; padding: 10px; gap: 8px; grid-template-columns: minmax(0, 1fr); align-content: start; justify-items: start; }
  .channel strong { font-size: 16px; line-height: 1.15; }
  .channel-icon { width: 39px; height: 39px; border-radius: 9px; }
  .channel-icon img, .channel-icon svg { width: 23px; height: 23px; }
  .channel-arrow { position: absolute; top: 10px; right: 8px; font-size: 16px; padding: 0; }
  .footer { margin-top: 32px; }
  .chat-page { --chat-inset: 13px; }
  .chat-page .masthead-inner { gap: 8px; }
  .chat-page .college { min-width: 0; gap: 7px; }
  .chat-page .college small { line-height: 1.15; }
}
@media (max-width: 360px) {
  .college small { font-size: 10px; }
  .channel { padding-inline: 8px; }
  .channel strong { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
