/* RobloxStats — Codédex pixel RPG login with image assets */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy: #0f1729;
  --yellow: #ffcd29;
  --yellow-dark: #c9880f;
  --yellow-shadow: #a86f00;
  --discord: #5865f2;
  --discord-dark: #3c45a5;
  --roblox: #e03c28;
  --roblox-dark: #9e2418;
  --text-white: #ffffff;
  --text-shadow: #2d1b4e;
  --font-pixel: 'Press Start 2P', monospace;
  --font-body: 'VT323', monospace;
  --safe-inset: max(5%, 20px);
  --para-x: 0px;
  --para-y: 0px;
  --idle-x: 0px;
  --idle-y: 0px;
}

html {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

html, body {
  min-height: 100%;
  overflow-x: hidden;
  font-family: var(--font-body);
  font-size: 20px;
  color: var(--text-white);
  background: var(--navy);
}

/* ── Header ── */
.pixel-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: 56px;
  background: var(--navy);
  border-bottom: 4px solid #000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.pixel-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-white);
}

.pixel-logo-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  filter: drop-shadow(2px 2px 0 #000);
  animation: coin-spin 4s ease-in-out infinite;
}

.pixel-logo-text {
  font-family: var(--font-pixel);
  font-size: 11px;
  text-shadow: 2px 2px 0 #000;
}

.header-xp {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-xp-label {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--yellow);
  text-shadow: 1px 1px 0 #000;
}

.header-xp-bar {
  width: 80px;
  height: 10px;
  background: #1a2744;
  border: 2px solid #000;
  overflow: hidden;
}

