/* Retro Classic Games — styles */
:root {
  --bg: #0e1013;
  --plastic: #ebe7de;
  --plastic-hi: #f8f5ef;
  --plastic-lo: #c8c2b6;
  --bezel: #1d201b;
  --lcd: #9ead86;
  --ink: #1f231d;
  --yellow: #f6b71e;
  --yellow-lo: #c48a08;
  --blue: #2f9be3;
  --blue-lo: #1a6eab;
  --text: #f2f0ea;
  --muted: #9aa0a6;
  --pixel: 'Press Start 2P', 'Courier New', monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}
a { color: inherit; }

/* ---------- Hub ---------- */
.page-hub {
  background: radial-gradient(1100px 600px at 50% -10%, #3b1a80 0%, #1a0b3d 45%, #0b0619 100%) fixed;
  overflow-x: hidden;
}
.bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.marquee {
  position: relative; z-index: 1; overflow: hidden;
  background: #ffd400; color: #1a0b3d; border-bottom: 3px solid #1a0b3d;
  font-family: var(--pixel); font-size: 8px; line-height: 1;
}
.marquee__track { display: inline-flex; white-space: nowrap; animation: marquee 22s linear infinite; }
.marquee__track span { padding: 9px 12px 8px; }
@keyframes marquee { to { transform: translateX(-50%); } }

.hub { position: relative; z-index: 1; max-width: 860px; margin: 0 auto; padding: clamp(28px, 6vw, 56px) 20px 48px; }
.hero { text-align: center; margin-bottom: clamp(28px, 5vw, 44px); }
.hero__kicker { font-family: var(--pixel); font-size: 8px; line-height: 2; letter-spacing: 1px; color: #3ee9ff; margin: 0 0 12px; }
.hero__title {
  font-family: var(--pixel); font-size: clamp(26px, 8vw, 62px); line-height: 1.25; margin: 0 0 18px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.hero__title .word { display: inline-flex; gap: 0.14em; }
.hero__title .word:nth-child(3) { font-size: 0.55em; letter-spacing: 0.1em; margin-top: 0.3em; }
.hero__title .l {
  display: inline-block; color: var(--c, #fff);
  text-shadow: 0.06em 0.06em 0 #1a0b3d, 0 0 18px currentColor;
  animation: bounce 1.8s ease-in-out infinite; animation-delay: calc(var(--i) * 0.09s);
}
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-0.18em); } }
.hero__tag { color: #d9d3ee; margin: 0 auto 22px; font-size: clamp(15px, 2.4vw, 18px); line-height: 1.6; max-width: 46ch; }
.hero__cta { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.cta {
  display: inline-block; font-family: var(--pixel); font-size: clamp(9px, 2vw, 12px); text-decoration: none;
  background: #ff5fb0; color: #1a0b3d; padding: 16px 22px; border-radius: 999px;
  box-shadow: 0 6px 0 #a6246e, 0 14px 30px rgba(255, 95, 176, 0.35);
  transition: transform 0.1s, box-shadow 0.1s;
}
.cta:hover { transform: translateY(2px); box-shadow: 0 4px 0 #a6246e, 0 10px 24px rgba(255, 95, 176, 0.4); }
.cta:active { transform: translateY(6px); box-shadow: 0 0 0 #a6246e; }
.blink { font-family: var(--pixel); font-size: 8px; color: #ffd400; animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }

.shelf { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
@media (min-width: 720px) { .shelf { grid-template-columns: repeat(3, 1fr); gap: 20px; } }
.hh {
  display: block; text-decoration: none; color: #1a1a1a;
  background: linear-gradient(180deg, color-mix(in srgb, var(--body) 80%, #fff), var(--body) 40%, color-mix(in srgb, var(--body) 75%, #000));
  border-radius: 22px; padding: 12px 12px 14px;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.55), inset 0 -4px 0 rgba(0, 0, 0, 0.22), 0 18px 34px rgba(0, 0, 0, 0.5);
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
}
.hh:hover, .hh:focus-visible { transform: rotate(0deg) translateY(-8px) scale(1.04); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.55), inset 0 -4px 0 rgba(0, 0, 0, 0.22), 0 28px 44px rgba(0, 0, 0, 0.55); outline: none; }
.hh__screen { background: #1d201b; border-radius: 12px; padding: 8px; box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.6); }
.hh__screen canvas { display: block; width: 100%; aspect-ratio: 1; background: var(--lcd); border-radius: 3px; }
.hh__keys { display: flex; align-items: center; gap: 6px; margin: 10px 2px 8px; }
.k { display: block; border-radius: 50%; width: 12px; height: 12px; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); }
.k--y { background: var(--yellow); }
.k--b { background: var(--blue); width: 18px; height: 18px; margin-left: auto; }
.hh__name { font-family: var(--pixel); font-size: 10px; line-height: 1.5; margin: 0 0 6px; }
.hh__desc { font-size: 12px; line-height: 1.4; margin: 0 0 8px; opacity: 0.8; }
.hh__best { font-family: var(--pixel); font-size: 7px; margin: 0; opacity: 0.75; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 40px 0 0; }
.stat { text-align: center; background: rgba(255, 255, 255, 0.06); border: 2px solid rgba(255, 255, 255, 0.1); border-radius: 14px; padding: 14px 6px; }
.stat b { display: block; font-family: var(--pixel); font-size: clamp(16px, 4vw, 26px); color: #ffd400; margin-bottom: 8px; }
.stat span { font-family: var(--pixel); font-size: 7px; color: #b7aee0; }
.hub__foot { margin-top: 36px; color: #b7aee0; font-size: 13px; line-height: 1.8; text-align: center; }
.hub__foot a { color: #3ee9ff; }
.hub__foot kbd {
  font-family: var(--pixel); font-size: 8px; background: #2a1656; border: 1px solid #4a2c8a;
  border-bottom-width: 3px; border-radius: 5px; padding: 3px 6px; color: var(--text);
}
@media (prefers-reduced-motion: reduce) {
  .marquee__track, .hero__title .l, .blink { animation: none; }
}


/* ---------- Game page: how to play ---------- */
.about { max-width: 640px; margin: 0 auto; padding: 8px 20px 48px; color: #cfd3d8; font-size: 15px; line-height: 1.7; }
.about h2 { font-family: var(--pixel); font-size: 11px; color: var(--lcd); margin: 32px 0 12px; line-height: 1.6; }
.about ol { padding-left: 22px; margin: 0; }
.about li { margin-bottom: 8px; }
.about p { margin: 0 0 14px; }
.about a { color: #3ee9ff; }
.about__more { font-size: 13px; color: #9aa0a6; }

/* ---------- Console ---------- */
.console {
  max-width: 430px;
  margin: 0 auto;
  padding: 12px 14px calc(18px + env(safe-area-inset-bottom));
  min-height: 100dvh;
  background: linear-gradient(180deg, var(--plastic-hi), var(--plastic) 30%, var(--plastic-lo));
  color: #2a2c28;
  display: flex;
  flex-direction: column;
  gap: 12px;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.page-game { touch-action: manipulation; overscroll-behavior: none; }
.screen, .controls { touch-action: none; }
@media (min-width: 480px) {
  .console {
    min-height: 0;
    margin: 24px auto;
    border-radius: 40px;
    padding: 18px 20px 26px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6), inset 0 2px 0 #fff, inset 0 -3px 0 rgba(0, 0, 0, 0.15);
  }
}
.console__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-family: var(--pixel); font-size: 9px; }
.back { text-decoration: none; opacity: 0.65; padding: 6px 0; }
.back:hover { opacity: 1; }
.console__title { font-size: 11px; margin: 0; letter-spacing: 0.5px; }
.chip {
  font: inherit; font-size: 7px; background: #d9d4ca; border: 0; border-radius: 999px; padding: 8px 10px;
  color: #2a2c28; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.15); cursor: pointer;
}
.chip[aria-pressed="false"] { opacity: 0.5; text-decoration: line-through; }

.screen {
  background: var(--bezel);
  border-radius: 16px;
  padding: 10px;
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.6), 0 1px 0 #fff;
}
.screen__inner {
  display: flex;
  justify-content: center;
  background: var(--lcd);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.25), inset 0 0 40px rgba(0, 0, 0, 0.08);
}
.lcd-wrap { position: relative; flex: 0 0 auto; padding: 4px; }
.lcd { display: block; height: min(52vh, 460px); aspect-ratio: var(--cols) / var(--rows); }
.overlay {
  position: absolute; inset: 4px; display: grid; place-items: center; text-align: center;
  font-family: var(--pixel); font-size: 11px; line-height: 1.9; color: var(--ink);
  background: rgba(158, 173, 134, 0.78);
}
.overlay[hidden] { display: none; }
.overlay small { display: block; font-size: 7px; opacity: 0.8; }
.hud {
  flex: 1 1 0; display: flex; flex-direction: column; justify-content: space-evenly;
  padding: 8px 8px; border-left: 2px solid rgba(31, 35, 29, 0.35); min-width: 96px; max-width: 130px;
}
.hud__item span { display: block; font-family: var(--pixel); font-size: 7px; color: rgba(31, 35, 29, 0.85); margin-bottom: 5px; }
.seg svg { height: 22px; width: auto; display: block; }
.seg .on { fill: var(--ink); }
.seg .off { fill: rgba(31, 35, 29, 0.1); }
.hud__item canvas { width: 44px; height: 44px; display: block; }

/* ---------- Controls ---------- */
.controls { display: flex; justify-content: space-between; align-items: center; padding: 4px 2px 0; }
.dpad { --d: min(54px, 14vw); display: grid; grid-template-columns: repeat(3, var(--d)); grid-template-rows: repeat(3, var(--d)); gap: 2px; }
.dpad .up { grid-area: 1 / 2; } .dpad .left { grid-area: 2 / 1; } .dpad .right { grid-area: 2 / 3; } .dpad .down { grid-area: 3 / 2; }
.btn {
  -webkit-tap-highlight-color: transparent; touch-action: none; user-select: none; -webkit-user-select: none;
  border: 0; border-radius: 50%; cursor: pointer; font-family: var(--pixel); font-size: 13px; padding: 0;
  transition: transform 0.05s, box-shadow 0.05s;
}
.btn--dir {
  width: var(--d); height: var(--d); color: #5a3f00;
  background: radial-gradient(circle at 35% 30%, #ffd65a, var(--yellow) 55%, var(--yellow-lo));
  box-shadow: 0 5px 0 var(--yellow-lo), 0 8px 12px rgba(0, 0, 0, 0.3);
}
.btn--action {
  width: min(76px, 20vw); height: min(76px, 20vw);
  background: radial-gradient(circle at 35% 30%, #7fc9ff, var(--blue) 55%, var(--blue-lo));
  box-shadow: 0 6px 0 var(--blue-lo), 0 9px 14px rgba(0, 0, 0, 0.3);
}
.btn.is-down, .btn:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4); }
.actions { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.pills { display: flex; gap: 8px; }
.pill {
  font-family: var(--pixel); font-size: 7px; background: #4b4f48; color: #eee; border: 0; border-radius: 999px;
  padding: 8px 10px; box-shadow: 0 3px 0 #23261f; touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pill.is-down, .pill:active { transform: translateY(2px); box-shadow: 0 1px 0 #23261f; }
.btn-label { font-family: var(--pixel); font-size: 7px; color: #5b5e58; }
.hint { margin: 2px 0 0; text-align: center; font-size: 11px; color: #6b6e68; line-height: 1.6; }
@media (pointer: coarse) { .hint { display: none; } }
