:root {
  --bg: var(--tg-theme-bg-color, #17212b);
  --fg: var(--tg-theme-text-color, #f5f5f5);
  --hint: var(--tg-theme-hint-color, #708499);
  --accent: var(--tg-theme-button-color, #5288c1);
  --accent-fg: var(--tg-theme-button-text-color, #ffffff);
  --card: var(--tg-theme-secondary-bg-color, #232e3c);
}
body.theme-dark {
  --bg: #17212b;
  --fg: #f5f5f5;
  --hint: #708499;
  --accent: #5288c1;
  --accent-fg: #ffffff;
  --card: #232e3c;
}
body.theme-light {
  --bg: #f5f7fa;
  --fg: #181c22;
  --hint: #8a96a8;
  --accent: #2481cc;
  --accent-fg: #ffffff;
  --card: #ffffff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 100vh;
}

header {
  display: flex;
  align-items: center;
  gap: 8px;
}
header h1 { font-size: 18px; font-weight: 700; flex: 1; text-align: center; }

.menu-btn {
  background: var(--card);
  color: var(--fg);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 20px;
  cursor: pointer;
  flex-shrink: 0;
}
.menu-btn:active { opacity: 0.7; }

.balance-pill {
  background: var(--card);
  color: var(--fg);
  border: none;
  height: 40px;
  padding: 0 6px 0 14px;
  border-radius: 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.balance-num { color: var(--fg); }
.balance-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 18px;
  font-weight: 600;
  margin-left: 4px;
}
.balance-pill:active { opacity: 0.7; }

/* Views */
.view { display: flex; flex-direction: column; gap: 16px; flex: 1; }

/* LIVE feed */
.live-feed {
  position: relative;
  background: var(--card);
  border-radius: 12px;
  padding: 6px 10px 6px 70px;
  overflow: hidden;
}
.live-badge {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  z-index: 2;
  background: var(--card);
  padding-right: 8px;
}
.online-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--fg);
  line-height: 1;
}
.live-label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 9px;
  font-weight: 700;
  color: #4fdc7c;
  letter-spacing: 1px;
}
.live-feed::before {
  content: "";
  position: absolute;
  left: 60px;
  top: 0; bottom: 0;
  width: 16px;
  background: linear-gradient(to right, var(--card), transparent);
  z-index: 1;
  pointer-events: none;
}
.live-feed::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0; bottom: 0;
  width: 16px;
  background: linear-gradient(to left, var(--card), transparent);
  z-index: 1;
  pointer-events: none;
}
.live-dot {
  width: 6px;
  height: 6px;
  background: #4fdc7c;
  border-radius: 50%;
  box-shadow: 0 0 6px #4fdc7c;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.live-track {
  display: flex;
  gap: 6px;
}
.live-item {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: var(--bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid transparent;
  font-size: 18px;
}
.live-item img { width: 26px; height: 26px; object-fit: contain; }
.live-item.r-common    { border-color: #6c7884; }
.live-item.r-uncommon  { border-color: #4ea1ff; }
.live-item.r-rare      { border-color: #b362ff; }
.live-item.r-epic      { border-color: #ffaa3b; }
.live-item.r-legendary { border-color: #ff3bd0; box-shadow: 0 0 6px rgba(255,59,208,0.5); }

/* Cases grid */
.cases-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.case-card {
  background: var(--card);
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  cursor: pointer;
  position: relative;
  color: var(--fg);
  transition: transform 0.1s, border-color 0.2s;
}
.case-card:active { transform: scale(0.98); }
.case-card { border-color: color-mix(in srgb, var(--case-accent) 30%, transparent); }

.case-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  z-index: 1;
}

.case-cover-wrap {
  background: radial-gradient(circle at center, color-mix(in srgb, var(--case-accent) 25%, transparent), transparent 70%);
  border-radius: 12px;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}
.case-cover {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px color-mix(in srgb, var(--case-accent) 40%, transparent));
}

.case-name {
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}
.case-price {
  font-size: 16px;
  font-weight: 700;
  color: var(--case-accent, var(--accent));
  text-align: center;
}

/* Spin view */
.back-btn {
  background: none;
  border: none;
  color: var(--fg);
  font-size: 16px;
  text-align: left;
  cursor: pointer;
  padding: 4px 0;
  align-self: flex-start;
}
.back-btn:active { opacity: 0.6; }

.case-info {
  text-align: center;
}
.case-info-name { font-size: 20px; font-weight: 700; }
.case-info-price { font-size: 14px; color: var(--hint); margin-top: 2px; }

/* Содержимое кейса */
.case-contents {
  background: var(--card);
  border-radius: 12px;
  overflow: hidden;
}
.case-contents > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--hint);
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.case-contents > summary::-webkit-details-marker { display: none; }
.case-contents > summary::after {
  content: '▾';
  font-size: 14px;
  transition: transform 0.2s;
}
.case-contents[open] > summary::after { transform: rotate(180deg); }
.case-contents-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 0 12px 12px;
}
.case-content-card {
  background: var(--bg);
  border: 1.5px solid transparent;
  border-radius: 10px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: var(--fg);
}
.case-content-card:active { transform: scale(0.96); }
.case-content-card.r-common    { border-color: #6c7884; }
.case-content-card.r-uncommon  { border-color: #4ea1ff; }
.case-content-card.r-rare      { border-color: #b362ff; }
.case-content-card.r-epic      { border-color: #ffaa3b; }
.case-content-card.r-legendary { border-color: #ff3bd0; }
.case-content-card img { width: 38px; height: 38px; object-fit: contain; }
.case-content-emoji { font-size: 30px; line-height: 1; }
.case-content-name { font-size: 9px; color: var(--hint); text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.item-preview-desc {
  font-size: 13px;
  color: var(--hint);
  text-align: center;
  padding: 8px 16px 4px;
  line-height: 1.4;
}

/* Admin */
.admin-stats { display: flex; flex-direction: column; gap: 8px; }
.admin-card {
  background: var(--card);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.admin-card-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--hint);
}
.admin-card-value { font-size: 22px; font-weight: 700; color: var(--accent); }

.admin-section-title { font-size: 13px; color: var(--hint); text-transform: uppercase; letter-spacing: 1px; padding-top: 8px; }
.admin-topups { display: flex; flex-direction: column; gap: 6px; }
.admin-topup-row {
  background: var(--card);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.admin-topup-info { flex: 1; min-width: 0; }
.admin-topup-name { font-size: 14px; font-weight: 600; }
.admin-topup-uname { color: var(--hint); font-weight: 400; font-size: 12px; }
.admin-topup-date { font-size: 11px; color: var(--hint); margin-top: 1px; }
.admin-topup-amount { font-size: 15px; font-weight: 700; color: #4fdc7c; }
.admin-topups-empty { color: var(--hint); text-align: center; padding: 16px; font-size: 13px; }

/* Theme picker */
.theme-option { justify-content: space-between; }
.theme-check { color: var(--accent); font-size: 18px; opacity: 0; }
.theme-option.active .theme-check { opacity: 1; }

/* Демо-режим переключатель */
.demo-toggle-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 4px 12px;
  background: var(--card);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
}
.demo-toggle-label { font-size: 14px; font-weight: 600; }
.demo-toggle-hint { font-size: 11px; color: var(--hint); grid-column: 1 / 3; grid-row: 2; }
.demo-toggle-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.demo-toggle-switch {
  position: relative;
  width: 42px;
  height: 24px;
  background: var(--bg);
  border-radius: 12px;
  transition: background 0.2s;
  grid-row: 1 / 3;
  grid-column: 3;
}
.demo-toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--fg);
  transition: transform 0.2s;
}
.demo-toggle-input:checked ~ .demo-toggle-switch { background: #ffaa3b; }
.demo-toggle-input:checked ~ .demo-toggle-switch::after {
  transform: translateX(18px);
  background: #000;
}

/* Inventory tabs */
.inv-tabs {
  display: flex;
  background: var(--card);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}
.inv-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--hint);
  padding: 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.inv-tab.active { background: var(--bg); color: var(--fg); }
.inv-tab-badge {
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: 10px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
}
.inv-tab-content { display: flex; flex-direction: column; gap: 8px; }

/* Withdraw list */
.withdraw-list { display: flex; flex-direction: column; gap: 8px; }
.withdraw-card {
  background: var(--card);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1.5px solid transparent;
}
.withdraw-card.r-common    { border-color: #6c7884; }
.withdraw-card.r-uncommon  { border-color: #4ea1ff; }
.withdraw-card.r-rare      { border-color: #b362ff; }
.withdraw-card.r-epic      { border-color: #ffaa3b; }
.withdraw-card.r-legendary { border-color: #ff3bd0; }
.withdraw-img { width: 56px; height: 56px; object-fit: contain; flex-shrink: 0; }
.withdraw-emoji { font-size: 44px; line-height: 1; flex-shrink: 0; width: 56px; text-align: center; }
.withdraw-info { flex: 1; min-width: 0; }
.withdraw-name { font-size: 14px; font-weight: 700; }
.withdraw-timer {
  font-family: ui-monospace, monospace;
  font-size: 14px;
  color: var(--accent);
  margin-top: 4px;
}
.withdraw-timer.done { color: #4fdc7c; }
.withdraw-accel-btn {
  margin-top: 8px;
  background: var(--bg);
  color: var(--fg);
  border: none;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.withdraw-accel-btn:active { opacity: 0.7; }

/* Pay-choice sheet */
.pay-choice-amount {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  padding: 8px 0 16px;
}

/* Accelerate sheet */
.accel-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 4px 16px;
}
.accel-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--hint); }
.accel-days { font-size: 36px; font-weight: 700; color: var(--fg); line-height: 1; }
.accel-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  outline: none;
}
.accel-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.accel-slider::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}
.accel-cost { font-size: 18px; font-weight: 700; color: var(--accent); margin-top: 4px; }

/* Inventory */
.view-title { font-size: 20px; font-weight: 700; text-align: center; }
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.inv-card {
  background: var(--card);
  border-radius: 12px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 2px solid transparent;
  position: relative;
  aspect-ratio: 1;
}
.inv-card.r-common    { border-color: #6c7884; }
.inv-card.r-uncommon  { border-color: #4ea1ff; }
.inv-card.r-rare      { border-color: #b362ff; }
.inv-card.r-epic      { border-color: #ffaa3b; }
.inv-card.r-legendary { border-color: #ff3bd0; box-shadow: 0 0 10px rgba(255,59,208,0.35); }

.inv-img { width: 56px; height: 56px; object-fit: contain; }
.inv-emoji { font-size: 40px; line-height: 1; }
.inv-name {
  font-size: 10px;
  color: var(--hint);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.inv-count {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 22px;
  text-align: center;
}

.inventory-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--hint);
}
.empty-emoji { font-size: 56px; margin-bottom: 12px; }
.empty-text { font-size: 14px; line-height: 1.4; }

/* Referral */
.ref-desc { color: var(--hint); font-size: 13px; text-align: center; line-height: 1.4; }
.ref-link-card {
  background: var(--card);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ref-link-label { font-size: 11px; color: var(--hint); text-transform: uppercase; letter-spacing: 1px; }
.ref-link {
  font-size: 12px;
  color: var(--fg);
  background: var(--bg);
  padding: 10px 12px;
  border-radius: 8px;
  word-break: break-all;
  font-family: ui-monospace, monospace;
}
.ref-link-actions { display: flex; gap: 8px; }
.ref-link-actions .ghost-btn { background: var(--bg); }

.ref-tiers { display: flex; flex-direction: column; gap: 8px; }
.ref-tier {
  background: var(--card);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1.5px solid transparent;
  transition: border-color 0.2s;
}
.ref-tier.ready { border-color: var(--accent); }
.ref-tier.claimed { opacity: 0.6; }
.ref-tier-img { width: 48px; height: 48px; object-fit: contain; flex-shrink: 0; }
.ref-tier-emoji { font-size: 36px; line-height: 1; flex-shrink: 0; width: 48px; text-align: center; }
.ref-tier-info { flex: 1; min-width: 0; }
.ref-tier-title { font-size: 14px; font-weight: 700; }
.ref-tier-sub { font-size: 11px; color: var(--hint); margin-top: 1px; }
.ref-tier-bar {
  height: 4px;
  background: var(--bg);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}
.ref-tier-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}
.ref-tier-progress { font-size: 10px; color: var(--hint); margin-top: 4px; }
.ref-tier-btn {
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.ref-tier-btn:disabled { background: var(--bg); color: var(--hint); cursor: not-allowed; }
.ref-tier-btn:active:not(:disabled) { opacity: 0.8; }

.ref-test-btn {
  background: transparent;
  border: 1px dashed var(--hint);
  color: var(--hint);
  font-size: 11px;
  padding: 8px;
}

.ref-friends-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ref-friends-title {
  font-size: 13px;
  color: var(--hint);
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ref-friends-count {
  background: var(--card);
  color: var(--fg);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}
.ref-friends { display: flex; flex-direction: column; gap: 6px; }
.ref-friend {
  background: var(--card);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.ref-friend-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.ref-friend-name { flex: 1; font-size: 14px; font-weight: 500; }
.ref-friend-date { font-size: 11px; color: var(--hint); }
.ref-friends-empty {
  background: var(--card);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  color: var(--hint);
  font-size: 13px;
}

.inv-card { cursor: pointer; color: var(--fg); }
.inv-card:active { transform: scale(0.97); }

/* Item detail sheet */
.item-detail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 0 16px;
}
.item-detail-visual { font-size: 80px; line-height: 1; height: 96px; display: flex; align-items: center; justify-content: center; }
.item-detail-img { width: 96px; height: 96px; object-fit: contain; }
.item-detail-name { font-size: 18px; font-weight: 700; }
.item-detail-rarity { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.item-detail-rarity.r-common    { color: #9aa6b2; }
.item-detail-rarity.r-uncommon  { color: #4ea1ff; }
.item-detail-rarity.r-rare      { color: #b362ff; }
.item-detail-rarity.r-epic      { color: #ffaa3b; }
.item-detail-rarity.r-legendary { color: #ff3bd0; }
.item-detail-count { font-size: 13px; color: var(--hint); margin-top: 4px; }

/* Sheets */
.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 10;
  animation: fade 0.2s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--card);
  border-radius: 16px 16px 0 0;
  padding: 16px;
  z-index: 11;
  max-width: 480px;
  margin: 0 auto;
  animation: slideUp 0.25s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0 12px;
}
.sheet-title { font-size: 17px; font-weight: 600; flex: 1; text-align: center; }
.sheet-close, .sheet-back {
  background: none; border: none; color: var(--fg);
  font-size: 28px; line-height: 1;
  cursor: pointer; width: 32px; height: 32px;
}
.sheet-back { font-size: 32px; }

.menu-item {
  background: var(--bg);
  color: var(--fg);
  border: none;
  padding: 16px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
}
.menu-item:active { opacity: 0.7; }
.menu-item.primary { background: var(--accent); color: var(--accent-fg); justify-content: center; }
.menu-item.sell-btn { justify-content: center; text-align: center; }
.balance-value { color: var(--accent); font-weight: 700; }

.topup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px 0;
}
.topup-amount {
  background: var(--bg);
  color: var(--fg);
  border: none;
  padding: 18px;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
}
.topup-amount:active { opacity: 0.7; transform: scale(0.98); }
.topup-note { color: var(--hint); font-size: 12px; text-align: center; padding: 8px 4px 0; }

.topup-custom { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.topup-input {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid transparent;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  -moz-appearance: textfield;
  appearance: textfield;
}
.topup-input::-webkit-outer-spin-button,
.topup-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.topup-input:focus { border-color: var(--accent); }
.topup-custom-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Roulette */
.roulette {
  position: relative;
  background: var(--card);
  border-radius: 16px;
  padding: 16px 0;
  overflow: hidden;
}

.pointer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  margin-left: -1.5px;
  background: linear-gradient(to bottom, transparent, #ff5252 20%, #ff5252 80%, transparent);
  z-index: 2;
  pointer-events: none;
}
.pointer::before, .pointer::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 0; height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  margin-left: -8px;
}
.pointer::before { top: 0; border-top: 10px solid #ff5252; }
.pointer::after { bottom: 0; border-bottom: 10px solid #ff5252; }

.strip-window {
  overflow: hidden;
  position: relative;
}
.strip-window::before, .strip-window::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 60px;
  z-index: 1;
  pointer-events: none;
}
.strip-window::before { left: 0; background: linear-gradient(to right, var(--card), transparent); }
.strip-window::after { right: 0; background: linear-gradient(to left, var(--card), transparent); }

.strip {
  display: flex;
  gap: 8px;
  padding: 0 50%;
  will-change: transform;
}

.item {
  flex: 0 0 96px;
  height: 110px;
  background: var(--bg);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 2px solid transparent;
  position: relative;
}
.item.r-common    { border-color: #6c7884; }
.item.r-uncommon  { border-color: #4ea1ff; }
.item.r-rare      { border-color: #b362ff; }
.item.r-epic      { border-color: #ffaa3b; }
.item.r-legendary { border-color: #ff3bd0; box-shadow: 0 0 12px rgba(255,59,208,0.4); }

.item .emoji { font-size: 44px; line-height: 1; }
.item .img { width: 64px; height: 64px; object-fit: contain; }
.item .name { font-size: 10px; color: var(--hint); text-align: center; padding: 0 4px; }

/* Полноэкранный результат */
.result-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  gap: 20px;
  animation: pop 0.4s ease;
}
@keyframes pop { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.result-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--card);
  color: var(--fg);
  border: none;
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.result-close:active { opacity: 0.7; }
.result-demo-badge {
  position: absolute;
  top: 24px;
  left: 24px;
  background: #ffaa3b;
  color: #000;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2px;
  padding: 4px 10px;
  border-radius: 6px;
}
.result-card {
  background: var(--card);
  border-radius: 24px;
  padding: 32px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 360px;
}
.result-emoji {
  font-size: 120px;
  line-height: 1;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.result-img { width: 180px; height: 180px; object-fit: contain; }
.result-name { font-size: 24px; font-weight: 700; }
.result-rarity { font-size: 14px; color: var(--hint); text-transform: uppercase; letter-spacing: 1px; }
.result-rarity.r-common    { color: #9aa6b2; }
.result-rarity.r-uncommon  { color: #4ea1ff; }
.result-rarity.r-rare      { color: #b362ff; }
.result-rarity.r-epic      { color: #ffaa3b; }
.result-rarity.r-legendary { color: #ff3bd0; }

/* Buttons */
.spin-btn {
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  padding: 16px;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  margin-top: auto;
}
.spin-btn:active:not(:disabled) { transform: scale(0.98); }
.spin-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.footer-actions { display: flex; gap: 8px; }
.ghost-btn {
  flex: 1;
  background: var(--card);
  color: var(--fg);
  border: none;
  padding: 14px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.ghost-btn:active { opacity: 0.7; }
