/* «Угли на Овцинской» — тема: угли, жар, огонь */
:root {
  --bg: #16110e;
  --bg2: #1f1713;
  --card: #241a15;
  --card2: #2d2019;
  --line: #3a2a20;
  --ember: #e8590c;
  --ember2: #c92a2a;
  --gold: #ffb703;
  --text: #f5efe9;
  --muted: #a89a90;
  --ok: #74c69d;
  --danger: #ff6b6b;
  --grad: linear-gradient(135deg, #e8590c 0%, #c92a2a 100%);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: radial-gradient(1200px 500px at 50% -200px, #2d1a10 0%, var(--bg) 60%);
  color: var(--text);
  font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .display { font-family: 'Russo One', 'Inter', sans-serif; font-weight: 400; letter-spacing: .3px; }
.page { max-width: 480px; margin: 0 auto; padding: 16px 16px 90px; }
.wide { max-width: 980px; padding-bottom: 24px; }

.brand { display: flex; align-items: center; gap: 12px; padding: 8px 0 16px; }
.brand img { width: 44px; height: 44px; border-radius: 50%; background: #fff; }
.brand .name { font-family: 'Russo One', sans-serif; font-size: 18px; line-height: 1.2; }
.brand .sub { color: var(--muted); font-size: 12px; }
.chip { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: var(--card2); color: var(--gold); border: 1px solid var(--line); margin-left: auto; }

.card {
  background: linear-gradient(180deg, var(--card) 0%, var(--bg2) 100%);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.card h2 { font-size: 17px; margin-bottom: 12px; }
.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; }

.btn {
  display: inline-block; width: 100%;
  background: var(--grad); color: #fff; border: 0;
  font-family: 'Russo One', sans-serif; font-size: 16px;
  padding: 14px 18px; border-radius: 14px; cursor: pointer;
  box-shadow: 0 6px 18px rgba(232, 89, 12, .35);
  transition: transform .1s, opacity .2s; text-align: center; text-decoration: none;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: default; box-shadow: none; }
.btn.ghost { background: var(--card2); box-shadow: none; border: 1px solid var(--line); color: var(--text); }
.btn.small { width: auto; padding: 10px 14px; font-size: 14px; }

input, select {
  width: 100%; background: var(--bg2); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 14px; font-size: 16px; outline: none;
}
input:focus, select:focus { border-color: var(--ember); }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 6px; }

.stamps { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding: 8px 0; }
.stamp {
  width: 46px; height: 46px; border-radius: 50%;
  border: 2px dashed var(--line); display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: var(--line); transition: all .3s;
}
.stamp.lit {
  border: 2px solid var(--ember); color: inherit;
  background: radial-gradient(circle at 50% 60%, #5a2510 0%, var(--card2) 70%);
  box-shadow: 0 0 14px rgba(232, 89, 12, .55);
  animation: emberpulse 2.5s ease-in-out infinite;
}
@keyframes emberpulse {
  0%, 100% { box-shadow: 0 0 10px rgba(232,89,12,.4); }
  50% { box-shadow: 0 0 18px rgba(255,183,3,.6); }
}

.balance-big { font-family: 'Russo One', sans-serif; font-size: 44px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Кофейные зёрна: SVG-зёрна, сетка адаптируется под цель (размер через --bs) */
.beans-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 8px 0 4px; }
.bean-svg {
  width: var(--bs, 40px); height: calc(var(--bs, 40px) * 1.3);
  transform: rotate(-9deg); transition: all .3s;
}
.beans-row .bean-svg:nth-child(even) { transform: rotate(8deg); }
.bean-svg.full { filter: drop-shadow(0 2px 4px rgba(0,0,0,.5)); }
.bean-svg.pop { animation: beanpop .35s cubic-bezier(.2,1.5,.4,1); }
@keyframes beanpop { from { transform: scale(.4) rotate(-9deg); } to { transform: scale(1) rotate(-9deg); } }

#qr-box { background: #fff; border-radius: 16px; padding: 14px; width: fit-content; margin: 0 auto; }
#qr-box img, #qr-box canvas { display: block; }

.nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: rgba(22, 17, 14, .96); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-around; padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
}
.nav a { color: var(--muted); text-decoration: none; font-size: 11px; text-align: center; flex: 1; }
.nav a .ico { font-size: 22px; display: block; margin-bottom: 2px; filter: grayscale(1) opacity(.6); }
.nav a.active { color: var(--gold); }
.nav a.active .ico { filter: none; }

.coupon-item {
  border: 1px dashed var(--gold); border-radius: 14px; padding: 14px; margin-bottom: 10px;
  background: linear-gradient(135deg, rgba(255,183,3,.06), transparent);
}
.coupon-item .code { font-family: 'Russo One', sans-serif; font-size: 20px; color: var(--gold); letter-spacing: 2px; }

.history-item { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.history-item:last-child { border-bottom: 0; }
.plus { color: var(--ok); } .minus { color: var(--danger); }

/* Колесо */
.wheel-wrap { position: relative; width: 300px; height: 300px; margin: 10px auto; }
.wheel {
  width: 100%; height: 100%; border-radius: 50%;
  border: 6px solid #3a2a20; box-shadow: 0 0 0 4px #16110e, 0 0 40px rgba(232,89,12,.25), inset 0 0 30px rgba(0,0,0,.5);
  position: relative; overflow: hidden;
  transition: transform 5s cubic-bezier(.17,.67,.12,.99);
}
.wheel .sector-label {
  position: absolute; left: 50%; top: 50%; transform-origin: 0 0;
  font-size: 11px; font-family: 'Russo One', sans-serif; color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.7); white-space: nowrap;
}
.wheel-pointer {
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%); z-index: 5;
  width: 0; height: 0; border-left: 14px solid transparent; border-right: 14px solid transparent;
  border-top: 22px solid var(--gold); filter: drop-shadow(0 2px 4px rgba(0,0,0,.5));
}
.wheel-logo {
  position: absolute; top: 50%; left: 50%; margin: -34px 0 0 -34px; z-index: 4;
  width: 68px; height: 68px; border-radius: 50%; background: #fff;
  padding: 5px; object-fit: contain; box-sizing: border-box;
  border: 3px solid var(--gold); box-shadow: 0 0 18px rgba(232,89,12,.65);
}

/* Анимация победы */
.win-particle {
  position: fixed; left: 50%; top: 42%; z-index: 400; pointer-events: none;
  font-size: 16px; width: 10px; height: 10px; border-radius: 2px;
  animation: winfly 1.5s cubic-bezier(.15,.6,.35,1) forwards;
}
@keyframes winfly {
  0% { transform: translate(0, 0) rotate(0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(.6); opacity: 0; }
}
.prize-pop { animation: prizepop .55s cubic-bezier(.2,1.6,.4,1); }
@keyframes prizepop {
  0% { transform: scale(.4); opacity: 0; }
  70% { transform: scale(1.12); }
  100% { transform: scale(1); opacity: 1; }
}

.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.65); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 24px; max-width: 380px; width: 100%; text-align: center; }
.modal .prize-title { font-family: 'Russo One', sans-serif; font-size: 22px; margin: 10px 0; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

#toast-stack {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 300;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; max-width: 92%;
}
.toast {
  background: var(--card2); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 18px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.5); max-width: 100%;
}
.toast.ok { border-color: var(--ok); } .toast.err { border-color: var(--danger); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--card2); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.stat .v { font-family: 'Russo One', sans-serif; font-size: 24px; }
.stat .l { color: var(--muted); font-size: 12px; margin-top: 2px; }
.hidden { display: none !important; }

