/* ============================================
   HashSlot — Industrial Terminal, 2026
   Flat matte panels, neutral hairlines, green
   reserved for live data and actions. Depth is
   spent where it pays: the pull button and the
   reel window are physical; everything else is
   crisp 2D.
   ============================================ */

@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 {
  color-scheme: dark;

  /* Base */
  --bg-primary: #060806;
  --bg-secondary: rgba(9, 13, 10, 0.92);
  --bg-card: rgba(9, 14, 10, 0.92);
  --bg-card-solid: #0a0e0b;
  --glass: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.09);

  /* Signature hues (unchanged palette) */
  --accent: #00ff41;
  --accent-light: #4dff88;
  --accent-dark: #00b32d;
  --accent-glow: rgba(0, 255, 65, 0.22);
  --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;

  /* Neutral text, green as signal */
  --text-primary: #e3ece5;
  --text-secondary: #8fa697;
  --text-muted: rgba(227, 236, 229, 0.55);
  --text-dim: rgba(227, 236, 229, 0.34);

  /* Hairlines — neutral, not colored */
  --hairline: rgba(255, 255, 255, 0.08);
  --hairline-strong: rgba(255, 255, 255, 0.14);
  --line-soft: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --line-cyan: rgba(0, 243, 255, 0.26);
  --line-green: rgba(0, 255, 65, 0.35);
  --tick: rgba(0, 255, 65, 0.5);

  /* Geometry */
  --radius-lg: 14px;
  --radius: 10px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition: 0.18s cubic-bezier(0.22, 1, 0.36, 1);

  /* Type */
  --font-mono: 'Days', monospace;
  --font-data: var(--font-mono);

  /* Surfaces — flat, elevation by shadow only */
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 12px 32px rgba(0, 0, 0, 0.45);
  --surface-fill: var(--bg-card);
  --surface-edge: var(--hairline);
  --module-bg: var(--bg-card);
  --module-grid: none;
  --module-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.045),
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 14px 36px rgba(0, 0, 0, 0.42);
  --scanline: none;
}

/* ---------- 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:
    linear-gradient(180deg, rgba(4, 6, 4, 0.86), rgba(4, 6, 4, 0.94)),
    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;
  letter-spacing: 0.3px;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1em;
  letter-spacing: 0.5px;
  text-wrap: balance;
}

body::before {
  content: none;
}

/* Quiet vignette */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 30%, transparent 55%, rgba(2, 3, 2, 0.5) 100%);
  z-index: 0;
  pointer-events: none;
}

/* ---------- Focus ---------- */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

.app-wrapper::before {
  content: none;
}

.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;
  gap: 18px;
  padding: 12px 14px 12px 20px;
  margin-bottom: 24px;
  position: sticky;
  top: 12px;
  z-index: 50;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  background: rgba(8, 12, 9, 0.88);
  box-shadow: var(--module-shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.header::before,
.header::after {
  content: none;
}

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

/* Live status dot — small, calm */
.logo::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: statusPulse 3s ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: transparent;
  border: 1px solid var(--hairline-strong);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.logo-text {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.2rem;
  color: #ffffff;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

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

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

/* A consistent control height keeps every header chip aligned. */
:root { --hctl: 40px; }

/* Economy cluster — key balance + buy, kept tight together. */
.header-economy {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.hashkey-balance {
  display: flex;
  align-items: center;
  gap: 7px;
  height: var(--hctl);
  padding: 0 11px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.35);
}

/* Segmented nav group — Shop / Missions / Fragments read as one unit. */
.header-nav {
  display: flex;
  align-items: stretch;
  height: var(--hctl);
  flex: 0 0 auto;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.hnav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.hnav-btn + .hnav-btn { border-left: 1px solid var(--hairline); }
.hnav-btn:hover { color: var(--accent); background: rgba(0, 255, 65, 0.06); }

a.hnav-btn {
  text-decoration: none;
  cursor: pointer;
}

/* Account cluster — avatar pill + icon controls, as one segmented unit. */
.account-cluster {
  display: flex;
  align-items: stretch;
  height: var(--hctl);
  flex: 0 0 auto;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  min-width: 0;
  max-width: 104px;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: background 0.18s ease;
}

.user-pill:hover,
.user-pill:focus-visible {
  background: rgba(0, 255, 65, 0.07);
  outline: none;
}

.user-avatar {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border: 1px solid var(--hairline-strong);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.36);
  object-fit: cover;
  object-position: center;
}

.user-email {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
  font-family: var(--font-data);
  font-size: 0.78rem;
}

.account-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  flex: 0 0 auto;
  border: 0;
  border-left: 1px solid var(--hairline);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.admin-link.account-icon { color: var(--amber); }
.admin-link.account-icon:hover { background: rgba(255, 176, 0, 0.1); }
.btn-logout.account-icon:hover { color: var(--red); background: rgba(255, 42, 42, 0.1); }

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

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

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

@keyframes hashkeyPulse {
  0% { transform: scale(1); }
  35% { transform: scale(1.07); box-shadow: 0 0 0 1px rgba(0, 255, 65, 0.7); }
  100% { transform: scale(1); }
}

/* ---------- 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: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 255, 65, 0.14), transparent 66%);
  transform: translateX(-50%);
  pointer-events: none;
  opacity: 0.6;
}

.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(--text-primary);
  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 var(--line-green);
  border-radius: 999px;
  padding: 7px 13px;
  color: var(--accent);
  background: rgba(0, 255, 65, 0.07);
  font-family: var(--font-data);
  font-size: 0.78rem;
  font-weight: 700;
}

.key-fragments-track {
  position: relative;
  z-index: 1;
  height: clamp(300px, 47vw, 360px);
  margin: 0 auto;
  max-width: 510px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 50% 50%, rgba(0, 255, 65, 0.07), transparent 36%),
    #070a08;
  box-shadow: inset 0 10px 30px rgba(0, 0, 0, 0.55), inset 0 -16px 40px rgba(0, 0, 0, 0.4);
}

.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.09), 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;
}

.key-fragments-guide circle,
.key-fragments-guide path {
  fill: none;
  stroke: rgba(0, 255, 65, 0.22);
  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 var(--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.6)) drop-shadow(0 0 18px rgba(0, 255, 65, 0.24));
  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(--text-secondary);
  font-family: var(--font-data);
  font-size: 0.7rem;
  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(0.2, 0.82, 0.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: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline-strong);
  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.2px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  z-index: 1;
  height: auto;
}

.btn::before,
.btn::after {
  content: none;
}

.btn:hover {
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.07);
}

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

/* Primary CTA: solid green, black text */
.btn-buy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--hctl);
  padding: 0 14px;
  background: var(--accent);
  color: #04130a;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 1.5px;
  white-space: nowrap;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 2px 8px rgba(0, 0, 0, 0.4);
  transition: var(--transition);
}

