/*
Created at: 2026-11-15 06:38 EST
Created by: Codex
Last Modified at: 2026-11-15 06:38 EST
Last Modified by: Codex
Styles the responsive static handheld with immediate, accessible physical feedback.
*/

:root {
  color-scheme: dark;
  --bg: #080b0c;
  --panel: #121718;
  --panel-hi: #1b2324;
  --line: #364344;
  --ink: #eff8f2;
  --muted: #92a19c;
  --mint: #a7ffd2;
  --mint-deep: #0d2b21;
  --danger: #ff837b;
  --shadow: rgba(0, 0, 0, 0.55);
  font: 100%/1.5 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  min-width: 320px;
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 6%, rgba(67, 150, 112, 0.17), transparent 30rem),
    radial-gradient(circle at 90% 75%, rgba(61, 92, 82, 0.12), transparent 34rem),
    linear-gradient(145deg, #07090a 0%, #0c1112 52%, #080b0c 100%);
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; }

.shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: max(1.25rem, env(safe-area-inset-top)) max(0px, env(safe-area-inset-right))
    max(2.5rem, env(safe-area-inset-bottom)) max(0px, env(safe-area-inset-left));
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.eyebrow {
  margin: 0 0 0.3rem;
  color: var(--mint);
  font: 750 0.69rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.17em;
}

h1 {
  margin: 0;
  font-size: clamp(1.75rem, 4.2vw, 2.9rem);
  line-height: 1;
  letter-spacing: -0.045em;
  font-optical-sizing: auto;
}

h1 span { color: var(--muted); font-weight: 430; }

.runtime-cluster {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.runtime-badge,
.sound-toggle {
  min-height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(12, 17, 18, 0.76);
  font: 750 0.68rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.06em;
}

.runtime-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.85rem;
}

.runtime-badge span {
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0.8rem rgba(167, 255, 210, 0.62);
}

.sound-toggle {
  padding: 0 0.85rem;
  cursor: pointer;
  touch-action: manipulation;
}

.sound-toggle[aria-pressed="true"] { border-color: #47705f; color: var(--mint); }
.sound-toggle:active { transform: scale(0.97); }

.device {
  position: relative;
  padding: 1.75rem;
  overflow: hidden;
  border: 1px solid #3c4849;
  border-radius: 1.9rem;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.045), transparent 25%),
    linear-gradient(160deg, #252c2d 0%, #161b1c 54%, #101415 100%);
  box-shadow: 0 1.5rem 4.4rem var(--shadow), inset 0 1px rgba(255, 255, 255, 0.065);
}

.device::before,
.device::after {
  position: absolute;
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: #687173;
  box-shadow: inset 0 1px 2px #111;
  content: "";
}

.device::before { top: 0.9rem; left: 1rem; }
.device::after { right: 1rem; bottom: 0.9rem; }

.device-mark {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0.1rem 1rem;
  color: #83908e;
  font: 750 0.64rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.15em;
}

.screens {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.1rem;
}

.screen-module {
  min-width: 0;
  padding: 0.75rem;
  border: 1px solid #3e494a;
  border-radius: 1rem;
  background: #0a0e0f;
  box-shadow: inset 0 0 1.4rem #030505;
}

.screen-heading {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0 0.12rem 0.55rem;
  color: #81908e;
  font: 750 0.62rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.07em;
}

.screen-bezel {
  min-width: 0;
  overflow: hidden;
  padding: 0.8rem;
  border: 1px solid #273735;
  border-radius: 0.7rem;
  background: #020504;
  box-shadow: inset 0 0 1.75rem rgba(72, 255, 178, 0.09);
}

canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 2 / 1;
  border-radius: 0.2rem;
  background: #03130f;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 0 0.5rem rgba(167, 255, 210, 0.22));
}

.status-strip {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr 0.85fr;
  gap: 1px;
  margin: 1.05rem 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--line);
}

.status-strip span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  min-height: 2.8rem;
  padding: 0 0.8rem;
  background: #101617;
}

