:root {
  --tg-bg: #0e1621;
  --tg-panel: #17212b;
  --tg-panel-2: #1c2733;
  --tg-panel-3: #242f3d;
  --tg-hover: #202b36;
  --tg-line: #0b131b;
  --tg-line-soft: #2b3a49;
  --tg-text: #eef4f8;
  --tg-text-soft: #c6d4df;
  --tg-muted: #7f91a4;
  --tg-muted-2: #627384;
  --tg-accent: #64b5ef;
  --tg-accent-strong: #3390ec;
  --tg-out: #2b5278;
  --tg-out-soft: #3b6794;
  --tg-in: #182533;
  --tg-green: #4dcd5e;
  --radius-shell: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: var(--tg-text);
  font-family: var(--font);
  background:
    radial-gradient(1000px 650px at 6% 4%, rgba(29, 72, 104, 0.55), transparent 58%),
    radial-gradient(900px 620px at 96% 96%, rgba(94, 55, 35, 0.26), transparent 58%),
    linear-gradient(145deg, #0a1119, #111c27 52%, #0a1017);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

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

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--tg-accent);
  outline-offset: 2px;
}

::selection {
  background: rgba(100, 181, 239, 0.32);
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

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

.icon {
  display: block;
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.page-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  opacity: 0.5;
}

.page-glow--left {
  width: 340px;
  height: 340px;
  left: -120px;
  top: 10%;
  background: rgba(30, 103, 155, 0.34);
}

.page-glow--right {
  width: 300px;
  height: 300px;
  right: -100px;
  bottom: 4%;
  background: rgba(158, 106, 58, 0.18);
}

.shell {
  position: relative;
  z-index: 1;
  display: flex;
  width: min(1180px, calc(100vw - 40px));
  height: min(900px, calc(100dvh - 40px));
  min-height: 520px;
  overflow: hidden;
  background: var(--tg-panel);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-shell);
  box-shadow:
    0 40px 100px rgba(0, 0, 0, 0.55),
    0 4px 22px rgba(0, 0, 0, 0.35);
}

/* ---------- Avatars ---------- */

.avatar {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  color: #fff;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
  user-select: none;
}

.avatar--peer {
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.2), transparent 42%),
    linear-gradient(145deg, #7c8f5b, #435236 72%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.avatar > img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.avatar > .presence-dot {
  z-index: 1;
}

.avatar--header {
  width: 42px;
  height: 42px;
  font-size: 15px;
}

.avatar--switch {
  width: 36px;
  height: 36px;
  font-size: 12px;
}

.presence-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--tg-panel);
  border-radius: 50%;
  background: var(--tg-green);
}

.avatar--header .presence-dot {
  width: 11px;
  height: 11px;
  border-width: 2px;
  border-color: var(--tg-panel);
}

/* ---------- Chat header ---------- */

.chat {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  background: var(--tg-bg);
}

.chat__header {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  height: 60px;
  padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--tg-line);
  background: var(--tg-panel);
}

.icon-btn {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #8295a8;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.icon-btn:hover {
  background: var(--tg-hover);
  color: #dbe7f0;
}

.icon-btn:active {
  transform: scale(0.96);
}

.icon-btn .icon {
  width: 22px;
  height: 22px;
}

