:root {
  --surface-bg: #050914;
  --surface-bg-2: #071022;
  --panel: rgba(13, 21, 42, 0.9);
  --panel-strong: rgba(17, 27, 52, 0.96);
  --panel-soft: rgba(24, 34, 62, 0.78);
  --control: rgba(19, 28, 51, 0.92);
  --control-2: rgba(27, 38, 66, 0.92);
  --line: rgba(151, 175, 227, 0.15);
  --line-strong: rgba(174, 109, 255, 0.58);
  --text: #f6f8ff;
  --text-strong: #ffffff;
  --muted: #bdc7e0;
  --muted-2: #8995b4;
  --pink: #f646d4;
  --violet: #965cff;
  --blue: #37b7ff;
  --cyan: #22d3ee;
  --amber: #ffb35c;
  --green: #65f5b5;
  --danger: #ff647c;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.44);
  --page-bottom: 28px;
  --cookie-space: 110px;
}

body.light-theme {
  --surface-bg: #eef3ff;
  --surface-bg-2: #f7f9ff;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-strong: rgba(255, 255, 255, 0.96);
  --panel-soft: rgba(255, 255, 255, 0.74);
  --control: rgba(243, 247, 255, 0.94);
  --control-2: rgba(232, 239, 255, 0.96);
  --line: rgba(61, 79, 126, 0.15);
  --line-strong: rgba(141, 85, 255, 0.48);
  --text: #12192d;
  --text-strong: #070b18;
  --muted: #4d5a78;
  --muted-2: #697493;
  --shadow: 0 24px 60px rgba(53, 73, 121, 0.17);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  overflow-x: hidden;
  background: #050914;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background:
    radial-gradient(circle at 12% 84%, rgba(0, 136, 255, 0.34), transparent 20rem),
    radial-gradient(circle at 45% 55%, rgba(141, 42, 255, 0.3), transparent 18rem),
    radial-gradient(circle at 82% 13%, rgba(65, 105, 225, 0.14), transparent 22rem),
    linear-gradient(180deg, var(--surface-bg) 0%, var(--surface-bg-2) 58%, var(--surface-bg) 100%);
  transition:
    background-color 220ms ease,
    color 220ms ease;
}