/* Вкладка «Игры» */
#games-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.game-card {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; cursor: pointer;
  border-radius: 16px; border: 1px solid color-mix(in srgb, var(--c) 55%, transparent);
  background: color-mix(in srgb, var(--c) 14%, var(--card));
  transition: transform .08s; user-select: none; -webkit-user-select: none;
}
.game-card:active { transform: scale(.97); }
.game-card .g-ico { font-size: 30px; }
.game-card .g-info { flex: 1; min-width: 0; }
.game-card .g-name { font-family: 'Russo One', sans-serif; font-size: 16px; }
.game-card .g-info .muted { font-size: 12px; margin-top: 2px; }
.game-card .g-go {
  width: 38px; height: 38px; border-radius: 50%; background: var(--c); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
  box-shadow: 0 0 12px color-mix(in srgb, var(--c) 60%, transparent);
}
/* Таблица лидеров */
.lb-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.lb-tabs::-webkit-scrollbar { display: none; }
.lb-tab { flex-shrink: 0; background: var(--card2); border: 1px solid var(--line); color: var(--muted);
  border-radius: 18px; padding: 8px 14px; font-size: 13px; cursor: pointer; white-space: nowrap;
  font-family: inherit; }
.lb-tab.small { padding: 5px 12px; font-size: 12px; }
.lb-tab.active { color: var(--gold); border-color: var(--gold); background: rgba(255,183,3,.08); }
.lb-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.lb-row:last-child { border-bottom: 0; }
.lb-row .pl { width: 26px; text-align: center; font-family: 'Russo One', sans-serif; color: var(--muted); font-size: 13px; }
.lb-row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row .sc { font-family: 'Russo One', sans-serif; color: var(--gold); font-variant-numeric: tabular-nums; }
.lb-row.mine { background: rgba(232,89,12,.1); border-radius: 10px; padding-left: 6px; padding-right: 6px; }
.lb-row.top1 .pl, .lb-row.top2 .pl, .lb-row.top3 .pl { font-size: 16px; }
.lb-mine-box { margin-top: 12px; padding: 12px 14px; border: 1px dashed var(--ember); border-radius: 12px;
  font-size: 13.5px; display: flex; align-items: center; gap: 10px; }
