/* ====== Тема (цвета переопределяются из настроек админки) ====== */
:root {
  --primary: #7c5cff;
  --accent: #00d2ff;
  --bg1: #0e1020;
  --bg2: #171a31;
  --card: #1b1f38;
  --text: #f2f3ff;
  --muted: #9aa0c3;
  --radius: 18px;
  --danger: #ff5c7a;
  --ok: #2ede8f;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, color-mix(in srgb, var(--primary) 22%, transparent), transparent 60%),
              radial-gradient(900px 500px at -10% 110%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%),
              linear-gradient(160deg, var(--bg1), var(--bg2));
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }
a { color: inherit; text-decoration: none; }
input, textarea, select { font-family: inherit; }

.app { max-width: 520px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.content { flex: 1; padding: 16px 16px calc(86px + env(safe-area-inset-bottom)); animation: fadein .18s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ====== Загрузка ====== */
.boot { min-height: 60vh; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 14px; }
.boot-card { background: var(--card); padding: 24px; border-radius: var(--radius); display: flex; gap: 14px; flex-direction: column; align-items: center; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 3px solid rgba(255,255,255,.15); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ====== Картинки с фолбэком ====== */
.img-fallback { display: flex; align-items: center; justify-content: center; font-size: 26px;
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; }

/* ====== Шапка/баннер ====== */
.shop-head { display: flex; align-items: center; gap: 12px; padding: 6px 2px 16px; }
.shop-logo { width: 42px; height: 42px; border-radius: 12px; object-fit: cover; }
.shop-logo-fallback { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px;
  background: linear-gradient(135deg, var(--primary), var(--accent)); }
.shop-title { font-family: 'Unbounded', 'Inter', sans-serif; font-weight: 800; font-size: 18px; letter-spacing: .3px; }
.shop-tagline { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.banner { position: relative; border-radius: calc(var(--radius) + 4px); overflow: hidden; margin-bottom: 20px; box-shadow: 0 12px 40px rgba(0,0,0,.35); }
.banner img, .banner .img-fallback { width: 100%; display: block; aspect-ratio: 5/2; object-fit: cover; }
.banner-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 18px;
  background: linear-gradient(to top, rgba(0,0,0,.62), transparent 65%); }
.banner-title { font-family: 'Unbounded', sans-serif; font-size: 20px; font-weight: 800; }
.banner-sub { color: #e8e8f5; font-size: 13px; margin-top: 4px; max-width: 90%; }

/* ====== Секции и карточки ====== */
.section-title { font-size: 19px; font-weight: 800; margin: 4px 2px 4px; font-family: 'Unbounded', sans-serif; }
.section-sub { color: var(--muted); font-size: 13px; margin: 0 2px 14px; }

.games-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.game-card { background: var(--card); border-radius: var(--radius); overflow: hidden; border: 1px solid rgba(255,255,255,.06);
  transition: transform .15s ease; cursor: pointer; display: block; }
.game-card:active { transform: scale(.97); }
.game-card img, .game-card .img-fallback { width: 100%; aspect-ratio: 3/2; object-fit: cover; display: block; }
.game-card-body { padding: 10px 12px 12px; }
.game-card-name { font-weight: 700; font-size: 14.5px; }
.game-card-desc { color: var(--muted); font-size: 11.5px; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.page-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.back-btn { background: var(--card); border: 1px solid rgba(255,255,255,.08); color: var(--text); width: 38px; height: 38px;
  border-radius: 12px; font-size: 17px; cursor: pointer; flex-shrink: 0; }
.page-title { font-size: 18px; font-weight: 800; font-family: 'Unbounded', sans-serif; }

.game-hero { display: flex; gap: 14px; align-items: center; background: var(--card); padding: 14px; border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,.06); margin-bottom: 16px; }
.game-hero img, .game-hero .img-fallback { width: 84px; height: 66px; object-fit: cover; border-radius: 12px; flex-shrink: 0; }
.game-hero-name { font-weight: 800; font-size: 16px; }
.game-hero-desc { color: var(--muted); font-size: 12.5px; margin-top: 3px; }

.product-list { display: flex; flex-direction: column; gap: 10px; }
.product-card { display: flex; gap: 12px; align-items: center; background: var(--card); padding: 12px; border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,.06); cursor: pointer; transition: transform .12s ease; position: relative; }
.product-card:active { transform: scale(.98); }
.product-card img, .product-card .img-fallback { width: 62px; height: 62px; object-fit: cover; border-radius: 12px; flex-shrink: 0; }
.product-info { flex: 1; min-width: 0; }
.product-name { font-weight: 700; font-size: 14.5px; }
.product-desc { color: var(--muted); font-size: 11.5px; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-price { font-weight: 800; font-size: 15px; white-space: nowrap;
  background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.badge { position: absolute; top: -7px; left: 10px; background: linear-gradient(135deg, var(--primary), var(--accent));
  font-size: 10.5px; font-weight: 700; padding: 3px 9px; border-radius: 20px; color: #fff; box-shadow: 0 4px 14px rgba(0,0,0,.3); z-index: 1; }

/* ====== Формы ====== */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; border: 1px solid rgba(255,255,255,.06); margin-bottom: 12px; }
.checkout-product { display: flex; gap: 12px; align-items: center; }
.checkout-img, .checkout-product .img-fallback { width: 58px; height: 58px; border-radius: 12px; object-fit: cover; flex-shrink: 0; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field .help { color: var(--muted); font-size: 11.5px; margin-top: 5px; line-height: 1.45; }
.input {
  width: 100%; background: rgba(255,255,255,.055); border: 1px solid rgba(255,255,255,.12); color: var(--text);
  padding: 12px 14px; border-radius: 12px; font-size: 15px; outline: none; transition: border .15s;
}
.input:focus { border-color: var(--primary); }
textarea.input { resize: vertical; min-height: 70px; }
select.input option { background: var(--bg2); color: var(--text); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; border: none;
  padding: 14px 18px; border-radius: 14px; font-size: 15px; font-weight: 700; cursor: pointer;
  transition: opacity .15s, transform .12s; box-shadow: 0 8px 24px color-mix(in srgb, var(--primary) 45%, transparent);
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.secondary { background: rgba(255,255,255,.08); box-shadow: none; border: 1px solid rgba(255,255,255,.12); }
.btn.danger { background: linear-gradient(135deg, #ff5c7a, #ff8f5c); box-shadow: none; }
.btn.small { width: auto; padding: 9px 14px; font-size: 13px; border-radius: 11px; }

.total-row { display: flex; justify-content: space-between; align-items: center; padding: 14px 2px; font-weight: 700; }
.total-value { font-size: 20px; font-family: 'Unbounded', sans-serif;
  background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.error-text { color: var(--danger); font-size: 13px; margin: 8px 0; }
.muted { color: var(--muted); font-size: 12.5px; line-height: 1.5; }

/* ====== Статусы заказов ====== */
.status-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 5px 11px; border-radius: 20px;
  background: rgba(255,255,255,.08); white-space: nowrap; }
.status-chip.pending { background: rgba(255,193,7,.14); color: #ffd54f; }
.status-chip.paid, .status-chip.processing, .status-chip.waiting_code { background: rgba(0,210,255,.13); color: #6fe3ff; }
.status-chip.done { background: rgba(46,222,143,.14); color: var(--ok); }
.status-chip.canceled, .status-chip.failed { background: rgba(255,92,122,.14); color: var(--danger); }

.order-card { background: var(--card); border-radius: var(--radius); padding: 14px; border: 1px solid rgba(255,255,255,.06); margin-bottom: 10px; display: block; }
.order-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.order-code { font-weight: 800; font-size: 14px; }
.order-line { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; padding: 3px 0; }
.order-line span:first-child { color: var(--muted); flex-shrink: 0; }
.order-line span:last-child { font-weight: 600; text-align: right; word-break: break-word; }

.status-banner { border-radius: var(--radius); padding: 16px; margin-bottom: 12px; font-size: 14px; line-height: 1.55;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 28%, var(--card)), color-mix(in srgb, var(--accent) 18%, var(--card)));
  border: 1px solid rgba(255,255,255,.1); white-space: pre-line; }

/* ====== Нижняя навигация ====== */
.bottom-nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 520px;
  display: flex; background: color-mix(in srgb, var(--bg1) 82%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid rgba(255,255,255,.08); padding: 8px 6px calc(8px + env(safe-area-inset-bottom)); z-index: 50; }
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--muted); font-size: 10.5px;
  font-weight: 600; background: none; border: none; cursor: pointer; padding: 4px 0; border-radius: 12px; }
.nav-item.active { color: var(--text); }
.nav-item .nav-ico { font-size: 20px; }
.nav-item.active .nav-ico { filter: drop-shadow(0 0 12px var(--primary)); }

/* ====== Модалки ====== */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--bg2); width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto;
  border-radius: 22px 22px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); animation: up .22s ease; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-title { font-size: 17px; font-weight: 800; }

/* ====== Админка ====== */
.admin-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 12px; scrollbar-width: none; }
.admin-tabs::-webkit-scrollbar { display: none; }
.tab-btn { white-space: nowrap; background: var(--card); color: var(--muted); border: 1px solid rgba(255,255,255,.08);
  padding: 9px 15px; border-radius: 20px; font-size: 13px; font-weight: 700; cursor: pointer; }
.tab-btn.active { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; border-color: transparent; }

.chips { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { white-space: nowrap; background: var(--card); color: var(--muted); border: 1px solid rgba(255,255,255,.08);
  padding: 7px 13px; border-radius: 18px; font-size: 12px; font-weight: 600; cursor: pointer; }
.chip.active { color: var(--text); border-color: var(--primary); background: color-mix(in srgb, var(--primary) 22%, var(--card)); }

.settings-section { margin-bottom: 10px; }
.settings-section summary { cursor: pointer; font-weight: 800; font-size: 15px; padding: 14px 16px; background: var(--card);
  border-radius: var(--radius); border: 1px solid rgba(255,255,255,.06); list-style: none; display: flex; justify-content: space-between; }
.settings-section summary::-webkit-details-marker { display: none; }
.settings-section summary::after { content: '▾'; color: var(--muted); }
.settings-section[open] summary::after { content: '▴'; }
.settings-section .section-body { padding: 14px 4px 4px; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.color-field { display: flex; gap: 8px; align-items: center; }
.color-field input[type='color'] { width: 44px; height: 44px; border: none; border-radius: 10px; background: none; cursor: pointer; padding: 0; flex-shrink: 0; }

.admin-item { display: flex; gap: 10px; align-items: center; background: var(--card); padding: 10px 12px; border-radius: 14px;
  border: 1px solid rgba(255,255,255,.06); margin-bottom: 8px; }
.admin-item img, .admin-item .img-fallback { width: 46px; height: 46px; object-fit: cover; border-radius: 10px; flex-shrink: 0; font-size: 20px; }
.admin-item .grow { flex: 1; min-width: 0; }
.admin-item .name { font-weight: 700; font-size: 13.5px; }
.admin-item .sub { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.icon-btn { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); color: var(--text); width: 34px; height: 34px;
  border-radius: 10px; cursor: pointer; font-size: 14px; flex-shrink: 0; }

.upload-row { display: flex; gap: 8px; align-items: center; }
.upload-preview { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat-tile { background: var(--card); border-radius: var(--radius); padding: 14px; border: 1px solid rgba(255,255,255,.06); }
.stat-value { font-size: 20px; font-weight: 800; font-family: 'Unbounded', sans-serif; word-break: break-word; }
.stat-label { color: var(--muted); font-size: 11.5px; margin-top: 4px; }

.bar-row { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 4px 0; }
.bar-row .bar-label { width: 74px; color: var(--muted); flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .bar-track { flex: 1; background: rgba(255,255,255,.06); border-radius: 6px; height: 10px; overflow: hidden; }
.bar-row .bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 6px; }
.bar-row .bar-val { width: 82px; text-align: right; font-weight: 700; flex-shrink: 0; }

.copy-row { display: flex; gap: 6px; align-items: center; background: rgba(255,255,255,.05); padding: 8px 10px; border-radius: 10px;
  font-size: 12px; margin: 6px 0; word-break: break-all; cursor: pointer; }
.copy-row .hint { margin-left: auto; opacity: .6; flex-shrink: 0; }
.toast { position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%); background: #23274a; color: #fff;
  padding: 11px 18px; border-radius: 14px; font-size: 13.5px; font-weight: 600; z-index: 200; box-shadow: 0 10px 30px rgba(0,0,0,.4);
  animation: up .2s ease; max-width: 90%; text-align: center; }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 14px; line-height: 1.6; }
.empty .big { font-size: 40px; margin-bottom: 10px; }
.btn-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.head-row { display: flex; justify-content: space-between; align-items: center; margin: 2px 0 10px; }
.sticky-save { position: sticky; bottom: calc(92px + env(safe-area-inset-bottom)); margin-top: 14px; z-index: 5; }
