/* ============================================================
   Inner Doctor — Жар (fever tracker)
   Палитра и типографика — как на innerdoctor.surge.sh:
   Cormorant Garamond (заголовки) + Montserrat (текст)
   ============================================================ */

:root {
  --bg:         #ece4d8;
  --bg-soft:    #f5efe4;
  --card:       #ffffffee;
  --ink:        #3b2e25;
  --ink-soft:   #5a4938;
  --muted:      #6b5a4c;
  --line:       #d9cfbf;

  --accent:      #6c4f3d;   /* deep brown */
  --accent-deep: #5a3f30;
  --accent-soft: #a48672;
  --gold:        #c8a25f;
  --script:      #a85a44;   /* terracotta для рукописного и опасности */

  /* светофор — приглушённые медицинские тона, в гамме сайта */
  --can-bg:     #d9dcc4;    /* sage, можно */
  --can-strong: #b7c4a0;
  --soft-zone:  #e6b89b;    /* peachy beige, аккуратно (можно, не превышая дневной лимит) */
  --hard-zone:  #c5694a;    /* приглушённая terracotta, нельзя */
  --eval-zone:  #4ec5b3;    /* бирюзовый — оценка эффекта (40 мин на противоположной шкале) */

  --nurofen:     #6c4f3d;   /* accent */
  --paracetamol: #c8a25f;   /* gold */

  --shadow-1: 0 6px 18px -10px rgba(40,28,18,.35);
  --shadow-2: 0 14px 40px -18px rgba(40,28,18,.45);

  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 24px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Montserrat', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-weight: 300;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  /* lining + tabular figures: цифры одной высоты с заглавными буквами */
  font-feature-settings: "lnum" 1, "tnum" 1;
  font-variant-numeric: lining-nums tabular-nums;
}

body {
  min-height: 100vh; min-height: 100dvh;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(108,79,61,0.10), transparent 60%),
    linear-gradient(180deg, var(--bg-soft) 0%, var(--bg) 70%);
}

button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select { font: inherit; color: inherit; font-weight: 400; }
a { color: inherit; text-decoration: none; }

#app {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100vh; min-height: 100dvh;
  padding: max(env(safe-area-inset-top), 16px) 18px max(env(safe-area-inset-bottom), 16px);
  display: flex;
  flex-direction: column;
}

/* ===== Topbar ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 16px;
}
.topbar h1 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 22px;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin: 0;
  flex: 1;
  min-width: 0;
  line-height: 1.1;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar h1 .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar h1 .muted {
  display: block;
  font-family: 'Montserrat', sans-serif;
  font-weight: 400;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: none;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.3;
}
.topbar h1 .muted::first-letter { text-transform: uppercase; }

.icon-btn {
  width: 38px; height: 38px;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 18px;
  transition: background .2s ease, transform .15s ease;
}
.icon-btn:hover { background: var(--bg-soft); }
.icon-btn:active { transform: scale(.96); }
.icon-btn .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
}
.icon-btn .icon svg { display: block; }
.topbar-placeholder {
  display: inline-block;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}
.icon-btn.help {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 20px;
  color: var(--script);
  border-color: var(--accent-soft);
}

.link-btn {
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 10px;
  line-height: 1;
}
.link-btn:active { opacity: .7; }

/* ===== Splash ===== */
.splash {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  text-align: center;
  padding: 20px;
}
.splash.register { gap: 18px; padding: 16px; justify-content: flex-start; padding-top: 28px; }
.logo-art {
  width: 220px; height: 220px;
  display: grid; place-items: center;
  filter: drop-shadow(0 12px 24px rgba(40,28,18,0.12));
}
.splash.register .logo-art { width: 150px; height: 150px; }
.splash h2 {
  margin: 0;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 30px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink);
  line-height: 1.05;
  text-wrap: balance;
}
.splash .sub {
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: .04em;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 14px;
}
.splash .sub span { display: block; white-space: nowrap; }
.splash .sub span::first-letter { text-transform: uppercase; }
.splash p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .22em;
  text-transform: uppercase;
  max-width: 28ch;
}

