:root {
  color-scheme: dark;
  --bg: #07080d;
  --panel: rgba(16, 20, 32, 0.62);
  --panel-strong: rgba(23, 29, 46, 0.82);
  --line: rgba(255, 255, 255, 0.12);
  --text: #edf4ff;
  --muted: #9aa7ba;
  --cyan: #36e4ff;
  --violet: #a866ff;
  --green: #69ff9f;
  --pink: #ff5fa8;
  --gold: #ffd36a;
  --danger: #ff416d;
  font-family: Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  overflow-x: hidden;
  background:
    radial-gradient(circle at 15% 8%, rgba(61, 228, 255, 0.16), transparent 28rem),
    radial-gradient(circle at 82% 18%, rgba(168, 102, 255, 0.18), transparent 31rem),
    radial-gradient(circle at 35% 88%, rgba(105, 255, 159, 0.13), transparent 26rem),
    linear-gradient(135deg, #05060a 0%, #0a0d16 46%, #05070a 100%);
  color: var(--text);
}

a { color: inherit; }
button,
input {
  font: inherit;
}

button {
  color: inherit;
}

#particles,
.ambient,
.screen-fx {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

#particles {
  z-index: 0;
  opacity: 0.75;
}

.ambient {
  z-index: 0;
  filter: blur(44px);
  opacity: 0.72;
  mix-blend-mode: screen;
}

.ambient-one {
  background: radial-gradient(circle at 70% 40%, rgba(89, 255, 214, 0.16), transparent 25rem);
  animation: drift 13s ease-in-out infinite;
}

.ambient-two {
  background: radial-gradient(circle at 28% 62%, rgba(255, 95, 168, 0.16), transparent 25rem);
  animation: drift 18s ease-in-out infinite reverse;
}

.glass {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(24, 29, 47, 0.72), rgba(10, 13, 22, 0.48));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(20px);
}

.is-hidden {
  display: none !important;
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at center, rgba(168, 102, 255, 0.2), transparent 28rem),
    rgba(3, 4, 8, 0.86);
}

.gate.shake .gate-panel {
  animation: shake 420ms ease;
}

.gate-panel,
.auth-card {
  width: min(100%, 31rem);
  border-radius: 8px;
  padding: 32px;
}

.eyebrow {
  color: var(--green);
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
.brand strong {
  font-family: Inter, system-ui, sans-serif;
  letter-spacing: 0;
}

.gate h1,
.auth-card h1,
.page-heading h1 {
  margin: 8px 0 10px;
  font-size: clamp(2.4rem, 7vw, 4.8rem);
  line-height: 0.95;
  text-shadow: 0 0 34px rgba(54, 228, 255, 0.26);
}

.gate p,
.auth-card p {
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

input {
  width: 100%;
  min-height: 3.35rem;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  outline: 0;
  padding: 0 14px;
  background: rgba(4, 7, 13, 0.62);
  color: var(--text);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

select,
textarea {
  font: inherit;
}

select {
  width: 100%;
  min-height: 3rem;
  border: 1px solid rgba(67, 55, 36, 0.16);
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink, var(--text));
}

input:focus {
  border-color: rgba(54, 228, 255, 0.7);
  box-shadow: 0 0 0 4px rgba(54, 228, 255, 0.12);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.check-row input,
.toggle-row input {
  width: 18px;
  min-height: 18px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.34);
  color: var(--muted);
  font-weight: 800;
}

.primary-btn,
.roll-btn,
.primary-link,
.ghost-btn,
.effect-card button {
  min-height: 2.75rem;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 180ms ease, border-color 180ms ease, opacity 180ms ease;
}

.primary-btn,
.primary-link {
  display: inline-grid;
  place-items: center;
  padding: 0 18px;
  background: linear-gradient(135deg, var(--cyan), var(--violet) 52%, var(--green));
  color: #02040a;
  font-weight: 800;
  box-shadow: 0 0 34px rgba(54, 228, 255, 0.28);
}

.ghost-btn {
  display: inline-grid;
  place-items: center;
  padding: 0 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.primary-btn:hover,
.primary-link:hover,
.ghost-btn:hover,
.roll-btn:hover,
.effect-card button:hover {
  transform: translateY(-1px);
}

.form-error {
  min-height: 1.2rem;
  color: #ff7898;
}

.app {
  position: relative;
  z-index: 2;
  width: min(1360px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 48px;
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 4.8rem;
  border-radius: 8px;
  padding: 10px 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 13rem;
  text-decoration: none;
}

.brand-sigil {
  display: grid;
  width: 3rem;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 8px;
  background: radial-gradient(circle, var(--cyan), var(--violet));
  color: #05070a;
  font-family: Inter, system-ui, sans-serif;
  font-weight: 900;
  box-shadow: 0 0 28px rgba(54, 228, 255, 0.36);
}

.brand strong,
.brand em {
  display: block;
}

.brand strong {
  font-size: 1.05rem;
}

.brand em {
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
}

.nav {
  display: flex;
  gap: 6px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
}

.nav a {
  min-height: 2.45rem;
  padding: 10px 14px;
  border-radius: 7px;
  color: var(--muted);
  text-decoration: none;
  transition: background 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.nav a:hover,
.nav a.active {
  background: rgba(54, 228, 255, 0.12);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(54, 228, 255, 0.18);
}

.account-actions {
  display: flex;
  gap: 8px;
}

.user-only,
body.logged-in .guest-only {
  display: none;
}

body.logged-in .user-only {
  display: inline-grid;
}

#view {
  padding-top: 22px;
}

.app:has(.roll-layout) {
  padding-bottom: 16px;
}

#view:has(.roll-layout) {
  padding-top: 12px;
}

.announcement-banner {
  margin-top: 14px;
  border: 1px solid color-mix(in srgb, var(--gold), transparent 58%);
  border-radius: 8px;
  padding: 12px 16px;
  background:
    linear-gradient(135deg, rgba(255, 211, 106, 0.2), rgba(54, 228, 255, 0.08)),
    rgba(0, 0, 0, 0.18);
  color: var(--text);
  font-weight: 800;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.14);
}

.roll-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 23rem;
  gap: 18px;
  height: calc(100svh - 8.8rem);
  min-height: 34rem;
  max-height: 48rem;
}

.roll-stage {
  position: relative;
  display: grid;
  min-height: 0;
  height: 100%;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  padding: 24px 28px 7rem;
}

.roll-stage::before {
  position: absolute;
  inset: -20%;
  content: "";
  background:
    repeating-conic-gradient(from 0deg, rgba(54, 228, 255, 0.06) 0 7deg, transparent 7deg 16deg),
    radial-gradient(circle, rgba(168, 102, 255, 0.18), transparent 48%);
  animation: rotate 38s linear infinite;
}

.equipped-vignette {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 300ms ease;
}

.equipped-vignette.active {
  opacity: 0.7;
  background:
    radial-gradient(circle at 50% 46%, color-mix(in srgb, var(--fx-a), transparent 70%), transparent 21rem),
    linear-gradient(120deg, color-mix(in srgb, var(--fx-b), transparent 88%), transparent);
}

.ring {
  position: absolute;
  width: min(62vw, 36rem);
  aspect-ratio: 1;
  border: 1px solid rgba(54, 228, 255, 0.19);
  border-radius: 50%;
  box-shadow: 0 0 80px rgba(54, 228, 255, 0.08), inset 0 0 60px rgba(168, 102, 255, 0.1);
  animation: rotate 24s linear infinite;
}

.ring-b {
  width: min(46vw, 26rem);
  border-style: dashed;
  animation-duration: 15s;
  animation-direction: reverse;
}

.roll-core {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(100%, 30rem);
  min-height: clamp(14rem, 43svh, 20rem);
  place-items: center;
  align-content: center;
  gap: 10px;
  border: 1px solid color-mix(in srgb, var(--fx-a, var(--cyan)), transparent 62%);
  border-radius: 50%;
  padding: clamp(20px, 4svh, 38px);
  background:
    radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--fx-a, var(--cyan)), transparent 66%), transparent 44%),
    rgba(0, 0, 0, 0.24);
  text-align: center;
  box-shadow: 0 0 90px color-mix(in srgb, var(--fx-a, var(--cyan)), transparent 78%);
  transition: transform 240ms ease, filter 240ms ease, border-color 240ms ease;
}