.btn-buy-plus {
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1;
  margin-top: -1px;
}

.btn-buy:hover {
  background: #3dff6e;
  border-color: #3dff6e;
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 6px 16px rgba(0, 0, 0, 0.45);
}

.btn-buy:active {
  transform: translateY(1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* The pull — a physical, extruded machine button */
.btn-spin {
  position: relative;
  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);
  background-color: #160a2a;
  background-image: linear-gradient(180deg, #4e2178 0%, #381955 48%, #2a123f 100%);
  border: 1px solid #8a52c0;
  border-bottom: 0;
  color: #f6edff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 6px 0 #1c0c30,
    0 7px 0 rgba(0, 0, 0, 0.55),
    0 16px 28px rgba(0, 0, 0, 0.5);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
  transition:
    transform 0.1s ease-out,
    box-shadow 0.1s ease-out,
    background 0.25s ease,
    border-color 0.25s ease;
  isolation: isolate;
  cursor: pointer;
}

.btn-spin-content {
  position: relative;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  line-height: 1;
}

.btn-spin .key-icon {
  position: relative;
  z-index: 4;
  height: 28px;
  transform: translateY(-1px);
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.6));
}

/* The press: travels down onto its base */
.btn-spin:active:not(:disabled) {
  transform: translateY(5px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 1px 0 #1c0c30,
    0 2px 0 rgba(0, 0, 0, 0.55),
    0 6px 14px rgba(0, 0, 0, 0.5);
}

.btn-spin:hover:not(:disabled) {
  background-image: linear-gradient(180deg, #5a2689 0%, #401d61 48%, #2e1546 100%);
  border-color: #a96ce0;
  color: #ffffff;
}

.btn-spin-shine {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 0%, transparent 40%, rgba(255, 255, 255, 0.14) 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 {
  opacity: 1;
  transform: translateX(120%);
}

.btn-spin:disabled {
  opacity: 1;
  cursor: not-allowed;
  transform: none;
  border-color: rgba(138, 82, 192, 0.6);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 6px 0 #1c0c30,
    0 7px 0 rgba(0, 0, 0, 0.55),
    0 12px 22px rgba(0, 0, 0, 0.45);
}

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

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

.btn-spin.spinning .btn-spin-content {
  position: relative;
  z-index: 3;
  opacity: 1;
}

/* X2 multiplier armed: shiny gold button for the doubled HP bonus turn. */
.btn-spin.multiplier-ready {
  background-color: #3a2a05;
  background-image: linear-gradient(180deg, #ffe27a 0%, #f5b431 48%, #c8860d 100%);
  border-color: #ffe9a3;
  color: #3a2400;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 6px 0 #6b4905,
    0 7px 0 rgba(0, 0, 0, 0.55),
    0 0 22px rgba(255, 196, 60, 0.75),
    0 16px 28px rgba(0, 0, 0, 0.5);
  animation: multiplier-glow 1.1s ease-in-out infinite alternate;
}

.btn-spin.multiplier-ready:hover:not(:disabled) {
  background-image: linear-gradient(180deg, #fff0ad 0%, #ffc24a 48%, #d8941a 100%);
  border-color: #fff4cf;
  color: #3a2400;
}

.btn-spin.multiplier-ready:disabled {
  border-color: rgba(255, 233, 163, 0.6);
}

/* Persistent sweeping shine while the gold state is active. */
.btn-spin.multiplier-ready .btn-spin-shine {
  opacity: 1;
  background: linear-gradient(110deg, transparent 0%, transparent 35%, rgba(255, 255, 255, 0.65) 50%, transparent 65%, transparent 100%);
  animation: multiplier-shine 1.6s linear infinite;
}

.btn-spin.multiplier-ready .key-icon {
  filter: brightness(0) saturate(100%) invert(18%) sepia(60%) saturate(1200%) hue-rotate(2deg) drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3));
}

@keyframes multiplier-glow {
  0% { box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 6px 0 #6b4905,
    0 7px 0 rgba(0, 0, 0, 0.55),
    0 0 18px rgba(255, 196, 60, 0.6),
    0 16px 28px rgba(0, 0, 0, 0.5); }
  100% { box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 6px 0 #6b4905,
    0 7px 0 rgba(0, 0, 0, 0.55),
    0 0 34px rgba(255, 214, 90, 0.95),
    0 16px 28px rgba(0, 0, 0, 0.5); }
}

@keyframes multiplier-shine {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(120%); }
}

.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;
  transition: opacity 0.45s ease, filter 0.45s ease;
}

.btn-spin::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent 45%, rgba(0, 0, 0, 0.18) 100%);
  opacity: 1;
  transition: opacity 0.45s ease;
}

