/* ═══════════════════════════════════════════
   PLAYER ONE — modern Nintendo theme
   Bold red · rounded cards · playful motion
   ═══════════════════════════════════════════ */

:root {
  --red: #e60012;
  --red-dark: #b3000e;
  --ink: #17171f;
  --ink-soft: #4a4a58;
  --paper: #fffdf8;
  --card: #ffffff;
  --cream: #fff4e8;
  --navy: #101018;
  --line: #f0e6d8;
  --shadow: 0 10px 30px rgba(23, 23, 31, 0.10);
  --shadow-pop: 0 6px 0 rgba(23, 23, 31, 0.9);
  --radius: 22px;
  --font-display: 'Bungee', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, sans-serif;
}

[data-theme="dark"] {
  --ink: #f4f1ea;
  --ink-soft: #b9b4a8;
  --paper: #14141c;
  --card: #1d1d28;
  --cream: #23232f;
  --line: #2c2c3a;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-pop: 0 6px 0 rgba(0, 0, 0, 0.85);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.65;
  overflow-x: hidden;
  transition: background 0.35s ease, color 0.35s ease;
}

h1, h2, h3, .logo, .press-start, .ver, .level-tag {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.15;
}

a { color: var(--red); }
img { max-width: 100%; display: block; }

/* ── Game menu ─────────────────────────── */
.game-menu {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  display: flex; align-items: center; gap: 1.25rem;
  padding: 0.7rem 1.25rem;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 3px solid var(--ink);
}

.logo {
  display: flex; align-items: center; gap: 0.6rem;
  text-decoration: none; color: var(--ink); font-size: 1rem;
  letter-spacing: 0.02em; white-space: nowrap;
}
.logo-badge {
  background: var(--red); color: #fff;
  width: 2.2rem; height: 2.2rem; border-radius: 12px;
  display: grid; place-items: center; font-size: 0.85rem;
  box-shadow: var(--shadow-pop); transform: rotate(-6deg);
}

.menu-links { display: flex; gap: 0.25rem; margin-left: auto; align-items: center; }
.menu-links a {
  text-decoration: none; color: var(--ink); font-weight: 800;
  padding: 0.5rem 0.85rem; border-radius: 999px; font-size: 0.95rem;
  transition: background 0.2s, transform 0.2s;
}
.menu-links a:hover { background: var(--cream); transform: translateY(-2px); }
.menu-cta {
  background: var(--red); color: #fff !important;
  box-shadow: 0 4px 0 var(--red-dark);
}
.menu-cta:hover { background: var(--red-dark); }

.theme-toggle {
  width: 3.2rem; height: 1.8rem; border-radius: 999px;
  border: 3px solid var(--ink); background: var(--cream);
  position: relative; cursor: pointer; flex-shrink: 0;
}
.toggle-knob {
  position: absolute; top: 50%; left: 3px; translate: 0 -50%;
  width: 1.15rem; height: 1.15rem; border-radius: 50%;
  background: var(--red); border: 2px solid var(--ink);
  transition: left 0.25s ease;
}
[data-theme="dark"] .toggle-knob { left: calc(100% - 1.15rem - 3px); background: #ffd23f; }

.hamburger { display: none; background: none; border: none; font-size: 1.5rem; color: var(--ink); cursor: pointer; }

/* ── Title screen ────────────────────────── */
.hero {
  min-height: 100svh;
  display: grid; place-items: center; text-align: center;
  padding: 7rem 1.5rem 4rem; position: relative; overflow: hidden;
  background:
    radial-gradient(1100px 500px at 50% -10%, color-mix(in srgb, var(--red) 26%, transparent), transparent 60%),
    var(--paper);
}
.hero-pixels .px {
  position: absolute; border-radius: 6px; opacity: 0.5;
  animation: float 9s ease-in-out infinite;
}
.px.p1 { width: 22px; height: 22px; background: var(--red); top: 16%; left: 8%; }
.px.p2 { width: 14px; height: 14px; background: #ffd23f; top: 24%; right: 12%; animation-delay: -2s; }
.px.p3 { width: 30px; height: 30px; background: var(--red); bottom: 22%; left: 14%; animation-delay: -4s; border-radius: 50%; }
.px.p4 { width: 12px; height: 12px; background: var(--ink); top: 60%; right: 20%; animation-delay: -1s; }
.px.p5 { width: 18px; height: 18px; background: #ffd23f; bottom: 30%; right: 8%; animation-delay: -6s; border-radius: 50%; }
.px.p6 { width: 26px; height: 26px; background: var(--red); top: 38%; left: 4%; animation-delay: -3s; }
.px.p7 { width: 12px; height: 12px; background: var(--ink); bottom: 14%; left: 46%; animation-delay: -5s; }
.px.p8 { width: 20px; height: 20px; background: #ffd23f; top: 12%; left: 60%; animation-delay: -7s; }
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-26px) rotate(14deg); }
}

.hero-inner { max-width: 46rem; position: relative; }
.hero-kicker { color: var(--red); letter-spacing: 0.35em; font-size: 0.95rem; margin-bottom: 1rem; }
.hero-title {
  font-size: clamp(3.2rem, 11vw, 7.5rem);
  color: var(--ink);
  text-shadow: 4px 4px 0 var(--red);
  margin-bottom: 1rem;
}
.hero-sub { font-weight: 800; letter-spacing: 0.25em; color: var(--ink-soft); margin-bottom: 1.25rem; }
.hero-blurb { font-size: 1.15rem; max-width: 36rem; margin: 0 auto 2rem; color: var(--ink-soft); }

.press-start {
  display: inline-block; text-decoration: none;
  background: var(--red); color: #fff; font-size: 1.15rem;
  padding: 1rem 2.4rem; border-radius: 999px;
  border: 3px solid var(--ink); box-shadow: var(--shadow-pop);
  animation: blink 1.6s ease-in-out infinite;
  transition: transform 0.15s;
}
.press-start:hover { transform: translateY(-3px) scale(1.03); }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.72; } }

