/* =========================================================================
   ЭндоЧат — тема "негатоскоп" (подсветка для рентген-снимков)

   Токены:
   bg-deep    #0A0F16  фон приложения, темнота смотрового кабинета
   bg-panel   #121926  поверхность карточек/вопросов
   bg-raised  #1B2432  строки вариантов ответа
   line       #29323F  тонкие разделители
   text       #EDF2F7  основной текст
   muted      #8592A3  вторичный текст
   accent     #6FD3FF  свечение негатоскопа — единственный яркий акцент
   warn       #FFB454  предупреждения
   danger     #FF6B5E  противоречия / неопределённость
   ========================================================================= */

:root {
  --bg-deep: #0A0F16;
  --bg-panel: #121926;
  --bg-raised: #1B2432;
  --bg-raised-hover: #212C3B;
  --line: #29323F;
  --text: #EDF2F7;
  --muted: #8592A3;
  --accent: #6FD3FF;
  --accent-dim: rgba(111, 211, 255, 0.13);
  --accent-line: rgba(111, 211, 255, 0.35);
  --warn: #FFB454;
  --warn-dim: rgba(255, 180, 84, 0.10);
  --danger: #FF6B5E;
  --danger-dim: rgba(255, 107, 94, 0.10);
  --accent-amber: #FFB454;
  --accent-amber-dim: rgba(255, 180, 84, 0.14);
  --accent-mint: #7CE7B8;
  --accent-mint-dim: rgba(124, 231, 184, 0.14);
  --font-sans: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Верхняя панель ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 8px;
}