.roll-core.slam {
  animation: slam 620ms cubic-bezier(.15, 1.4, .3, 1);
}

.result-rarity {
  color: var(--fx-a, var(--cyan));
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
}

.roll-core h1 {
  max-width: 100%;
  margin: 0;
  font-size: clamp(2rem, 5.4vw, 4.8rem);
  line-height: 0.9;
  overflow-wrap: anywhere;
  text-shadow: 0 0 34px color-mix(in srgb, var(--fx-a, var(--cyan)), transparent 54%);
}

.roll-core p {
  max-width: 28rem;
  margin: 0;
  color: var(--muted);
}

.roll-core > span,
.roll-core > h1,
.roll-core > p {
  position: relative;
  z-index: 1;
}

.rarity-common {
  filter: saturate(0.9);
}

.rarity-rare {
  animation: rarePulse 2s ease-in-out infinite;
}

.rarity-veryRare {
  animation: veryRarePulse 1.3s ease-in-out infinite;
}

.rarity-superRare {
  animation: superRarePulse 800ms ease-in-out infinite;
}

.rarity-ultraRare,
.rarity-celestial,
.rarity-impossible {
  animation: superRarePulse 680ms ease-in-out infinite;
}

.roll-actions {
  position: absolute;
  right: 50%;
  bottom: 42px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateX(50%);
}

.roll-btn {
  min-width: 15rem;
  min-height: 3.7rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background:
    linear-gradient(135deg, rgba(54, 228, 255, 0.96), rgba(168, 102, 255, 0.94), rgba(105, 255, 159, 0.92));
  color: #03050b;
  font-family: Inter, system-ui, sans-serif;
  font-size: 1.15rem;
  font-weight: 900;
  box-shadow: 0 0 44px rgba(54, 228, 255, 0.35);
}

.auto-roll-btn {
  min-height: 3.7rem;
  border: 1px solid color-mix(in srgb, var(--fx-a, var(--accent, #916b3d)), transparent 56%);
  border-radius: 8px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.52);
  color: var(--ink, var(--text));
  cursor: pointer;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(31, 36, 48, 0.12);
}

.roll-btn:hover,
.auto-roll-btn:hover {
  transform: translateY(-1px) scale(1.02);
}

.auto-roll-btn.active {
  background: #1f2430;
  color: #fff8e8;
  box-shadow: 0 0 28px rgba(255, 211, 106, 0.32);
}

.roll-btn:disabled {
  cursor: wait;
  opacity: 0.72;
}

.roll-status {
  position: absolute;
  bottom: 16px;
  z-index: 2;
  color: var(--muted);
  text-align: center;
}

.side-stack {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 14px;
  min-height: 0;
  overflow: hidden;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  border-radius: 8px;
  padding: 12px;
}

.stat-strip article,
.metric {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.stat-strip span,
.metric span {
  color: var(--muted);
  font-size: 0.78rem;
}

.stat-strip strong,
.metric strong {
  overflow-wrap: anywhere;
  font-family: Inter, system-ui, sans-serif;
}

.feed-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  border-radius: 8px;
  padding: 16px;
}

.potion-panel {
  display: grid;
  gap: 8px;
  border-radius: 8px;
  padding: 14px;
}

.potion-panel.collapsed {
  gap: 0;
  padding-block: 10px;
}

.potion-panel.collapsed .section-title {
  margin-bottom: 0;
}

.potion-panel.collapsed > strong,
.potion-panel.collapsed > p,
.potion-panel.collapsed .potion-controls {
  display: none;
}

.potion-panel strong {
  font-size: 1.05rem;
}

.potion-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.potion-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.potion-btn {
  display: grid;
  gap: 3px;
  min-height: 3.2rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.potion-btn.heavenly {
  border-color: color-mix(in srgb, var(--gold), transparent 34%);
  background: linear-gradient(135deg, rgba(255, 211, 106, 0.22), rgba(255, 95, 168, 0.12));
}

.potion-btn span {
  font-weight: 900;
}

.potion-btn em {
  color: var(--muted);
  font-size: 0.74rem;
  font-style: normal;
}

.potion-btn:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-family: Inter, system-ui, sans-serif;
}

.section-title i {
  width: 0.62rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 18px var(--green);
  animation: rarePulse 1.4s ease-in-out infinite;
}

.panel-toggle {
  min-height: 1.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.42);
  color: inherit;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 900;
}

.feed-list {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.feed-item {
  position: relative;
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 3.2rem;
  overflow: hidden;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  animation: feedIn 420ms ease both;
}

.feed-item > * {
  position: relative;
  z-index: 1;
}

.feed-item i {
  width: 9px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 16px currentColor;
}

.feed-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.feed-item time,
.empty {
  color: var(--muted);
}

.rarity-common { color: #aeb8c9; }
.rarity-rare { color: var(--cyan); }
.rarity-veryRare { color: var(--violet); }
.rarity-superRare { color: var(--gold); }
.rarity-ultraRare { color: #ff5fa8; }
.rarity-celestial { color: #36e4ff; }
.rarity-impossible { color: #ffffff; }

.auth-page {
  display: grid;
  min-height: calc(100vh - 8rem);
  place-items: center;
}

.auth-swap a {
  color: var(--cyan);
  font-weight: 800;
}

.page-stack,
.profile-layout {
  display: grid;
  gap: 18px;
}

.page-heading {
  padding: 18px 2px 0;
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 14px;
}

.effect-card {
  position: relative;
  display: grid;
  gap: 10px;
  min-height: 20rem;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--fx-a), transparent 70%);
  border-radius: 8px;
  padding: 14px;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--fx-a), transparent 90%), rgba(14, 17, 28, 0.72)),
    rgba(0, 0, 0, 0.24);
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.24);
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.effect-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 28px 70px color-mix(in srgb, var(--fx-a), transparent 88%);
}

