/* ============================================
   TeaTimer — Design System & Styles
   ============================================ */

/* CSS Variables — Light (default) */
/* ============================================
   Design tokens — «Рисовая бумага и нефрит»
   ============================================ */
:root {
  --bg-primary: #F3EDE0;
  --btn-text-color: #FBF8F0;
  --bg-secondary: #EAE2D0;
  --bg-card: #FBF7EE;
  --bg-input: #EAE2D0;
  --text-primary: #211A10;
  --text-secondary: #5A4E39;
  --text-tertiary: #857860;
  --text-muted: #AFA286;
  --border-light: #E7DECB;
  --border-medium: #DDD2BA;
  --border-strong: #CFC3A7;
  --accent-green: #2F6F52;
  --accent-green-hover: #285E45;
  --accent-amber: #B9741A;
  --accent-amber-light: #E3A84A;
  --accent-red: #B2452A;
  --accent-red-hover: #923620;
  --timer-bg: #F3EDE0;
  --nav-active-bg: #EAE2D0;
  --nav-inactive: #A3957A;
  --shadow: rgba(70,48,16,.14);
  --chart-bar: #D3C7A8;
  --chart-bar-active: #B9741A;

  --surface-hi: #FFFDF8;
  --surface-lo: #F6EFE0;
  --glow: rgba(255,247,226,.95);
  --grain-opacity: .06;
  --sh-raised: inset 0 1px 0 rgba(255,255,255,.85), inset 0 -1px 0 rgba(120,90,40,.07), 0 1px 2px rgba(70,48,16,.10), 0 12px 26px -16px rgba(70,48,16,.38);
  --sh-inset: inset 0 2px 5px rgba(70,48,16,.15), inset 0 -1px 0 rgba(255,255,255,.75);
  --jade-hi: #418D6B;
  --jade-lo: #285F46;
  --sh-jade: inset 0 1px 0 rgba(255,255,255,.30), inset 0 -2px 0 rgba(0,0,0,.16), 0 1px 2px rgba(20,60,40,.40), 0 14px 26px -12px rgba(34,88,62,.70);
}

[data-theme="dark"] {
  --bg-primary: #14100A;
  --bg-secondary: #0E0B07;
  --bg-card: #1E1810;
  --bg-input: #0E0B07;
  --text-primary: #F2E9D6;
  --text-secondary: #CBBE9F;
  --text-tertiary: #9A8E72;
  --text-muted: #6F6450;
  --border-light: #2A2217;
  --border-medium: #342B1D;
  --border-strong: #43392A;
  --accent-green: #3F9170;
  --accent-green-hover: #357F61;
  --accent-amber: #EDB452;
  --accent-amber-light: #F6D083;
  --accent-red: #E8805A;
  --accent-red-hover: #CF6F4B;
  --timer-bg: #100D08;
  --nav-active-bg: #0E0B07;
  --nav-inactive: #7C7058;
  --shadow: rgba(0,0,0,.5);
  --chart-bar: #5C523D;
  --chart-bar-active: #EDB452;

  --surface-hi: #281F15;
  --surface-lo: #1B150E;
  --glow: rgba(120,84,32,.22);
  --grain-opacity: .09;
  --sh-raised: inset 0 1px 0 rgba(255,236,200,.08), inset 0 -1px 0 rgba(0,0,0,.35), 0 1px 2px rgba(0,0,0,.55), 0 16px 30px -18px rgba(0,0,0,.9);
  --sh-inset: inset 0 2px 6px rgba(0,0,0,.6), inset 0 -1px 0 rgba(255,236,200,.05);
  --jade-hi: #4BA17E;
  --jade-lo: #2E7457;
  --sh-jade: inset 0 1px 0 rgba(255,255,255,.22), inset 0 -2px 0 rgba(0,0,0,.28), 0 1px 2px rgba(0,0,0,.6), 0 14px 28px -12px rgba(63,145,112,.55);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --btn-text-color: #F2E9D6;
    --bg-primary: #14100A;
    --bg-secondary: #0E0B07;
    --bg-card: #1E1810;
    --bg-input: #0E0B07;
    --text-primary: #F2E9D6;
    --text-secondary: #CBBE9F;
    --text-tertiary: #9A8E72;
    --text-muted: #6F6450;
    --border-light: #2A2217;
    --border-medium: #342B1D;
    --border-strong: #43392A;
    --accent-green: #3F9170;
    --accent-green-hover: #357F61;
    --accent-amber: #EDB452;
    --accent-amber-light: #F6D083;
    --accent-red: #E8805A;
    --accent-red-hover: #CF6F4B;
    --timer-bg: #100D08;
    --nav-active-bg: #0E0B07;
    --nav-inactive: #7C7058;
    --shadow: rgba(0,0,0,.5);
    --chart-bar: #5C523D;
    --chart-bar-active: #EDB452;

    --surface-hi: #281F15;
    --surface-lo: #1B150E;
    --glow: rgba(120,84,32,.22);
    --grain-opacity: .09;
    --sh-raised: inset 0 1px 0 rgba(255,236,200,.08), inset 0 -1px 0 rgba(0,0,0,.35), 0 1px 2px rgba(0,0,0,.55), 0 16px 30px -18px rgba(0,0,0,.9);
    --sh-inset: inset 0 2px 6px rgba(0,0,0,.6), inset 0 -1px 0 rgba(255,236,200,.05);
    --jade-hi: #4BA17E;
    --jade-lo: #2E7457;
    --sh-jade: inset 0 1px 0 rgba(255,255,255,.22), inset 0 -2px 0 rgba(0,0,0,.28), 0 1px 2px rgba(0,0,0,.6), 0 14px 28px -12px rgba(63,145,112,.55);
  }
}

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

html, body {
  height: 100%;
  font-family: 'Karla', 'Helvetica Neue', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ============================================
   Typography
   ============================================ */
.font-display {
  font-family: 'Cormorant Garamond', Georgia, serif;
}

/* ============================================
   Animations
   ============================================ */

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

/* ============================================
   Screen Container
   ============================================ */
.screen {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: none;
  animation: fadeIn 0.3s ease-out;
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}

.screen.active {
  display: block;
}

.screen-content {
  max-width: 430px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* ============================================
   Header / Section Headers
   ============================================ */

.overline {
  font-family: 'Karla', sans-serif;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  display: block;
  margin-bottom: 6px;
}

/* ============================================
   Buttons
   ============================================ */
.btn-primary {
  border: none;
  border-radius: 28px;
  background: var(--accent-green);
  color: var(--btn-text-color);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 600;
  font-size: 28px;
  line-height: 1;
  padding: 20px 32px;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s;
  text-align: center;
}

.btn-primary:hover,
.btn-primary:active {
  background: var(--accent-green-hover);
}

.btn-secondary {
  border: 1px solid var(--border-strong);
  border-radius: 26px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: 'Karla', sans-serif;
  font-weight: 600;
  font-size: 14px;
  line-height: 1;
  padding: 16px 24px;
  cursor: pointer;
  transition: border-color 0.2s;
  text-align: center;
}

.btn-secondary:hover,
.btn-secondary:active {
  border-color: var(--text-muted);
}

.btn-dashed {
  border: 1px dashed var(--text-muted);
  background: transparent;
  color: var(--text-secondary);
}

.btn-dashed:hover,
.btn-dashed:active {
  border-color: var(--accent-green);
  color: var(--accent-green);
}

.btn-icon {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--accent-amber);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 500;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover,
.btn-icon:active {
  border-color: var(--accent-amber);
}

/* ============================================
   Cards & Lists
   ============================================ */

.list-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: opacity 0.15s;
}

.list-row:last-child {
  border-bottom: none;
}

.list-row:active {
  opacity: 0.7;
}

.list-row .row-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.list-row .row-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 500;
  font-size: 19px;
  line-height: 1.2;
  color: var(--text-primary);
}

.list-row .row-meta {
  font-family: 'Karla', sans-serif;
  font-weight: 400;
  font-size: 13px;
  line-height: 1;
  color: var(--text-tertiary);
}

.list-row .row-badge {
  font-family: 'Karla', sans-serif;
  font-weight: 500;
  font-size: 13px;
  color: var(--accent-amber);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ============================================
   Chips & Tags
   ============================================ */
.chip {
  padding: 8px 14px;
  border-radius: 99px;
  font-family: 'Karla', sans-serif;
  font-weight: 500;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.chip-active {
  background: var(--accent-green);
  color: var(--bg-primary);
  font-weight: 600;
}

.chip-inactive {
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  background: transparent;
}

.chip-inactive:hover {
  border-color: var(--text-muted);
}

.tag {
  padding: 7px 12px;
  border-radius: 99px;
  background: var(--bg-secondary);
  font-family: 'Karla', sans-serif;
  font-weight: 500;
  font-size: 13px;
  color: var(--text-secondary);
}

/* ============================================
   Segmented Control
   ============================================ */
.segmented {
  display: flex;
  gap: 0;
  padding: 5px;
  background: var(--bg-secondary);
  border-radius: 16px;
}

.segmented .segment {
  flex: 1;
  text-align: center;
  padding: 13px 0;
  border-radius: 12px;
  font-family: 'Karla', sans-serif;
  font-weight: 500;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text-secondary);
  border: none;
  background: transparent;
}

.segmented .segment.active {
  background: var(--accent-green);
  color: var(--bg-primary);
  font-weight: 600;
}

/* ============================================
   Toggle Switch
   ============================================ */
.toggle {
  width: 50px;
  height: 30px;
  border-radius: 99px;
  background: var(--border-strong);
  display: flex;
  align-items: center;
  padding: 0 4px;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle.on {
  background: var(--accent-green);
  justify-content: flex-end;
}

.toggle .knob {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-card);
  transition: transform 0.2s;
}

/* ============================================
   Search Input
   ============================================ */
.search-box {
  height: 52px;
  border-radius: 16px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 10px;
}

.search-box input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: 'Karla', sans-serif;
  font-size: 16px;
  color: var(--text-primary);
  outline: none;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

/* ============================================
   Slider / Stepper
   ============================================ */
.slider-track {
  width: calc(100% - 30px);
  margin: 0 15px;
  height: 4px;
  background: var(--border-medium);
  border-radius: 99px;
  position: relative;
}

.slider-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 4px;
  background: var(--accent-green);
  border-radius: 99px;
}

