/* ============================================
   HashSlot — Hacker Terminal Theme
   Green-on-black, monospace, matrix vibes
   ============================================ */

@font-face {
  font-family: 'Days';
  src: url('font/Days.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Modern deep glass colors */
  --bg-primary: #050806;
  --bg-secondary: rgba(5, 12, 8, 0.74);
  --bg-card: rgba(1, 8, 4, 0.68);
  --bg-card-solid: #030804;
  --glass: rgba(0, 255, 65, 0.04);
  --glass-border: rgba(0, 255, 65, 0.15);

  /* Cyber glows */
  --accent: #00ff41;
  --accent-light: #4dff88;
  --accent-dark: #00b32d;
  --accent-glow: rgb(0 0 0 / 40%);
  --accent-glow-strong: rgba(0, 255, 65, 0.6);
  --cyber-cyan: #00f3ff;
  --cyber-cyan-glow: rgba(0, 243, 255, 0.4);

  --gold: #00ff41;
  --gold-glow: rgba(0, 255, 65, 0.4);
  --green: #00ff41;
  --green-glow: rgba(0, 255, 65, 0.4);
  --red: #ff2a2a;
  --red-glow: rgba(255, 42, 42, 0.4);
  --cyan: #00f3ff;
  --pink: #ff00ea;
  --amber: #ffb000;

  --text-primary: #27ffab;
  --text-secondary: #00ff41;
  --text-muted: #ffffff;

  --radius: 6px;
  --radius-sm: 4px;
  --radius-xs: 2px;
  --shadow: 0 8px 32px 0 rgba(0, 255, 65, 0.08);
  --transition: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --font-mono: 'Days', monospace;
  --module-bg:
    linear-gradient(135deg, rgba(0, 255, 65, 0.08), transparent 34%),
    radial-gradient(circle at 92% 0%, rgba(0, 243, 255, 0.14), transparent 32%),
    rgba(1, 8, 4, 0.68);
  --module-grid: none;
  --module-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 18px 50px rgba(0, 0, 0, 0.28),
    0 0 26px rgba(0, 255, 65, 0.05);
  --scanline: repeating-linear-gradient(0deg,
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.15) 2px,
      rgba(0, 0, 0, 0.15) 4px);
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-mono);
  background-color: var(--bg-primary);
  background-image:
    radial-gradient(circle at 18% 8%, rgba(0, 255, 65, 0.12), transparent 24rem),
    radial-gradient(circle at 82% 18%, rgba(0, 243, 255, 0.10), transparent 22rem),
    linear-gradient(180deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.72)),
    url('/img/fons3.png');
  background-repeat: no-repeat;
  background-position: center center;
  background-attachment: fixed;
  background-size: cover;
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  /* text-shadow: 0 0 10px rgba(0, 255, 65, 0.5); */
  letter-spacing: 0.5px;
}

h1,
h2,
h3,
h4 {
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 1em;
  /* text-shadow: 0 0 10px rgba(0, 255, 65, 0.5); */
  letter-spacing: 1px;
}

/* Scanline overlay */
body::before {
  display: none;
  content: '';
  position: fixed;
  inset: 0;
  background: var(--scanline);
  z-index: 9999;
  pointer-events: none;
  opacity: 0.2;
  /* Subtler scanlines */
}

/* CRT vignette glow */
body::after {
  display: none;
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at center, transparent 30%, rgba(2, 5, 3, 0.85) 100%);
  z-index: 0;
  pointer-events: none;
}

/* ---------- Layout ---------- */
.app-wrapper {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

.app-wrapper::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: var(--module-grid);
  background-size: 34px 34px;
  mask-image: radial-gradient(ellipse at center, #000 0%, transparent 68%);
  opacity: 0.35;
  pointer-events: none;
  z-index: -1;
}

.key-icon {
  height: 1.25em;
  width: auto;
  vertical-align: middle;
  display: inline-block;
  transform: translateY(-2px);
}

/* ---------- Header ---------- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 14px 22px;
  border: 1px solid rgba(0, 255, 65, 0.22);
  border-top-color: rgba(0, 255, 65, 0.42);
  border-radius: var(--radius);
  background: var(--module-bg);
  box-shadow: var(--module-shadow);
  margin-bottom: 24px;
  position: sticky;
  top: 16px;
  z-index: 50;
  overflow: hidden;
  gap: 18px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.header::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--module-grid);
  background-size: 28px 28px;
  mask-image: linear-gradient(90deg, #000, transparent 70%);
  opacity: 0.65;
  pointer-events: none;
}

.logo {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: transparent;
  border: 1px solid rgba(0, 255, 65, 0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 0 22px rgba(0, 255, 65, 0.12);
}

.logo-text {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.4rem;
  background: linear-gradient(135deg, var(--green) 0%, var(--cyber-cyan) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  /* text-shadow: 0 0 20px rgba(0, 255, 65, 0.3); */
  letter-spacing: 2.5px;
  text-transform: uppercase;
}

.logo-text::after {
  content: none;
}

.header-right {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
}

.header-right > * {
  min-width: 0;
}

.hashkey-balance {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(0, 255, 65, 0.22);
  padding: 8px 14px;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.account-cluster {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-width: 0;
  max-width: 440px;
  border: 1px solid rgba(0, 255, 65, 0.22);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.26);
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.account-cluster .hashkey-balance,
.account-cluster .btn,
.account-cluster .admin-link {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.user-pill {
  min-width: 0;
  flex: 1 1 auto;
  max-width: 260px;
}

.user-avatar {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border: 1px solid rgba(0, 243, 255, 0.24);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.34);
  object-fit: cover;
  object-position: center;
  box-shadow: 0 0 12px rgba(0, 255, 65, 0.14);
}

.user-email {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
}

.admin-link,
.btn-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 0 14px;
  white-space: nowrap;
  text-decoration: none;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

.admin-link {
  border-left: 1px solid rgba(0, 255, 65, 0.14) !important;
  color: var(--amber);
  background: rgba(255, 176, 0, 0.035) !important;
}

.admin-link::before {
  content: 'ADM';
  margin-right: 8px;
  color: rgba(255, 176, 0, 0.7);
  font-size: 0.52rem;
  letter-spacing: 1px;
}

.admin-link:hover {
  background: rgba(255, 176, 0, 0.09) !important;
}

.btn-logout {
  border-left: 1px solid rgba(0, 255, 65, 0.14) !important;
  color: var(--text-secondary);
}

.btn-logout:hover {
  color: var(--red);
  border-color: rgba(255, 42, 42, 0.24) !important;
  background: rgba(255, 42, 42, 0.06) !important;
}

.btn-fragments {
  flex: 0 0 auto;
  border-color: rgba(0, 243, 255, 0.24);
  color: var(--cyber-cyan);
}

.btn-fragments:hover {
  border-color: rgba(0, 243, 255, 0.5);
  background: rgba(0, 243, 255, 0.08);
}

.hashkey-balance .hashkey-icon {
  font-size: 1rem;
}

.hashkey-balance .hashkey-count {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.hashkey-balance.hashkey-pulse {
  animation: hashkeyPulse 0.9s ease-out;
}

@keyframes hashkeyPulse {
  0% { transform: scale(1); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03); }
  35% { transform: scale(1.08); box-shadow: 0 0 0 1px rgba(0,255,65,0.75), 0 0 42px rgba(0,255,65,0.42); }
  100% { transform: scale(1); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03); }
}

/* ---------- Key Fragment Modal ---------- */
.key-fragments-card {
  position: relative;
  overflow: hidden;
  max-width: 560px;
  padding: 30px 28px 26px;
}

.key-fragments-card::after {
  content: '';
  position: absolute;
  inset: -35% auto auto 50%;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,255,65,0.18), transparent 66%);
  transform: translateX(-50%);
  pointer-events: none;
  opacity: 0.65;
}

.key-fragments-card .modal-close {
  position: relative;
  z-index: 2;
  margin-top: 18px !important;
}

