@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* ── Palette ────────────────────────────────────────── */
:root {
  --gb0: #0f380f;
  --gb1: #306230;
  --gb2: #8bac0f;
  --gb3: #9bbc0f;
  --body: #c4c4b8;
  --body-shadow: #9a9a8e;
  --body-dark: #7a7a6e;
  --bezel: #282828;
  --btn-purple: #6a5acd;
  --btn-purple-dark: #483d8b;
}

/* ── Reset ──────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
a { text-decoration: none; }
button { border: none; cursor: pointer; font-family: inherit; }

/* ── Page ───────────────────────────────────────────── */
html, body {
  min-height: 100vh;
  background: #111;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  gap: 12px;
}

.page-hint {
  font-family: 'Press Start 2P', monospace;
  font-size: 6px;
  color: #444;
  text-align: center;
  letter-spacing: 1px;
}

/* ── Game Boy Shell ─────────────────────────────────── */
.gameboy {
  position: relative;
  margin: 8px;
  width: 320px;
  background: var(--body);
  border-radius: 18px 18px 18px 60px;
  padding: 18px 20px 24px;
  display: flex;
  flex-direction: column;
  box-shadow:
    inset 0 2px 4px rgba(255,255,255,0.6),
    inset 0 -2px 4px rgba(0,0,0,0.15),
    4px 4px 0 var(--body-shadow),
    6px 6px 0 var(--body-dark),
    10px 10px 20px rgba(0,0,0,0.5);
}

.gb-top-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 5px;
  color: var(--body-dark);
  letter-spacing: 2px;
  text-align: right;
  margin-bottom: 4px;
  opacity: 0.7;
}

/* Power LED */
.power-led {
  position: absolute;
  top: 48px;
  left: 24px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff3333;
  box-shadow: 0 0 6px #ff3333, 0 0 10px rgba(255,51,51,0.5);
  animation: led-pulse 2s ease-in-out infinite;
}

@keyframes led-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ── Screen Bezel ───────────────────────────────────── */
.screen-bezel {
  background: var(--bezel);
  border-radius: 10px;
  padding: 12px 14px 18px;
  margin-bottom: 14px;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.8);
}

.screen-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 4.5px;
  color: #555;
  text-align: center;
  letter-spacing: 1.5px;
  margin-bottom: 10px;
}

.screen-frame {
  position: relative;
  border: 3px solid #1a1a1a;
  border-radius: 2px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px #000,
    inset 0 0 20px rgba(0,0,0,0.4);
}

/* ── The Screen (GB display) ────────────────────────── */
.screen {
  position: relative;
  width: 100%;
  aspect-ratio: 160 / 144;
  background: var(--gb0);
  overflow: hidden;
  image-rendering: pixelated;
}

/* CRT scanline overlay */
.screen::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 2px,
    rgba(0,0,0,0.08) 2px,
    rgba(0,0,0,0.08) 3px
  );
  pointer-events: none;
  z-index: 50;
}

/* Screen glare */
.screen-glare {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(
    135deg,
    rgba(255,255,255,0.06) 0%,
    transparent 60%
  );
  pointer-events: none;
  z-index: 51;
}

/* ── GB Screens (sections) ──────────────────────────── */
.gb-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 10px 8px 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  font-family: 'Press Start 2P', monospace;
  color: var(--gb3);
}

.gb-screen.active {
  opacity: 1;
  pointer-events: auto;
}

.gb-screen.fade-out {
  opacity: 0;
  transition: opacity 0.1s ease;
}

/* ── Title Screen ───────────────────────────────────── */
#screen-title {
  align-items: center;
  justify-content: space-between;
  background: var(--gb0);
}

.title-art {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.title-logo {
  font-size: 16px;
  line-height: 1.5;
  text-align: center;
  color: var(--gb3);
  text-shadow: 2px 2px 0 var(--gb1);
  animation: title-glow 3s ease-in-out infinite;
}

.title-logo span {
  color: var(--gb2);
}

.title-sub {
  font-size: 7px;
  color: var(--gb2);
  letter-spacing: 6px;
}

@keyframes title-glow {
  0%, 100% { text-shadow: 2px 2px 0 var(--gb1); }
  50% { text-shadow: 2px 2px 0 var(--gb1), 0 0 12px rgba(155,188,15,0.4); }
}

.title-press {
  font-size: 6px;
  color: var(--gb2);
  text-align: center;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.title-footer {
  font-size: 5px;
  color: var(--gb1);
  text-align: center;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

/* ── Main Menu ──────────────────────────────────────── */
#screen-menu {
  justify-content: space-between;
  background: var(--gb0);
}

.menu-header {
  font-size: 9px;
  color: var(--gb3);
  text-align: center;
  letter-spacing: 2px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gb1);
  margin-bottom: 4px;
}

.menu-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  justify-content: center;
  padding: 0 4px;
}

.menu-item {
  font-size: 7px;
  color: var(--gb2);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px;
  transition: color 0.05s;
  user-select: none;
}

.menu-item.selected {
  color: var(--gb3);
}

