:root {
  --bg0: #0a0616;
  --bg1: #150b2e;
  --glow1: #ff2e97;
  --glow2: #00e5ff;
  --accentA: #ff2e97;
  --accentB: #8a2be2;
  --gold: #ffd93d;
  --card: rgba(30, 18, 58, 0.55);
  --border: rgba(255, 255, 255, 0.12);
  --txt: #f3ecff;
  --muted: #b8a9dd;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Vazirmatn', 'Bricolage Grotesque', sans-serif;
  background:
    radial-gradient(1200px 700px at 20% -10%, rgba(255,46,151,0.22), transparent 60%),
    radial-gradient(1000px 600px at 90% 10%, rgba(0,229,255,0.18), transparent 55%),
    radial-gradient(900px 700px at 50% 110%, rgba(138,43,226,0.30), transparent 60%),
    linear-gradient(160deg, var(--bg0), var(--bg1));
  color: var(--txt);
  min-height: 100vh;
  overflow-x: hidden;
}
[dir="ltr"] body { font-family: 'Bricolage Grotesque', 'Vazirmatn', sans-serif; }

/* stars */
#stars { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.star {
  position: absolute; background: #fff; border-radius: 50%;
  animation: twinkle 4s ease-in-out infinite;
}
@keyframes twinkle { 0%,100% { opacity: .2; } 50% { opacity: 1; } }

#root { position: relative; z-index: 1; }

.app-shell {
  max-width: 720px; margin: 0 auto; padding: 24px 18px 60px;
  display: flex; flex-direction: column; align-items: center;
  animation: fadeUp .6s ease both;
}

