/* === Базовые токены темы === */
:root {
  /* Палитра варианта «Двойной обжарки»:
     монохром кофейный + красный/зелёный ТОЛЬКО как семантика (оценки/успех/ошибка). */
  --bg-0: #120d0a;   /* глубокий чёрный (обжарка) */
  --bg-1: #1c1410;
  --bg-2: #241a14;   /* фон карточек */
  --surface: rgba(200, 150, 90, 0.05);
  --surface-2: rgba(200, 150, 90, 0.09);
  --border: rgba(200, 150, 90, 0.16);
  --border-strong: rgba(200, 150, 90, 0.32);

  --text: #f5e8d4;   /* foam — основной текст */
  --text-dim: #c4b29c;
  --text-muted: #8a7866;

  --espresso: #6f4e37;      /* кофейный — поверхности/селекторы */
  --espresso-light: #84604a;
  --caramel: #c8965a;       /* карамель — ЕДИНСТВЕННЫЙ декоративный акцент */
  --caramel-bright: #e0a865;/* активный таб, ползунки, hover */
  --crema: #e8d5b7;
  --foam: #f5e8d4;

  /* Семантические цвета — используются ТОЛЬКО по назначению (не как декор). */
  --cherry: #c0392b;        /* спелая ягода: плохие оценки / ошибки / удаление */
  --cherry-bright: #d85565;
  --leaf: #5a7d46;          /* лист кофе: успех / оптимальная оценка / сбалансирован */
  --leaf-bright: #7ea45f;

  /* Алиасы для семантики (читаемость в коде). */
  --danger: var(--cherry);
  --success: var(--leaf);
  --accent: var(--caramel-bright);   /* декоративный акцент */

  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);

  --maxw: 1180px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", "Inter", system-ui, -apple-system, "Roboto", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(200, 150, 90, 0.08), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(111, 78, 55, 0.18), transparent 60%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1) 60%, var(--bg-0));
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.5;
}

/* === Шапка === */
.app-header {
  padding: 22px 20px 6px;
  display: flex;
  justify-content: center;
  position: relative;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: var(--maxw);
  width: 100%;
}
.brand-logo {
  font-size: 38px;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4));
}
.brand-text h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0.3px;
  background: linear-gradient(90deg, var(--crema), var(--caramel-bright));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-text p {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

/* ===== Переключатель языка ===== */
.lang-switcher {
  position: absolute;
  top: 22px;
  right: 20px;
  z-index: 100;
}
.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s, border-color .15s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.lang-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: var(--caramel);
}
.lang-btn[aria-expanded="true"] {
  border-color: var(--caramel-bright);
}
.lang-caret {
  font-size: 10px;
  opacity: 0.7;
}
.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.lang-menu[hidden] { display: none; }
.lang-menu li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
  font-size: 14px;
  transition: background .12s;
}
.lang-menu li:hover {
  background: var(--surface-2);
}
.lang-menu li.active {
  color: var(--caramel-bright);
  font-weight: 700;
}
.lang-menu .lang-flag {
  font-size: 18px;
}
.lang-menu .lang-code {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* === Табы === */
.tabs {
  display: flex;
  gap: 6px;
  padding: 10px 20px 0;
  justify-content: center;
  flex-wrap: wrap;
  max-width: var(--maxw);
  margin: 0 auto;
}
.tab {
  appearance: none;
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--text-dim);
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all .18s ease;
}
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab.active {
  background: linear-gradient(180deg, rgba(200,150,90,0.22), rgba(111,78,55,0.18));
  color: var(--crema);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

/* === Контейнер === */
.container {
  max-width: var(--maxw);
  margin: 16px auto 60px;
  padding: 0 20px;
}
.panel { display: none; animation: fade .25s ease; }
.panel.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin: 6px 0 16px;
}
.panel-head h2 {
  margin: 0;
  font-size: 20px;
  color: var(--crema);
}

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.filter, .filter-input {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-dim);
}
.filter-input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

/* === Карточки === */
.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.card {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(4px);
}