.lb-mine-box b { font-family: 'Russo One', sans-serif; color: var(--gold); }

/* Итог партии рисуется поверх полноэкранной игры */
.play-sheet { z-index: 600; }
.ps-points { font-family: 'Russo One', sans-serif; font-size: 34px; margin: 6px 0 2px; color: var(--gold); }
.ps-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.reward-card { border-color: var(--ember); background: linear-gradient(180deg, rgba(232,89,12,.14), var(--card) 70%); }
.rb-title { font-family: 'Russo One', sans-serif; font-size: 17px; line-height: 1.35; }
.rb-rules { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.rb-rule { display: flex; align-items: baseline; gap: 8px; font-size: 14px; }
.rb-rule .rr-ico { font-size: 15px; }
.rb-rule .rr-txt { flex: 1; }
.rb-rule .rr-left { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.rb-rule.spent .rr-txt, .rb-rule.spent .rr-ico { opacity: .45; }

#game-frame { position: fixed; inset: 0; z-index: 500; background: var(--bg); }
#game-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
#game-close {
  position: fixed; top: 12px; right: 12px; z-index: 501;
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line);
  background: rgba(22,17,14,.85); color: var(--text); font-size: 17px; cursor: pointer;
}

/* Меню заведения */
.menu-cat { margin-bottom: 20px; }
.menu-cat-title { font-size: 15px; color: var(--gold); margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); scroll-margin-top: 12px; }
.menu-cat-title .dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 8px; }
.cat-head.menu-cat-title { border-bottom: 0; padding-bottom: 0; }

/* Боковая рейка разделов меню (как у кассира) — видна только на вкладке «Меню» */
#menu-rail { position: fixed; left: 8px; top: 50%; transform: translateY(-50%); z-index: 90;
  display: flex; flex-direction: column; gap: 7px; }
