:root {
  --plastic: #d9d4ca;
  --shell: #f2efe8;
  --ink: #22202e;
  --lcd: #a7b85a;
  --berry: #b3245b;

  --ink-soft: color-mix(in srgb, var(--ink) 68%, transparent);
  --ink-line: color-mix(in srgb, var(--ink) 16%, transparent);

  --font-pixel: "Press Start 2P", "Noto Sans SC", monospace;
  --font-body: "Noto Sans SC", system-ui, sans-serif;

  --radius: 14px;
  --shadow: 0 1px 0 color-mix(in srgb, var(--shell) 80%, transparent) inset,
    0 24px 48px -24px color-mix(in srgb, var(--ink) 45%, transparent);
}

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

html {
  background: var(--plastic);
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--plastic);
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3,
p {
  margin: 0;
}

button {
  font: inherit;
  color: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 100;
  padding: 8px 16px;
  background: var(--ink);
  color: var(--shell);
  border-radius: 8px;
}

.skip-link:focus {
  top: 16px;
}

:focus-visible {
  outline: 3px solid var(--berry);
  outline-offset: 3px;
}

.container {
  width: min(1160px, 100% - 40px);
  margin-inline: auto;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--plastic) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--ink-line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 28px;
  height: 32px;
  border-radius: 4px 4px 10px 4px;
  background: var(--ink);
  box-shadow: inset 0 0 0 5px var(--ink), inset 0 0 0 14px var(--lcd);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-en {
  font-family: var(--font-pixel);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.brand-zh {
  font-size: 12px;
  color: var(--ink-soft);
}

.site-nav {
  display: flex;
  gap: 8px;
}

.site-nav a {
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  transition: background-color 0.2s;
}

.site-nav a:hover {
  background: var(--shell);
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: var(--shell);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.nav-toggle-bar,
.nav-toggle-bar::before,
.nav-toggle-bar::after {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  position: relative;
}

.nav-toggle-bar::before,
.nav-toggle-bar::after {
  content: "";
  position: absolute;
  left: 0;
}

.nav-toggle-bar::before {
  top: -6px;
}

.nav-toggle-bar::after {
  top: 6px;
}

@media (max-width: 720px) {
  .nav-toggle {
    display: flex;
  }

  .site-nav {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    padding: 12px 20px 20px;
    background: var(--plastic);
    border-bottom: 1px solid var(--ink-line);
    display: none;
  }

  .site-nav.is-open {
    display: flex;
  }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, background-color 0.2s;
}

.btn-primary {
  background: var(--ink);
  color: var(--shell);
  box-shadow: 0 4px 0 var(--berry);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 var(--berry);
}

.btn-primary:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--berry);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
}

.btn-ghost:hover {
  background: var(--shell);
}

.btn-block {
  width: 100%;
}

/* ---------- Hero ---------- */
.hero {
  padding: 56px 0 96px;
}

.hero-grid {
  display: grid;
  gap: 56px;
  align-items: center;
}

@media (min-width: 960px) {
  .hero-grid {
    grid-template-columns: 1fr 420px;
    gap: 72px;
  }
}

.hero-copy {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.eyebrow {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--berry);
}

.hero-title {
  font-size: clamp(44px, 8vw, 84px);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.hero-lead {
  max-width: 34em;
  font-size: 18px;
  line-height: 1.7;
  color: var(--ink-soft);
  text-wrap: pretty;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.controls-hint {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin: 8px 0 0;
  padding-top: 20px;
  border-top: 1px dashed var(--ink-line);
  font-size: 14px;
}

.controls-hint div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.controls-hint dt {
  display: flex;
  gap: 4px;
  align-items: center;
}

.controls-hint dd {
  margin: 0;
  color: var(--ink-soft);
}

kbd {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--shell);
  border: 1px solid var(--ink-line);
  border-bottom-width: 3px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
}

/* ---------- The Console ---------- */
.console-wrap {
  display: flex;
  justify-content: center;
}

.console {
  position: relative;
  width: min(400px, 100%);
  padding: 0 26px 30px;
  background: var(--shell);
  border-radius: 18px 18px 72px 18px;
  box-shadow: var(--shadow),
    inset 0 -6px 0 color-mix(in srgb, var(--ink) 8%, transparent);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.console.is-inserting {
  animation: bump 0.45s ease;
}

@keyframes bump {
  0%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(6px);
  }
  60% {
    transform: translateY(-2px);
  }
}

.console-top {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  margin: 0 -26px 14px;
  border-bottom: 2px solid var(--ink-line);
}

.console-slot {
  position: absolute;
  top: 0;
  left: 50%;
  width: 70%;
  height: 6px;
  transform: translateX(-50%);
  border-radius: 0 0 4px 4px;
  background: var(--ink);
  opacity: 0.85;
}

.cart-label {
  font-family: var(--font-pixel);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  padding-top: 6px;
}

.bezel {
  padding: 14px 30px 26px;
  border-radius: 10px 10px 40px 10px;
  background: color-mix(in srgb, var(--ink) 82%, var(--shell));
}

.bezel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--berry) 30%, var(--ink));
  transition: background-color 0.3s, box-shadow 0.3s;
}