.btn-spin:hover:not(:disabled)::before {
  opacity: 0.95;
  filter: brightness(0) invert(1);
}

@keyframes terminal-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

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

.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 {
  position: relative;
  overflow: hidden;
  padding: 24px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--module-shadow);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* One quiet identity mark: a short green index line, top-left */
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 22px;
  width: 26px;
  height: 2px;
  background: var(--accent);
  pointer-events: none;
}

.card::after {
  content: none;
}

.module-card {
  padding: 0;
}

.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: 56px;
  background: transparent;
  border: 0;
  padding: 15px 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(255, 255, 255, 0.025);
}

.module-static {
  cursor: default;
}

.module-static:hover {
  background: transparent;
}

.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 var(--hairline-strong);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.32);
  color: var(--green);
  font-size: 0.5rem;
  letter-spacing: 1px;
}

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

.module-kicker {
  margin-bottom: 4px;
  color: var(--text-dim);
  font-family: var(--font-data);
  font-size: 0.58rem;
  letter-spacing: 2px;
}

.module-title-text {
  color: var(--text-primary);
  font-size: 0.92rem;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}

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

.module-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border: 0;
  border-radius: var(--radius-xs);
  background: rgba(0, 255, 65, 0.08);
  color: var(--accent);
  font-family: var(--font-data);
  font-size: 0.62rem;
  letter-spacing: 0.8px;
  white-space: nowrap;
}

.module-status::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

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

.module-arrow {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font-size: 0.68rem;
  transition: transform 0.25s var(--ease), border-color 0.18s ease, color 0.18s ease;
}

.module-toggle:hover .module-arrow {
  border-color: var(--hairline-strong);
  color: var(--text-primary);
}

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

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

.module-content.open {
  display: block;
  animation: fadeSlideIn 0.22s var(--ease);
}

.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(--text-primary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.card-title::before {
  content: '>';
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.03);
  color: var(--accent);
}

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

/* Hero panel: same flat surface, slightly raised, green edge on top */
.slot-card {
  border-color: var(--hairline-strong);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 22px 50px rgba(0, 0, 0, 0.5);
}

.slot-card::before {
  width: 44px;
}

.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;
  font-size: 1.05rem;
  color: #ffffff;
}

.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 — a machine window with physical depth */
.reel-container {
  position: relative;
  height: 124px;
  overflow: hidden;
  border-radius: var(--radius);
  background: #040604;
  border: 1px solid rgba(0, 0, 0, 0.9);
  margin-bottom: 20px;
  z-index: 2;
  box-shadow:
    inset 0 12px 22px rgba(0, 0, 0, 0.85),
    inset 0 -10px 18px rgba(0, 0, 0, 0.7),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 1px 0 rgba(255, 255, 255, 0.06);
}

/* Edge fades */
.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(4, 6, 4, 0.98), transparent);
}

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

/* Fixed selection window — green tinted lens (clear, like colored glasses) */
.reel-highlight {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100px;
  height: 100px;
  border-radius: var(--radius-sm);
  z-index: 4;
  pointer-events: none;
  border: 1px solid rgba(0, 255, 65, 0.3);
  background: rgba(0, 255, 65, 0.045);
  backdrop-filter: saturate(1.4) brightness(1.02);
  -webkit-backdrop-filter: saturate(1.4) brightness(1.02);
  box-shadow:
    inset 0 1px 0 rgba(77, 255, 136, 0.14),
    inset 0 -1px 0 rgba(0, 179, 45, 0.06),
    0 0 0 1px rgba(0, 0, 0, 0.8);
}

/* Lens glare — barely there */
.reel-highlight::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    120deg,
    rgba(77, 255, 136, 0.09) 0%,
    transparent 32%
  );
  pointer-events: none;
}

/* Frame catch-light */
.reel-highlight::after {
  content: '';
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 4px;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 255, 65, 0.18) 50%,
    transparent
  );
  pointer-events: none;
}

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

.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-sm);
  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 var(--line-soft);
  position: relative;
  overflow: hidden;
  color: var(--text-primary);
  background: #0b100c;
}

.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 — unchanged hues */
.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-settle 0.45s var(--ease-spring);
}

@keyframes winner-settle {
  0% { transform: scale(0.98); }
  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: var(--text-primary);
  position: relative;
  z-index: 2;
  letter-spacing: 0.4px;
  margin-bottom: 14px;
  padding: 0;
  border: 0;
  background: transparent;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
}

/* Win is the one earned glow in the app */
.result-display.won {
  color: var(--accent);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6), 0 0 22px rgba(0, 255, 65, 0.45);
  animation: result-pop 0.4s var(--ease-spring);
}

.result-display.lost {
  color: var(--red);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
}

.result-multiplier-tag {
  color: #ffd54a;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.55), 0 0 14px rgba(255, 196, 60, 0.55);
}

.result-free-spin-tag {
  font-size: 0.92em;
  opacity: 0.92;
}

.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: 5px;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 12px;
  position: relative;
  z-index: 2;
  letter-spacing: 0.4px;
}

.spin-cost .key-icon {
  height: 16px;
  transform: translateY(-1px);
}

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

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