/* Карточка рецепта */
.recipe-card .title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.recipe-card h3 {
  margin: 0 0 2px;
  font-size: 17px;
  color: var(--foam);
}
.recipe-card .desc {
  color: var(--text-muted);
  font-size: 12.5px;
  margin: 0 0 12px;
}
.badge {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  white-space: nowrap;
}
.badge.black { background: rgba(111,78,55,0.25); color: var(--crema); }
.badge.milk  { background: rgba(245,232,212,0.12); color: var(--foam); }
.badge.cold  { background: rgba(120,170,210,0.18); color: #a9d2eb; }
.badge.mine  { background: rgba(111,154,92,0.18); color: #b6d8a3; }
.global-badge {
  font-size: 10px;
  background: rgba(200,150,90,0.18);
  color: var(--caramel-bright);
  padding: 2px 7px;
  border-radius: 999px;
  margin-left: 6px;
  font-weight: 600;
  letter-spacing: .3px;
}

/* ============================ Базовые настройки кофемашины ============================ */
.machine-bar {
  max-width: var(--maxw);
  margin: 4px auto 0;
  padding: 12px 16px;
  background: linear-gradient(180deg, rgba(200,150,90,0.10), rgba(111,78,55,0.06));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.machine-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--crema);
  letter-spacing: .3px;
}
.machine-sub { color: var(--text-muted); font-weight: 400; font-size: 12px; }
.machine-controls {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

/* Группа из нескольких полей в одной рамке (зерно + обжарка) */
.machine-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px;
  background: linear-gradient(180deg, rgba(200,150,90,0.08), rgba(111,78,55,0.03));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  min-width: 200px;
}
.mf-group-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mf-group-field select {
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
}
.mf-group-field select:focus {
  outline: none;
  border-color: var(--caramel);
  box-shadow: 0 0 0 3px rgba(200,150,90,0.18);
}
.machine-field {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 8px 12px;
  flex: 1;
  min-width: 280px;
}
.mf-label { font-size: 15px; color: var(--text-dim); font-weight: 600; }
.mf-value { font-size: 16px; color: var(--caramel-bright); }
.mf-value strong { font-size: 22px; }
.mf-range { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }
.machine-field input[type="range"] { accent-color: var(--caramel); width: 100%; }

/* ============================ Круглые ползунки ============================ */
/* Базовый сброс: убираем нативный «ползунок-палец», оставляем только дорожку. */
input[type="range"].round-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 10px;
  background: linear-gradient(90deg, rgba(111,78,55,0.5), rgba(200,150,90,0.25));
  border-radius: 999px;
  outline: none;
  cursor: pointer;
  border: 1px solid var(--border);
}
/* Кружок (бегунок) — WebKit (Chrome, Edge, Safari). */
input[type="range"].round-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--foam), var(--caramel-bright) 70%, var(--espresso));
  border: 2px solid var(--bg-0);
  box-shadow: 0 2px 6px rgba(0,0,0,0.5), 0 0 0 1px rgba(200,150,90,0.4);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
input[type="range"].round-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 3px 10px rgba(0,0,0,0.6), 0 0 0 3px rgba(200,150,90,0.35);
}
input[type="range"].round-slider::-webkit-slider-thumb:active { transform: scale(1.25); }
/* Кружок — Firefox. */
input[type="range"].round-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--foam), var(--caramel-bright) 70%, var(--espresso));
  border: 2px solid var(--bg-0);
  box-shadow: 0 2px 6px rgba(0,0,0,0.5), 0 0 0 1px rgba(200,150,90,0.4);
  cursor: pointer;
}
input[type="range"].round-slider::-moz-range-track {
  height: 10px;
  background: linear-gradient(90deg, rgba(111,78,55,0.5), rgba(200,150,90,0.25));
  border-radius: 999px;
  border: 1px solid var(--border);
}

/* Крупный круглый ползунок для температуры в вводных данных */
input[type="range"].round-slider-lg {
  height: 14px;
}
input[type="range"].round-slider-lg::-webkit-slider-thumb {
  width: 32px;
  height: 32px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.6), 0 0 0 2px rgba(200,150,90,0.5);
}
input[type="range"].round-slider-lg::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 14px rgba(0,0,0,0.7), 0 0 0 5px rgba(200,150,90,0.4);
}
input[type="range"].round-slider-lg::-moz-range-thumb {
  width: 32px;
  height: 32px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.6), 0 0 0 2px rgba(200,150,90,0.5);
}
input[type="range"].round-slider-lg::-moz-range-track { height: 14px; }