.peer {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.peer__text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.peer h1 {
  overflow: hidden;
  margin: 0;
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.peer p {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  color: var(--tg-accent);
  font-size: 12.5px;
  line-height: 1.2;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tg-green);
}

.peer p.is-typing {
  color: var(--tg-accent);
}

.peer p.is-offline {
  color: var(--tg-muted);
}

.status-dot--offline {
  background: var(--tg-muted);
  box-shadow: none;
}

.peer p.is-typing .status-dot {
  background: var(--tg-accent);
  animation: statusPulse 900ms ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.chat__actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}


/* ---------- Chat body ---------- */

.chat__body {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 18px clamp(12px, 4vw, 52px) 16px;
  background-color: var(--tg-bg);
  background-image:
    radial-gradient(680px 480px at 18% 16%, rgba(47, 95, 132, 0.23), transparent 66%),
    radial-gradient(560px 440px at 86% 82%, rgba(138, 91, 48, 0.1), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.032'%3E%3Cpath d='M18 22l4-4 4 4-4 4zM92 36l3-3 3 3-3 3zM60 88l5-5 5 5-5 5zM30 76l2.5-2.5L35 76l-2.5 2.5zM100 96l2-2 2 2-2 2zM72 14l2.5-2.5L77 14l-2.5 2.5z'/%3E%3Ccircle cx='48' cy='48' r='1.2'/%3E%3Ccircle cx='110' cy='68' r='1'/%3E%3Ccircle cx='12' cy='102' r='1'/%3E%3C/g%3E%3C/svg%3E");
  background-size: auto, auto, 120px 120px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #304355 transparent;
}

.chat__body::-webkit-scrollbar {
  width: 6px;
}

.chat__body::-webkit-scrollbar-track {
  background: transparent;
}

.chat__body::-webkit-scrollbar-thumb {
  border-radius: 99px;
  background: #304355;
}

.chat-list::-webkit-scrollbar {
  width: 5px;
}

.chat-list::-webkit-scrollbar-thumb {
  border-radius: 99px;
  background: #2e3e4e;
}

.day-chip {
  display: flex;
  justify-content: center;
  margin: 2px 0 18px;
}

.day-chip span {
  padding: 4px 11px;
  border-radius: 10px;
  background: rgba(23, 33, 43, 0.72);
  color: #c2cfda;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  backdrop-filter: blur(8px);
}

.messages {
  display: flex;
  flex-direction: column;
  max-width: 820px;
  margin: 0 auto;
}

.messages.is-restoring .msg-row {
  animation: none;
}

.msg-row {
  display: flex;
  margin: 2px 0;
  animation: msgIn 220ms cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

.msg-row--me {
  justify-content: flex-end;
}

.msg-row--report {
  margin: 10px 0 6px;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(7px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.bubble {
  position: relative;
  display: inline-block;
  max-width: min(77%, 560px);
  padding: 7px 11px 7px 12px;
  border-radius: 14px;
  color: #f0f5f8;
  font-size: 14.8px;
  line-height: 1.38;
  text-align: left;
  overflow-wrap: break-word;
  word-break: break-word;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.18);
}

.bubble--peer {
  border-bottom-left-radius: 5px;
  background: var(--tg-in);
}

.bubble--me {
  border-bottom-right-radius: 5px;
  background: var(--tg-out);
}

.bubble__text {
  white-space: pre-wrap;
}

.bubble__meta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  float: right;
  margin: 7px 0 0 9px;
  color: #7e93a6;
  font-size: 10.5px;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
}

.bubble--me .bubble__meta {
  color: #a5c5e0;
}

.bubble__meta .icon {
  width: 14px;
  height: 14px;
  stroke-width: 2.2;
}

.bubble--question {
  border-left: 2px solid rgba(100, 181, 239, 0.48);
}

.typing-row {
  display: flex;
  margin: 4px 0 2px;
}

.typing-bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  padding: 10px 14px;
  border-radius: 14px;
  border-bottom-left-radius: 5px;
  background: var(--tg-in);
}

.typing-bubble span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8fa2b4;
  animation: typing 1.2s ease-in-out infinite;
}

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

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

@keyframes typing {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

/* ---------- Report card ---------- */

.report {
  position: relative;
  width: min(520px, 100%);
  overflow: hidden;
  padding: 15px 16px 13px;
  border: 1px solid #2f4356;
  border-radius: 16px;
  background:
    radial-gradient(340px 160px at 100% 0, rgba(100, 181, 239, 0.08), transparent 70%),
    linear-gradient(155deg, #1c2b39, #17232f);
  color: var(--tg-text);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
}

.report::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border-top: 2px solid rgba(100, 181, 239, 0.34);
  pointer-events: none;
}

.report__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 11px;
  border-bottom: 1px dashed #35495c;
}

.report__eyebrow {
  margin: 0 0 3px;
  color: var(--tg-accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.report__title {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.report__no {
  flex: 0 0 auto;
  padding-top: 2px;
  color: var(--tg-muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.02em;
}

.report__list {
  display: grid;
  gap: 7px;
  margin: 12px 0 0;
}

.report__row {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  font-size: 13px;
  line-height: 1.4;
}

.report__row dt {
  color: #8397a9;
}

.report__row dd {
  margin: 0;
  color: #e7eff5;
  overflow-wrap: anywhere;
}

.report__verdict {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 13px;
  padding: 9px 11px;
  border: 1px solid rgba(77, 205, 94, 0.22);
  border-radius: 10px;
  background: rgba(77, 205, 94, 0.065);
  color: #c7e8cb;
  font-size: 12.5px;
  line-height: 1.38;
}

.report__verdict .icon {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin-top: 1px;
  color: #64d174;
}

.report__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding-top: 9px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--tg-muted);
  font-size: 10.5px;
}

.report__status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #7dd389;
  font-weight: 600;
}

.report__status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px rgba(77, 205, 94, 0.12);
}

.report__stamp {
  position: absolute;
  top: 58px;
  right: 13px;
  padding: 3px 8px;
  border: 2px solid rgba(77, 205, 94, 0.62);
  border-radius: 4px;
  color: rgba(126, 220, 139, 0.92);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transform: rotate(-11deg);
  opacity: 0.9;
  pointer-events: none;
}

.report__stamp::after {
  content: "";
  position: absolute;
  inset: 2px;
  border: 1px solid rgba(77, 205, 94, 0.35);
  border-radius: 2px;
}

/* ---------- Composer / answer form ---------- */

.composer {
  flex: 0 0 auto;
  padding: 9px clamp(10px, 3.4vw, 28px) calc(9px + var(--safe-bottom));
  border-top: 1px solid var(--tg-line);
  background: var(--tg-panel);
}

.composer__inner {
  max-width: 820px;
  margin: 0 auto;
}

.answer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 3px 6px;
  color: var(--tg-muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  line-height: 1.2;
  text-transform: uppercase;
}

.answer-meta__progress {
  color: var(--tg-accent);
}

.answer-meta__hint {
  overflow: hidden;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-overflow: ellipsis;
  text-transform: none;
  white-space: nowrap;
}

.composer__row {
  display: flex;
  align-items: flex-end;
  gap: 7px;
}

.field {
  display: flex;
  align-items: flex-end;
  flex: 1;
  min-width: 0;
  min-height: 42px;
  padding: 9px 14px;
  border-radius: 18px;
  background: var(--tg-panel-3);
  transition: background 160ms ease, box-shadow 160ms ease;
}

.field:focus-within {
  background: #293544;
  box-shadow: inset 0 0 0 1px rgba(100, 181, 239, 0.25);
}

.field.is-invalid {
  box-shadow: inset 0 0 0 1px rgba(226, 107, 107, 0.78);
  animation: fieldShake 300ms ease;
}

@keyframes fieldShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  55% { transform: translateX(4px); }
  80% { transform: translateX(-2px); }
}