.led.is-on {
  background: var(--berry);
  box-shadow: 0 0 8px var(--berry);
}

.bezel-text {
  flex: 1;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: color-mix(in srgb, var(--shell) 60%, transparent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lcd {
  display: block;
  width: 100%;
  aspect-ratio: 160 / 144;
  height: auto;
  background: var(--lcd);
  border-radius: 2px;
  image-rendering: pixelated;
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ink) 30%, transparent);
}

.console-logo {
  margin: 12px 0 22px 4px;
  font-family: var(--font-pixel);
  font-size: 12px;
  color: var(--ink);
  font-style: italic;
}

.console-logo span {
  color: var(--berry);
}

.console-logo sup {
  font-size: 6px;
  font-style: normal;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 38px);
  grid-template-rows: repeat(3, 38px);
}

.dpad-btn,
.dpad-center {
  background: var(--ink);
  border: 0;
  cursor: pointer;
  touch-action: none;
}

.dpad-btn.up {
  grid-area: 1 / 2;
  border-radius: 6px 6px 0 0;
}

.dpad-btn.left {
  grid-area: 2 / 1;
  border-radius: 6px 0 0 6px;
}

.dpad-center {
  grid-area: 2 / 2;
}

.dpad-btn.right {
  grid-area: 2 / 3;
  border-radius: 0 6px 6px 0;
}

.dpad-btn.down {
  grid-area: 3 / 2;
  border-radius: 0 0 6px 6px;
}

.dpad-btn.is-down,
.round-btn.is-down,
.pill-btn.is-down {
  filter: brightness(1.6);
  transform: scale(0.94);
}

.ab {
  display: flex;
  gap: 18px;
  transform: rotate(-24deg);
  padding: 14px 16px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 7%, transparent);
}

.ab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--ink-soft);
}

.ab-item.a {
  margin-top: -18px;
}

.round-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 0;
  background: var(--berry);
  box-shadow: 0 4px 0 color-mix(in srgb, var(--berry) 60%, var(--ink));
  cursor: pointer;
  touch-action: none;
  transition: transform 0.05s;
}

.bottom-row {
  position: relative;
  display: flex;
  justify-content: center;
  margin-top: 30px;
}

.pills {
  display: flex;
  gap: 22px;
  margin-right: 60px;
}

.pill-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transform: rotate(-24deg);
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--ink-soft);
}

.pill-btn {
  width: 46px;
  height: 12px;
  border-radius: 999px;
  border: 0;
  background: color-mix(in srgb, var(--ink) 70%, var(--shell));
  cursor: pointer;
  touch-action: none;
}

.speaker {
  position: absolute;
  right: 0;
  bottom: -6px;
  display: flex;
  gap: 6px;
  transform: rotate(-28deg);
}

.speaker span {
  width: 5px;
  height: 46px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 22%, transparent);
  box-shadow: inset 0 2px 2px color-mix(in srgb, var(--ink) 35%, transparent);
}

/* ---------- Sections ---------- */
.section {
  padding: 96px 0;
}

.section-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  max-width: 640px;
  margin-bottom: 48px;
}

