/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a1210;
  --bg-elevated: #101a16;
  --surface: #15221c;
  --surface2: #1c2d25;
  --line: rgba(212, 185, 120, 0.14);
  --text: #f4efe4;
  --muted: #9aaf9f;
  --accent: #e8a317;
  --accent-deep: #c45a12;
  --accent-soft: rgba(232, 163, 23, 0.16);
  --moss: #3d7a5a;
  --telegram: #2AABEE;
  --legendary: #ffd56a;
  --rare: #6ec8c0;
  --uncommon: #7dca8c;
  --common: #8a9a90;
  --danger: #ff7a7a;
  --card-w: 130px;
  --card-h: 182px;
  --radius: 18px;
  --font-display: 'Unbounded', sans-serif;
  --font-body: 'Onest', sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

body {
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(61, 122, 90, 0.22), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 80%, rgba(196, 90, 18, 0.12), transparent 50%),
    var(--bg);
}

#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; }
.hidden { display: none !important; }

/* ===== Ambient atmosphere ===== */
.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  animation: orbDrift 14s ease-in-out infinite;
}

.ambient-orb--amber {
  width: 42vw;
  height: 42vw;
  max-width: 480px;
  max-height: 480px;
  top: -8%;
  right: -10%;
  background: rgba(232, 163, 23, 0.22);
}

.ambient-orb--moss {
  width: 50vw;
  height: 50vw;
  max-width: 560px;
  max-height: 560px;
  bottom: -18%;
  left: -16%;
  background: rgba(61, 122, 90, 0.28);
  animation-delay: -5s;
}

.ambient-grain {
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(255, 255, 255, 0.015) 2px,
      rgba(255, 255, 255, 0.015) 4px
    ),
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px),
    radial-gradient(circle at 70% 60%, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px);
  background-size: auto, 48px 48px, 36px 36px;
  mix-blend-mode: soft-light;
}

@keyframes orbDrift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-18px, 22px) scale(1.06); }
}

/* ===== Buttons ===== */
.btn {
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  border-radius: 14px;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  padding: 12px 20px;
  font-size: 0.95rem;
  border: 1px solid var(--line);
}

.spin-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  gap: 10px;
}

.btn-spin {
  position: relative;
  background: linear-gradient(145deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #1a1004;
  padding: 18px 52px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  box-shadow: 0 10px 28px rgba(196, 90, 18, 0.28);
  overflow: hidden;
  animation: spinIdle 3.2s ease-in-out infinite;
}

.btn-fast-spin {
  min-width: 112px;
  padding: 14px 18px;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.btn-fast-spin:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.btn-fast-spin:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.fast-spin-text {
  font-weight: 800;
}

.fast-spin-sub {
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}

.btn-spin::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.28) 50%, transparent 60%);
  transform: translateX(-120%);
  animation: spinSheen 4s ease-in-out infinite;
}

.btn-spin:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  animation: none;
}
.btn-spin:disabled::after { animation: none; }

