/* Дневник сигар: тихий журнал на пепельном фоне.
   Один яркий акцент: цвет сигарной ленты. Заголовки и баллы набраны Alegreya, интерфейс Golos Text. */
:root {
  --font-serif: "Alegreya", Georgia, "Times New Roman", serif;
  --font-sans: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bg: #E3E5DF;
  --paper: #F3F4EF;
  --ink: #1B1D19;
  --muted: #5B6058;
  --line: #C9CCC3;
  --accent: #8A2B2B;
  --on-accent: #FFFFFF;
  --accent-soft: #EBD9D5;
  --leaf: #8C5A2B;
  --ok: #2F6B45;
  --danger: #A12B24;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151714;
    --paper: #1E211C;
    --ink: #E6E7E0;
    --muted: #A0A59A;
    --line: #33372F;
    --accent: #E58B7B;
    --on-accent: #1A0F0C;
    --accent-soft: #3B2420;
    --leaf: #C8935A;
    --ok: #7FCB93;
    --danger: #FF9188;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--font-sans);
  padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
  -webkit-text-size-adjust: 100%;
}
body.wiz { padding-bottom: 40px; }
body.lock { overflow: hidden; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { max-width: 100%; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* Каркас */
.top { border-bottom: 1px solid var(--line); background: var(--bg); padding-top: env(safe-area-inset-top, 0px); }
.top-in { max-width: 720px; margin: 0 auto; padding: 14px 16px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { font: 700 1.5rem/1.1 var(--font-serif); text-decoration: none; }
.proto { font-size: .8rem; color: var(--muted); }
.wrap { max-width: 720px; margin: 0 auto; padding: 24px 16px 0; display: block; min-width: 0; }
.h1 { font: 700 2.1rem/1.1 var(--font-serif); margin-bottom: 16px; text-wrap: balance; }
.h2 { font: 700 1.4rem/1.2 var(--font-serif); margin: 28px 0 10px; text-wrap: balance; }
.lead { color: var(--muted); max-width: 60ch; margin-bottom: 18px; }
.muted { color: var(--muted); }
.hint { font-size: .85rem; color: var(--muted); }

.tabs { position: fixed; inset-inline: 0; bottom: 0; z-index: 5; display: flex; background: var(--paper); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
.tabs a { flex: 1; min-width: 0; text-align: center; padding: 14px 2px; font-size: .84rem; text-decoration: none; font-weight: 500; color: var(--muted); border-top: 3px solid transparent; margin-top: -1px; }
.tabs a[aria-current="page"] { color: var(--ink); border-top-color: var(--accent); }
body.wiz .tabs, body.wiz .fab, body.sub .fab { display: none; }
.fab { position: fixed; right: 16px; bottom: calc(68px + env(safe-area-inset-bottom, 0px)); z-index: 6; background: var(--accent); color: var(--on-accent); text-decoration: none; font-weight: 600; padding: 13px 20px; border-radius: 999px; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); }

/* Кнопки и поля */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 20px; border-radius: var(--radius); border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent); font-weight: 600; cursor: pointer; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.sm { min-height: 38px; padding: 0 14px; font-size: .9rem; }
.link { background: none; border: 0; padding: 6px 0; color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.field { width: 100%; min-height: 46px; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--paper); font-size: 16px; }
textarea.field { resize: vertical; min-height: 84px; }
.field.narrow { max-width: 260px; }
.lbl { display: block; margin: 18px 0 6px; font-weight: 600; font-size: .92rem; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 8px; }
.check input { margin-top: 5px; width: 18px; height: 18px; accent-color: var(--accent); }
.err { color: var(--danger); font-weight: 500; min-height: 1.5em; margin-top: 12px; }
.stack { display: grid; gap: 10px; max-width: 360px; }
.filebtn { cursor: pointer; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; font-size: .95rem; }
.chip.on, .chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chips.sm .chip { min-height: 34px; padding: 0 12px; font-size: .88rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--paper); }
.seg button { min-width: 44px; min-height: 44px; padding: 0 12px; border: 0; border-right: 1px solid var(--line); background: transparent; cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); font-weight: 600; }

