/* Учебный форум — «конфетный» премиум-UI (светлая тема) */
:root {
  --mouse-x: 0;
  --mouse-y: 0;

  --ink: #0f172a;
  --ink-soft: #334155;
  --ink-faint: #64748b;

  --cream: #fffdfb;
  --snow: #ffffff;

  --violet-900: #1e1b4b;
  --violet-700: #4338ca;
  --violet-500: #6366f1;
  --violet-300: #a5b4fc;

  --coral: #fb7185;
  --apricot: #fdba74;
  --mint: #5eead4;
  --sky: #7dd3fc;

  --grad-brand: linear-gradient(125deg, #4338ca 0%, #6366f1 38%, #0ea5e9 100%);
  --grad-heat: linear-gradient(125deg, #f43f5e 0%, #fb923c 45%, #fbbf24 100%);
  --grad-card-edge: linear-gradient(135deg, rgba(99, 102, 241, 0.45), rgba(244, 114, 182, 0.35), rgba(14, 165, 233, 0.4));

  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-pill: 999px;

  --font-ui: "Figtree", system-ui, sans-serif;
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 30px rgba(15, 23, 42, 0.08), 0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 50px -12px rgba(30, 27, 75, 0.18);
  --shadow-glow: 0 0 0 1px rgba(255, 255, 255, 0.65) inset, 0 12px 40px rgba(99, 102, 241, 0.12);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

::selection {
  background: rgba(99, 102, 241, 0.22);
  color: var(--ink);
}

.app-surface {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--cream);
  position: relative;
  overflow-x: hidden;
}

/* Атмосферные пятна + лёгкий параллакс от курсора */
.app-surface::before,
.app-surface::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.app-surface::before {
  background:
    radial-gradient(ellipse 90% 70% at calc(8% + var(--mouse-x) * 18px) calc(12% + var(--mouse-y) * 14px), rgba(165, 180, 252, 0.55), transparent 55%),
    radial-gradient(ellipse 70% 55% at calc(92% - var(--mouse-x) * 12px) calc(8% + var(--mouse-y) * 10px), rgba(251, 113, 133, 0.35), transparent 50%),
    radial-gradient(ellipse 60% 50% at calc(50% + var(--mouse-x) * 8px) calc(88% - var(--mouse-y) * 12px), rgba(125, 211, 252, 0.45), transparent 48%),
    linear-gradient(180deg, #faf5ff 0%, #fff7ed 35%, #ecfeff 100%);
  transition: opacity 0.6s ease;
}

.app-surface::after {
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 3.5rem;
}

a {
  color: var(--violet-700);
  text-decoration: none;
  transition: color 0.18s ease;
}

a:hover {
  color: #db2777;
}

/* ——— Шапка ——— */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.1rem;
  margin: 0 0 1.75rem;
  background: rgba(255, 253, 251, 0.72);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-md), var(--shadow-glow);
  position: sticky;
  top: 0.65rem;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: inherit;
}

.brand:hover {
  color: inherit;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(67, 56, 202, 0.35);
}

.brand-mark__inner {
  position: absolute;
  inset: 0;
  background: var(--grad-brand);
  animation: hueShift 14s ease-in-out infinite alternate;
}

.brand-mark__letter {
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
  color: #fff;
  letter-spacing: -0.04em;
  line-height: 1;
}

@keyframes hueShift {
  0% {
    filter: hue-rotate(-8deg) saturate(1.1);
  }
  100% {
    filter: hue-rotate(12deg) saturate(1.25);
  }
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0;
  line-height: 1.15;
  background: linear-gradient(105deg, #1e1b4b 0%, #4338ca 50%, #0c4a6e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-sub {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-faint);
  margin: 0;
  letter-spacing: 0.01em;
}

.nav-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  font-size: 0.92rem;
}

.user-greet {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.user-greet strong {
  color: var(--ink);
  font-weight: 600;
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--violet-900);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(99, 102, 241, 0.22);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.nav-pill:hover {
  transform: translateY(-1px);
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.15);
  color: var(--violet-700);
}

/* ——— Кнопки ——— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-pill);
  border: none;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.14s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  color: #fff;
  background: var(--grad-brand);
  box-shadow: 0 4px 18px rgba(67, 56, 202, 0.38);
}

.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.35) 50%, transparent 60%);
  transform: translateX(-120%);
  transition: transform 0.55s ease;
}

.btn-primary:hover {
  filter: brightness(1.05);
  box-shadow: 0 8px 28px rgba(67, 56, 202, 0.45);
}

.btn-primary:hover::after {
  transform: translateX(120%);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.95);
  color: var(--violet-700);
  border: 2px solid rgba(99, 102, 241, 0.28);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: rgba(238, 242, 255, 0.98);
  border-color: rgba(99, 102, 241, 0.45);
}

.btn-danger {
  background: linear-gradient(125deg, #e11d48, #fb7185);
  color: #fff;
  box-shadow: 0 4px 16px rgba(225, 29, 72, 0.35);
}

.btn-danger:hover {
  filter: brightness(1.06);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  background: rgba(15, 23, 42, 0.05);
  color: var(--ink);
}

.btn-sm {
  padding: 0.38rem 0.85rem;
  font-size: 0.82rem;
}

.btn:focus-visible,
.nav-pill:focus-visible,
.brand:focus-visible {
  outline: 3px solid rgba(99, 102, 241, 0.45);
  outline-offset: 2px;
}

/* ——— Карточки ——— */
.card {
  position: relative;
  background: rgba(255, 253, 251, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-xl);
  padding: 1.4rem 1.55rem;
  margin-bottom: 1.35rem;
  box-shadow: var(--shadow-md), var(--shadow-glow);
  border: 1px solid rgba(255, 255, 255, 0.85);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--grad-card-edge);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.55;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.card--search {
  padding: 1.15rem 1.35rem;
}

.card--search:hover {
  transform: none;
}

.card > h2:first-child,
.card > h3:first-child {
  margin-top: 0;
}

.card h2,
.card h3 {
  font-family: var(--font-display);
  color: var(--ink);
  letter-spacing: -0.02em;
}

.card h2 {
  font-size: 1.42rem;
  font-weight: 800;
}

/* ——— Герой (главная) ——— */
.page-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  padding: 1.6rem 1.75rem 1.75rem;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, rgba(67, 56, 202, 0.1) 0%, rgba(251, 113, 133, 0.12) 50%, rgba(14, 165, 233, 0.12) 100%);
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

