:root {
  color-scheme: light;
  --ink: #263238;
  --muted: #66736e;
  --cream: #fff8e8;
  --paper: #ffffff;
  --teal: #287b82;
  --coral: #ef7f68;
  --green: #4f9d69;
  --sun: #ffd24d;
  --line: rgba(38, 50, 56, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  background: linear-gradient(180deg, #fff8e8, #f3e7c8);
  color: var(--ink);
  font-family: "Trebuchet MS", Arial, sans-serif;
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

.arcade-header,
.arcade-footer {
  align-items: center;
  background: rgba(255, 248, 232, 0.94);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: space-between;
  padding: 0.9rem clamp(1rem, 4vw, 2.5rem);
}

.arcade-footer {
  border-bottom: 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  justify-content: center;
}

.brand {
  font-size: 1.2rem;
  font-weight: 900;
}

.arcade-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.arcade-nav a,
.back-link,
.control-pad button {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  font-weight: 900;
  min-height: 48px;
  padding: 0.7rem 0.9rem;
}

.arcade-nav a:hover,
.arcade-nav a:focus-visible,
.back-link:hover,
.back-link:focus-visible,
.control-pad button:active {
  background: var(--sun);
  outline: none;
}

.classic-shell {
  display: grid;
  gap: 1rem;
  margin: 0 auto;
  max-width: 1120px;
  padding: clamp(1rem, 4vw, 2rem);
}

.intro {
  text-align: center;
}

.intro h1,
.marquee-title {
  font-size: clamp(2rem, 8vw, 4.2rem);
  line-height: 1;
  margin: 0;
}

.intro p,
.marquee-subtitle {
  color: var(--muted);
  font-size: clamp(1.05rem, 3vw, 1.25rem);
  line-height: 1.35;
  margin: 0.5rem auto 0;
  max-width: 42rem;
}

.classic-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
}

.classic-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 24px rgba(38, 50, 56, 0.09);
  display: grid;
  gap: 0.5rem;
  min-height: 10rem;
  padding: 1.1rem;
}

.classic-card:hover,
.classic-card:focus-visible {
  border-color: var(--coral);
  outline: none;
  transform: translateY(-2px);
}

.classic-card strong {
  font-size: 1.25rem;
}

.classic-card span {
  color: var(--muted);
  line-height: 1.35;
}

.game-wrap {
  background: #17212b;
  border: 4px solid rgba(40, 123, 130, 0.26);
  border-radius: 8px;
  box-shadow: 0 20px 42px rgba(38, 50, 56, 0.2);
  padding: clamp(0.55rem, 2vw, 1rem);
}

.screen-frame {
  margin: 0 auto;
  max-width: min(100%, 800px);
}

#gameCanvas {
  aspect-ratio: 4 / 3;
  background: #050518;
  border-radius: 6px;
  display: block;
  height: auto;
  image-rendering: pixelated;
  max-height: calc(100svh - 18rem);
  width: 100%;
}

.control-pad {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 0.8rem auto 0;
  max-width: 800px;
}

.control-pad button[data-key=" "] {
  background: var(--coral);
  color: #ffffff;
}

.thumb-controls {
  display: none;
}

@media (max-width: 640px) {
  .arcade-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .control-pad {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-top: 0.7rem;
    min-height: 132px;
  }

  .control-pad > button {
    display: none;
  }

  .thumb-controls {
    align-items: center;
    display: flex;
    gap: clamp(1rem, 8vw, 2.8rem);
    justify-content: space-between;
    width: 100%;
  }

  .arcade-action {
    align-items: center;
    aspect-ratio: 1;
    background:
      radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 28%),
      linear-gradient(145deg, #ff987f, #e95f48 58%, #bb3f31);
    border: 0;
    border-radius: 999px;
    box-shadow:
      inset 0 5px 9px rgba(255, 255, 255, 0.48),
      inset 0 -10px 14px rgba(95, 29, 18, 0.36),
      0 10px 0 #9b3228,
      0 16px 24px rgba(38, 50, 56, 0.28);
    color: #ffffff;
    display: grid;
    flex: 0 0 clamp(96px, 26vw, 124px);
    font-size: 1rem;
    font-weight: 900;
    gap: 0.1rem;
    justify-items: center;
    min-height: 96px;
    padding: 0.9rem;
    text-shadow: 0 2px 0 rgba(90, 30, 24, 0.34);
    touch-action: none;
    transform: translateY(-4px);
  }

  .arcade-action.is-pressed,
  .arcade-action:active {
    box-shadow:
      inset 0 3px 8px rgba(255, 255, 255, 0.34),
      inset 0 -6px 10px rgba(95, 29, 18, 0.42),
      0 5px 0 #9b3228,
      0 10px 16px rgba(38, 50, 56, 0.22);
    transform: translateY(2px);
  }

  .action-icon {
    font-size: 2.1rem;
    line-height: 1;
  }

  .thumb-stick {
    align-items: center;
    display: grid;
    flex: 0 0 clamp(132px, 36vw, 168px);
    gap: 0.35rem;
    justify-items: center;
    touch-action: none;
    user-select: none;
  }

  .stick-ring {
    aspect-ratio: 1;
    background:
      radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0) 37%),
      linear-gradient(145deg, #fef9ea, #d7cab2);
    border: 5px solid rgba(38, 50, 56, 0.88);
    border-radius: 999px;
    box-shadow:
      inset 0 7px 12px rgba(255, 255, 255, 0.78),
      inset 0 -10px 18px rgba(64, 48, 35, 0.28),
      0 8px 0 rgba(38, 50, 56, 0.28),
      0 16px 24px rgba(38, 50, 56, 0.18);
    position: relative;
    width: 100%;
  }

  .stick-knob {
    background:
      radial-gradient(circle at 34% 25%, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0) 23%),
      linear-gradient(145deg, #334155, #111827 66%, #020617);
    border: 4px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    box-shadow:
      inset 0 4px 8px rgba(255, 255, 255, 0.18),
      inset 0 -9px 13px rgba(0, 0, 0, 0.42),
      0 8px 12px rgba(0, 0, 0, 0.32);
    height: 48%;
    left: 50%;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 48%;
  }

  .thumb-stick.is-active .stick-ring {
    border-color: var(--teal);
  }

  .stick-label {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 900;
  }
}