.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: 5px;
  border: 0;
  border-radius: var(--radius-xs);
  padding: 5px 8px;
  background: rgba(255, 255, 255, 0.045);
  font-family: var(--font-data);
  font-size: 0.52rem;
  font-weight: 800;
  letter-spacing: 0.9px;
  line-height: 1;
  text-transform: uppercase;
}

.rarity-chip::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: 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-dim);
  font-family: var(--font-data);
  font-size: 0.58rem;
  letter-spacing: 1.3px;
}

.prize-sort-btn {
  min-width: 48px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-xs);
  padding: 7px 10px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  font-family: var(--font-data);
  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: var(--hairline-strong);
  color: var(--text-primary);
}

.prize-sort-btn.active {
  border-color: var(--line-green);
  color: var(--accent);
  background: rgba(0, 255, 65, 0.08);
}

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

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

.prize-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 10px 13px;
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  background: #0b100c;
  text-align: center;
  transition: transform 0.2s var(--ease), border-color 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}

.prize-card::before {
  content: none;
}

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

.prize-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.5);
}

.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;
  transition: transform 0.25s var(--ease);
}

.prize-card:hover .prize-icon-img {
  transform: scale(1.04);
}

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

.prize-card .prize-chance {
  font-size: 0.64rem;
  font-family: var(--font-data);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  padding: 2px 8px;
  border: 0;
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.05);
}

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

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

.faq-item {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.22);
}

.faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  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 var(--hairline);
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.03);
  color: var(--accent);
  font-size: 0.58rem;
  flex-shrink: 0;
}

.faq-question:hover {
  background: rgba(255, 255, 255, 0.03);
}

.faq-question[aria-expanded="true"] {
  color: var(--accent);
  background: rgba(0, 255, 65, 0.05);
  border-bottom: 1px solid var(--line-soft);
}

.faq-arrow {
  flex-shrink: 0;
  font-size: 0.65em;
  transition: var(--transition);
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
}

.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.3);
  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-data);
  font-size: 0.9em;
}

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

.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: 18px;
}

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

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

.leaderboard-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.22);
  transition: var(--transition);
}

.leaderboard-row:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--hairline);
}

.leaderboard-rank {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  font-family: var(--font-data);
  font-size: 0.72rem;
  font-weight: 800;
}

/* Podium accents */
.leaderboard-row:nth-child(1) .leaderboard-rank {
  color: #100b00;
  background: var(--amber);
}

.leaderboard-row:nth-child(2) .leaderboard-rank {
  color: #0c0c0c;
  background: #cfd8d1;
}

.leaderboard-row:nth-child(3) .leaderboard-rank {
  color: #04130a;
  background: var(--accent);
}

.leaderboard-name {
  min-width: 0;
  color: var(--text-primary);
  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-data);
  font-size: 0.84rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.6px;
  text-align: right;
}

.leaderboard-points::after {
  content: ' HP';
  color: var(--text-dim);
  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: 18px;
}

@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.62rem;
  font-weight: 600;
  font-family: var(--font-data);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

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

.fair-value {
  background: #060906;
  border: 1px solid var(--line-soft);
  border-left: 2px solid rgba(0, 255, 65, 0.4);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
  font-family: var(--font-data);
  font-size: 0.72rem;
  color: var(--text-secondary);
  word-break: break-all;
  line-height: 1.4;
}

.fair-input {
  background: #060906;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
  font-family: var(--font-data);
  font-size: 0.72rem;
  color: var(--text-primary);
  width: 100%;
  outline: none;
  transition: var(--transition);
  caret-color: var(--accent);
}

.fair-input::placeholder {
  color: var(--text-dim);
}

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

.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: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line-soft);
  border-left: 2px solid rgba(0, 243, 255, 0.4);
  border-radius: var(--radius-xs);
}

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

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

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

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

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

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

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

.history-list {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 300px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

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

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

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

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--line-soft);
  font-size: 0.75rem;
  transition: var(--transition);
  cursor: pointer;
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--hairline);
  box-shadow: inset 2px 0 0 var(--accent);
}

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

.history-num {
  font-family: var(--font-data);
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  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-family: var(--font-data);
  font-size: 0.6rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

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

.history-badge.common {
  background: rgba(169, 169, 169, 0.1);
  color: #a9a9a9;
}

.history-badge.uncommon {
  background: rgba(181, 138, 255, 0.12);
  color: #b58aff;
}

.history-badge.rare {
  background: rgba(134, 18, 255, 0.16);
  color: #b06aff;
}

.history-badge.epic {
  background: rgba(255, 51, 51, 0.12);
  color: #ff6666;
}

.history-badge.legendary {
  background: rgba(255, 176, 0, 0.12);
  color: var(--amber);
}

.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 var(--hairline);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.18);
}

.history-empty::before {
  content: '> ';
  color: var(--accent);
}

.history-empty::after {
  content: '_';
  color: var(--accent);
  animation: caretBlink 1.1s steps(1) infinite;
}

@keyframes caretBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ---------- Modals ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 3, 2, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-lg);
  background: #0b100c;
  padding: 28px;
  max-width: 480px;
  width: 100%;
  animation: modalSlide 0.24s var(--ease);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 30px 70px rgba(0, 0, 0, 0.65);
}

/* Green index line, same mark as cards */
.modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 26px;
  width: 26px;
  height: 2px;
  background: var(--accent);
  pointer-events: none;
}

@keyframes modalSlide {
  from {
    transform: translateY(12px) scale(0.99);
    opacity: 0;
  }

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

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

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

  .header-right {
    flex: 1 1 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
  }

  .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(--text-primary);
  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-image:
    linear-gradient(180deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.72)),
    url('img/fons3.png');
  background-position: center center;
  background-size: cover;
  opacity: 0.55;
  pointer-events: none;
}

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