.hero-stats {
  display: flex; gap: 2rem; justify-content: center; flex-wrap: wrap;
  margin-top: 3rem;
}
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats strong { font-family: var(--font-display); font-size: 1.7rem; color: var(--red); }
.hero-stats span { font-size: 0.85rem; color: var(--ink-soft); font-weight: 700; }

.hero-scroll-hint {
  position: absolute; bottom: 1.2rem; left: 50%; translate: -50% 0;
  color: var(--red); font-size: 1.4rem; animation: bounce 1.8s infinite;
}
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(10px); } }

/* ── Levels (sections) ───────────────────── */
.level { padding: 6rem 1.5rem; max-width: 72rem; margin: 0 auto; }
.level-alt { max-width: none; background: var(--cream); border-top: 3px solid var(--ink); border-bottom: 3px solid var(--ink); }
.level-alt .level, .level-alt > *:not(.level-head) { max-width: 72rem; margin-left: auto; margin-right: auto; }

.level-head { text-align: center; margin-bottom: 3rem; }
.level-tag {
  display: inline-block; background: var(--ink); color: var(--paper);
  font-size: 0.8rem; letter-spacing: 0.2em; padding: 0.4rem 1rem;
  border-radius: 999px; margin-bottom: 1rem;
}
.level-head h2 { font-size: clamp(2rem, 5vw, 3.2rem); margin-bottom: 0.5rem; }
.level-head p { color: var(--ink-soft); font-size: 1.1rem; }
.level-head code {
  background: var(--ink); color: #7df9a2; padding: 0.15rem 0.5rem;
  border-radius: 8px; font-size: 0.95em;
}

/* ── Player profile ──────────────────────── */
.profile-grid { display: grid; grid-template-columns: 320px 1fr; gap: 2rem; align-items: start; }

