/* ===== Горна лента ===== */
.appbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
}
.appbar-inner { display: flex; align-items: center; gap: 10px; height: 60px; padding: 0 16px; padding-top: env(safe-area-inset-top); }
.brand {
  display: flex; align-items: center; gap: 10px; padding: 0; border: 0; background: none; cursor: pointer;
  font-weight: 900; font-size: 1.14rem; letter-spacing: -.02em; color: var(--ink);
}
.logo { width: 34px; height: 34px; border-radius: 10px; box-shadow: var(--shadow-1); }
.appbar-actions { display: flex; gap: 8px; margin-left: auto; }
.appbar-title { flex: 1; text-align: center; font-size: 1.08rem; font-weight: 800; }
.appbar-spacer { width: 42px; flex: 0 0 auto; }

/* ===== Главен екран (телефон) ===== */
.home { display: flex; flex-direction: column; width: 100%; max-width: 560px; min-height: calc(100vh - 60px); min-height: calc(100dvh - 60px); margin: 0 auto; padding: 2px 16px 0; }
.col { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.ctx-chips { display: flex; gap: 6px; margin: 0 -16px; padding: 4px 16px; overflow-x: auto; scrollbar-width: none; }
.ctx-chips::-webkit-scrollbar { display: none; }
.pool-line { margin: 6px 2px 12px; color: var(--muted); font-size: .8rem; font-weight: 600; }

.today {
  display: flex; align-items: center; gap: 12px; width: 100%; margin-bottom: 12px; padding: 10px 12px; text-align: left;
  border-radius: 18px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-1); cursor: pointer;
}
.today small { color: var(--good); font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; }
.today b { display: block; font-weight: 800; }
.today > .i { color: var(--muted); }

.banner {
  display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; padding: 14px 16px;
  border-radius: 18px; background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 22%, transparent);
}
.banner p { font-weight: 800; }
.banner-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ===== Тестето и картата ===== */
.stack { position: relative; isolation: isolate; display: flex; flex-direction: column; flex: 1; min-height: 380px; max-height: 660px; margin-bottom: 20px; }
@media (min-width: 600px) and (max-width: 959.98px) { .col { justify-content: center; } }
.stack.has-card::before, .stack.has-card::after {
  content: ''; position: absolute; left: 16px; right: 16px; bottom: -9px; height: 80px; z-index: -1;
  border-radius: var(--radius-l); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-1);
}
.stack.has-card::after { left: 34px; right: 34px; bottom: -18px; z-index: -2; opacity: .55; }

.card {
  position: relative; display: flex; flex-direction: column; flex: 1; overflow: hidden;
  border-radius: var(--radius-l); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-2);
}
.card[data-id] { touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: grab; transition: transform .2s ease, box-shadow .2s; }
.card[data-id]:active { cursor: grabbing; }
.card.enter { animation: rise .34s cubic-bezier(.2, .8, .2, 1); }
@keyframes rise { from { transform: translateY(16px) scale(.96); opacity: .3; } }
.card[data-drag="right"] { box-shadow: 0 0 0 3px var(--good), var(--shadow-2); }
.card[data-drag="left"] { box-shadow: 0 0 0 3px var(--accent), var(--shadow-2); }

.card-hero { position: relative; display: grid; place-items: center; flex: 1 1 auto; min-height: 170px; padding: 58px 16px 22px; }
.card-hero .plate { --size: clamp(124px, 24vh, 232px); }
.card-body { display: flex; flex-direction: column; gap: 12px; padding: 18px 20px 20px; }
.card-title { font-size: clamp(1.55rem, 6.6vw, 2rem); font-weight: 900; line-height: 1.06; letter-spacing: -.03em; }