.welcome-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: clamp(1.55rem, 5.8vw, 2.45rem);
  font-weight: 900;
  letter-spacing: clamp(2px, 0.72vw, 4px);
  line-height: 1.12;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6), 0 0 26px rgba(255, 255, 255, 0.22);
}

.welcome-title-line {
  display: block;
  max-width: 100%;
}

.welcome-copy {
  max-width: 430px;
  margin: 0 auto 14px;
  color: var(--text-primary);
  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 {
  color: inherit;
  font-weight: inherit;
  text-decoration: none;
}

.welcome-watch {
  display: block;
  margin-top: 14px;
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: clamp(1.28rem, 5vw, 1.82rem);
  font-weight: 900;
  letter-spacing: 2px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6), 0 0 26px rgba(255, 255, 255, 0.22);
}

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

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

/* Solid CTA */
.welcome-action {
  width: 100%;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  color: #04130a;
  background: var(--accent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -2px 0 rgba(0, 0, 0, 0.22),
    0 4px 14px rgba(0, 0, 0, 0.5);
  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);
  background: #3dff6e;
  border-color: #3dff6e;
}

.welcome-action:active {
  transform: translateY(1px);
}

@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;
}

#modal-buy.open:not(.buy-modal-open) .hashkey-amounts {
  visibility: hidden;
}

.hashkey-amount-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  background: #0d130e;
  cursor: pointer;
  transition: transform 0.18s var(--ease), border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  min-width: 120px;
  overflow: visible;
}

.hashkey-amount-btn img {
  width: 140px;
  height: auto;
  display: block;
  object-fit: contain;
  margin-bottom: 6px;
  transition: transform 0.22s var(--ease);
}

.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: var(--hairline-strong);
  background: #111812;
  transform: translateY(-2px);
}

.hashkey-amount-btn:hover img {
  transform: scale(1.04);
}

.hashkey-amount-btn.selected {
  border-color: var(--accent);
  background: #0e1810;
  box-shadow: 0 0 0 1px var(--accent), 0 8px 20px rgba(0, 0, 0, 0.45);
  color: var(--accent);
}

/* Recommended pack — terminal highlight */
.hashkey-amount-btn.is-recommended {
  padding-top: 14px;
}

.hashkey-amount-btn.is-recommended::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  border: 1px solid transparent;
  pointer-events: none;
  opacity: 0;
}

.hashkey-amount-btn.is-recommended.selected::after {
  opacity: 1;
  animation: recommendedRing 2.4s ease-in-out 0.75s infinite;
}

.recommended-tag {
  position: absolute;
  top: 0;
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transform: translate(-50%, -50%);
  padding: 5px 11px;
  font-family: var(--font-data);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  line-height: 1;
  color: var(--accent);
  background: #0b100c;
  border: 1px solid var(--line-green);
  border-radius: var(--radius-xs);
  white-space: nowrap;
  opacity: 0;
  z-index: 3;
  box-shadow: 0 0 0 3px #0b100c;
}

.recommended-tag::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* Buy modal open — staggered reveal, recommended lands last with emphasis */
#modal-buy.buy-modal-open .hashkey-amount-btn:not(.is-recommended) {
  animation: buyOptionIn 0.42s var(--ease) both;
}

#modal-buy.buy-modal-open .hashkey-amount-btn[data-amount="1"] {
  animation-delay: 0.06s;
}

#modal-buy.buy-modal-open .hashkey-amount-btn[data-amount="10"] {
  animation-delay: 0.12s;
}

#modal-buy.buy-modal-open .hashkey-amount-btn.is-recommended {
  animation: recommendedReveal 0.72s var(--ease-spring) 0.18s both;
}

#modal-buy.buy-modal-open .is-recommended .recommended-tag {
  animation: recommendedTagIn 0.55s var(--ease-spring) 0.44s both;
}

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

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

@keyframes recommendedReveal {
  0% {
    opacity: 0;
    transform: scale(0.9) translateY(14px);
    box-shadow: 0 0 0 0 rgba(0, 255, 65, 0);
  }

  55% {
    opacity: 1;
    transform: scale(1.05) translateY(-3px);
    box-shadow:
      0 0 0 2px var(--accent),
      0 0 28px rgba(0, 255, 65, 0.22),
      0 12px 28px rgba(0, 0, 0, 0.5);
  }

  100% {
    transform: scale(1) translateY(0);
    box-shadow: 0 0 0 1px var(--accent), 0 8px 20px rgba(0, 0, 0, 0.45);
  }
}

@keyframes recommendedTagIn {
  0% {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 8px)) scale(0.85);
  }

  70% {
    opacity: 1;
    transform: translate(-50%, calc(-50% - 2px)) scale(1.04);
  }

  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes recommendedRing {
  0%,
  100% {
    border-color: rgba(0, 255, 65, 0.2);
    box-shadow: inset 0 0 0 0 rgba(0, 255, 65, 0);
  }

  50% {
    border-color: rgba(0, 255, 65, 0.55);
    box-shadow: inset 0 0 12px rgba(0, 255, 65, 0.06);
  }
}

@media (prefers-reduced-motion: reduce) {
  #modal-buy.buy-modal-open .hashkey-amount-btn {
    animation: none !important;
    opacity: 1;
    transform: none;
  }

  #modal-buy.buy-modal-open .is-recommended .recommended-tag {
    animation: none !important;
    opacity: 1;
    transform: translate(-50%, -50%);
  }

  .hashkey-amount-btn.is-recommended.selected::after {
    animation: none;
    opacity: 1;
    border-color: var(--line-green);
  }
}

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