body.light-theme {
  background:
    radial-gradient(circle at 12% 84%, rgba(0, 136, 255, 0.18), transparent 20rem),
    radial-gradient(circle at 45% 55%, rgba(246, 70, 212, 0.13), transparent 18rem),
    radial-gradient(circle at 82% 13%, rgba(141, 92, 255, 0.14), transparent 22rem),
    linear-gradient(180deg, var(--surface-bg-2) 0%, #edf3ff 58%, var(--surface-bg) 100%);
}

body::before,
body::after {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  content: "";
}

body::before {
  background-image:
    radial-gradient(circle, rgba(151, 117, 255, 0.8) 0 1px, transparent 1.2px),
    radial-gradient(circle, rgba(66, 205, 255, 0.4) 0 1px, transparent 1.1px);
  background-position:
    14% 22%,
    67% 74%;
  background-size:
    170px 190px,
    230px 210px;
  opacity: 0.32;
}

body::after {
  background:
    repeating-radial-gradient(
      ellipse at 9% 0%,
      rgba(119, 143, 255, 0.12) 0 1px,
      transparent 1px 18px
    );
  opacity: 0.42;
}

body.light-theme::before {
  opacity: 0.22;
}

body.light-theme::after {
  opacity: 0.18;
}

button,
a,
textarea,
input {
  -webkit-tap-highlight-color: transparent;
}

button,
textarea,
input {
  font: inherit;
}

button {
  border: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  display: block;
}

.hidden,
[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

*:focus-visible {
  outline: 3px solid rgba(55, 183, 255, 0.72);
  outline-offset: 3px;
}

.page-shell {
  width: min(1540px, calc(100% - clamp(24px, 4.4vw, 72px)));
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: clamp(16px, 2.5vw, 28px) 0 var(--page-bottom);
  transition: padding-bottom 180ms ease;
}

body.has-cookie .page-shell {
  padding-bottom: calc(var(--page-bottom) + var(--cookie-space));
}

body.cookie-settings-open .page-shell {
  padding-bottom: calc(var(--page-bottom) + 300px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: clamp(14px, 2.6vh, 30px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
  font-weight: 800;
  white-space: nowrap;
}

.brand-mark {
  position: relative;
  width: clamp(42px, 3.1vw, 48px);
  height: clamp(42px, 3.1vw, 48px);
  color: var(--pink);
  filter: drop-shadow(0 0 16px rgba(246, 70, 212, 0.45));
}

.brand-mark svg {
  width: 100%;
  height: 100%;
}

.brand-mark path:first-child {
  fill: rgba(246, 70, 212, 0.08);
  stroke: currentColor;
  stroke-width: 2.5;
}

.brand-mark circle {
  fill: #cba6ff;
}

.brand-mark path:last-child {
  fill: none;
  stroke: #cba6ff;
  stroke-linecap: round;
  stroke-width: 2.5;
}

.brand-text {
  color: var(--text-strong);
  font-size: clamp(1.55rem, 2vw, 2.15rem);
  line-height: 1;
  letter-spacing: 0;
}

.brand-text span {
  color: var(--pink);
}

.tabs {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(12px, 4.6vw, 68px);
  min-width: 0;
}

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
  background: transparent;
  cursor: pointer;
  transition:
    color 160ms ease,
    transform 160ms ease;
}

.tab:hover {
  color: var(--text-strong);
  transform: translateY(-1px);
}

.tab svg {
  width: 24px;
  height: 24px;
  color: #9aa9d7;
}

.tab svg path,
.tab svg rect {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.tab.active {
  color: var(--text-strong);
}

.tab.active svg {
  color: #9a7cff;
}

.tab.active::after {
  position: absolute;
  right: 0;
  bottom: -11px;
  left: 0;
  height: 3px;
  border-radius: 99px;
  background: linear-gradient(90deg, #8264ff, var(--pink));
  box-shadow: 0 0 16px rgba(246, 70, 212, 0.65);
  content: "";
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(390px, 0.92fr) minmax(620px, 1.14fr);
  gap: clamp(26px, 5vw, 70px);
  align-items: center;
}

.intro-panel {
  position: relative;
  min-height: min(680px, calc(100dvh - 110px));
  padding: clamp(34px, 8vh, 78px) 6px 0 4px;
}

.anonymous-badge,
.intro-panel h1,
.intro-copy,
.feature-row {
  position: relative;
  z-index: 1;
}

.anonymous-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid rgba(246, 70, 212, 0.28);
  border-radius: 10px;
  color: #f4b2ff;
  font-size: 0.9rem;
  font-weight: 800;
  text-transform: uppercase;
  background: rgba(246, 70, 212, 0.1);
  box-shadow:
    inset 0 0 18px rgba(246, 70, 212, 0.1),
    0 14px 34px rgba(0, 0, 0, 0.22);
}

body.light-theme .anonymous-badge {
  color: #9f2abc;
  background: rgba(246, 70, 212, 0.08);
}

.anonymous-badge svg {
  width: 23px;
  height: 23px;
  color: var(--pink);
}

.anonymous-badge path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.intro-panel h1 {
  max-width: 610px;
  margin: clamp(24px, 4.2vh, 34px) 0 18px;
  color: var(--text-strong);
  font-size: clamp(3rem, 5vw, 5.1rem);
  line-height: 1.05;
  letter-spacing: 0;
  text-wrap: balance;
}

.intro-panel h1 span {
  color: transparent;
  background: linear-gradient(92deg, #8277ff 0%, #b958ff 48%, #ff4fd8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  text-shadow: 0 0 32px rgba(179, 88, 255, 0.26);
}

.intro-copy {
  max-width: 570px;
  margin: 0 0 clamp(22px, 3.8vh, 38px);
  color: var(--muted);
  font-size: clamp(1rem, 1.2vw, 1.24rem);
  line-height: 1.55;
}

.feature-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  max-width: 650px;
}

.feature-card {
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 10px;
  min-height: 92px;
  padding: 16px 14px 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--panel-soft), rgba(12, 18, 35, 0.42));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
}

body.light-theme .feature-card {
  background: rgba(255, 255, 255, 0.72);
}

.feature-card > div {
  min-width: 0;
}

.feature-card h2 {
  margin: 0 0 7px;
  color: var(--text-strong);
  font-size: clamp(0.84rem, 0.82vw, 0.92rem);
  line-height: 1.18;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.feature-card p {
  margin: 0;
  color: var(--muted-2);
  font-size: 0.82rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.feature-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
}

.feature-icon svg {
  width: 25px;
  height: 25px;
}

.feature-icon svg path,
.feature-icon svg rect {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.feature-icon.lock {
  color: #e64eff;
  background: rgba(230, 78, 255, 0.16);
  box-shadow: 0 0 28px rgba(230, 78, 255, 0.22);
}

.feature-icon.bolt {
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.15);
  box-shadow: 0 0 28px rgba(34, 211, 238, 0.24);
}

.feature-icon.shield {
  color: var(--pink);
  background: rgba(246, 70, 212, 0.15);
  box-shadow: 0 0 28px rgba(246, 70, 212, 0.22);
}

.space-scene {
  position: absolute;
  right: -18px;
  bottom: 0;
  left: -48px;
  z-index: 0;
  height: min(340px, 45vh);
  pointer-events: none;
  overflow: hidden;
}

.space-scene::before {
  position: absolute;
  inset: auto 0 0;
  height: 150px;
  background:
    linear-gradient(165deg, transparent 0 31%, rgba(8, 16, 34, 0.96) 31% 39%, transparent 39%),
    linear-gradient(12deg, rgba(5, 7, 17, 0.98) 0 29%, rgba(10, 18, 38, 0.98) 29% 40%, rgba(5, 7, 17, 0.98) 40%);
  clip-path: polygon(0 78%, 9% 76%, 14% 79%, 26% 70%, 42% 68%, 48% 76%, 59% 75%, 69% 81%, 78% 77%, 88% 80%, 100% 78%, 100% 100%, 0 100%);
  content: "";
}

.planet {
  position: absolute;
  border-radius: 50%;
  filter: blur(0.2px);
}

.planet-blue {
  bottom: -138px;
  left: -34px;
  width: 300px;
  height: 300px;
  background:
    radial-gradient(circle at 38% 24%, rgba(22, 184, 255, 0.85), transparent 26%),
    radial-gradient(circle at 60% 55%, rgba(104, 70, 255, 0.68), transparent 42%),
    linear-gradient(145deg, #032b68, #080a2a 67%);
  box-shadow:
    inset -28px -24px 60px rgba(0, 0, 0, 0.56),
    0 0 90px rgba(0, 151, 255, 0.34);
}

.planet-pink {
  right: -80px;
  bottom: -185px;
  width: 440px;
  height: 300px;
  border: 1px solid rgba(246, 70, 212, 0.32);
  background:
    radial-gradient(circle at 50% 14%, rgba(246, 70, 212, 0.42), transparent 31%),
    linear-gradient(145deg, rgba(60, 24, 93, 0.9), rgba(11, 9, 28, 0.22));
  box-shadow: 0 -28px 100px rgba(246, 70, 212, 0.18);
  transform: rotate(-8deg);
}

.lighthouse {
  position: absolute;
  bottom: 56px;
  left: 242px;
  width: 42px;
  height: 104px;
  background: linear-gradient(90deg, #0a1022 0 22%, #d7e6ff 22% 47%, #1a2140 47% 67%, #d7e6ff 67% 100%);
  clip-path: polygon(34% 0, 66% 0, 82% 100%, 18% 100%);
  filter: drop-shadow(0 0 18px rgba(42, 187, 255, 0.24));
}

.lighthouse::before {
  position: absolute;
  top: -14px;
  left: 8px;
  width: 28px;
  height: 16px;
  border-radius: 4px 4px 0 0;
  background: #0a1022;
  box-shadow: 0 -7px 0 -2px #f755d8;
  content: "";
}

.beam {
  position: absolute;
  top: -5px;
  left: 22px;
  width: 360px;
  height: 42px;
  background: linear-gradient(90deg, rgba(246, 70, 212, 0.7), rgba(246, 70, 212, 0.18), transparent);
  clip-path: polygon(0 34%, 100% 0, 100% 100%, 0 66%);
  filter: blur(3px);
  transform-origin: left center;
  transform: rotate(-1deg);
}

.astronaut-helmet {
  position: absolute;
  top: -6px;
  right: 76px;
  width: 200px;
  height: 154px;
  border: 4px solid rgba(141, 42, 255, 0.48);
  border-radius: 48% 52% 44% 46%;
  background:
    radial-gradient(circle at 64% 33%, rgba(246, 70, 212, 0.22), transparent 32%),
    linear-gradient(160deg, rgba(13, 22, 44, 0.1), rgba(8, 12, 27, 0.68));
  box-shadow:
    inset 20px 12px 40px rgba(246, 70, 212, 0.1),
    0 0 52px rgba(141, 42, 255, 0.26);
  opacity: 0.65;
  transform: rotate(-14deg);
}

.astronaut-helmet::before {
  position: absolute;
  inset: 30px 22px 29px 32px;
  border: 4px solid rgba(246, 70, 212, 0.52);
  border-right-color: rgba(34, 211, 238, 0.16);
  border-radius: 50% 45% 48% 42%;
  content: "";
}

.astronaut-helmet::after {
  position: absolute;
  right: 48px;
  bottom: 36px;
  width: 145px;
  height: 56px;
  border-bottom: 4px solid rgba(246, 70, 212, 0.6);
  border-radius: 50%;
  transform: rotate(-18deg);
  content: "";
}

.chat-card {
  position: relative;
  min-width: 0;
  padding: clamp(22px, 3vw, 32px) clamp(22px, 4.2vw, 54px) clamp(22px, 3vw, 28px);
  border: 1px solid var(--line);
  border-radius: clamp(22px, 2.4vw, 34px);
  background:
    linear-gradient(180deg, rgba(24, 34, 62, 0.88), rgba(8, 14, 29, 0.94)),
    var(--panel);
  box-shadow:
    var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(22px);
}

body.light-theme .chat-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(241, 245, 255, 0.95)),
    var(--panel);
}

.chat-card::before {
  position: absolute;
  inset: 1px;
  z-index: -1;
  border-radius: inherit;
  background:
    radial-gradient(circle at 15% 4%, rgba(246, 70, 212, 0.16), transparent 28%),
    radial-gradient(circle at 100% 0%, rgba(34, 211, 238, 0.12), transparent 26%);
  content: "";
}

.setup-view,
.conversation-view {
  animation: viewIn 220ms ease both;
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: center;
  margin: 0;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--line);
  list-style: none;
}

.steps li {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  color: var(--muted-2);
  font-size: 0.94rem;
  font-weight: 750;
  white-space: nowrap;
}

.steps li:not(:last-child)::after {
  position: absolute;
  right: -12px;
  width: 26px;
  height: 1px;
  background: var(--line);
  content: "";
}

.steps span {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(151, 175, 227, 0.25);
  border-radius: 50%;
  color: var(--muted);
  background: rgba(15, 24, 45, 0.72);
}

body.light-theme .steps span {
  background: rgba(235, 241, 255, 0.86);
}

.steps .active {
  color: var(--text-strong);
}

.steps .active span {
  color: var(--text-strong);
  border-color: rgba(246, 70, 212, 0.78);
  box-shadow:
    0 0 0 3px rgba(246, 70, 212, 0.08),
    0 0 20px rgba(246, 70, 212, 0.33);
}

.chat-form {
  padding-top: 18px;
}

.form-alert {
  display: none;
  margin-bottom: 14px;
  padding: 11px 14px;
  border: 1px solid rgba(255, 100, 124, 0.38);
  border-radius: 8px;
  color: #ffd6de;
  background: rgba(255, 100, 124, 0.1);
}

body.light-theme .form-alert {
  color: #9b1732;
  background: rgba(255, 100, 124, 0.09);
}

.form-alert.visible {
  display: block;
}

.section-head,
legend {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-strong);
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: 0;
}

.section-head {
  margin: 0 0 12px;
}

legend {
  margin: 0 0 12px;
  padding: 0;
}

.section-head svg,
legend svg {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  color: var(--pink);
}

.section-head svg path,
legend svg path,
legend svg circle,
legend svg rect {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.choice-section {
  border-radius: 10px;
}

.choice-section.invalid .topic-grid,
.choice-section.invalid .segmented,
.choice-section.invalid .age-grid,
.choice-section.invalid .theme-toggle {
  border-radius: 9px;
  box-shadow: 0 0 0 2px rgba(255, 100, 124, 0.78);
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.topic-card {
  display: grid;
  min-height: 90px;
  place-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text-strong);
  background: linear-gradient(180deg, var(--control-2), var(--control));
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease,
    filter 160ms ease;
}

.topic-card:hover {
  border-color: rgba(151, 175, 227, 0.34);
  transform: translateY(-1px);
}

.topic-card:active,
.start-button:active,
.emoji-button:active,
.send-button:active,
.accept-button:active,
.ghost-button:active,
.danger-button:active {
  transform: translateY(0);
}

.topic-card.selected {
  border-color: rgba(214, 78, 255, 0.9);
  background:
    radial-gradient(circle at 16% 0%, rgba(246, 70, 212, 0.18), transparent 45%),
    linear-gradient(180deg, rgba(36, 29, 67, 0.94), rgba(15, 22, 42, 0.9));
  box-shadow:
    inset 0 0 0 1px rgba(214, 78, 255, 0.14),
    0 0 28px rgba(214, 78, 255, 0.16);
}

body.light-theme .topic-card.selected {
  background:
    radial-gradient(circle at 16% 0%, rgba(246, 70, 212, 0.14), transparent 45%),
    linear-gradient(180deg, rgba(251, 243, 255, 0.98), rgba(238, 243, 255, 0.96));
}

.topic-card svg {
  width: 42px;
  height: 42px;
  color: #96a4c7;
}

.topic-card.selected svg {
  color: #9a66ff;
  filter: drop-shadow(0 0 14px rgba(154, 102, 255, 0.46));
}

.topic-card svg path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.form-grid fieldset:nth-child(2) legend svg,
.form-grid fieldset:nth-child(4) legend svg {
  color: var(--cyan);
}

.segmented,
.theme-toggle {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control);
}

.segmented button,
.theme-toggle button,
.age-grid button {
  min-width: 0;
  min-height: 44px;
  padding: 0 10px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  white-space: normal;
  overflow-wrap: anywhere;
  text-wrap: balance;
  line-height: 1.18;
  transition:
    background 160ms ease,
    box-shadow 160ms ease,
    color 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.segmented button + button,
.theme-toggle button + button {
  border-left: 1px solid var(--line);
}

.segmented button.selected {
  color: var(--text-strong);
  background:
    linear-gradient(180deg, rgba(246, 70, 212, 0.16), rgba(128, 72, 255, 0.1)),
    rgba(25, 31, 56, 0.9);
  box-shadow: inset 0 0 0 1px rgba(246, 70, 212, 0.82);
}

body.light-theme .segmented button.selected {
  background: rgba(246, 70, 212, 0.1);
}

.segmented.cyan button.selected {
  background:
    linear-gradient(180deg, rgba(34, 211, 238, 0.14), rgba(42, 117, 255, 0.08)),
    rgba(25, 31, 56, 0.9);
  box-shadow: inset 0 0 0 1px rgba(34, 183, 255, 0.86);
}

.segmented.cyan {
  grid-template-columns: minmax(108px, 1.25fr) repeat(2, minmax(58px, 0.875fr));
}

body.light-theme .segmented.cyan button.selected {
  background: rgba(34, 183, 255, 0.11);
}

.age-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.age-grid button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  font-size: 0.86rem;
  background: linear-gradient(180deg, var(--control-2), var(--control));
}

.age-grid button:nth-child(5) {
  grid-column: 1 / -1;
}

.age-grid button:hover,
.segmented button:hover,
.theme-toggle button:hover {
  background-color: rgba(151, 175, 227, 0.09);
}

.age-grid button.selected {
  border-color: rgba(101, 245, 181, 0.72);
  color: var(--text-strong);
  box-shadow:
    inset 0 0 0 1px rgba(101, 245, 181, 0.16),
    0 0 18px rgba(101, 245, 181, 0.12);
}

.form-footer {
  display: grid;
  grid-template-columns: minmax(240px, 0.86fr) minmax(300px, 1.14fr);
  gap: 28px;
  align-items: end;
  padding-top: 20px;
}

.theme-toggle {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.theme-toggle button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  color: var(--muted);
}

.theme-toggle svg {
  width: 21px;
  height: 21px;
  color: currentColor;
}

.theme-toggle path,
.theme-toggle circle {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.theme-toggle button.selected {
  color: var(--text-strong);
  box-shadow: inset 0 0 0 1px rgba(55, 183, 255, 0.86);
  background: rgba(45, 78, 133, 0.18);
}

.start-block {
  min-width: 0;
}

.start-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  padding: 0 18px;
  overflow: hidden;
  border-radius: 12px;
  color: #ffffff;
  font-size: 1.12rem;
  font-weight: 850;
  cursor: pointer;
  background:
    linear-gradient(100deg, rgba(57, 183, 255, 0.95), rgba(139, 86, 255, 0.98) 45%, rgba(246, 70, 212, 1)),
    #705dff;
  box-shadow:
    0 18px 42px rgba(246, 70, 212, 0.26),
    0 10px 32px rgba(55, 183, 255, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transition:
    transform 160ms ease,
    filter 160ms ease,
    opacity 160ms ease;
}

.start-button:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.start-button:disabled {
  cursor: wait;
  filter: saturate(0.92) brightness(0.94);
}

.start-button svg {
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
}

.start-button svg path,
.send-button svg path,
.modal-close svg path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.button-spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 850ms linear infinite;
}

.start-button.is-loading .button-spinner {
  display: block;
}

.start-button.is-loading .sparkle {
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.start-block p {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 12px 0 0;
  color: var(--muted-2);
  font-size: 0.82rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.start-block p svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: #a9b7df;
}

.start-block p path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.start-block a,
.cookie-banner a {
  color: #67d9ff;
}

.conversation-view {
  display: flex;
  min-height: min(650px, calc(100dvh - 145px));
  flex-direction: column;
  gap: 16px;
}

.chat-card.chat-mode {
  padding: clamp(20px, 2.8vw, 30px);
}

.conversation-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.conversation-header h2 {
  margin: 4px 0 6px;
  color: var(--text-strong);
  font-size: clamp(1.65rem, 2vw, 2.15rem);
  line-height: 1.1;
  letter-spacing: 0;
}

.conversation-header p {
  margin: 0;
  color: var(--muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 0 12px;
  border: 1px solid rgba(101, 245, 181, 0.28);
  border-radius: 999px;
  color: #a9ffd4;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  background: rgba(101, 245, 181, 0.1);
}

.status-pill::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 14px rgba(101, 245, 181, 0.7);
  content: "";
}

body.light-theme .status-pill {
  color: #0d7d4a;
}

.chat-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.small {
  min-height: 40px !important;
  padding: 0 14px !important;
  font-size: 0.9rem;
}

.settings-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.summary-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.82rem;
  background: rgba(151, 175, 227, 0.08);
  overflow-wrap: anywhere;
}

.search-state {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(55, 183, 255, 0.28);
  border-radius: 10px;
  color: var(--text-strong);
  background: rgba(55, 183, 255, 0.08);
}

.loader-dot {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(55, 183, 255, 0.26);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 850ms linear infinite;
}

.messages {
  display: flex;
  min-height: 260px;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    radial-gradient(circle at 20% 0%, rgba(246, 70, 212, 0.08), transparent 34%),
    rgba(4, 8, 18, 0.24);
}

body.light-theme .messages {
  background:
    radial-gradient(circle at 20% 0%, rgba(246, 70, 212, 0.08), transparent 34%),
    rgba(247, 250, 255, 0.86);
}

.message {
  max-width: min(72%, 520px);
  padding: 10px 13px;
  border-radius: 14px;
  color: var(--text);
  font-size: 0.96rem;
  line-height: 1.42;
  overflow-wrap: anywhere;
  animation: messageIn 180ms ease both;
}

.message.system {
  align-self: center;
  max-width: 90%;
  color: var(--muted);
  font-size: 0.86rem;
  background: rgba(151, 175, 227, 0.08);
}

.message.partner {
  align-self: flex-start;
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
  background: var(--control);
}

.message.user {
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  color: #ffffff;
  background: linear-gradient(100deg, rgba(55, 183, 255, 0.92), rgba(151, 92, 255, 0.95) 55%, rgba(246, 70, 212, 0.95));
  box-shadow: 0 12px 26px rgba(92, 97, 255, 0.18);
}

/* Индикатор "Печатает..." */
.typing-indicator {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  background: var(--control);
  border: 1px solid var(--line);
  margin-top: 6px;
  animation: messageIn 200ms ease;
}

.typing-text {
  color: var(--muted);
  font-size: 0.86rem;
}

.typing-dots {
  display: flex;
  gap: 3px;
}

.typing-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0s;
}