.spin-text { position: relative; z-index: 1; }
.spin-sub {
  position: relative;
  z-index: 1;
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 600;
  opacity: 0.75;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

@keyframes spinIdle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes spinSheen {
  0%, 55% { transform: translateX(-120%); }
  75%, 100% { transform: translateX(120%); }
}

.btn-drop-close {
  background: var(--text);
  color: #12180f;
  padding: 14px 36px;
  font-size: 1rem;
  font-weight: 800;
  margin-top: 24px;
  z-index: 10;
  position: relative;
}

.error-msg { color: var(--danger); margin-top: 16px; font-size: 0.9rem; }

/* ===== Header ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(10, 18, 16, 0.72);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
  animation: headerIn 0.55s ease-out both;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.header-chip:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.header-chip--soon {
  opacity: 0.92;
}

.topup-combo {
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 6px;
  border-radius: 14px;
  border: 1px dashed rgba(232, 163, 23, 0.45);
  background: rgba(232, 163, 23, 0.1);
  box-shadow: none;
  min-width: 108px;
}

.topup-combo-main,
.topup-combo-discount {
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s, filter 0.15s, background 0.15s, border-color 0.15s;
}

.topup-combo-main {
  padding: 8px 12px;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--accent), var(--accent-deep));
  color: #1a1004;
  font-size: 0.78rem;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(196, 90, 18, 0.22);
}

.topup-combo-discount {
  padding: 2px 4px 4px;
  background: transparent;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
  line-height: 1.1;
}

.topup-combo-main:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.topup-combo-discount:hover {
  color: var(--text);
}

.soon-badge {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #1a1004;
  background: var(--accent);
  padding: 2px 6px;
  border-radius: 6px;
}

.balance-pill {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  padding: 6px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
  min-width: 76px;
}

.balance-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.balance-value {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}

.free-spins-value {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--uncommon);
}

.wallet-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-topup {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 800;
}

.btn-topup:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.promo-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px dashed rgba(232, 163, 23, 0.45);
  background: rgba(232, 163, 23, 0.1);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}

.promo-chip:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: rgba(232, 163, 23, 0.18);
}

.promo-chip-code {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.promo-chip-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}

.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-btn:hover { color: var(--text); }

.center-modal {
  align-items: center;
  justify-content: center;
}

.topup-modal-content {
  border-radius: 24px !important;
  max-width: 420px;
  width: calc(100% - 32px);
  max-height: 90vh;
  margin: 16px;
  animation: authPop 0.35s ease-out !important;
  border: 1px solid var(--line);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 6px;
  padding-right: 36px;
}

.modal-subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
  line-height: 1.45;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  text-align: left;
}

.field-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.field input {
  width: 100%;
  padding: 14px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  outline: none;
}

.field input:focus {
  border-color: var(--accent);
}

.topup-preview {
  margin: 4px 0 14px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
}

.topup-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.btn-topup-submit {
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(145deg, var(--accent), var(--accent-deep));
  color: #1a1004;
  font-size: 1rem;
  font-weight: 800;
}

.success-msg {
  color: var(--uncommon);
  margin-bottom: 12px;
  font-size: 0.9rem;
}

.profile-wallet {
  color: var(--accent) !important;
  font-weight: 700;
}

.market-soon-content {
  text-align: center;
}

.market-soon-icon {
  font-size: 2.4rem;
  margin-bottom: 8px;
}

@keyframes headerIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  font-size: 1.55rem;
  line-height: 1;
  animation: floatSoft 3.4s ease-in-out infinite;
}

@keyframes floatSoft {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1;
  color: var(--text);
}

.brand-sub {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.profile-btn {
  position: relative;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, transform 0.15s, background 0.2s;
}

.profile-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.04);
}

.profile-avatar {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent);
}

.profile-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: var(--accent-deep);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 2px solid var(--bg);
}

/* ===== Roulette ===== */
.roulette-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 24px 16px 48px;
  gap: 24px;
  animation: mainIn 0.65s ease-out 0.08s both;
}

.roulette-tagline {
  margin-top: 8px;
}

@keyframes mainIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.roulette-tagline {
  font-size: 0.95rem;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-align: center;
}

.roulette-stage {
  width: 100%;
  max-width: 640px;
  padding: 8px;
}

.roulette-container {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 40%),
    var(--surface);
  border: 1px solid var(--line);
  mask-image: linear-gradient(90deg, transparent, black 12%, black 88%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, black 12%, black 88%, transparent);
}

.roulette-frame {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.roulette-track {
  display: flex;
  gap: 12px;
  padding: 28px 0 24px;
  will-change: transform;
}

.roulette-pointer {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pointer-tip {
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 14px solid var(--accent);
  filter: drop-shadow(0 2px 6px rgba(232, 163, 23, 0.45));
}

.pointer-tip::after {
  content: none;
}

.chances-hint {
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}

.legendary-hint strong { color: var(--legendary); }
.legendary-hint em {
  font-style: normal;
  opacity: 0.65;
  font-size: 0.9em;
}

.drop-rates {
  width: 100%;
  max-width: 720px;
  margin-top: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.drop-rates-title {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  margin-bottom: 16px;
}

.drop-rates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.drop-rate-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 8px 12px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--line);
  text-align: center;
}

.drop-rate-item .meme-card {
  width: 88px;
  height: 123px;
}

.drop-rate-item .meme-card-footer {
  display: none;
}

.drop-rate-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  width: 100%;
}