.slider-thumb {
  position: absolute;
  top: -13px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1.5px solid var(--accent-green);
  cursor: pointer;
}

/* ============================================
   Stat Tiles
   ============================================ */

/* ============================================
   Info Grid (Tea Detail)
   ============================================ */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border-medium);
  border: 1px solid var(--border-medium);
  border-radius: 18px;
  overflow: hidden;
}

.info-cell {
  background: var(--bg-card);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-cell .label {
  font-family: 'Karla', sans-serif;
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.info-cell .value {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 500;
  font-size: 22px;
  line-height: 1;
  color: var(--text-primary);
  white-space: nowrap;
}

/* ============================================
   Timer Screen — «Сосуд»
   Жидкость поднимается по мере настаивания, волны
   рисуются маской, а цифры меняют цвет там, где их
   накрывает настой (две копии текста).
   ============================================ */
.timer-screen {
  --acc: #C8801C;            /* цвет сорта (ставит JS) */
  --acc-rgb: 200, 128, 28;
  --acc-deep: #9A5F10;       /* тёмный тон сорта */
  --acc-lite: #E8B64C;       /* светлый тон сорта для тёмной темы */
  --acc-ui: var(--ui-deep, var(--acc-deep)); /* цвет тиков/точек по теме */
  --on-liquid: #1E1B15;      /* цвет цифр поверх настоя */
  --p: 0;                    /* уровень жидкости 0..1 */
  --energy: .35;             /* «кипение»: 0.35 → 1 */
  --wave-h: 18px;
  --gw: min(88vw, 340px);
  --bh: calc(var(--gw) * .425);

  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  flex-direction: column;
  background: var(--timer-bg);
  overflow: hidden;
  padding-top: env(safe-area-inset-top);
}
.timer-screen.active { display: flex; animation: t-in .45s cubic-bezier(.2,.8,.2,1) both; }

.t-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(90% 55% at 50% 36%, rgba(var(--acc-rgb), calc(.10 + var(--energy) * .16)), transparent 72%),
    radial-gradient(70% 40% at 50% 100%, rgba(var(--acc-rgb), .10), transparent 70%);
  transition: background .6s;
}
.timer-screen.is-done .t-bg {
  background:
    radial-gradient(90% 55% at 50% 36%, rgba(47, 111, 82, .26), transparent 72%),
    radial-gradient(70% 40% at 50% 100%, rgba(47, 111, 82, .14), transparent 70%);
}

/* ---- Header ---- */
.t-header {
  position: relative;
  padding: 20px 26px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.t-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  transition: color .4s;
}
.t-status::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--acc-ui);
  box-shadow: 0 0 0 0 rgba(var(--acc-rgb), .5);
  animation: t-blink 2s ease-out infinite;
}
.timer-screen.is-done .t-status { color: var(--accent-green); }
.timer-screen.is-done .t-status::before { background: var(--accent-green); box-shadow: 0 0 0 0 rgba(47,111,82,.5); }
.t-clock {
  font-weight: 500;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text-tertiary);
}

/* ---- Body ---- */
.t-body {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2.2svh, 22px);
  padding: 0 24px;
}

[data-theme="dark"] .timer-screen { --acc-ui: var(--ui-lite, var(--acc-lite)); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .timer-screen { --acc-ui: var(--ui-lite, var(--acc-lite)); }
}

/* Волны: маска = форма гребня + тело. --wx двигает JS. */
.liquid {
  --tile: 150px;
  --wave-svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 150 22' preserveAspectRatio='none'%3E%3Cpath d='M0 12 C25 2 50 2 75 12 S125 22 150 12 V22 H0Z' fill='%23000'/%3E%3C/svg%3E");
  position: absolute;
  left: 0; top: 0;
  width: 100%;
  height: calc(100% + var(--wave-h));
  transform: translate3d(0, calc(var(--bh) - var(--p) * (var(--bh) + var(--wave-h))), 0);
  background: linear-gradient(180deg, var(--acc) 0%, var(--acc-deep) 100%);
  -webkit-mask-image: var(--wave-svg), linear-gradient(#000, #000);
          mask-image: var(--wave-svg), linear-gradient(#000, #000);
  -webkit-mask-repeat: repeat-x, no-repeat;
          mask-repeat: repeat-x, no-repeat;
  -webkit-mask-size: var(--tile) var(--wave-h), 100% calc(100% - var(--wave-h) + 1px);
          mask-size: var(--tile) var(--wave-h), 100% calc(100% - var(--wave-h) + 1px);
  -webkit-mask-position: var(--wx, 0px) 0, 0 calc(var(--wave-h) - 1px);
          mask-position: var(--wx, 0px) 0, 0 calc(var(--wave-h) - 1px);
  will-change: transform;
}
.liquid.back {
  --tile: 210px;
  opacity: .5;
  filter: saturate(1.15);
  margin-top: -7px;
}
.liquid.front { opacity: .94; z-index: 2; }

/* Пузырьки внутри настоя */
.bubbles {
  position: absolute;
  inset: var(--wave-h) 0 0 0;
  opacity: calc(.25 + var(--energy) * .75);
  overflow: hidden;
}
.bubbles i {
  position: absolute;
  bottom: -12px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,.4);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.35);
  animation: t-bubble 6s ease-in infinite;
}
.bubbles i:nth-child(1) { left: 18%; animation-delay: .2s; }
.bubbles i:nth-child(2) { left: 34%; width: 5px; height: 5px; animation-delay: 2.1s; animation-duration: 5s; }
.bubbles i:nth-child(3) { left: 52%; width: 9px; height: 9px; animation-delay: 3.4s; animation-duration: 7s; }
.bubbles i:nth-child(4) { left: 68%; width: 5px; height: 5px; animation-delay: 1.1s; animation-duration: 5.5s; }
.bubbles i:nth-child(5) { left: 80%; animation-delay: 4.2s; animation-duration: 6.5s; }
.bubbles i:nth-child(6) { left: 44%; width: 4px; height: 4px; animation-delay: 5s; animation-duration: 4.6s; }

/* Цифры: базовая копия + копия поверх настоя */
.vessel-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 4px;
  color: var(--text-primary);
  z-index: 1;
}
.vessel-text.inv {
  /* лежит внутри .liquid.front и компенсирует его смещение,
     поэтому стоит на месте, а видна только там, где есть настой */
  width: 100%;
  height: var(--bh);
  inset: auto;
  left: 0;
  top: calc(var(--p) * (var(--bh) + var(--wave-h)) - var(--bh));
  color: var(--on-liquid);
  z-index: 2;
}
.t-count {
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  opacity: .72;
}
.t-time {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 500;
  font-size: calc(var(--size) * .30);
  line-height: .95;
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: -.03em;
}
.timer-screen.is-done .t-time { animation: t-pop .5s cubic-bezier(.2,1.4,.4,1) both; }

/* Точки-проливы */
.t-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  max-width: 300px;
}
.t-dots i {
  width: 8px; height: 8px;
  border-radius: 99px;
  background: var(--border-strong);
  transition: width .4s cubic-bezier(.2,.8,.2,1), background .3s;
}
.t-dots i.done { background: var(--acc-ui); opacity: .55; }
.t-dots i.skip { background: transparent; box-shadow: inset 0 0 0 1.5px var(--text-muted); }
.t-dots i.cur  { width: 26px; background: var(--acc-ui); }
.timer-screen.is-done .t-dots i.cur { background: var(--accent-green); }

/* Информация о чае */
.t-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}
.t-name {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 500;
  font-size: 28px;
  line-height: 1.1;
  color: var(--text-primary);
}
.t-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.t-meta span {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  padding: 7px 11px;
  border-radius: 99px;
  color: var(--text-secondary);
  background: rgba(var(--acc-rgb), .12);
  box-shadow: inset 0 0 0 1px rgba(var(--acc-rgb), .22);
  font-variant-numeric: tabular-nums;
}
.t-meta span.cn { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 15px; font-weight: 600; padding: 5px 11px; }