@keyframes typingBounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.message-form textarea.shake {
  animation: shake 300ms ease;
  border-color: rgba(255, 100, 124, 0.6);
}

.message-form {
  display: grid;
  grid-template-columns: 1fr 52px 52px;
  gap: 10px;
  align-items: end;
}

.message-form textarea {
  width: 100%;
  max-height: 120px;
  min-height: 52px;
  resize: none;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: var(--control);
  outline: none;
}

.message-form textarea::placeholder {
  color: var(--muted-2);
}

.emoji-button {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: #ffd47a;
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
  background: linear-gradient(180deg, var(--control-2), var(--control));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition:
    transform 160ms ease,
    filter 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease;
}

.emoji-wrap {
  position: relative;
  width: 52px;
  height: 52px;
}

.emoji-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  z-index: 12;
  display: grid;
  width: min(372px, calc(100vw - 34px));
  max-height: min(430px, 72vh);
  grid-template-rows: auto auto auto minmax(140px, 1fr) auto;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(151, 175, 227, 0.2);
  border-radius: 16px;
  background:
    radial-gradient(circle at 14% 0%, rgba(246, 70, 212, 0.16), transparent 9rem),
    linear-gradient(180deg, var(--panel-strong), rgba(10, 17, 35, 0.98));
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.44),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: viewIn 150ms ease both;
}