.section-title {
  font-size: clamp(30px, 5vw, 46px);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.section-lead {
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.7;
  text-wrap: pretty;
}

/* ---------- Cartridges ---------- */
.carts {
  background: var(--ink);
  color: var(--shell);
}

.carts .section-lead {
  color: color-mix(in srgb, var(--shell) 72%, transparent);
}

.carts .eyebrow {
  color: var(--lcd);
}

.cart-grid {
  display: grid;
  gap: 28px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 720px) {
  .cart-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.cart {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 22px 18px 18px;
  background: color-mix(in srgb, var(--ink) 20%, var(--plastic));
  color: var(--ink);
  clip-path: polygon(0 0, calc(100% - 36px) 0, 100% 36px, 100% 100%, 0 100%);
  border-radius: 6px 0 6px 6px;
  transition: transform 0.25s ease;
}

.cart:hover {
  transform: translateY(-6px);
}

.cart.is-active {
  background: var(--shell);
}

.cart-ridges {
  position: absolute;
  top: 6px;
  left: 18px;
  right: 54px;
  height: 8px;
  background: repeating-linear-gradient(
    90deg,
    color-mix(in srgb, var(--ink) 25%, transparent) 0 3px,
    transparent 3px 8px
  );
}

.cart-art {
  overflow: hidden;
  border-radius: 4px;
  border: 6px solid var(--ink);
  background: var(--lcd);
}

.cart-art img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  transform: scale(1.14);
}

.cart-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  padding-top: 18px;
}

.cart-code {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--berry);
}

.cart-name {
  font-size: 24px;
  font-weight: 900;
}

.cart-desc {
  color: var(--ink-soft);
  font-size: 15px;
  flex: 1;
}

.cart-tags {
  display: flex;
  gap: 8px;
  margin: 4px 0 8px;
  padding: 0;
  list-style: none;
}

.cart-tags li {
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--ink-line);
  font-size: 13px;
  font-weight: 500;
}

/* ---------- Scoreboard ---------- */
.scores-grid {
  display: grid;
  gap: 40px;
}

@media (min-width: 960px) {
  .scores-grid {
    grid-template-columns: 1fr 1.1fr;
    align-items: start;
  }

  .scores-grid .section-head {
    margin-bottom: 0;
    position: sticky;
    top: 100px;
  }
}

.board {
  padding: 20px;
  background: var(--shell);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 6px;
  margin-bottom: 18px;
  border-radius: 999px;
  background: var(--plastic);
}

.tab {
  flex: 1;
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

.tab[aria-selected="true"] {
  background: var(--ink);
  color: var(--shell);
}

.board-panel {
  padding: 18px;
  border-radius: 8px;
  background: var(--lcd);
  border: 6px solid var(--ink);
  min-height: 300px;
}

.board-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-pixel);
  font-size: 12px;
  color: var(--ink);
}

.board-list li {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  border-bottom: 2px dotted color-mix(in srgb, var(--ink) 35%, transparent);
}

.board-list li:first-child {
  background: var(--ink);
  color: var(--lcd);
  border-bottom-color: transparent;
}

.board-list .date {
  font-size: 9px;
  opacity: 0.75;
}

.board-list li.empty {
  display: block;
  padding: 72px 10px;
  text-align: center;
  line-height: 2;
  background: transparent;
  color: var(--ink);
  border: 0;
}

.board-list li.is-new {
  animation: blink 0.5s steps(2) 4;
}

@keyframes blink {
  50% {
    opacity: 0.2;
  }
}

/* ---------- Timeline ---------- */
.history {
  border-top: 1px solid var(--ink-line);
}

.timeline {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 2px solid var(--ink);
}

@media (min-width: 720px) {
  .timeline {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1040px) {
  .timeline {
    grid-template-columns: repeat(4, 1fr);
  }
}

.timeline-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 26px 22px 30px 0;
  border-bottom: 1px solid var(--ink-line);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.timeline-item.is-visible {
  opacity: 1;
  transform: none;
}

.timeline-item .year {
  font-family: var(--font-pixel);
  font-size: 22px;
  color: var(--berry);
}

.timeline-item h3 {
  font-size: 19px;
  font-weight: 900;
}

.timeline-item p:last-child {
  color: var(--ink-soft);
  font-size: 15px;
}

/* ---------- Footer ---------- */
.site-footer {
  padding: 40px 0;
  background: var(--ink);
  color: var(--shell);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.footer-brand {
  font-family: var(--font-pixel);
  font-size: 11px;
  color: var(--lcd);
}

.footer-note {
  font-size: 14px;
  color: color-mix(in srgb, var(--shell) 70%, transparent);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  html {
    scroll-behavior: auto;
  }

  .timeline-item {
    opacity: 1;
    transform: none;
  }
}
