/* ===========================================================
   ATELIER MONDO · pixel-art world explorer
   Coherent with portfolio (dark + cream + cinnabar)
   =========================================================== */

:root {
  --ink: #0d0c0a;
  --ink-2: #161410;
  --ink-3: #1f1b15;
  --cream: #efe9dc;
  --cream-dim: #cfc8b9;
  --muted: #857f73;
  --line: rgba(239, 233, 220, 0.10);
  --line-strong: rgba(239, 233, 220, 0.18);
  --accent: #ff5e2b;
  --accent-dim: rgba(255, 94, 43, 0.18);
  --pad-x: clamp(1rem, 4vw, 3rem);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--cream);
  font-family: 'Manrope', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100dvh;
}

body {
  display: flex;
  flex-direction: column;
  touch-action: manipulation;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
::selection { background: var(--accent); color: var(--ink); }

.font-display { font-family: 'Instrument Serif', serif; font-weight: 400; }
.font-mono    { font-family: 'JetBrains Mono', monospace; }
.dim          { color: var(--muted); }
.italic       { font-style: italic; }

.kbd {
  display: inline-block;
  padding: 1px 6px;
  margin: 0 2px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: rgba(239, 233, 220, 0.04);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--cream);
  line-height: 1.4;
  vertical-align: middle;
}

/* ============== ORIENTATION LOCK (mobile portrait) ============== */
.orient-lock {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background:
    radial-gradient(circle at 75% 80%, rgba(255, 94, 43, 0.10), transparent 55%),
    linear-gradient(180deg, #0a0908 0%, #050504 100%);
  color: var(--cream);
  text-align: center;
}
.orient-lock::before,
.orient-lock::after {
  content: "";
  position: absolute;
  background: var(--accent);
  pointer-events: none;
}
.orient-lock::before { top: 22px; left: 22px;  width: 22px; height: 1px; }
.orient-lock::after  { bottom: 22px; right: 22px; width: 22px; height: 1px; }

.orient-card {
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

.orient-icon {
  color: var(--accent);
  width: 86px;
  height: 86px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 14px rgba(255, 94, 43, 0.35));
  animation: orientRotate 2.6s cubic-bezier(0.65, 0, 0.35, 1) infinite;
  transform-origin: center;
}
@keyframes orientRotate {
  0%, 35%   { transform: rotate(0deg); }
  55%, 80%  { transform: rotate(-90deg); }
  100%      { transform: rotate(-90deg); }
}

.orient-tag {
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: 0.4rem;
}

.orient-title {
  font-size: clamp(1.6rem, 7vw, 2.1rem);
  line-height: 1;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--cream);
}
.orient-title em { color: var(--accent); font-style: italic; }

.orient-msg {
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  line-height: 1.55;
  color: var(--cream-dim);
  margin: 0;
}

/* show only on real mobile in portrait */
@media (max-width: 880px) and (orientation: portrait) {
  .orient-lock { display: flex; }
  body { overflow: hidden; }
}

/* mobile landscape — make the world frame fill the viewport */
@media (max-width: 880px) and (orientation: landscape) {
  .mondo-nav,
  .mondo-head,
  .mondo-legend,
  .mondo-foot { display: none; }

  .mondo-main {
    padding: 0;
    gap: 0;
    height: 100dvh;
  }

  .world-stage { width: 100%; height: 100%; }

  .world-frame {
    width: 100%;
    height: 100dvh;
    max-width: none;
    aspect-ratio: auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .fullscreen-btn { top: 8px; left: 8px; }
  .world-hud      { top: 8px; right: 8px; font-size: 9px; }

  /* touch controls — compact + corners, well visible on small landscape */
  .touch-controls {
    display: flex;
    padding: 0 12px 12px;
    z-index: 4;
  }
  .dpad        { width: 96px; height: 96px; }
  .touch-action {
    width: 56px;
    height: 56px;
    font-size: 17px;
    box-shadow: 0 6px 18px -2px rgba(255, 94, 43, 0.65);
  }
  .dpad-btn { background: rgba(22, 20, 16, 0.92); }
}

/* ============== GRAIN ============== */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/></filter><rect width='200' height='200' filter='url(%23n)' opacity='1'/></svg>");
}