body.light-theme .emoji-panel {
  border-color: rgba(61, 79, 126, 0.18);
  background:
    radial-gradient(circle at 14% 0%, rgba(246, 70, 212, 0.12), transparent 9rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 247, 255, 0.98));
  box-shadow: 0 24px 60px rgba(53, 73, 121, 0.2);
}

.emoji-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-strong);
  font-size: 0.95rem;
  font-weight: 800;
}

.emoji-panel-head span {
  min-width: 44px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  background: rgba(255, 255, 255, 0.04);
}

.emoji-search {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: var(--control);
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.emoji-search::placeholder {
  color: var(--muted-2);
}

.emoji-search:focus {
  border-color: rgba(55, 183, 255, 0.52);
  box-shadow: 0 0 0 3px rgba(55, 183, 255, 0.14);
}

.emoji-tabs {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 5px;
}

.emoji-tab {
  display: grid;
  width: 100%;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  font-family: "Noto Color Emoji", "Segoe UI Emoji", "Apple Color Emoji", "Twemoji Mozilla", "EmojiOne Color", sans-serif;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.035);
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background-color 140ms ease;
}

.emoji-tab:hover {
  border-color: rgba(151, 92, 255, 0.42);
  transform: translateY(-1px);
}

.emoji-tab.active {
  border-color: rgba(246, 70, 212, 0.56);
  color: var(--text-strong);
  background: linear-gradient(135deg, rgba(55, 183, 255, 0.16), rgba(246, 70, 212, 0.18));
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 4px;
  min-height: 140px;
  max-height: 258px;
  padding: 2px 4px 2px 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.emoji-grid::-webkit-scrollbar {
  width: 7px;
}

.emoji-grid::-webkit-scrollbar-thumb {
  border-radius: 99px;
  background: rgba(151, 175, 227, 0.22);
}

.emoji-option {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text);
  font-family: "Noto Color Emoji", "Segoe UI Emoji", "Apple Color Emoji", "Twemoji Mozilla", "EmojiOne Color", sans-serif;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  background: transparent;
  transition:
    transform 120ms ease,
    background-color 120ms ease,
    border-color 120ms ease;
}

