/* FOOD-рулетка — design system */
@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  /* surfaces — deep near-black with subtle warm-cool blend */
  --bg:        #0a0c0f;
  --surface:   #14171c;
  --surface-2: #1b1f26;
  --surface-3: #232831;
  --line:      rgba(255,255,255,0.06);
  --line-2:    rgba(255,255,255,0.10);

  /* type */
  --fg:        #f4f6f8;
  --fg-2:      #c4ccd4;
  --muted:     #6b7480;
  --dim:       #4a5260;

  /* accent — electric lime (low-carb / fresh) */
  --acc:       #c8ff2e;
  --acc-soft:  rgba(200,255,46,0.14);
  --acc-glow:  rgba(200,255,46,0.40);
  --acc-ink:   #0a0c0f;

  /* rarity tiers (by carbs: lower = rarer) */
  --r-legend:  #ffb800;
  --r-legend-soft: rgba(255,184,0,0.13);
  --r-epic:    #b67dff;
  --r-epic-soft:   rgba(182,125,255,0.13);
  --r-rare:    #4ea7ff;
  --r-rare-soft:   rgba(78,167,255,0.13);
  --r-common:  #8a93a0;
  --r-common-soft: rgba(138,147,160,0.12);

  /* semantic */
  --ok:        #5fe39c;
  --danger:    #ff5466;
  --warn:      #ffb800;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: #1a1a1f;
  color: var(--fg);
  font-family: 'Geist', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}
button { font-family: inherit; }
input { font-family: inherit; }

.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-feature-settings: 'tnum'; }

/* ── App shell inside iPhone ─────────────────────────────────────── */
.tg-app {
  background:
    radial-gradient(900px 600px at 50% -10%, rgba(200,255,46,0.05), transparent 60%),
    radial-gradient(700px 500px at 100% 100%, rgba(78,167,255,0.04), transparent 60%),
    var(--bg);
  min-height: 100%;
  color: var(--fg);
  padding: 0 0 48px;
}
.tg-app.has-appbar { padding-top: 0; }
.tg-app.no-appbar  { padding-top: 64px; }

/* ── Top app bar ─────────────────────────────────────────────────── */
.appbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 64px 20px 12px;
  background:
    linear-gradient(180deg, rgba(10,12,15,1) 0%, rgba(10,12,15,0.96) 70%, rgba(10,12,15,0.6) 90%, rgba(10,12,15,0));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.appbar-back {
  background: none; border: none; color: var(--fg);
  font-size: 15px; font-weight: 500;
  display: flex; align-items: center; gap: 4px;
  padding: 4px 8px 4px 0; margin-left: -8px;
  cursor: pointer;
}
.appbar-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }

/* ── HUD chips ───────────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
}
.chip-credit {
  background: linear-gradient(180deg, rgba(200,255,46,0.16), rgba(200,255,46,0.06));
  border-color: rgba(200,255,46,0.30);
  color: var(--acc);
}
.chip-credit .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--acc); box-shadow: 0 0 8px var(--acc-glow);
}

/* ── Section header ──────────────────────────────────────────────── */
.section-eyebrow {
  text-transform: uppercase; font-size: 11px; letter-spacing: 0.12em;
  color: var(--muted); font-weight: 600;
}

/* ── Card surfaces ───────────────────────────────────────────────── */
.surface {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
}

