:root {
  --bg: #070a10;
  --bg-soft: #0d1219;
  --card: #121924;
  --card-hi: #18212f;
  --line: #1f2b3b;
  --text: #e8eef7;
  --muted: #8697ad;
  --accent: #38bdf8;
  --accent-2: #a78bfa;
  --gold: #f5c518;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --radius: 18px;
  --tap: 46px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Атрибут hidden должен побеждать любые display из классов (.wide, .pay-row и т.д.) */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
  background:
    radial-gradient(1200px 500px at 50% -10%, #12213a 0%, transparent 60%),
    var(--bg);
}

.glow {
  position: fixed;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .35;
  pointer-events: none;
  z-index: 0;
}
.glow-a { background: #1d4ed8; top: -120px; left: -80px; }
.glow-b { background: #7c3aed; bottom: -160px; right: -100px; opacity: .25; }

/* ── Шапка ───────────────────────────────────────── */
.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 10px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-weight: 800;
  letter-spacing: .5px;
  font-size: 15px;
  color: #06121b;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px rgba(56, 189, 248, .25);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 15px; letter-spacing: .3px; }
.brand-sub { font-size: 11.5px; color: var(--muted); }

.lang-btn {
  min-width: 52px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: .5px;
  cursor: pointer;
  transition: .15s;
}
.lang-btn:active { transform: scale(.96); }

main { position: relative; z-index: 1; padding: 4px 16px 8px; }
.view { animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Герой ───────────────────────────────────────── */
.hero {
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(56,189,248,.14), rgba(167,139,250,.10)),
    var(--card);
  margin-bottom: 16px;
}
.hero h1 { margin: 0 0 6px; font-size: 20px; line-height: 1.2; }
.hero p { margin: 0; font-size: 13px; color: var(--muted); }

/* ── Игры ────────────────────────────────────────── */
.games {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 8px;
  margin-bottom: 18px;
}
.game {
  position: relative;
  padding: 12px 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: .18s;
  overflow: hidden;
}
.game::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--g-accent, var(--accent));
  opacity: 0;
  transition: .2s;
}
.game span { position: relative; z-index: 1; }
.game.active {
  color: #06121b;
  border-color: transparent;
  background: var(--g-accent, var(--accent));
  box-shadow: 0 8px 20px -8px var(--g-accent, var(--accent));
}

/* ── Заголовки ───────────────────────────────────── */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
}
.section-head h2 { margin: 0; font-size: 17px; }
.hint { font-size: 12px; color: var(--muted); }

/* ── Товары ──────────────────────────────────────── */
.products { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.product {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  text-align: left;
  gap: 10px;
  min-height: 108px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, var(--card-hi), var(--card));
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: .16s;
}
.product:active { transform: scale(.985); border-color: var(--accent); }
.product .amount {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .2px;
}
.product .amount small { font-size: 11.5px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.product .price {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  padding: 5px 10px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 700;
  color: #06121b;
  background: linear-gradient(135deg, #7dd3fc, #38bdf8);
}
.product::after {
  content: "";
  position: absolute;
  top: 0; right: 0;
  width: 46px; height: 46px;
  background: radial-gradient(circle at top right, rgba(56,189,248,.22), transparent 70%);
}

/* ── Заказы ──────────────────────────────────────── */
.orders { display: flex; flex-direction: column; gap: 10px; }
.order {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
}
.order-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.order-title { font-size: 15px; font-weight: 700; }
.order-num { font-size: 11.5px; color: var(--muted); }
.order-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); }
.order-meta b { color: var(--text); font-weight: 600; }
.badge {
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .2px;
  white-space: nowrap;
}
.badge.created, .badge.awaiting_payment { background: rgba(251,191,36,.14); color: var(--warn); }
.badge.paid, .badge.processing { background: rgba(56,189,248,.14); color: var(--accent); }
.badge.done { background: rgba(52,211,153,.14); color: var(--ok); }
.badge.cancelled { background: rgba(248,113,113,.14); color: var(--err); }

