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

html, body { height: 100%; overflow: hidden; background: #0a0d13; }

canvas { display: block; }

#ui {
  position: fixed; inset: 0; pointer-events: none;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #e6f4ff;
  user-select: none; -webkit-user-select: none;
}

.screen {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5, 8, 13, 0.7);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  pointer-events: auto;
}
.screen.hidden { display: none; }
#screen-levelup { background: rgba(5, 8, 13, 0.55); }

.panel { text-align: center; max-width: 680px; padding: 32px; }

h1 {
  font-size: 60px; font-weight: 800;
  letter-spacing: 14px; padding-left: 14px;
  color: #53e6ff;
  text-shadow: 0 0 28px rgba(83, 230, 255, 0.6), 0 0 4px rgba(83, 230, 255, 0.9);
}
h2 {
  font-size: 26px; font-weight: 700;
  letter-spacing: 6px; padding-left: 6px;
  color: #53e6ff;
  text-shadow: 0 0 18px rgba(83, 230, 255, 0.5);
  margin-bottom: 18px;
}
h2.ko { color: #ff5a5a; text-shadow: 0 0 18px rgba(255, 90, 90, 0.5); }

.tagline { margin-top: 6px; color: #9fb6c9; font-style: italic; }
.how { margin: 20px auto 0; color: #b8cbdc; font-size: 14px; line-height: 1.55; max-width: 560px; }
.controls { margin-top: 16px; color: #7e93a8; font-size: 12px; line-height: 1.7; }
.best { margin-top: 10px; color: #ffd64d; font-size: 13px; letter-spacing: 1px; }
.scrap { margin: 10px 0 4px; color: #ffd64d; font-size: 14px; font-weight: 700; letter-spacing: 1px; }
.kbd-note { margin-top: 4px; font-size: 11px; color: #5a6c7e; }

.btn {
  pointer-events: auto; cursor: pointer;
  position: relative; overflow: hidden;
  margin-top: 22px;
  font: inherit; font-weight: 700; font-size: 16px; letter-spacing: 4px;
  color: #0a0d13;
  background: linear-gradient(180deg, #7df0ff, #3fd2ee);
  border: none; border-radius: 6px;
  padding: 12px 34px;
  box-shadow: 0 0 22px rgba(83, 230, 255, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.btn::after {
  content: ''; position: absolute; top: 0; left: 0; width: 60%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: translateX(-180%) skewX(-18deg);
  transition: transform 0.5s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 0 30px rgba(83, 230, 255, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.5); }
.btn:hover::after { transform: translateX(230%) skewX(-18deg); }
.btn:active { transform: translateY(0) scale(0.97); }
.btn.ghost {
  background: transparent; color: #53e6ff;
  border: 1px solid rgba(83, 230, 255, 0.5);
  box-shadow: none; margin-left: 10px;
}
.btn.ghost:hover { box-shadow: 0 0 16px rgba(83, 230, 255, 0.4); border-color: #53e6ff; }

.big-stat { font-size: 48px; font-weight: 800; color: #ffffff; margin: 6px 0; }
.statline {
  display: flex; gap: 26px; justify-content: center;
  margin: 14px 0 4px;
  color: #9fb6c9; font-size: 14px;
}
.statline b { color: #e6f4ff; }

#cards { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.card {
  pointer-events: auto; cursor: pointer;
  width: 188px; text-align: left;
  background: #0d1420;
  border: 1px solid rgba(83, 230, 255, 0.25);
  border-radius: 10px;
  padding: 16px 14px 12px;
  color: inherit; font: inherit;
  position: relative;
  transition: transform 0.08s ease, border-color 0.08s ease, box-shadow 0.08s ease;
}
.card:hover {
  transform: translateY(-3px);
  border-color: rgba(83, 230, 255, 0.8);
  box-shadow: 0 0 18px rgba(83, 230, 255, 0.25);
}
.card-key {
  position: absolute; top: 8px; right: 10px;
  font-size: 11px; color: #53718a;
  border: 1px solid #2a3c4e; border-radius: 4px;
  padding: 1px 6px;
}
.card-name { font-weight: 700; font-size: 15px; color: #53e6ff; margin-bottom: 6px; padding-right: 24px; }
.card-desc { font-size: 12.5px; color: #b8cbdc; line-height: 1.45; min-height: 36px; }
.card-pips { margin-top: 8px; font-size: 10px; letter-spacing: 2px; color: #41ffd2; }
.card-cost { margin-top: 8px; font-weight: 700; font-size: 13px; color: #ffd64d; }

/* ---------- motion & juice (pure CSS, GPU-composited) ---------- */

@keyframes screenIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes panelIn {
  0%   { transform: translateY(10px) scale(0.94); opacity: 0; }
  60%  { transform: translateY(-2px) scale(1.01); }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes cardDeal {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes neonPulse {
  0%, 100% { text-shadow: 0 0 22px rgba(83, 230, 255, 0.5), 0 0 4px rgba(83, 230, 255, 0.9); }
  50%      { text-shadow: 0 0 34px rgba(83, 230, 255, 0.78), 0 0 6px rgba(83, 230, 255, 1); }
}
@keyframes neonPulseKo {
  0%, 100% { text-shadow: 0 0 18px rgba(255, 90, 90, 0.5); }
  50%      { text-shadow: 0 0 30px rgba(255, 70, 70, 0.85); }
}
@keyframes scan { to { transform: translateY(4px); } }
@keyframes dangerPulse {
  0%, 100% { box-shadow: inset 0 0 140px rgba(255, 60, 60, 0.12); }
  50%      { box-shadow: inset 0 0 200px rgba(255, 60, 60, 0.22); }
}

/* drifting scanline texture behind every overlay — keeps the world alive */
.screen::before {
  content: '';
  position: absolute; inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg,
    rgba(125, 165, 255, 0.03) 0 2px, transparent 2px 4px);
  opacity: 0.6;
  animation: scan 12s linear infinite;
}

.screen { animation: screenIn 0.18s ease-out both; }
.panel { animation: panelIn 0.26s cubic-bezier(0.2, 0.9, 0.25, 1.1) both; }

h1, h2 { animation: neonPulse 3.6s ease-in-out infinite; }
h2.ko { animation: neonPulseKo 1.6s ease-in-out infinite; }

.card { animation: cardDeal 0.28s cubic-bezier(0.2, 0.9, 0.25, 1.1) both; animation-delay: calc(var(--i, 0) * 70ms); }
.card.meta { animation-delay: calc(var(--i, 0) * 40ms); }
.card:focus-visible {
  outline: none;
  transform: translateY(-3px);
  border-color: rgba(83, 230, 255, 0.8);
  box-shadow: 0 0 18px rgba(83, 230, 255, 0.3);
}
.card:hover .card-key, .card:focus-visible .card-key { color: #53e6ff; border-color: #53e6ff; }

#screen-over { box-shadow: inset 0 0 160px rgba(255, 60, 60, 0.14); animation: screenIn 0.18s ease-out both, dangerPulse 2.4s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .screen, .panel, .card, h1, h2, h2.ko, .screen::before, #screen-over { animation: none; }
}

.panel.wide { max-width: 880px; }
#armory-cards {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: center;
  max-height: 56vh; overflow-y: auto; padding: 4px;
}
.card.meta { width: 172px; }
.card.disabled { opacity: 0.5; cursor: default; }
.card.disabled:hover {
  transform: none;
  border-color: rgba(83, 230, 255, 0.25);
  box-shadow: none;
}