/* ============== NAV ============== */
.mondo-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem var(--pad-x);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.mondo-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  transition: color 0.3s, gap 0.3s;
}
.mondo-back:hover { color: var(--cream); gap: 0.75rem; }
.back-arrow { font-size: 14px; }
.mondo-nav-mark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  justify-self: center;
}
.mondo-nav-mark .font-display { font-size: 1.1rem; line-height: 1; letter-spacing: -0.01em; }
.mondo-nav-mark .font-mono    { color: var(--muted); font-size: 9px; letter-spacing: 0.3em; }
.mondo-nav-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  justify-self: end;
  color: var(--cream);
  font-size: 11px;
  letter-spacing: 0.25em;
}
.status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  animation: pulse 2.5s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,94,43,0.5); }
  70%  { box-shadow: 0 0 0 8px rgba(255,94,43,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,94,43,0); }
}

@media (max-width: 720px) {
  .mondo-nav { grid-template-columns: auto 1fr; gap: 0.5rem; }
  .mondo-nav-mark { display: none; }
  .mondo-back { font-size: 9px; letter-spacing: 0.15em; }
  .back-text { display: none; }
  .mondo-nav-meta { font-size: 9px; letter-spacing: 0.15em; }
}

/* ============== MAIN HEAD ============== */
.mondo-main {
  flex: 1;
  padding: clamp(1.5rem, 4vw, 3rem) var(--pad-x) clamp(2rem, 5vw, 4rem);
  display: flex;
  flex-direction: column;
  gap: clamp(1.25rem, 3vw, 2rem);
}

.mondo-head {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 980px;
}
.mondo-eyebrow {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}
.mondo-title {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--cream);
}
.mondo-title em { color: var(--accent); font-style: italic; }
.mondo-sub {
  color: var(--cream-dim);
  font-size: 14px;
  line-height: 1.6;
  max-width: 70ch;
  margin: 0.25rem 0 0;
}

/* ============== WORLD STAGE ============== */
.world-stage {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

.world-frame {
  position: relative;
  width: min(100%, 1100px);
  aspect-ratio: 16 / 10;
  background: var(--ink-2);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.6) inset,
    0 30px 80px -20px rgba(0,0,0,0.9);
}

/* When the frame goes fullscreen, fill the screen and remove the aspect cap */
.world-frame:fullscreen,
.world-frame:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  aspect-ratio: auto;
  border-radius: 0;
  background: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
}
.world-frame:fullscreen #world,
.world-frame:-webkit-full-screen #world {
  width: auto;
  height: 100%;
  max-width: 100%;
}

#world {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #2c3a2a; /* erba di base */
}

/* HUD top-right */
.world-hud {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(13, 12, 10, 0.78);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  padding: 8px 12px;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
}
.hud-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.hud-row .dim { color: var(--muted); }
.hud-row span:not(.dim) { color: var(--cream); }

@media (max-width: 720px) {
  .world-hud { top: 8px; right: 8px; padding: 6px 9px; font-size: 9px; gap: 2px; }
  .world-hud .hud-row { gap: 5px; }
}

/* Interact hint floating above player */
.interact-hint {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  background: rgba(13, 12, 10, 0.92);
  border: 1px solid var(--accent);
  border-radius: 3px;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  pointer-events: none;
  transform: translate(-50%, -100%);
  white-space: nowrap;
  z-index: 3;
  animation: bob 1.6s ease-in-out infinite;
}
.interact-hint[hidden] { display: none; }
@keyframes bob {
  0%, 100% { transform: translate(-50%, -100%); }
  50%      { transform: translate(-50%, calc(-100% - 4px)); }
}

/* Player name label — floats above the avatar's head */
.player-name {
  position: absolute;
  transform: translate(-50%, -100%);
  padding: 2px 7px;
  background: rgba(13, 12, 10, 0.85);
  border: 1px solid var(--accent);
  color: var(--cream);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border-radius: 2px;
  pointer-events: none;
  z-index: 2;
  white-space: nowrap;
  line-height: 1.4;
  text-shadow: 0 1px 0 rgba(0,0,0,0.5);
}
.player-name::before {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid var(--accent);
}

/* ============== HORDE MODE ============== */