/* ---- Actions ---- */
.t-actions {
  position: relative;
  padding: 0 22px calc(20px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2;
}
.btn-pour {
  position: relative;
  border: none;
  height: 76px;
  border-radius: 38px;
  background: var(--text-primary);
  color: var(--bg-primary);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 600;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 14px 30px -14px rgba(30,27,21,.55);
  transition: background .35s, transform .15s, box-shadow .35s;
}
.btn-pour:active { transform: scale(.975); }
.timer-screen.is-done .btn-pour {
  background: var(--accent-green);
  color: #FDF8EB;
  box-shadow: 0 14px 34px -12px rgba(47,111,82,.7);
  animation: t-cta 1.8s ease-in-out infinite;
}
.btn-pour::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.22) 50%, transparent 65%);
  transform: translateX(-120%);
}
.timer-screen.is-done .btn-pour::after { animation: t-sheen 2.8s ease-in-out infinite; }
.t-row { display: flex; gap: 10px; }
.t-btn {
  flex: 1;
  height: 48px;
  border-radius: 24px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-secondary);
  font-family: 'Karla', sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .02em;
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .15s;
}
.t-btn:active { transform: scale(.97); background: var(--bg-secondary); }
.t-btn.danger { color: var(--accent-red); border-color: rgba(176,67,31,.35); }

/* ---- Keyframes (таймер) ---- */
@keyframes t-in      { from { opacity: 0; transform: scale(1.015); } to { opacity: 1; transform: none; } }
@keyframes t-blink   { 0% { box-shadow: 0 0 0 0 rgba(var(--acc-rgb), .55); } 70%,100% { box-shadow: 0 0 0 9px rgba(var(--acc-rgb), 0); } }
@keyframes t-wisp {
  0%   { stroke-dashoffset: 46; opacity: 0; transform: translateY(8px); }
  25%  { opacity: .75; }
  55%  { stroke-dashoffset: 0; opacity: .6; transform: translateY(-4px); }
  100% { stroke-dashoffset: -46; opacity: 0; transform: translateY(-14px); }
}
@keyframes t-bubble {
  0%   { transform: translateY(0) scale(.6); opacity: 0; }
  15%  { opacity: 1; }
  100% { transform: translateY(calc(var(--bh) * -.8)) scale(1.1); opacity: 0; }
}
@keyframes t-pop     { 0% { transform: scale(.9); } 100% { transform: scale(1); } }
@keyframes t-cta     { 0%,100% { transform: scale(1); } 50% { transform: scale(1.018); } }
@keyframes t-sheen   { 0% { transform: translateX(-120%); } 55%,100% { transform: translateX(120%); } }

@media (prefers-reduced-motion: reduce) {
  .t-steam i, .bubbles i, .t-status::before,
  .timer-screen.is-done .btn-pour, .timer-screen.is-done .btn-pour::after { animation: none !important; }
  .timer-screen.active { animation: none; }
}


/* ============================================
   Bottom Navigation
   ============================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-medium);
  padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  z-index: 50;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 6px 14px 4px;
  border-radius: 14px;
  min-width: 64px;
  cursor: pointer;
  transition: background 0.15s;
  border: none;
  background: transparent;
}

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

.nav-item .icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-item .icon svg {
  stroke: var(--nav-inactive);
  stroke-width: 1.5;
  fill: none;
}

.nav-item.active .icon svg {
  stroke: var(--accent-green);
}

.nav-item .label {
  font-family: 'Karla', sans-serif;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--nav-inactive);
}

.nav-item.active .label {
  font-weight: 600;
  color: var(--text-primary);
}

/* ============================================
   Custom Scenario
   ============================================ */
.scenario-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--bg-secondary);
}

.scenario-row .idx {
  width: 20px;
  font-family: 'Karla', sans-serif;
  font-weight: 500;
  font-size: 14px;
  color: var(--text-tertiary);
}

.scenario-row .bar-bg {
  flex: 1;
  height: 6px;
  border-radius: 99px;
  background: var(--border-medium);
  overflow: hidden;
}

.scenario-row .bar-fill {
  display: block;
  height: 6px;
  border-radius: 99px;
  background: var(--accent-amber);
  transition: width 0.3s;
}

.scenario-row .sec {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 500;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  min-width: 48px;
  text-align: right;
  background: transparent;
  border: none;
  color: var(--text-primary);
  outline: none;
}

.scenario-row .unit {
  font-family: 'Karla', sans-serif;
  font-weight: 500;
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ============================================
   History
   ============================================ */

/* ============================================
   Settings
   ============================================ */
.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}

.settings-row .label {
  font-family: 'Karla', sans-serif;
  font-weight: 400;
  font-size: 18px;
  line-height: 1.2;
  color: var(--text-primary);
}

.settings-row .sublabel {
  font-family: 'Karla', sans-serif;
  font-weight: 400;
  font-size: 13px;
  line-height: 1.3;
  color: var(--text-tertiary);
}

/* ============================================
   Home Screen Specific
   ============================================ */
.hero-btn {
  width: 100%;
  border: none;
  height: 120px;
  border-radius: 28px;
  background: var(--accent-green);
  color: var(--btn-text-color);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  padding: 0 26px;
  cursor: pointer;
  transition: background 0.2s;
  margin-bottom: 8px;
}

.hero-btn:hover,
.hero-btn:active {
  background: var(--accent-green-hover);
}

.hero-btn .title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 600;
  font-size: 32px;
  line-height: 1;
}

.hero-btn .subtitle {
  font-family: 'Karla', sans-serif;
  font-weight: 500;
  font-size: 14px;
  line-height: 1;
  opacity: 0.75;
}

.tea-card-mini {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--border-medium);
  cursor: pointer;
  transition: border-color 0.15s;
}

.tea-card-mini:active {
  opacity: 0.7;
}

.tea-card-mini .info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tea-card-mini .info .name {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 500;
  font-size: 18px;
  line-height: 1.2;
  color: var(--text-primary);
}

.tea-card-mini .info .meta {
  font-family: 'Karla', sans-serif;
  font-weight: 400;
  font-size: 13px;
  color: var(--text-tertiary);
}

.tea-card-mini .count {
  font-family: 'Karla', sans-serif;
  font-weight: 500;
  font-size: 13px;
  color: var(--accent-amber);
  white-space: nowrap;
}

.stats-banner {
  padding: 16px 18px;
  border-radius: 20px;
  background: var(--bg-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.stats-banner .text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stats-banner .text .title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 500;
  font-size: 20px;
  line-height: 1.1;
  color: var(--text-primary);
}

.stats-banner .text .subtitle {
  font-family: 'Karla', sans-serif;
  font-weight: 400;
  font-size: 13px;
  color: var(--text-tertiary);
}

.stats-banner .arrow {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 500;
  font-size: 22px;
  color: var(--accent-amber);
}

/* ============================================
   Tea Detail Hero
   ============================================ */
.tea-hero {
  height: 160px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 22px 26px;
  border-radius: 0 0 20px 20px;
  margin: -24px -20px 0;
  width: calc(100% + 40px);
}

.tea-hero .label {
  position: absolute;
  left: 26px;
  top: 22px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.tea-hero .cn-name {
  position: relative;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 500;
  font-size: 48px;
  line-height: 1;
  color: var(--text-primary);
  opacity: 0.9;
}

/* ============================================
   Scenario Chips
   ============================================ */
.scenario-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.scenario-chip {
  padding: 9px 0;
  width: 52px;
  text-align: center;
  border-radius: 12px;
  background: var(--bg-secondary);
  font-family: 'Karla', sans-serif;
  font-weight: 500;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

/* ============================================
   Misc
   ============================================ */
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-16 { margin-bottom: 16px; }

.flex { display: flex; }

.hidden { display: none !important; }

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 99px;
}

/* Prevent text selection on UI elements */
button, .nav-item, .chip, .list-row, .tea-card-mini {
  user-select: none;
  -webkit-user-select: none;
}

/* Focus styles */
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent-green);
  outline-offset: 2px;
}

/* ============================================
   Phase 2: Add Tea Form Styles
   ============================================ */

/* Toast notifications */

/* Screen add-tea visibility */

/* ============================================
   Modal Styles
   ============================================ */

/* ============================================
   Loader / Splash Screen
   ============================================ */
.app-loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
  opacity: 1;
  visibility: visible;
}

.app-loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  text-align: center;
}

.loader-logo {
  width: 120px;
  height: 120px;
  object-fit: contain;
  opacity: 0.9;
  animation: pulse-logo 2s ease-in-out infinite;
}

.loader-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.5px;
  margin: 0;
}

.loader-subtitle {
  font-family: 'Karla', sans-serif;
  font-size: 1rem;
  color: var(--text-secondary);
  margin: 0;
  min-height: 1.5rem;
  opacity: 0.8;
}

.loader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--accent-green);
  border-top: 3px solid transparent;
  border-radius: 50%;
  animation: spin-loader 1s linear infinite;
  opacity: 0.7;
}