.pill-btn, .fav-btn {
  position: absolute; top: 14px; z-index: 2; border: 0; cursor: pointer; color: var(--ink-2);
  background: color-mix(in srgb, var(--surface) 80%, transparent); box-shadow: var(--shadow-1);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.pill-btn { left: 14px; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 13px 0 11px; border-radius: 999px; font-size: .85rem; font-weight: 800; }
.pill-btn .i { width: 17px; height: 17px; }
.fav-btn { right: 12px; top: 10px; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; transition: transform .15s; }
.fav-btn .i { width: 23px; height: 23px; }
.fav-btn.on { color: var(--star); }
.fav-btn:active { transform: scale(.88); }

.stamp {
  position: absolute; top: 50%; z-index: 3; padding: 6px 14px; border: 4px solid currentColor; border-radius: 12px; pointer-events: none;
  background: color-mix(in srgb, var(--surface) 88%, transparent); font-size: 1.5rem; font-weight: 900; text-transform: uppercase; letter-spacing: .06em;
  opacity: 0; transition: opacity .12s;
}
.stamp-yes { left: 18px; color: var(--good); transform: translateY(-50%) rotate(-14deg); }
.stamp-no { right: 18px; color: var(--accent); transform: translateY(-50%) rotate(12deg); }
.card[data-drag="right"] .stamp-yes, .card[data-drag="left"] .stamp-no { opacity: 1; }

.badge-line { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; color: var(--accent); font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; }
.badge-line .i { width: 15px; height: 15px; }
.badge-line.mine { color: var(--good); }

.facts, .ingredients { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; list-style: none; }
.fact { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-size: .85rem; font-weight: 700; }
.fact .i { width: 15px; height: 15px; color: var(--muted); }
.fact.e1 { background: var(--good-soft); color: var(--good); }
.fact.e2 { background: var(--warn-soft); color: var(--warn); }
.fact.e3 { background: var(--accent-soft); color: var(--accent); }
.fact.e1 .i, .fact.e2 .i, .fact.e3 .i { color: currentColor; }
.ingredients li { padding: 3px 10px; border-radius: 8px; border: 1px solid var(--line); color: var(--ink-2); font-size: .86rem; }
.why { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .86rem; font-weight: 600; }
.why .i { width: 15px; height: 15px; color: var(--star); }

/* ===== Решението ===== */
.decide {
  position: sticky; bottom: 0; z-index: 5; display: grid; grid-template-columns: 1fr 1.35fr; gap: 10px;
  margin: 0 -16px; padding: 10px 16px calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 72%, transparent);
}
.swipe-hint { grid-column: 1 / -1; text-align: center; color: var(--muted); font-size: .76rem; font-weight: 600; }
.kbd-hint { display: flex; justify-content: center; gap: 18px; margin-top: 14px; color: var(--muted); font-size: .82rem; font-weight: 600; }
kbd {
  display: inline-grid; place-items: center; min-width: 24px; height: 24px; margin-right: 4px; padding: 0 6px;
  border-radius: 6px; border: 1px solid var(--line-2); border-bottom-width: 2px; background: var(--surface);
  color: var(--ink-2); font: 800 .76rem var(--font);
}

/* ===== Въпрос ===== */
.qcard .card-hero { min-height: 120px; padding: 20px 16px; }
.qcard .card-hero .plate { --size: clamp(96px, 17vh, 150px); }
.qcard .card-body { gap: 14px; padding-bottom: 12px; }
.q-head { display: flex; flex-direction: column; gap: 4px; }
.q-options { display: grid; grid-template-columns: repeat(var(--n, 2), 1fr); gap: 10px; }
.q-opt {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 118px; padding: 14px 8px;
  border-radius: 20px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer;
  transition: transform .12s, border-color .15s, background-color .15s;
}
.q-opt:hover { border-color: var(--accent); background: var(--accent-soft); }
.q-opt:active { transform: scale(.97); }
.q-emoji { font-size: 40px; line-height: 1.1; }
.q-label { font-weight: 800; font-size: 1rem; line-height: 1.2; text-align: center; }
.q-count { color: var(--muted); font-size: .76rem; font-weight: 600; }

