/* ============================================================
   TO-SKILLS-TDP // Character Select
   Subtle 8-bit aesthetic, readable typography
   ============================================================ */

:root {
  /* black & white with grays — no chromatic accent */
  --bg-0: #0a0a0a;
  --bg-1: #131313;
  --bg-2: #1c1c1c;

  --fg-0: #ffffff;
  --fg-1: #c8c8c8;
  --fg-2: #808080;
  --fg-3: #555555;

  --accent: #ffffff;          /* highlight = pure white */
  --accent-soft: #c8c8c8;
  --danger: #ffffff;

  --card-bg: rgba(255, 255, 255, 0.02);
  --card-border: rgba(255, 255, 255, 0.10);
  --card-border-strong: rgba(255, 255, 255, 0.40);
}

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

html, body {
  height: 100%;
  background: var(--bg-0);
  color: var(--fg-1);
  /* readable pixel font as the default */
  font-family: 'VT323', 'Courier New', monospace;
  font-size: 22px;
  line-height: 1.35;
  overflow-x: hidden;
}

body {
  background: var(--bg-0);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--fg-0); text-decoration: underline; }

/* small util */
.bracket { color: var(--accent); }

/* ---------- top / bottom bars ---------- */

.topbar {
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--card-border);
}

.bottombar {
  margin-top: auto;
  padding: 18px 28px;
  text-align: center;
  font-size: 18px;
  color: var(--fg-2);
  border-top: 1px solid var(--card-border);
}

.brand {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.brand:hover { color: var(--fg-0); text-decoration: none; }

.sound-toggle {
  font-family: 'VT323', monospace;
  font-size: 18px;
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--fg-2);
  padding: 6px 12px;
  cursor: pointer;
  letter-spacing: 0.05em;
}

.sound-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- main screen ---------- */

.screen {
  padding: 48px 28px 56px;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

.title {
  font-family: 'Press Start 2P', monospace;
  font-size: 28px;
  text-align: center;
  color: var(--fg-0);
  letter-spacing: 0.06em;
  margin-bottom: 14px;
  line-height: 1.5;
}

.title-bracket {
  color: var(--accent);
}

.subtitle {
  text-align: center;
  color: var(--fg-2);
  font-size: 22px;
  letter-spacing: 0.02em;
  margin-bottom: 40px;
}

/* ---------- team filters ---------- */

.team-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 32px;
}

.team-filter {
  font-family: 'VT323', monospace;
  font-size: 18px;
  letter-spacing: 0.04em;
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--fg-2);
  padding: 8px 14px;
  cursor: pointer;
  transition: border-color 120ms, color 120ms, background 120ms;
}

.team-filter:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.team-filter.is-active {
  background: var(--accent);
  color: var(--bg-0);
  border-color: var(--accent);
}

/* ---------- layout ---------- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(360px, 1fr);
  gap: 28px;
  align-items: start;
}

@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; }
}

/* ---------- combo rows ---------- */

.combos {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.combo-row {
  border: 1px solid var(--card-border);
  border-left: 3px solid var(--accent);
  padding: 18px;
  background: var(--card-bg);
  transition: border-color 200ms, opacity 200ms;
}

.combo-row.is-dimmed { opacity: 0.35; }
.combo-row.is-highlighted { border-color: var(--accent); }

.combo-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.combo-rule { display: none; } /* simplified: drop the ascii rules */

.combo-name {
  font-family: 'Press Start 2P', monospace;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--accent);
  line-height: 1.4;
}

.combo-sep { display: none; }

.combo-tagline {
  font-family: 'VT323', monospace;
  font-size: 19px;
  font-weight: normal;
  color: var(--fg-2);
  letter-spacing: 0.01em;
}

.combo-heroes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

/* ---------- hero cards ---------- */

.hero {
  background: transparent;
  border: 1px solid var(--card-border);
  padding: 14px 8px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font: inherit;
  color: var(--fg-1);
  position: relative;
  transition: transform 120ms, border-color 120ms, background 120ms;
  outline: none;
}

.hero:hover, .hero:focus-visible {
  border-color: var(--fg-0);
  background: rgba(255, 255, 255, 0.03);
  transform: translateY(-2px);
}

.hero:hover .sprite, .hero:focus-visible .sprite {
  animation: idle 600ms steps(2) infinite;
}

.hero:hover .sprite-svg, .hero:focus-visible .sprite-svg {
  color: var(--fg-0);
}