.field textarea {
  display: block;
  width: 100%;
  min-height: 24px;
  max-height: 112px;
  padding: 0;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--tg-text);
  font-size: 15px;
  line-height: 1.45;
}

.field textarea::placeholder {
  color: #708396;
}

.send-btn {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--tg-accent-strong);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(51, 144, 236, 0.18);
  transition: background 140ms ease, opacity 140ms ease, transform 100ms ease;
}

.send-btn:hover:not(:disabled) {
  background: #3f9bf0;
}

.send-btn:active:not(:disabled) {
  transform: scale(0.94);
}

.send-btn:disabled {
  opacity: 0.38;
  cursor: default;
  box-shadow: none;
}

.send-btn .icon {
  width: 20px;
  height: 20px;
  transform: translateX(-1px);
}

.composer__hint {
  margin: 6px 0 0;
  color: var(--tg-muted-2);
  font-size: 10.5px;
  line-height: 1.35;
  text-align: center;
}

.answer-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  width: 100%;
}

.option-btn {
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid #2d3d4d;
  border-radius: 12px;
  background: #1e2a37;
  color: #dbe7f0;
  font-size: 13.5px;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, transform 100ms ease;
}

.option-btn:hover {
  border-color: #3d5368;
  background: #263646;
}

.option-btn:active {
  transform: scale(0.985);
}

.option-btn strong {
  display: block;
  margin-bottom: 1px;
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
}

.option-btn span {
  color: var(--tg-muted);
  font-size: 11px;
}

.option-btn[disabled] {
  opacity: 0.5;
  cursor: default;
}

.scale-wrap {
  flex: 1;
  min-width: 0;
}

.scale {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 16px;
  background: var(--tg-panel-3);
}

.scale output {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 32px;
  border-radius: 9px;
  background: var(--tg-out);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.scale input[type="range"] {
  flex: 1;
  width: 100%;
  height: 20px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.scale input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(to right, var(--tg-accent) 0%, var(--tg-accent) var(--fill, 66%), #334556 var(--fill, 66%), #334556 100%);
}

.scale input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 99px;
  background: #334556;
}

.scale input[type="range"]::-moz-range-progress {
  height: 4px;
  border-radius: 99px;
  background: var(--tg-accent);
}

.scale input[type="range"]::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -7px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--tg-accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.36);
  -webkit-appearance: none;
  appearance: none;
}

.scale input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--tg-accent);
}

.scale__ticks {
  display: flex;
  justify-content: space-between;
  padding: 4px 2px 0;
  color: var(--tg-muted-2);
  font-size: 9.5px;
}

.waiting-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 11px 15px;
  border-radius: 16px;
  background: var(--tg-panel-3);
  color: var(--tg-muted);
  font-size: 13px;
}