/* ===== Buttons (CTA) ===== */
.cta {
  width: 100%;
  max-width: 320px;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 16px 22px;
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  box-shadow: var(--shadow-2);
  transition: background .2s ease, transform .15s ease;
}
.cta:hover { background: var(--accent-deep); }
.cta:active { transform: translateY(1px); }

.cta.secondary {
  background: #fff;
  color: var(--ink);
  font-weight: 500;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
}
.cta.secondary:hover { background: var(--bg-soft); }

/* ===== Forms ===== */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label {
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  padding-left: 4px;
  font-weight: 500;
}
.field > input, .field > select {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  font-size: 16px;
  color: var(--ink);
  width: 100%;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.field > input::placeholder { color: #b3a795; font-weight: 300; }
.field > input:focus, .field > select:focus {
  border-color: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(164,134,114,.18);
}
.field-row { display: flex; gap: 10px; }
.field-row > .field { flex: 1; }
.hint {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 0 4px;
  line-height: 1.55;
}

/* ===== Case screen ===== */
.scales {
  display: flex;
  gap: 14px;
  margin: 8px 0 18px;
  align-items: stretch;
}
.scales-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-family: 'Cormorant Garamond', serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: .04em;
  padding: 50px 0 0;
  height: 380px;
  margin-top: 50px;
  width: 26px;
  text-align: right;
  flex-shrink: 0;
}

.scale-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  min-width: 0;
}
.scale-col .give-btn { margin-top: auto; }

.scale-col header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink);
  height: 24px;
}
.scale-col .dot { width: 8px; height: 8px; border-radius: 999px; }
.scale-col[data-drug="ibuprofen"] .dot { background: var(--nurofen); }
.scale-col[data-drug="paracetamol"] .dot { background: var(--paracetamol); }

.scale {
  position: relative;
  height: 380px;
  border-radius: 14px;
  background: linear-gradient(to bottom, #e6e9d4, var(--can-bg));
  overflow: visible;
  margin: 0 auto;
  width: 52px;
  box-shadow: inset 0 0 0 1px rgba(60,45,35,0.08), var(--shadow-1);
}
.scale-tail {
  position: relative;
  width: 52px;
  margin: 0 auto;
  height: 0;
  opacity: 0.35;
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 14px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,1), rgba(0,0,0,0.2));
          mask-image: linear-gradient(to bottom, rgba(0,0,0,1), rgba(0,0,0,0.2));
}
.scale-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 12px;
}
.scale-wrap .next-day-label {
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--muted);
  margin-top: 6px;
  opacity: 0.8;
  line-height: 1;
}
.scale-wrap .next-day-label::first-letter { text-transform: uppercase; }

.zone {
  position: absolute;
  left: 0; right: 0;
  pointer-events: none;
}
.zone.hard { background: var(--hard-zone); }
.zone.soft { background: var(--soft-zone); }
.zone.eval {
  background: var(--eval-zone);
  z-index: 2;  /* поверх hard/soft */
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25);
}

.eval-q {
  position: absolute;
  left: 50%;
  margin-left: -16px;
  transform: translateY(-50%);
  width: 32px; height: 32px;
  border-radius: 999px;
  background: #fff;
  border: 2px solid var(--eval-zone);
  color: var(--eval-zone);
  display: grid; place-items: center;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 18px;
  line-height: 1;
  z-index: 5;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(40,28,18,0.25);
  padding: 0;
  animation: eval-pulse 2.4s ease-in-out infinite;
}
.eval-q:active { transform: translateY(-50%) scale(0.92); animation: none; }
@keyframes eval-pulse {
  0%, 100% { box-shadow: 0 2px 8px rgba(40,28,18,0.25), 0 0 0 0 rgba(78,197,179,0.55); }
  50%      { box-shadow: 0 2px 8px rgba(40,28,18,0.25), 0 0 0 8px rgba(78,197,179,0);   }
}

.now-marker {
  position: absolute;
  left: -6px; right: -6px;
  height: 2px;
  background: var(--ink);
  pointer-events: none;
  z-index: 3;
}
.now-marker::after {
  content: attr(data-time);
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translate(-6px, -50%);
  background: var(--ink);
  color: #fff;
  font-family: 'Cormorant Garamond', serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .04em;
  padding: 3px 7px;
  border-radius: 6px;
  white-space: nowrap;
}