.key-fragments-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.key-fragments-title {
  margin: 0 0 6px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.key-fragments-copy {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.74rem;
  line-height: 1.5;
  max-width: 360px;
}

.key-fragments-meter {
  flex: 0 0 auto;
  border: 1px solid rgba(0,255,65,0.28);
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--accent);
  background: rgba(0,0,0,0.32);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  box-shadow: inset 0 0 18px rgba(0,255,65,0.06);
}

.key-fragments-track {
  position: relative;
  z-index: 1;
  height: clamp(300px, 47vw, 360px);
  margin: 0 auto;
  max-width: 510px;
  border: 1px solid rgba(0,255,65,0.14);
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 50%, rgba(0,255,65,0.10), transparent 34%),
    linear-gradient(180deg, rgba(0,20,11,0.24), rgba(0,0,0,0.22));
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.02),
    inset 0 -30px 70px rgba(0,0,0,0.28);
}

.key-fragments-track::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(310px, 72vw);
  height: min(310px, 72vw);
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(0,255,65,0.10), transparent 56%);
  filter: blur(18px);
  opacity: 0.7;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.key-fragments-track::after {
  content: none;
}

.key-fragments-guide {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 0;
  width: min(310px, 72vw);
  height: min(310px, 72vw);
  transform: translate(-50%, -50%);
  overflow: visible;
  filter: drop-shadow(0 0 12px rgba(0,255,65,0.12));
}

.key-fragments-guide circle,
.key-fragments-guide path {
  fill: none;
  stroke: rgba(0,255,65,0.26);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.key-fragments-guide circle {
  stroke-width: 1.7;
}

.key-fragment-slot {
  position: absolute;
  display: block;
  border: 0;
  background: transparent;
  transform-origin: center;
  transition: transform 0.25s ease, border-color 0.25s ease, filter 0.25s ease, opacity 0.25s ease;
}

.key-fragment-slot::before {
  content: none;
}

.key-fragment-slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: grayscale(1) brightness(0.38) drop-shadow(0 0 0 transparent);
  opacity: 0.58;
  transition: inherit;
}

.key-fragment-slot.key-piece-curve {
  left: 32%;
  top: 34%;
  width: 26%;
  height: 37%;
  z-index: 3;
  transform: translate(-50%, -50%);
}

.key-fragment-slot.key-piece-curve img {
  transform: rotate(-12deg);
}

.key-fragment-slot.key-piece-ring {
  left: 66%;
  right: auto;
  top: 36%;
  width: 25%;
  height: 37%;
  z-index: 2;
  transform: translate(-50%, -50%);
}

.key-fragment-slot.key-piece-ring img {
  transform: translateX(-8%) rotate(7deg);
}

.key-fragment-slot.key-piece-jagged {
  left: 50%;
  right: auto;
  top: 70%;
  bottom: auto;
  width: 27%;
  height: 38%;
  z-index: 1;
  transform: translate(-50%, -50%);
}

.key-fragment-slot.key-piece-jagged img {
  transform: rotate(0deg);
}

.key-fragment-slot.collected {
  background: transparent;
}

.key-fragment-slot.collected img {
  filter: drop-shadow(0 0 8px rgba(0,255,65,0.68)) drop-shadow(0 0 18px rgba(0,255,65,0.28));
  opacity: 1;
}

.key-fragment-slot.awarded {
  animation: fragmentAward 1.15s ease-out;
}

.key-fragments-forge {
  position: relative;
  z-index: 1;
  min-height: 18px;
  margin-top: 14px;
  color: var(--cyber-cyan);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 1.2px;
  text-align: center;
  text-transform: uppercase;
}

.key-fragments-card.forging .key-fragment-slot {
  animation-duration: 2.1s;
  animation-timing-function: cubic-bezier(.2,.82,.2,1);
  animation-fill-mode: forwards;
}

.key-fragments-card.forging .key-piece-curve {
  animation-name: forgeCurve;
}

.key-fragments-card.forging .key-piece-ring {
  animation-name: forgeRing;
}

.key-fragments-card.forging .key-piece-jagged {
  animation-name: forgeJagged;
}

.key-fragments-card.forging .key-fragments-guide {
  animation: forgeGuide 2.1s ease-in-out forwards;
}

.key-fragments-card.forging .key-fragments-track::after {
  animation: forgeCore 2.1s ease-in-out forwards;
}

@keyframes fragmentAward {
  0% { opacity: 0.72; }
  38% { opacity: 1; }
  100% { opacity: 1; }
}

@keyframes forgeCurve {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  45% { transform: translate(8%, 12%) rotate(-4deg) scale(1.06); opacity: 1; }
  72% { transform: translate(8%, 12%) rotate(-4deg) scale(1.1); opacity: 1; filter: drop-shadow(0 0 18px rgba(0,255,65,0.45)); }
  100% { transform: translate(8%, 12%) rotate(-4deg) scale(0.92); opacity: 0; filter: blur(2px) brightness(1.7); }
}

@keyframes forgeRing {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  45% { transform: translate(-50%, -50%) rotate(0deg) scale(1.18); opacity: 1; }
  72% { transform: translate(-50%, -50%) rotate(0deg) scale(1.24); opacity: 1; filter: drop-shadow(0 0 22px rgba(0,255,65,0.52)); }
  100% { transform: translate(-50%, -50%) rotate(0deg) scale(0.96); opacity: 0; filter: blur(2px) brightness(1.7); }
}

@keyframes forgeJagged {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  45% { transform: translate(-50%, -138%) rotate(5deg) scale(1.08); opacity: 1; }
  72% { transform: translate(-50%, -138%) rotate(5deg) scale(1.14); opacity: 1; filter: drop-shadow(0 0 18px rgba(0,255,65,0.45)); }
  100% { transform: translate(-50%, -138%) rotate(5deg) scale(0.92); opacity: 0; filter: blur(2px) brightness(1.7); }
}

@keyframes forgeGuide {
  0% { opacity: 1; }
  45% { opacity: 0.55; transform: translate(-50%, -50%) scale(0.96); }
  72% { opacity: 0.2; transform: translate(-50%, -50%) scale(0.84); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.72); }
}

@keyframes forgeCore {
  0% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 18px rgba(0,255,65,0.55); }
  45% { transform: translate(-50%, -50%) scale(2.2); box-shadow: 0 0 34px rgba(0,255,65,0.8); }
  72% { transform: translate(-50%, -50%) scale(6); box-shadow: 0 0 80px rgba(0,255,65,0.72); }
  100% { transform: translate(-50%, -50%) scale(10); opacity: 0; box-shadow: 0 0 100px rgba(0,255,65,0); }
}

@media (max-width: 600px) {
  .key-fragments-head {
    flex-direction: column;
    gap: 10px;
  }

  .key-fragments-track {
    height: clamp(250px, 76vw, 310px);
  }

}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 255, 65, 0.35);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  background:
    linear-gradient(135deg, rgba(0, 255, 65, 0.10), rgba(0, 243, 255, 0.035)),
    rgba(0, 0, 0, 0.28);
  color: var(--accent);
  backdrop-filter: blur(4px);
  z-index: 1;
  height: auto;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 0 18px rgba(0, 255, 65, 0.06);
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(0, 255, 65, 0.2), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
  z-index: -1;
}

.btn:hover::before {
  transform: translateX(100%);
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 255, 65, 0.1);
  opacity: 0;
  transition: var(--transition);
  z-index: -2;
}

.btn:hover::after {
  opacity: 1;
}

.btn:hover {
  /* text-shadow: 0 0 12px var(--accent); */
  transform: translateY(-1px);
  border-color: rgba(0, 243, 255, 0.46);
  color: var(--text-primary);
}

.btn:active {
  transform: translateY(1px);
}

.btn-buy {
  background:
    linear-gradient(135deg, rgba(0, 255, 65, 0.13), rgba(0, 243, 255, 0.045)),
    rgba(0, 0, 0, 0.28);
  color: var(--accent);
  border: 1px solid rgba(0, 255, 65, 0.42);
  padding: 8px 16px 8px 45px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  min-width: 0;
}