.emoji-option:hover {
  border-color: rgba(55, 183, 255, 0.24);
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

body.light-theme .emoji-option:hover {
  background: rgba(55, 183, 255, 0.1);
}

.emoji-empty {
  margin: 0;
  padding: 10px 0 2px;
  color: var(--muted-2);
  font-size: 0.88rem;
  text-align: center;
}

.emoji-button:hover {
  border-color: rgba(255, 211, 122, 0.42);
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.emoji-button.active {
  border-color: rgba(255, 211, 122, 0.6);
  color: #ffe3a3;
  background: linear-gradient(135deg, rgba(55, 183, 255, 0.18), rgba(246, 70, 212, 0.2));
}

.emoji-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.send-button {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 12px;
  color: #ffffff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--blue), var(--pink));
  box-shadow: 0 12px 24px rgba(246, 70, 212, 0.18);
  transition:
    transform 160ms ease,
    filter 160ms ease;
}

.send-button:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.send-button svg {
  width: 23px;
  height: 23px;
}

.ghost-button,
.accept-button,
.danger-button {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  transition:
    transform 160ms ease,
    filter 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease;
}

.ghost-button {
  border: 1px solid var(--line);
  background: rgba(18, 27, 51, 0.66);
}

body.light-theme .ghost-button {
  background: rgba(244, 247, 255, 0.78);
}

.ghost-button:hover {
  border-color: rgba(151, 175, 227, 0.36);
  background-color: rgba(151, 175, 227, 0.1);
}

.accept-button {
  color: #ffffff;
  font-weight: 800;
  background: linear-gradient(100deg, #596cff, #c839f4);
  box-shadow: 0 14px 30px rgba(200, 57, 244, 0.22);
}

.accept-button:hover,
.danger-button:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.danger-button {
  color: #ffdbe1;
  border: 1px solid rgba(255, 100, 124, 0.32);
  background: rgba(255, 100, 124, 0.1);
}

body.light-theme .danger-button {
  color: #9b1732;
}

.cookie-banner {
  position: fixed;
  left: 50%;
  bottom: 14px;
  z-index: 30;
  width: min(1540px, calc(100vw - clamp(24px, 4.4vw, 72px)));
  max-height: min(74vh, 430px);
  overflow-y: auto;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--panel-strong), rgba(11, 18, 36, 0.96));
  box-shadow:
    0 26px 70px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transform: translateX(-50%);
  animation: cookieIn 220ms ease both;
}

body.light-theme .cookie-banner {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(242, 246, 255, 0.96));
}