.effect-card.locked {
  opacity: 0.48;
  filter: grayscale(0.7);
}

.effect-card::before,
.effect-card::after,
.profile-hero::after,
.public-profile::before,
.public-profile::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
}

.effect-card > * {
  position: relative;
  z-index: 1;
}

.effect-card.rarity-superRare::before,
.roll-core.rarity-superRare::after,
.feed-item.rarity-superRare::after {
  background:
    radial-gradient(circle at 14% 20%, var(--fx-a, currentColor) 0 2px, transparent 3px),
    radial-gradient(circle at 82% 28%, var(--fx-b, currentColor) 0 2px, transparent 3px),
    radial-gradient(circle at 62% 82%, var(--fx-a, currentColor) 0 2px, transparent 3px);
  opacity: 0.55;
  animation: rareStarFloat 2.4s ease-in-out infinite;
}

.effect-card.rarity-superRare::after,
.roll-core.rarity-superRare::before {
  border: 1px solid color-mix(in srgb, var(--fx-a, currentColor), transparent 42%);
  border-radius: inherit;
  transform: scale(0.84);
  animation: rareOrbitLine 2.7s linear infinite;
}

.effect-card.rarity-ultraRare::before,
.roll-core.rarity-ultraRare::before,
.profile-hero.rarity-ultraRare::after,
.public-profile.rarity-ultraRare::before {
  background:
    repeating-linear-gradient(120deg, transparent 0 14px, color-mix(in srgb, var(--fx-a), transparent 42%) 14px 16px, transparent 16px 34px),
    radial-gradient(circle at 20% 22%, color-mix(in srgb, var(--fx-b), transparent 28%) 0 4px, transparent 5px),
    radial-gradient(circle at 82% 70%, color-mix(in srgb, var(--fx-a), transparent 22%) 0 5px, transparent 6px);
  opacity: 0.72;
  animation: ultraLines 1.6s linear infinite;
}

.effect-card.rarity-ultraRare::after,
.roll-core.rarity-ultraRare::after,
.public-profile.rarity-ultraRare::after {
  border: 2px dashed color-mix(in srgb, var(--fx-b), transparent 35%);
  border-radius: inherit;
  transform: scale(0.72);
  animation: rareOrbitLine 1.7s linear infinite reverse;
}

.effect-card.rarity-celestial::before,
.roll-core.rarity-celestial::before,
.profile-hero.rarity-celestial::after,
.public-profile.rarity-celestial::before {
  background:
    radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--fx-a), transparent 64%), transparent 20%),
    conic-gradient(from 0deg, transparent, color-mix(in srgb, var(--fx-a), transparent 35%), transparent 16%, color-mix(in srgb, var(--fx-b), transparent 48%), transparent 36%),
    radial-gradient(circle at 12% 28%, #fff 0 2px, transparent 3px),
    radial-gradient(circle at 88% 22%, #fff 0 2px, transparent 3px),
    radial-gradient(circle at 76% 82%, #fff 0 3px, transparent 4px);
  opacity: 0.78;
  animation: celestialSpin 2.1s linear infinite;
}

.effect-card.rarity-celestial::after,
.roll-core.rarity-celestial::after,
.public-profile.rarity-celestial::after {
  background: radial-gradient(circle at 50% 50%, transparent 0 26%, color-mix(in srgb, var(--fx-b), transparent 30%) 27% 29%, transparent 31%);
  animation: celestialPulse 1.2s ease-in-out infinite;
}

.effect-card.rarity-impossible::before,
.roll-core.rarity-impossible::before,
.profile-hero.rarity-impossible::after,
.public-profile.rarity-impossible::before {
  background:
    conic-gradient(from 0deg, color-mix(in srgb, var(--fx-a), transparent 18%), transparent 7%, color-mix(in srgb, var(--fx-b), transparent 24%), transparent 16%, color-mix(in srgb, #fff, transparent 28%), transparent 27%),
    repeating-radial-gradient(circle at 50% 50%, transparent 0 18px, color-mix(in srgb, var(--fx-a), transparent 58%) 19px 21px);
  opacity: 0.92;
  animation: impossibleWarp 1.25s linear infinite;
}

.effect-card.rarity-impossible::after,
.roll-core.rarity-impossible::after,
.public-profile.rarity-impossible::after {
  background:
    radial-gradient(circle at 18% 16%, #fff 0 3px, transparent 4px),
    radial-gradient(circle at 32% 84%, var(--fx-a) 0 4px, transparent 5px),
    radial-gradient(circle at 78% 28%, var(--fx-b) 0 4px, transparent 5px),
    linear-gradient(90deg, transparent 0 46%, rgba(255,255,255,.7) 48% 50%, transparent 53%),
    linear-gradient(0deg, transparent 0 46%, rgba(255,255,255,.5) 48% 50%, transparent 53%);
  mix-blend-mode: screen;
  animation: impossibleBurst 900ms steps(4) infinite;
}

.effect-preview {
  position: relative;
  overflow: hidden;
  min-height: 7rem;
  border-radius: 8px;
  background:
    radial-gradient(circle at center, var(--fx-a), transparent 34%),
    radial-gradient(circle at 25% 70%, var(--fx-b), transparent 30%),
    rgba(255, 255, 255, 0.04);
  animation: previewPulse 2.6s ease-in-out infinite;
}

.effect-preview::before,
.effect-preview::after,
.roll-core::before,
.roll-core::after,
.equipped-vignette::before,
.equipped-vignette::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
}

.type-name { clip-path: polygon(8% 20%, 92% 10%, 82% 82%, 13% 92%); }
.type-screen { filter: contrast(1.5) saturate(1.5); }
.type-ui { border-radius: 8px; }
.type-background { background-size: 40px 40px; }
.type-particles { mask-image: radial-gradient(circle, black 20%, transparent 70%); }

.visual-rain::before {
  background: repeating-linear-gradient(105deg, transparent 0 13px, color-mix(in srgb, var(--fx-a), transparent 45%) 14px 16px, transparent 17px 26px);
  animation: rainFall 620ms linear infinite;
}

.visual-pixel::before {
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--fx-a), transparent 36%) 10px, transparent 10px),
    linear-gradient(color-mix(in srgb, var(--fx-b), transparent 42%) 10px, transparent 10px);
  background-size: 20px 20px;
  image-rendering: pixelated;
  mix-blend-mode: multiply;
  animation: pixelJump 1.1s steps(4) infinite;
}

.visual-scanline::before,
.visual-crt::before {
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.18) 0 1px, transparent 1px 5px);
  animation: scanSweep 1.8s linear infinite;
}