.status-strip b,
.status-strip i {
  font: 750 0.72rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.status-strip b { color: var(--muted); }
.status-strip i { overflow: hidden; color: var(--mint); font-style: normal; text-overflow: ellipsis; }

.control-deck {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 2.25rem;
  padding: 0.45rem 1.75rem 0.25rem;
}

.dpad-panel {
  display: grid;
  grid-template: repeat(3, 4rem) / repeat(3, 4rem);
  justify-content: center;
  user-select: none;
}

.key,
.dpad-center {
  border: 1px solid #4a5657;
  background: linear-gradient(#2a3233, #171d1e);
}

.key {
  min-width: 4rem;
  min-height: 4rem;
  padding: 0;
  color: var(--ink);
  font-size: 1.25rem;
  cursor: pointer;
  touch-action: none;
  box-shadow: 0 0.38rem 0.75rem rgba(0, 0, 0, 0.3), inset 0 1px rgba(255, 255, 255, 0.07);
  transition: transform 90ms ease-out, color 90ms ease-out, background-color 90ms ease-out;
}

.key.active,
.key:active {
  z-index: 1;
  color: var(--mint);
  background: #12271f;
  transform: translateY(0.15rem) scale(0.98);
}

.up { grid-area: 1 / 2; border-radius: 0.7rem 0.7rem 0 0; }
.left { grid-area: 2 / 1; border-radius: 0.7rem 0 0 0.7rem; }
.dpad-center { position: relative; grid-area: 2 / 2; }
.right { grid-area: 2 / 3; border-radius: 0 0.7rem 0.7rem 0; }
.down { grid-area: 3 / 2; border-radius: 0 0 0.7rem 0.7rem; }

.dpad-center span {
  position: absolute;
  inset: 40%;
  border-radius: 50%;
  background: #111617;
  box-shadow: inset 0 1px 2px #050707;
}

.action-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.8rem;
  user-select: none;
}

.round-key {
  position: relative;
  width: 5.2rem;
  height: 5.2rem;
  padding: 0;
  border: 1px solid #566362;
  border-radius: 50%;
  color: var(--ink);
  background: linear-gradient(145deg, #313a3b, #161b1c);
  cursor: pointer;
  touch-action: none;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.38), inset 0 2px rgba(255, 255, 255, 0.07);
  transition: transform 90ms ease-out, border-color 90ms ease-out, color 90ms ease-out;
}

.round-key span,
.round-key small { display: block; }
.round-key span { font: 850 0.78rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.round-key small { margin-top: 0.42rem; color: var(--muted); font-size: 0.56rem; letter-spacing: 0.11em; }

.round-key.active,
.round-key:active {
  color: var(--mint);
  border-color: var(--mint);
  transform: translateY(0.18rem) scale(0.98);
}

.round-key.fire {
  width: 6.5rem;
  height: 6.5rem;
  border-color: #4b755f;
  background: linear-gradient(145deg, #244a3a, #10231b);
}

.round-key.clear { border-color: #704946; }

.round-key.clear i {
  position: absolute;
  inset: -0.28rem;
  border: 2px solid transparent;
  border-top-color: var(--danger);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}

.round-key.clear.charging i {
  opacity: 0.8;
  animation: charge-ring 800ms linear both;
}

@keyframes charge-ring { to { transform: rotate(360deg); } }

.guide {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1.5rem;
  align-items: center;
  margin-top: 1rem;
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(16, 22, 23, 0.82);
  backdrop-filter: blur(1rem) saturate(125%);
}

.guide p:last-child { margin: 0; color: var(--muted); font-size: 0.82rem; line-height: 1.55; }
kbd { padding: 0.12rem 0.34rem; border: 1px solid var(--line); border-radius: 0.28rem; color: var(--ink); background: #070a0b; }

.legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.legend span {
  min-width: 0;
  padding: 0.7rem;
  border: 1px solid #2f3b3c;
  border-radius: 0.7rem;
  color: var(--muted);
  background: #0c1112;
  font-size: 0.72rem;
}

.legend b { color: var(--mint); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding: 1rem 0.25rem 0;
  color: #74817e;
  font: 650 0.65rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.035em;
}

footer p { margin: 0; }
footer p:first-child { max-width: 48rem; }
footer p:last-child { flex: 0 0 auto; }

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

@media (max-width: 760px) {
  .shell {
    width: min(100% - 1rem, 34rem);
    padding-top: max(0.8rem, env(safe-area-inset-top));
  }

  .topbar { align-items: flex-start; gap: 0.8rem; }
  h1 { font-size: 1.78rem; }
  h1 span { display: block; margin-top: 0.3rem; font-size: 0.62em; letter-spacing: -0.02em; }
  .runtime-cluster { flex-direction: column-reverse; align-items: flex-end; gap: 0.35rem; }
  .runtime-badge, .sound-toggle { min-height: 2.25rem; font-size: 0.6rem; }

  .device { padding: 1.15rem 0.7rem 1.35rem; border-radius: 1.45rem; }
  .device-mark { margin-bottom: 0.7rem; font-size: 0.54rem; }
  .device-mark span:last-child { display: none; }
  .screens { grid-template-columns: minmax(0, 1fr); gap: 0.65rem; }
  .screen-module { padding: 0.58rem; border-radius: 0.8rem; }
  .screen-heading { margin-bottom: 0.42rem; font-size: 0.55rem; }
  .screen-bezel { padding: 0.55rem; }

  .status-strip { grid-template-columns: 1.2fr 0.8fr 0.9fr; margin: 0.72rem 0; }
  .status-strip span { min-height: 2.35rem; padding: 0 0.5rem; }
  .status-strip b, .status-strip i { font-size: 0.61rem; }

  .control-deck { grid-template-columns: 1fr 1fr; gap: 0.6rem; padding: 0.2rem 0 0; }
  .dpad-panel { grid-template: repeat(3, 3.2rem) / repeat(3, 3.2rem); }
  .key { min-width: 3.2rem; min-height: 3.2rem; }
  .action-panel { gap: 0.75rem; }
  .round-key { width: 4.25rem; height: 4.25rem; }
  .round-key.fire { width: 5.15rem; height: 5.15rem; }
  .round-key span { font-size: 0.67rem; }
  .round-key small { font-size: 0.48rem; }

  .guide { grid-template-columns: 1fr; gap: 0.9rem; padding: 0.9rem; }
  footer { display: block; }
  footer p:last-child { margin-top: 0.55rem; }
}

@media (max-width: 350px) {
  .shell { width: calc(100% - 0.6rem); }
  .topbar { padding-inline: 0.2rem; }
  .runtime-badge { display: none; }
  .control-deck { gap: 0.2rem; }
  .dpad-panel { grid-template: repeat(3, 3rem) / repeat(3, 3rem); }
  .key { min-width: 3rem; min-height: 3rem; }
  .action-panel { gap: 0.45rem; }
  .round-key { width: 4rem; height: 4rem; }
  .round-key.fire { width: 4.8rem; height: 4.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 1ms !important; transition-duration: 1ms !important; }
}

@media (prefers-reduced-transparency: reduce) {
  .guide { background: #101617; backdrop-filter: none; }
}

@media (prefers-contrast: more) {
  :root { --line: #7c8a87; --muted: #c4cfcb; }
  .device, .screen-module, .guide { border-color: var(--muted); }
}