.wordmark {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.topbar-counter {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-toggle {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.menu-toggle svg {
  width: 16px;
  height: 16px;
  stroke: var(--text);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.menu-toggle:active { background: var(--bg-raised); }

/* ---------- Выдвижное меню ---------- */

.menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 11, 0.6);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
  z-index: 40;
}

.menu-overlay.open {
  opacity: 1;
  visibility: visible;
}

.menu-drawer {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(84%, 320px);
  background: var(--bg-panel);
  border-left: 1px solid var(--line);
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.menu-overlay.open .menu-drawer {
  transform: translateX(0);
}

.menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.menu-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.menu-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: var(--bg-raised);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.menu-close svg {
  width: 13px;
  height: 13px;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.menu-greeting {
  font-size: 13px;
  color: var(--muted);
  margin: -8px 0 12px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 13px 6px;
  border: none;
  border-top: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  text-align: left;
  opacity: 0;
  transform: translateX(14px);
  transition: background 0.15s ease;
}

.menu-overlay.open .menu-item {
  animation: menu-item-in 0.32s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.menu-overlay.open .menu-item:nth-of-type(1) { animation-delay: 0.06s; }
.menu-overlay.open .menu-item:nth-of-type(2) { animation-delay: 0.11s; }
.menu-overlay.open .menu-item:nth-of-type(3) { animation-delay: 0.16s; }

@keyframes menu-item-in {
  to { opacity: 1; transform: translateX(0); }
}

.menu-item:last-of-type { border-bottom: 1px solid var(--line); }

.menu-item:active { background: var(--bg-raised); }

.menu-item-icon {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-item-icon svg {
  width: 17px;
  height: 17px;
  stroke: var(--accent);
  stroke-width: 1.7;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.menu-item-icon-amber { background: var(--accent-amber-dim); }
.menu-item-icon-amber svg { stroke: var(--accent-amber); }

.menu-item-icon-mint { background: var(--accent-mint-dim); }
.menu-item-icon-mint svg { stroke: var(--accent-mint); }

.menu-item-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.menu-item-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.menu-item-sub {
  font-size: 12.5px;
  color: var(--muted);
}

.menu-footer {
  margin-top: auto;
  padding-top: 16px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.stage {
  flex: 1;
  padding: 8px 20px 28px;
  display: flex;
  flex-direction: column;
}

.home-tiles {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.tile {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.tile:active {
  background: var(--bg-raised);
  border-color: var(--accent-line);
}

.tile-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--accent-amber-dim);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tile-icon svg {
  width: 16px;
  height: 16px;
  stroke: var(--accent-amber);
  stroke-width: 1.7;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tile-icon-mint { background: var(--accent-mint-dim); }
.tile-icon-mint svg { stroke: var(--accent-mint); }

.tile-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

/* ---------- Иллюстрация зуба / прогресс ---------- */

.tooth-progress {
  display: flex;
  justify-content: center;
  margin: 6px 0 22px;
}

.tooth-progress svg {
  width: 74px;
  height: 126px;
  overflow: visible;
}

.tooth-outline {
  fill: var(--bg-raised);
  stroke: var(--line);
  stroke-width: 1.6;
}

.tooth-canal {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-dasharray: 100;
  filter: drop-shadow(0 0 5px rgba(111, 211, 255, 0.75));
  transition: stroke-dashoffset 0.5s ease;
}

/* ---------- Общие блоки экрана ---------- */

.screen {
  animation: rise 0.38s ease both;
}

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

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.03em;
  margin-bottom: 10px;
}

h1.q-text {
  font-size: 21px;
  line-height: 1.4;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 22px;
  max-width: 340px;
}

.helper-text {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  margin: 0 0 20px;
}

/* ---------- Варианты ответов ---------- */

.options {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}

.option-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 15px 4px;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.option-row:active,
.option-row.flash {
  background: var(--accent-dim);
}

.option-row .check {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  border: 1.6px solid var(--line);
  background: var(--bg-raised);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.option-row.checked .check {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.option-row .check svg {
  width: 12px;
  height: 12px;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.option-row.checked .check svg { opacity: 1; }

.option-row .label { flex: 1; }

/* ---------- Нижняя закреплённая панель (кнопки) ---------- */

.bottom-bar {
  margin-top: auto;
  padding-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.005em;
  padding: 16px 22px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  text-align: center;
  transition: transform 0.08s ease, box-shadow 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

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

.btn-primary {
  background: var(--accent);
  color: #06121C;
  box-shadow: 0 6px 20px rgba(111, 211, 255, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-primary:hover { background: #85DBFF; }

.btn-primary:active {
  box-shadow: 0 3px 10px rgba(111, 211, 255, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-ghost {
  background: var(--bg-panel);
  color: var(--text);
  border: 1.5px solid var(--line);
}

.btn-ghost:hover {
  border-color: var(--accent-line);
  background: var(--bg-raised);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

/* ---------- Поле ввода метки пациента ---------- */

.text-input {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 14px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  margin-bottom: 6px;
}

.text-input:focus {
  outline: none;
  border-color: var(--accent-line);
}

.field-note {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
  margin-bottom: 24px;
}

/* ---------- Результат ---------- */

.result-header {
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 4px 0 18px;
}

.report-block {
  border-top: 1px solid var(--line);
  padding: 16px 0;
}

.report-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}

.report-value {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.4;
}

.report-value.dim { color: var(--muted); font-weight: 500; }

.findings-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.findings-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14.5px;
  color: var(--text);
  padding: 6px 0;
}

.findings-list li::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.panel {
  border-radius: 10px;
  padding: 14px 16px;
  margin-top: 16px;
  font-size: 14px;
  line-height: 1.55;
  border-left: 3px solid var(--warn);
  background: var(--warn-dim);
}

.panel.danger {
  border-left-color: var(--danger);
  background: var(--danger-dim);
}

.panel-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.disclaimer {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
  margin-top: 20px;
  font-style: italic;
}

/* ---------- История ---------- */

.history-item {
  border-top: 1px solid var(--line);
  padding: 14px 0;
}

.history-date {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.history-label {
  font-size: 15.5px;
  font-weight: 700;
  margin: 4px 0 8px;
}

.history-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 100px;
  background: var(--bg-raised);
  color: var(--muted);
  border: 1px solid var(--line);
}

.chip.chip-accent {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent-line);
}

.chip.chip-warn {
  background: var(--warn-dim);
  color: var(--warn);
  border-color: rgba(255, 180, 84, 0.35);
}

.info-block {
  border-top: 1px solid var(--line);
  padding: 15px 0;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--text);
}

.info-block:first-of-type { border-top: none; }

.info-block strong { color: var(--text); }

.empty-state {
  color: var(--muted);
  font-size: 14.5px;
  padding: 30px 0;
  text-align: center;
}