.mf-hint-inline { font-size: 10.5px; color: var(--text-muted); font-weight: 400; }

/* Блок «Эспрессо» (задаёт brew ratio) */
.machine-field-espresso {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(200,150,90,0.08), rgba(111,78,55,0.03));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  flex: 1;
  min-width: 240px;
}
.espresso-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.esp-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text-muted);
  flex: 1;
  min-width: 80px;
}
.esp-field input {
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  width: 100%;
}
.esp-field input:focus {
  outline: none;
  border-color: var(--caramel);
  box-shadow: 0 0 0 3px rgba(200,150,90,0.18);
}

/* Производные параметры блока Эспрессо (brew ratio, поток, помол) */
.esp-derived {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}
.esp-derived-item strong {
  color: var(--caramel-bright);
  font-weight: 700;
  font-size: 15px;
}
.esp-derived-hint {
  margin-top: 0;
  font-size: 12.5px;
}
.esp-derived-hint span { color: var(--text-muted); font-style: italic; }

/* Горизонтальный температурный блок */
.machine-field-temp-h {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  background: linear-gradient(180deg, rgba(200,150,90,0.10), rgba(111,78,55,0.04));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  flex: 1;
  min-width: 260px;
}
.temp-h-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.temp-range-inline {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 400;
}

/* Шкала горизонтальная + текущее значение справа */
.temp-h-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Скрытый input range (для accessibility, визуально спрятан) */
.temp-hidden-input {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Горизонтальный ртутный градусник */
.thermometer-h {
  cursor: pointer;
  user-select: none;
  touch-action: none;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0;
}
.therm-h-tube {
  position: relative;
  flex: 1;
  height: 26px;
  background: var(--bg-2);
  border: 2px solid var(--border-strong);
  border-radius: 13px;
  overflow: visible;
  box-shadow: inset 0 0 6px rgba(0,0,0,0.4);
}
/* Ртуть — заливка слева направо до текущей температуры */
.therm-h-fill {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 50%;
  background: linear-gradient(90deg, var(--espresso), var(--caramel-bright));
  transition: width .12s ease;
  border-radius: 11px;
  box-shadow: inset 0 0 4px rgba(255,255,255,0.15);
}
/* Мелкие риски-метки вдоль трубки (только визуальные) */
.therm-h-marks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.therm-h-mark {
  position: absolute;
  top: 0;
  width: 1px;
  height: 6px;
  background: rgba(243,233,218,0.3);
}
.therm-h-mark-label {
  position: absolute;
  top: 30px;
  left: 0;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}
/* Ползунок (указатель) на уровне текущей температуры — крупный, по центру шкалы */
.therm-h-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  transform: translateY(-50%);
  transition: left .12s ease;
  pointer-events: none;
}
.therm-h-indicator-dot {
  position: absolute;
  top: 0;
  left: 0;
  width: 28px;
  height: 28px;
  margin-top: -14px;
  margin-left: -14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--foam), var(--caramel-bright) 60%, var(--espresso));
  border: 3px solid var(--bg-0);
  box-shadow: 0 2px 8px rgba(0,0,0,0.5), 0 0 12px rgba(200,150,90,0.7);
  transition: transform .12s ease;
}
.thermometer-h:hover .therm-h-indicator-dot {
  box-shadow: 0 3px 12px rgba(0,0,0,0.6), 0 0 16px rgba(200,150,90,0.9);
}
.thermometer-h:active .therm-h-indicator-dot {
  transform: scale(1.12);
}

/* Текущая температура — крупным шрифтом */
.temp-h-current {
  display: flex;
  align-items: baseline;
  gap: 2px;
  min-width: 70px;
  justify-content: flex-end;
}
.temp-h-current strong {
  font-size: 32px;
  font-weight: 800;
  color: var(--caramel-bright);
  line-height: 1;
}
.temp-h-current small {
  font-size: 14px;
  color: var(--text-muted);
}