.modal-total strong {
  color: var(--accent);
  font-family: var(--font-data);
  font-variant-numeric: tabular-nums;
}

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

/* Solid CTA */
.btn-pay {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 16px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #04130a;
  cursor: pointer;
  transition: var(--transition);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -2px 0 rgba(0, 0, 0, 0.22),
    0 4px 14px rgba(0, 0, 0, 0.5);
}

.btn-pay:hover {
  background: #3dff6e;
  border-color: #3dff6e;
  transform: translateY(-1px);
}

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

.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: center;
    padding: 12px 14px;
    top: 10px;
  }

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

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

  .header-right {
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    gap: 8px;
  }

  .header-economy { flex: 0 0 auto; }

  .header-nav { flex: 1 1 auto; justify-content: center; }
  .hnav-btn { flex: 1 1 auto; justify-content: center; padding: 0 10px; }

  .account-cluster {
    flex: 1 1 100%;
    justify-content: center;
  }

  .user-pill { flex: 1 1 auto; max-width: none; }

  .admin-link,
  .btn-logout {
    font-size: 0.64rem;
    padding: 0 12px;
  }

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

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

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

  .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(255, 255, 255, 0.04);
  border: 1px solid var(--hairline);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 5px 14px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 1px;
}

.ach-filter-btn:hover {
  border-color: var(--hairline-strong);
  color: var(--text-primary);
}

.ach-filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #04130a;
  font-weight: 700;
}

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

.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 var(--line-soft);
  background: rgba(0, 0, 0, 0.28);
  transition: var(--transition);
  overflow: visible;
}

.ach-card::before {
  content: none;
}

.ach-card.ach-unlocked {
  border-color: var(--line-green);
  background: rgba(0, 255, 65, 0.05);
}

.ach-card.ach-locked {
  opacity: 0.62;
  filter: grayscale(0.5);
}

.ach-card.ach-unlocked:hover,
.ach-card:hover {
  border-color: var(--hairline-strong);
  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 var(--hairline);
  display: block;
  padding: 3px;
}

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

.ach-check {
  color: var(--accent);
  border-color: var(--accent);
}

.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: var(--radius-xs);
  white-space: nowrap;
  font-family: var(--font-data);
}

.ach-status-done {
  color: #04130a;
  border: 0;
  background: var(--accent);
  font-weight: 700;
}

.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.72);
  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(255, 255, 255, 0.07);
  border-radius: 999px;
  overflow: hidden;
  border: 0;
}

.ach-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.6s var(--ease);
}

.ach-progress-label {
  font-family: var(--font-data);
  font-size: 0.58rem;
  color: rgba(255, 255, 255, 0.66);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ---------- 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;
  border: 1px solid var(--hairline-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: #0c110d;
  min-width: 240px;
  max-width: 320px;
  transform: translateX(-120%);
  opacity: 0;
  transition: transform 0.45s var(--ease-spring), opacity 0.3s ease;
  pointer-events: auto;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
}

.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, 0, 0, 0.4);
  border: 1px solid var(--hairline);
  flex-shrink: 0;
}

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

.ach-toast-title {
  font-size: 0.62rem;
  color: var(--accent);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 2px;
  font-family: var(--font-data);
}

.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 var(--ease), opacity 0.3s ease;
}

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

/* ---------- Floating Action Buttons — physical discs ---------- */
.achievements-toggle-btn,
.chat-toggle-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--hairline-strong);
  background: linear-gradient(180deg, #141a15, #0a0e0b);
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: var(--transition);
  font-family: var(--font-mono);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    0 4px 0 rgba(0, 0, 0, 0.45),
    0 14px 28px rgba(0, 0, 0, 0.5);
}

.achievements-toggle-btn:hover,
.chat-toggle-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 6px 0 rgba(0, 0, 0, 0.45),
    0 18px 34px rgba(0, 0, 0, 0.55);
}

.achievements-toggle-btn:active,
.chat-toggle-btn:active {
  transform: translateY(2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 1px 0 rgba(0, 0, 0, 0.45),
    0 8px 18px rgba(0, 0, 0, 0.5);
}

.achievements-toggle-btn[aria-expanded="true"],
.chat-toggle-btn[aria-expanded="true"] {
  border-color: var(--accent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    0 0 0 1px var(--accent),
    0 14px 28px rgba(0, 0, 0, 0.5);
}

.achievements-panel {
  display: none;
  flex-direction: column;
  width: min(380px, calc(100vw - 44px));
  max-height: min(640px, calc(100vh - 130px));
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-lg);
  background: #0b100c;
  overflow: hidden;
  animation: panelIn 0.2s var(--ease);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
}

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

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }

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

.achievements-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px;
  border-bottom: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.025);
}

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

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

.achievements-close-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--hairline);
  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: var(--radius-xs);
  transition: var(--transition);
}

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

.achievements-filters {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
  background: rgba(0, 0, 0, 0.2);
}

.achievements-filters .ach-filter-btn {
  flex: 1;
  padding: 7px 8px;
  border-radius: var(--radius-xs);
  font-size: 0.6rem;
}

.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 var(--ease), opacity 0.3s ease;
}

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

.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-data);
  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));
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-lg);
  background: #0b100c;
  overflow: hidden;
  animation: panelIn 0.2s var(--ease);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
}

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

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px;
  border-bottom: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.025);
  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(--text-primary);
  letter-spacing: 1.6px;
  text-transform: uppercase;
}

/* Live dot */
.chat-title::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: statusPulse 3s ease-in-out infinite;
}