.drop-rate-title {
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.drop-rate-chance {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.drop-rate-item.rarity-common .drop-rate-chance { color: var(--common); }
.drop-rate-item.rarity-uncommon .drop-rate-chance { color: var(--uncommon); }
.drop-rate-item.rarity-rare .drop-rate-chance { color: var(--rare); }
.drop-rate-item.rarity-legendary .drop-rate-chance { color: var(--legendary); }

.drop-rate-item.rarity-legendary {
  border-color: rgba(255, 213, 106, 0.35);
  background: rgba(232, 163, 23, 0.08);
}

/* ===== Meme Card ===== */
.meme-card {
  flex-shrink: 0;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
  background: #0d1411;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.meme-card-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
  user-select: none;
  pointer-events: none;
  background: transparent;
}

.meme-card-footer {
  position: absolute;
  bottom: 6px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 8px;
  pointer-events: none;
  z-index: 2;
}

.meme-card-user,
.meme-card-serial {
  font-size: 0.55rem;
  font-weight: 800;
  color: #fff;
  background: rgba(8, 14, 12, 0.62);
  padding: 2px 6px;
  border-radius: 4px;
  max-width: 46%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.meme-card-serial {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.4px;
}

.meme-card.rarity-uncommon { box-shadow: 0 0 0 1px rgba(125, 202, 140, 0.45), 0 8px 22px rgba(0, 0, 0, 0.35); }
.meme-card.rarity-rare { box-shadow: 0 0 0 1px rgba(110, 200, 192, 0.5), 0 8px 22px rgba(0, 0, 0, 0.35); }
.meme-card.rarity-legendary {
  box-shadow: 0 0 0 1px rgba(255, 213, 106, 0.55), 0 8px 28px rgba(232, 163, 23, 0.25);
  animation: legendaryPulse 2.4s ease-in-out infinite;
}

@keyframes legendaryPulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255, 213, 106, 0.45), 0 8px 28px rgba(232, 163, 23, 0.2); }
  50% { box-shadow: 0 0 0 1px rgba(255, 213, 106, 0.75), 0 10px 34px rgba(232, 163, 23, 0.35); }
}

.won-card { overflow: visible; }
.won-card .meme-card { width: 240px; height: 336px; }
.won-card .meme-card-user,
.won-card .meme-card-serial { font-size: 0.7rem; }
.won-card .meme-card-footer { bottom: 10px; padding: 0 12px; }

/* ===== Drop Overlay ===== */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 10, 8, 0.88);
  backdrop-filter: blur(10px);
}

.drop-overlay.active { display: flex; }

.drop-content {
  position: relative;
  z-index: 5;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: visible;
}

.drop-rarity-label {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  margin-top: 16px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.drop-rarity-label.tier-1 { color: var(--common); }
.drop-rarity-label.tier-2 { color: var(--uncommon); }
.drop-rarity-label.tier-3 { color: var(--rare); }
.drop-rarity-label.tier-4 {
  color: var(--legendary);
  font-size: 1.2rem;
  animation: pulseText 0.5s ease-in-out infinite alternate;
}

@keyframes pulseText {
  from { transform: scale(1); }
  to { transform: scale(1.04); }
}

#particles-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.red-screen {
  position: fixed;
  inset: 0;
  background: #c00000;
  z-index: 2;
  animation: redFlash 0.3s ease-out;
}

.red-screen.active { animation: redPulse 1.5s ease-in-out infinite; }

@keyframes redFlash {
  0% { opacity: 0; }
  30% { opacity: 1; }
  100% { opacity: 0.85; }
}