#menu-rail .rail-btn { width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--c);
  background: color-mix(in srgb, var(--c) 22%, var(--bg2));
  display: flex; align-items: center; justify-content: center; font-size: 19px;
  cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,.45);
  transition: transform .12s, box-shadow .12s; user-select: none; -webkit-user-select: none; }
#menu-rail .rail-btn.active { background: var(--c); transform: scale(1.12);
  box-shadow: 0 0 14px color-mix(in srgb, var(--c) 70%, transparent); }
body.menu-rail-on .page { padding-left: 62px; }

/* Плитки меню (общие для гостя и кассира) */
.cat-head { font-family: 'Russo One', sans-serif; font-size: 14px; margin: 14px 0 8px;
  display: flex; align-items: center; gap: 8px; scroll-margin-top: 10px; }
.cat-head .dot { width: 12px; height: 12px; border-radius: 50%; }
.tile-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.tile { position: relative; border-radius: 14px; padding: 10px 12px 12px; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--c) 55%, transparent);
  background: color-mix(in srgb, var(--c) 14%, var(--card));
  transition: transform .06s; user-select: none; -webkit-user-select: none; }
.tile:active { transform: scale(.97); }
.tile.sold-out { opacity: .42; filter: grayscale(.75); }
.tile.sold-out .t-var { color: var(--danger); }
.tile.sold-out .t-price { text-decoration: line-through; }
.tile .t-name { font-size: 13px; line-height: 1.25; }
.tile .t-var { font-size: 11px; color: var(--muted); }
.tile .t-price { font-family: 'Russo One', sans-serif; font-size: 15px; margin-top: 4px; }
.tile .t-qty { position: absolute; top: -7px; right: -6px; min-width: 24px; height: 24px;
  border-radius: 12px; background: var(--c); color: #fff; font-family: 'Russo One', sans-serif;
  font-size: 13px; display: flex; align-items: center; justify-content: center; padding: 0 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.tile .t-minus { position: absolute; bottom: 6px; right: 6px; width: 30px; height: 30px;
  border-radius: 10px; border: 1px solid var(--line); background: rgba(0,0,0,.35);
  color: var(--text); font-size: 17px; line-height: 1; cursor: pointer; }

/* Выбор размера: затемнение + плитки размеров */
.size-overlay { position: fixed; inset: 0; z-index: 300;
  background: rgba(10, 7, 5, .8); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: ovfadein .15s ease-out; }
@keyframes ovfadein { from { opacity: 0; } to { opacity: 1; } }
.size-panel { width: 100%; max-width: 420px; }
.size-panel h3 { font-family: 'Russo One', sans-serif; font-size: 17px;
  display: flex; align-items: center; gap: 10px; }
.size-panel h3 .dot { width: 14px; height: 14px; border-radius: 50%; }
.size-panel .tile { animation: tilepop .18s ease-out; }
@keyframes tilepop { from { transform: scale(.9); opacity: .3; } to { transform: none; opacity: 1; } }
#guest-cart-bar { position: fixed; left: 70px; right: 12px; z-index: 99;
  bottom: calc(64px + env(safe-area-inset-bottom));
  max-width: 420px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(180deg, var(--card) 0%, var(--bg2) 100%);
  border: 1px solid var(--gold); border-radius: 16px; padding: 10px 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.55); }
#guest-cart-info { flex: 1; font-size: 14px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#guest-cart-info b { font-family: 'Russo One', sans-serif; color: var(--gold); }
#guest-cart-clear { color: var(--muted); cursor: pointer; font-size: 18px; padding: 2px 6px; }
.menu-row { display: flex; align-items: baseline; gap: 6px; padding: 5px 0; font-size: 14px; }
.menu-row.multi { padding-bottom: 0; }
.menu-row.sub { padding: 2px 0 2px 14px; }
.menu-name { flex-shrink: 1; }
.menu-dots { flex: 1; border-bottom: 1px dotted var(--line); min-width: 12px; }
.menu-price { font-family: 'Russo One', sans-serif; font-size: 14px; color: var(--text); white-space: nowrap; }
