/* ===== AnythingQR — loot-box theme ===== */
:root {
  --bg: #07060f;
  --bg-2: #0d0b1f;
  --neon: #00e5ff;
  --neon-2: #b14bff;
  --gold: #ffd54a;
  --legendary: #ff8a00;
  --text: #eaf6ff;
  --muted: #8c89a8;
  --ok: #4ade80;
  --err: #ff5b7f;
  --radius: 18px;
  --shadow-neon: 0 0 24px rgba(0, 229, 255, .45), 0 0 60px rgba(177, 75, 255, .35);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(120% 120% at 50% -10%, var(--bg-2), var(--bg) 60%);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  overflow-x: hidden;
}

/* ---- background fx ---- */
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(0, 229, 255, .06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(177, 75, 255, .06) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 50% 30%, #000 30%, transparent 80%);
  animation: drift 22s linear infinite;
}
.bg-glow {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(40% 40% at 20% 20%, rgba(177, 75, 255, .22), transparent 60%),
    radial-gradient(40% 40% at 80% 30%, rgba(0, 229, 255, .20), transparent 60%);
  filter: blur(10px);
}
@keyframes drift { to { background-position: 440px 440px, 440px 440px; } }

/* ---- layout ---- */
.stage {
  position: relative; z-index: 2;
  max-width: 640px; margin: 0 auto; padding: 32px 20px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 22px;
  min-height: 88vh;
}
.brand { text-align: center; }
.brand__title {
  margin: 0; font-size: clamp(34px, 8vw, 58px); font-weight: 900; letter-spacing: 2px;
  background: linear-gradient(90deg, var(--neon), var(--neon-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: var(--shadow-neon); filter: drop-shadow(0 0 18px rgba(0, 229, 255, .25));
}
.brand__title span { color: var(--gold); -webkit-text-fill-color: var(--gold); }
.brand__tag { margin: 6px 0 0; color: var(--muted); font-size: 15px; }

/* ---- panels ---- */
.panel { display: none; width: 100%; flex-direction: column; align-items: center; gap: 18px; }
.panel.is-active { display: flex; animation: panelIn .45s cubic-bezier(.2, .9, .25, 1.2) both; }
@keyframes panelIn { from { opacity: 0; transform: translateY(18px) scale(.98); } }

/* ---- input panel ---- */
.modes { display: flex; gap: 10px; width: 100%; }
.mode-btn {
  flex: 1; cursor: pointer; padding: 12px 8px; border-radius: 14px;
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .10);
  color: var(--text); display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: transform .15s, border-color .2s, box-shadow .2s, background .2s;
}
.mode-btn:hover { transform: translateY(-2px); border-color: rgba(0, 229, 255, .5); }
.mode-btn.is-selected {
  border-color: var(--neon); background: rgba(0, 229, 255, .10); box-shadow: var(--shadow-neon);
}
.mode-btn__icon { font-size: 22px; }
.mode-btn__label { font-size: 13px; font-weight: 700; letter-spacing: .5px; }

.field { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.field__label { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .5px; text-transform: uppercase; }
.field__input {
  width: 100%; resize: vertical; min-height: 64px; padding: 14px 16px; border-radius: 14px;
  background: rgba(0, 0, 0, .35); border: 1px solid rgba(255, 255, 255, .12);
  color: var(--text); font-size: 16px; font-family: inherit; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field__input:focus { border-color: var(--neon); box-shadow: 0 0 0 3px rgba(0, 229, 255, .18); }
.hint { margin: 0; min-height: 18px; font-size: 13px; color: var(--muted); align-self: flex-start; }
.hint.is-error { color: var(--err); }

/* ---- buttons ---- */
.btn {
  cursor: pointer; border: 1px solid transparent; border-radius: 14px; padding: 14px 22px;
  font-size: 15px; font-weight: 800; letter-spacing: .4px; color: var(--text);
  transition: transform .12s, box-shadow .2s, opacity .2s, background .2s; font-family: inherit;
}
.btn:active { transform: scale(.97); }
.btn--primary {
  background: linear-gradient(90deg, var(--neon), var(--neon-2)); color: #05030d;
  box-shadow: var(--shadow-neon);
}
.btn--primary:hover { transform: translateY(-2px); }
.btn--primary:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; transform: none; }
.btn--ghost { background: rgba(255, 255, 255, .05); border-color: rgba(255, 255, 255, .14); }
.btn--ghost:hover { border-color: var(--neon); background: rgba(0, 229, 255, .08); }
.btn__spark { filter: drop-shadow(0 0 6px var(--gold)); }

/* ---- present ---- */
.present__hint { color: var(--muted); font-size: 15px; animation: pulseText 1.6s ease-in-out infinite; }
@keyframes pulseText { 50% { opacity: .4; } }
.present {
  position: relative; width: 240px; height: 240px; background: none; border: 0; cursor: pointer;
  display: grid; place-items: center; animation: float 3s ease-in-out infinite;
}
.present.is-charging { animation: shake .35s linear infinite; }
.present.is-open { pointer-events: none; }
@keyframes float { 50% { transform: translateY(-12px); } }
@keyframes shake {
  10%, 90% { transform: translate(-2px, 1px) rotate(-1deg); }
  50% { transform: translate(3px, -2px) rotate(1.5deg); }
}

.present__aura {
  position: absolute; inset: -30px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 138, 0, .55), rgba(177, 75, 255, .25) 45%, transparent 70%);
  filter: blur(14px); animation: auraPulse 2.4s ease-in-out infinite;
}
@keyframes auraPulse { 50% { transform: scale(1.18); opacity: .8; } }
.present.is-charging .present__aura { animation: auraPulse .4s ease-in-out infinite; }