@keyframes cookieIn {
  from {
    opacity: 0;
    transform: translate(-50%, 12px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.cookie-main {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
}

.cookie-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: var(--amber);
}

.cookie-icon svg {
  width: 38px;
  height: 38px;
}

.cookie-icon path,
.cookie-icon circle {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.cookie-banner p {
  margin: 0;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.cookie-actions,
.cookie-settings-actions {
  display: grid;
  grid-template-columns: 150px 180px;
  gap: 12px;
}

.cookie-settings {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  animation: viewIn 180ms ease both;
}

.cookie-option {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(151, 175, 227, 0.06);
}

.cookie-option strong {
  display: block;
  margin-bottom: 3px;
  color: var(--text-strong);
  font-size: 0.95rem;
}

.cookie-option span span,
.cookie-option div span {
  color: var(--muted-2);
  font-size: 0.86rem;
}

.cookie-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(151, 175, 227, 0.16);
  transition:
    background 160ms ease,
    border-color 160ms ease;
}

.switch::after {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--muted);
  transition:
    transform 160ms ease,
    background 160ms ease;
  content: "";
}

.cookie-option input:checked + .switch,
.switch.locked {
  border-color: rgba(101, 245, 181, 0.42);
  background: rgba(101, 245, 181, 0.18);
}

.cookie-option input:checked + .switch::after,
.switch.locked::after {
  background: var(--green);
  transform: translateX(20px);
}

.cookie-option input:focus-visible + .switch {
  outline: 3px solid rgba(55, 183, 255, 0.72);
  outline-offset: 3px;
}

.cookie-settings-actions {
  justify-content: end;
  justify-self: end;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(2, 5, 13, 0.66);
  backdrop-filter: blur(8px);
  animation: fadeIn 160ms ease both;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 41;
  width: min(430px, calc(100% - 32px));
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--text);
  background: linear-gradient(180deg, var(--panel-strong), var(--panel));
  box-shadow: var(--shadow);
  transform: translate(-50%, -50%);
  animation: modalIn 180ms ease both;
}

body.light-theme .modal {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(242, 246, 255, 0.98));
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text-strong);
  background: rgba(151, 175, 227, 0.1);
}

