/* ==========================================================================
   RoyalMC — Camada de estilos customizados
   Complementa o Tailwind (CDN) com efeitos que utilitários não cobrem bem:
   glassmorphism, brilhos neon, partículas de brasa, animações de dialogs etc.
   Paleta extraída da logo: amarelo → ouro → laranja → vermelho → carmesim.
   ========================================================================== */

:root {
  --royal-yellow: #ffe11a;
  --royal-gold: #ffb800;
  --royal-orange: #ff6a00;
  --royal-red: #e3170a;
  --royal-crimson: #9e0b0b;

  --ink-950: #080504;
  --ink-900: #0e0907;
  --ink-800: #160e0b;
  --ink-700: #21150f;

  --fire-gradient: linear-gradient(135deg, var(--royal-yellow) 0%, var(--royal-gold) 30%, var(--royal-orange) 65%, var(--royal-red) 100%);
  --glass-bg: rgba(22, 14, 11, 0.55);
  --glass-border: rgba(255, 184, 0, 0.14);
  --header-h: 72px;

  color-scheme: dark;
}

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }

body {
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(227, 23, 10, 0.12), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(255, 106, 0, 0.08), transparent 60%),
    var(--ink-950);
  -webkit-font-smoothing: antialiased;
}

/* Textura sutil de "pixels" para remeter ao Minecraft */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.035;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.6) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.6) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}

::selection { background: var(--royal-orange); color: #000; }

/* Trava o scroll da página enquanto um modal/gaveta estiver aberto */
html:has(dialog[open]) { overflow: hidden; }

/* Scrollbar temática */
* { scrollbar-width: thin; scrollbar-color: var(--royal-orange) var(--ink-900); }

/* ---------- Utilitários de marca ---------- */
.text-fire {
  background: var(--fire-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.bg-fire { background: var(--fire-gradient); }

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid var(--glass-border);
}

/* Card com borda em gradiente neon que acende no hover */
.neon-card {
  position: relative;
  background: linear-gradient(180deg, rgba(33, 21, 15, 0.75), rgba(14, 9, 7, 0.85));
  border: 1px solid rgba(255, 184, 0, 0.1);
  border-radius: 1.25rem;
  transition: transform 0.35s cubic-bezier(.2, .8, .2, 1), border-color 0.35s, box-shadow 0.35s;
  isolation: isolate;
}
.neon-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: var(--fire-gradient);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.35s;
  z-index: -1;
}
.neon-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 50px -20px rgba(255, 106, 0, 0.45), 0 0 0 1px rgba(255, 184, 0, 0.05);
}
.neon-card:hover::before { opacity: 1; }