/* Маленькие блоки рекомендаций (под Эспрессо и под Температурой) */
.rec-block {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
  padding: 6px 10px;
  background: rgba(111,78,55,0.12);
  border-left: 3px solid var(--caramel);
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--text-dim);
}
.rec-block[hidden] { display: none; }
.rec-label { font-weight: 600; color: var(--caramel-bright); }
.rec-block span:last-child { color: var(--text); font-weight: 600; }

/* Рекомендация температуры прижата ко дну блока (как в Эспрессо) */
.machine-field-temp-h .temp-h-wrap { margin-bottom: 18px; } /* запас под метки градусов */
.machine-field-temp-h .rec-block { margin-top: auto; }
.mf-recommendation {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.mf-recommendation.active {
  color: var(--foam);
  background: rgba(200,150,90,0.15);
  border-color: var(--caramel);
  animation: pulse-glow 2s ease-in-out infinite alternate;
}
@keyframes pulse-glow {
  from { box-shadow: 0 0 4px rgba(200,150,90,0.15); }
  to   { box-shadow: 0 0 10px rgba(200,150,90,0.35); }
}

/* Блок таймингов в калькуляторе */
.timing-block {
  margin-top: 14px;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(111,78,55,0.08), rgba(111,78,55,0.03));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.timing-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--caramel-bright);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}
.timing-block .slider-row {
  padding: 8px 0 4px;
  border-bottom: none;
}

/* Компактная рекомендация под ползунком (вода, преинфузия, экстракция) */
.rec-inline {
  margin-top: 6px;
  margin-bottom: 0;
  font-size: 12px;
  padding: 5px 10px;
}

/* Подсветка оценок в сводке: красный — плохо (семантика ошибки), зелёный — хорошо (семантика успеха).
   В варианте «Двойной обжарки» это ЕДИНСТВЕННЫЕ места, где используются cherry/leaf цвета. */
.rec-bad {
  color: var(--cherry-bright);
  border: 1px solid var(--cherry);
  background: rgba(192, 57, 43, 0.12);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  font-weight: 700;
  display: inline-block;
}
.rec-good {
  color: var(--leaf-bright);
  border: 1px solid var(--leaf);
  background: rgba(90, 125, 70, 0.14);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  font-weight: 700;
  display: inline-block;
}

/* Select-поля в вводных данных (зерно, обжарка) */
.machine-field-select {
  grid-template-columns: auto 1fr !important;
  align-items: center;
  min-width: 220px;
}
.machine-field-select select {
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  width: 100%;
  cursor: pointer;
}
.machine-field-select select:focus {
  outline: none;
  border-color: var(--caramel);
  box-shadow: 0 0 0 3px rgba(200,150,90,0.18);
}