@media (min-width: 720px) {
  .page-hero {
    grid-template-columns: 1.15fr 0.85fr;
    align-items: center;
  }
}

.page-hero::after {
  content: "";
  position: absolute;
  width: 280px;
  height: 280px;
  right: -80px;
  top: -100px;
  background: radial-gradient(circle, rgba(251, 113, 133, 0.35), transparent 65%);
  pointer-events: none;
}

.page-hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--violet-700);
  margin: 0 0 0.5rem;
}

.page-hero__eyebrow::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--grad-heat);
  box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.25);
}

.page-hero__title {
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 4vw, 2.35rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.035em;
  margin: 0 0 0.65rem;
  color: var(--violet-900);
}

.page-hero__text {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1.02rem;
  max-width: 36ch;
}

.page-hero__art {
  position: relative;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-orbit {
  position: relative;
  width: min(100%, 220px);
  aspect-ratio: 1;
}

.hero-orbit__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px dashed rgba(99, 102, 241, 0.28);
  animation: spinSlow 28s linear infinite;
}

.hero-orbit__core {
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background: var(--grad-brand);
  box-shadow: 0 12px 40px rgba(67, 56, 202, 0.4), inset 0 0 0 4px rgba(255, 255, 255, 0.25);
  display: grid;
  place-items: center;
  font-size: 2.5rem;
}

@keyframes spinSlow {
  to {
    transform: rotate(360deg);
  }
}

/* ——— Формы ——— */
.field {
  margin-bottom: 1.05rem;
}

.field--tight {
  margin-bottom: 0;
}

.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 0.4rem;
  letter-spacing: 0.02em;
}

.input,
select.input,
textarea.input {
  width: 100%;
  padding: 0.78rem 1rem;
  border: 2px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  transition: border-color 0.18s ease, box-shadow 0.22s ease, background 0.18s ease;
}

.input:hover,
select.input:hover,
textarea.input:hover {
  border-color: rgba(99, 102, 241, 0.25);
}

.input:focus,
select.input:focus,
textarea.input:focus {
  outline: none;
  border-color: rgba(99, 102, 241, 0.65);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
  background: #fff;
}

textarea.input {
  min-height: 130px;
  resize: vertical;
}

.field-hint {
  font-size: 0.8rem;
  color: var(--ink-faint);
  margin-top: 0.35rem;
}

.search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-end;
}

.search-row .grow {
  flex: 1;
  min-width: 200px;
}

/* Файлы — «конфетная» зона */
.file-field {
  border: 2px dashed rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem;
  background: linear-gradient(180deg, rgba(238, 242, 255, 0.65), rgba(255, 255, 255, 0.5));
  transition: border-color 0.2s ease, background 0.2s ease;
}

.file-field:hover {
  border-color: rgba(244, 63, 94, 0.45);
  background: linear-gradient(180deg, rgba(255, 241, 242, 0.5), rgba(238, 242, 255, 0.45));
}