.btn-buy-bg {
  position: absolute;
  left: -20px;
  top: 50%;
  transform: translateY(-50%);
  height: 160%;
  opacity: 0.2;
  pointer-events: none;
}

.buy-text-wrapper {
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 2;
  line-height: 1.15;
}

.buy-text-top {
  font-size: 0.68rem;
  letter-spacing: 1.5px;
  color: var(--text-primary);
}

.buy-text-bottom {
  font-size: 0.90rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.btn-buy:hover {
  background: rgba(0, 255, 65, 0.15);
}

.btn-spin {
  width: 100%;
  min-height: 72px;
  padding: 0 28px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.45rem;
  letter-spacing: 7px;
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  background-color: #160a2a;
  background-image: linear-gradient(180deg, #451d6c 0%, #351752 45%, #241037 100%);
  border: 1px solid #9d61d3;
  color: #f6edff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -18px 36px rgba(8, 0, 18, 0.32),
    0 0 22px rgba(95, 38, 154, 0.34);
  text-shadow: 0 0 10px rgba(219, 180, 255, 0.42);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), border-color 0.28s ease, box-shadow 0.28s ease, color 0.28s ease, background 0.28s ease;
  isolation: isolate;
  animation: spin-fluorescent-flicker 6.4s steps(1, end) infinite;
}

.btn-spin-content {
  position: relative;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  line-height: 1;
  animation: spin-label-flicker 6.4s steps(1, end) infinite;
}

.btn-spin .key-icon {
  height: 28px;
  transform: translateY(-1px);
  filter: drop-shadow(0 0 6px rgba(0, 255, 120, 0.48));
}

.btn-spin:active:not(:disabled) {
  transform: translateY(2px);
  border-bottom-width: 1px;
}

.btn-spin:hover:not(:disabled) {
  background-image: linear-gradient(180deg, #4f2080 0%, #3a1760 45%, #25103b 100%);
  border-color: #b475ff;
  color: #ffffff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -18px 38px rgba(8, 0, 18, 0.26),
    0 0 28px rgba(136, 70, 210, 0.48);
  text-shadow: 0 0 16px rgba(219, 180, 255, 0.62);
}

.btn-spin:hover:not(:disabled) .btn-spin-shine {
  opacity: 1;
}

.btn-spin-shine {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 0%, transparent 40%, rgba(255, 255, 255, 0.16) 50%, transparent 60%, transparent 100%);
  transform: translateX(-120%);
  transition: opacity 0.55s ease, transform 1.05s ease;
  opacity: 0;
  z-index: 2;
}

.btn-spin:hover:not(:disabled) .btn-spin-shine {
  transform: translateX(120%);
}

.btn-spin:disabled {
  opacity: 1;
  cursor: not-allowed;
  border-bottom-width: 1px;
  transform: none;
  border-color: rgba(157, 97, 211, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.10),
    inset 0 -18px 36px rgba(8, 0, 18, 0.38),
    0 0 18px rgba(95, 38, 154, 0.22);
}

.btn-spin:disabled .btn-spin-content {
  opacity: 1;
}

.btn-spin.spinning {
  animation: terminal-blink 0.8s ease-in-out infinite alternate;
}

.btn-spin::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background-image: url('/img/mascaraopen.png');
  background-position: center;
  background-size: auto 100%;
  background-repeat: repeat-x;
  opacity: 1;
  filter: none;
  transform: none;
  transition: opacity 0.28s ease, filter 0.28s ease;
  animation: spin-pattern-flicker 6.4s steps(1, end) infinite;
}

.btn-spin::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(70% 120% at 50% 0%, rgba(219, 180, 255, 0.16), transparent 58%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 55%);
  opacity: 0.9;
  transition: opacity 0.45s ease;
}

.btn-spin:hover:not(:disabled)::before {
  animation: none;
  opacity: 0.95;
  filter: brightness(0) invert(1) drop-shadow(0 0 8px rgba(255, 255, 255, 0.28));
  transform: none;
}

.btn-spin:hover:not(:disabled)::after {
  opacity: 1;
}

@keyframes spin-fluorescent-flicker {
  0%, 54%, 59%, 63%, 87%, 90%, 100% {
    border-color: #9d61d3;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.12),
      inset 0 -18px 36px rgba(8, 0, 18, 0.32),
      0 0 22px rgba(95, 38, 154, 0.34);
  }
  55%, 58%, 88% {
    border-color: #f6edff;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.24),
      inset 0 -18px 36px rgba(8, 0, 18, 0.22),
      0 0 36px rgba(219, 180, 255, 0.58),
      0 0 14px rgba(255, 255, 255, 0.34);
  }
  56%, 61%, 89% {
    border-color: rgba(157, 97, 211, 0.48);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.08),
      inset 0 -18px 36px rgba(8, 0, 18, 0.42),
      0 0 10px rgba(95, 38, 154, 0.18);
  }
}

@keyframes spin-label-flicker {
  0%, 54%, 59%, 63%, 87%, 90%, 100% {
    opacity: 1;
    text-shadow: 0 0 10px rgba(219, 180, 255, 0.42);
  }
  55%, 58%, 88% {
    opacity: 1;
    text-shadow: 0 0 16px rgba(255, 255, 255, 0.84), 0 0 28px rgba(219, 180, 255, 0.55);
  }
  56%, 61%, 89% {
    opacity: 0.86;
    text-shadow: 0 0 4px rgba(219, 180, 255, 0.22);
  }
}

@keyframes spin-pattern-flicker {
  0%, 54%, 59%, 63%, 87%, 90%, 100% {
    filter: none;
    opacity: 1;
  }
  55%, 58%, 88% {
    filter: brightness(0) invert(1) drop-shadow(0 0 10px rgba(255, 255, 255, 0.42));
    opacity: 1;
  }
  56%, 61%, 89% {
    filter: none;
    opacity: 0.66;
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn-spin,
  .btn-spin-content,
  .btn-spin::before {
    animation: none;
  }
}

@keyframes terminal-blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

.btn-sm {
  padding: 5px 12px;
  font-size: 0.7rem;
  border-radius: var(--radius);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- Card ---------- */
.card {
  background: var(--module-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(0, 255, 65, 0.24);
  border-top: 1px solid rgba(0, 255, 65, 0.42);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--module-shadow);
}

.module-card {
  padding: 0;
  background: var(--module-bg);
  border-color: rgba(0, 255, 65, 0.28);
  box-shadow: var(--module-shadow);
}

.module-heading {
  display: block;
  margin: 0;
}

.card-title.module-heading {
  margin-bottom: 0;
}

.card-title.module-heading::before,
.module-heading::before {
  content: none;
}

.module-toggle {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  min-height: 58px;
  background: rgba(0, 0, 0, 0.1);
  border: 0;
  padding: 14px 22px;
  color: var(--text-primary);
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}

.module-toggle:hover {
  background: rgba(0, 255, 65, 0.035);
}

.module-static {
  cursor: default;
}

.module-static:hover {
  background: rgba(0, 0, 0, 0.1);
}

.module-toggle-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  text-align: left;
}

.module-lock {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(0, 255, 65, 0.4);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 35%, rgba(0, 255, 65, 0.2), transparent 56%),
    rgba(0, 0, 0, 0.32);
  color: var(--green);
  font-size: 0.5rem;
  letter-spacing: 1px;
  box-shadow: 0 0 24px rgba(0, 255, 65, 0.14);
}

.module-kicker,
.module-title-text {
  display: block;
}

.module-kicker {
  margin-bottom: 4px;
  color: var(--cyber-cyan);
  font-size: 0.58rem;
  letter-spacing: 2px;
  opacity: 0.9;
}

.module-title-text {
  color: var(--text-primary);
  font-size: 1rem;
  letter-spacing: 1.8px;
}

