/* ==================== Base ==================== */
:root {
  --shell-bg-1: #d9d5d0;
  --shell-bg-2: #bcb7af;
  --shell-border: #2c2c2c;

  --screen-bezel: #2f2f2f;
  --screen-green: #4a7844;

  --accent: #00ff88;
  --accent-2: #00ccff;

  --shadow-deep: rgba(0,0,0,0.55);
  --shadow-soft: rgba(0,0,0,0.25);
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: radial-gradient(circle at 50% 20%, #2a2a2a, #141414);
  font-family: monospace;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  /* mejor UX en mobile */
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

button,
input,
textarea {
  font-family: monospace;
}

/* ==================== Consola GameBoy ==================== */
.console-shell {
  background: linear-gradient(to bottom, var(--shell-bg-1), var(--shell-bg-2));
  border: 9px solid var(--shell-border);
  border-radius: 26px;

  box-shadow:
    0 18px 46px var(--shadow-deep),
    0 5px 14px var(--shadow-soft),
    inset -6px -6px 10px rgba(255,255,255,0.22),
    inset 6px 6px 12px rgba(0,0,0,0.12);

  padding: 0;
  max-width: 400px;
  width: min(92vw, 400px);
  margin: 0;

  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}


/* brillo sutil “plástico” */
.console-shell::before {
  content: "";
  position: absolute;
  inset: 14px 14px auto 14px;
  height: 70px;
  border-radius: 22px;
  background: linear-gradient(
    to bottom,
    rgba(255,255,255,0.35),
    rgba(255,255,255,0)
  );
  pointer-events: none;
  opacity: 0.35;
}
/* Logo tipo GameBoy — físico, grabado (más pequeño y realista) */
.console-shell .brand {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);

  font-family: monospace;
  font-size: 0.9rem;        /* 🔽 más chico */
  font-weight: 800;
  letter-spacing: 1.1px;      /* 🔽 menos aire */

  color: #4a4a4a;

  /* Grabado en plástico */
  text-shadow:
    1px 1px 0 rgba(255,255,255,0.55),
   -1px -1px 0 rgba(0,0,0,0.35),
    0 1px 1px rgba(0,0,0,0.25);

  opacity: 0.75;

  pointer-events: none;
  user-select: none;

  filter: contrast(1.02) saturate(0.85) blur(0.2px);
}


/* Tornillos decorativos (solo abajo, más realista) */
.console-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  background:
    radial-gradient(circle at calc(100% - 18px) calc(100% - 18px),
      #1a1a1a 0 3px, transparent 4px);
  opacity: 0.45;
}


/* ==================== Contenido principal ==================== */
.container-flex {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  text-align: center;
  padding-top: 30px; /* deja aire bajo el “logo” */
}

/* ==================== Pantalla ==================== */
.canvas-wrapper {
  position: relative;
  width: 95%;

  /* 🔽 MÁS BAJA (clave del arreglo) */
  aspect-ratio: 4 / 4.3; /* ← antes era demasiado alto */

  background: var(--screen-green);
  border: 6px inset var(--screen-bezel);
  border-radius: 14px;
  padding: 0.45rem;

  box-shadow:
    inset 0 0 10px rgba(0,0,0,0.65),
    0 6px 14px rgba(0,0,0,0.35);
}


/* marco interior como “vidrio” */
.canvas-wrapper::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 10px;
  border: 1px solid rgba(0,255,136,0.35);
  box-shadow: inset 0 0 18px rgba(0,255,136,0.12);
  pointer-events: none;
  z-index: 6;
}

canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  display: block;
  background-color: #000;
  border-radius: 10px;
}

/* Efecto CRT más suave (no ensucia) */
.canvas-wrapper::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 10px;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.06),
    rgba(0, 0, 0, 0.06) 1px,
    transparent 2px,
    transparent 5px
  );
  pointer-events: none;
  z-index: 7;
  opacity: 0.7;
}

/* ==================== Enlaces sobre canvas ==================== */
.project-links {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 8;
}

.project-links a {
  position: absolute;
  pointer-events: auto;
  font-size: 12px;
  color: var(--accent-2);
  text-decoration: underline;
  white-space: nowrap;
  transition: color 0.2s, text-shadow 0.2s;
}

.project-links a:hover {
  color: #ffff00;
  text-shadow: 0 0 6px rgba(255,255,0,0.7);
}

/* ==================== Formulario sobre canvas ==================== */
.contact-form {
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  background: rgba(0, 0, 0, 0.86);
  padding: 0.9rem;
  border: 1px solid var(--accent);
  border-radius: 10px;
  z-index: 9;
  display: flex;
  flex-direction: column;
  gap: 10px;

  /* ✅ más estrecho y más bonito */
  width: min(82%, 320px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.55);
}

.contact-form input,
.contact-form textarea {
  background-color: #000;
  color: var(--accent);
  border: 1px solid rgba(0,255,136,0.75);
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 14px;
  resize: none;
  outline: none;
}

.contact-form textarea {
  min-height: 90px;
}

.contact-form input:focus,
.contact-form textarea:focus {
  box-shadow: 0 0 0 2px rgba(0,255,136,0.22);
  border-color: var(--accent);
}

.contact-form button {
  background-color: #0a74ff;
  color: white;
  border: none;
  padding: 10px;
  cursor: pointer;
  font-size: 14px;
  border-radius: 10px;
  transition: transform 0.08s ease, filter 0.12s ease;
}