/* ===== Дуел ===== */
.duel { display: flex; flex-direction: column; justify-content: center; gap: 14px; flex: 1; padding-bottom: 8px; }
.duel-title { font-size: clamp(1.6rem, 6.6vw, 2.1rem); font-weight: 900; line-height: 1.05; letter-spacing: -.03em; }
.duel-grid { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.duel-card {
  display: flex; flex-direction: column; overflow: hidden; padding: 0; text-align: left;
  border-radius: 22px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-2);
  cursor: pointer; transition: transform .15s, box-shadow .15s;
}
.duel-card:hover { transform: translateY(-3px); }
.duel-hero { display: grid; place-items: center; height: 156px; }
.duel-hero .plate { --size: 96px; }
.duel-body { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px 14px; }
.duel-body strong { font-size: 1.02rem; line-height: 1.2; }
.duel-body small { color: var(--muted); font-size: .82rem; font-weight: 600; }
.vs {
  position: absolute; left: 50%; top: 156px; z-index: 2; transform: translate(-50%, -50%);
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; border: 3px solid var(--bg);
  background: var(--ink); color: var(--bg); font-size: .78rem; font-weight: 900;
}

/* ===== Свършиха ===== */
.empty .card-hero { min-height: 200px; padding-top: 28px; }
.empty .card-body { align-items: center; }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 4px; }

/* ===== Странични панели (компютър) ===== */
.side, .peek { display: none; }
.ctx-panel { display: flex; flex-direction: column; gap: 14px; }
.ctx-group { display: flex; flex-direction: column; gap: 6px; }
.pool { color: var(--muted); font-size: .84rem; font-weight: 700; }
.mini-list { display: flex; flex-direction: column; gap: 2px; margin: 8px -6px 0; padding: 0; list-style: none; }
.mini-row {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px; text-align: left;
  border: 0; border-radius: 12px; background: none; font-weight: 700; font-size: .92rem; cursor: pointer;
}
.mini-row:hover { background: var(--surface-2); }
.peek-panel { display: flex; flex-direction: column; gap: 10px; }
.peek-panel .label { margin-top: 6px; }
.peek-ing { columns: 2; column-gap: 18px; padding-left: 18px; color: var(--ink-2); font-size: .92rem; }
.peek-ing small, .peek-steps small { color: var(--muted); }
.peek-steps { display: flex; flex-direction: column; gap: 8px; padding-left: 20px; color: var(--ink-2); font-size: .92rem; }

body[data-view="home"] .toast { bottom: calc(116px + env(safe-area-inset-bottom)); }

/* ===== Компютър ===== */
@media (min-width: 960px) {
  .appbar { border-bottom: 1px solid var(--line); }
  .appbar-inner { height: 70px; max-width: 1240px; margin: 0 auto; padding: 0 32px; gap: 16px; }
  .tabs { display: flex; gap: 4px; margin-left: auto; padding: 4px; border-radius: 14px; background: var(--surface-2); }
  .tab { padding: 9px 16px; border: 0; border-radius: 10px; background: transparent; color: var(--ink-2); font-weight: 800; font-size: .94rem; cursor: pointer; }
  .tab:hover { color: var(--ink); }
  .tab.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

  .home {
    display: grid; grid-template-columns: 300px minmax(0, 480px); justify-content: center; align-items: start; gap: 32px;
    max-width: 1240px; min-height: 0; margin: 0 auto; padding: 32px 32px 56px;
  }
  .side { position: sticky; top: 102px; display: flex; flex-direction: column; gap: 16px; }
  .side .today { margin: 0; }
  .stack { flex: none; min-height: 0; margin-bottom: 26px; }
  .card { flex: none; }
  .card-hero { flex: none; height: 270px; }
  .decide { position: static; margin: 0; padding: 0; background: none; }
  .duel { padding-top: 12px; }
  body[data-view="home"] .toast { bottom: 28px; }
}
@media (min-width: 1240px) {
  .home { grid-template-columns: 290px 470px minmax(0, 1fr); }
  .peek { display: block; position: sticky; top: 102px; }
}