.module-toggle-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.module-status {
  padding: 5px 10px;
  border: 1px solid rgba(0, 243, 255, 0.28);
  border-radius: 999px;
  background: rgba(0, 243, 255, 0.055);
  color: var(--cyber-cyan);
  font-size: 0.58rem;
  letter-spacing: 1.2px;
  white-space: nowrap;
}

.module-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -4px;
}

.module-arrow {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(0, 255, 65, 0.35);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.32);
  color: var(--green);
  font-size: 0.72rem;
  transition: var(--transition);
}

.module-arrow.open {
  transform: rotate(90deg);
}

.module-content {
  position: relative;
  z-index: 1;
  display: none;
  padding: 0 22px 22px;
}

.module-content.open {
  display: block;
  animation: fadeSlideIn 0.2s ease-out;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyber-cyan), transparent);
  animation: scan-line 6s linear infinite;
}

.card::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--module-grid);
  background-size: 28px 28px;
  mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
  pointer-events: none;
  opacity: 0.85;
}

@keyframes scan-line {
  0% {
    left: -100%;
  }

  100% {
    left: 200%;
  }
}

.card-title {
  position: relative;
  z-index: 1;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.card-title::before {
  content: '>';
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(0, 255, 65, 0.28);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.28);
  color: var(--cyber-cyan);
}

/* ---------- Slot Machine ---------- */
.slot-section {
  margin-bottom: 20px;
}

.slot-card::before {
  background-image: var(--module-grid), var(--scanline);
  background-size: 28px 28px, auto;
  opacity: 0.5;
}

.slot-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--module-grid);
  background-size: 28px 28px;
  mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
  pointer-events: none;
  opacity: 0.85;
}

.slot-card .module-title-text::before,
.slot-card .module-title-text::after {
  content: none;
}

.slot-card .module-title-text {
  font-style: italic;
  text-transform: uppercase;
}

.slot-card .module-toggle {
  padding-left: 22px;
}

.slot-card .module-content {
  padding-inline: 16px;
}

.slot-sublabel {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  position: relative;
  z-index: 2;
  letter-spacing: 1px;
}

/* Reel Strip */
.reel-container {
  position: relative;
  height: 120px;
  overflow: hidden;
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.75), rgba(0, 255, 65, 0.035), rgba(0, 0, 0, 0.75)),
    rgba(0, 5, 2, 0.82);
  border: 1px solid rgba(0, 255, 65, 0.22);
  margin-bottom: 20px;
  z-index: 2;
  box-shadow: inset 0 0 32px rgba(0, 0, 0, 0.72), 0 0 20px rgba(0, 255, 65, 0.05);
}

/* Gradient masks on edges */
.reel-container::before,
.reel-container::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100px;
  z-index: 3;
  pointer-events: none;
}

.reel-container::before {
  left: 0;
  background: linear-gradient(90deg, rgba(3, 8, 4, 0.98), transparent);
}

.reel-container::after {
  right: 0;
  background: linear-gradient(-90deg, rgba(3, 8, 4, 0.98), transparent);
}

/* Center highlight */
.reel-highlight {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 110px;
  height: 110px;
  border: 1px solid rgba(0, 243, 255, 0.55);
  border-radius: var(--radius);
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 243, 255, 0.08), transparent, rgba(0, 255, 65, 0.08));
  box-shadow: 0 0 32px rgba(0, 243, 255, 0.12), inset 0 0 18px rgba(0, 255, 65, 0.08);
}

.reel-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  position: absolute;
  top: 50%;
  left: 0;
  width: max-content;
  transform: translateY(-50%);
  transition: none;
}

.reel-strip.animating {
  transition: none;
}

.reel-strip.landing {
  transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.reel-item {
  flex-shrink: 0;
  width: 100px;
  height: 100px;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.7rem;
  text-align: center;
  border: 1px solid rgba(0, 255, 65, 0.12);
  position: relative;
  overflow: hidden;
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.26);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.reel-item .item-icon {
  font-size: 1.8rem;
}

.item-icon-img {
  width: 90%;
  height: 90%;
  object-fit: contain;
}

.history-icon-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  vertical-align: middle;
}

.detail-icon-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  vertical-align: middle;
}

.reel-item .item-label {
  font-size: 0.65rem;
  opacity: 0.9;
  line-height: 1.2;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
}

/* Item rarity colors — hacker style */
.reel-item.rarity-common,
.prize-card.rarity-common {
  background: rgba(169, 169, 169, 0.1);
  border-color: #a9a9a9;
}

.reel-item.rarity-uncommon,
.prize-card.rarity-uncommon {
  background: rgba(181, 138, 255, 0.1);
  border-color: #b58aff;
  color: #b58aff;
}

.reel-item.rarity-rare,
.prize-card.rarity-rare {
  background: rgba(134, 18, 255, 0.2);
  border-color: #8612ff;
  color: #8612ff;
}

.reel-item.rarity-epic,
.prize-card.rarity-epic {
  background: rgba(255, 44, 44, 0.15);
  border-color: #ff2c2c;
  color: #ff2c2c;
}

.reel-item.rarity-legendary,
.prize-card.rarity-legendary {
  background: rgba(230, 164, 16, 0.15);
  border-color: #e6a410;
  color: #e6a410;
}

.reel-item.winner {
  animation: winner-glow 0.6s ease-out;
}

@keyframes winner-glow {
  0% {
    transform: scale(0.95);
  }

  50% {
    transform: scale(1.05);
  }

  100% {
    transform: scale(1);
  }
}

/* Result display */
.result-display {
  text-align: center;
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.12rem;
  color: #ffffff;
  position: relative;
  z-index: 2;
  letter-spacing: 0.4px;
  margin-bottom: 14px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.72), 0 0 10px rgba(255, 255, 255, 0.18);
}

.result-display.won {
  color: var(--accent);
  /* text-shadow: 0 0 20px var(--accent-glow); */
  animation: result-pop 0.4s ease-out;
}

.result-display.lost {
  color: var(--red);
  /* text-shadow: 0 0 10px var(--red-glow); */
}

.result-icon-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  vertical-align: middle;
}

@keyframes result-pop {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }

  60% {
    transform: scale(1.1);
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Spin cost badge */
.spin-cost {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.74rem;
  color: #ffffff;
  margin-top: 7px;
  position: relative;
  z-index: 2;
  letter-spacing: 0.35px;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.72), 0 0 8px rgba(255, 255, 255, 0.15);
}

.spin-cost .key-icon {
  height: 16px;
  transform: translateY(-1px);
  filter: drop-shadow(0 0 4px rgba(0, 255, 120, 0.45));
}

/* ---------- Prize Table ---------- */
.prize-table-section {
  margin-bottom: 20px;
}