.spinner {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  border: 2px solid rgba(127, 145, 164, 0.25);
  border-top-color: var(--tg-accent);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

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

.msg-row--auth {
  margin: 6px 0 6px;
}

.inline-auth {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(370px, 100%);
  padding: 7px;
  border: 1px solid #2d4154;
  border-radius: 14px;
  background: #1c2733;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.inline-auth__button {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 9px;
  background: #fc3f1d;
  color: #fff;
  font-size: 13.5px;
  font-weight: 650;
  text-decoration: none;
  transition: background 140ms ease;
}

.inline-auth__button:hover {
  background: #ff5535;
}

.inline-auth__button .yandex-badge {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.yandex-badge {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fc3f1d;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.yandex-badge--sm {
  width: 20px;
  height: 20px;
  font-size: 10px;
}

.inline-auth__error {
  padding: 6px 8px;
  border: 1px solid rgba(226, 107, 107, 0.3);
  border-radius: 7px;
  background: rgba(226, 107, 107, 0.08);
  color: #f0b5b5;
  font-size: 11px;
  line-height: 1.35;
}

.done-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 11px 13px;
  border: 1px solid #2d4154;
  border-radius: 14px;
  background:
    linear-gradient(120deg, rgba(77, 205, 94, 0.06), transparent 55%),
    #1c2a38;
}

.done-panel__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.done-panel__text strong {
  font-size: 13.5px;
  font-weight: 600;
}

.done-panel__text span {
  color: var(--tg-muted);
  font-size: 11.5px;
}

.done-panel__actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, transform 100ms ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--tg-accent-strong);
  color: #fff;
}

.btn--primary:hover {
  background: #3f9bf0;
}

.btn--ghost {
  border-color: #34485b;
  background: transparent;
  color: #c8d6e1;
}

.btn--ghost:hover {
  background: #253442;
}

.btn--danger {
  background: #a84444;
  color: #fff;
}

.btn--danger:hover {
  background: #b94e4e;
}

.btn .icon {
  width: 16px;
  height: 16px;
}

/* ---------- Modal / toast ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal[hidden] {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 12, 0.66);
  backdrop-filter: blur(5px);
  animation: fadeIn 160ms ease both;
}

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

.modal__card {
  position: relative;
  width: min(440px, 100%);
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  padding: 22px 22px 20px;
  border: 1px solid #2c3d4e;
  border-radius: 18px;
  background: #17212b;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.58);
  animation: modalIn 180ms cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.modal__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
}

.modal__close .icon {
  width: 20px;
  height: 20px;
}

.modal__card h2 {
  margin: 0 34px 10px 0;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.modal__body {
  color: #b9c8d4;
  font-size: 13.5px;
  line-height: 1.55;
}

.modal__body p {
  margin: 0 0 10px;
}

.modal__body p:last-child {
  margin-bottom: 0;
}

.modal__body ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.modal__body li {
  margin: 4px 0;
}

.modal__body .muted {
  color: var(--tg-muted);
  font-size: 11.5px;
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.modal__actions .btn {
  min-height: 38px;
  padding: 9px 15px;
  font-size: 13px;
}

.toast {
  position: fixed;
  z-index: 120;
  left: 50%;
  bottom: calc(22px + var(--safe-bottom));
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 15px;
  border: 1px solid #33465a;
  border-radius: 11px;
  background: #1d2a37;
  color: #dbe7f0;
  font-size: 12.5px;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.42);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #0e1621;
  color: #fff;
  font-size: 15px;
  text-align: center;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  body {
    padding: 0;
    background: var(--tg-bg);
  }

  .page-glow {
    display: none;
  }

  .shell {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .chat__header {
    height: calc(58px + var(--safe-top));
    padding-top: var(--safe-top);
    padding-left: 12px;
  }

  .chat__body {
    padding: 14px 10px 12px;
  }

  .messages {
    max-width: none;
  }

  .bubble {
    max-width: 86%;
    font-size: 14.6px;
  }

  .composer {
    padding-left: 9px;
    padding-right: 9px;
  }

  .report {
    width: 100%;
  }

  .report__stamp {
    top: 52px;
  }

  .done-panel {
    align-items: flex-start;
  }

  .done-panel__actions {
    width: 100%;
  }

  .done-panel__actions .btn {
    flex: 1;
  }

  .toast {
    bottom: calc(16px + var(--safe-bottom));
  }
}

@media (max-width: 430px) {
  .chat__actions {
    gap: 0;
  }

  .peer {
    gap: 8px;
  }

  .peer h1 {
    font-size: 15px;
  }

  .avatar--header {
    width: 38px;
    height: 38px;
    font-size: 14px;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
  }

  .answer-options {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .option-btn {
    min-height: 46px;
    padding: 8px 10px;
    font-size: 12.8px;
  }

  .report__row {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 8px;
    font-size: 12.5px;
  }

  .report__no {
    display: none;
  }

  .report__stamp {
    top: 48px;
    right: 9px;
    font-size: 8.5px;
  }

  .bubble {
    max-width: 89%;
  }

  .composer__hint {
    display: none;
  }
}

@media (max-height: 640px) and (min-width: 901px) {
  .shell {
    height: calc(100dvh - 20px);
  }

  .report__list {
    gap: 5px;
  }
}

@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;
  }
}