@keyframes spin-loader {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse-logo {
  0%, 100% {
    opacity: 0.9;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
}

/* ============================================================
   SKIN — современный скевоморфизм: фарфор, нефрит, бумага
   Подключается последним и переопределяет базовые компоненты.
   ============================================================ */
:root { --nav-h: calc(88px + env(safe-area-inset-bottom)); }

html, body {
  background-color: var(--bg-primary);
  background-image: radial-gradient(120% 55% at 50% -8%, var(--glow), transparent 62%);
  background-attachment: fixed;
}
body::before {            /* зерно бумаги */
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35  0 0 0 0 .27  0 0 0 0 .16  0 0 0 1.2 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}
#app { z-index: 1; }

.screen { padding-bottom: calc(var(--nav-h) + 12px); }
.screen.has-cta { padding-bottom: 0; }

/* ---- Заголовки ---- */
.page-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 500; font-size: 34px; line-height: 1.04; letter-spacing: -.015em;
  color: var(--text-primary); margin-bottom: 16px;
}
.page-title.lg { font-size: 40px; margin-bottom: 0; letter-spacing: -.02em; }
.overline { letter-spacing: .18em; }

/* ---- Поверхности ---- */
.panel, .tea-card-mini, .stats-banner, .info-grid {
  background: linear-gradient(180deg, var(--surface-hi), var(--surface-lo));
  border: 1px solid var(--border-light);
  box-shadow: var(--sh-raised);
}
.panel { border-radius: 22px; padding: 18px; }
.panel.flush { padding: 4px 0; overflow: hidden; }

.info-grid { gap: 0; background-color: transparent; border-radius: 22px; }
.info-cell { background: transparent; }
.info-cell:nth-child(odd) { border-right: 1px solid var(--border-light); }
.info-cell:nth-child(-n+2) { border-bottom: 1px solid var(--border-light); }
.info-cell .value { font-size: 21px; }

/* ---- Самоцвет: цвет сорта ---- */
.gem {
  --c: #C8801C;
  display: inline-block; flex: none; width: 38px; height: 38px; border-radius: 13px;
  background:
    radial-gradient(circle at 28% 20%, rgba(255,255,255,.75), rgba(255,255,255,0) 42%),
    linear-gradient(150deg, var(--c), color-mix(in srgb, var(--c) 62%, #2a1608));
  box-shadow: inset 0 1px 1px rgba(255,255,255,.55), inset 0 -5px 9px rgba(0,0,0,.22), 0 6px 12px -5px color-mix(in srgb, var(--c) 80%, #000);
}
.gem.lg { width: 48px; height: 48px; border-radius: 16px; }
.tea-card-mini .gem { width: 42px; height: 42px; }

/* ---- Список в панели ---- */
.panel.flush .list-row, .panel.flush .hrow { padding: 12px 16px; }
.panel.flush .list-row { border-bottom: 1px solid var(--border-light); }
.panel.flush .list-row .gem { width: 34px; height: 34px; border-radius: 11px; }
.panel.flush .list-row:active { background: var(--bg-secondary); opacity: 1; }
.list-row .row-title { font-size: 19px; }

/* ---- Кнопки ---- */
.btn-primary, .hero-btn, .segmented .segment.active, .chip-active {
  background: linear-gradient(180deg, var(--jade-hi), var(--accent-green) 52%, var(--jade-lo));
  color: var(--btn-text-color);
  box-shadow: var(--sh-jade);
  text-shadow: 0 1px 0 rgba(0,0,0,.22);
}
.btn-primary { height: 62px; padding: 0 28px; border-radius: 22px; font-size: 26px; transition: transform .12s, box-shadow .12s, filter .2s; }
.btn-primary.sm { height: 52px; font-size: 22px; border-radius: 18px; }
.btn-primary:hover { background: linear-gradient(180deg, var(--jade-hi), var(--accent-green) 52%, var(--jade-lo)); filter: brightness(1.05); }
.btn-primary:active, .hero-btn:active { transform: translateY(1px) scale(.992); filter: brightness(.96); box-shadow: inset 0 2px 5px rgba(0,0,0,.28), 0 4px 10px -6px rgba(34,88,62,.6); }

.btn-secondary, .btn-icon {
  background: linear-gradient(180deg, var(--surface-hi), var(--surface-lo));
  border: 1px solid var(--border-light);
  box-shadow: var(--sh-raised);
  transition: transform .12s, box-shadow .12s;
}
.btn-secondary { height: 52px; border-radius: 20px; padding: 0 22px; color: var(--text-primary); }
.btn-secondary:active, .btn-icon:active { transform: translateY(1px); box-shadow: var(--sh-inset); }
.btn-secondary:hover, .btn-icon:hover { border-color: var(--border-strong); }
.btn-dashed { background: transparent; box-shadow: none; border: 1.5px dashed var(--border-strong); color: var(--text-secondary); }
.btn-icon { width: 62px; height: 62px; border-radius: 22px; color: var(--accent-amber); }
.btn-icon.sm { width: 42px; height: 42px; border-radius: 14px; font-size: 19px; color: var(--text-secondary); }
.btn-icon.fav.on { color: var(--accent-amber); box-shadow: var(--sh-inset); }

/* Чипы, сегменты, поиск, тоггл — «утопленные» и «выпуклые» */
.chip-inactive {
  background: linear-gradient(180deg, var(--surface-hi), var(--surface-lo));
  border: 1px solid var(--border-light); box-shadow: var(--sh-raised); color: var(--text-secondary);
}
.chip-active { border: 1px solid transparent; }
.chip { padding: 9px 15px; }
.segmented { background: var(--bg-secondary); box-shadow: var(--sh-inset); border-radius: 18px; padding: 4px; }
.segmented .segment { border-radius: 14px; }
.segmented .segment.active { font-weight: 700; }
.search-box { height: 54px; border-radius: 18px; background: var(--bg-secondary); box-shadow: var(--sh-inset); }
.tag { background: var(--bg-secondary); box-shadow: var(--sh-inset); }

.toggle { width: 54px; height: 32px; padding: 0 4px; background: var(--bg-secondary); box-shadow: var(--sh-inset); transition: background .25s; }
.toggle.on { background: linear-gradient(180deg, var(--jade-lo), var(--accent-green)); box-shadow: inset 0 2px 5px rgba(0,0,0,.35); }
.toggle .knob {
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(180deg, #fff, #E9E1CE);
  box-shadow: 0 1px 1px rgba(255,255,255,.9) inset, 0 2px 5px rgba(0,0,0,.35);
}

/* Слайдер */
.slider-track { height: 8px; background: var(--bg-secondary); box-shadow: var(--sh-inset); }
.slider-fill { height: 8px; background: linear-gradient(180deg, var(--jade-hi), var(--jade-lo)); }
.slider-thumb {
  top: -11px; width: 30px; height: 30px; border: none;
  background: linear-gradient(180deg, #fff, #E9E1CE);
  box-shadow: inset 0 1px 0 #fff, 0 2px 6px rgba(0,0,0,.35), 0 0 0 4px rgba(47,111,82,.18);
}

.scenario-row, .scenario-chip { background: var(--bg-secondary); box-shadow: var(--sh-inset); }
.scenario-chip { border-radius: 13px; }

/* ---- Нижняя навигация: парящий док ---- */
.bottom-nav {
  left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom));
  padding: 6px; height: 68px; align-items: center; gap: 2px;
  border-radius: 28px; border: 1px solid var(--border-light);
  background: color-mix(in srgb, var(--surface-hi) 82%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: var(--sh-raised), 0 18px 40px -18px rgba(0,0,0,.5);
  max-width: 430px; margin: 0 auto;
}
.nav-item { flex: 1; min-width: 0; height: 56px; padding: 0; gap: 4px; justify-content: center; border-radius: 22px; transition: background .2s, box-shadow .2s; }
.nav-item.active { background: var(--bg-secondary); box-shadow: var(--sh-inset); }
.nav-item .icon svg { stroke-width: 1.7; }
.nav-item .label { font-size: 10px; letter-spacing: .08em; }

/* ---- Главная ---- */
.hero-btn {
  position: relative; overflow: hidden; height: 128px; border-radius: 30px; padding: 0 26px;
  flex-direction: row; align-items: center; justify-content: space-between; margin-bottom: 8px;
}
.hero-btn::before {            /* стеклянный блик */
  content: ''; position: absolute; inset: 0 0 52% 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.22), rgba(255,255,255,0));
}
.hero-btn::after {             /* мягкое пятно света справа */
  content: ''; position: absolute; right: -40px; top: -60px; width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255,255,255,.18), transparent); pointer-events: none;
}
.hero-text { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left; position: relative; z-index: 1; }
.hero-btn .title { font-size: 34px; }
.hero-art { position: relative; z-index: 1; opacity: .55; flex: none; }
.tea-card-mini { border-radius: 22px; padding: 12px 16px 12px 12px; transition: transform .12s, box-shadow .12s; }
.tea-card-mini:active { opacity: 1; transform: translateY(1px); box-shadow: var(--sh-inset); }
.stats-banner { border-radius: 22px; padding: 18px 20px; }

/* ---- Детали чая ---- */
.detail-top { position: sticky; top: 0; z-index: 10; padding: 12px 20px; margin: 0 -20px; background: linear-gradient(180deg, var(--bg-primary) 55%, transparent); }
.tea-hero {
  --c: #C8801C; height: 188px; margin: -8px 0 0; width: 100%; border-radius: 30px; padding: 22px 24px;
  background:
    radial-gradient(120% 90% at 85% 0%, color-mix(in srgb, var(--c) 55%, #fff) 0%, transparent 55%),
    linear-gradient(155deg, color-mix(in srgb, var(--c) 82%, #fff), color-mix(in srgb, var(--c) 62%, #1c0f05));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), inset 0 -18px 40px -20px rgba(0,0,0,.45), 0 22px 40px -22px color-mix(in srgb, var(--c) 85%, #000);
  align-items: flex-end;
}
.tea-hero .hero-disc {
  position: absolute; right: -50px; top: -50px; width: 210px; height: 210px; border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, rgba(255,255,255,.45), rgba(255,255,255,0) 55%), rgba(255,255,255,.08);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25), inset 0 -14px 30px rgba(0,0,0,.18);
}
.tea-hero .hero-cat {
  position: absolute; left: 24px; top: 22px; font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: rgba(255,255,255,.88); text-shadow: 0 1px 2px rgba(0,0,0,.35);
}
.tea-hero .cn-name { font-size: 54px; color: #fff; opacity: 1; text-shadow: 0 2px 10px rgba(0,0,0,.35); }
 .tea-hero .label { display: none; }

/* Закреплённая кнопка действия */
.sticky-cta {
  position: sticky; bottom: 0; z-index: 20; display: flex; gap: 12px; align-items: center;
  margin: auto -20px 0; padding: 26px 20px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, var(--bg-primary) 38%);
}
.sticky-cta .btn-primary { flex: 1; }
.screen-content.detail { padding-bottom: 0; }
.has-cta .screen-content { padding-bottom: 0; min-height: 100%; display: flex; flex-direction: column; }
.has-cta .screen-content > * { flex-shrink: 0; }

/* ---- Настройки ---- */
.settings-row { padding: 14px 18px; border-bottom: 1px solid var(--border-light); }
.panel.flush .settings-row:last-child { border-bottom: none; }
.settings-row .label { font-size: 17px; }

/* ---- История ---- */
.hero-stats { padding: 20px 18px 16px; }
.hs-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.hs-num { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 64px; line-height: .9; font-weight: 500; letter-spacing: -.03em; color: var(--text-primary); }
.hs-cap { display: block; margin-top: 4px; font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--text-tertiary); }
.hs-streak {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 99px;
  font-size: 12.5px; font-weight: 600; color: var(--accent-amber);
  background: var(--bg-secondary); box-shadow: var(--sh-inset); white-space: nowrap;
}
.hs-streak b { font-size: 15px; }
.hs-streak.off { color: var(--text-muted); }
.hist-chart { display: flex; align-items: stretch; gap: 8px; height: 132px; margin: 18px 0 14px; }
.hist-chart.dense { gap: 3px; }
.hc-col { flex: 1; min-width: 0; display: grid; grid-template-rows: 14px 1fr 16px; justify-items: center; align-items: end; }
.hc-val { font-size: 11px; font-weight: 700; color: var(--text-tertiary); line-height: 14px; }
.hc-bar {
  width: 100%; max-width: 30px; border-radius: 9px 9px 5px 5px; align-self: end;
  background: linear-gradient(180deg, color-mix(in srgb, var(--chart-bar) 100%, #fff 12%), var(--chart-bar));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35); transition: height .5s cubic-bezier(.2,.8,.2,1);
}
.hist-chart.dense .hc-bar { border-radius: 5px 5px 3px 3px; }
.hc-col.cur .hc-bar { background: linear-gradient(180deg, var(--accent-amber-light), var(--accent-amber)); box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 8px 14px -8px var(--accent-amber); }
.hc-col.empty .hc-bar { background: var(--bg-secondary); box-shadow: var(--sh-inset); }
.hc-lab { font-size: 10.5px; font-weight: 600; color: var(--text-muted); line-height: 16px; text-transform: capitalize; white-space: nowrap; }
.hc-col.cur .hc-lab { color: var(--text-primary); }
.hs-row { display: grid; grid-template-columns: repeat(3, 1fr); padding-top: 14px; border-top: 1px solid var(--border-light); }
.hs-row > div { display: flex; flex-direction: column; gap: 3px; }
.hs-row > div + div { padding-left: 14px; border-left: 1px solid var(--border-light); }
.hs-row b { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 24px; font-weight: 500; line-height: 1; }
.hs-row span { font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--text-tertiary); }

.catbar { display: flex; gap: 3px; height: 14px; margin: 4px 0 12px; border-radius: 99px; overflow: hidden; box-shadow: var(--sh-inset); padding: 2px; background: var(--bg-secondary); }
.catbar i { background: var(--c); border-radius: 99px; min-width: 6px; box-shadow: inset 0 1px 0 rgba(255,255,255,.4); }
.catlegend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--text-secondary); }
.catlegend span { display: inline-flex; align-items: center; gap: 6px; }
.catlegend i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: inset 0 1px 1px rgba(255,255,255,.5); }
.catlegend em { font-style: normal; color: var(--text-tertiary); }
.topteas { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border-light); display: flex; flex-direction: column; gap: 4px; }
.toptea { display: grid; grid-template-columns: 18px minmax(0, 1.3fr) minmax(0, 1fr) 20px; gap: 10px; align-items: center; padding: 7px 0; cursor: pointer; }
.toptea-n { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 20px; color: var(--text-muted); }
.toptea-name { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 18px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toptea-bar { height: 8px; border-radius: 99px; background: var(--bg-secondary); box-shadow: var(--sh-inset); overflow: hidden; }
.toptea-bar i { display: block; height: 100%; border-radius: 99px; background: var(--c); box-shadow: inset 0 1px 0 rgba(255,255,255,.4); }
.toptea-c { font-size: 13px; font-weight: 700; color: var(--text-tertiary); text-align: right; font-variant-numeric: tabular-nums; }

.hist-groups { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 6px 8px; }
.day-head span { font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--text-tertiary); }
.day-head em { font-style: normal; font-size: 12px; color: var(--text-muted); }
.hrow {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; border: none; background: transparent; cursor: pointer;
  border-bottom: 1px solid var(--border-light); color: inherit; font: inherit;
}
.hrow:last-child { border-bottom: none; }
.hrow:active { background: var(--bg-secondary); }
.hrow .gem { width: 36px; height: 36px; border-radius: 12px; }
.hrow-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.hrow-name { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 19px; font-weight: 500; line-height: 1.15; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hrow-meta { font-size: 12.5px; color: var(--text-tertiary); }
.hrow-rate { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-amber); opacity: .85; }

