/* NEXUS Mini App — премиум тёмная тема */
:root {
  --bg: #0a0e1a;
  --bg-card: #111726;
  --bg-card-2: #161d30;
  --gold: #f5c518;
  --gold-dim: #b8941f;
  --green: #22d27d;
  --red: #ff4d5e;
  --neon: #4d8cff;
  --text: #eaf0ff;
  --text-dim: #8a93ab;
  --border: #1e2740;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro", "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
}

body {
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(77, 140, 255, 0.10), transparent 60%),
    radial-gradient(700px 400px at 50% 110%, rgba(245, 197, 24, 0.06), transparent 60%),
    var(--bg);
  min-height: 100vh;
  padding-bottom: 72px; /* место под табы */
}

.screen { display: none; padding: 14px 16px; }
.screen.active { display: block; }

/* ─── Шапка ─── */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 2px 14px;
}
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: 2px; }
.logo .mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  display: grid; place-items: center; color: #0a0e1a; font-weight: 900;
  box-shadow: 0 0 16px rgba(245, 197, 24, 0.4);
}
.logo .name { font-size: 18px; background: linear-gradient(90deg, #fff, #cfd7ee); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

.balance-chip {
  display: flex; flex-direction: column; align-items: flex-end; line-height: 1;
}
.balance-chip .num {
  font-size: 30px; font-weight: 900; color: var(--gold);
  text-shadow: 0 0 18px rgba(245, 197, 24, 0.35);
}
.balance-chip .lbl { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; margin-top: 3px; }

/* ─── Колесо (горизонтальная лента) ─── */
.wheel-wrap {
  position: relative; margin: 8px 0 16px;
  border-radius: 18px; background: var(--bg-card);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  padding: 26px 0;
  overflow: hidden;
}
.wheel-wrap::before, .wheel-wrap::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 64px; z-index: 3; pointer-events: none;
}
.wheel-wrap::before { left: 0; background: linear-gradient(90deg, var(--bg-card), transparent); }
.wheel-wrap::after { right: 0; background: linear-gradient(270deg, var(--bg-card), transparent); }

.pointer { position: absolute; left: 50%; transform: translateX(-50%); z-index: 5; color: var(--gold); font-size: 18px; filter: drop-shadow(0 0 6px rgba(245,197,24,0.6)); }
.pointer.top { top: 4px; }
.pointer.bottom { bottom: 4px; transform: translateX(-50%) rotate(180deg); }

.reel-viewport { position: relative; height: 108px; }
.reel {
  display: flex; gap: 10px; position: absolute; left: 0; top: 0;
  will-change: transform;
  padding: 0 calc(50% - 50px); /* центрируем первый элемент под стрелкой */
}
.seg {
  flex: 0 0 100px; height: 108px; border-radius: 14px;
  background: linear-gradient(160deg, var(--bg-card-2), #0d1322);
  border: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
}
.seg .emo { font-size: 38px; line-height: 1; }
.seg .cap { font-size: 11px; color: var(--text-dim); text-align: center; padding: 0 6px; }
.seg.magnet { border-color: rgba(245, 197, 24, 0.45); background: linear-gradient(160deg, #1c1c10, #14140a); }
.seg.magnet .cap { color: var(--gold); }
.seg.win { border-color: var(--gold); box-shadow: 0 0 22px rgba(245, 197, 24, 0.5); transform: scale(1.04); transition: transform .2s; }

/* центральная подсветка */
.center-glow {
  position: absolute; left: 50%; top: 0; bottom: 0; width: 104px; transform: translateX(-50%);
  border-left: 1px dashed rgba(245,197,24,0.25); border-right: 1px dashed rgba(245,197,24,0.25);
  z-index: 4; pointer-events: none;
}

/* ─── Кнопки ─── */
.btn {
  width: 100%; border: none; border-radius: 14px; padding: 16px;
  font-size: 17px; font-weight: 800; cursor: pointer; color: #0a0e1a;
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  box-shadow: 0 8px 24px rgba(245, 197, 24, 0.28);
  transition: transform .08s, opacity .2s; letter-spacing: .5px;
}
.btn:active { transform: scale(0.98); }
.btn:disabled, .btn.disabled {
  background: #2a3147; color: var(--text-dim);
  box-shadow: none; cursor: not-allowed;
}
.btn.spin { font-size: 19px; margin-bottom: 10px; }
.btn.secondary {
  background: transparent; color: var(--gold); border: 1px solid rgba(245,197,24,0.5);
  box-shadow: none; font-size: 15px;
}

/* ─── Магнит-статистика ─── */
.magnet-stats {
  text-align: center; color: var(--text-dim); font-size: 13px;
  padding: 12px 8px; margin-top: 6px;
}

/* ─── Лента победителей ─── */
.section-title { font-size: 13px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; margin: 18px 4px 8px; }
.winners { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; }
.winner {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
}
.winner .emo { font-size: 22px; }
.winner .who { font-weight: 700; font-size: 14px; }
.winner .what { font-size: 12px; color: var(--text-dim); }
.winner .time { margin-left: auto; font-size: 11px; color: var(--text-dim); white-space: nowrap; }

/* ─── Табы ─── */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; background: rgba(10, 14, 26, 0.94); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}
.tab {
  flex: 1; text-align: center; padding: 12px 0 14px; font-size: 12px; color: var(--text-dim);
  cursor: pointer; border: none; background: none;
}
.tab .ico { display: block; font-size: 20px; margin-bottom: 3px; }
.tab.active { color: var(--gold); }

/* ─── Попап результата ─── */
.overlay {
  position: fixed; inset: 0; z-index: 50; display: none;
  background: rgba(5, 8, 16, 0.82); backdrop-filter: blur(6px);
  align-items: center; justify-content: center; padding: 24px;
}
.overlay.show { display: flex; }
.prize-card {
  width: 100%; max-width: 340px; text-align: center;
  background: linear-gradient(160deg, var(--bg-card-2), #0c1120);
  border: 1px solid var(--gold); border-radius: 22px; padding: 30px 24px;
  box-shadow: 0 0 60px rgba(245, 197, 24, 0.3); animation: pop .35s cubic-bezier(.2,1.3,.5,1);
}
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.prize-card .big-emo { font-size: 72px; line-height: 1; }
.prize-card h2 { margin: 14px 0 6px; font-size: 24px; color: var(--gold); }
.prize-card p { color: var(--text-dim); font-size: 14px; margin-bottom: 22px; }

/* ─── Подсказка первого запуска ─── */
.hint {
  position: fixed; left: 16px; right: 16px; bottom: 84px; z-index: 30;
  background: var(--bg-card-2); border: 1px solid rgba(245,197,24,0.4); border-radius: 14px;
  padding: 14px 16px; font-size: 14px; box-shadow: var(--shadow); display: none;
}
.hint.show { display: block; animation: pop .3s ease; }
.hint b { color: var(--gold); }

/* ─── Конфетти ─── */
.confetti { position: fixed; inset: 0; z-index: 49; pointer-events: none; overflow: hidden; }
.confetti i {
  position: absolute; top: -10px; width: 9px; height: 14px; opacity: .9;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(540deg); opacity: 0; }
}

.empty { text-align: center; color: var(--text-dim); padding: 40px 20px; font-size: 14px; }