.hero.is-selected {
  border-color: var(--fg-0);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px var(--fg-0);
}

.hero.is-selected .sprite-svg {
  color: var(--fg-0);
}

@keyframes idle {
  0%, 50% { transform: translateY(0); }
  51%, 100% { transform: translateY(-2px); }
}

.sprite {
  width: 56px; height: 56px;
  display: flex;
  align-items: center; justify-content: center;
}

.sprite-svg, .portrait-svg {
  width: 100%; height: 100%;
  fill: currentColor;
  filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.6));
  overflow: visible;
}

.sprite-svg { color: var(--fg-2); transition: color 120ms; }
.portrait-svg { color: var(--fg-0); }

.sprite-svg .outline, .portrait-svg .outline { fill: rgba(0, 0, 0, 0.55); }
.sprite-svg .visor, .portrait-svg .visor { fill: rgba(255, 255, 255, 0.95); }
.sprite-svg .emblem, .portrait-svg .emblem { fill: #fff; }
.sprite-svg .hand, .portrait-svg .hand { fill: #fff; }
.sprite-svg .boot, .portrait-svg .boot { fill: #1a1a1a; }
.sprite-svg .cape, .portrait-svg .cape {
  fill: color-mix(in srgb, currentColor 60%, #000);
}
.sprite-svg .belt, .portrait-svg .belt { fill: rgba(0, 0, 0, 0.5); }
.sprite-svg .shadow { fill: rgba(0, 0, 0, 0.35); }

.sprite-png {
  width: 100%; height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.6));
}

.hero-name {
  font-family: 'VT323', monospace;
  font-size: 17px;
  text-align: center;
  color: var(--fg-1);
  letter-spacing: 0.02em;
  line-height: 1.15;
}

.hero:hover .hero-name, .hero.is-selected .hero-name {
  color: var(--accent);
}

/* ---------- detail panel ---------- */

.detail {
  background: var(--card-bg);
  border: 1px solid var(--card-border-strong);
  padding: 24px;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

.detail-inner {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 16px;
  grid-template-areas:
    'portrait meta'
    'desc desc'
    'how how'
    'bestwith bestwith'
    'install install'
    'actions actions';
}

.detail-portrait {
  grid-area: portrait;
  width: 100px; height: 100px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}

.portrait-svg {
  width: 80%; height: 80%;
  animation: portrait-idle 1.2s steps(2) infinite;
}

@keyframes portrait-idle {
  0%, 50% { transform: translateY(0); }
  51%, 100% { transform: translateY(-3px); }
}

.detail-meta {
  grid-area: meta;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.detail-name {
  font-family: 'Press Start 2P', monospace;
  font-size: 15px;
  color: var(--accent);
  letter-spacing: 0.03em;
  line-height: 1.4;
  word-break: break-word;
}

.detail-title {
  font-family: 'VT323', monospace;
  font-size: 22px;
  color: var(--fg-1);
  font-style: italic;
}

.detail-type, .detail-combo {
  font-family: 'VT323', monospace;
  font-size: 17px;
  color: var(--fg-2);
  letter-spacing: 0.02em;
}

.detail-type span { color: var(--fg-1); }
.detail-combo span { color: var(--accent); }

.detail-section { display: flex; flex-direction: column; gap: 6px; }
.detail-section.section-desc { grid-area: desc; }
.detail-section.section-how { grid-area: how; }
.detail-section.section-install { grid-area: install; }
.detail-section.best-with { grid-area: bestwith; }

.section-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: var(--fg-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-section p {
  font-family: 'VT323', monospace;
  font-size: 21px;
  color: var(--fg-1);
  line-height: 1.4;
}

.best-with-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.best-with-chip {
  font-family: 'VT323', monospace;
  font-size: 16px;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--card-border);
  color: var(--fg-1);
  cursor: pointer;
  text-decoration: none;
}

.best-with-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.chip-dot {
  width: 8px; height: 8px;
  background: var(--accent);
  display: inline-block;
}

.install-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: stretch;
}

.install-row code {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--card-border);
  padding: 8px 12px;
  font-family: 'VT323', monospace;
  font-size: 18px;
  color: var(--accent);
  overflow-x: auto;
  white-space: nowrap;
}

.copy-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--fg-2);
  padding: 0 14px;
  cursor: pointer;
  letter-spacing: 0.06em;
  transition: background 120ms, color 120ms, border-color 120ms;
}

.copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.copy-btn.is-copied { background: var(--accent); color: var(--bg-0); border-color: var(--accent); }

.detail-actions {
  grid-area: actions;
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.engage-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  background: var(--accent);
  color: var(--bg-0);
  padding: 12px 22px;
  border: none;
  cursor: pointer;
  letter-spacing: 0.08em;
  text-decoration: none;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.5);
  transition: transform 80ms, box-shadow 80ms;
}

.engage-btn:hover {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
  text-decoration: none;
  color: var(--bg-0);
}

.engage-btn:active {
  transform: translate(3px, 3px);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  bottom: 80px; left: 50%;
  transform: translateX(-50%);
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  background: var(--accent);
  color: var(--bg-0);
  padding: 12px 18px;
  letter-spacing: 0.05em;
  z-index: 200;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms;
}

.toast.is-visible { opacity: 1; }

/* ---------- responsive ---------- */

@media (max-width: 700px) {
  .screen { padding: 32px 16px 40px; }
  .title { font-size: 18px; }
  .detail-inner { grid-template-columns: 80px 1fr; }
  .detail-portrait { width: 80px; height: 80px; }
  .detail-name { font-size: 12px; }
  .detail { position: static; max-height: none; }
}

/* ============================================================
   STEP 1 — Awwwards-grade craft layer
   ============================================================ */

/* ---------- Custom cursor (desktop only) ---------- */

@media (hover: hover) and (pointer: fine) {
  html, body, button, a, [role="button"], .hero, .copy-btn, .engage-btn, .sound-toggle, .team-filter, .best-with-chip {
    cursor: none;
  }
}

.cursor {
  position: fixed;
  top: 0; left: 0;
  width: 18px;
  height: 18px;
  pointer-events: none;
  z-index: 9998;
  display: none;
  will-change: transform;
  transform: translate3d(-100px, -100px, 0);
  transition: width 80ms steps(2), height 80ms steps(2);
}