.dose-mark {
  position: absolute;
  left: 50%;
  width: 20px; height: 20px;
  margin-left: -10px;
  border-radius: 999px;
  background: #fff;
  border: 1.5px solid var(--accent);
  box-shadow: 0 2px 6px rgba(40,28,18,0.25);
  display: grid; place-items: center;
  z-index: 4;
  transform: translateY(-50%);
}
.dose-mark::after { content: '✓'; color: var(--accent); font-weight: 700; font-size: 11px; }
.scale-col[data-drug="paracetamol"] .dose-mark { border-color: var(--gold); }
.scale-col[data-drug="paracetamol"] .dose-mark::after { color: var(--gold); }

.give-btn {
  width: 100%;
  border-radius: 999px;
  padding: 13px 8px;
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #fff;
  box-shadow: var(--shadow-1);
  white-space: nowrap;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .2s ease, transform .15s ease, filter .2s ease;
}
.scale-col[data-drug="ibuprofen"] .give-btn { background: var(--nurofen); }
.scale-col[data-drug="paracetamol"] .give-btn { background: var(--gold); }
.give-btn:hover { filter: brightness(1.08); }
.give-btn:active { transform: translateY(1px); }
.give-btn.muted {
  background: #fff !important;
  color: var(--muted);
  border: 1px solid var(--line);
  box-shadow: none;
}