/* ── Primary CTA / Case button on home ───────────────────────────── */
.case-cta {
  position: relative; overflow: hidden;
  border-radius: 22px;
  border: 1px solid rgba(200,255,46,0.30);
  background:
    radial-gradient(800px 220px at 70% 0%, rgba(200,255,46,0.22), transparent 60%),
    linear-gradient(180deg, #1a1f12 0%, #11140c 100%);
  padding: 22px 22px 24px;
  cursor: pointer; transition: transform 0.15s ease;
  width: 100%; text-align: left;
  color: inherit;
}
.case-cta:hover { transform: translateY(-1px); }
.case-cta:active { transform: translateY(0); }

.case-cta::before {
  content: ''; position: absolute; right: -40px; top: -40px;
  width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(closest-side, var(--acc), transparent 70%);
  opacity: 0.35;
  filter: blur(8px);
}

/* tile button (secondary actions on home) */
.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
  text-align: left; cursor: pointer; color: inherit;
  transition: border-color 0.15s, background 0.15s;
  min-height: 92px;
}
.tile:hover { border-color: var(--line-2); background: var(--surface-2); }
.tile-icon {
  width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-3);
  color: var(--fg-2);
}
.tile-title { font-weight: 600; font-size: 14px; }
.tile-sub { font-size: 12px; color: var(--muted); }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  height: 46px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--fg);
  font-weight: 600; font-size: 15px;
  cursor: pointer;
  transition: background 0.12s, transform 0.05s;
  width: 100%;
}
.btn:active { transform: scale(0.985); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary {
  background: var(--acc);
  color: var(--acc-ink);
  box-shadow: 0 0 0 1px rgba(200,255,46,0.30), 0 8px 24px -8px var(--acc-glow);
}
.btn-primary:hover:not(:disabled) { background: #d5ff4f; }
.btn-ghost {
  background: transparent;
  border-color: var(--line-2);
}
.btn-danger {
  background: rgba(255,84,102,0.10);
  color: var(--danger);
  border-color: rgba(255,84,102,0.20);
}
.btn-sm { height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }

/* ── Rarity card (case slot reveal) ──────────────────────────────── */
.slot-card {
  position: relative;
  padding: 16px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
  display: flex; align-items: center; gap: 12px;
}
.slot-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--rarity-color, var(--r-common));
}
.slot-card .glow {
  position: absolute; left: -30px; top: -30px;
  width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(closest-side, var(--rarity-color, var(--r-common)), transparent 70%);
  opacity: 0.18; pointer-events: none;
}
.slot-icon {
  position: relative;
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--surface-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  border: 1px solid var(--rarity-soft, var(--line));
  flex-shrink: 0;
}
.slot-meta { flex: 1; min-width: 0; }
.slot-eyebrow {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--muted); font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}
.slot-eyebrow .rarity-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--rarity-color, var(--r-common));
  box-shadow: 0 0 6px var(--rarity-color, var(--r-common));
}
.slot-name {
  font-size: 16px; font-weight: 600; margin-top: 2px;
  letter-spacing: -0.01em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; line-height: 1.25;
}
.slot-carbs {
  font-size: 12px; color: var(--fg-2);
  margin-top: 3px;
}
.slot-carbs b {
  color: var(--rarity-color, var(--fg));
}

/* ── Rarity utility classes ──────────────────────────────────────── */
.r-legend  { --rarity-color: var(--r-legend);  --rarity-soft: var(--r-legend-soft); }
.r-epic    { --rarity-color: var(--r-epic);    --rarity-soft: var(--r-epic-soft); }
.r-rare    { --rarity-color: var(--r-rare);    --rarity-soft: var(--r-rare-soft); }
.r-common  { --rarity-color: var(--r-common);  --rarity-soft: var(--r-common-soft); }

/* ── Roulette ────────────────────────────────────────────────────── */
.roulette {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  padding: 16px 0;
}
.roulette::before, .roulette::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 64px;
  pointer-events: none; z-index: 3;
}
.roulette::before {
  left: 0;
  background: linear-gradient(90deg, var(--surface) 0%, transparent 100%);
}
.roulette::after {
  right: 0;
  background: linear-gradient(270deg, var(--surface) 0%, transparent 100%);
}
.roulette-pointer-top, .roulette-pointer-bottom {
  position: absolute; left: 50%; transform: translateX(-50%);
  width: 0; height: 0; z-index: 5;
}
.roulette-pointer-top {
  top: 4px;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 10px solid var(--acc);
  filter: drop-shadow(0 0 6px var(--acc-glow));
}
.roulette-pointer-bottom {
  bottom: 4px;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 10px solid var(--acc);
  filter: drop-shadow(0 0 6px var(--acc-glow));
}
.roulette-center-line {
  position: absolute; left: 50%; top: 18px; bottom: 18px; width: 2px;
  background: linear-gradient(180deg, transparent, var(--acc) 25%, var(--acc) 75%, transparent);
  transform: translateX(-50%);
  box-shadow: 0 0 12px var(--acc-glow);
  z-index: 2;
}

.roulette-strip {
  display: flex; gap: 10px; padding: 0 16px;
  will-change: transform;
}
.roulette-strip.spinning {
  transition: transform 5.2s cubic-bezier(0.10, 0.65, 0.18, 1.0);
}

.case-card {
  flex: 0 0 120px;
  height: 144px;
  background: var(--surface-2);
  border: 1px solid var(--rarity-soft, var(--line));
  border-radius: 12px;
  padding: 12px;
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.case-card::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: var(--rarity-color, var(--r-common));
}
.case-card::after {
  content: ''; position: absolute; left: -20px; bottom: -20px;
  width: 80px; height: 80px; border-radius: 50%;
  background: radial-gradient(closest-side, var(--rarity-color, transparent), transparent 65%);
  opacity: 0.20;
}
.case-card .cc-name {
  font-size: 13px; font-weight: 600; line-height: 1.25;
  position: relative; z-index: 1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.case-card .cc-carbs {
  font-size: 11px; color: var(--rarity-color, var(--fg-2));
  font-weight: 600; position: relative; z-index: 1;
}
.case-card .cc-slot {
  font-size: 9px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted); position: relative; z-index: 1; margin-top: 2px;
}