.file-field input[type="file"] {
  width: 100%;
  font-size: 0.88rem;
  cursor: pointer;
}

/* ——— Флеши ——— */
.flash-stack {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 1.15rem;
}

.flash {
  padding: 0.9rem 1rem;
  border-radius: var(--radius-lg);
  font-size: 0.95rem;
  font-weight: 500;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  animation: flashIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) backwards;
  border: 1px solid transparent;
}

@keyframes flashIn {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.flash-success {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(94, 234, 212, 0.18));
  border-color: rgba(16, 185, 129, 0.25);
  color: #047857;
}

.flash-error {
  background: linear-gradient(135deg, rgba(251, 113, 133, 0.15), rgba(253, 186, 116, 0.18));
  border-color: rgba(244, 63, 94, 0.3);
  color: #9f1239;
}

.flash-close {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.55);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  opacity: 0.75;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.flash-close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.9);
}

/* ——— Пилюли предметов ——— */
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.35rem;
}

.pill {
  padding: 0.48rem 1rem;
  border-radius: var(--radius-pill);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, color 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.pill:hover {
  transform: translateY(-2px);
  color: var(--violet-700);
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.12);
}

.pill.is-active {
  color: #fff;
  border-color: transparent;
  background: var(--grad-brand);
  box-shadow: 0 8px 24px rgba(67, 56, 202, 0.35);
}

/* ——— Лента тем ——— */
.topic-list .topic {
  padding: 1.05rem 0.35rem 1.05rem 0.85rem;
  margin: 0 -0.35rem;
  border-radius: var(--radius-md);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  transition: background 0.2s ease, transform 0.2s ease;
}

.topic-list .topic:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.topic-list .topic:first-child {
  padding-top: 0;
}

.topic-list .topic:hover {
  background: rgba(255, 255, 255, 0.65);
  transform: translateX(4px);
}

.topic-list h3 {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
}

.topic-list h3 a {
  color: var(--ink);
  background: linear-gradient(90deg, currentColor, currentColor) 0 100% / 0 2px no-repeat;
  transition: background-size 0.25s ease;
}

.topic-list h3 a:hover {
  color: var(--violet-700);
  background-size: 100% 2px;
}

.meta {
  font-size: 0.8rem;
  color: var(--ink-faint);
  font-weight: 500;
}

/* ——— Страница темы ——— */
.topic-headline {
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 3.5vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.15;
  margin: 0;
  color: var(--violet-900);
}

.topic-meta {
  margin: 0.65rem 0 1.1rem;
  font-size: 0.84rem;
  color: var(--ink-faint);
  font-weight: 500;
}

.topic-body {
  white-space: pre-wrap;
  font-size: 1.02rem;
  color: var(--ink-soft);
  line-height: 1.65;
}

.topic-body--reply {
  margin-top: 0.5rem;
}

.attachments {
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
  background: linear-gradient(135deg, rgba(238, 242, 255, 0.9), rgba(255, 255, 255, 0.85));
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  border: 1px solid rgba(99, 102, 241, 0.12);
}

.attachments--spaced-top {
  margin-top: 1.1rem;
}

.message {
  padding: 1.15rem 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.message:last-of-type {
  border-bottom: none;
}

.author {
  font-weight: 700;
  color: var(--violet-700);
}

.edit-form {
  display: none;
  margin-top: 0.75rem;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.btn-row--inline {
  display: inline-flex;
  margin-left: 0.35rem;
  vertical-align: middle;
}

.link-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.1rem;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink-faint);
  padding: 0.35rem 0.65rem;
  margin-left: -0.45rem;
  border-radius: var(--radius-pill);
  transition: background 0.18s ease, color 0.18s ease;
}

.link-back:hover {
  color: var(--violet-700);
  background: rgba(255, 255, 255, 0.7);
}

.reply-zone {
  margin-top: 1.35rem;
  padding-top: 1.35rem;
  border-top: 1px solid rgba(15, 23, 42, 0.07);
}

.reply-zone h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0 0 0.85rem;
  color: var(--violet-900);
}

/* ——— Auth ——— */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem 3rem;
  position: relative;
  z-index: 1;
}

.auth-card {
  width: 100%;
  max-width: 430px;
  padding: 2.1rem 2rem 2.15rem;
  border-radius: var(--radius-xl);
  background: rgba(255, 253, 251, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  position: relative;
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--grad-card-edge);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.6;
}

.auth-card h1 {
  font-family: var(--font-display);
  margin: 0 0 0.35rem;
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--violet-900);
}

.auth-lead {
  color: var(--ink-soft);
  margin: 0 0 1.45rem;
  font-size: 0.96rem;
  line-height: 1.5;
}