.stars { display: inline-flex; gap: 2px; }
.stars i { font-style: normal; font-size: 14px; color: var(--border-strong); }
.stars i.on { color: var(--accent-amber); text-shadow: 0 1px 6px rgba(237,180,82,.45); }
.stars.sm i { font-size: 12px; }

.empty-state { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state p { font-size: 26px; color: var(--text-secondary); }
.empty-state span { font-size: 14px; max-width: 240px; line-height: 1.45; }

/* ---- Шторка чаепития ---- */
.sheet { position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-end; justify-content: center; pointer-events: none; }
.sheet.open { pointer-events: auto; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(20,14,6,.5); opacity: 0; transition: opacity .25s; -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.sheet.open .sheet-backdrop { opacity: 1; }
.sheet-panel {
  --c: #C8801C;
  position: relative; width: 100%; max-width: 430px; max-height: 88svh; overflow-y: auto;
  border-radius: 30px 30px 0 0; padding: 10px 22px calc(22px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, var(--surface-hi), var(--surface-lo));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 -24px 60px -20px rgba(0,0,0,.55);
  transform: translateY(100%); transition: transform .32s cubic-bezier(.2,.9,.25,1);
  display: flex; flex-direction: column; gap: 14px;
}
.sheet.open .sheet-panel { transform: none; }
.sheet-grab { align-self: center; width: 42px; height: 5px; border-radius: 9px; background: var(--border-strong); margin-bottom: 4px; }
.sheet-head { display: flex; align-items: center; gap: 14px; }
.sheet-head h2 { font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 500; font-size: 28px; line-height: 1.05; }
.sheet-head span:not(.gem) { font-size: 13px; color: var(--text-tertiary); text-transform: capitalize; }
.sheet-hint { font-size: 14px; color: var(--accent-amber); font-weight: 600; margin: -4px 0 -2px; }
.sheet-stars { display: flex; justify-content: center; gap: 6px; padding: 8px 0; border-radius: 20px; background: var(--bg-secondary); box-shadow: var(--sh-inset); }
.sheet-stars button { border: none; background: transparent; font-size: 34px; line-height: 1; padding: 4px 6px; color: var(--border-strong); cursor: pointer; transition: transform .15s, color .15s; }
.sheet-stars button.on { color: var(--accent-amber); text-shadow: 0 2px 10px rgba(237,180,82,.5); }
.sheet-stars button:active { transform: scale(1.2); }
.sheet-stats { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.sheet-stats > div { display: flex; flex-direction: column; gap: 3px; }
.sheet-stats > div + div { border-left: 1px solid var(--border-light); }
.sheet-stats b { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 24px; font-weight: 500; }
.sheet-stats small { font-size: 13px; color: var(--text-tertiary); font-family: 'Karla', sans-serif; }
.sheet-stats span { font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--text-tertiary); }
.sheet-bars { display: flex; flex-direction: column; gap: 7px; }
.sb { display: grid; grid-template-columns: 16px 1fr 82px; align-items: center; gap: 10px; }
.sb-n { font-size: 12px; font-weight: 700; color: var(--text-muted); }
.sb-track { position: relative; height: 12px; border-radius: 99px; background: var(--bg-secondary); box-shadow: var(--sh-inset); overflow: hidden; }
.sb-track i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; }
.sb-track .plan { background: color-mix(in srgb, var(--c) 28%, transparent); }
.sb-track .fact { top: 3px; bottom: 3px; left: 3px; background: var(--c); box-shadow: inset 0 1px 0 rgba(255,255,255,.4); max-width: calc(100% - 6px); }
.sb-v { font-size: 12px; color: var(--text-tertiary); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sb-v b { color: var(--text-primary); }
.sb.skip { opacity: .55; }
.sheet-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.sheet-note {
  width: 100%; resize: none; border: none; outline: none; border-radius: 16px; padding: 12px 14px;
  background: var(--bg-secondary); box-shadow: var(--sh-inset); color: var(--text-primary);
  font-family: 'Karla', sans-serif; font-size: 15px; line-height: 1.45;
}
.sheet-note::placeholder { color: var(--text-muted); }
.sheet-actions { display: flex; gap: 10px; margin-top: 4px; }
.sheet-actions .btn-primary { flex: 1.5; font-size: 20px; padding: 0 12px; white-space: nowrap; }
.sheet-actions .btn-secondary { flex: 1; height: 52px; }
.sheet-delete { border: none; background: transparent; color: var(--text-muted); font: 600 13px 'Karla', sans-serif; padding: 8px; cursor: pointer; align-self: center; }
.sheet-delete.armed { color: var(--accent-red); }

/* Таймер: кнопки в новой палитре */
.timer-screen .btn-pour { box-shadow: 0 14px 30px -14px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.18); }
.timer-screen.is-done .btn-pour { background: linear-gradient(180deg, var(--jade-hi), var(--accent-green) 52%, var(--jade-lo)); box-shadow: var(--sh-jade); }
.t-btn { background: linear-gradient(180deg, var(--surface-hi), var(--surface-lo)); box-shadow: var(--sh-raised); border-color: var(--border-light); }
.t-btn:active { box-shadow: var(--sh-inset); }
.t-btn.danger { border-color: var(--border-light); }

@media (prefers-reduced-motion: reduce) {
  .sheet-panel, .sheet-backdrop { transition: none; }
}

/* ============================================================
   Гайвань: стеклянная чаша, крышка, фарфоровое блюдце
   ============================================================ */
:root {
  --saucer-a: #FFFFFF; --saucer-b: #E9DFC9; --saucer-c: #C9BC9E; --saucer-well: rgba(120,95,55,.16); --rim-line: rgba(90,70,40,.22);
  --glass-a: rgba(255,255,255,.62); --glass-b: rgba(235,226,205,.28);
  --glass-edge: rgba(98,78,46,.55); --glass-inner: rgba(255,255,255,.65); --glass-lip: rgba(255,252,243,.92);
}
[data-theme="dark"] {
  --saucer-a: #4A3E2B; --saucer-b: #2F2619; --saucer-c: #1B150D; --saucer-well: rgba(0,0,0,.35); --rim-line: rgba(255,230,180,.16);
  --glass-a: rgba(255,244,220,.17); --glass-b: rgba(255,244,220,.04);
  --glass-edge: rgba(255,236,200,.5); --glass-inner: rgba(255,236,200,.18); --glass-lip: rgba(255,244,220,.2);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --saucer-a: #4A3E2B; --saucer-b: #2F2619; --saucer-c: #1B150D; --saucer-well: rgba(0,0,0,.35); --rim-line: rgba(255,230,180,.16);
    --glass-a: rgba(255,244,220,.17); --glass-b: rgba(255,244,220,.04);
    --glass-edge: rgba(255,236,200,.5); --glass-inner: rgba(255,236,200,.18); --glass-lip: rgba(255,244,220,.2);
  }
}