.present__box { position: relative; width: 160px; height: 150px; }
.present__body {
  position: absolute; bottom: 0; width: 160px; height: 116px; border-radius: 10px;
  background: linear-gradient(160deg, #2a1c5e, #5a2da8 60%, #7a3fd6);
  box-shadow: inset 0 -10px 20px rgba(0, 0, 0, .35), var(--shadow-neon); overflow: hidden;
}
.present__lid {
  position: absolute; top: 0; left: -8px; width: 176px; height: 48px; border-radius: 10px;
  background: linear-gradient(160deg, #3a2680, #6f3ad1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .4), var(--shadow-neon);
  transform-origin: center bottom; transition: transform .3s; z-index: 3;
}
.present__ribbon-v {
  position: absolute; left: 50%; top: 0; transform: translateX(-50%); width: 26px; height: 100%;
  background: linear-gradient(var(--gold), var(--legendary));
}
.present__ribbon-h {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 100%; height: 22px;
  background: linear-gradient(90deg, var(--legendary), var(--gold));
}
.present__bow {
  position: absolute; left: 50%; top: -14px; transform: translateX(-50%);
  width: 44px; height: 26px; border-radius: 50% 50% 45% 45%;
  background: radial-gradient(circle at 50% 40%, var(--gold), var(--legendary));
  box-shadow: 0 0 14px var(--gold);
}
.present__shine {
  position: absolute; top: -40%; left: -60%; width: 60%; height: 200%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: rotate(18deg); animation: sweep 3.2s ease-in-out infinite;
}
@keyframes sweep { 0%, 60% { left: -60%; } 100% { left: 140%; } }

/* charge ring fills while holding/opening */
.present__charge {
  position: absolute; inset: -18px; border-radius: 50%;
  border: 4px solid transparent; opacity: 0;
}
.present.is-charging .present__charge {
  opacity: 1; border-color: var(--gold);
  box-shadow: 0 0 26px var(--gold), inset 0 0 26px var(--legendary);
  animation: spin .6s linear infinite, chargeGrow .55s ease-out forwards;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes chargeGrow { from { transform: scale(.7); } to { transform: scale(1.25); } }

/* explosion: lid flies off + box pops */
.present.is-open .present__lid { transform: translateY(-160px) rotate(28deg); opacity: 0; }
.present.is-open .present__box {
  animation: boxPop .5s cubic-bezier(.2, .9, .25, 1.4) forwards;
}
@keyframes boxPop {
  35% { transform: scale(1.25, .8); }
  100% { transform: scale(0); opacity: 0; }
}

/* ---- reveal ---- */
.qr-card {
  width: 100%; max-width: 460px; padding: 18px; border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(255, 138, 0, .14), rgba(177, 75, 255, .12));
  border: 1px solid rgba(255, 213, 74, .4); box-shadow: 0 0 40px rgba(255, 138, 0, .35);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  animation: dropIn .6s cubic-bezier(.15, .9, .2, 1.4) both;
}
@keyframes dropIn { from { opacity: 0; transform: scale(.4) rotate(-8deg); } }
.qr-card__rarity {
  font-size: 13px; font-weight: 900; letter-spacing: 3px; color: var(--gold);
  text-shadow: 0 0 10px var(--legendary);
}
.qr-frame {
  position: relative; width: min(360px, 80vw); aspect-ratio: 1; border-radius: 14px;
  background: #fff; padding: 14px; overflow: hidden; box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
}
.qr-preview { width: 100%; height: 100%; image-rendering: pixelated; display: block; }
.qr-frame__shine {
  position: absolute; top: 0; left: -80%; width: 50%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .8), transparent);
  transform: skewX(-18deg); animation: shineSweep 2.6s ease-in-out 1; pointer-events: none;
}
@keyframes shineSweep { 0% { left: -80%; } 60%, 100% { left: 160%; } }
.qr-meta { margin: 0; font-size: 13px; color: var(--muted); word-break: break-all; text-align: center; max-width: 460px; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.action-status { min-height: 18px; font-size: 13px; color: var(--ok); }

/* ---- fx overlay ---- */
.fx { position: fixed; inset: 0; z-index: 50; pointer-events: none; }

/* ---- screen shake ---- */
.shake-screen { animation: screenShake .45s cubic-bezier(.36, .07, .19, .97) both; }
@keyframes screenShake {
  10% { transform: translate(-6px, 4px); } 30% { transform: translate(7px, -5px); }
  50% { transform: translate(-5px, 6px); } 70% { transform: translate(6px, -4px); }
  90% { transform: translate(-3px, 2px); }
}

.footer { position: relative; z-index: 2; text-align: center; color: var(--muted); font-size: 12px; padding: 18px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; }
}