/* ============================ Калькулятор (ползунковый) ============================ */
.calc-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
  align-items: stretch;
}
.calc-sliders { padding: 18px; }
/* Правая колонка: сводка сверху, блок порций снизу. Растягивается по высоте левой колонки. */
.calc-right-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.calc-right-col .scale-inline {
  flex: 1 1 0;        /* растянуть блок порций, заполняя всё пространство до низа калькулятора */
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.calc-right-col .scale-inline[hidden] { display: none; }  /* скрытие не переопределяется flex */
.calc-right-col .scale-inline .scale-row {
  flex: 1 1 0;        /* внутренний ряд тянется вместе с блоком */
  min-height: 0;
}
.calc-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.calc-head h3 { margin: 0; color: var(--foam); font-size: 19px; }

/* Инлайн-селектор напитка рядом с заголовком калькулятора */
.drink-select-inline {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: var(--espresso);
  /* Кастомная карамельная стрелка справа (SVG) */
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23e0a865' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  border: 1px solid var(--caramel);
  color: var(--foam);
  padding: 8px 32px 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex: 1;
  max-width: 280px;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.drink-select-inline:hover {
  background-color: #7d5840;
  border-color: var(--caramel-bright);
}
.drink-select-inline:focus,
.drink-select-inline:focus-visible {
  outline: none;
  border-color: var(--caramel-bright);
  box-shadow: 0 0 0 3px rgba(200,150,90,0.25);
}
/* Выпадающие опции и заголовки групп — в той же коричневой палитре */
.drink-select-inline option {
  background: var(--bg-2);
  color: var(--text);
}
.drink-select-inline optgroup {
  background: var(--espresso);
  color: var(--caramel-bright);
  font-weight: 700;
}

.calc-desc { color: var(--text-muted); font-size: 13px; margin: 0 0 6px; }

/* Шкала объёма напитка (3 дискретные позиции) */
.volume-scale { padding: 12px 0 4px; border-bottom: 1px solid var(--border); }
.volume-scale[hidden] { display: none; }
.volume-ticks { display: flex; justify-content: space-between; margin-top: 6px; }
.volume-ticks span {
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 6px;
  transition: color .12s, background .12s;
  user-select: none;
}
.volume-ticks span:hover { color: var(--caramel-bright); background: var(--surface); }
.volume-ticks span.active { color: var(--caramel-bright); font-weight: 700; background: var(--surface-2); }
.calc-hint {
  font-size: 12px;
  color: var(--caramel-bright);
  background: rgba(200,150,90,0.10);
  border-left: 3px solid var(--caramel);
  padding: 8px 12px;
  border-radius: 6px;
  margin: 8px 0 14px;
}

.slider-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.slider-row:last-child { border-bottom: none; }
.slider-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.slider-label { font-size: 13.5px; color: var(--text-dim); font-weight: 600; }
.slider-value { font-size: 14px; color: var(--text-muted); }

/* Переключатель единиц (для молочной пены: мл / сек) */
.unit-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-left: auto;
}
.unit-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 4px 12px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s ease;
}
.unit-btn:hover { color: var(--text); background: var(--surface-2); }
.unit-btn.active {
  background: linear-gradient(180deg, var(--caramel-bright), var(--caramel));
  color: #2a1a0c;
}
.slider-value strong {
  color: var(--foam);
  font-size: 20px;
  font-weight: 700;
  margin-right: 2px;
}
.slider-range { font-size: 11px; color: var(--text-muted); margin-top: 6px; }
.slider-row input[type="range"] {
  width: 100%;
  accent-color: var(--caramel);
  height: 6px;
}

.calc-summary { padding: 18px; }
.calc-summary h3 { margin: 0 0 12px; color: var(--crema); font-size: 17px; }
.summary-block { margin-top: 16px; }
.summary-block h4 {
  margin: 0 0 8px;
  font-size: 12.5px;
  color: var(--caramel-bright);
  text-transform: uppercase;
  letter-spacing: .6px;
}
/* Параметры приготовления в сводке — в один столбец, друг под другом */
.summary-block .params {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.summary-block .params .p {
  width: 100%;
  padding: 8px 12px;
}

/* Инлайн-блок масштабирования */
.scale-inline {
  margin-top: 16px;
  padding: 16px;
}
.scale-inline h3 { margin: 0 0 12px; color: var(--crema); font-size: 16px; }
.scale-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.field-inline {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-dim);
  min-width: 140px;
}
.field-inline input {
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  width: 90px;
}
.scale-row .params { flex: 1; min-width: 260px; }

/* ============================ Редактор: строки ингредиентов ============================ */
.editor-section {
  margin: 16px 0 8px;
  font-size: 13px;
  color: var(--caramel-bright);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.ing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr 0.7fr;
  gap: 6px;
}
.ing-grid input {
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  width: 100%;
}
.add-ing { margin-top: 10px; }
.add-ing select {
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin: 0 8px;
}