.visual-crt::after {
  background: radial-gradient(circle at 50% 50%, transparent 48%, rgba(0, 0, 0, 0.18));
  mix-blend-mode: multiply;
}

.visual-storm::before {
  background:
    conic-gradient(from 90deg at 50% 50%, transparent, color-mix(in srgb, var(--fx-a), transparent 45%), transparent 28%),
    linear-gradient(135deg, transparent 47%, color-mix(in srgb, var(--fx-b), transparent 25%) 48% 51%, transparent 52%);
  animation: stormSnap 760ms steps(2) infinite;
}

.visual-mosaic::before,
.visual-dither::before {
  background:
    linear-gradient(45deg, color-mix(in srgb, var(--fx-a), transparent 55%) 25%, transparent 25% 75%, color-mix(in srgb, var(--fx-b), transparent 58%) 75%),
    linear-gradient(45deg, color-mix(in srgb, var(--fx-b), transparent 60%) 25%, transparent 25% 75%, color-mix(in srgb, var(--fx-a), transparent 62%) 75%);
  background-position: 0 0, 12px 12px;
  background-size: 24px 24px;
  animation: mosaicSlide 1.4s steps(6) infinite;
}

.visual-glyphs::before {
  background:
    repeating-linear-gradient(90deg, transparent 0 18px, color-mix(in srgb, var(--fx-a), transparent 55%) 18px 20px, transparent 20px 38px),
    repeating-linear-gradient(0deg, transparent 0 28px, color-mix(in srgb, var(--fx-b), transparent 65%) 28px 30px, transparent 30px 54px);
  animation: glyphDrift 2.4s linear infinite;
}

.visual-datastream::before {
  background: repeating-linear-gradient(180deg, color-mix(in srgb, var(--fx-a), transparent 55%) 0 8px, transparent 8px 20px);
  mask-image: repeating-linear-gradient(90deg, black 0 8px, transparent 8px 20px);
  animation: dataFall 820ms linear infinite;
}

.visual-liquid::before {
  background:
    radial-gradient(circle at 20% 30%, color-mix(in srgb, var(--fx-a), transparent 35%), transparent 24%),
    radial-gradient(circle at 78% 64%, color-mix(in srgb, var(--fx-b), transparent 38%), transparent 26%);
  filter: blur(7px);
  animation: liquidFlow 2.6s ease-in-out infinite;
}

.visual-spark::before,
.visual-orbit::before,
.visual-starburst::before {
  border: 1px dashed color-mix(in srgb, var(--fx-a), transparent 35%);
  border-radius: inherit;
  animation: rotate 2.8s linear infinite;
}

.visual-orbit::after,
.visual-starburst::after {
  inset: 18%;
  border-radius: inherit;
  background: conic-gradient(from 0deg, transparent, color-mix(in srgb, var(--fx-b), transparent 30%), transparent 18%);
  animation: rotate 1.5s linear infinite reverse;
}

.visual-fog::before,
.visual-lens::before {
  background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--fx-a), transparent 55%), transparent 48%);
  filter: blur(12px);
  animation: fogRoll 3.4s ease-in-out infinite;
}

.visual-lens::after {
  border: 1px solid color-mix(in srgb, var(--fx-b), transparent 40%);
  border-radius: inherit;
  transform: scale(0.82);
  animation: lensWarp 1.8s ease-in-out infinite;
}

.effect-card span {
  color: var(--fx-a);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.effect-card h2 {
  margin: 0;
  font-size: 1.2rem;
}

.effect-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

.chance-pill {
  justify-self: start;
  border: 1px solid color-mix(in srgb, var(--fx-a), transparent 62%);
  border-radius: 999px;
  padding: 5px 9px;
  background: color-mix(in srgb, var(--fx-a), transparent 88%);
  color: var(--ink, var(--text));
  font-size: 0.78rem;
}

.effect-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
}

.effect-card em {
  color: var(--muted);
  font-style: normal;
}

.effect-card button {
  min-height: 2.35rem;
  padding: 0 14px;
  background: color-mix(in srgb, var(--fx-a), #05070a 30%);
  color: #05070a;
  font-weight: 900;
}

.effect-card button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.profile-hero {
  position: relative;
  min-height: 28rem;
  overflow: hidden;
  border-radius: 8px;
  padding: 34px;
  animation: profileOpenFlash 520ms ease both;
}

.profile-hero.profile-border {
  border-color: color-mix(in srgb, var(--fx-a), transparent 36%);
  box-shadow:
    0 18px 48px rgba(87, 65, 38, 0.12),
    0 0 0 2px color-mix(in srgb, var(--fx-a), transparent 70%),
    0 0 44px color-mix(in srgb, var(--fx-b), transparent 72%);
}

.profile-hero.profile-border::before {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  content: "";
}

.profile-aura {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(circle at 50% 48%, color-mix(in srgb, var(--fx-a, var(--cyan)), transparent 50%), transparent 24rem),
    conic-gradient(from 90deg, transparent, color-mix(in srgb, var(--fx-b, var(--violet)), transparent 70%), transparent);
  animation: rotate 20s linear infinite;
  opacity: 0.8;
}

.profile-hero > :not(.profile-aura) {
  position: relative;
  z-index: 1;
}

.profile-main,
.public-profile-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 18px;
}

.profile-avatar,
.avatar-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border: 2px solid color-mix(in srgb, var(--fx-a, var(--accent)), transparent 58%);
  background: #1f2430;
  color: #fff8e8;
  font-weight: 900;
  object-fit: cover;
}