/* Botão principal "fogo" */
.btn-fire {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--fire-gradient);
  background-size: 160% 160%;
  color: #1a0700;
  font-weight: 800;
  border-radius: 0.875rem;
  box-shadow: 0 10px 30px -10px rgba(255, 106, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -3px 0 rgba(158, 11, 11, 0.45);
  transition: transform 0.2s, box-shadow 0.25s, background-position 0.5s;
}
.btn-fire:hover { transform: translateY(-2px); background-position: 100% 100%; box-shadow: 0 16px 40px -10px rgba(255, 106, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -3px 0 rgba(158, 11, 11, 0.45); }
.btn-fire:active { transform: translateY(1px); }
.btn-fire:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 0.875rem;
  border: 1px solid rgba(255, 184, 0, 0.2);
  background: rgba(255, 184, 0, 0.04);
  color: #ffe9c2;
  font-weight: 600;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.btn-ghost:hover { background: rgba(255, 184, 0, 0.1); border-color: rgba(255, 184, 0, 0.45); color: #fff; }

:where(button, a, input, select, summary):focus-visible {
  outline: 2px solid var(--royal-gold);
  outline-offset: 2px;
}

/* ---------- Header / navegação ---------- */
.site-header { height: var(--header-h); transition: background 0.3s, box-shadow 0.3s; }
.site-header.scrolled { background: rgba(8, 5, 4, 0.78); box-shadow: 0 10px 40px -20px rgba(0, 0, 0, 0.9); }

.nav-link { position: relative; z-index: 1; color: #cdb8a6; transition: color 0.25s; }
.nav-link:hover, .nav-link[aria-current="page"] { color: #fff; }

/* Pílula deslizante que indica a aba ativa */
.nav-indicator {
  position: absolute;
  top: 50%;
  height: 40px;
  translate: 0 -50%;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, rgba(255, 184, 0, 0.16), rgba(227, 23, 10, 0.16));
  border: 1px solid rgba(255, 184, 0, 0.35);
  box-shadow: 0 0 24px -6px rgba(255, 106, 0, 0.6), inset 0 0 12px rgba(255, 106, 0, 0.15);
  transition: left 0.4s cubic-bezier(.2, .8, .2, 1), width 0.4s cubic-bezier(.2, .8, .2, 1);
}
.nav-indicator::after {
  content: "";
  position: absolute;
  left: 20%;
  right: 20%;
  bottom: -9px;
  height: 2px;
  border-radius: 2px;
  background: var(--fire-gradient);
  box-shadow: 0 0 12px var(--royal-orange);
}

.logo-glow { filter: drop-shadow(0 0 14px rgba(255, 106, 0, 0.55)); transition: filter 0.3s, transform 0.3s; }
.logo-glow:hover { filter: drop-shadow(0 0 22px rgba(255, 184, 0, 0.8)); transform: rotate(-3deg) scale(1.05); }

.cart-badge { animation: pop 0.35s cubic-bezier(.2, 1.6, .4, 1); }

/* ---------- Páginas (SPA) ---------- */
.page { animation: pageIn 0.5s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- Hero ---------- */
.hero-bg {
  background-image:
    linear-gradient(180deg, rgba(8, 5, 4, 0.35) 0%, rgba(8, 5, 4, 0.55) 55%, var(--ink-950) 100%),
    radial-gradient(ellipse at 50% 40%, transparent 0%, rgba(8, 5, 4, 0.7) 75%),
    url("../assets/img/hero.jpg");
  background-size: cover;
  background-position: center 30%;
}

.hero-logo { animation: float 6s ease-in-out infinite; filter: drop-shadow(0 0 40px rgba(255, 106, 0, 0.45)); }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-14px) rotate(1deg); } }

/* Partículas de brasa subindo */
.embers { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.ember {
  position: absolute;
  bottom: -10px;
  width: var(--s, 4px);
  height: var(--s, 4px);
  background: var(--c, var(--royal-orange));
  box-shadow: 0 0 8px var(--c, var(--royal-orange)), 0 0 16px var(--c, var(--royal-orange));
  opacity: 0;
  animation: rise var(--d, 8s) linear var(--delay, 0s) infinite;
}
@keyframes rise {
  0% { opacity: 0; transform: translate(0, 0) rotate(0); }
  10% { opacity: 1; }
  80% { opacity: .8; }
  100% { opacity: 0; transform: translate(var(--x, 30px), -95vh) rotate(360deg); }
}

/* Caixa do IP */
.ip-box {
  background: linear-gradient(135deg, rgba(255, 184, 0, 0.1), rgba(227, 23, 10, 0.08));
  border: 1px solid rgba(255, 184, 0, 0.3);
  box-shadow: 0 0 40px -10px rgba(255, 106, 0, 0.5), inset 0 0 30px rgba(255, 106, 0, 0.06);
}
.copy-btn.copied { background: linear-gradient(135deg, #4ade80, #16a34a); color: #052e12; box-shadow: 0 10px 30px -10px rgba(34, 197, 94, 0.8); }

.status-dot { position: relative; }
.status-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  background: inherit;
  animation: ping 1.6s cubic-bezier(0, 0, .2, 1) infinite;
}
@keyframes ping { 75%, 100% { transform: scale(2.4); opacity: 0; } }

/* Linha conectando o passo a passo */
.step-line { background: linear-gradient(90deg, transparent, rgba(255, 184, 0, 0.45), transparent); }

/* ---------- Regras (accordion nativo <details>) ---------- */
.rule-cat { transition: border-color 0.3s, box-shadow 0.3s; }
.rule-cat[open] { border-color: rgba(255, 184, 0, 0.4); box-shadow: 0 0 40px -18px rgba(255, 106, 0, 0.7); }
.rule-cat summary { list-style: none; cursor: pointer; }
.rule-cat summary::-webkit-details-marker { display: none; }
.rule-cat .chev { transition: transform 0.35s cubic-bezier(.2, .8, .2, 1); }
.rule-cat[open] .chev { transform: rotate(180deg); }
.rule-cat[open] .rule-body { animation: pageIn 0.4s ease both; }

/* ---------- Loja ---------- */
.filter-btn { transition: all 0.25s; }
.filter-btn[aria-pressed="true"] {
  background: var(--fire-gradient);
  color: #1a0700;
  border-color: transparent;
  box-shadow: 0 8px 24px -8px rgba(255, 106, 0, 0.8);
}

.product-img { transition: transform 0.6s cubic-bezier(.2, .8, .2, 1); }
.neon-card:hover .product-img { transform: scale(1.08) rotate(-2deg); }

.badge-shine { position: relative; overflow: hidden; }
.badge-shine::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  transform: skewX(-20deg);
  animation: shine 3s ease-in-out infinite;
}
@keyframes shine { 0%, 60% { left: -100%; } 100% { left: 160%; } }

.add-btn.added { background: linear-gradient(135deg, #4ade80, #16a34a) !important; color: #052e12 !important; }

/* ---------- Investidores / pódio ---------- */
.podium-1 { --glow: rgba(255, 225, 26, 0.55); }
.podium-2 { --glow: rgba(203, 213, 225, 0.4); }
.podium-3 { --glow: rgba(234, 125, 60, 0.45); }
.podium-card { box-shadow: 0 0 60px -20px var(--glow); }
.podium-skin { filter: drop-shadow(0 12px 24px var(--glow)); transition: transform 0.4s; }
.podium-card:hover .podium-skin { transform: translateY(-8px) scale(1.04); }
.podium-crown { animation: float 3s ease-in-out infinite; filter: drop-shadow(0 0 12px rgba(255, 225, 26, 0.9)); }

.tier-table th, .tier-table td { white-space: nowrap; }
.tier-table tbody tr { transition: background 0.2s; }
.tier-table tbody tr:hover { background: rgba(255, 184, 0, 0.04); }

/* ---------- Dialogs (modais & gaveta) ---------- */
dialog { color: #f5e9dc; }
dialog::backdrop { background: rgba(5, 3, 2, 0.7); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }

dialog.modal[open] { animation: modalIn 0.35s cubic-bezier(.2, .9, .3, 1.2) both; }
dialog.modal[open]::backdrop { animation: fadeIn 0.3s ease both; }
@keyframes modalIn { from { opacity: 0; transform: translateY(20px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

dialog.drawer {
  margin: 0 0 0 auto;
  height: 100dvh;
  max-height: 100dvh;
  width: min(440px, 100vw);
  max-width: 100vw;
}
dialog.drawer[open] { animation: drawerIn 0.4s cubic-bezier(.2, .8, .2, 1) both; }
dialog.drawer[open]::backdrop { animation: fadeIn 0.3s ease both; }
@keyframes drawerIn { from { transform: translateX(100%); } to { transform: none; } }

/* Opções de pagamento */
.pay-option input:checked + .pay-card {
  border-color: var(--royal-gold);
  background: linear-gradient(135deg, rgba(255, 184, 0, 0.14), rgba(227, 23, 10, 0.08));
  box-shadow: 0 0 30px -10px rgba(255, 106, 0, 0.8);
}
.pay-option input:checked + .pay-card .pay-check { opacity: 1; transform: scale(1); }
.pay-option input:focus-visible + .pay-card { outline: 2px solid var(--royal-gold); outline-offset: 2px; }
.pay-check { opacity: 0; transform: scale(.5); transition: all .25s; }

.field {
  width: 100%;
  background: rgba(8, 5, 4, 0.65);
  border: 1px solid rgba(255, 184, 0, 0.15);
  border-radius: 0.75rem;
  padding: 0.75rem 0.9rem 0.75rem 2.6rem;
  color: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field.no-icon { padding-left: 0.9rem; }
.field::placeholder { color: #7b6656; }
.field:focus { outline: none; border-color: var(--royal-gold); box-shadow: 0 0 0 3px rgba(255, 184, 0, 0.15); }
.field:user-invalid { border-color: #ef4444; }

.auth-tab[aria-selected="true"] { color: #1a0700; }
.auth-tab-indicator { transition: transform 0.35s cubic-bezier(.2, .8, .2, 1); }

.spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(26, 7, 0, 0.3);
  border-top-color: #1a0700;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.success-ring { animation: pop 0.5s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes pop { 0% { transform: scale(0); } 100% { transform: scale(1); } }

/* ---------- Discord FAB ---------- */
.discord-fab {
  background: linear-gradient(135deg, #5865f2, #4752c4);
  box-shadow: 0 10px 30px -8px rgba(88, 101, 242, 0.8);
  animation: glowPulse 2.4s ease-in-out infinite;
  transition: transform 0.25s;
}
.discord-fab:hover { transform: scale(1.08) rotate(-6deg); }
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 10px 30px -8px rgba(88, 101, 242, 0.8), 0 0 0 0 rgba(34, 197, 94, 0.55); }
  50% { box-shadow: 0 10px 30px -8px rgba(88, 101, 242, 0.8), 0 0 0 14px rgba(34, 197, 94, 0); }
}

#discordPopover {
  position: fixed;
  inset: auto 1.25rem 6.5rem auto;
  margin: 0;
  width: min(340px, calc(100vw - 2.5rem));
  padding: 0;
  border: 0;
  background: transparent;
  color: #f5e9dc;
}
#discordPopover:popover-open { animation: modalIn 0.3s cubic-bezier(.2, .9, .3, 1.2) both; }

/* ---------- Toasts ---------- */
.toast { animation: toastIn 0.4s cubic-bezier(.2, .9, .3, 1.2) both; }
.toast.out { animation: toastOut 0.3s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px); } }

/* Reveal ao rolar */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(.2, .8, .2, 1); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Acessibilidade: reduzir movimento ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .reveal { opacity: 1; transform: none; }
  .embers { display: none; }
}