.gaiwan-wrap { position: relative; display: flex; flex-direction: column; align-items: center; gap: 16px; flex: none; }
.gaiwan { position: relative; width: var(--gw); aspect-ratio: 320 / 276; }
.g-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.g-back { z-index: 0; }
.g-front { z-index: 4; }

/* настой: форма чаши вырезается clip-path (в процентах от рамки чаши) */
.g-bowl {
  position: absolute; z-index: 1; overflow: hidden; isolation: isolate;
  left: 9.375%; top: 25.36%; width: 81.25%; height: 49.28%;
  -webkit-clip-path: url(#g-bowl-clip); clip-path: url(#g-bowl-clip);
}
.g-bowl .vessel-text { z-index: 1; }

/* свечение за гайванью (растёт к финалу) */
.g-glow {
  position: absolute; left: 6%; right: 6%; top: 18%; bottom: 8%; border-radius: 50%; z-index: 0; pointer-events: none;
  background: radial-gradient(closest-side, rgba(var(--acc-rgb), calc(.16 + var(--energy) * .28)), transparent);
  filter: blur(14px); transition: background .6s;
}
.timer-screen.is-done .g-glow { background: radial-gradient(closest-side, rgba(47,111,82,.5), transparent); animation: g-breathe 2.2s ease-in-out infinite; }

/* пар из-под крышки */
.t-steam { position: absolute; z-index: 5; left: 7%; top: -2%; width: 30%; height: 24%; display: flex; justify-content: space-between; align-items: flex-end; pointer-events: none; opacity: calc(.3 + var(--energy) * .7); transition: opacity .8s; }
.t-steam svg { width: 24%; height: 100%; overflow: visible; }
.t-steam path { fill: none; stroke: var(--acc-ui); stroke-width: 2.8; stroke-linecap: round; stroke-dasharray: 46; stroke-dashoffset: 46; opacity: 0; animation: t-wisp 4.8s ease-in-out infinite; }
.t-steam svg:nth-child(2) path { animation-delay: 1.5s; animation-duration: 5.4s; }
.t-steam svg:nth-child(3) path { animation-delay: 3s; animation-duration: 5.1s; }
.timer-screen.is-done .t-steam { opacity: .35; }

/* крышка подпрыгивает от кипения */
.g-lid { transform-box: view-box; transform-origin: 268px 73px; transform: rotate(-2.6deg); animation: g-jig calc(3.2s - var(--energy) * 2.2s) ease-in-out infinite; }
.g-saucer-glass { opacity: .72; }
.g-drops { opacity: calc(.25 + var(--energy) * .75); }
@keyframes g-jig {
  0%, 100% { transform: rotate(-2.6deg) translateY(0); }
  50% { transform: rotate(calc(-2.6deg - var(--energy) * 1.6deg)) translateY(calc(var(--energy) * -1.4px)); }
}
@keyframes g-breathe { 0%,100% { opacity: .75; transform: scale(1); } 50% { opacity: 1; transform: scale(1.05); } }
.timer-screen.is-done .g-lid { animation: g-jig 1.1s ease-in-out infinite; }

/* внутри чаши цифры чуть меньше и выше центра */
.g-bowl .vessel-text { justify-content: center; padding-bottom: 14%; }
.t-time { font-size: calc(var(--gw) * .19); }
.t-caption { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.t-caption i { width: 4px; height: 4px; border-radius: 50%; background: var(--text-muted); }
.t-caption .t-count { font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--text-tertiary); opacity: 1; }
.timer-screen.is-done .t-caption .js-next { color: var(--accent-red); }

/* линейка прогресса под блюдцем */
.t-ruler { width: calc(var(--gw) * .86); height: 12px; overflow: visible; }
.t-ruler line { stroke: color-mix(in srgb, var(--text-primary) 20%, transparent); stroke-width: 1.5; stroke-linecap: round; vector-effect: non-scaling-stroke; transition: stroke .35s; }
.t-ruler line.on { stroke: var(--acc-ui); }
.t-ruler line.head { stroke: var(--acc-ui); stroke-width: 2.6; }
.timer-screen.is-done .t-ruler line.on, .timer-screen.is-done .t-ruler line.head { stroke: var(--accent-green); }

@media (prefers-reduced-motion: reduce) { .g-lid, .g-glow { animation: none !important; } }

/* ---- Оценки ---- */
.rbadge { font-size: 12.5px; font-weight: 700; color: var(--accent-amber); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rbadge.avg { opacity: .7; }
.rate-panel { padding: 16px 18px; }
.rp-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.rp-head .overline { margin: 0; }
.rp-sub { font-size: 12px; color: var(--text-tertiary); }
.rp-stars { display: flex; justify-content: center; gap: 4px; margin: 10px 0 8px; padding: 6px 0; border-radius: 18px; background: var(--bg-secondary); box-shadow: var(--sh-inset); }
.rp-stars button { border: none; background: transparent; font-size: 32px; line-height: 1; padding: 4px 8px; color: var(--border-strong); cursor: pointer; transition: transform .15s, color .15s; }
.rp-stars button.on { color: var(--accent-amber); text-shadow: 0 2px 10px rgba(237,180,82,.5); }
.rp-stars button:active { transform: scale(1.22); }
.rp-foot { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--text-secondary); }
.rp-foot em { font-style: normal; font-size: 11.5px; color: var(--text-muted); }

/* ---- Шторка: передержка ---- */
.sheet-stats > div.warn b { color: var(--accent-red); }
.sb { grid-template-columns: 16px 1fr 112px; gap: 12px; }
.sb-track .fact { top: 3px; bottom: 3px; left: 3px; max-width: none; border-radius: 99px 0 0 99px; }
.sb-track .over {
  top: 3px; bottom: 3px; border-radius: 0 99px 99px 0; margin-left: 3px;
  background: repeating-linear-gradient(135deg, var(--accent-red) 0 4px, color-mix(in srgb, var(--accent-red) 55%, transparent) 4px 8px);
}
.sb-track .mark { top: 0; bottom: 0; width: 2px; margin-left: 3px; background: color-mix(in srgb, var(--text-primary) 45%, transparent); border-radius: 0; }
.sb-v { display: flex; align-items: baseline; justify-content: flex-end; gap: 6px; }
.sb-v small { font-size: 10.5px; color: var(--text-muted); }
.sb-v em { font-style: normal; font-weight: 700; color: var(--accent-red); }
.sheet-total { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 10px 14px; border-radius: 14px; background: var(--bg-secondary); box-shadow: var(--sh-inset); font-size: 13px; color: var(--text-secondary); }
.sheet-total b { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 20px; color: var(--text-primary); }
.sheet-total small { color: var(--text-muted); }
.sheet-total .warn { color: var(--accent-red); font-weight: 700; }

/* ---- Pull-to-refresh ---- */
html, body, .screen { overscroll-behavior-y: contain; }
#ptr {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 8px); z-index: 300;
  margin-left: -34px; width: 68px; display: flex; flex-direction: column; align-items: center; gap: 8px;
  transform: translate3d(0,-90px,0); opacity: 0; pointer-events: none; will-change: transform, opacity;
}
#ptr.settle { transition: transform .32s cubic-bezier(.3,1.3,.5,1), opacity .25s; }
.ptr-badge {
  position: relative; width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(180deg, var(--surface-hi), var(--surface-lo));
  box-shadow: var(--sh-raised), 0 14px 24px -12px rgba(0,0,0,.5);
  transform: scale(calc(.6 + var(--pre, 0) * .4)) rotate(calc(var(--pre, 0) * 360deg - 360deg));
}
#ptr.ready .ptr-badge { transform: scale(1); }
.ptr-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ptr-ring-bg { fill: none; stroke: var(--border-medium); stroke-width: 3; }
.ptr-ring-fg { fill: none; stroke: var(--accent-amber); stroke-width: 3.4; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; filter: drop-shadow(0 0 3px rgba(237,180,82,.6)); }
#ptr.done .ptr-ring-fg { stroke: var(--accent-green); }
.ptr-cup { position: absolute; inset: 10px; width: 44px; height: 44px; overflow: visible; }
.ptr-cup-line { stroke: var(--text-secondary); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.ptr-liquid { fill: var(--accent-amber); opacity: .9; }
#ptr.done .ptr-liquid { fill: var(--accent-green); }
.ptr-wisp { stroke: var(--accent-amber); stroke-width: 2; stroke-linecap: round; fill: none; opacity: 0; }
#ptr.ready .ptr-wisp { animation: ptr-wisp 1.4s ease-in-out infinite; }
#ptr.ready .ptr-wisp.w2 { animation-delay: .3s; } #ptr.ready .ptr-wisp.w3 { animation-delay: .6s; }
#ptr.busy .ptr-badge { animation: ptr-bob 1s ease-in-out infinite; }
.ptr-text { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; white-space: nowrap; color: var(--text-secondary); padding: 5px 11px; border-radius: 99px; background: color-mix(in srgb, var(--surface-hi) 88%, transparent); box-shadow: var(--sh-raised); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
@keyframes ptr-wisp { 0% { opacity: 0; transform: translateY(4px); } 40% { opacity: .9; } 100% { opacity: 0; transform: translateY(-5px); } }
@keyframes ptr-bob { 0%,100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.06) rotate(-4deg); } }
@media (prefers-reduced-motion: reduce) { #ptr.ready .ptr-wisp, #ptr.busy .ptr-badge { animation: none; } }


/* ---- Ползунок проливов: тянется пальцем ---- */
.slider-hit { height: 46px; display: flex; align-items: center; touch-action: none; cursor: grab; -webkit-user-select: none; user-select: none; }
.slider-hit.dragging { cursor: grabbing; }
.slider-hit .slider-track { overflow: visible; }
.slider-hit .slider-fill { transition: none; }
.slider-hit .slider-thumb { transition: transform .12s, box-shadow .12s; }
.slider-hit.dragging .slider-thumb { transform: scale(1.14); box-shadow: inset 0 1px 0 #fff, 0 4px 12px rgba(0,0,0,.4), 0 0 0 7px rgba(47,111,82,.2); }
.slider-ticks { position: absolute; inset: 0; display: flex; justify-content: space-between; pointer-events: none; }
.slider-ticks i { width: 2px; height: 8px; border-radius: 2px; background: var(--border-strong); opacity: .55; margin-top: 12px; }
.slider-fill, .slider-thumb { z-index: 1; }

/* ---- Форма «Свой чай» ---- */
.fld { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.fld > span:first-child { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-tertiary); }
.fld-in { display: flex; align-items: center; gap: 6px; height: 48px; padding: 0 14px; border-radius: 15px; background: var(--bg-secondary); box-shadow: var(--sh-inset); }
.fld-in:focus-within { outline: 2px solid var(--accent-green); outline-offset: 1px; }
.fld-in input { flex: 1; min-width: 0; border: none; background: transparent; outline: none; font: 500 16px 'Karla', sans-serif; color: var(--text-primary); }
.fld-in input::placeholder { color: var(--text-muted); }
.fld-in em { font-style: normal; font-size: 12px; color: var(--text-tertiary); white-space: nowrap; }
.fld-row { display: flex; gap: 10px; }
.tf-cats { display: flex; flex-wrap: wrap; gap: 8px; }
.tf-switch { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: none; border-radius: 15px; background: var(--bg-secondary); box-shadow: var(--sh-inset); font: 500 15px 'Karla', sans-serif; color: var(--text-primary); cursor: pointer; }
.tf-switch i { width: 44px; height: 26px; border-radius: 99px; background: var(--border-medium); position: relative; transition: background .2s; flex: none; }
.tf-switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35); transition: transform .2s; }
.tf-switch.on i { background: linear-gradient(180deg, var(--jade-hi), var(--jade-lo)); }
.tf-switch.on i::after { transform: translateX(18px); }
.tf-err { margin: 0; color: #B3402A; font-size: 14px; font-weight: 600; }
.custom-actions { margin-top: 22px; display: flex; flex-direction: column; gap: 8px; }
#tea-sheet .sheet-head span:not(.gem) { text-transform: none; }

/* ---- Единый вид полей ввода ---- */
input, textarea { -webkit-appearance: none; appearance: none; border-radius: 0; -webkit-tap-highlight-color: transparent; caret-color: var(--accent-green); }
input:focus, input:focus-visible, textarea:focus, textarea:focus-visible { outline: none !important; box-shadow: none; }
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-results-button { -webkit-appearance: none; display: none; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.search-box, .fld-in, .sheet-note, .scenario-row {
  transition: box-shadow .18s, background-color .18s;
}
.search-box { background: var(--bg-secondary); box-shadow: var(--sh-inset); border: 1px solid transparent; }
.search-box:focus-within, .fld-in:focus-within, .sheet-note:focus, .scenario-row:focus-within {
  outline: none;
  background: var(--bg-card, var(--bg-secondary));
  box-shadow: var(--sh-inset), 0 0 0 3px rgba(47,111,82,.22);
  border-color: rgba(47,111,82,.55);
}
.fld-in { border: 1px solid transparent; }
.sheet-note { border: 1px solid transparent; }
.scenario-row .sec { border: none; background: transparent; outline: none; color: var(--text-primary); width: 56px; }


/* ---- Подсказка и теги вкуса на экране заварки ---- */
.t-tip { margin: 0; max-width: 340px; text-align: center; font-size: 12.5px; line-height: 1.4; color: var(--text-tertiary); text-wrap: balance; }
.t-tip b { display: block; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--acc-ui); margin-bottom: 2px; }
.t-tags { display: flex; gap: 6px; max-width: 100%; overflow-x: auto; padding: 4px 24px 6px; margin: 0 -24px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.t-tags::-webkit-scrollbar { display: none; }
.t-tag { flex: none; border: none; cursor: pointer; padding: 7px 12px; border-radius: 99px; font: 600 12.5px 'Karla', sans-serif; color: var(--text-secondary);
  background: var(--bg-secondary); box-shadow: var(--sh-inset); transition: transform .12s, background .15s, color .15s; }
.t-tag:active { transform: scale(.94); }
.t-tag.on { color: var(--on-liquid, #fff); background: linear-gradient(180deg, var(--acc), var(--acc-deep)); box-shadow: 0 1px 0 rgba(255,255,255,.35) inset, 0 2px 6px rgba(0,0,0,.25); }
.t-meta span.liq { background: transparent; box-shadow: inset 0 0 0 1px rgba(var(--acc-rgb), .45); color: var(--acc-ui); }
@media (max-height: 760px) { .t-tip { display: none; } }

/* ---- Тост «пролив готов» ---- */
.ready-toast { position: fixed; z-index: 300; left: 14px; right: 14px; top: calc(12px + env(safe-area-inset-top)); display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border: none; border-radius: 20px; cursor: pointer; text-align: left;
  background: linear-gradient(180deg, var(--jade-hi), var(--jade-lo)); color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.35); animation: toast-in .35s cubic-bezier(.2,.9,.25,1); font-family: 'Karla', sans-serif; }
.ready-toast span { font-size: 22px; } .ready-toast b { font-size: 16px; flex: 1; } .ready-toast em { font-style: normal; font-size: 12.5px; opacity: .85; }
@keyframes toast-in { from { transform: translateY(-120%); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---- Вкус по проливам в карточке чаепития ---- */
.sheet-tastes { display: flex; flex-direction: column; gap: 6px; }
.sheet-tastes div { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.sheet-tastes b { width: 18px; font-size: 12px; color: var(--text-muted); }
.sheet-tastes span, .ts-tags span { padding: 4px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); background: var(--bg-secondary); box-shadow: var(--sh-inset); }

/* ---- Статистика вкусов ---- */
.ts-line { margin: 8px 0 0; font-size: 14px; color: var(--text-secondary); } .ts-line b { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 22px; color: var(--text-primary); }
.ts-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; } .ts-tags em { font-style: normal; color: var(--text-muted); margin-left: 3px; }
.ts-best { margin-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.ts-best .toptea { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; cursor: pointer; }
.ts-star { font-weight: 700; color: #C8801C; font-variant-numeric: tabular-nums; }

/* ---- Сегодня и бэкап на главной ---- */
.today-card { display: flex; flex-direction: column; gap: 10px; }
.today-chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -20px; padding: 2px 20px 4px; scrollbar-width: none; }
.today-chips::-webkit-scrollbar { display: none; } .today-chips .chip { flex: none; }
.today-list { display: flex; flex-direction: column; gap: 8px; }
.backup-banner { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 22px; background: linear-gradient(180deg, var(--surface-hi), var(--surface-lo)); box-shadow: var(--sh-raised); }
.backup-banner b { display: block; font-size: 15px; color: var(--text-primary); } .backup-banner span { font-size: 13px; color: var(--text-tertiary); }
.bb-actions { display: flex; gap: 8px; } .bb-actions button { flex: 1; height: 42px; }


/* ---- Экран «Своя лестница» ---- */
.cs { display: flex; flex-direction: column; gap: 14px; }
.cs-head { display: flex; align-items: center; gap: 12px; }
.cs-head h1 { font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 500; font-size: 30px; line-height: 1.05; color: var(--text-primary); }
.cs-tea { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 16px; background: var(--bg-secondary); box-shadow: var(--sh-inset); }
.cs-tea b { flex: 1; font-family: 'Cormorant Garamond', Georgia, serif; font-size: 19px; font-weight: 600; color: var(--text-primary); }
.cs-tea span:last-child { font-size: 13px; color: var(--text-tertiary); }
.cs-summary { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 1px; border-radius: 20px; overflow: hidden; background: var(--border-light); box-shadow: var(--sh-raised); }
.cs-summary div { display: flex; flex-direction: column; gap: 2px; padding: 12px 10px; background: linear-gradient(180deg, var(--surface-hi), var(--surface-lo)); text-align: center; }
.cs-summary b { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 20px; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.cs-summary span { font-size: 10.5px; letter-spacing: .04em; color: var(--text-tertiary); }
.cs-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.cs-preset { display: inline-flex; border-radius: 99px; overflow: hidden; background: var(--bg-secondary); box-shadow: var(--sh-inset); }
.cs-preset button { border: none; background: transparent; cursor: pointer; padding: 8px 12px; font: 600 13px 'Karla', sans-serif; color: var(--text-secondary); }
.cs-preset button em { font-style: normal; font-weight: 500; color: var(--text-muted); margin-left: 6px; }
.cs-preset .x { padding: 8px 12px 8px 4px; font-size: 16px; color: var(--text-muted); }
.cs-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cs-tools .btn-secondary { height: 42px; border-radius: 14px; padding: 0 14px; font-size: 14px; }
.cs-shift { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-tertiary); }
.cs-shift button { width: 44px; height: 42px; border: none; border-radius: 14px; cursor: pointer; font: 700 15px 'Karla', sans-serif; color: var(--text-primary); background: linear-gradient(180deg, #fff, #EFE7D4); box-shadow: var(--sh-raised); }
.cs-shift button:active, .cs-step:active { transform: scale(.94); }
.cs-rows { display: flex; flex-direction: column; gap: 8px; }
.cs-row { gap: 8px; padding: 10px 10px 10px 14px; }
.cs-row .bar-bg { min-width: 24px; }
.cs-step { flex: none; width: 36px; height: 36px; border: none; border-radius: 12px; cursor: pointer; font: 700 20px/1 'Karla', sans-serif; color: var(--text-primary); background: linear-gradient(180deg, #fff, #EFE7D4); box-shadow: var(--sh-raised); }
.cs-val { display: flex; align-items: baseline; gap: 2px; min-width: 58px; justify-content: center; }
.cs-val input.sec { width: 46px !important; min-width: 0; text-align: right; }
.cs-val i { font-style: normal; font-size: 12px; color: var(--text-tertiary); }
.cs-del { flex: none; width: 36px; height: 36px; border: none; border-radius: 12px; cursor: pointer; display: grid; place-items: center; color: #B3402A; background: color-mix(in srgb, #B3402A 10%, transparent); transition: opacity .15s, transform .12s; }
.cs-del:active { transform: scale(.92); } .cs-del:disabled { opacity: .25; cursor: default; }
.cs-save { margin-top: 6px; display: flex; flex-direction: column; gap: 10px; }
[data-theme="dark"] .cs-step, [data-theme="dark"] .cs-shift button { background: linear-gradient(180deg, #3a3223, #2a2418); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cs-step, :root:not([data-theme="light"]) .cs-shift button { background: linear-gradient(180deg, #3a3223, #2a2418); } }

.app-toast { position: fixed; z-index: 310; left: 16px; right: 16px; bottom: calc(24px + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-radius: 18px; background: #26201A; color: #FDF8EB; font: 500 14px 'Karla', sans-serif; box-shadow: 0 12px 32px rgba(0,0,0,.4); animation: toast-up .28s cubic-bezier(.2,.9,.25,1); max-width: 398px; margin: 0 auto; }
.app-toast button { border: none; background: transparent; color: #8FD4B0; font: 700 14px 'Karla', sans-serif; cursor: pointer; padding: 4px 6px; }
@keyframes toast-up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Подписи в строках настроек — под названием */
.settings-row > div:not(.toggle) { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.settings-row .sublabel { display: block; font-size: 12.5px; line-height: 1.3; color: var(--text-tertiary); }


/* ---- Без выделения текста (кроме полей ввода) ---- */
html, body, body * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea { -webkit-user-select: text; user-select: text; }
img { -webkit-user-drag: none; user-drag: none; }

/* ---- Кнопка «копировать название» ---- */
.name-row { display: flex; align-items: center; gap: 10px; }
.name-row h1 { min-width: 0; }
.copy-btn { flex: none; width: 36px; height: 36px; border: none; border-radius: 12px; cursor: pointer; display: grid; place-items: center; color: var(--text-tertiary);
  background: var(--bg-secondary); box-shadow: var(--sh-inset); transition: transform .12s, color .15s, background .15s; }
.copy-btn:active { transform: scale(.9); }
.copy-btn.done { color: #fff; background: linear-gradient(180deg, var(--jade-hi), var(--jade-lo)); box-shadow: none; }


/* ---- Граммы и посуда ---- */
.gm-block { padding: 16px; border-radius: 22px; background: linear-gradient(180deg, var(--surface-hi), var(--surface-lo)); box-shadow: var(--sh-raised); }
.gm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.gm-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.gm-in { display: flex; align-items: center; gap: 2px; height: 50px; padding: 0 4px; border-radius: 16px; background: var(--bg-secondary); box-shadow: var(--sh-inset); transition: box-shadow .18s; }
.gm-in:focus-within { box-shadow: var(--sh-inset), 0 0 0 3px rgba(47,111,82,.22); }
.gm-in button { flex: none; width: 38px; height: 38px; border: none; border-radius: 12px; cursor: pointer; font: 700 20px/1 'Karla', sans-serif; color: var(--text-primary); background: linear-gradient(180deg, #fff, #EFE7D4); box-shadow: var(--sh-raised); }
.gm-in button:active { transform: scale(.92); }
.gm-in input { flex: 1; min-width: 0; width: 100%; border: none; background: transparent; outline: none; text-align: right; font: 500 24px 'Cormorant Garamond', Georgia, serif; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.gm-in em { flex: none; font-style: normal; font-size: 12px; color: var(--text-tertiary); margin: 0 6px 0 2px; min-width: 16px; }
.gm-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; font-size: 12.5px; color: var(--text-tertiary); }
.gm-foot b { color: var(--accent-amber, #C8801C); font-weight: 700; }
[data-theme="dark"] .gm-in button { background: linear-gradient(180deg, #3a3223, #2a2418); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .gm-in button { background: linear-gradient(180deg, #3a3223, #2a2418); } }

.sheet-gm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 12px 14px; border-radius: 18px; background: var(--bg-secondary); box-shadow: var(--sh-inset); }
.sheet-gm label { display: inline-flex; align-items: baseline; gap: 6px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-tertiary); }
.sheet-gm input { width: 54px; border: none; border-bottom: 1.5px solid var(--border-medium); background: transparent; text-align: right; font: 500 22px 'Cormorant Garamond', Georgia, serif; color: var(--text-primary); padding: 0 2px; }
.sheet-gm input:focus { border-bottom-color: var(--accent-green); }
.sheet-gm em { font-style: normal; font-size: 12px; text-transform: none; letter-spacing: 0; }
.sheet-gm #sg-ratio { flex-basis: 100%; font-size: 12.5px; color: var(--text-tertiary); }