@keyframes redPulse {
  0%, 100% { background: #c00000; }
  50% { background: #ff0000; }
}

.lightning-container {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  overflow: hidden;
}

.lightning-bolt {
  position: absolute;
  width: 4px;
  background: white;
  box-shadow: 0 0 20px 8px rgba(255, 255, 255, 0.8), 0 0 60px 20px rgba(255, 213, 106, 0.45);
  animation: lightningStrike 0.15s ease-out forwards;
  transform-origin: top;
}

@keyframes lightningStrike {
  0% { opacity: 0; transform: scaleY(0); }
  20% { opacity: 1; transform: scaleY(1); }
  100% { opacity: 0; transform: scaleY(1); }
}

.drop-anim-tier-1 .won-card { animation: dropCommon 0.8s ease-out forwards; }
.drop-anim-tier-2 .won-card { animation: dropUncommon 1.2s ease-out forwards; }
.drop-anim-tier-3 .won-card { animation: dropRare 1.6s ease-out forwards; }
.drop-anim-tier-4 .won-card { animation: dropLegendary 1.8s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

@keyframes dropCommon {
  0% { opacity: 0; transform: scale(0.3) rotateY(90deg); }
  60% { transform: scale(1.05) rotateY(0); }
  100% { opacity: 1; transform: scale(1) rotateY(0); }
}

@keyframes dropUncommon {
  0% { opacity: 0; transform: scale(0.2) translateY(100px); }
  40% { transform: scale(1.15) translateY(-20px); }
  70% { transform: scale(0.95) translateY(5px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes dropRare {
  0% { opacity: 0; transform: scale(0) rotate(-20deg); filter: brightness(3); }
  30% { transform: scale(1.3) rotate(5deg); filter: brightness(2); }
  50% { transform: scale(0.9) rotate(-3deg); }
  70% { transform: scale(1.1) rotate(2deg); filter: brightness(1.5); }
  100% { opacity: 1; transform: scale(1) rotate(0); filter: brightness(1); }
}

@keyframes dropLegendary {
  0% {
    opacity: 0;
    transform: scale(0.72) translateY(36px);
    filter: brightness(0.2) blur(8px);
  }
  35% {
    opacity: 1;
    transform: scale(1.04) translateY(-6px);
    filter: brightness(1.35) blur(0);
  }
  60% {
    transform: scale(0.98) translateY(2px);
    filter: brightness(1.1);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: brightness(1);
  }
}

/* ===== Owl omen reveal ===== */
.drop-overlay.owl-legendary {
  background:
    radial-gradient(ellipse at 50% 42%, rgba(180, 20, 20, 0.5) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 100%, rgba(232, 163, 23, 0.12) 0%, transparent 40%),
    rgba(8, 2, 4, 0.94);
}

.red-screen.omen-crimson {
  background:
    radial-gradient(circle at 50% 40%, rgba(160, 0, 0, 0.35) 0%, transparent 50%),
    linear-gradient(180deg, #4a0008 0%, #1a0004 55%, #0a0002 100%);
  animation: omenCrimsonPulse 3.5s ease-in-out infinite;
  opacity: 0.9;
}

@keyframes omenCrimsonPulse {
  0%, 100% { opacity: 0.72; }
  50% { opacity: 0.9; }
}

.owl-reveal {
  position: relative;
  width: min(340px, 86vw);
  min-height: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: dropLegendary 1.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.owl-bloom {
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 220, 100, 0.45) 0%, rgba(255, 80, 0, 0.18) 35%, transparent 70%);
  filter: blur(8px);
  animation: owlBloom 3.2s ease-in-out infinite;
  z-index: 0;
  pointer-events: none;
}

@keyframes owlBloom {
  0%, 100% { transform: scale(0.92); opacity: 0.7; }
  50% { transform: scale(1.12); opacity: 1; }
}

.owl-rays {
  position: absolute;
  width: 420px;
  height: 420px;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(255, 220, 120, 0.14) 8deg,
    transparent 16deg,
    transparent 40deg,
    rgba(255, 60, 40, 0.1) 48deg,
    transparent 56deg,
    transparent 80deg,
    rgba(255, 220, 120, 0.12) 88deg,
    transparent 96deg,
    transparent 360deg
  );
  mask-image: radial-gradient(circle, black 10%, transparent 68%);
  -webkit-mask-image: radial-gradient(circle, black 10%, transparent 68%);
  animation: owlRaysSpin 18s linear infinite;
  z-index: 0;
  pointer-events: none;
  opacity: 0.85;
}

@keyframes owlRaysSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.owl-rings {
  position: absolute;
  width: 260px;
  height: 260px;
  z-index: 1;
  pointer-events: none;
}

.owl-rings span {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 215, 90, 0.35);
  animation: owlRingExpand 3.6s ease-out infinite;
}

.owl-rings span:nth-child(2) {
  animation-delay: 1.2s;
  border-color: rgba(255, 80, 60, 0.3);
}

.owl-rings span:nth-child(3) {
  animation-delay: 2.4s;
  border-color: rgba(255, 235, 180, 0.25);
}

@keyframes owlRingExpand {
  0% { transform: scale(0.55); opacity: 0.85; }
  100% { transform: scale(1.85); opacity: 0; }
}

.owl-feathers {
  position: absolute;
  inset: -40px -20px;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
}

.owl-feather {
  position: absolute;
  top: -30px;
  left: var(--l);
  width: var(--s);
  height: calc(var(--s) * 2.4);
  background: linear-gradient(180deg, #fff6d0 0%, #ffb300 40%, #c62828 100%);
  border-radius: 60% 40% 60% 40%;
  opacity: 0.75;
  filter: blur(0.3px);
  animation: featherFall var(--t) linear infinite;
  animation-delay: var(--d);
  transform-origin: center top;
}

@keyframes featherFall {
  0% {
    transform: translateY(0) rotate(0deg) translateX(0);
    opacity: 0;
  }
  10% { opacity: 0.85; }
  50% {
    transform: translateY(220px) rotate(120deg) translateX(18px);
    opacity: 0.7;
  }
  100% {
    transform: translateY(460px) rotate(260deg) translateX(-12px);
    opacity: 0;
  }
}

.owl-card-shell {
  position: relative;
  z-index: 5;
  border-radius: 14px;
  animation: owlFloat 4.5s ease-in-out infinite;
  animation-delay: 1.8s;
}

.owl-card-shell .meme-card {
  width: 240px;
  height: 336px;
  box-shadow:
    0 0 0 1px rgba(255, 220, 120, 0.45),
    0 20px 60px rgba(0, 0, 0, 0.55),
    0 0 50px rgba(255, 60, 40, 0.35),
    0 0 90px rgba(255, 200, 60, 0.28);
}

.owl-shimmer {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  overflow: hidden;
  pointer-events: none;
  z-index: 6;
}

.owl-shimmer::before {
  content: '';
  position: absolute;
  top: -20%;
  left: -60%;
  width: 40%;
  height: 140%;
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(255, 255, 255, 0.05) 35%,
    rgba(255, 240, 180, 0.45) 50%,
    rgba(255, 255, 255, 0.05) 65%,
    transparent 100%
  );
  animation: owlShimmer 3.8s ease-in-out infinite;
  animation-delay: 1.5s;
}

@keyframes owlShimmer {
  0%, 20% { transform: translateX(0) skewX(-18deg); opacity: 0; }
  35% { opacity: 1; }
  70%, 100% { transform: translateX(420%) skewX(-18deg); opacity: 0; }
}

@keyframes owlFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.owl-subtitle {
  position: relative;
  z-index: 5;
  margin: 18px 0 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255, 200, 190, 0.72);
  letter-spacing: 0.04em;
  animation: owlSubtitleIn 1.8s ease-out 0.4s both;
}

@keyframes owlSubtitleIn {
  from { opacity: 0; filter: blur(4px); transform: translateY(8px); }
  to { opacity: 1; filter: blur(0); transform: translateY(0); }
}

.drop-rarity-label.owl-title {
  margin-top: 8px;
  font-size: 1.05rem;
  letter-spacing: 0.18em;
  color: #ffe082;
  text-shadow:
    0 0 20px rgba(255, 60, 40, 0.7),
    0 0 40px rgba(255, 200, 60, 0.4);
}

.drop-anim-tier-4.owl-legendary .won-card {
  animation: none;
  overflow: visible;
}

.drop-anim-tier-4.owl-legendary .drop-content { overflow: visible; }

.drop-anim-tier-4:not(.owl-legendary) .won-card {
  animation: dropLegendary 1.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@media (max-width: 480px) {
  .owl-card-shell .meme-card {
    width: 200px;
    height: 280px;
  }
  .owl-reveal { min-height: 360px; }
}

.screen-shake { animation: screenShake 0.5s ease-in-out; }

@keyframes screenShake {
  0%, 100% { transform: translate(0); }
  10% { transform: translate(-8px, 4px); }
  20% { transform: translate(8px, -4px); }
  30% { transform: translate(-6px, -6px); }
  40% { transform: translate(6px, 6px); }
  50% { transform: translate(-4px, 2px); }
  60% { transform: translate(4px, -2px); }
  70% { transform: translate(-2px, 4px); }
  80% { transform: translate(2px, -4px); }
}

/* ===== Auth modal ===== */
body.auth-locked #roulette-screen {
  filter: blur(6px) saturate(0.85);
  pointer-events: none;
  user-select: none;
}

.auth-modal {
  z-index: 600;
  align-items: center;
  justify-content: center;
}

.auth-backdrop {
  background:
    radial-gradient(ellipse at 50% 20%, rgba(232, 163, 23, 0.14), transparent 45%),
    rgba(6, 10, 8, 0.72);
}

.auth-modal .modal-content {
  border-radius: 24px;
  max-width: 420px;
  width: calc(100% - 32px);
  padding: 36px 28px 28px;
  text-align: center;
  animation: authPop 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  background:
    linear-gradient(180deg, rgba(232, 163, 23, 0.08), transparent 28%),
    var(--surface);
  border: 1px solid var(--line);
}

@keyframes authPop {
  from { opacity: 0; transform: scale(0.94) translateY(18px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.auth-hero {
  margin-bottom: 8px;
}

.auth-logo {
  display: inline-block;
  font-size: 3.2rem;
  margin-bottom: 6px;
  animation: floatSoft 3.4s ease-in-out infinite;
  filter: drop-shadow(0 8px 18px rgba(232, 163, 23, 0.25));
}

.auth-brand {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  line-height: 1;
  margin-bottom: 10px;
  color: var(--text);
}

.auth-modal-content h2 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
  color: var(--accent);
}

.auth-subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 22px;
  line-height: 1.55;
}

.auth-steps {
  text-align: left;
  margin: 0 auto 24px;
  padding: 14px 14px 14px 32px;
  max-width: 320px;
  color: var(--text);
  line-height: 1.85;
  font-size: 0.92rem;
  background: rgba(0, 0, 0, 0.18);
  border-radius: 14px;
  border: 1px solid var(--line);
}

.btn-telegram {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px 20px;
  background: linear-gradient(135deg, #2AABEE, #1e8fc7);
  color: #fff;
  font-size: 1.02rem;
  font-weight: 800;
  text-decoration: none;
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(34, 158, 217, 0.28);
}

.btn-telegram:hover {
  transform: translateY(-2px);
  color: #fff;
}

.btn-telegram.disabled {
  opacity: 0.6;
  pointer-events: none;
}

.auth-bot-name {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.auth-alt {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.auth-alt strong { color: var(--text); }

.btn-logout {
  margin-left: auto;
  padding: 8px 14px;
  font-size: 0.82rem;
  flex-shrink: 0;
}

/* ===== Profile Modal ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal.active { display: flex; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 6, 0.62);
  backdrop-filter: blur(6px);
}

.modal-content {
  position: relative;
  background:
    linear-gradient(180deg, rgba(232, 163, 23, 0.06), transparent 18%),
    var(--surface);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
  animation: slideUp 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  border-top: 1px solid var(--line);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--surface2);
  border: 1px solid var(--line);
  color: var(--muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.95rem;
  z-index: 1;
  transition: color 0.15s, border-color 0.15s;
}

.modal-close:hover {
  color: var(--text);
  border-color: var(--accent);
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding-right: 40px;
  flex-wrap: wrap;
}

.profile-meta { min-width: 0; }

.profile-big-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--surface2);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--accent);
  flex-shrink: 0;
}

.profile-header h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-header p {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 4px;
}

.collection-title {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 16px;
}

.collection-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: inherit;
  font: inherit;
  text-align: center;
}

.collection-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 12px;
}

.collection-item .meme-card {
  width: 120px;
  height: 168px;
  transition: transform 0.2s;
}

.collection-item:hover .meme-card { transform: scale(1.04) translateY(-2px); }
.collection-item .meme-card-footer { bottom: 4px; padding: 0 5px; }
.collection-item .meme-card-user,
.collection-item .meme-card-serial { font-size: 0.45rem; }

.collection-date {
  font-size: 0.7rem;
  color: var(--muted);
}

.empty-collection {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 48px 20px;
  line-height: 1.5;
}

/* ===== Card view modal ===== */
.card-view-modal {
  z-index: 700;
  align-items: center;
  justify-content: center;
}

.card-view-content {
  border-radius: 24px;
  max-width: 440px;
  width: calc(100% - 32px);
  max-height: 92vh;
  padding: 28px 20px 24px;
  text-align: center;
  animation: authPop 0.3s ease-out;
  overflow: visible;
  border: 1px solid var(--line);
}

.card-view-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 340px;
  margin-bottom: 12px;
  overflow: visible;
}

.card-view-preview .meme-card {
  width: 240px;
  height: 336px;
  animation: cardViewPop 0.35s ease-out;
}

.card-view-preview .meme-card-user,
.card-view-preview .meme-card-serial { font-size: 0.7rem; }

.card-view-stage .owl-reveal { min-height: 380px; }

.card-view-rarity {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 4px;
}

.card-view-rarity.tier-1 { color: var(--common); }
.card-view-rarity.tier-2 { color: var(--uncommon); }
.card-view-rarity.tier-3 { color: var(--rare); }
.card-view-rarity.tier-4 {
  color: var(--legendary);
  text-shadow: 0 0 16px rgba(255, 213, 106, 0.55);
}

.card-view-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

@keyframes cardViewPop {
  from { opacity: 0; transform: scale(0.85) translateY(16px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ===== Responsive ===== */
@media (max-width: 720px) {
  .header {
    flex-wrap: wrap;
    row-gap: 10px;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  :root {
    --card-w: 110px;
    --card-h: 154px;
  }

  .brand-name { font-size: 0.95rem; }
  .auth-brand { font-size: 1.55rem; letter-spacing: 0.18em; }
  .btn-spin { padding: 16px 48px; font-size: 0.95rem; }
  .won-card .meme-card { width: 200px; height: 280px; }
  .roulette-main { gap: 22px; padding-top: 20px; }
  .profile-header { padding-right: 36px; }
  .balance-label { display: none; }
  .header-chip { padding: 8px 10px; font-size: 0.75rem; }
  .topup-combo { min-width: 96px; padding: 5px; gap: 5px; }
  .topup-combo-main { padding: 7px 10px; font-size: 0.72rem; }
  .topup-combo-discount { font-size: 0.68rem; }
}

@media (min-width: 720px) {
  .modal {
    align-items: center;
  }

  .profile-modal-content {
    border-radius: 24px;
    max-height: 80vh;
    border: 1px solid var(--line);
    animation: authPop 0.35s ease-out;
  }
}