.header-xp-fill {
  display: block;
  height: 100%;
  width: 35%;
  background: linear-gradient(90deg, #5cb838, #7ed957);
  animation: xp-fill 3s ease-in-out infinite alternate;
}

/* ── World (image assets) ── */
.pixel-world {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.world-bg-wrap {
  position: absolute;
  inset: -8%;
  transform: translate(
    calc(var(--para-x) + var(--idle-x)),
    calc(var(--para-y) + var(--idle-y))
  );
  will-change: transform;
}

.world-bg-img {
  width: 120%;
  height: 120%;
  margin: -10% 0 0 -10%;
  object-fit: cover;
  object-position: center center;
  animation: bg-alive 48s ease-in-out infinite;
  will-change: transform;
}

.world-fog {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(ellipse 80% 50% at 50% 80%, rgba(120, 60, 180, 0.25) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 30% 60%, rgba(80, 40, 120, 0.15) 0%, transparent 60%);
  animation: fog-drift 20s ease-in-out infinite;
  pointer-events: none;
}

.world-torch-glow {
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(circle, rgba(255, 140, 40, 0.35) 0%, transparent 70%);
  animation: torch-flicker 3s ease-in-out infinite;
}

.world-torch-glow--left {
  top: 25%;
  left: 5%;
  animation-delay: 0s;
}

.world-torch-glow--right {
  top: 30%;
  right: 5%;
  animation-delay: 1.5s;
}

.world-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    radial-gradient(ellipse 70% 60% at 50% 45%, rgba(8, 6, 18, 0.55) 0%, transparent 70%),
    radial-gradient(ellipse at center, transparent 20%, rgba(10, 8, 20, 0.65) 100%),
    linear-gradient(180deg, rgba(15, 10, 30, 0.4) 0%, transparent 50%, rgba(10, 8, 20, 0.55) 100%);
  animation: overlay-breathe 12s ease-in-out infinite;
  pointer-events: none;
}

.world-embers {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.ember {
  position: absolute;
  width: 4px;
  height: 4px;
  background: #ff8c00;
  border-radius: 50%;
  box-shadow: 0 0 6px #ff6600, 0 0 12px #ff4400;
  animation: ember-rise var(--dur, 4s) ease-out infinite;
  animation-delay: var(--delay, 0s);
}

/* ── Readability helpers ── */
.text-readable {
  text-shadow:
    0 0 12px rgba(0, 0, 0, 0.95),
    0 2px 6px rgba(0, 0, 0, 1),
    2px 2px 0 #000;
}

/* ── Hero content ── */
.hero {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px var(--safe-inset) 40px;
}

.hero-panel {
  position: relative;
  width: min(600px, calc(100vw - 32px));
  padding: 36px 36px 28px;
  color: rgba(255, 255, 255, 1);
  background-color: rgba(26, 26, 46, 1);
  border: 4px solid #000;
  border-bottom: 7px solid #0a0a12;
  border-right: 6px solid #111118;
  border-radius: 0;
  box-shadow: 6px 6px 0 #000;
  animation: panel-enter 0.35s ease-out both;
}

.hero-panel::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 2px solid var(--yellow);
  pointer-events: none;
}

.hero-sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.sparkle {
  position: absolute;
  font-size: 12px;
  color: var(--yellow);
  text-shadow: 0 0 6px #ffcd29;
  animation: sparkle-pop var(--dur, 2s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}

.hero-eyebrow {
  font-family: var(--font-pixel);
  font-size: clamp(9px, 2.2vw, 11px);
  color: var(--yellow);
  text-shadow: 2px 2px 0 #000;
  letter-spacing: 0.18em;
  margin-bottom: 14px;
}

.hero-title,
#hero-title {
  font-family: var(--font-pixel);
  font-size: clamp(1.4rem, 6vw, 3.2rem);
  font-weight: 400;
  line-height: 1.5;
  color: #ffcd29;
  background: unset;
  background-color: unset;
  background-clip: unset;
  -webkit-background-clip: unset;
  border: none;
  border-width: 0;
  border-color: transparent;
  border-image: none;
  text-transform: uppercase;
  text-shadow:
    2px 2px 0 #c9880f,
    4px 4px 0 #5c3d8a,
    6px 6px 0 #000,
    0 0 20px rgba(255, 205, 41, 0.35);
  margin-bottom: 16px;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.hero-sub {
  font-family: var(--font-body);
  font-size: clamp(1.35rem, 3vw, 1.65rem);
  color: #ddd;
  text-shadow: 2px 2px 0 #000;
  line-height: 1.5;
  max-width: 100%;
  text-wrap: balance;
  margin-bottom: 28px;
}

.hero-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 3px solid #000;
  box-shadow: inset 0 2px 0 rgba(255, 205, 41, 0.35);
  font-family: var(--font-body);
  font-size: 1.15rem;
  color: #aaa;
  text-shadow: 1px 1px 0 #000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  text-align: center;
}

/* ── Status Banner ── */
.status-banner {
  font-family: var(--font-body);
  font-size: 1.15rem;
  padding: 10px 16px;
  margin-bottom: 16px;
  width: 100%;
  border: 3px solid #000;
  animation: banner-pop 0.35s ease-out;
}

.status-banner--success { background: #5cb838; color: #fff; box-shadow: 4px 4px 0 #2d6b28; }
.status-banner--error   { background: #e03c28; color: #fff; box-shadow: 4px 4px 0 #9e2418; }
.status-banner--info    { background: #ffcd29; color: #1a1a2e; box-shadow: 4px 4px 0 var(--yellow-dark); }

/* ── Login actions (inside hero-panel) ── */
.login-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  width: 100%;
  padding-top: 22px;
  margin-top: 4px;
  border-top: 3px solid #000;
  box-shadow: inset 0 2px 0 rgba(255, 205, 41, 0.35);
}

.login-quest {
  font-family: var(--font-body);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--yellow);
  text-shadow: 2px 2px 0 #000;
  margin-bottom: 4px;
  letter-spacing: 0.04em;
  text-align: center;
  width: 100%;
}

.login-or {
  font-family: var(--font-body);
  font-size: 1.15rem;
  color: #ccc;
  text-shadow: 1px 1px 0 #000;
  text-align: center;
  margin: 2px 0;
}

.login-or-gem {
  color: var(--yellow);
  animation: spin-slow 3s linear infinite;
  display: inline-block;
}

.btn-hint {
  font-family: var(--font-body);
  font-size: 1.15rem;
  color: #e87060;
  text-shadow: 1px 1px 0 #000;
  margin-top: -4px;
}


/* ── Pixel Buttons ── */
.btn-pixel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 14px 20px;
  font-family: var(--font-pixel);
  font-size: 12px;
  line-height: 1.6;
  color: #1a1a2e;
  background: var(--yellow);
  border: 3px solid #1a1a2e;
  border-bottom: 6px solid var(--yellow-dark);
  border-right: 5px solid var(--yellow-shadow);
  box-shadow: 4px 4px 0 #1a1a2e;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease, border-width 0.08s ease;
}

.btn-pixel:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.btn-pixel:not(:disabled):hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #1a1a2e;
  border-bottom-width: 4px;
}