.auth-footer {
  margin-top: 1.35rem;
  text-align: center;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.auth-card .btn-primary[type="submit"] {
  width: 100%;
}

.auth-wrap .flash-stack {
  margin-bottom: 1rem;
}

.form-lead {
  margin-bottom: 1rem;
  color: var(--ink-soft);
  font-size: 0.96rem;
  line-height: 1.5;
}

.auth-top {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 0;
  position: relative;
  z-index: 1;
}

/* ——— Чат ——— */
.chat-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
}

.chat-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.95rem 1.1rem;
  background: linear-gradient(125deg, #1e1b4b 0%, #4338ca 55%, #0369a1 100%);
  color: #fff;
  box-shadow: 0 8px 32px rgba(30, 27, 75, 0.35);
}

.chat-header a {
  color: #fff;
  font-weight: 700;
  opacity: 0.92;
}

.chat-header a:hover {
  opacity: 1;
}

.chat-title {
  flex: 1;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  margin: 0;
  padding-right: 2rem;
  letter-spacing: -0.02em;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.1rem 1rem 5.75rem;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

.msg-row {
  display: flex;
  margin-bottom: 0.65rem;
}

.msg-row.mine {
  justify-content: flex-end;
}

.msg-row.other {
  justify-content: flex-start;
}

.bubble {
  max-width: 84%;
  padding: 0.7rem 1.05rem;
  border-radius: 20px;
  font-size: 0.95rem;
  line-height: 1.48;
  position: relative;
}

.msg-row.mine .bubble {
  background: var(--grad-brand);
  color: #fff;
  border-bottom-right-radius: 5px;
  box-shadow: 0 6px 22px rgba(67, 56, 202, 0.35);
}

.msg-row.other .bubble {
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
  border: 1px solid rgba(15, 23, 42, 0.07);
  border-bottom-left-radius: 5px;
  box-shadow: var(--shadow-sm);
}

.bubble .time {
  display: block;
  font-size: 0.68rem;
  margin-top: 0.4rem;
  opacity: 0.78;
  font-weight: 500;
}

.chat-input-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.7rem 1rem calc(0.7rem + env(safe-area-inset-bottom));
  background: rgba(255, 253, 251, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  display: flex;
  gap: 0.55rem;
  align-items: flex-end;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
  box-shadow: 0 -8px 30px rgba(15, 23, 42, 0.06);
}

.chat-input-bar textarea {
  flex: 1;
  min-height: 46px;
  max-height: 130px;
  padding: 0.7rem 1.05rem;
  border-radius: 22px;
  border: 2px solid rgba(15, 23, 42, 0.1);
  font-family: inherit;
  font-size: 0.95rem;
  resize: none;
  background: rgba(255, 255, 255, 0.95);
}

.chat-input-bar textarea:focus {
  outline: none;
  border-color: rgba(99, 102, 241, 0.55);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.chat-input-bar button {
  flex-shrink: 0;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background: var(--grad-brand);
  color: #fff;
  font-size: 1.15rem;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(67, 56, 202, 0.4);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.chat-input-bar button:hover {
  transform: scale(1.05);
  filter: brightness(1.05);
}

/* ——— Список пользователей чата ——— */
.user-list__row {
  padding: 0.95rem 0.25rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  transition: background 0.18s ease;
  border-radius: var(--radius-md);
}

.user-list__row:last-child {
  border-bottom: none;
}

.user-list__row:hover {
  background: rgba(255, 255, 255, 0.7);
}

.user-list__row a {
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
}

.user-list__row a:hover {
  color: var(--violet-700);
}

/* Счётчик символов */
.char-count {
  text-align: right;
  font-size: 0.75rem;
  color: var(--ink-faint);
  margin-top: 0.3rem;
  font-weight: 600;
}

.char-count.warn {
  color: #ea580c;
}

/* Вход: верхняя полоска как на главной */
.auth-shell-pad {
  padding-bottom: 0;
}

/* Анимация появления карточек */
.shell > .card,
.shell > .page-hero,
.shell > .pill-row {
  animation: riseIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.shell > .page-hero {
  animation-delay: 0.02s;
}

.shell > .card:nth-of-type(1) {
  animation-delay: 0.06s;
}

.shell > .card:nth-of-type(2) {
  animation-delay: 0.1s;
}

.shell > .card:nth-of-type(3) {
  animation-delay: 0.14s;
}

.shell > .pill-row {
  animation-delay: 0.08s;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html {
    scroll-behavior: auto;
  }
  .card:hover,
  .topic-list .topic:hover,
  .pill:hover {
    transform: none;
  }
  .brand-mark__inner {
    animation: none;
  }
  .hero-orbit__ring {
    animation: none;
  }
}