/* horde activate button — top-left, next to fullscreen */
.horde-btn {
  position: absolute;
  top: 14px;
  left: 56px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px 6px;
  background: rgba(13, 12, 10, 0.85);
  border: 1px solid var(--accent);
  border-radius: 3px;
  color: var(--cream);
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  cursor: pointer;
  z-index: 4;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.25s, transform 0.2s, box-shadow 0.3s;
  -webkit-tap-highlight-color: transparent;
}
.horde-btn:hover {
  background: rgba(255, 94, 43, 0.18);
  box-shadow: 0 0 16px -2px rgba(255, 94, 43, 0.6);
}
.horde-btn:active { transform: scale(0.96); }
.horde-btn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px rgba(255, 94, 43, 0.7);
  animation: pulse 2.5s ease-out infinite;
}
.horde-btn.is-active {
  background: var(--accent);
  color: var(--ink);
  border-color: var(--accent);
}
.horde-btn.is-active .horde-btn-dot {
  background: var(--ink);
  box-shadow: none;
  animation: none;
}
@media (max-width: 720px) {
  .horde-btn { top: 8px; left: 44px; padding: 5px 8px 4px; font-size: 8px; letter-spacing: 0.16em; gap: 6px; }
  .horde-btn-dot { width: 6px; height: 6px; }
}

/* horde HUD — below the world-hud, top-right */
.horde-hud {
  position: absolute;
  top: 100px;
  right: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(13, 12, 10, 0.82);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 8px 12px;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  z-index: 3;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
}
.horde-hud[hidden] { display: none; }
.horde-hud-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.horde-hud-row .dim   { color: var(--muted); }
.horde-hud-row span:not(.dim) { color: var(--cream); }
.horde-hud-row:nth-child(3) span:not(.dim) { color: var(--accent); letter-spacing: 0.05em; }
@media (max-width: 720px) {
  .horde-hud { top: 80px; right: 8px; padding: 6px 9px; font-size: 9px; }
}

/* wave-start banner */
.horde-banner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  z-index: 4;
  background: rgba(13, 12, 10, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: hordeBannerIn 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: none;
}
.horde-banner[hidden] { display: none; }
@keyframes hordeBannerIn {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}
.horde-banner-tag {
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--accent);
}
.horde-banner-title {
  font-size: clamp(2.5rem, 7vw, 4.5rem);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--cream);
  text-shadow: 0 4px 18px rgba(0,0,0,0.7);
}
.horde-banner-title em { font-style: italic; color: var(--accent); }
.horde-banner-sub {
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--cream-dim);
  margin-top: 6px;
}

/* end overlay (game over / victory) */
.horde-end {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 6;
  background: rgba(13, 12, 10, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: hordeBannerIn 0.4s ease-out;
}
.horde-end[hidden] { display: none; }
.horde-end-card {
  width: min(440px, 100%);
  background: var(--ink);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 1.5rem 1.75rem 1.25rem;
  text-align: left;
  position: relative;
}
.horde-end-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 42px;
  height: 2px;
  background: var(--accent);
}
.horde-end-tag {
  display: block;
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.4rem;
}
.horde-end-title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1;
  margin: 0 0 0.6rem;
  color: var(--cream);
}
.horde-end-title em { color: var(--accent); font-style: italic; }
.horde-end-msg {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cream-dim);
  margin: 0 0 1.1rem;
}
.horde-end-actions {
  display: flex;
  gap: 0.5rem;
}
.horde-end-btn {
  padding: 0.55rem 1rem;
  background: var(--accent);
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  font-weight: 500;
  border-radius: 3px;
  transition: transform 0.15s;
}
.horde-end-btn:active { transform: scale(0.96); }
.horde-end-btn-ghost {
  background: transparent;
  color: var(--cream-dim);
  border: 1px solid var(--line-strong);
}
.horde-end-btn-ghost:hover { color: var(--cream); border-color: var(--cream-dim); }

/* damage flash on the frame */
.world-frame.is-hurt::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 50%, rgba(255, 60, 60, 0.4) 100%);
  animation: hordeHurt 0.32s ease-out;
  z-index: 2;
}
@keyframes hordeHurt {
  0%   { opacity: 0; }
  50%  { opacity: 1; }
  100% { opacity: 0; }
}

/* Fullscreen button — top-right of the frame */
.fullscreen-btn {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 12, 10, 0.78);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  color: var(--cream-dim);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  z-index: 3;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.fullscreen-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(13, 12, 10, 0.92);
}
.fullscreen-btn:active { transform: scale(0.94); }
@media (max-width: 720px) {
  .fullscreen-btn { width: 28px; height: 28px; top: 8px; left: 8px; font-size: 14px; }
}