/* ── Панели / профиль ────────────────────────────── */
.panel {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  margin-bottom: 12px;
}
.panel h3 { margin: 0 0 10px; font-size: 14.5px; }
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  font-size: 13.5px;
  color: var(--muted);
  border-bottom: 1px solid rgba(31,43,59,.6);
}
.row:last-child { border-bottom: 0; }
.row b { color: var(--text); }
.steps { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.steps li { margin-bottom: 6px; }
.muted { color: var(--muted); font-size: 13px; margin: 0 0 10px; }

/* ── Кнопки ──────────────────────────────────────── */
.primary-btn {
  min-height: var(--tap);
  padding: 0 18px;
  border: 0;
  border-radius: 13px;
  font-size: 14.5px;
  font-weight: 700;
  color: #06121b;
  background: linear-gradient(135deg, #7dd3fc, #38bdf8);
  cursor: pointer;
  transition: .15s;
}
.primary-btn:active { transform: scale(.98); }
.primary-btn:disabled { opacity: .55; cursor: default; }
.ghost-btn {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
}
.ghost-btn:active { transform: scale(.97); }
.wide { display: block; width: 100%; margin-top: 10px; }

/* ── Нижнее меню ─────────────────────────────────── */
.tabbar {
  position: fixed;
  z-index: 5;
  left: 0; right: 0; bottom: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(9,13,19,.92);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 4px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
}
.tab-ico { font-size: 16px; line-height: 1; }
.tab.active { color: var(--accent); background: rgba(56,189,248,.10); }

/* ── Шит заказа ──────────────────────────────────── */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 8;
  background: rgba(3,6,10,.72);
  backdrop-filter: blur(3px);
  animation: fade .18s ease;
}
.sheet {
  position: fixed;
  z-index: 9;
  left: 0; right: 0; bottom: 0;
  max-height: 92vh;
  overflow-y: auto;
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
  border-radius: 22px 22px 0 0;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  box-shadow: 0 -18px 48px rgba(0,0,0,.55);
  animation: slide .24s cubic-bezier(.2,.9,.3,1);
}
@keyframes slide { from { transform: translateY(100%); } to { transform: none; } }
.sheet-handle {
  width: 40px;
  height: 4px;
  margin: 4px auto 14px;
  border-radius: 99px;
  background: var(--line);
}
.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.sheet-game { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.sheet-head h3 { margin: 2px 0 0; font-size: 19px; }
.sheet-price { font-size: 17px; font-weight: 800; color: var(--accent); white-space: nowrap; }

.field { display: block; margin-bottom: 12px; }
.field span { display: block; margin-bottom: 6px; font-size: 12px; color: var(--muted); }
.field input {
  width: 100%;
  min-height: var(--tap);
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 14.5px;
  font-family: inherit;
  outline: none;
  transition: .15s;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56,189,248,.12); }
.field input::placeholder { color: #5b6b80; }

.sheet-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  margin-top: 4px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--muted);
}
.sheet-total b { font-size: 18px; color: var(--text); }

/* ── Прочее ──────────────────────────────────────── */
.empty { padding: 28px 0; text-align: center; color: var(--muted); font-size: 13.5px; }

/* ── Оплата ──────────────────────────────────────── */
.methods { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.method {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 54px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: .15s;
}
.method small { display: block; margin-top: 2px; font-size: 11.5px; font-weight: 500; color: var(--muted); }
.method.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(56,189,248,.14); }
.method .dot {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--line);
  flex: 0 0 auto;
}
.method.active .dot { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 3px var(--card); }

.pay-body { animation: fade .18s ease; }
.pay-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(31,43,59,.7);
  font-size: 12.5px;
  color: var(--muted);
}
.pay-row b {
  grid-column: 1;
  color: var(--text);
  font-size: 14px;
  word-break: break-all;
  user-select: all;
}
.pay-row .copy-btn {
  grid-row: 1 / span 2;
  grid-column: 2;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--card-hi);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.pay-row .copy-btn:active { transform: scale(.96); }

.pay-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 6px;
  font-size: 14px;
  color: var(--muted);
}
.pay-total b { font-size: 20px; color: var(--text); }
.pay-hint { margin: 4px 0 12px; font-size: 12.5px; color: var(--muted); }
.pay-hint.warn { color: var(--warn); }
.pay-status {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 11px;
  background: rgba(56,189,248,.12);
  color: var(--accent);
  font-size: 13px;
  text-align: center;
}
.pay-status.ok { background: rgba(52,211,153,.14); color: var(--ok); }
.pay-status.err { background: rgba(248,113,113,.14); color: var(--err); }
.pay-sheet .sheet-head { margin-bottom: 12px; }
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: 88vw;
  padding: 10px 16px;
  border-radius: 12px;
  background: #1b2534;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
  text-align: center;
  animation: fade .18s ease;
}
.toast.err { border-color: rgba(248,113,113,.5); color: #fecaca; }

@media (min-width: 520px) {
  main { max-width: 520px; margin: 0 auto; }
  .topbar { max-width: 520px; margin: 0 auto; }
  .tabbar { max-width: 520px; margin: 0 auto; border-radius: 16px 16px 0 0; }
  .sheet { max-width: 520px; margin: 0 auto; border-radius: 22px 22px 0 0; }
}