.modal-close svg {
  width: 22px;
  height: 22px;
}

.modal-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 16px;
  color: var(--pink);
  background: rgba(246, 70, 212, 0.12);
  box-shadow: 0 0 28px rgba(246, 70, 212, 0.18);
}

.modal-icon svg {
  width: 30px;
  height: 30px;
}

.modal-icon path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.modal h2 {
  margin: 18px 0 10px;
  color: var(--text-strong);
  font-size: 1.55rem;
  line-height: 1.16;
  letter-spacing: 0;
}

.modal p {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.55;
}

.modal-ok {
  width: 100%;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 10px)) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* ============ Оверлей поиска собеседника ============ */

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 9, 20, 0.82);
  backdrop-filter: blur(12px);
  animation: searchOverlayIn 280ms ease both;
}

body.light-theme .search-overlay {
  background: rgba(238, 243, 255, 0.82);
}

@keyframes searchOverlayIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.search-overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 48px 40px;
  max-width: 420px;
  width: calc(100% - 40px);
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  animation: searchContentIn 340ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes searchContentIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.search-overlay-spinner {
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-overlay-spinner .search-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--violet);
  animation: searchDotBounce 1.2s ease-in-out infinite;
}

.search-overlay-spinner .search-dot:nth-child(2) {
  animation-delay: 0.15s;
  background: var(--pink);
}

.search-overlay-spinner .search-dot:nth-child(3) {
  animation-delay: 0.3s;
  background: var(--cyan);
}

@keyframes searchDotBounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.search-overlay-title {
  margin: 0;
  color: var(--text-strong);
  font-size: 1.35rem;
  font-weight: 700;
  text-align: center;
}

.search-overlay-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
  line-height: 1.5;
}

.search-overlay-cancel {
  margin-top: 8px;
  padding: 12px 32px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--danger);
  background: rgba(255, 100, 124, 0.1);
  border: 1px solid rgba(255, 100, 124, 0.25);
  border-radius: 14px;
  cursor: pointer;
  transition:
    background 180ms ease,
    border-color 180ms ease,
    transform 120ms ease;
}

.search-overlay-cancel:hover {
  background: rgba(255, 100, 124, 0.18);
  border-color: rgba(255, 100, 124, 0.4);
}