.btn-pixel:not(:disabled):active {
  transform: translate(4px, 4px);
  box-shadow: none;
  border-bottom-width: 3px;
}

.btn-pixel:disabled {
  opacity: 1;
  cursor: not-allowed;
  filter: none;
  background: #3a3a4a;
  color: #f0f0f8;
  border-bottom-color: #222230;
  border-right-color: #2a2a38;
  box-shadow: 4px 4px 0 #111118;
}

.btn-pixel--roblox:disabled {
  background: #6b3030;
  color: #fff;
  border-bottom-color: #3d1818;
  border-right-color: #4a2020;
}

.btn-pixel--pulse:not(:disabled) {
  animation: btn-glow 2s ease-in-out infinite;
}

.btn-pixel--discord {
  background: var(--discord);
  color: #fff;
  border-bottom-color: var(--discord-dark);
  border-right-color: #4a55c8;
}

.btn-pixel--roblox {
  background: var(--roblox);
  color: #fff;
  border-bottom-color: var(--roblox-dark);
  border-right-color: #b83020;
}

.btn-pixel--ghost {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-color: #fff;
  border-bottom-color: #aaa;
  border-right-color: #ccc;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.5);
  font-size: 9px;
  min-height: 44px;
}

.btn-pixel-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  font-size: 16px;
}

/* ── Adventurer Card ── */
.adventurer-card {
  width: min(540px, calc(100vw - 40px));
  background: rgba(12, 10, 28, 0.22);
  border: 1px solid rgba(255, 220, 100, 0.28);
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  padding: 20px;
  overflow: hidden;
}

.adventurer-frame {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 3px dashed rgba(255,255,255,0.2);
}

.avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.adventurer-avatar {
  width: 64px;
  height: 64px;
  border: 3px solid #000;
  box-shadow: 3px 3px 0 var(--yellow-dark);
  image-rendering: auto;
}

.avatar-sparkle {
  position: absolute;
  top: -6px;
  right: -6px;
  font-size: 14px;
  color: var(--yellow);
  animation: spin-slow 2s linear infinite;
}

.adventurer-rank {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--yellow);
  margin-bottom: 6px;
  text-shadow: 1px 1px 0 #000;
}

.adventurer-name {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: #fff;
  margin-bottom: 4px;
  text-shadow: 2px 2px 0 #000;
  word-break: break-word;
}

.adventurer-handle {
  font-family: var(--font-body);
  font-size: 1.2rem;
  color: #ddd;
}

.quest-log {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.quest-log-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(0,0,0,0.3);
  border: 2px solid rgba(255,255,255,0.15);
  font-family: var(--font-body);
  font-size: 1.1rem;
}

.quest-log-item--done {
  border-color: #5cb838;
  background: rgba(92, 184, 56, 0.15);
}

.quest-log-item--done .quest-log-check { color: #5cb838; }
.quest-log-item--done .quest-log-state { color: #7ed957; }

.quest-log-check {
  font-family: var(--font-pixel);
  font-size: 10px;
  width: 16px;
  color: rgba(255,255,255,0.4);
}

.quest-log-check--pulse {
  animation: pulse-ring 1.5s ease-in-out infinite;
}

.quest-log-label { flex: 1; text-align: left; }
.quest-log-state { font-size: 1.05rem; color: #ccc; }

.adventurer-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Animations ── */
@keyframes bg-alive {
  0%   { transform: translate(0%, 0%) scale(1.04); }
  20%  { transform: translate(-1.5%, -0.8%) scale(1.07); }
  40%  { transform: translate(1%, -1.2%) scale(1.05); }
  60%  { transform: translate(1.8%, 0.6%) scale(1.08); }
  80%  { transform: translate(-0.8%, 1%) scale(1.06); }
  100% { transform: translate(0%, 0%) scale(1.04); }
}

@keyframes fog-drift {
  0%, 100% { opacity: 0.7; transform: translateX(0) scale(1); }
  50%       { opacity: 1; transform: translateX(20px) scale(1.05); }
}

@keyframes torch-flicker {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  30%       { opacity: 0.9; transform: scale(1.08); }
  60%       { opacity: 0.5; transform: scale(0.95); }
  80%       { opacity: 0.85; transform: scale(1.04); }
}

@keyframes ember-rise {
  0%   { opacity: 0; transform: translateY(0) scale(1); }
  20%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-80px) scale(0.3); }
}

@keyframes overlay-breathe {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.85; }
}