.contact-form button:hover {
  filter: brightness(1.07);
}

.contact-form button:active {
  transform: translateY(1px);
  filter: brightness(0.92);
}

/* ==================== Interacción (UX): Pointer + Focus ==================== */
.btn,
.start-select button,
.contact-form button,
.switch-audio .slider {
  cursor: pointer;
}

/* foco bonito (accesible) */
.btn:focus-visible,
.start-select button:focus-visible,
.contact-form button:focus-visible {
  outline: 2px solid rgba(0,255,136,0.65);
  outline-offset: 3px;
}

/* ==================== D-Pad y Botones ==================== */
.gameboy-controls {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 2.4rem;
  margin-top: 1.1rem;
  flex-wrap: wrap;
}

.dpad {
  display: grid;
  grid-template-columns: 52px 52px 52px;
  grid-template-rows: 52px 52px 52px;
  gap: 6px;
}

#btn-up { grid-column: 2; grid-row: 1; }
#btn-left { grid-column: 1; grid-row: 2; }
#btn-right { grid-column: 3; grid-row: 2; }
#btn-down { grid-column: 2; grid-row: 3; }

.btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  font-size: 18px;
  font-weight: bold;
  background: radial-gradient(circle at 30% 30%, #8a8a8a, #3f3f3f);
  color: white;
  box-shadow:
    inset -2px -2px 5px rgba(255,255,255,0.22),
    inset 2px 2px 6px rgba(0,0,0,0.55),
    0 6px 10px rgba(0,0,0,0.45);
  transition: transform 0.08s ease, filter 0.12s ease, box-shadow 0.12s ease;
}

.btn:hover {
  filter: brightness(1.06);
}

.btn:active {
  transform: translateY(2px) scale(0.97);
  box-shadow:
    inset 2px 2px 7px rgba(0,0,0,0.55),
    inset -1px -1px 3px rgba(255,255,255,0.18),
    0 3px 7px rgba(0,0,0,0.4);
}

/* A y B en diagonal */
.ab-buttons {
  position: relative;
  width: 130px;
  height: 110px;
}

.btn-a {
  position: absolute;
  top: 0;
  right: 0;
  background: radial-gradient(circle at 30% 30%, #ff4d4d, #8f0000);
}

.btn-b {
  position: absolute;
  bottom: 0;
  left: 0;
  background: radial-gradient(circle at 30% 30%, #4d4dff, #00008a);
}

/* ==================== Start y Select ==================== */
.start-select {
  display: flex;
  gap: 1rem;
  margin-top: 0.85rem;
  align-items: center;
}

.start-select button {
  background: #3f3f3f;
  color: #eee;
  border-radius: 14px;
  padding: 7px 22px;
  font-size: 12px;
  border: none;
  box-shadow:
    inset -1px -1px 2px rgba(255,255,255,0.18),
    inset 1px 1px 2px rgba(0,0,0,0.55),
    0 4px 9px rgba(0,0,0,0.25);
  transition: transform 0.08s ease, filter 0.12s ease;
  cursor: pointer;
}

.start-select button:hover {
  filter: brightness(1.05);
}

.start-select button:active {
  transform: translateY(2px);
  filter: brightness(0.95);
}

/* ==================== Parlante inferior ==================== */
.parlante {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
}

.parlante div {
  width: 4px;
  height: 24px;
  background: #222;
  border-radius: 2px;
  box-shadow:
    inset -1px -1px 2px rgba(255,255,255,0.18),
    inset 1px 1px 2px rgba(0,0,0,0.55);
}

/* ==================== Switch audio ==================== */
.switch-audio {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
  margin-left: 10px;
}

.switch-audio input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  background-color: #444;
  border: 2px solid #888;
  border-radius: 15px;
  inset: 0;
  transition: all 0.25s ease;
}

.slider:before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: linear-gradient(to bottom, var(--shell-bg-1), var(--shell-bg-2));
  border-radius: 50%;
  transition: transform 0.25s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.35);
}

input:checked + .slider {
  background-color: #111;
}

input:checked + .slider:before {
  transform: translateX(24px);
}

.slider:after {
  content: "🔇";
  position: absolute;
  top: 0px;
  left: 25px;
  font-size: 16px;
  transition: transform 0.25s ease;
}

input:checked + .slider:after {
  content: "🔊";
  transform: translateX(-22px);
}

/* ==================== Accesibilidad SEO ==================== */
.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;
}

/* ==================== Responsive: pantallas pequeñas ==================== */
@media (max-height: 740px) {
  .console-shell {
    transform: scale(0.95);
    transform-origin: center;
  }
}

.contact-toast {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 110px; /* sobre el footer */
  width: min(420px, 85%);
  padding: 12px 14px;
  border: 1px solid rgba(0, 255, 136, 0.75);
  background: rgba(0, 0, 0, 0.85);
  color: #00ff88;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.3;
  border-radius: 12px;
  box-shadow: 0 0 18px rgba(0, 255, 136, 0.18);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
  z-index: 50;
}

.contact-toast[data-kind="err"] {
  border-color: rgba(255, 70, 70, 0.8);
  color: rgba(255, 210, 210, 0.95);
  box-shadow: 0 0 18px rgba(255, 70, 70, 0.12);
}