/* header */
.app-header { text-align: center; width: 100%; position: relative; margin-bottom: 8px; }
.app-title {
  font-size: clamp(2.2rem, 8vw, 3.6rem); font-weight: 900; line-height: 1.1;
  background: linear-gradient(90deg, var(--glow1), var(--gold), var(--glow2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 24px rgba(255,46,151,0.4));
  margin-top: 30px;
}
.app-tagline { color: var(--muted); margin-top: 10px; font-weight: 300; font-size: 1rem; }

.lang-toggle {
  position: absolute; top: 0; inset-inline-end: 0; display: flex; gap: 4px;
  background: rgba(0,0,0,0.3); border: 1px solid var(--border); border-radius: 999px; padding: 3px;
}
.lang-btn {
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  padding: 5px 12px; border-radius: 999px; font-size: .8rem; font-family: inherit; font-weight: 500;
  transition: .2s;
}
.lang-btn.on { background: linear-gradient(90deg, var(--accentA), var(--accentB)); color: #fff; }

.coll-open-btn {
  margin-top: 14px; border: 1px solid var(--border); background: rgba(255,255,255,0.05);
  color: var(--txt); padding: 8px 18px; border-radius: 999px; cursor: pointer;
  font-family: inherit; font-weight: 500; font-size: .9rem; transition: .2s; backdrop-filter: blur(8px);
}
.coll-open-btn:hover { background: rgba(255,255,255,0.12); transform: translateY(-2px); }

/* chips */
.chip-row {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  margin: 22px 0 8px; width: 100%;
}
.chip {
  border: 1px solid var(--border); background: rgba(255,255,255,0.04); color: var(--muted);
  padding: 8px 14px; border-radius: 999px; cursor: pointer; font-family: inherit;
  font-size: .85rem; font-weight: 500; transition: .2s; white-space: nowrap;
}
.chip:hover { color: var(--txt); border-color: rgba(255,255,255,0.3); }
.chip.active {
  background: linear-gradient(90deg, var(--accentA), var(--accentB)); color: #fff;
  border-color: transparent; transform: scale(1.06);
  box-shadow: 0 0 20px rgba(255,46,151,0.5);
}

/* big button */
.button-zone { text-align: center; margin: 26px 0 10px; }
.big-btn {
  width: 168px; height: 168px; border-radius: 50%; border: none; cursor: pointer;
  font-family: inherit; font-weight: 900; font-size: 1.7rem; color: #fff;
  background: radial-gradient(circle at 30% 30%, #ff6fc0, var(--accentA) 40%, var(--accentB));
  box-shadow: 0 0 0 6px rgba(255,255,255,0.06), 0 0 45px rgba(255,46,151,0.6), inset 0 -8px 20px rgba(0,0,0,0.35);
  animation: pulse 2.4s ease-in-out infinite; transition: transform .15s;
  letter-spacing: 1px;
}
.big-btn:active { transform: scale(0.93); }
.big-btn:hover:not(:disabled) { transform: scale(1.05); }
.big-btn.spinning { animation: spin 0.9s linear infinite; font-size: 3rem; }
.big-btn:disabled { cursor: wait; }
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 6px rgba(255,255,255,0.06), 0 0 40px rgba(255,46,151,0.55), inset 0 -8px 20px rgba(0,0,0,0.35); }
  50% { box-shadow: 0 0 0 10px rgba(255,255,255,0.10), 0 0 70px rgba(0,229,255,0.55), inset 0 -8px 20px rgba(0,0,0,0.35); }
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-msg { margin-top: 16px; color: var(--glow2); font-weight: 300; animation: fadeUp .3s ease; }
.counter { margin-top: 12px; color: var(--muted); font-size: .8rem; font-weight: 300; }

/* result */
.result-zone { width: 100%; margin-top: 12px; display: flex; flex-direction: column; align-items: center; }
.result-card {
  width: 100%; background: var(--card); border: 1px solid var(--border); border-radius: 22px;
  padding: 24px; backdrop-filter: blur(14px); position: relative;
  animation: fadeUp .45s cubic-bezier(.2,.8,.2,1) both;
  box-shadow: 0 18px 50px rgba(0,0,0,0.4);
}
.result-card.jackpot {
  border-color: var(--gold);
  box-shadow: 0 0 40px rgba(255,217,61,0.5), 0 18px 50px rgba(0,0,0,0.4);
  animation: fadeUp .45s cubic-bezier(.2,.8,.2,1) both, goldpulse 1.6s ease-in-out infinite;
}
@keyframes goldpulse { 0%,100% { box-shadow: 0 0 30px rgba(255,217,61,0.35), 0 18px 50px rgba(0,0,0,0.4);} 50% { box-shadow: 0 0 55px rgba(255,217,61,0.7), 0 18px 50px rgba(0,0,0,0.4);} }

.res-chip {
  display: inline-block; background: linear-gradient(90deg, var(--accentA), var(--accentB));
  color: #fff; font-size: .72rem; font-weight: 700; padding: 4px 12px; border-radius: 999px;
  margin-bottom: 14px; letter-spacing: .5px;
}
.jackpot-tag { color: var(--gold); font-weight: 700; margin-bottom: 12px; font-size: .9rem; }

.res-quote {
  font-size: 1.3rem; line-height: 1.7; font-weight: 300; white-space: pre-line;
  border-inline-start: 4px solid var(--glow2); padding-inline-start: 16px;
}

/* pokemon */
.poke-wrap { text-align: center; }
.poke-img { width: 180px; height: 180px; object-fit: contain; filter: drop-shadow(0 6px 20px rgba(0,229,255,0.4)); animation: float 3s ease-in-out infinite; }
.poke-img.shiny { filter: drop-shadow(0 0 22px var(--gold)); }
.poke-img.placeholder { display: flex; align-items: center; justify-content: center; font-size: 4rem; color: var(--muted); }
@keyframes float { 0%,100% { transform: translateY(0);} 50% { transform: translateY(-12px);} }
.poke-name { font-size: 1.6rem; font-weight: 800; text-transform: capitalize; margin: 6px 0 12px; }
.shiny-badge { font-size: .7rem; background: var(--gold); color: #3a2a00; padding: 3px 8px; border-radius: 999px; margin-inline-start: 8px; vertical-align: middle; font-weight: 700; }
.type-row { display: flex; gap: 8px; justify-content: center; margin-bottom: 16px; flex-wrap: wrap; }
.type-badge { padding: 4px 12px; border-radius: 999px; font-size: .75rem; font-weight: 700; text-transform: capitalize; color: #fff; background: #5a5a7a; }
.type-fire{background:#e35a3c}.type-water{background:#3b8ee0}.type-grass{background:#4caf50}.type-electric{background:#e0b400;color:#3a2a00}.type-psychic{background:#e0559a}.type-ice{background:#67c9d6;color:#053}.type-dragon{background:#7038f8}.type-dark{background:#3a3a48}.type-fairy{background:#e69ac7}.type-poison{background:#9b4f9b}.type-ground{background:#c9a227;color:#3a2a00}.type-rock{background:#a08b3d}.type-bug{background:#8fb01e}.type-ghost{background:#6a4b8a}.type-steel{background:#8b8ba0}.type-fighting{background:#b03530}.type-flying{background:#7fa8e0}.type-normal{background:#7a7a8c}
.stats { max-width: 340px; margin: 0 auto; }
.stat-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.stat-name { width: 60px; font-size: .72rem; color: var(--muted); text-transform: capitalize; text-align: start; }
.stat-bar-bg { flex: 1; height: 8px; background: rgba(255,255,255,0.1); border-radius: 999px; overflow: hidden; }
.stat-bar { height: 100%; background: linear-gradient(90deg, var(--glow2), var(--glow1)); border-radius: 999px; transition: width .6s ease; }
.stat-val { width: 32px; font-size: .8rem; font-weight: 700; text-align: end; }

/* cocktail */
.cocktail-wrap { text-align: center; }
.cocktail-img { width: 160px; height: 160px; object-fit: cover; border-radius: 18px; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.cocktail-name { font-size: 1.5rem; font-weight: 800; margin: 12px 0; }
.sub-head { color: var(--glow2); font-weight: 700; font-size: .85rem; margin-bottom: 6px; }
.ing-list { list-style: none; margin-bottom: 14px; }
.ing-list li { padding: 4px 0; border-bottom: 1px dashed var(--border); font-weight: 300; }
.instr { font-weight: 300; line-height: 1.6; color: var(--muted); text-align: start; }

/* activity */
.activity-wrap { text-align: center; }
.activity-text { font-size: 1.3rem; font-weight: 300; line-height: 1.6; margin-bottom: 16px; }
.activity-meta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.meta-pill { background: rgba(255,255,255,0.08); border: 1px solid var(--border); padding: 4px 12px; border-radius: 999px; font-size: .8rem; }

/* image */
.img-wrap { text-align: center; }
.rand-img { width: 100%; max-width: 500px; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.45); }
.img-caption { margin-top: 10px; color: var(--muted); font-family: 'JetBrains Mono', monospace; font-size: .85rem; }

/* actions */
.result-actions { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; justify-content: center; }
.act-btn {
  border: 1px solid var(--border); background: rgba(255,255,255,0.06); color: var(--txt);
  padding: 10px 20px; border-radius: 999px; cursor: pointer; font-family: inherit;
  font-weight: 500; font-size: .9rem; transition: .2s; backdrop-filter: blur(8px);
}
.act-btn:hover { background: rgba(255,255,255,0.14); transform: translateY(-2px); }
.act-btn.save { border-color: var(--glow1); }
.act-btn.save.flashed { background: #4dff9e; color: #043; border-color: transparent; }

/* footer */
.app-footer { margin-top: 40px; color: var(--muted); font-size: .8rem; font-weight: 300; text-align: center; }
.app-footer a { color: var(--glow2); text-decoration: none; font-weight: 500; }
.app-footer a:hover { text-decoration: underline; }

/* drawer */
.drawer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.55); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: .3s; z-index: 20; }
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; inset-inline-end: 0; height: 100%; width: min(400px, 88vw);
  background: linear-gradient(180deg, #1a0f38, #0d0722); border-inline-start: 1px solid var(--border);
  transform: translateX(110%); transition: transform .35s cubic-bezier(.2,.8,.2,1); z-index: 21;
  display: flex; flex-direction: column; box-shadow: -10px 0 40px rgba(0,0,0,0.5);
}
[dir="ltr"] .drawer { transform: translateX(110%); }
[dir="rtl"] .drawer { transform: translateX(-110%); }
.drawer.open { transform: translateX(0) !important; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 20px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { font-size: 1.2rem; font-weight: 800; }
.drawer-close { background: none; border: none; color: var(--muted); font-size: 1.4rem; cursor: pointer; }
.drawer-body { padding: 16px; overflow-y: auto; flex: 1; }
.empty-coll { color: var(--muted); font-weight: 300; text-align: center; margin-top: 40px; line-height: 1.6; }
.mini-card { background: rgba(255,255,255,0.05); border: 1px solid var(--border); border-radius: 14px; padding: 12px; margin-bottom: 12px; }
.mini-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.mini-label { font-size: .7rem; font-weight: 700; color: var(--glow1); }
.mini-remove { background: none; border: none; color: var(--muted); font-size: .75rem; cursor: pointer; }
.mini-remove:hover { color: var(--glow1); }
.mini-body p { font-size: .85rem; font-weight: 300; line-height: 1.5; }
.mini-poke { display: flex; align-items: center; gap: 10px; }
.mini-poke img { width: 44px; height: 44px; object-fit: contain; }
.mini-poke span { font-weight: 700; text-transform: capitalize; }
.mini-img { width: 100%; border-radius: 10px; }

/* confetti */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.confetti { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); opacity: 0; } }

@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 480px) {
  .big-btn { width: 140px; height: 140px; font-size: 1.4rem; }
  .chip { font-size: .78rem; padding: 7px 11px; }
  .result-card { padding: 18px; }
}