/* Сводные числа */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat { min-width: 0; }
.stat b { display: block; font: 700 1.7rem/1.1 var(--font-serif); overflow-wrap: anywhere; }
.stat span { font-size: .8rem; color: var(--muted); line-height: 1.3; display: block; margin-top: 2px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.toolbar .field { flex: 1 1 200px; }

/* Хьюмидор */
.list { display: block; }
.hrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 14px; padding: 18px 0; border-top: 1px solid var(--line); }
.hrow.empty .hr-main { opacity: .55; }
.hr-name { font: 700 1.25rem/1.2 var(--font-serif); overflow-wrap: anywhere; }
.hr-name span { font-weight: 500; }
.hr-sub { color: var(--muted); font-size: .9rem; }
.hr-meta { font-size: .9rem; margin-top: 4px; }
.hr-note { font-size: .9rem; color: var(--muted); margin-top: 4px; font-style: italic; }
.qty { text-align: right; }
.qty b { display: block; font: 700 1.9rem/1 var(--font-serif); }
.qty span { font-size: .8rem; color: var(--muted); }
.hr-acts { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.delta { font-weight: 600; font-size: .85rem; color: var(--muted); }
.delta.up { color: var(--ok); }
.delta.down { color: var(--danger); }

/* История */
.trow { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; padding: 18px 0; border-top: 1px solid var(--line); text-decoration: none; }
.t-score b { display: block; font: 700 2.3rem/1 var(--font-serif); color: var(--accent); }
.t-score span { font-size: .75rem; color: var(--muted); }
.t-main h3 { font: 700 1.2rem/1.2 var(--font-serif); overflow-wrap: anywhere; }
.t-sub { font-size: .88rem; color: var(--muted); margin-top: 2px; }
.t-note { font-size: .92rem; margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tag { display: inline-block; font-size: .78rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }

/* Дегустация */
.back { display: inline-block; margin-bottom: 14px; font-weight: 600; color: var(--accent); text-underline-offset: 3px; }
.d-score { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 18px; align-items: center; margin: 14px 0 6px; }
.d-score .big { font: 700 4.4rem/1 var(--font-serif); color: var(--accent); grid-row: 1 / 3; }
.d-score p { font-size: .95rem; }
.sec { margin-top: 30px; }
.kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; margin: 0; }
.kv div { display: contents; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; text-align: right; }
.rose-box { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 12px 16px; margin-top: 10px; }
.rose { display: block; width: 100%; max-width: 420px; margin: 4px auto 0; height: auto; }
.rg { fill: none; stroke: var(--line); stroke-width: 1; }
.rs { fill: var(--leaf); fill-opacity: .85; stroke: var(--leaf); stroke-width: 1; }
.rl { font: 500 10.5px var(--font-sans); fill: var(--muted); }
.alist { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.alist li { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; }
.pill { font-size: .78rem; color: var(--muted); }
.quote { margin-top: 10px; font: italic 500 1.1rem/1.4 var(--font-serif); }
.notes p { margin-top: 8px; }
.reveal { background: var(--accent-soft); border-radius: var(--radius); padding: 16px; margin-top: 18px; display: grid; gap: 10px; }

/* Мастер дегустации */
.wiz-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.prog { height: 4px; background: var(--line); border-radius: 2px; margin-bottom: 20px; overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--accent); }
.wnav { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; }
.picked { display: grid; gap: 12px; margin-top: 16px; }
.pcard { border: 1px solid var(--line); background: var(--paper); border-radius: var(--radius); padding: 12px; display: grid; gap: 10px; }
.pcard b { font: 700 1.1rem var(--font-serif); }
.introw { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.introw > span { font-size: .85rem; color: var(--muted); }
.rrow { margin-top: 20px; }
.rrow .q-h { display: grid; gap: 2px; margin-bottom: 8px; }
.base { display: flex; align-items: baseline; gap: 14px; margin-bottom: 6px; }
.base output { font: 700 3.4rem/1 var(--font-serif); color: var(--accent); }
.base span { font-weight: 600; }
input[type="range"] { width: 100%; accent-color: var(--accent); min-height: 36px; }
.bands { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 2px; font-size: .88rem; color: var(--muted); }
.sumbox { margin-top: 20px; padding: 14px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.sumbox .total { font: 700 1.7rem/1.2 var(--font-serif); margin-top: 4px; }
.sumbox .total b { color: var(--accent); }

/* Данные */
.code { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; overflow-x: auto; font: 400 .8rem/1.5 ui-monospace, Menlo, Consolas, monospace; max-height: 340px; }
details summary { cursor: pointer; font-weight: 600; margin: 10px 0; }

/* Окно */
.modal { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .5); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 16px 16px 0 0; padding: 20px 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
.sheet .h2 { margin-top: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.sheet .acts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

@media (min-width: 720px) {
  .modal { align-items: center; }
  .sheet { border-radius: 16px; }
  .h1 { font-size: 2.5rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .prog i { transition: width .2s ease; }
}

/* Фото и каталог */
.hr-flex { display: flex; gap: 14px; align-items: flex-start; }
.hr-text, .cr-text { min-width: 0; flex: 1; }
.thumb { position: relative; flex: 0 0 84px; width: 84px; height: 56px; border-radius: 8px; background: var(--accent-soft); border: 1px solid var(--line); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.thumb span { font: 700 1.5rem/1 var(--font-serif); color: var(--accent); }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.crow { display: flex; gap: 14px; padding: 16px 0; border-top: 1px solid var(--line); }
#clist, #id-list { margin-top: 6px; }

/* Скан */
.demo-note { border: 1px dashed var(--accent); border-radius: var(--radius); padding: 12px 14px; background: var(--accent-soft); font-size: .9rem; margin: 0 0 18px; max-width: 70ch; }
.pick-grid { display: grid; gap: 12px; grid-template-columns: 1fr; margin-bottom: 22px; }
.pick { display: block; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--paper); text-decoration: none; color: inherit; }
.pick:hover { border-color: var(--accent); }
.pick b { display: block; font: 700 1.3rem/1.2 var(--font-serif); margin-bottom: 4px; }
.preview { display: block; max-width: 100%; max-height: 260px; border-radius: var(--radius); border: 1px solid var(--line); margin: 0 0 14px; }
.file-btn { position: relative; cursor: pointer; }
.file-btn input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.file-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.acts { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.rline { border-top: 1px solid var(--line); padding: 14px 0; }
.rline.skip .raw { opacity: .6; }
.rline .raw { font-size: .9rem; color: var(--muted); overflow-wrap: anywhere; }
.conf { font-size: .85rem; font-weight: 600; }
.conf.hi, .sumok { color: var(--ok); }
.conf.lo, .sumbad { color: var(--danger); }
@media (min-width: 720px) { .pick-grid { grid-template-columns: 1fr 1fr; } }

/* Версия 3: упаковки и карточка сигары */
.mini { list-style: none; margin: 8px 0 0; padding: 0; font-size: .9rem; color: var(--muted); }
.mini li { padding: 2px 0; }
.mini a { color: var(--accent); }
.bar { height: 10px; border-radius: 999px; background: var(--accent-soft); overflow: hidden; margin: 10px 0 6px; }
.bar i { display: block; height: 100%; background: var(--accent); }
.pline { border-top: 1px solid var(--line); padding: 8px 0 14px; }
.pline-row { display: flex; gap: 14px; padding: 16px 0; border-top: 1px solid var(--line); }
.pline-row .hr-acts { grid-column: auto; margin-top: 10px; align-items: center; }
.field.sm { min-height: 38px; width: auto; padding: 4px 10px; font-size: .9rem; }
.calc { margin: 18px 0 6px; padding: 12px 14px; border-radius: var(--radius); background: var(--paper); border: 1px solid var(--line); font-size: .95rem; }
.cardhead { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.thumb.big { flex: 0 0 160px; width: 160px; height: 106px; }
.thumb.big span { font-size: 2.4rem; }
.soft { font-weight: 500; }
.h3 { font: 700 1.15rem/1.2 var(--font-serif); margin: 22px 0 8px; }
.plain { color: inherit; text-decoration: none; }
.plain:hover { text-decoration: underline; }
.spark { width: 100%; max-width: 420px; height: auto; display: block; }
.spark .sl { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.spark .sd { fill: var(--paper); stroke: var(--accent); stroke-width: 2; }
.spark .rg { stroke: var(--line); stroke-dasharray: 3 4; }

.stat b { font-size: 1.45rem; }

/* Этап 1 на Яндекс Облаке */
body.gate .tabs, body.gate .fab { display: none; }
.tabs a[hidden] { display: none; }
.urow { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 0; border-top: 1px solid var(--line); }
.urow .hint { display: block; }