/* ── Progress ring + bar ─────────────────────────────────────────── */
.progress-bar {
  height: 8px; border-radius: 999px;
  background: var(--surface-2); overflow: hidden;
  position: relative;
}
.progress-bar .fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--acc) 0%, #6cdf94 100%);
  transition: width 0.3s ease;
}

/* ── Checkbox / report toggle ────────────────────────────────────── */
.report-check {
  width: 36px; height: 36px; border-radius: 12px;
  border: 1.5px solid var(--line-2);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: all 0.15s;
}
.report-check.on {
  background: var(--acc);
  border-color: var(--acc);
  box-shadow: 0 0 16px var(--acc-glow);
}
.report-check.on svg path { stroke: var(--acc-ink); }
.report-check svg { width: 16px; height: 16px; }
.report-check svg path { stroke: var(--muted); stroke-width: 2.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* ── Tabs ────────────────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 4px 4px;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex-shrink: 0;
  height: 36px; padding: 0 14px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--fg-2);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.tab.active {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}
.tab .count {
  font-size: 11px;
  background: rgba(0,0,0,0.15);
  padding: 1px 6px;
  border-radius: 999px;
  color: inherit;
  opacity: 0.65;
}
.tab.active .count { background: rgba(0,0,0,0.20); }

/* ── Input ───────────────────────────────────────────────────────── */
.input-field {
  display: flex; flex-direction: column; gap: 6px;
}
.input-field label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--muted); font-weight: 600;
}
.input {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  color: var(--fg);
  font-size: 15px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.input:focus {
  border-color: var(--acc);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--acc-soft);
}

/* ── Dish row in menu editor ─────────────────────────────────────── */
.dish-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.dish-row .name { flex: 1; font-weight: 500; }
.dish-row .carbs-chip {
  font-size: 12px; font-weight: 600;
  padding: 4px 9px; border-radius: 8px;
  background: var(--rarity-soft, var(--surface-2));
  color: var(--rarity-color, var(--fg-2));
  border: 1px solid var(--rarity-soft, var(--line));
}
.dish-row .delete {
  background: none; border: none; color: var(--muted);
  cursor: pointer; padding: 4px;
  display: flex; align-items: center;
}
.dish-row .delete:hover { color: var(--danger); }

/* ── Stat tile ───────────────────────────────────────────────────── */
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.stat-tile .label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--muted); font-weight: 600;
}
.stat-tile .value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 32px; font-weight: 700; letter-spacing: -0.02em;
  line-height: 1; color: var(--fg);
  font-feature-settings: 'tnum';
}
.stat-tile .unit { font-size: 14px; color: var(--muted); font-weight: 500; }
.stat-tile .delta {
  font-size: 11px; color: var(--ok); font-weight: 600;
  display: inline-flex; align-items: center; gap: 3px;
}

/* ── Day bar chart (week) ────────────────────────────────────────── */
.daybar {
  display: flex; align-items: flex-end; gap: 6px;
  height: 80px;
}
.daybar .col {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
  height: 100%;
}
.daybar .col .bar {
  width: 100%; max-width: 22px;
  background: var(--surface-2);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}
.daybar .col .bar .fill {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--bar-color, var(--acc));
  border-radius: 4px;
}
.daybar .col .day {
  font-size: 10px; color: var(--muted);
  font-weight: 600;
}

/* ── Reveal animation ────────────────────────────────────────────── */
@keyframes slot-reveal {
  0%   { opacity: 0; transform: translateY(8px) scale(0.98); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.reveal-anim { opacity: 1; }

@keyframes flash-glow {
  0% { box-shadow: 0 0 0 0 var(--rarity-color); }
  100% { box-shadow: 0 0 0 8px transparent; }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}
.pulse { animation: pulse-dot 1.6s ease-in-out infinite; }

/* ── Empty state ─────────────────────────────────────────────────── */
.empty {
  padding: 32px 20px; text-align: center; color: var(--muted);
  border: 1px dashed var(--line-2); border-radius: 18px;
  background: var(--surface);
}
.empty .icon {
  font-size: 28px; opacity: 0.5; margin-bottom: 8px;
}

/* ── Bottom sheet (extra-snack) ──────────────────────────────────── */
.danger-cta {
  background: linear-gradient(180deg, rgba(255,84,102,0.16), rgba(255,84,102,0.06));
  border: 1px solid rgba(255,84,102,0.25);
  color: var(--danger);
  border-radius: 16px;
  padding: 16px;
  width: 100%;
  font-weight: 600; font-size: 15px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