.profile-avatar {
  width: clamp(5.5rem, 13vw, 8rem);
  aspect-ratio: 1;
  border-radius: 8px;
  font-size: 1.8rem;
  box-shadow: 0 16px 34px rgba(31, 36, 48, 0.18);
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

img.profile-avatar,
img.avatar-mark {
  object-fit: cover;
}

.profile-hero h1 {
  max-width: 100%;
  margin: 0 0 10px;
  font-size: clamp(3.1rem, 10vw, 8.8rem);
  line-height: 0.88;
  overflow-wrap: anywhere;
  text-shadow: 0 0 40px rgba(54, 228, 255, 0.34);
}

.profile-hero p {
  max-width: 58rem;
  color: var(--muted);
  font-size: 1.1rem;
}

.name-name,
.name-aura,
.name-particles {
  background: linear-gradient(90deg, var(--cyan), var(--pink), var(--green));
  background-clip: text;
  color: transparent;
  animation: textShift 2.5s linear infinite;
}

.effect-name {
  position: relative;
  display: inline-block;
  background: linear-gradient(90deg, var(--fx-a), var(--fx-b), var(--fx-a));
  background-size: 220% 100%;
  background-clip: text;
  color: transparent;
  animation: nameRainbow 2.8s linear infinite;
}

.effect-name::after {
  position: absolute;
  inset: -0.18em -0.25em;
  z-index: -1;
  border-radius: 8px;
  background: radial-gradient(circle, color-mix(in srgb, var(--fx-a), transparent 74%), transparent 62%);
  pointer-events: none;
  content: "";
  animation: nameFlash 1.8s ease-in-out infinite;
}

.effect-name-spark::after,
.effect-name-starburst::after {
  background:
    radial-gradient(circle at 12% 25%, var(--fx-a) 0 2px, transparent 3px),
    radial-gradient(circle at 82% 18%, var(--fx-b) 0 2px, transparent 3px),
    radial-gradient(circle at 70% 82%, var(--fx-a) 0 3px, transparent 4px);
  animation: sparklePop 900ms steps(3) infinite;
}

.effect-name-pixel {
  text-shadow: 3px 0 0 color-mix(in srgb, var(--fx-b), transparent 28%);
  animation: pixelName 850ms steps(2) infinite;
}

.effect-name-crt {
  text-shadow: 2px 0 0 var(--fx-a), -2px 0 0 var(--fx-b);
  animation: crtName 1.1s steps(2) infinite;
}

.effect-name-storm {
  animation: nameRainbow 1.1s linear infinite, stormName 700ms steps(2) infinite;
}

.effect-name-starburst {
  filter: drop-shadow(0 0 12px var(--fx-a)) drop-shadow(0 0 26px var(--fx-b));
  animation: nameRainbow 1.3s linear infinite, nameFlash 650ms ease-in-out infinite;
}

.effect-name-datastream {
  text-shadow: 0 0 12px var(--fx-a), 0 0 26px var(--fx-b);
}

.dev-tag {
  display: inline-grid;
  place-items: center;
  min-height: 1.45rem;
  border: 1px solid rgba(54, 228, 255, 0.45);
  border-radius: 999px;
  padding: 0 9px;
  background: linear-gradient(135deg, rgba(54, 228, 255, 0.18), rgba(255, 211, 106, 0.16));
  color: #12313a;
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 900;
  vertical-align: middle;
}

.profile-picture-form {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.profile-picture-form input {
  position: absolute;
  width: 1px;
  min-height: 1px;
  opacity: 0;
  pointer-events: none;
}

.profile-picture-form small {
  color: var(--muted);
}

.profile-grid,
.leaderboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric,
.board {
  border-radius: 8px;
  padding: 18px;
}

.leaderboard-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.board h2 {
  margin: 0 0 14px;
}

.board-row {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) minmax(5rem, auto);
  gap: 10px;
  align-items: center;
  min-height: 3.2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.board-row b {
  display: grid;
  width: 1.75rem;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}

.board-row span,
.board-row em {
  min-width: 0;
  overflow-wrap: anywhere;
}

.board-row em {
  color: var(--muted);
  font-style: normal;
  text-align: right;
}

.screen-fx {
  z-index: 30;
  display: none;
  place-items: center;
  background:
    radial-gradient(circle at center, color-mix(in srgb, var(--fx-a), transparent 55%), transparent 32rem),
    rgba(0, 0, 0, 0.76);
}

.screen-fx.active {
  display: grid;
  animation: cutsceneIn 1.85s ease both;
}

.screen-fx.rarity-superRare,
.screen-fx.rarity-ultraRare,
.screen-fx.rarity-celestial,
.screen-fx.rarity-impossible {
  animation-name: ultraCutscene;
  animation-duration: 2.85s;
}

.cutscene-stage {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(92vw, 68rem);
  padding: 36px 20px;
  text-align: center;
}

.cutscene-stage::before,
.cutscene-stage::after {
  position: absolute;
  inset: -18vh -18vw;
  pointer-events: none;
  content: "";
}

.cutscene-stage::before {
  background:
    radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--fx-a), transparent 58%), transparent 19rem),
    conic-gradient(from 0deg, transparent, color-mix(in srgb, var(--fx-b), transparent 42%), transparent 22%, color-mix(in srgb, var(--fx-a), transparent 54%), transparent 45%);
  animation: rotate 2.2s linear infinite;
}

.cutscene-stage::after {
  background: radial-gradient(circle at 50% 50%, transparent 0 9rem, rgba(0, 0, 0, 0.45) 9.2rem, transparent 15rem);
  animation: revealBurst 1.85s ease both;
}

.cutscene-star {
  position: relative;
  z-index: 1;
  display: block;
  width: clamp(5rem, 16vw, 11rem);
  aspect-ratio: 1;
  background: linear-gradient(135deg, var(--fx-a), var(--fx-b));
  clip-path: polygon(50% 0, 62% 34%, 98% 35%, 69% 56%, 79% 91%, 50% 70%, 21% 91%, 31% 56%, 2% 35%, 38% 34%);
  filter: drop-shadow(0 0 34px var(--fx-a)) drop-shadow(0 0 70px var(--fx-b));
  animation: starReveal 1.4s cubic-bezier(.2, 1.15, .22, 1) both;
}

.screen-fx span {
  position: relative;
  z-index: 1;
  color: var(--fx-a);
  font-family: Inter, system-ui, sans-serif;
  font-weight: 900;
  text-transform: uppercase;
}

.screen-fx strong {
  position: relative;
  z-index: 1;
  max-width: min(88vw, 60rem);
  font-family: Inter, system-ui, sans-serif;
  font-size: clamp(3rem, 10vw, 9rem);
  line-height: 0.85;
  overflow-wrap: anywhere;
  text-shadow: 0 0 60px var(--fx-a), 0 0 120px var(--fx-b);
}

.screen-fx.rarity-ultraRare .cutscene-stage::before {
  animation-duration: 1.35s;
  filter: saturate(1.8);
}