/* ============== DIALOG ============== */
.dialog {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  z-index: 4;
  background: linear-gradient(to top, rgba(13, 12, 10, 0.85) 0%, rgba(13, 12, 10, 0.0) 60%);
  animation: dialogIn 0.3s ease-out;
}
.dialog[hidden] { display: none; }
@keyframes dialogIn { from { opacity: 0; } to { opacity: 1; } }
.dialog-card {
  width: min(560px, 100%);
  background: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 1.25rem 1.5rem 1rem;
  box-shadow: 0 20px 60px -10px rgba(0,0,0,0.9);
  position: relative;
}
.dialog-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 32px;
  height: 2px;
  background: var(--accent);
}
.dialog-tag {
  display: block;
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.dialog-title {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  line-height: 1;
  margin: 0 0 0.75rem;
  color: var(--cream);
}
.dialog-title em { color: var(--accent); font-style: italic; }
.dialog-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--cream-dim);
  margin-bottom: 1rem;
}
.dialog-body strong { color: var(--cream); font-weight: 600; }
.dialog-body em { color: var(--cream); font-style: italic; }
.dialog-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 0.75rem;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.dialog-close {
  color: var(--muted);
  transition: color 0.2s;
}
.dialog-close:hover { color: var(--cream); }
.dialog-link {
  color: var(--accent);
  transition: opacity 0.2s, transform 0.2s;
}
.dialog-link:hover { transform: translateX(2px); }
.dialog-link[hidden] { display: none; }

/* ============== INTRO OVERLAY ============== */
.intro {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(13, 12, 10, 0.85);
  z-index: 5;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.intro.is-hidden { display: none; }
.intro-card {
  width: min(520px, 100%);
  background: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 1.75rem 2rem;
  text-align: left;
  position: relative;
}
.intro-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 48px;
  height: 2px;
  background: var(--accent);
}
.intro-tag {
  display: block;
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.intro-title {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  line-height: 1;
  margin: 0 0 0.75rem;
  color: var(--cream);
}
.intro-title em { color: var(--accent); font-style: italic; }
.intro-msg {
  font-size: 13px;
  line-height: 1.6;
  color: var(--cream-dim);
  margin: 0 0 1.25rem;
}
.intro-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  background: var(--accent);
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  border-radius: 3px;
  font-weight: 500;
  transition: transform 0.2s, box-shadow 0.2s;
}
.intro-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px -6px rgba(255, 94, 43, 0.6);
}

/* ============== TOUCH CONTROLS (overlay inside frame) ============== */
.touch-controls {
  display: none;
  position: absolute;
  inset: auto 0 0 0;
  padding: 0 14px 14px;
  pointer-events: none;
  z-index: 3;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
}
.touch-controls > * { pointer-events: auto; }

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 4px;
  width: 116px;
  height: 116px;
}
.dpad-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(22, 20, 16, 0.85);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--cream);
  font-size: 18px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.dpad-btn:active,
.dpad-btn.is-active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}
.dpad-up    { grid-column: 2; grid-row: 1; }
.dpad-left  { grid-column: 1; grid-row: 2; }
.dpad-right { grid-column: 3; grid-row: 2; }
.dpad-down  { grid-column: 2; grid-row: 3; }

.touch-action {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  font-weight: 600;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 6px 18px -2px rgba(255, 94, 43, 0.55);
  transition: transform 0.1s;
}
.touch-action:active { transform: scale(0.94); }

/* show on touch devices and on any mobile-sized viewport */
@media (hover: none) and (pointer: coarse) {
  .touch-controls { display: flex; }
}
@media (max-width: 880px) {
  .touch-controls { display: flex; padding: 0 10px 10px; }
  .dpad { width: 104px; height: 104px; }
  .touch-action { width: 58px; height: 58px; font-size: 18px; }
}

/* ============== LEGEND ============== */
.mondo-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--cream-dim);
  padding-top: 0.5rem;
}
.leg-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: middle;
}

/* ============== FOOT ============== */
.mondo-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem var(--pad-x);
  border-top: 1px solid var(--line);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--cream-dim);
}
.foot-link { color: var(--muted); transition: color 0.3s; }
.foot-link:hover { color: var(--cream); }
.foot-mid { text-align: center; flex: 1; }
@media (max-width: 720px) {
  .mondo-foot { flex-direction: column; text-align: center; font-size: 9px; gap: 0.5rem; }
  .foot-mid { display: none; }
}