.search-overlay-cancel:active {
  transform: scale(0.97);
}

@media (max-width: 600px) {
  .search-overlay-content {
    padding: 36px 24px;
    border-radius: 20px;
  }

  .search-overlay-title {
    font-size: 1.2rem;
  }
}

@media (max-width: 1360px) {
  .hero-grid {
    grid-template-columns: minmax(340px, 0.86fr) minmax(620px, 1.14fr);
    gap: 34px;
  }

  .intro-panel h1 {
    font-size: clamp(2.8rem, 4.85vw, 4.25rem);
  }

  .feature-card {
    padding: 14px 12px;
  }

  .chat-card {
    padding: 22px 34px;
  }
}

@media (max-width: 1180px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .intro-panel {
    min-height: 420px;
    padding-top: 36px;
    overflow: hidden;
  }

  .space-scene {
    right: -20px;
    left: auto;
    width: min(600px, 100%);
    height: 250px;
  }

  .chat-card {
    width: min(980px, 100%);
    margin: 0 auto;
  }
}

@media (max-width: 900px) {
  :root {
    --cookie-space: 220px;
  }

  body.cookie-settings-open .page-shell {
    padding-bottom: calc(var(--page-bottom) + 420px);
  }

  .page-shell {
    width: min(100% - 28px, 740px);
    padding-top: 18px;
  }

  .topbar {
    align-items: flex-start;
    gap: 18px;
  }

  .tabs {
    max-width: 100%;
    gap: 10px;
    overflow-x: auto;
    padding: 0 2px 14px;
    scrollbar-width: none;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tab {
    flex: 0 0 auto;
    min-height: 38px;
    font-size: 0.94rem;
  }

  .brand-text {
    font-size: 1.55rem;
  }

  .intro-panel {
    min-height: auto;
    padding-top: 30px;
    overflow: hidden;
  }

  .feature-row {
    grid-template-columns: 1fr 1fr 1fr;
    max-width: 100%;
    gap: 8px;
  }

  .space-scene {
    right: -40px;
    bottom: 0;
    left: auto;
    width: min(480px, 80%);
    height: 200px;
    opacity: 0.55;
  }

  .chat-card {
    padding: 22px 18px;
    border-radius: 24px;
  }

  .steps {
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: start;
  }

  .steps li {
    justify-content: flex-start;
  }

  .steps li:not(:last-child)::after {
    display: none;
  }

  .topic-grid,
  .form-grid,
  .form-footer {
    grid-template-columns: 1fr;
  }

  .topic-card {
    min-height: 82px;
  }

  .conversation-view {
    min-height: 620px;
  }

  .conversation-header {
    display: grid;
  }

  .chat-actions {
    justify-content: stretch;
  }

  .chat-actions button {
    flex: 1 1 150px;
  }

  .cookie-banner {
    width: calc(100% - 28px);
    padding: 16px;
  }

  .cookie-main {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .cookie-actions {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .cookie-settings-actions {
    width: 100%;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  :root {
    --cookie-space: 250px;
  }

  .page-shell {
    width: min(100% - 24px, 480px);
  }

  .topbar {
    display: grid;
  }

  .intro-panel {
    min-height: auto;
    padding-top: 18px;
    overflow: hidden;
  }

  .intro-panel h1 {
    font-size: clamp(2rem, 10vw, 2.6rem);
    margin: 16px 0 12px;
  }

  .intro-copy {
    font-size: 0.96rem;
    margin: 0 0 16px;
  }

  .anonymous-badge {
    min-height: 40px;
    padding: 0 14px;
    font-size: 0.82rem;
  }

  .space-scene {
    display: none;
  }

  .segmented,
  .segmented.cyan,
  .age-grid,
  .theme-toggle {
    grid-template-columns: 1fr;
  }

  .segmented button + button,
  .theme-toggle button + button {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .age-grid button:nth-child(5) {
    grid-column: auto;
  }

  .start-button {
    min-height: 60px;
    font-size: 1.04rem;
  }

  .start-block p {
    align-items: flex-start;
    text-align: center;
  }

  .message {
    max-width: 88%;
  }

  .message-form {
    grid-template-columns: 1fr 48px 48px;
  }

  .emoji-wrap,
  .emoji-button,
  .send-button {
    width: 48px;
    height: 52px;
  }

  .emoji-panel {
    position: fixed;
    right: 14px;
    bottom: 86px;
    left: 14px;
    width: auto;
    max-height: min(420px, calc(100dvh - 120px));
  }

  .emoji-tabs {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .emoji-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  .emoji-option {
    width: 36px;
    height: 36px;
  }

  .cookie-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 820px), (max-width: 900px) {
  body.has-cookie .page-shell,
  body.cookie-settings-open .page-shell {
    padding-bottom: var(--page-bottom);
  }

  .cookie-banner {
    position: static;
    width: min(1540px, calc(100vw - 28px));
    max-height: none;
    margin: 16px auto 18px;
    transform: none;
    animation: viewIn 180ms ease both;
  }
}

@media (min-width: 901px) and (max-height: 820px) {
  .cookie-main {
    grid-template-columns: auto 1fr auto;
  }
}

@media (max-width: 900px) {
  .cookie-main {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