.cursor svg {
  width: 100%;
  height: 100%;
  display: block;
  filter:
    drop-shadow(1px 0 0 #000)
    drop-shadow(-1px 0 0 #000)
    drop-shadow(0 1px 0 #000)
    drop-shadow(0 -1px 0 #000);
}

.cursor.is-pointer {
  width: 24px;
  height: 24px;
}

@media (hover: hover) and (pointer: fine) {
  .cursor { display: block; }
}

/* ---------- Animated grain overlay ---------- */

body::before {
  content: '';
  position: fixed;
  inset: -2%;
  pointer-events: none;
  background-image: var(--noise-tile, none);
  background-repeat: repeat;
  z-index: 9990;
  opacity: 0.55;
  mix-blend-mode: overlay;
  animation: grain-flicker 0.16s steps(3) infinite;
}

@keyframes grain-flicker {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-1.5%, 1%); }
  50%  { transform: translate(1.2%, -1.5%); }
  75%  { transform: translate(-0.8%, -1%); }
  100% { transform: translate(0, 0); }
}

/* ---------- Boot intro overlay ---------- */

.boot {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.boot.is-leaving {
  animation: boot-leave 700ms steps(8, end) forwards;
}

@keyframes boot-leave {
  0%   { opacity: 1; clip-path: inset(0% 0% 0% 0%); }
  60%  { opacity: 1; clip-path: inset(48% 0% 48% 0%); background: #fff; }
  61%  { background: #000; }
  100% { opacity: 0; clip-path: inset(50% 0% 50% 0%); }
}

.boot-frame {
  width: min(560px, 90vw);
  padding: 24px 28px;
  position: relative;
}

.boot-frame::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.25);
  opacity: 0;
  animation: boot-frame-in 300ms steps(4) 80ms forwards;
}

.boot-screen {
  font-family: 'VT323', monospace;
  font-size: 22px;
  color: var(--fg-0);
  text-align: left;
  line-height: 1.5;
  position: relative;
}

.boot-line {
  opacity: 0;
  white-space: nowrap;
  overflow: hidden;
  letter-spacing: 0.02em;
}

.boot-line-1 {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  margin-bottom: 14px;
  color: var(--fg-1);
  animation: boot-type 400ms steps(10) 200ms forwards;
}

.boot-line-2 {
  animation: boot-type 500ms steps(22) 800ms forwards;
}

.boot-line-3 {
  animation: boot-type 600ms steps(30) 1400ms forwards;
}

.boot-bar {
  opacity: 0;
  margin: 8px 0 8px;
  height: 8px;
  width: 280px;
  max-width: 100%;
  border: 1px solid var(--fg-1);
  position: relative;
  animation: boot-fade 200ms 2000ms forwards;
}

.boot-bar-fill {
  position: absolute;
  inset: 0 100% 0 0;
  background: var(--fg-0);
  animation: boot-fill 700ms steps(14, end) 2100ms forwards;
}

.boot-line-4 {
  animation: boot-type 500ms steps(30) 2900ms forwards;
}

.boot-line-5 {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  margin-top: 18px;
  color: var(--fg-0);
  animation:
    boot-fade 200ms 3500ms forwards,
    boot-blink 800ms 3700ms steps(2) infinite;
}

@keyframes boot-frame-in {
  0%   { opacity: 0; transform: scaleY(0.02); }
  60%  { opacity: 1; transform: scaleY(1); }
  100% { opacity: 1; transform: scaleY(1); }
}

@keyframes boot-type {
  0%   { opacity: 1; width: 0; }
  100% { opacity: 1; width: 100%; }
}

@keyframes boot-fade {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes boot-fill {
  0%   { right: 100%; }
  100% { right: 0%; }
}

@keyframes boot-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0.2; }
}

/* hide intro state of the page until boot finishes */
body:not(.is-booted) .screen,
body:not(.is-booted) .topbar,
body:not(.is-booted) .bottombar {
  opacity: 0;
  pointer-events: none;
}

body.is-booted .screen,
body.is-booted .topbar,
body.is-booted .bottombar {
  animation: page-fade-in 400ms steps(8) 100ms backwards;
}

@keyframes page-fade-in {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}

/* ---------- Staggered hero entrance ---------- */

.hero {
  --stagger-delay: 0;
}

body.is-booted .hero {
  animation: hero-in 360ms steps(6, end) backwards;
  animation-delay: calc(var(--stagger-delay) * 45ms + 300ms);
}

@keyframes hero-in {
  0%   { opacity: 0; transform: translateY(8px) scale(0.94); filter: brightness(2); }
  60%  { opacity: 1; filter: brightness(1.4); }
  100% { opacity: 1; transform: translateY(0) scale(1); filter: brightness(1); }
}

/* combo row labels fade in before their heroes */
body.is-booted .combo-row {
  animation: combo-in 400ms steps(6) backwards;
  animation-delay: calc(var(--row-delay, 0) * 100ms + 200ms);
}

@keyframes combo-in {
  0%   { opacity: 0; transform: translateX(-12px); }
  100% { opacity: 1; transform: translateX(0); }
}

/* ---------- Glitch transition on hero select ---------- */

.detail.is-glitching .detail-portrait,
.detail.is-glitching .detail-meta,
.detail.is-glitching .detail-section {
  animation: glitch-jitter 220ms steps(5);
}

.detail.is-glitching .detail-portrait { animation-delay: 0ms; }
.detail.is-glitching .detail-meta { animation-delay: 30ms; }
.detail.is-glitching .detail-section { animation-delay: 60ms; }

@keyframes glitch-jitter {
  0%   { transform: translate(0, 0); clip-path: inset(0); }
  20%  { transform: translate(-3px, 1px); clip-path: inset(20% 0 20% 0); }
  40%  { transform: translate(2px, -2px); clip-path: inset(40% 0 10% 0); }
  60%  { transform: translate(-1px, 2px); clip-path: inset(10% 0 50% 0); }
  80%  { transform: translate(1px, -1px); clip-path: inset(30% 0 30% 0); }
  100% { transform: translate(0, 0); clip-path: inset(0); }
}

/* subtle scramble for the install code on transition */
.detail.is-glitching .install-row code {
  animation: scramble 220ms steps(8);
}

@keyframes scramble {
  0%, 100% { letter-spacing: 0; }
  50%      { letter-spacing: 0.1em; opacity: 0.6; }
}

/* ---------- Arcade Mode (Konami unlock) ---------- */

body.is-arcade-mode {
  --accent: #ffd866;
  --fg-0: #fff7d6;
}

body.is-arcade-mode::before {
  opacity: 0.7;
}

body.is-arcade-mode .title {
  text-shadow:
    2px 2px 0 var(--accent),
    -2px -2px 0 #ff5c95;
}

.toast.is-achievement {
  background: var(--accent);
  color: #000;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.8);
}