@keyframes coin-spin {
  0%, 100% { transform: rotateY(0deg) scale(1); }
  50%       { transform: rotateY(180deg) scale(1.08); }
}

@keyframes xp-fill {
  from { width: 30%; }
  to   { width: 55%; }
}

@keyframes sparkle-pop {
  0%, 100% { opacity: 0; transform: scale(0) rotate(0deg); }
  50%       { opacity: 1; transform: scale(1) rotate(180deg); }
}

@keyframes text-glow {
  0%, 100% { text-shadow: 3px 3px 0 var(--text-shadow); }
  50%       { text-shadow: 3px 3px 0 var(--text-shadow), 0 0 12px rgba(255,205,41,0.5); }
}

@keyframes blink-arrow {
  0%, 100% { opacity: 1; transform: translateY(0); }
  50%       { opacity: 0.4; transform: translateY(4px); }
}

@keyframes title-shimmer {
  0%, 100% { filter: drop-shadow(4px 4px 0 var(--text-shadow)) drop-shadow(6px 6px 0 rgba(0,0,0,0.35)); }
  50%       { filter: drop-shadow(4px 4px 0 var(--text-shadow)) drop-shadow(6px 6px 0 rgba(0,0,0,0.35)) drop-shadow(0 0 20px rgba(255,200,50,0.4)); }
}

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

@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

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

@keyframes hint-bounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-3px); }
}

@keyframes btn-glow {
  0%, 100% { box-shadow: 4px 4px 0 #1a1a2e; }
  50%       { box-shadow: 4px 4px 0 #1a1a2e, 0 0 20px rgba(88,101,242,0.6); }
}

@keyframes banner-pop {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes pulse-ring {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 1; transform: scale(1.15); }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .world-bg-wrap { transform: none !important; }
  .world-bg-img { transform: scale(1.05) !important; }
  .world-fog, .world-torch-glow { animation: none; opacity: 0.6; }
}

/* ── Mobile ── */
@media (max-width: 480px) {
  .pixel-logo-text { font-size: 9px; }
  .header-xp { display: none; }

  .hero {
    padding: 64px 10px 24px;
    justify-content: center;
  }

  .hero-panel {
    width: calc(100vw - 20px);
    padding: 22px 14px 18px;
    border-width: 3px;
    border-bottom-width: 5px;
    border-right-width: 4px;
    box-shadow: 4px 4px 0 #000;
  }

  .hero-panel::before {
    inset: 4px;
    border-width: 1px;
  }

  .hero-eyebrow {
    font-size: 8px;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
  }

  .hero-title,
  #hero-title {
    font-size: min(1.2rem, calc((100vw - 88px) / 7.5));
    letter-spacing: 0;
    line-height: 1.65;
    white-space: normal;
    width: 100%;
    max-width: 100%;
    overflow-wrap: break-word;
    text-shadow:
      1px 1px 0 #c9880f,
      2px 2px 0 #5c3d8a,
      3px 3px 0 #000;
    margin-bottom: 10px;
  }

  .hero-sub {
    font-size: 1.15rem;
    line-height: 1.4;
    margin-bottom: 18px;
  }

  .login-actions {
    gap: 12px;
    padding-top: 16px;
    margin-top: 0;
  }

  .login-quest { font-size: 1.05rem; }
  .login-or { font-size: 1rem; }
  .btn-hint { font-size: 1rem; }

  .btn-pixel {
    font-size: 8px;
    min-height: 46px;
    padding: 12px 10px;
    line-height: 1.5;
  }

  .hero-footer {
    font-size: 0.95rem;
    margin-top: 14px;
    padding-top: 12px;
    flex-wrap: wrap;
    gap: 4px;
  }
}