.status-pill {
  align-self: center;
  font-family: 'Cormorant Garamond', serif;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: .04em;
  border-radius: 999px;
  padding: 6px 12px;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.status-pill.can  { background: var(--can-bg); color: #4a5a3a; }
.status-pill.soft { background: var(--soft-zone); color: #6b3a26; }
.status-pill.hard { background: var(--hard-zone); color: #fff; }

/* ===== Легенда цветов под шкалами ===== */
.scale-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 14px;
  margin: 4px 0 14px;
  padding: 0 4px;
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  letter-spacing: .02em;
  color: var(--muted);
}
.scale-legend .leg-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.scale-legend .leg-color {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.scale-legend .leg-color.can  { background: var(--can-bg); border: 1px solid var(--can-strong); }
.scale-legend .leg-color.soft { background: var(--soft-zone); }
.scale-legend .leg-color.hard { background: var(--hard-zone); }
.scale-legend .leg-color.eval { background: var(--eval-zone); }

/* ===== Bottom toolbar ===== */
.bottom-bar {
  margin-top: auto;
  display: flex;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.bottom-bar > * { flex: 1; }
.bottom-bar .cta {
  padding: 14px 12px;
  font-size: 11px;
  letter-spacing: .18em;
}

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(20,12,6,.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 50;
  animation: fadeIn .25s ease;
}
@media (min-height: 680px) {
  .modal-backdrop { align-items: center; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%;
  max-width: 460px;
  background: linear-gradient(180deg, #fffaf2 0%, #f3e9d9 100%);
  border-radius: var(--r-lg) var(--r-lg) var(--r-md) var(--r-md);
  padding: 22px 22px max(env(safe-area-inset-bottom), 22px);
  max-height: 92vh;
  overflow-y: auto;
  animation: slideUp .35s cubic-bezier(.2,.8,.2,1);
  box-shadow: 0 -30px 80px rgba(0,0,0,.5);
}
@keyframes slideUp { from { transform: translateY(40px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-grab {
  width: 42px; height: 4px;
  background: var(--line);
  border-radius: 99px;
  margin: -6px auto 16px;
}
.modal h3 {
  margin: 0 0 18px;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 28px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink);
  text-align: center;
  line-height: 1;
}
.modal h3 small {
  display: block;
  font-family: 'Montserrat', sans-serif;
  font-weight: 400;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: none;
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.2;
}
.modal h3 small::first-letter { text-transform: uppercase; }

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.segmented.three { grid-template-columns: 1fr 1fr 1fr; }
.segmented > button {
  padding: 13px 12px;
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  color: var(--ink);
  transition: background .2s ease, color .2s ease;
}
.segmented > button + button { border-left: 1px solid var(--line); }
.segmented > button.active {
  background: var(--accent);
  color: #fff;
  font-weight: 500;
}

.dosage-card {
  background: linear-gradient(135deg, #fffaef 0%, #f5e8c9 100%);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dosage-card .big {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--ink);
  line-height: 1.15;
}
.dosage-card .muted {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.info-section { padding: 0 4px 12px; }
.info-section h4 {
  margin: 20px 0 8px;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink);
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.info-section h4:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.info-section p { margin: 0 0 10px; font-size: 14px; color: var(--ink); line-height: 1.55; }
.info-section ul { margin: 6px 0 12px; padding-left: 20px; }
.info-section li { margin-bottom: 6px; font-size: 14px; color: var(--ink); line-height: 1.4; }
.info-section li.warn { color: var(--script); font-weight: 500; }

/* ===== History (chart) ===== */
.history-screen { display: flex; flex-direction: column; gap: 14px; }
.chart-wrap {
  background: var(--card);
  border-radius: var(--r-md);
  padding: 14px;
  box-shadow: var(--shadow-1);
  border: 1px solid var(--line);
}
.legend {
  display: flex; gap: 14px;
  padding: 4px 4px 8px;
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  flex-wrap: wrap;
}
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend .dot { width: 10px; height: 10px; border-radius: 999px; }

.dose-list {
  background: var(--card);
  border-radius: var(--r-md);
  padding: 4px 8px;
  box-shadow: var(--shadow-1);
  border: 1px solid var(--line);
}
.dose-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
}
.dose-row:last-child { border-bottom: 0; }
.dose-row .pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  padding: 4px 12px;
  border-radius: 999px;
}
.dose-row .pill[data-drug="ibuprofen"] { background: rgba(108,79,61,0.10); color: var(--accent); }
.dose-row .pill[data-drug="paracetamol"] { background: rgba(200,162,95,0.18); color: #8a6a2a; }
.dose-row .pill[data-drug="other"] { background: var(--bg-soft); color: var(--muted); }
.dose-row .when {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.dose-row .temp {
  margin-left: auto;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 16px;
  color: var(--script);
}

/* ===== Алгоритм действий при ОРВИ ===== */
.algorithm-content { padding: 0 0 12px; }
.algorithm-content p { margin: 0 0 12px; font-size: 14px; line-height: 1.5; color: var(--ink); }
.algorithm-content > ul { margin: 0 0 16px; padding-left: 22px; }
.algorithm-content > ul > li { margin: 4px 0; font-size: 14px; color: var(--ink); line-height: 1.5; }

.algo-intro {
  font-size: 12px !important;
  letter-spacing: .04em;
  color: var(--muted) !important;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 16px !important;
}

.algo-step {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 24px 0 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.algo-step:first-child, .algo-step + .algo-step { border-top: 1px solid var(--line); }
.algorithm-content > .algo-step:first-of-type { border-top: 0; padding-top: 4px; }
.algo-step-num {
  width: 42px; height: 42px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent);
  color: #fff;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 24px;
  line-height: 1;
  border-radius: 10px;
  flex-shrink: 0;
}
.algo-step-extra .algo-step-num { background: var(--gold); color: var(--ink); }
.algo-step-text { flex: 1; min-width: 0; }
.algo-step-title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 20px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink);
  line-height: 1.1;
}
.algo-step-sub {
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: .02em;
  color: var(--muted);
  margin-top: 4px;
}
.algo-step-sub::first-letter { text-transform: uppercase; }

.algo-subhead {
  margin: 16px 0 8px;
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--script);
}

.algo-callout {
  margin: 10px 0 14px;
  padding: 14px 16px;
  border-radius: var(--r-sm);
  font-size: 13px;
  line-height: 1.5;
}
.algo-callout-red {
  background: rgba(197,105,74,0.10);
  border-left: 3px solid var(--hard-zone);
  color: var(--ink);
}
.algo-callout-red .algo-callout-label { color: var(--hard-zone); }
.algo-callout-dark {
  background: rgba(31,32,34,0.78);
  color: #fff;
  border-left: 3px solid var(--ink);
}
.algo-callout-dark .algo-callout-label { color: #fff; }
.algo-callout-dark ul li { color: #f2ece0; }
.algo-callout-plain {
  background: var(--bg-soft);
  border-left: 3px solid var(--accent-soft);
}
.algo-callout-plain .algo-callout-label { color: var(--ink); }
.algo-callout-label {
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.algo-callout ul {
  margin: 0;
  padding-left: 18px;
}
.algo-callout li {
  margin: 4px 0;
  font-size: 13px;
  line-height: 1.45;
}
.algo-callout-suffix {
  margin: 8px 0 0 !important;
  font-size: 12px !important;
  font-style: italic;
}

.algo-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 16px;
  font-size: 13px;
}
.algo-table th {
  text-align: left;
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 8px;
  border-bottom: 1px solid var(--line);
}
.algo-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.4;
}
.algo-table td:first-child {
  font-weight: 500;
  font-family: 'Cormorant Garamond', serif;
  font-size: 15px;
  color: var(--accent);
  letter-spacing: .02em;
  white-space: nowrap;
}

.algo-highlight {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #fff;
  border-radius: var(--r-sm);
  padding: 16px;
  margin: 14px 0;
  display: flex;
  align-items: center;
  gap: 14px;
}
.algo-highlight-big {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 30px;
  line-height: 1;
  color: var(--gold);
  flex-shrink: 0;
}
.algo-highlight-text {
  font-size: 12px;
  line-height: 1.4;
  opacity: 0.9;
}

.algo-alert {
  background: var(--hard-zone);
  color: #fff;
  border-radius: var(--r-sm);
  padding: 12px 14px;
  margin: 14px 0;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
}

.algo-disclaimer {
  margin: 20px 0 0;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: var(--r-sm);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
  letter-spacing: .02em;
}

.algorithm-btn {
  background: linear-gradient(135deg, #fffaef 0%, #f5e8c9 100%) !important;
  color: var(--ink) !important;
  border: 1px solid var(--gold) !important;
  border-left: 3px solid var(--gold) !important;
  position: relative;
  text-align: left;
  padding-left: 20px !important;
  padding-right: 36px !important;
}
.algorithm-btn::after {
  content: '★';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gold);
  font-size: 14px;
  text-shadow: 0 0 12px rgba(200,162,95,.55);
}

.archive-list { display: flex; flex-direction: column; gap: 12px; }
.archive-tools {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 0 4px 6px;
}
.archive-danger {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.archive-card { position: relative; padding: 0; overflow: hidden; }
.archive-card .archive-main {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  width: 100%;
  padding: 16px 48px 16px 18px;
  background: transparent;
}
.archive-card .archive-del,
.archive-card .archive-edit {
  position: absolute;
  top: 8px; right: 8px;
  width: 32px; height: 32px;
  border-radius: 999px;
  display: grid; place-items: center;
  font-size: 18px;
  font-weight: 400;
  color: var(--muted);
  background: transparent;
  line-height: 1;
}
.archive-card .archive-del { font-size: 20px; }
.archive-card .archive-del:hover { background: rgba(168,90,68,0.10); color: var(--script); }
.archive-card .archive-edit:hover { background: var(--bg-soft); color: var(--accent); }
.archive-card .archive-del:active,
.archive-card .archive-edit:active { transform: scale(0.92); }
.archive-card {
  background: var(--card);
  border-radius: var(--r-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-1);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}
.archive-card.closed { border-left-color: var(--accent-soft); }
.archive-card .ttl {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: .04em;
  color: var(--ink);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.archive-card .sub {
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 6px;
}
.archive-card .chev { color: var(--accent-soft); font-size: 22px; margin-left: auto; }

.action-list button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 16px 18px;
  background: var(--card);
  border-radius: var(--r-md);
  margin-bottom: 8px;
  font-size: 15px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  transition: background .2s ease;
}
.action-list button:hover { background: var(--bg-soft); }

.empty {
  text-align: center;
  font-family: 'Montserrat', sans-serif;
  color: var(--muted);
  padding: 50px 20px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .22em;
  text-transform: uppercase;
  line-height: 1.4;
}

/* misc */
.spacer { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; }
.row.between { justify-content: space-between; }

.danger-btn {
  background: transparent;
  color: var(--script);
  padding: 12px;
  border-radius: var(--r-sm);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.danger-btn:hover { background: rgba(168,90,68,0.08); }

.case-screen, .history-screen {
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* ===== Promo bar (в самом низу страницы во время случая) ===== */
.promo-bar {
  align-self: center;
  margin-top: 16px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #fff;
  border-radius: 999px;
  box-shadow: 0 10px 24px -10px rgba(40,28,18,0.45);
  cursor: pointer;
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  transition: transform .15s ease, filter .2s ease;
  user-select: none;
}
.promo-bar:hover { filter: brightness(1.08); }
.promo-bar:active { transform: translateY(1px); }
.promo-bar .promo-tag {
  font-weight: 600;
  display: inline-flex;
  align-items: center;
}
.promo-bar .promo-cta {
  color: var(--gold);
  font-weight: 500;
  border-left: 1px solid rgba(255,255,255,0.22);
  padding-left: 10px;
}

@media (max-width: 380px) {
  .splash h2 { font-size: 38px; }
  .splash .sub { font-size: 26px; }
  .topbar h1 { font-size: 19px; }
  .modal h3 { font-size: 24px; }
}

/* ============================================================
   Install prompt — Add-to-Home-Screen wizard
   ============================================================ */

.install-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.install-overlay--visible {
  opacity: 1;
  pointer-events: auto;
}

.install-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(40, 28, 18, 0.42);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.install-card {
  position: relative;
  z-index: 1;
  width: min(440px, calc(100% - 20px));
  margin: 0 10px max(12px, env(safe-area-inset-bottom));
  padding: 26px 22px 20px;
  background: var(--bg-soft);
  border-radius: 22px 22px 16px 16px;
  box-shadow: 0 -16px 50px -14px rgba(40, 28, 18, 0.45);
  transform: translateY(24px);
  transition: transform .35s cubic-bezier(.2, .9, .3, 1.15);
  font-family: 'Montserrat', sans-serif;
  color: var(--ink);
}
.install-overlay--visible .install-card {
  transform: translateY(0);
}

@media (min-width: 700px) {
  .install-overlay { align-items: center; }
  .install-card {
    margin: 0;
    border-radius: 18px;
  }
}

.install-close {
  position: absolute;
  top: 8px; right: 10px;
  width: 34px; height: 34px;
  border: none; background: none;
  color: var(--muted);
  font-size: 26px; line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  transition: background .15s, color .15s;
}
.install-close:hover { background: rgba(0,0,0,.05); color: var(--ink); }

.install-title {
  margin: 0 0 6px;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: 26px;
  line-height: 1.15;
  color: var(--ink);
}

.install-sub {
  margin: 0 0 18px;
  font-size: 14px;
  font-weight: 300;
  color: var(--muted);
  line-height: 1.5;
}

.install-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.install-steps li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.install-steps li > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
}
.install-steps strong {
  font-weight: 500;
  color: var(--ink);
}
.install-num {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #faf3e3;
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.install-hint {
  font-size: 12.5px;
  color: var(--muted);
}

.install-cta {
  display: block;
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #faf3e3;
  font-family: inherit;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: .01em;
  cursor: pointer;
  margin-top: 8px;
  transition: background .15s, transform .1s;
}
.install-cta:active { transform: scale(.98); }
.install-cta:hover { background: var(--accent-deep); }

.install-cta--ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}
.install-cta--ghost:hover { background: rgba(0,0,0,.04); color: var(--ink); }

/* Pulsing indicator near the Safari Share button location.
   iPhone — bottom toolbar, centered. iPad — top-right URL bar.
   These are heuristics; positions vary by iOS version & orientation. */
.install-pulse {
  position: fixed;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 10000;
  background: var(--script);
  opacity: 0;
  animation: install-pulse 1.6s ease-out infinite;
  animation-delay: .8s;
}
.install-pulse--bottom {
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 28px);
  transform: translateX(-50%);
}
.install-pulse--top-right {
  top: 18px;
  right: 90px;
}

@keyframes install-pulse {
  0%   { transform: translateX(var(--tx, 0)) scale(.6); opacity: .55; }
  70%  { transform: translateX(var(--tx, 0)) scale(2.4); opacity: 0; }
  100% { transform: translateX(var(--tx, 0)) scale(2.4); opacity: 0; }
}
.install-pulse--bottom { --tx: -50%; }