.char-card {
  background: var(--card); border: 3px solid var(--ink);
  border-radius: var(--radius); padding: 1.5rem; text-align: center;
  box-shadow: var(--shadow-pop); position: sticky; top: 6rem;
}
.char-frame {
  border: 3px solid var(--ink); border-radius: 16px; overflow: hidden;
  background: var(--red); margin-bottom: 1rem;
}
.char-frame img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.char-card h3 { font-size: 1.3rem; margin-bottom: 0.25rem; }
.char-class { font-size: 0.8rem; font-weight: 800; letter-spacing: 0.12em; color: var(--red); margin-bottom: 1rem; }
.hp-bar { height: 14px; border: 3px solid var(--ink); border-radius: 999px; overflow: hidden; background: var(--cream); }
.hp-fill { display: block; height: 100%; width: 92%; border-radius: 999px;
  background: linear-gradient(90deg, #37d67a, #7df9a2); animation: hp 2.4s ease-in-out infinite; }
@keyframes hp { 0%, 100% { width: 92%; } 50% { width: 88%; } }
.hp-label { font-size: 0.75rem; font-weight: 800; letter-spacing: 0.15em; margin: 0.5rem 0 1rem; color: var(--ink-soft); }
.char-traits { list-style: none; text-align: left; font-size: 0.92rem; font-weight: 600; }
.char-traits li { padding: 0.45rem 0; border-top: 2px dashed var(--line); }
.char-traits li::before { content: "★ "; color: var(--red); }

.profile-body { display: grid; gap: 1.5rem; }
.bio-card, .stats-card, .now-card {
  background: var(--card); border: 3px solid var(--ink);
  border-radius: var(--radius); padding: 1.75rem; box-shadow: var(--shadow);
}
.bio-card h3, .stats-card h3, .now-card h3 { color: var(--red); margin-bottom: 0.9rem; font-size: 1.05rem; }
.samson-bio { overflow: hidden; }
.samson-bio-photo { float: left; width: 150px; margin: 0.25rem 1.25rem 0.75rem 0; border: 3px solid var(--ink); border-radius: 16px; }
@media (max-width: 600px) {
  .samson-bio-photo { float: none; display: block; width: 170px; margin: 0 auto 1rem; }
}
.bio-card p + p { margin-top: 0.9rem; }
.stat { display: grid; grid-template-columns: 1fr 140px 2.2rem; align-items: center; gap: 0.9rem; padding: 0.5rem 0; font-weight: 700; }
.stat .bar { height: 12px; background: var(--cream); border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; }
.stat .bar i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--red), #ff6b6b); transition: width 1.2s cubic-bezier(0.2, 0.8, 0.2, 1); }
.stat b { color: var(--red); font-family: var(--font-display); font-weight: 400; font-size: 0.95rem; }
.now-card ul { list-style: none; }
.now-card li { padding: 0.4rem 0 0.4rem 1.6rem; position: relative; font-weight: 600; }
.now-card li::before { content: "▶"; position: absolute; left: 0; color: var(--red); }

/* ── Cartridges ──────────────────────────── */
.cart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.75rem; perspective: 1200px; }
.cart {
  background: var(--card); border: 3px solid var(--ink); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-pop);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  transform-style: preserve-3d; will-change: transform;
  display: flex; flex-direction: column;
}
.cart:hover { box-shadow: 0 12px 0 rgba(23, 23, 31, 0.9); }
.cart-art {
  height: 150px; display: grid; place-items: center;
  font-family: var(--font-display); font-size: 3rem; color: #fff;
  border-bottom: 3px solid var(--ink); text-shadow: 3px 3px 0 rgba(0,0,0,0.35);
}
.cart-hound { background: linear-gradient(135deg, #0f9d58, #37d67a); }
.cart-orca { background: linear-gradient(135deg, #1a73e8, #6ab4ff); }
.cart-detect { background: linear-gradient(135deg, var(--red), #ff6b6b); }
.cart-soar { background: linear-gradient(135deg, #7b2ff7, #b388ff); }
.cart-versus { background: linear-gradient(135deg, #d32f2f, #1a73e8); }
.cart-cub { background: linear-gradient(135deg, #f7e3b0, #dfa248); }
.cart-body { padding: 1.5rem; display: flex; flex-direction: column; gap: 0.7rem; flex: 1; }
.cart-meta { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.genre { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.15em; background: var(--ink); color: var(--paper); padding: 0.25rem 0.7rem; border-radius: 999px; }
.status { font-size: 0.78rem; font-weight: 800; }
.status.live { color: #0f9d58; }
.status.shelf { color: #b7791f; }
.cart-body h3 { font-size: 1.4rem; }
.cart-body p { color: var(--ink-soft); font-size: 0.98rem; flex: 1; }
.cart-btn {
  align-self: flex-start; text-decoration: none; font-family: var(--font-display);
  font-size: 0.9rem; background: var(--red); color: #fff;
  padding: 0.7rem 1.5rem; border-radius: 999px; border: 3px solid var(--ink);
  box-shadow: 0 4px 0 var(--ink); transition: transform 0.15s;
}
.cart-btn:hover { transform: translateY(-2px); }
.cart-btn.ghost { background: var(--cream); color: var(--ink-soft); box-shadow: none; cursor: default; }
.cart-btn.ghost:hover { transform: none; }

/* ── Patch notes ─────────────────────────── */
.notes-list { display: grid; gap: 1.25rem; max-width: 52rem; margin: 0 auto; }
.note {
  display: grid; grid-template-columns: auto 1fr; gap: 1.25rem;
  background: var(--card); border: 3px solid var(--ink); border-radius: var(--radius);
  padding: 1.5rem 1.75rem; box-shadow: var(--shadow); align-items: start;
}
.ver {
  background: var(--red); color: #fff; font-size: 0.85rem;
  padding: 0.45rem 0.9rem; border-radius: 12px; border: 3px solid var(--ink);
  box-shadow: 0 4px 0 var(--ink); white-space: nowrap; transform: rotate(-3deg);
}
.note h3 { font-size: 1.15rem; margin-bottom: 0.5rem; }
.note h3 time { font-family: var(--font-body); font-weight: 700; font-size: 0.85rem; color: var(--ink-soft); }
.note p { color: var(--ink-soft); }

/* ── Terminal ────────────────────────────── */
.terminal {
  max-width: 52rem; margin: 0 auto;
  background: #101018; border: 3px solid var(--ink); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-pop);
}
.term-bar {
  display: flex; align-items: center; gap: 0.5rem;
  background: #23232f; padding: 0.7rem 1rem; border-bottom: 3px solid var(--ink);
}
.term-bar span { width: 12px; height: 12px; border-radius: 50%; background: #55555f; }
.term-bar span:first-child { background: #ff5f57; }
.term-bar span:nth-child(2) { background: #febc2e; }
.term-bar span:nth-child(3) { background: #28c840; }
.term-bar em { margin-left: auto; color: #8a8a96; font-style: normal; font-size: 0.85rem; font-weight: 700; }
.term-screen {
  height: 300px; overflow-y: auto; padding: 1.1rem 1.25rem;
  font-family: ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace;
  font-size: 0.92rem; color: #d6f5d6; white-space: pre-wrap;
}
.term-screen .cmd { color: #7df9a2; }
.term-screen .dim { color: #8a8a96; }
.term-screen .warn { color: #ffd23f; }
.term-input-row {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.9rem 1.25rem; border-top: 2px solid #23232f;
  font-family: ui-monospace, Menlo, Consolas, monospace; color: #7df9a2;
}
.term-input-row input {
  flex: 1; background: none; border: none; outline: none;
  color: #d6f5d6; font: inherit; caret-color: #7df9a2;
}
.term-input-row input::placeholder { color: #55555f; }

/* ── Continue / footer ───────────────────── */
.continue {
  background: var(--navy); color: #f4f1ea; text-align: center;
  padding: 6rem 1.5rem 3rem; border-top: 3px solid var(--ink);
}
.continue-kicker { color: #ffd23f; letter-spacing: 0.35em; font-size: 0.9rem; margin-bottom: 1rem; }
.continue h2 { font-size: clamp(2.4rem, 6vw, 4rem); margin-bottom: 1rem; text-shadow: 4px 4px 0 var(--red); }
.continue p { max-width: 38rem; margin: 0 auto 2rem; color: #b9b4a8; }
.continue-btns { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-bottom: 3rem; }
.big-btn {
  text-decoration: none; font-family: var(--font-display); font-size: 1rem;
  background: var(--red); color: #fff; padding: 1rem 2.2rem;
  border-radius: 999px; border: 3px solid #f4f1ea;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.6); transition: transform 0.15s;
}
.big-btn:hover { transform: translateY(-3px); }
.big-btn.alt { background: transparent; }
.fine-print { font-size: 0.85rem; color: #8a8a96; }

/* ── Toast ───────────────────────────────── */
.toast {
  position: fixed; bottom: 1.5rem; left: 50%; translate: -50% 0;
  background: var(--ink); color: var(--paper); font-weight: 800;
  padding: 0.9rem 1.6rem; border-radius: 999px; border: 3px solid var(--red);
  opacity: 0; pointer-events: none; transform: translateY(20px);
  transition: opacity 0.3s, transform 0.3s; z-index: 200; text-align: center;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ── Reveal defaults (JS enhances) ───────── */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s ease, transform .7s cubic-bezier(.22,.8,.3,1); }
.reveal.in { opacity: 1; transform: none; }

/* ── Responsive ──────────────────────────── */
@media (max-width: 900px) {
  .profile-grid { grid-template-columns: 1fr; }
  .char-card { position: static; }
  .menu-links {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0.25rem;
    margin-left: 0;
    background: var(--paper); border-bottom: 3px solid var(--ink);
    padding: 0.75rem 1.25rem 1.25rem;
    box-shadow: 0 16px 28px rgba(0,0,0,.14);
  }
  .menu-links.open { display: flex; }
  .hamburger { display: block; margin-left: auto; }
  .theme-toggle { margin-left: 0; }
  .note { grid-template-columns: 1fr; }
  .stat { grid-template-columns: 1fr 90px 2.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}