.prize-table-controls {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.rarity-legend {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

.rarity-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 4px 7px;
  background: rgba(0, 0, 0, 0.28);
  font-family: var(--font-mono);
  font-size: 0.52rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  line-height: 1;
  text-transform: uppercase;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.rarity-chip::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.rarity-chip.common { color: #a9a9a9; }
.rarity-chip.uncommon { color: #b58aff; }
.rarity-chip.rare { color: #8612ff; }
.rarity-chip.epic { color: #ff2c2c; }
.rarity-chip.legendary { color: #e6a410; }

.prize-sort {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

.prize-sort-label {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 1.3px;
}

.prize-sort-btn {
  min-width: 48px;
  border: 1px solid rgba(0, 255, 65, 0.18);
  border-radius: var(--radius-xs);
  padding: 7px 10px;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.28);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: var(--transition);
}

.prize-sort-btn:hover,
.prize-sort-btn:focus-visible {
  border-color: rgba(0, 243, 255, 0.38);
  color: var(--cyber-cyan);
  outline: none;
}

.prize-sort-btn.active {
  border-color: rgba(0, 255, 65, 0.48);
  color: var(--accent);
  background:
    linear-gradient(135deg, rgba(0, 255, 65, 0.11), rgba(0, 243, 255, 0.04)),
    rgba(0, 0, 0, 0.34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 0 16px rgba(0, 255, 65, 0.08);
}

.prize-sort-btn.active::after {
  content: attr(data-sort-arrow);
  display: inline-block;
  margin-left: 5px;
  color: var(--cyber-cyan);
  font-size: 0.72em;
}

.prize-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.prize-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 10px;
  border-radius: var(--radius);
  border: 1px solid rgba(0, 255, 65, 0.16);
  background:
    linear-gradient(135deg, rgba(0, 255, 65, 0.045), transparent),
    rgba(0, 0, 0, 0.28);
  text-align: center;
  transition: var(--transition);
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.prize-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(0, 243, 255, 0.08), transparent);
  transform: translateX(-120%);
  transition: transform 0.55s ease;
  pointer-events: none;
  z-index: 0;
}

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

.prize-card:hover {
  border-color: rgba(0, 243, 255, 0.45);
  transform: translateY(-2px);
}

.prize-card:hover::before {
  transform: translateX(120%);
}

.prize-card .prize-icon {
  font-size: 1.4rem;
}

.prize-icon-img {
  display: block;
  width: calc(100% + 20px);
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  margin: -16px -10px 8px -10px;
  border-radius: var(--radius) var(--radius) 0 0;
  filter: drop-shadow(0 0 10px rgba(0, 255, 65, 0.10));
  opacity: 1;
}

.prize-card .prize-name {
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.5px;
}

.prize-card .prize-chance {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  padding: 2px 7px;
  border: 1px solid rgba(0, 255, 65, 0.12);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.24);
}

/* ---------- FAQ ---------- */
.faq-section {
  margin-bottom: 20px;
}

.faq-list {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.faq-item {
  border: 1px solid rgba(0, 255, 65, 0.12);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: linear-gradient(90deg, rgba(0, 255, 65, 0.045), rgba(0, 0, 0, 0.12));
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
}

.faq-question::before {
  content: 'Q';
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(0, 243, 255, 0.24);
  border-radius: var(--radius-xs);
  background: rgba(0, 243, 255, 0.05);
  color: var(--cyber-cyan);
  font-size: 0.58rem;
  flex-shrink: 0;
}

.faq-question:hover {
  background: linear-gradient(90deg, rgba(0, 255, 65, 0.08), rgba(0, 243, 255, 0.025));
  color: var(--accent);
}

.faq-question[aria-expanded="true"] {
  color: var(--accent);
  background: linear-gradient(90deg, rgba(0, 255, 65, 0.08), rgba(0, 243, 255, 0.035));
  border-bottom: 1px solid rgba(0, 255, 65, 0.12);
}

.faq-arrow {
  flex-shrink: 0;
  font-size: 0.65em;
  transition: var(--transition);
  display: inline-block;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(0, 255, 65, 0.2);
  border-radius: var(--radius-xs);
  color: rgba(0, 255, 65, 0.65);
}

.faq-question[aria-expanded="true"] .faq-arrow {
  transform: rotate(90deg);
  color: var(--accent);
}

.faq-answer {
  display: none;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.32);
  font-size: 0.73rem;
  color: var(--text-muted);
  line-height: 1.6;
  animation: fadeSlideIn 0.15s ease-out;
}

.faq-answer.open {
  display: block;
}

.faq-answer p {
  margin: 0;
}

.faq-answer code {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.faq-answer strong {
  color: var(--text-secondary);
}

.rarity-label {
  font-weight: 700;
  font-size: 0.85em;
  letter-spacing: 0.5px;
}

.rarity-label.common   { color: #a9a9a9; }
.rarity-label.uncommon { color: #b58aff; }
.rarity-label.rare     { color: #8612ff; }
.rarity-label.epic     { color: #ff2c2c; }
.rarity-label.legendary { color: #e6a410; }

/* ---------- Leaderboard ---------- */
.leaderboard-section {
  margin-bottom: 20px;
}

.leaderboard-card .module-status strong {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(0, 255, 65, 0.12);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(90deg, rgba(0, 255, 65, 0.055), rgba(0, 243, 255, 0.018)),
    rgba(0, 0, 0, 0.24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.leaderboard-rank {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(0, 243, 255, 0.24);
  border-radius: var(--radius-xs);
  color: var(--cyber-cyan);
  background: rgba(0, 243, 255, 0.05);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
}

.leaderboard-name {
  min-width: 0;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-points {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.8px;
  text-align: right;
}

.leaderboard-points::after {
  content: ' HP';
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
}

@media (max-width: 560px) {
  .leaderboard-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .leaderboard-points {
    grid-column: 2;
    text-align: left;
  }
}

/* ---------- Provably Fair Panel ---------- */
.fair-section {
  margin-bottom: 20px;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fair-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.fair-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.fair-label::before {
  content: '$ ';
  color: rgba(0, 255, 65, 0.3);
}

.fair-value {
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-secondary);
  word-break: break-all;
  line-height: 1.4;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.fair-input {
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-primary);
  width: 100%;
  outline: none;
  transition: var(--transition);
  /* text-shadow: 0 0 6px rgba(0, 255, 65, 0.3); */
}

.fair-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 255, 65, 0.07);
}

.fair-row-inline {
  display: flex;
  gap: 10px;
}

.fair-row-inline .fair-row {
  flex: 1;
}

.btn-verify {
  margin-top: 2px;
}

.fair-explainer {
  margin-top: 16px;
  padding: 14px;
  background: linear-gradient(135deg, rgba(0, 255, 65, 0.06), rgba(0, 0, 0, 0.18));
  border: 1px solid rgba(0, 255, 65, 0.12);
  border-left-color: rgba(0, 243, 255, 0.35);
  border-radius: var(--radius-sm);
}

.fair-explainer p {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.fair-explainer strong {
  color: var(--text-secondary);
}

.fair-explainer code {
  color: var(--accent);
}

.verify-result {
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 4px;
  display: none;
  font-family: var(--font-mono);
}

.verify-result.pass {
  display: block;
  background: rgba(0, 255, 65, 0.06);
  border: 1px solid rgba(0, 255, 65, 0.25);
  color: var(--accent);
}

.verify-result.fail {
  display: block;
  background: rgba(255, 51, 51, 0.06);
  border: 1px solid rgba(255, 51, 51, 0.25);
  color: var(--red);
}

/* ---------- History ---------- */
.history-section {
  margin-bottom: 20px;
}

.history-list {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.history-list::-webkit-scrollbar {
  width: 4px;
}

.history-list::-webkit-scrollbar-track {
  background: transparent;
}

.history-list::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 0;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background:
    linear-gradient(90deg, rgba(0, 255, 65, 0.04), rgba(0, 0, 0, 0.18)),
    rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(0, 255, 65, 0.12);
  font-size: 0.75rem;
  transition: var(--transition);
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.history-item:hover {
  border-color: rgba(0, 243, 255, 0.4);
  background:
    linear-gradient(90deg, rgba(0, 255, 65, 0.07), rgba(0, 243, 255, 0.025)),
    rgba(0, 0, 0, 0.24);
  transform: translateX(2px);
}

.history-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-num {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  font-size: 0.65rem;
  min-width: 24px;
}

.history-icon {
  font-size: 1rem;
}

.history-name {
  font-weight: 600;
  font-size: 0.75rem;
}

.history-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.history-nonce {
  font-size: 0.6rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.history-badge {
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: var(--font-mono);
}

.history-badge.common {
  background: rgba(0, 255, 65, 0.06);
  color: var(--text-muted);
  border: 1px solid rgba(0, 255, 65, 0.1);
}

.history-badge.uncommon {
  background: rgba(0, 255, 65, 0.08);
  color: var(--text-secondary);
  border: 1px solid rgba(0, 255, 65, 0.15);
}

.history-badge.rare {
  background: rgba(0, 255, 204, 0.08);
  color: #00ffcc;
  border: 1px solid rgba(0, 255, 204, 0.2);
}

.history-badge.epic {
  background: rgba(255, 51, 51, 0.08);
  color: #ff6666;
  border: 1px solid rgba(255, 51, 51, 0.2);
}

.history-badge.legendary {
  background: rgba(255, 176, 0, 0.08);
  color: var(--amber);
  border: 1px solid rgba(255, 176, 0, 0.2);
}

.history-empty {
  position: relative;
  z-index: 1;
  text-align: center;
  color: var(--text-muted);
  padding: 24px;
  font-size: 0.75rem;
  letter-spacing: 1px;
  border: 1px dashed rgba(0, 255, 65, 0.16);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.18);
}

.history-empty::before {
  content: '> ';
}

/* ---------- Buy Hashkeys Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 50% 18%, rgba(0, 255, 65, 0.10), transparent 28rem),
    rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(10px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal {
  position: relative;
  overflow: hidden;
  background: var(--module-bg);
  border: 1px solid rgba(0, 255, 65, 0.36);
  border-top-color: rgba(0, 243, 255, 0.4);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 480px;
  width: 100%;
  animation: modalSlide 0.2s ease-out;
  box-shadow: var(--module-shadow);
}

.modal::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--module-grid);
  background-size: 28px 28px;
  pointer-events: none;
  opacity: 0.55;
}

@keyframes modalSlide {
  from {
    transform: translateY(10px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 900px) {
  .app-wrapper {
    max-width: min(860px, calc(100vw - 24px));
    padding-left: 12px;
    padding-right: 12px;
  }

  .header {
    align-items: stretch;
    gap: 12px;
    flex-wrap: wrap;
  }

  .logo {
    flex: 1 1 260px;
  }

  .header-right {
    flex: 1 1 420px;
    gap: 8px;
  }

  .btn-buy {
    flex: 1 1 128px;
    padding-right: 12px;
  }

  .account-cluster {
    flex: 1 1 260px;
    max-width: none;
  }

  .user-pill {
    max-width: none;
  }

  .reel-container::before,
  .reel-container::after {
    width: clamp(28px, 10vw, 80px);
  }
}

.modal-title {
  position: relative;
  z-index: 1;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 6px;
  text-align: center;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.modal-sub {
  position: relative;
  z-index: 1;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-bottom: 20px;
  letter-spacing: 0.5px;
}

.welcome-modal {
  max-width: 560px;
  padding: 34px 30px 30px;
  text-align: center;
}

.welcome-modal::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 0%, rgba(0, 243, 255, 0.16), transparent 38%),
    linear-gradient(90deg, transparent, rgba(0, 255, 65, 0.08), transparent);
  pointer-events: none;
}

.welcome-title,
.welcome-copy,
.welcome-steps,
.welcome-action {
  position: relative;
  z-index: 1;
}

.welcome-title {
  margin: 0 0 12px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: clamp(1.35rem, 4vw, 2rem);
  letter-spacing: 2.5px;
  text-transform: uppercase;
  text-shadow: 0 0 24px rgba(0, 255, 65, 0.18);
}

.welcome-copy {
  max-width: 430px;
  margin: 0 auto 14px;
  color: var(--text-secondary);
  font-size: 0.84rem;
  line-height: 1.7;
}

.welcome-copy-strong {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.welcome-underlined {
  text-decoration: underline;
  text-decoration-color: var(--cyber-cyan);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.welcome-watch {
  display: block;
  margin-top: 10px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: clamp(1.05rem, 4vw, 1.42rem);
  font-weight: 800;
  letter-spacing: 1.5px;
}

.welcome-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 24px;
}

.welcome-steps span {
  border: 1px solid rgba(0, 255, 65, 0.18);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.28);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

.welcome-action {
  width: 100%;
  border: 1px solid rgba(0, 243, 255, 0.34);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  color: var(--cyber-cyan);
  background:
    linear-gradient(180deg, rgba(0, 243, 255, 0.11), rgba(0, 255, 65, 0.045)),
    rgba(0, 0, 0, 0.34);
  box-shadow: inset 0 0 18px rgba(0, 243, 255, 0.06), 0 0 20px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  transition: var(--transition);
}

.welcome-action:hover,
.welcome-action:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(0, 255, 65, 0.42);
  color: var(--accent);
  background:
    linear-gradient(180deg, rgba(0, 255, 65, 0.12), rgba(0, 243, 255, 0.055)),
    rgba(0, 0, 0, 0.42);
  box-shadow: inset 0 0 18px rgba(0, 255, 65, 0.06), 0 0 24px rgba(0, 243, 255, 0.12);
}

@media (max-width: 560px) {
  .welcome-steps {
    grid-template-columns: 1fr;
  }
}

.hashkey-amounts {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 20px;
}

.hashkey-amount-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 8px;
  border-radius: var(--radius);
  border: 1px solid rgba(0, 255, 65, 0.2);
  background:
    linear-gradient(145deg, rgba(0, 38, 16, 0.92) 0%, rgba(0, 58, 42, 0.74) 48%, rgba(0, 20, 36, 0.9) 100%),
    rgba(0, 10, 12, 0.72);
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-mono);
  color: var(--text-secondary);
  min-width: 120px;
}

.hashkey-amount-btn img {
  width: 140px;
  height: auto;
  display: block;
  filter: drop-shadow(0 0 5px rgba(0,255,65,0.1));
  object-fit: contain;
  margin-bottom: 6px;
}

.hashkey-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.hashkey-amount-btn.selected .hashkey-label {
  color: var(--accent);
}

.hashkey-amount-btn:hover {
  border-color: rgba(0, 243, 255, 0.42);
  background:
    linear-gradient(145deg, rgba(0, 48, 18, 0.96) 0%, rgba(0, 72, 50, 0.8) 48%, rgba(0, 29, 52, 0.94) 100%),
    rgba(0, 12, 16, 0.78);
  transform: translateY(-2px);
}

.hashkey-amount-btn.selected {
  border-color: var(--accent);
  background:
    radial-gradient(circle at 50% 0%, rgba(0, 255, 65, 0.18), transparent 58%),
    linear-gradient(145deg, rgba(0, 54, 20, 0.98) 0%, rgba(0, 83, 59, 0.84) 50%, rgba(0, 32, 58, 0.96) 100%),
    rgba(0, 18, 18, 0.82);
  color: var(--accent);
}

.hashkey-amount-btn.selected {
  position: relative;
}

.badge-recommended {
  position: absolute;
  top: -32px;
  right: 30%;
  transform: translateX(50%);
  width: 70px !important;
}

.modal-total {
  position: relative;
  z-index: 1;
  margin-bottom: 14px;
  padding: 12px;
  text-align: center;
  color: var(--text-muted);
  border: 1px solid rgba(0, 255, 65, 0.14);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.24);
  letter-spacing: 1px;
}

.modal-total strong {
  color: var(--accent);
}

#prize-reward-content {
  position: relative;
  z-index: 1;
}

.btn-pay {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 16px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  background:
    linear-gradient(135deg, rgba(0, 255, 65, 0.12), rgba(0, 243, 255, 0.045)),
    rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(0, 255, 65, 0.48);
  color: var(--accent);
  cursor: pointer;
  transition: var(--transition);
}

.btn-pay:hover {
  background:
    linear-gradient(135deg, rgba(0, 255, 65, 0.18), rgba(0, 243, 255, 0.07)),
    rgba(0, 0, 0, 0.28);
  /* text-shadow: 0 0 15px var(--accent); */
}

.modal-close {
  position: relative;
  z-index: 1;
  text-align: center;
  margin-top: 10px;
}

.modal-close button {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  cursor: pointer;
  padding: 6px;
  transition: var(--transition);
  font-family: var(--font-mono);
  letter-spacing: 1px;
}

.modal-close button:hover {
  color: var(--red);
}

/* ---------- History Detail Modal ---------- */
.detail-modal .modal {
  max-width: 540px;
}

.detail-seeds {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-seeds .fair-value {
  font-size: 0.68rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  .app-wrapper {
    padding: 12px 10px 40px;
  }

  .header {
    gap: 12px;
    align-items: stretch;
    padding: 14px;
    top: 10px;
  }

  .logo {
    justify-content: center;
    flex-basis: 100%;
  }

  .logo-text {
    font-size: clamp(1.05rem, 6vw, 1.4rem);
  }

  .header-right {
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    align-items: stretch;
    justify-content: stretch;
    gap: 8px;
    width: 100%;
  }

  .header-right>* {
    margin-left: 0 !important;
  }

  .hashkey-balance {
    font-size: 0.75rem;
    padding: 6px 10px;
  }

  .header-right > .hashkey-balance {
    justify-content: center;
  }

  .header-right > .btn-buy {
    justify-content: center;
    padding: 7px 10px 7px 38px;
  }

  .buy-text-top {
    font-size: 0.56rem;
  }

  .buy-text-bottom {
    font-size: 0.72rem;
  }

  .account-cluster {
    grid-column: 1 / -1;
    width: 100%;
    max-width: none;
  }

  .user-pill {
    max-width: none;
  }

  .admin-link,
  .btn-logout {
    min-height: 42px;
    padding: 0 8px;
    font-size: 0.64rem;
  }

  .admin-link::before {
    display: none;
  }

  .btn {
    font-size: 0.75rem;
    padding: 6px 12px;
  }

  .reel-container {
    height: clamp(92px, 24vw, 108px);
  }

  .reel-item {
    width: clamp(76px, 21vw, 88px);
    height: clamp(76px, 21vw, 88px);
  }

  .reel-highlight {
    width: clamp(86px, 23vw, 96px);
    height: clamp(86px, 23vw, 96px);
  }

  .btn-spin {
    font-size: 1rem;
    min-height: 72px;
    padding: 0 20px;
  }

  .prize-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(118px, 100%), 1fr));
  }

  .prize-table-controls {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .rarity-legend {
    justify-content: flex-start;
  }

  .rarity-chip {
    font-size: 0.48rem;
    padding: 4px 6px;
  }

  .prize-sort {
    justify-content: flex-start;
    flex-wrap: wrap;
  }



  .hashkey-amounts {
    gap: 8px;
    overflow-x: auto;
    justify-content: flex-start;
  }

  .hashkey-amount-btn {
    min-width: 96px;
  }

  .hashkey-amount-btn img {
    width: 88px;
  }

  .hashkey-label {
    font-size: 0.64rem;
  }

  .module-toggle {
    align-items: center;
    flex-direction: row;
    min-height: 0;
    padding: 12px 16px;
  }

  .module-lock {
    width: 42px;
    height: 42px;
    font-size: 0.46rem;
  }

  .module-title-text {
    font-size: 0.9rem;
  }

  .module-toggle-meta {
    justify-content: flex-end;
    width: auto;
  }

  .module-content {
    padding: 0 16px 16px;
  }

  .fair-row-inline {
    flex-direction: column;
  }
}

/* ---------- Utility ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Confetti canvas */
#confetti-canvas {
  position: fixed;
  inset: 0;
  z-index: 150;
  pointer-events: none;
}

/* ---------- Achievements Section ---------- */
.achievement-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.ach-filter-btn {
  background: rgba(0, 255, 65, 0.05);
  border: 1px solid rgba(0, 255, 65, 0.15);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 4px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 1px;
}

.ach-filter-btn.active,
.ach-filter-btn:hover {
  background: rgba(0, 255, 65, 0.12);
  border-color: rgba(0, 255, 65, 0.4);
  color: #00ff41;
}

.achievement-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ach-card {
  position: relative;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  min-height: 92px;
  padding: 14px 14px 13px;
  border-radius: var(--radius);
  border: 1px solid rgba(0, 255, 65, 0.14);
  background:
    linear-gradient(135deg, rgba(0, 255, 65, 0.055), rgba(0, 243, 255, 0.018)),
    rgba(0, 0, 0, 0.34);
  transition: var(--transition);
  overflow: visible;
}

.ach-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(0, 243, 255, 0.07), transparent);
  transform: translateX(-120%);
  transition: transform 0.6s ease;
  pointer-events: none;
}

.ach-card:hover::before {
  transform: translateX(120%);
}

.ach-card.ach-unlocked {
  border-color: rgba(0, 255, 65, 0.42);
  background:
    linear-gradient(135deg, rgba(0, 255, 65, 0.10), rgba(0, 243, 255, 0.025)),
    rgba(0, 0, 0, 0.3);
}

.ach-card.ach-locked {
  opacity: 0.68;
  filter: grayscale(0.45);
}

.ach-card.ach-unlocked:hover,
.ach-card:hover {
  border-color: rgba(0, 243, 255, 0.48);
  transform: translateY(-1px);
}

.ach-icon-wrap {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

.ach-icon {
  width: 58px;
  height: 58px;
  object-fit: contain;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.36);
  border: 1px solid rgba(0, 255, 65, 0.18);
  display: block;
  padding: 3px;
  box-shadow: inset 0 0 18px rgba(0, 255, 65, 0.06);
}

.ach-check,
.ach-lock {
  position: absolute;
  bottom: -4px;
  right: -4px;
  font-size: 0.58rem;
  background: #031006;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 255, 65, 0.35);
}

.ach-check {
  color: #00ff41;
  border-color: #00ff41;
}

.ach-body {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
  padding-top: 2px;
}

.ach-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}

.ach-name {
  font-size: 0.82rem;
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: 0.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ach-status {
  font-size: 0.54rem;
  letter-spacing: 1px;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.ach-status-done {
  color: #00ff41;
  border: 1px solid rgba(0, 255, 65, 0.45);
  background: rgba(0, 255, 65, 0.10);
}

.ach-status-locked {
  color: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.035);
}

.ach-desc {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.74);
  margin-bottom: 12px;
  line-height: 1.35;
}

.ach-progress-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.ach-progress-bar {
  height: 5px;
  background: rgba(0, 255, 65, 0.08);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(0, 255, 65, 0.12);
}

.ach-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #00ff41, #00f3ff);
  border-radius: 999px;
  box-shadow: 0 0 12px rgba(0, 255, 65, 0.28);
  transition: width 0.6s ease;
}

.ach-progress-label {
  font-size: 0.58rem;
  color: rgba(255, 255, 255, 0.68);
  white-space: nowrap;
}

/* ---------- Achievement Toast Notifications ---------- */
.achievement-toasts {
  position: fixed;
  top: 24px;
  left: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.ach-toast {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px 12px 14px;
  background: var(--module-bg);
  border: 1px solid rgba(0, 255, 65, 0.5);
  border-radius: var(--radius);
  min-width: 240px;
  max-width: 320px;
  transform: translateX(-120%);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
  pointer-events: auto;
  box-shadow: var(--module-shadow);
}

.ach-toast.ach-toast-show {
  transform: translateX(0);
  opacity: 1;
}

.ach-toast.ach-toast-hide {
  transform: translateX(-120%);
  opacity: 0;
  transition: transform 0.4s ease, opacity 0.3s ease;
}

.ach-toast-icon {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 50%;
  background: rgba(0, 255, 65, 0.07);
  border: 1px solid rgba(0, 255, 65, 0.2);
  flex-shrink: 0;
}

.ach-toast-text {
  min-width: 0;
}

.ach-toast-title {
  font-size: 0.65rem;
  color: #00ff41;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.ach-toast-name {
  font-size: 0.85rem;
  color: var(--text-primary);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 600px) {
  .achievement-toasts {
    left: 12px;
    right: 12px;
    bottom: 90px;
  }
  .ach-toast {
    max-width: 100%;
    min-width: 0;
  }
}

.achievements-widget {
  position: fixed;
  bottom: 24px;
  left: 22px;
  z-index: 199;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-start;
  gap: 12px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.achievements-widget.widget-hidden {
  transform: translateY(80px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* ---------- Chat Widget ---------- */

.achievements-toggle-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 1px solid rgba(0, 255, 65, 0.42);
  background:
    radial-gradient(circle at 50% 42%, rgba(0, 255, 65, 0.24), rgba(0, 18, 8, 0.94) 58%, rgba(0, 243, 255, 0.16) 100%);
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: var(--transition);
  backdrop-filter: blur(8px);
  box-shadow: 0 0 26px rgba(0, 255, 65, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.achievements-toggle-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 243, 255, 0.55);
  background: radial-gradient(circle at 50% 42%, rgba(0, 255, 65, 0.32), rgba(0, 18, 8, 0.94) 54%, rgba(0, 243, 255, 0.24) 100%);
}

.achievements-toggle-btn[aria-expanded="true"],
.chat-toggle-btn[aria-expanded="true"] {
  border-color: rgba(0, 243, 255, 0.62);
  box-shadow: 0 0 32px rgba(0, 243, 255, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.achievements-panel {
  display: none;
  flex-direction: column;
  width: min(380px, calc(100vw - 44px));
  max-height: min(640px, calc(100vh - 130px));
  background: var(--module-bg);
  border: 1px solid rgba(0, 255, 65, 0.34);
  border-top-color: rgba(0, 243, 255, 0.42);
  border-radius: 10px;
  overflow: hidden;
  animation: fadeSlideIn 0.15s ease-out;
  box-shadow: var(--module-shadow);
  backdrop-filter: blur(18px);
}

.achievements-panel.open {
  display: flex;
}

.achievements-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px;
  border-bottom: 1px solid rgba(0, 255, 65, 0.16);
  background:
    linear-gradient(90deg, rgba(0, 255, 65, 0.07), rgba(0, 243, 255, 0.025)),
    rgba(0, 0, 0, 0.18);
}

.achievements-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.76rem;
  color: var(--accent);
  letter-spacing: 1.6px;
  font-weight: 700;
  text-transform: uppercase;
}

.achievements-title::before {
  content: none;
}

.achievements-close-btn {
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(0, 255, 65, 0.14);
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.76);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  transition: var(--transition);
}

.achievements-close-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.achievements-filters {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0, 255, 65, 0.12);
  background: rgba(0, 0, 0, 0.18);
}

.achievements-filters .ach-filter-btn {
  flex: 1;
  padding: 7px 8px;
  border-radius: 999px;
  font-size: 0.6rem;
  background: rgba(0, 0, 0, 0.24);
}

.achievements-panel .achievement-list {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 12px 14px;
  flex: 1;
  scrollbar-width: none;
}

.achievements-panel .achievement-list::-webkit-scrollbar {
  display: none;
}

/* ---------- Chat Widget ---------- */
.chat-widget {
  position: fixed;
  bottom: 24px;
  right: 22px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.chat-widget.widget-hidden {
  transform: translateY(80px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.chat-toggle-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 1px solid rgba(0, 255, 65, 0.42);
  background: radial-gradient(circle at 50% 42%, rgba(0, 255, 65, 0.24), rgba(0, 18, 8, 0.94) 58%, rgba(0, 243, 255, 0.16) 100%);
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: var(--transition);
  font-family: var(--font-mono);
  backdrop-filter: blur(8px);
  box-shadow: 0 0 26px rgba(0, 255, 65, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.chat-toggle-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 243, 255, 0.55);
  background: radial-gradient(circle at 50% 42%, rgba(0, 255, 65, 0.32), rgba(0, 18, 8, 0.94) 54%, rgba(0, 243, 255, 0.24) 100%);
}

.chat-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  background: var(--red);
  color: #fff;
  border-radius: 9px;
  font-size: 0.6rem;
  font-family: var(--font-mono);
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 1px solid #000;
}

.chat-badge.visible {
  display: flex;
}

.chat-panel {
  display: none;
  flex-direction: column;
  width: min(360px, calc(100vw - 44px));
  height: min(430px, calc(100vh - 130px));
  background: var(--module-bg);
  border: 1px solid rgba(0, 255, 65, 0.34);
  border-top-color: rgba(0, 243, 255, 0.42);
  border-radius: 10px;
  overflow: hidden;
  animation: fadeSlideIn 0.15s ease-out;
  box-shadow: var(--module-shadow);
  backdrop-filter: blur(18px);
}



.chat-panel.open {
  display: flex;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px;
  border-bottom: 1px solid rgba(0, 255, 65, 0.16);
  background:
    linear-gradient(90deg, rgba(0, 255, 65, 0.07), rgba(0, 243, 255, 0.025)),
    rgba(0, 0, 0, 0.18);
  flex-shrink: 0;
}

.chat-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.chat-title::before {
  content: none;
}

.chat-close-btn {
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(0, 255, 65, 0.14);
  color: rgba(255, 255, 255, 0.76);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 2px 6px;
  font-family: var(--font-mono);
  transition: var(--transition);
  border-radius: var(--radius-xs);
}

.chat-close-btn:hover {
  color: var(--red);
  background: rgba(255, 42, 42, 0.08);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-messages::-webkit-scrollbar {
  width: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--glass-border);
}

.chat-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  min-height: 100%;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.68rem;
  font-family: var(--font-mono);
  letter-spacing: 0.8px;
  padding: 28px;
  text-align: center;
  border: 1px dashed rgba(0, 255, 65, 0.14);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.16);
}

.chat-empty span {
  color: var(--cyber-cyan);
  font-size: 0.56rem;
  letter-spacing: 1.8px;
  text-transform: uppercase;
}

.chat-empty strong {
  color: var(--text-primary);
  font-size: 0.82rem;
}

.chat-empty small {
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.62rem;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-width: 88%;
  padding: 9px 10px;
  border: 1px solid rgba(0, 255, 65, 0.10);
  border-radius: 10px 10px 10px 2px;
  background: rgba(0, 0, 0, 0.24);
}

.chat-msg.mine {
  align-self: flex-end;
  border-color: rgba(0, 255, 65, 0.22);
  border-radius: 10px 10px 2px 10px;
  background: rgba(0, 255, 65, 0.055);
}

.chat-msg-meta {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.chat-msg-author {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--cyber-cyan);
  letter-spacing: 0.5px;
}

.chat-msg-author.mine {
  color: var(--accent);
}

.chat-msg-time {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: rgba(255, 255, 255, 0.3);
}

.chat-msg-text {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
  word-break: break-word;
  padding-left: 0;
  border-left: 0;
}

.chat-msg.mine .chat-msg-text {
  border-left-color: rgba(0, 255, 65, 0.3);
  color: #d0ffd0;
}

.chat-input-row {
  display: flex;
  gap: 0;
  border-top: 1px solid rgba(0, 255, 65, 0.16);
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.28);
}

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 13px 14px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-primary);
  outline: none;
}

.chat-input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.chat-send-btn {
  background: rgba(0, 255, 65, 0.08);
  border: none;
  border-left: 1px solid rgba(0, 255, 65, 0.16);
  color: var(--accent);
  padding: 0 14px;
  font-family: var(--font-mono);
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
}

.chat-send-btn:hover {
  background: rgba(0, 255, 65, 0.14);
}

@media (max-width: 600px) {
  .chat-widget {
    bottom: 16px;
    right: 14px;
  }

  .achievements-widget {
    bottom: 90px;
    right: 14px;
    left: auto;
    align-items: flex-end;
  }

  .achievements-widget.chat-pushed {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
  }

  .chat-panel {
    width: calc(100vw - 28px);
    height: min(430px, calc(100vh - 110px));
  }

  .achievements-panel {
    width: calc(100vw - 28px);
    max-height: min(460px, calc(100vh - 140px));
  }
}

/* ---------- Custom selection ---------- */
::selection {
  background: rgba(0, 255, 65, 0.3);
  color: var(--accent);
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 255, 65, 0.15);
  border-radius: 0;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 255, 65, 0.3);
}