.screen-fx.rarity-celestial .cutscene-stage::before,
.screen-fx.rarity-impossible .cutscene-stage::before {
  background:
    radial-gradient(circle at 50% 50%, color-mix(in srgb, #fff, transparent 36%), transparent 9rem),
    conic-gradient(from 0deg, var(--fx-a), transparent 8%, var(--fx-b), transparent 18%, #fff, transparent 28%, var(--fx-a), transparent 42%);
  animation: celestialSpin 1.05s linear infinite;
}

.screen-fx.rarity-impossible .cutscene-star {
  filter: drop-shadow(0 0 38px #fff) drop-shadow(0 0 92px var(--fx-a)) drop-shadow(0 0 140px var(--fx-b));
  animation: impossibleStarReveal 1.35s cubic-bezier(.12, 1.4, .18, 1) both;
}

.screen-fx small {
  position: relative;
  z-index: 1;
  max-width: min(86vw, 42rem);
  color: rgba(255, 255, 255, 0.76);
  line-height: 1.45;
}

@media (max-width: 980px) {
  .topbar,
  .roll-layout,
  .leaderboard-grid,
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
    position: static;
  }

  .nav {
    overflow-x: auto;
  }

  .roll-layout {
    display: grid;
    height: auto;
    min-height: 0;
    max-height: none;
  }

  .roll-stage {
    height: calc(100svh - 8rem);
    min-height: 31rem;
    max-height: 39rem;
  }

  .side-stack,
  .leaderboard-grid,
  .profile-grid {
    display: grid;
  }
}

@media (max-width: 620px) {
  .app {
    width: min(100% - 20px, 1360px);
  }

  .account-actions,
  .stat-strip {
    grid-template-columns: 1fr;
    display: grid;
  }

  .nav a {
    white-space: nowrap;
  }

  .roll-stage {
    height: calc(100svh - 7.2rem);
    min-height: 29rem;
    max-height: 36rem;
    padding: 16px 14px 6.4rem;
  }

  .roll-core {
    width: min(100%, 25rem);
    min-height: clamp(13rem, 39svh, 17rem);
    padding: 18px;
  }

  .roll-core h1 {
    font-size: clamp(1.8rem, 11vw, 3.4rem);
  }

  .roll-actions {
    bottom: 38px;
    width: calc(100% - 48px);
    justify-content: center;
  }

  .roll-btn,
  .auto-roll-btn {
    min-width: 0;
    min-height: 3.35rem;
  }

  .roll-btn {
    flex: 1 1 auto;
  }

  .auto-roll-btn {
    flex: 0 0 auto;
  }

  .roll-status {
    bottom: 12px;
    width: calc(100% - 28px);
    font-size: 0.86rem;
  }

  .potion-controls {
    grid-template-columns: 1fr;
  }
}

@keyframes drift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(4vw, -3vh, 0) scale(1.08); }
}

@keyframes rotate {
  to { transform: rotate(360deg); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  50% { transform: translateX(8px); }
  75% { transform: translateX(-4px); }
}

@keyframes rarePulse {
  0%, 100% { filter: drop-shadow(0 0 10px currentColor); }
  50% { filter: drop-shadow(0 0 22px currentColor); }
}

@keyframes veryRarePulse {
  0%, 100% { transform: scale(1); filter: saturate(1.1) drop-shadow(0 0 18px currentColor); }
  50% { transform: scale(1.025); filter: saturate(1.7) drop-shadow(0 0 40px currentColor); }
}

@keyframes superRarePulse {
  0%, 100% { transform: scale(1) rotate(0deg); filter: hue-rotate(0deg) drop-shadow(0 0 28px currentColor); }
  50% { transform: scale(1.045) rotate(-0.7deg); filter: hue-rotate(45deg) drop-shadow(0 0 68px currentColor); }
}

@keyframes slam {
  0% { transform: scale(0.92); }
  62% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes previewPulse {
  0%, 100% { transform: scale(1); filter: saturate(1); }
  50% { transform: scale(1.03); filter: saturate(1.7); }
}

@keyframes feedIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes textShift {
  to { filter: hue-rotate(360deg); }
}

@keyframes nameRainbow {
  to { background-position: 220% 0; }
}

@keyframes nameFlash {
  0%, 100% { opacity: .28; transform: scale(.98); }
  50% { opacity: .86; transform: scale(1.03); }
}

@keyframes sparklePop {
  0%, 100% { opacity: .25; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-4px); }
}

@keyframes pixelName {
  0%, 100% { transform: translateX(0); filter: contrast(1); }
  50% { transform: translateX(2px); filter: contrast(1.8); }
}

@keyframes crtName {
  0%, 100% { filter: saturate(1); }
  50% { filter: saturate(1.8) contrast(1.25); }
}

@keyframes stormName {
  0%, 100% { transform: skewX(0deg); }
  50% { transform: skewX(-3deg); }
}

@keyframes cutsceneIn {
  0% { opacity: 0; transform: scale(1.16); filter: blur(12px); }
  22% { opacity: 1; transform: scale(1); filter: blur(0); }
  70% { opacity: 1; transform: scale(1.03); }
  100% { opacity: 0; transform: scale(0.96); }
}

@keyframes ultraCutscene {
  0% { opacity: 0; transform: scale(1.22) rotate(.8deg); filter: blur(14px) saturate(1); }
  16% { opacity: 1; transform: scale(1); filter: blur(0) saturate(1.6); }
  34% { transform: scale(1.04) rotate(-.4deg); }
  58% { transform: scale(1.01) rotate(.4deg); filter: hue-rotate(26deg) saturate(2); }
  82% { opacity: 1; transform: scale(1.08); }
  100% { opacity: 0; transform: scale(.86); filter: blur(8px) saturate(2.4); }
}

@keyframes starReveal {
  0% { transform: scale(.25) rotate(-220deg); opacity: 0; }
  54% { transform: scale(1.2) rotate(18deg); opacity: 1; }
  78% { transform: scale(.92) rotate(44deg); }
  100% { transform: scale(1) rotate(72deg); }
}

@keyframes revealBurst {
  0%, 42% { opacity: 0; transform: scale(.5); }
  56% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.85); }
}

@keyframes rareStarFloat {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); opacity: .42; }
  50% { transform: translate3d(10px, -12px, 0) scale(1.08); opacity: .85; }
}

@keyframes rareOrbitLine {
  to { transform: scale(.84) rotate(360deg); }
}

@keyframes ultraLines {
  to { transform: translate3d(-34px, 28px, 0); }
}

@keyframes celestialSpin {
  to { transform: rotate(360deg) scale(1.04); }
}

@keyframes celestialPulse {
  0%, 100% { opacity: .32; transform: scale(.72); filter: blur(0); }
  50% { opacity: .95; transform: scale(1.2); filter: blur(2px); }
}

@keyframes impossibleWarp {
  0% { transform: rotate(0deg) scale(1); filter: hue-rotate(0deg) contrast(1.15); }
  50% { transform: rotate(180deg) scale(1.08); filter: hue-rotate(90deg) contrast(1.65); }
  100% { transform: rotate(360deg) scale(1); filter: hue-rotate(180deg) contrast(1.15); }
}

@keyframes impossibleBurst {
  0%, 100% { opacity: .35; transform: translate3d(0, 0, 0) scale(1); }
  33% { opacity: 1; transform: translate3d(8px, -6px, 0) scale(1.06); }
  66% { opacity: .72; transform: translate3d(-7px, 8px, 0) scale(.98); }
}

@keyframes impossibleStarReveal {
  0% { transform: translateY(34vh) scale(.12) rotate(-360deg); opacity: 0; }
  38% { transform: translateY(-8vh) scale(1.5) rotate(30deg); opacity: 1; }
  62% { transform: translateY(0) scale(.82) rotate(120deg); }
  100% { transform: translateY(0) scale(1.12) rotate(220deg); }
}