.params {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  font-size: 13px;
  margin: 6px 0 12px;
}
.params .p {
  display: flex;
  justify-content: space-between;
  padding: 5px 9px;
  background: rgba(0,0,0,0.18);
  border-radius: var(--radius-sm);
}
.params .p span:first-child { color: var(--text-muted); }
.params .p span:last-child { color: var(--text); font-weight: 600; }

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* === Кнопки === */
.btn {
  appearance: none;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  transition: all .15s ease;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn.primary {
  background: linear-gradient(180deg, var(--caramel-bright), var(--caramel));
  border-color: transparent;
  color: #2a1a0c;
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--cherry-bright); border-color: rgba(192,57,43,0.45); }
.btn.danger:hover { background: rgba(192,57,43,0.18); border-color: var(--cherry); }
.btn.small { padding: 6px 10px; font-size: 12.5px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.btn-row.right { justify-content: flex-end; }

/* === Формы === */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-card h3 {
  margin: 0 0 14px;
  font-size: 16px;
  color: var(--crema);
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 13.5px;
  color: var(--text-dim);
}
.field input[type="text"],
.field input[type="number"],
.field input[type="search"],
.field select {
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
}
.field input:focus, .field select:focus, .filter-input:focus {
  outline: none;
  border-color: var(--caramel);
  box-shadow: 0 0 0 3px rgba(200,150,90,0.18);
}
.field input[type="range"] {
  accent-color: var(--caramel);
}
.field strong { color: var(--crema); font-weight: 700; }

.hint { font-size: 12px; color: var(--text-muted); margin: 10px 0 0; }

/* === Результат === */
.result-card { min-height: 240px; }
.result-card .placeholder { color: var(--text-muted); text-align: center; margin-top: 60px; }
.result-block { margin-bottom: 16px; }
.result-block h4 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--caramel-bright);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.result-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}
.stat {
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.stat .v {
  font-size: 20px;
  font-weight: 700;
  color: var(--foam);
  display: block;
}
.stat .k { font-size: 11.5px; color: var(--text-muted); }
.note { font-size: 12.5px; color: var(--text-dim); background: rgba(111,78,55,0.18); border-left: 3px solid var(--caramel); padding: 8px 12px; border-radius: 6px; margin-top: 8px; }

/* === Модальное окно === */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(10,7,4,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.modal[hidden] { display: none; }
.modal-card {
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 20px;
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal-card h3 { margin: 0 0 14px; color: var(--crema); }

/* Приветственный баннер */
.welcome-card { max-width: 560px; }
.welcome-card p { color: var(--text-dim); line-height: 1.55; font-size: 14px; margin: 0 0 14px; }
.welcome-card h4 { margin: 18px 0 8px; color: var(--caramel-bright); font-size: 15px; }
.welcome-steps { margin: 0 0 14px; padding-left: 22px; color: var(--text-dim); line-height: 1.55; font-size: 14px; }
.welcome-steps li { margin-bottom: 6px; }

/* Баннер поддержки (exit-intent) */
.donate-card { max-width: 460px; }
.donate-card h3 { margin: 0 0 14px; }
.donate-card p { color: var(--text-dim); line-height: 1.6; font-size: 14px; margin: 0 0 16px; }
.donate-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
}
.donate-qr a {
  display: block;
  padding: 8px;
  background: #fff;
  border-radius: 10px;
  transition: transform .15s;
}
.donate-qr a:hover { transform: scale(1.04); }
.donate-qr img { display: block; width: 150px; height: 150px; }
.donate-qr span { font-size: 12px; color: var(--text-muted); text-align: center; }
.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.modal-grid .field { margin-bottom: 0; }

/* === Тосты === */
.toasts {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
}
.toast {
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--caramel);
  color: var(--text);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  box-shadow: var(--shadow);
  animation: slidein .25s ease;
  max-width: 320px;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* === Подвал === */
.app-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  padding: 20px;
  border-top: 1px solid var(--border);
}
.footer-contacts { margin: 8px 0 0; }
.footer-contacts a {
  color: var(--caramel-bright);
  text-decoration: none;
  border-bottom: 1px dotted var(--caramel);
  margin: 0 8px;
  transition: color .12s;
}
.footer-contacts a:hover { color: var(--caramel); }

/* Кнопка-ссылка «Поддержать» в баннере доната */
a.btn {
  display: inline-block;
  text-decoration: none;
  color: var(--foam);
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* === Адаптив === */
@media (max-width: 860px) {
  .calc-layout { grid-template-columns: 1fr; }
  .calc-right-col .scale-inline { flex: 0 0 auto; }   /* на мобильных — не растягивать */
  .ing-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .two-col { grid-template-columns: 1fr; }
  .modal-grid { grid-template-columns: 1fr; }
  .brand-text h1 { font-size: 20px; }
  .panel-head { flex-direction: column; align-items: stretch; }
  .machine-field { grid-template-columns: 1fr; }
  .machine-field input[type="range"] { grid-column: 1; }
}