.chat-close-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--hairline);
  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;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.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-data);
  letter-spacing: 0.8px;
  padding: 28px;
  text-align: center;
  border: 1px dashed var(--hairline);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.16);
}

.chat-empty span {
  color: var(--text-secondary);
  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: row;
  align-items: flex-start;
  gap: 8px;
  max-width: 88%;
  padding: 9px 11px;
  border: 1px solid var(--line-soft);
  border-radius: 10px 10px 10px 3px;
  background: rgba(255, 255, 255, 0.035);
  animation: fadeSlideIn 0.16s var(--ease);
}

.chat-msg.mine {
  align-self: flex-end;
  flex-direction: row-reverse;
  border-color: rgba(0, 255, 65, 0.28);
  border-radius: 10px 10px 3px 10px;
  background: rgba(0, 255, 65, 0.07);
}

.chat-msg-avatar {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid var(--hairline-strong);
  background: rgba(0, 0, 0, 0.36);
  object-fit: cover;
  margin-top: 1px;
}

.chat-msg-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

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

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

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

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

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

.chat-msg.mine .chat-msg-text {
  color: #d8ffe2;
}

.chat-input-row {
  display: flex;
  gap: 0;
  border-top: 1px solid var(--hairline);
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.3);
}

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

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

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

.chat-send-btn:hover {
  background: var(--accent);
  color: #04130a;
}

@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: var(--accent);
  color: #04130a;
}

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

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

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .logo::before,
  .chat-title::before,
  .history-empty::after {
    animation: none;
  }
}

/* ─── Profile / Personalization Modal ─────── */
.profile-modal {
  max-width: 460px;
  text-align: left;
}

.profile-identity {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  margin-bottom: 18px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.profile-avatar-preview {
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: rgba(0, 0, 0, 0.4);
  object-fit: cover;
  box-shadow: 0 0 16px var(--accent-glow);
}

.profile-identity-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.profile-identity-name {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-primary);
  word-break: break-word;
}

.profile-identity-email {
  font-family: var(--font-data);
  font-size: 0.72rem;
  color: var(--text-muted);
  word-break: break-all;
}

.profile-label {
  display: block;
  font-family: var(--font-data);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 16px 0 7px;
}

.profile-hint {
  font-family: var(--font-data);
  font-size: 0.68rem;
  color: var(--text-muted);
  margin: 6px 0 0;
  line-height: 1.4;
}

.profile-avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 8px;
}

.profile-avatar-option.default-avatar {
  border-color: var(--line-soft);
  background: rgba(0, 255, 65, 0.05);
}

.profile-avatar-option {
  aspect-ratio: 1;
  padding: 2px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.profile-avatar-option img {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  object-fit: cover;
  display: block;
}

.profile-avatar-option:hover {
  transform: translateY(-2px);
  border-color: var(--hairline-strong);
}

.profile-avatar-option.selected {
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

.profile-upload-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.profile-upload-hint {
  font-family: var(--font-data);
  font-size: 0.64rem;
  color: var(--text-muted);
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
  gap: 8px;
}

.profile-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.025);
}

.profile-stat-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent);
}

.profile-stat-label {
  font-family: var(--font-data);
  font-size: 0.6rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.profile-rarity-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.profile-rarity-chip {
  font-family: var(--font-data);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: capitalize;
  padding: 3px 8px;
  border-radius: 20px;
  border: 1px solid var(--line-soft);
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
}
.profile-rarity-chip.common    { color: #a9a9a9; border-color: #a9a9a9; background: rgba(169, 169, 169, 0.1); }
.profile-rarity-chip.uncommon  { color: #b58aff; border-color: #b58aff; background: rgba(181, 138, 255, 0.1); }
.profile-rarity-chip.rare      { color: #8612ff; border-color: #8612ff; background: rgba(134, 18, 255, 0.2); }
.profile-rarity-chip.epic      { color: #ff2c2c; border-color: #ff2c2c; background: rgba(255, 44, 44, 0.15); }
.profile-rarity-chip.legendary { color: #e6a410; border-color: #e6a410; background: rgba(230, 164, 16, 0.15); }

.profile-message {
  min-height: 18px;
  margin-top: 14px;
  font-family: var(--font-data);
  font-size: 0.72rem;
  text-align: center;
}
.profile-message.error   { color: #ff6b6b; }
.profile-message.success { color: var(--accent); }

.profile-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.profile-actions .btn {
  flex: 1;
}

/* ─── Missions ──────────────────────────────── */
.btn-missions {
  position: relative;
}

.missions-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  margin-left: 2px;
  border-radius: 9px;
  background: var(--accent);
  color: #04120a;
  font-family: var(--font-data);
  font-size: 0.6rem;
  font-weight: 800;
  line-height: 1;
  vertical-align: middle;
}

.missions-modal {
  max-width: 480px;
  text-align: left;
}

.missions-section {
  margin-top: 14px;
}

.missions-heading {
  font-family: var(--font-data);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0 0 8px;
}

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

.mission-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.025);
}

.mission-item.complete {
  border-color: var(--line-green);
  background: rgba(0, 255, 65, 0.05);
}

.mission-item.claimed {
  opacity: 0.55;
}

.mission-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mission-title {
  font-family: var(--font-data);
  font-size: 0.82rem;
  color: var(--text-primary);
}

.mission-bar {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.mission-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.4s var(--ease);
}

.mission-progress {
  font-family: var(--font-data);
  font-size: 0.66rem;
  color: var(--text-muted);
}

.mission-reward {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  text-align: right;
}

.mission-reward-amount {
  font-family: var(--font-data);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.mission-claim {
  padding: 4px 14px;
}

.mission-claim:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.missions-message {
  min-height: 18px;
  margin-top: 12px;
  font-family: var(--font-data);
  font-size: 0.72rem;
  text-align: center;
}
.missions-message.success { color: var(--accent); }
.missions-message.error { color: #ff6b6b; }

/* ─── Live win feed (lateral rail) ──────────── */
.winfeed-live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow-strong);
  animation: winfeed-pulse 1.4s ease-in-out infinite;
  vertical-align: middle;
}

@keyframes winfeed-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Fixed side rail — sits in the left margin on wide screens. */
.winfeed-rail {
  position: fixed;
  top: 84px;
  left: max(14px, calc(50vw - 430px - 252px));
  width: 232px;
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-card-solid);
  box-shadow: var(--module-shadow);
  z-index: 90;
}

.winfeed-rail-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line-soft);
}

.winfeed-rail-title {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-primary);
}