@keyframes profileOpenFlash {
  0% { opacity: 0; transform: scale(.96); filter: brightness(2.4) blur(8px); }
  42% { opacity: 1; transform: scale(1.015); filter: brightness(1.55) blur(0); }
  100% { opacity: 1; transform: scale(1); filter: brightness(1); }
}

@keyframes profileModalOpen {
  0% { opacity: 0; transform: translateY(22px) scale(.94); filter: blur(8px); }
  56% { opacity: 1; transform: translateY(-3px) scale(1.01); filter: blur(0); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes rainFall {
  to { transform: translate3d(-22px, 34px, 0); }
}

@keyframes pixelJump {
  0%, 100% { transform: translate3d(0, 0, 0); filter: contrast(1.1); }
  35% { transform: translate3d(8px, -4px, 0); filter: contrast(1.8); }
  70% { transform: translate3d(-6px, 5px, 0); filter: contrast(1.4); }
}

@keyframes scanSweep {
  to { transform: translateY(18px); }
}

@keyframes stormSnap {
  0%, 100% { opacity: .25; transform: scale(1); }
  50% { opacity: .95; transform: scale(1.08) skewX(-6deg); }
}

@keyframes mosaicSlide {
  to { background-position: 24px 24px, 36px 36px; }
}

@keyframes glyphDrift {
  to { transform: translate3d(-38px, 54px, 0); }
}

@keyframes dataFall {
  to { transform: translateY(28px); }
}

@keyframes liquidFlow {
  0%, 100% { transform: translate3d(-4%, -2%, 0) scale(1.04); }
  50% { transform: translate3d(5%, 3%, 0) scale(1.18); }
}

@keyframes fogRoll {
  0%, 100% { opacity: .42; transform: translateX(-4%) scale(1.04); }
  50% { opacity: .8; transform: translateX(5%) scale(1.16); }
}

@keyframes lensWarp {
  0%, 100% { transform: scale(.82); filter: blur(0); }
  50% { transform: scale(1.02); filter: blur(2px); }
}

/* SaaS polish pass */
:root {
  --bg: #f4efe4;
  --paper: #fffaf0;
  --paper-2: #f8f0df;
  --ink: #1f2430;
  --muted: #747061;
  --line: rgba(54, 45, 31, 0.13);
  --accent: #916b3d;
  --accent-2: #3d5f50;
  --accent-3: #9f6a55;
  --text: #1f2430;
  --gold: #c08a32;
  color-scheme: light;
}

body {
  background:
    radial-gradient(circle at 18% 8%, rgba(255, 250, 240, 0.95), transparent 26rem),
    radial-gradient(circle at 88% 16%, rgba(202, 181, 142, 0.24), transparent 28rem),
    linear-gradient(180deg, #f6f0e5 0%, #efe5d5 100%);
  color: var(--ink);
}

#particles {
  opacity: 0.18;
  mix-blend-mode: multiply;
}

.ambient {
  display: none;
}

.glass {
  border: 1px solid rgba(52, 43, 29, 0.12);
  background: rgba(255, 250, 240, 0.78);
  box-shadow: 0 18px 48px rgba(87, 65, 38, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(18px);
}

h1,
h2,
.brand strong,
.section-title,
.result-rarity,
.roll-btn,
.eyebrow {
  font-family: "Playfair Display", Georgia, serif;
}

.eyebrow {
  color: var(--accent-2);
  font-size: 0.82rem;
  text-transform: none;
}

.gate {
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 250, 240, 0.72), transparent 24rem),
    rgba(244, 239, 228, 0.96);
}

.gate h1,
.auth-card h1,
.page-heading h1,
.screen-fx strong {
  text-shadow: 0 14px 32px rgba(115, 82, 38, 0.14);
}

input {
  border-color: rgba(67, 55, 36, 0.16);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

input:focus {
  border-color: rgba(145, 107, 61, 0.55);
  box-shadow: 0 0 0 4px rgba(145, 107, 61, 0.12);
}

.primary-btn,
.primary-link,
.roll-btn,
.effect-card button,
.shop-card button,
.admin-controls button {
  background: #1f2430;
  color: #fff8e8;
  box-shadow: 0 12px 26px rgba(31, 36, 48, 0.18);
}

.ghost-btn,
.admin-link {
  border: 1px solid rgba(54, 45, 31, 0.13);
  background: rgba(255, 255, 255, 0.42);
  color: var(--ink);
}

.admin-link {
  min-height: 2.45rem;
  border-radius: 8px;
  padding: 0 12px;
  cursor: pointer;
}

.topbar {
  top: 10px;
  border-radius: 8px;
}

.brand-sigil,
.buck-logo {
  position: relative;
  background:
    linear-gradient(145deg, #f7df98, #b8832f 48%, #6d4921);
  color: #fff7df;
  box-shadow: 0 12px 24px rgba(143, 99, 42, 0.22);
}

.brand-sigil::after,
.buck-logo::after {
  position: absolute;
  inset: 5px 8px auto;
  height: 30%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
  content: "";
}

.nav {
  border-color: rgba(54, 45, 31, 0.09);
  background: rgba(255, 255, 255, 0.34);
}

.nav a {
  color: #6f6a5d;
}

.nav a:hover,
.nav a.active {
  background: #fff8e8;
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(87, 65, 38, 0.08);
}

.roll-layout {
  grid-template-columns: minmax(0, 1fr) 25rem;
}

.roll-stage {
  background:
    linear-gradient(180deg, rgba(255, 250, 240, 0.88), rgba(248, 239, 222, 0.78)),
    radial-gradient(circle at 50% 42%, rgba(192, 138, 50, 0.12), transparent 24rem);
}

.roll-stage::before {
  inset: 0;
  background:
    linear-gradient(rgba(31, 36, 48, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 36, 48, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  animation: none;
}

.ring {
  border-color: rgba(145, 107, 61, 0.18);
  box-shadow: inset 0 0 0 12px rgba(255, 255, 255, 0.18), 0 22px 52px rgba(87, 65, 38, 0.08);
}

.roll-core {
  border-radius: 8px;
  border-color: color-mix(in srgb, var(--fx-a, var(--accent)), transparent 54%);
  background:
    linear-gradient(180deg, rgba(255, 252, 244, 0.88), rgba(244, 234, 214, 0.78)),
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--fx-a, var(--accent)), transparent 82%), transparent 17rem);
  box-shadow: 0 24px 54px rgba(87, 65, 38, 0.14);
}

.roll-core h1 {
  font-size: clamp(2.1rem, 5vw, 4.7rem);
  text-shadow: 0 10px 24px rgba(87, 65, 38, 0.12);
}

.result-rarity {
  color: var(--accent-2);
  font-weight: 700;
}

.roll-btn {
  font-size: 1.35rem;
}

.roll-btn:hover {
  box-shadow: 0 16px 34px rgba(31, 36, 48, 0.22);
}

.stat-strip {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.event-card {
  border-radius: 8px;
  padding: 16px;
}

.event-card strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 1.25rem;
}

.event-card p {
  margin: 0;
  color: var(--muted);
}

.section-title i {
  background: var(--gold);
  box-shadow: 0 0 18px rgba(192, 138, 50, 0.36);
}

.feed-item {
  border-bottom-color: rgba(54, 45, 31, 0.09);
}

.rarity-common { color: #756f60; }
.rarity-rare { color: #3d5f50; }
.rarity-veryRare { color: #8a5b3f; }
.rarity-superRare { color: #b37b22; }
.rarity-ultraRare { color: #a83363; }
.rarity-celestial { color: #1c7180; }
.rarity-impossible { color: #1f2430; }

.inventory-grid,
.shop-grid,
.users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 14px;
}

.effect-card,
.shop-card,
.user-card {
  border-color: rgba(54, 45, 31, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 250, 240, 0.9), rgba(246, 236, 218, 0.82));
  color: var(--ink);
  box-shadow: 0 14px 36px rgba(87, 65, 38, 0.1);
}

.effect-preview {
  background:
    radial-gradient(circle at 32% 32%, color-mix(in srgb, var(--fx-a), white 35%), transparent 34%),
    linear-gradient(135deg, color-mix(in srgb, var(--fx-b), white 65%), #fff8e8);
  animation-duration: 4s;
}

.effect-card span,
.shop-card span {
  color: var(--accent-2);
}

.effect-card button,
.shop-card button {
  color: #fff8e8;
}

.effect-card.locked {
  opacity: 0.55;
}

.split-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.buck-balance {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 3.4rem;
  border: 1px solid rgba(54, 45, 31, 0.12);
  border-radius: 8px;
  padding: 8px 14px;
  background: rgba(255, 250, 240, 0.72);
}

.buck-logo {
  display: grid;
  width: 2.6rem;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  font-weight: 900;
  font-size: 0.8rem;
}

.buck-logo.large {
  width: 4.2rem;
  margin-bottom: 18px;
  font-size: 1rem;
}

.shop-card,
.user-card {
  display: grid;
  gap: 10px;
  border-radius: 8px;
  padding: 18px;
}

.shop-card h2,
.user-card h2 {
  margin: 0;
}

.shop-card p,
.user-card p {
  margin: 0;
  color: var(--muted);
}

.shop-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
}

.shop-card.owned {
  outline: 2px solid rgba(61, 95, 80, 0.22);
}

.shop-card button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.profile-hero {
  background:
    linear-gradient(180deg, rgba(255, 250, 240, 0.88), rgba(244, 234, 214, 0.75));
}

.profile-aura {
  background:
    radial-gradient(circle at 50% 48%, color-mix(in srgb, var(--fx-a, var(--accent)), transparent 62%), transparent 23rem),
    linear-gradient(110deg, transparent, rgba(255, 255, 255, 0.36), transparent);
}

.profile-hero h1 {
  font-size: clamp(3rem, 8vw, 7.8rem);
  text-shadow: 0 20px 38px rgba(87, 65, 38, 0.16);
}

.profile-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.name-name,
.name-aura,
.name-particles {
  background: linear-gradient(90deg, #1f2430, #916b3d, #3d5f50);
  background-clip: text;
}

.user-card {
  grid-template-columns: auto 1fr;
  align-items: start;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 180ms ease;
}

.user-card:hover,
.user-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 18px 44px rgba(87, 65, 38, 0.16);
  outline: 0;
}

.avatar-mark {
  width: 3rem;
  aspect-ratio: 1;
  border-radius: 8px;
}

.user-card dl {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 8px 0 0;
}

.user-card dt {
  color: var(--muted);
  font-size: 0.75rem;
}

.user-card dd {
  margin: 0;
  font-weight: 800;
}

.board-row {
  border-bottom-color: rgba(54, 45, 31, 0.09);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(31, 36, 48, 0.32);
}

.modal-card {
  position: relative;
  width: min(100%, 34rem);
  max-height: calc(100svh - 40px);
  overflow: auto;
  border-radius: 8px;
  padding: 28px;
}

.modal-card h1 {
  margin: 8px 0 10px;
}

.close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  min-height: 2.2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.48);
  cursor: pointer;
}

.admin-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.admin-controls button {
  min-height: 3.4rem;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.admin-user-tools {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.admin-user-tools h2 {
  margin: 0;
  font-size: 1.35rem;
}

.admin-user-tools label,
.admin-user-tools form {
  display: grid;
  gap: 8px;
}

.admin-user-tools label span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.admin-user-actions,
.admin-user-tools form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.admin-user-tools form label {
  min-width: 0;
}

.admin-user-tools small {
  color: var(--muted);
}

.announcement-form {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  margin-top: 8px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.announcement-form label,
.announcement-form label span {
  display: grid;
  gap: 8px;
}

.announcement-form textarea {
  width: 100%;
  min-height: 6rem;
  resize: vertical;
  border: 1px solid rgba(67, 55, 36, 0.16);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font: inherit;
}

.announcement-form div {
  display: flex;
  gap: 10px;
}

.announcement-form small {
  color: var(--muted);
}

.user-profile-modal-card {
  width: min(100%, 54rem);
  animation: profileModalOpen 540ms cubic-bezier(.18, 1.1, .24, 1) both;
}

.public-profile {
  position: relative;
  display: grid;
  gap: 18px;
  overflow: hidden;
  border-radius: 8px;
  padding-top: 14px;
  animation: profileOpenFlash 620ms ease both;
}

.public-profile h1 {
  margin: 4px 0 6px;
  font-size: clamp(2.4rem, 8vw, 5.2rem);
  line-height: 0.9;
  overflow-wrap: anywhere;
}

.public-profile p {
  margin: 0;
  color: var(--muted);
}

.profile-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.profile-mini-list {
  display: grid;
  gap: 8px;
}

.mini-effect {
  display: grid;
  gap: 4px;
  border: 1px solid color-mix(in srgb, var(--fx-a), transparent 70%);
  border-radius: 8px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--fx-a), transparent 92%);
}

.mini-effect span {
  color: var(--muted);
  font-size: 0.82rem;
}

.screen-fx {
  background:
    radial-gradient(circle at center, color-mix(in srgb, var(--fx-a), transparent 48%), transparent 28rem),
    radial-gradient(circle at 50% 52%, color-mix(in srgb, var(--fx-b), transparent 72%), transparent 36rem),
    rgba(0, 0, 0, 0.92);
}

.screen-fx strong {
  color: #fff8e8;
}

@media (max-width: 980px) {
  .roll-layout,
  .profile-grid,
  .leaderboard-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: stretch;
  }
}

@media (max-width: 620px) {
  .split-heading,
  .shop-card footer {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-controls,
  .user-card dl {
    grid-template-columns: 1fr;
  }
}