.menu-item .cursor {
  opacity: 0;
  font-size: 6px;
  flex-shrink: 0;
  width: 8px;
}

.menu-item.selected .cursor {
  opacity: 1;
  animation: cursor-blink 0.6s step-end infinite;
}

@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.menu-hint {
  font-size: 4.5px;
  color: var(--gb1);
  text-align: center;
  letter-spacing: 0.5px;
}

/* ── Content Screens (About, Services, Contact) ─────── */
.content-title {
  font-size: 7px;
  color: var(--gb3);
  letter-spacing: 1px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--gb1);
  margin-bottom: 8px;
  flex-shrink: 0;
}

.content-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

.content-body p {
  font-size: 5.5px;
  color: var(--gb2);
  line-height: 1.8;
}

.content-hint {
  font-size: 4.5px;
  color: var(--gb1);
  text-align: right;
  margin-top: 6px;
  flex-shrink: 0;
}

/* ── Services ───────────────────────────────────────── */
.services-list {
  list-style: none;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
}

.services-list li {
  font-size: 5.5px;
  color: var(--gb2);
  padding-left: 10px;
  position: relative;
  line-height: 1.6;
}

.services-list li::before {
  content: '▶';
  position: absolute;
  left: 0;
  top: 1px;
  font-size: 4px;
  color: var(--gb3);
}

/* ── Contact ────────────────────────────────────────── */
.contact-body {
  align-items: center;
  text-align: center;
}

.contact-icon {
  font-size: 14px;
  color: var(--gb3);
  margin: 4px 0;
}

.contact-email {
  display: block;
  font-size: 6px;
  color: var(--gb3);
  line-height: 2;
  border: 1px solid var(--gb1);
  padding: 6px 4px;
  margin-top: 4px;
  animation: link-pulse 2s ease-in-out infinite;
}

.contact-email:hover {
  background: var(--gb1);
  color: var(--gb0);
}

@keyframes link-pulse {
  0%, 100% { border-color: var(--gb1); }
  50% { border-color: var(--gb3); }
}

/* ── Game Screen ────────────────────────────────────── */
#screen-game {
  padding: 0;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ── Controls Area ──────────────────────────────────── */
.controls-area {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  margin-bottom: 8px;
}

/* D-Pad */
.dpad-wrap {
  flex-shrink: 0;
}

.dpad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.dpad-up-row,
.dpad-down-row {
  display: flex;
  justify-content: center;
}

.dpad-mid-row {
  display: flex;
  align-items: center;
}

.dpad-btn {
  width: 26px;
  height: 26px;
  background: #4a4a4a;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.05s;
}

.dpad-btn:active,
.dpad-btn.pressed {
  background: #2a2a2a;
}

.dpad-up { border-radius: 4px 4px 0 0; }
.dpad-down { border-radius: 0 0 4px 4px; }
.dpad-left { border-radius: 4px 0 0 4px; }
.dpad-right { border-radius: 0 4px 4px 0; }

.dpad-center {
  width: 26px;
  height: 26px;
  background: #4a4a4a;
}

/* Start / Select */
.meta-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
}

.meta-btn {
  background: #5a5a5a;
  border-radius: 10px;
  font-family: 'Press Start 2P', monospace;
  font-size: 4px;
  color: #aaa;
  padding: 4px 8px;
  letter-spacing: 1px;
  border: 1px solid #3a3a3a;
  cursor: pointer;
  transition: background 0.05s;
}

.meta-btn:active,
.meta-btn.pressed {
  background: #3a3a3a;
}

/* A/B Buttons */
.ab-wrap {
  flex-shrink: 0;
}

.ab-buttons {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  transform: rotate(-15deg);
}

.ab-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--btn-purple);
  color: #ddd;
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 0 var(--btn-purple-dark);
  transition: transform 0.05s, box-shadow 0.05s;
  cursor: pointer;
}

.ab-btn:active,
.ab-btn.pressed {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--btn-purple-dark);
}

.btn-b { margin-bottom: 8px; }

/* ── Speaker Grille ─────────────────────────────────── */
.speaker-grille {
  display: flex;
  gap: 4px;
  transform: rotate(-45deg);
  align-self: flex-end;
  margin-right: 10px;
  margin-bottom: 10px;
}

.speaker-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.speaker-col span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--body-dark);
  display: block;
  box-shadow: inset 0 1px 1px rgba(0,0,0,0.4);
}


/* ── Shared Animations ──────────────────────────────── */
.blink {
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 360px) {
  .gameboy { width: 290px; }
}

/* Shrink on short viewports */
@media (max-height: 680px) {
  .gameboy { zoom: 0.85; }
}

/* Scale up on tablet and above */
@media (min-width: 600px) and (min-height: 681px) {
  .gameboy { zoom: 1.35; }
  .page-hint { font-size: 8px; }
}

@media (min-width: 900px) and (min-height: 750px) {
  .gameboy { zoom: 1.7; }
  .page-hint { font-size: 10px; }
}

@media (min-width: 1200px) and (min-height: 900px) {
  .gameboy { zoom: 1.85; }
  .page-hint { font-size: 12px; }
}