/* Hide the rail when there isn't room beside the 860px content column. */
@media (max-width: 1240px) {
  .winfeed-rail { display: none; }
}

.winfeed-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.winfeed-rail .winfeed-list {
  flex: 1 1 auto;
  min-height: 0;
}

.winfeed-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
}

.winfeed-row.winfeed-new {
  animation: winfeed-flash 1.2s var(--ease);
}

@keyframes winfeed-flash {
  0% { background: rgba(0, 255, 65, 0.18); border-color: var(--line-green); }
  100% { background: rgba(255, 255, 255, 0.02); border-color: var(--line-soft); }
}

.winfeed-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  object-fit: contain;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.3);
}

.winfeed-text {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-data);
  font-size: 0.74rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.winfeed-text strong { color: var(--text-primary); font-weight: 700; }

.winfeed-prize { font-weight: 700; color: var(--text-secondary); }
.winfeed-prize.common { color: #a9a9a9; }
.winfeed-prize.uncommon { color: #b58aff; }
.winfeed-prize.rare { color: #b06aff; }
.winfeed-prize.epic { color: #ff6666; }
.winfeed-prize.legendary { color: var(--amber); }

.winfeed-time {
  flex: 0 0 auto;
  font-family: var(--font-data);
  font-size: 0.62rem;
  color: var(--text-muted);
}

/* ─── Referral / invite ─────────────────────── */
.referral-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.referral-row .form-input {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.74rem;
}

#btn-copy-referral {
  flex: 0 0 auto;
  padding: 0 16px;
}

.referral-stats {
  margin-top: 8px;
  font-family: var(--font-data);
  font-size: 0.7rem;
  color: var(--accent);
}

/* ─── Avatar frames (cosmetics) ─────────────── */
.frame-green  { border: 2px solid #00ff41 !important; box-shadow: 0 0 7px rgba(0, 255, 65, 0.75); }
.frame-gold   { border: 2px solid #ffd24d !important; box-shadow: 0 0 7px rgba(255, 210, 77, 0.75); }
.frame-cyber  { border: 2px solid #00e5ff !important; box-shadow: 0 0 7px rgba(0, 229, 255, 0.75); }
.frame-pink   { border: 2px solid #ff4dd2 !important; box-shadow: 0 0 7px rgba(255, 77, 210, 0.75); }

/* ─── Hashpoints shop ───────────────────────── */
.shop-modal {
  max-width: 500px;
  text-align: left;
}

.shop-section { margin-top: 16px; }

.shop-heading {
  font-family: var(--font-data);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0 0 8px;
}

.shop-grid {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.shop-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.025);
}

.shop-item.equipped {
  border-color: var(--line-green);
  background: rgba(0, 255, 65, 0.05);
}

.shop-swatch {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid var(--hairline-strong);
}

.shop-frame-swatch { background: rgba(0, 0, 0, 0.4); }

.shop-key-swatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
}
.shop-key-swatch img { width: 20px; height: 20px; object-fit: contain; }

.shop-item-label {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-data);
  font-size: 0.8rem;
  color: var(--text-primary);
}

.shop-item-price {
  flex: 0 0 auto;
  font-family: var(--font-data);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.shop-buy, .shop-equip, .shop-unequip {
  flex: 0 0 auto;
  padding: 4px 14px;
  min-width: 72px;
}

.shop-buy:disabled { opacity: 0.45; cursor: not-allowed; }

.shop-message {
  min-height: 18px;
  margin-top: 12px;
  font-family: var(--font-data);
  font-size: 0.72rem;
  text-align: center;
}
.shop-message.success { color: var(--accent); }
.shop-message.error { color: #ff6b6b; }

/* ─── Rainbow frame (box-exclusive cosmetic) ── */
.frame-rainbow {
  border: 2px solid #ff4dd2 !important;
  box-shadow: 0 0 9px rgba(255, 77, 210, 0.8);
  animation: frame-rainbow-cycle 3s linear infinite;
}
@keyframes frame-rainbow-cycle {
  0%   { border-color: #ff4dd2; box-shadow: 0 0 9px rgba(255, 77, 210, 0.8); }
  25%  { border-color: #ffd24d; box-shadow: 0 0 9px rgba(255, 210, 77, 0.8); }
  50%  { border-color: #7bff8a; box-shadow: 0 0 9px rgba(123, 255, 138, 0.8); }
  75%  { border-color: #00e5ff; box-shadow: 0 0 9px rgba(0, 229, 255, 0.8); }
  100% { border-color: #ff4dd2; box-shadow: 0 0 9px rgba(255, 77, 210, 0.8); }
}

/* ─── Shop modal ────────────────────────────── */
.shop-modal { position: relative; }
