:root {
  --bg: #05070d;
  --bg-soft: #0b1020;
  --panel: rgba(255, 255, 255, 0.07);
  --panel-strong: rgba(255, 255, 255, 0.12);
  --text: #f5f7ff;
  --muted: #aeb7ca;
  --line: rgba(255, 255, 255, 0.14);
  --accent: #9be564;
  --accent-2: #7ca7ff;
  --danger: #ff9d9d;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  --radius: 24px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--text);
  background:
    radial-gradient(circle at 10% -10%, rgba(155, 229, 100, 0.24), transparent 28rem),
    radial-gradient(circle at 92% 4%, rgba(124, 167, 255, 0.22), transparent 30rem),
    linear-gradient(180deg, #070a13, var(--bg) 48rem);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.12;
  background-image: linear-gradient(rgba(255,255,255,0.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.08) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
}

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

button, input { font: inherit; }

code {
  padding: 0.1rem 0.32rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  color: #dffbcf;
  background: rgba(0, 0, 0, 0.35);
}

.topbar,
.shell,
.footer,
.player-header,
.player-shell {
  width: min(1280px, calc(100% - 2rem));
  margin-inline: auto;
}

.topbar,
.player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topbar { padding: 1rem 0; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.72rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.55rem;
  height: 2.55rem;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 0.95rem;
  color: #102008;
  background: linear-gradient(135deg, var(--accent), #ddffab);
  box-shadow: 0 14px 35px rgba(155, 229, 100, 0.25);
}

.brand-text { font-size: 1.1rem; }

.topbar-actions,
.player-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.6rem;
  padding: 0 1rem;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #0c1607;
  background: var(--accent);
  font-weight: 850;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}

.icon-button:hover { transform: translateY(-1px); }
.icon-button.muted { color: var(--text); background: rgba(255,255,255,0.08); border-color: var(--line); }

.shell { padding-bottom: 3rem; }

.welcome {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 1.5rem;
  margin-top: 1rem;
  padding: clamp(1.5rem, 4vw, 4rem);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 10px);
  background: linear-gradient(135deg, rgba(255,255,255,0.12), rgba(255,255,255,0.035));
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 0.65rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p { margin-top: 0; }

h1 {
  max-width: 820px;
  margin-bottom: 0.85rem;
  font-size: clamp(2.5rem, 7vw, 6.4rem);
  line-height: 0.92;
  letter-spacing: -0.075em;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 3vw, 2rem);
  letter-spacing: -0.045em;
}

h3 { margin-bottom: 0.6rem; }

.lead {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.counter-card {
  display: grid;
  place-items: center;
  min-width: 9.5rem;
  padding: 1.4rem;
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  background: rgba(0,0,0,0.26);
}

.counter-card strong {
  font-size: 3rem;
  line-height: 1;
  letter-spacing: -0.07em;
}

.counter-card span { color: var(--muted); }

.controls,
.console-strip,
.recent,
.library,
.admin-panel,
.message-card {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 14px 40px rgba(0,0,0,0.18);
}

.controls {
  display: grid;
  grid-template-columns: minmax(260px, 1.3fr) minmax(190px, 0.65fr) minmax(190px, 0.65fr);
  gap: 0.85rem;
  padding: 1rem;
  align-items: end;
}

.console-strip {
  padding: 0.85rem 1rem;
}

.search-box,
.select-box {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.search-box input,
.select-box select {
  width: 100%;
  min-height: 3rem;
  padding: 0 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  outline: none;
  color: var(--text);
  background: rgba(0,0,0,0.32);
}

.select-box select {
  appearance: none;
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 1.15rem) 1.35rem,
    calc(100% - 0.85rem) 1.35rem;
  background-size: 0.35rem 0.35rem, 0.35rem 0.35rem;
  background-repeat: no-repeat;
  padding-right: 2rem;
}

.search-box input:focus,
.select-box select:focus { border-color: rgba(155, 229, 100, 0.85); }

.system-tabs {
  display: flex;
  gap: 0.55rem;
  overflow-x: auto;
  padding-bottom: 0.1rem;
}

.tab {
  flex: 0 0 auto;
  min-height: 2.55rem;
  padding: 0 0.95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255,255,255,0.06);
  cursor: pointer;
}

.tab.active { color: #0c1607; background: var(--accent); border-color: transparent; font-weight: 850; }

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.15rem 0;
}

.section-title p,
.footer p { color: var(--muted); }

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1rem;
  padding: 1.15rem;
}

.game-tile {
  position: relative;
  display: flex;
  min-height: 340px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1.45rem;
  background: rgba(255,255,255,0.055);
  box-shadow: 0 12px 36px rgba(0,0,0,0.22);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.game-tile:hover,
.game-tile:focus-visible {
  transform: translateY(-4px);
  border-color: rgba(155, 229, 100, 0.65);
  background: rgba(255,255,255,0.09);
  outline: none;
}

.game-tile.is-disabled { opacity: 0.65; }
.game-tile.is-disabled:hover { transform: none; border-color: var(--line); }

.tile-cover {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.03), rgba(5,7,13,0.92)),
    radial-gradient(circle at 50% 25%, rgba(155, 229, 100, 0.24), transparent 18rem),
    #10182c;
}

.tile-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tile-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(5,7,13,0.05), rgba(5,7,13,0.82) 58%, rgba(5,7,13,0.96));
}

.tile-initials {
  color: rgba(255,255,255,0.2);
  font-size: 5rem;
  font-weight: 950;
  letter-spacing: -0.12em;
}

.tile-body {
  position: relative;
  z-index: 1;
  align-self: flex-end;
  width: 100%;
  padding: 1rem;
}

.system-pill {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 0.65rem;
  padding: 0.32rem 0.62rem;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  color: var(--text);
  background: rgba(0,0,0,0.38);
  font-size: 0.78rem;
  font-weight: 800;
}

.tile-body h3 {
  margin: 0 0 0.75rem;
  font-size: 1.28rem;
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.tile-details {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-height: 1.7rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 1.55rem;
  padding: 0 0.5rem;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(0,0,0,0.3);
  font-size: 0.76rem;
}

.launch-hint {
  display: flex;
  justify-content: center;
  margin-top: 0.95rem;
  min-height: 2.7rem;
  align-items: center;
  border-radius: 999px;
  color: #0c1607;
  background: var(--accent);
  font-weight: 900;
}

.launch-hint.disabled { color: var(--muted); background: rgba(255,255,255,0.08); border: 1px solid var(--line); }

.recent { padding-bottom: 1rem; }

.recent-list {
  display: flex;
  gap: 0.65rem;
  overflow-x: auto;
  padding: 1rem 1.15rem 0;
}

.recent-chip {
  flex: 0 0 auto;
  padding: 0.7rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.07);
  font-weight: 800;
}

.admin-panel { padding: 1rem; color: var(--muted); }
.admin-panel summary { color: var(--text); cursor: pointer; font-weight: 850; }
.admin-grid { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 1rem; padding-top: 1rem; }
.admin-grid p { line-height: 1.65; }
pre {
  margin: 0;
  overflow: auto;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(0,0,0,0.35);
}
pre code { padding: 0; border: 0; background: transparent; color: #dffbcf; }

.footer { padding: 0 0 2rem; }

.play-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.player-header {
  position: relative;
  z-index: 2;
  width: min(1280px, calc(100% - 1rem));
  margin-top: 0.5rem;
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  background: rgba(5,7,13,0.82);
  backdrop-filter: blur(14px);
}

.player-title {
  display: grid;
  gap: 0.12rem;
  text-align: center;
  color: var(--muted);
}

.player-title strong { color: var(--text); }

.player-shell {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
}

.emulator-frame {
  --player-aspect: 4 / 3;
  --player-aspect-number: 1.3333;
  position: relative;
  width: min(100%, calc((100dvh - 7rem) * var(--player-aspect-number)), 1280px);
  height: auto;
  aspect-ratio: var(--player-aspect);
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  background: #000;
  box-shadow: var(--shadow);
}

#game {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #000;
}

#game canvas,
#game iframe,
#game video {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  max-height: 100%;
}

.boot-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 1rem;
  background:
    radial-gradient(circle at 50% 20%, rgba(155, 229, 100, 0.18), transparent 22rem),
    rgba(0, 0, 0, 0.92);
}

.boot-overlay[hidden] { display: none; }

.boot-card {
  width: min(520px, 100%);
  padding: clamp(1.1rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  background: rgba(255,255,255,0.08);
  text-align: center;
}

.boot-card h1 {
  margin-bottom: 0.65rem;
  font-size: clamp(1.8rem, 5vw, 3.25rem);
  line-height: 0.95;
}

.boot-card p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.55;
}

.boot-actions {
  display: flex;
  justify-content: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.emulator-frame:fullscreen {
  width: 100vw !important;
  height: 100vh !important;
  max-width: none;
  max-height: none;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
}

.emulator-frame:fullscreen #game {
  width: 100vw !important;
  height: 100vh !important;
}

.message-card {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 14px 40px rgba(0,0,0,0.18);
}

.controls {
  display: grid;
  grid-template-columns: minmax(260px, 1.3fr) minmax(190px, 0.65fr) minmax(190px, 0.65fr);
  gap: 0.85rem;
  padding: 1rem;
  align-items: end;
}

.console-strip {
  padding: 0.85rem 1rem;
}

.search-box,
.select-box {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.search-box input,
.select-box select {
  width: 100%;
  min-height: 3rem;
  padding: 0 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  outline: none;
  color: var(--text);
  background: rgba(0,0,0,0.32);
}

.select-box select {
  appearance: none;
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 1.15rem) 1.35rem,
    calc(100% - 0.85rem) 1.35rem;
  background-size: 0.35rem 0.35rem, 0.35rem 0.35rem;
  background-repeat: no-repeat;
  padding-right: 2rem;
}

.search-box input:focus,
.select-box select:focus { border-color: rgba(155, 229, 100, 0.85); }

.system-tabs {
  display: flex;
  gap: 0.55rem;
  overflow-x: auto;
  padding-bottom: 0.1rem;
}

.tab {
  flex: 0 0 auto;
  min-height: 2.55rem;
  padding: 0 0.95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255,255,255,0.06);
  cursor: pointer;
}

.tab.active { color: #0c1607; background: var(--accent); border-color: transparent; font-weight: 850; }

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.15rem 0;
}

.section-title p,
.footer p { color: var(--muted); }

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1rem;
  padding: 1.15rem;
}

.game-tile {
  position: relative;
  display: flex;
  min-height: 340px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1.45rem;
  background: rgba(255,255,255,0.055);
  box-shadow: 0 12px 36px rgba(0,0,0,0.22);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.game-tile:hover,
.game-tile:focus-visible {
  transform: translateY(-4px);
  border-color: rgba(155, 229, 100, 0.65);
  background: rgba(255,255,255,0.09);
  outline: none;
}

.game-tile.is-disabled { opacity: 0.65; }
.game-tile.is-disabled:hover { transform: none; border-color: var(--line); }

.tile-cover {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.03), rgba(5,7,13,0.92)),
    radial-gradient(circle at 50% 25%, rgba(155, 229, 100, 0.24), transparent 18rem),
    #10182c;
}

.tile-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tile-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(5,7,13,0.05), rgba(5,7,13,0.82) 58%, rgba(5,7,13,0.96));
}

.tile-initials {
  color: rgba(255,255,255,0.2);
  font-size: 5rem;
  font-weight: 950;
  letter-spacing: -0.12em;
}

.tile-body {
  position: relative;
  z-index: 1;
  align-self: flex-end;
  width: 100%;
  padding: 1rem;
}

.system-pill {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 0.65rem;
  padding: 0.32rem 0.62rem;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  color: var(--text);
  background: rgba(0,0,0,0.38);
  font-size: 0.78rem;
  font-weight: 800;
}

.tile-body h3 {
  margin: 0 0 0.75rem;
  font-size: 1.28rem;
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.tile-details {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-height: 1.7rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 1.55rem;
  padding: 0 0.5rem;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(0,0,0,0.3);
  font-size: 0.76rem;
}

.launch-hint {
  display: flex;
  justify-content: center;
  margin-top: 0.95rem;
  min-height: 2.7rem;
  align-items: center;
  border-radius: 999px;
  color: #0c1607;
  background: var(--accent);
  font-weight: 900;
}

.launch-hint.disabled { color: var(--muted); background: rgba(255,255,255,0.08); border: 1px solid var(--line); }

.recent { padding-bottom: 1rem; }

.recent-list {
  display: flex;
  gap: 0.65rem;
  overflow-x: auto;
  padding: 1rem 1.15rem 0;
}

.recent-chip {
  flex: 0 0 auto;
  padding: 0.7rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.07);
  font-weight: 800;
}

.admin-panel { padding: 1rem; color: var(--muted); }
.admin-panel summary { color: var(--text); cursor: pointer; font-weight: 850; }
.admin-grid { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 1rem; padding-top: 1rem; }
.admin-grid p { line-height: 1.65; }
pre {
  margin: 0;
  overflow: auto;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(0,0,0,0.35);
}
pre code { padding: 0; border: 0; background: transparent; color: #dffbcf; }

.footer { padding: 0 0 2rem; }

.play-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.player-header {
  position: relative;
  z-index: 2;
  width: min(1500px, calc(100% - 1rem));
  margin-top: 0.5rem;
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  background: rgba(5,7,13,0.82);
  backdrop-filter: blur(14px);
}

.player-title {
  display: grid;
  gap: 0.12rem;
  text-align: center;
  color: var(--muted);
}

.player-title strong { color: var(--text); }

.player-shell {
  width: min(1500px, calc(100% - 1rem));
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.emulator-frame {
  --player-aspect: 4 / 3;
  --player-aspect-number: 1.3333;
  position: relative;
  width: min(100%, calc((100dvh - 7rem) * var(--player-aspect-number)), 1280px);
  aspect-ratio: var(--player-aspect);
  height: auto;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  background: #000;
  box-shadow: var(--shadow);
}

#game {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
}

#game canvas,
#game iframe,
#game video {
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  max-height: 100%;
}

.boot-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 1rem;
  background:
    radial-gradient(circle at 50% 20%, rgba(155, 229, 100, 0.18), transparent 22rem),
    rgba(0, 0, 0, 0.92);
}

.boot-overlay[hidden] { display: none; }

.boot-card {
  width: min(520px, 100%);
  padding: clamp(1.1rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  background: rgba(255,255,255,0.08);
  text-align: center;
}

.boot-card h1 {
  margin-bottom: 0.65rem;
  font-size: clamp(1.8rem, 5vw, 3.25rem);
  line-height: 0.95;
}

.boot-card p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.55;
}

.boot-actions {
  display: flex;
  justify-content: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.emulator-frame:fullscreen {
  width: 100vw !important;
  height: 100vh !important;
  max-width: none;
  max-height: none;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
}

.message-card {
  padding: 1.25rem;
  color: var(--muted);
}

.message-card h1,
.message-card h3 { color: var(--text); }

@media (max-width: 860px) {
  .topbar,
  .player-header { flex-wrap: wrap; }
  .topbar-actions,
  .player-actions { width: 100%; }
  .topbar-actions .icon-button,
  .player-actions .icon-button { flex: 1; }
  .welcome { grid-template-columns: 1fr; align-items: stretch; }
  .counter-card { place-items: start; }
  .controls { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 0.75rem; padding: 0.9rem; }
  .game-tile { min-height: 285px; }
  .tile-initials { font-size: 4rem; }
}

@media (max-width: 520px) {
  .topbar,
  .shell,
  .footer { width: min(100% - 1rem, 1280px); }
  .brand-text { display: none; }
  .play-page { overflow: auto; }
  .player-shell { min-height: 60dvh; align-items: start; }
  .emulator-frame { width: 100%; margin-top: 0.5rem; }
  .welcome { padding: 1.25rem; }
  h1 { font-size: clamp(2.15rem, 12vw, 3.4rem); }
  .lead { font-size: 0.98rem; }
  .game-grid { grid-template-columns: 1fr 1fr; }
  .game-tile { min-height: 245px; border-radius: 1.1rem; }
  .tile-body { padding: 0.75rem; }
  .tile-body h3 { font-size: 1rem; }
  .launch-hint { min-height: 2.3rem; margin-top: 0.7rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

/* --- RetroJS player hardening: do not resize EmulatorJS internal controls. --- */
.play-page {
  overflow: hidden;
}

.player-header {
  width: min(1500px, calc(100% - 1rem));
}

.player-shell {
  width: min(1500px, calc(100% - 1rem));
  margin-inline: auto;
  padding: 0.5rem 0;
}

.emulator-frame {
  position: relative;
  width: min(100%, 1280px);
  height: 720px;
  max-width: 100%;
  max-height: calc(100dvh - 6rem);
  aspect-ratio: auto;
  overflow: hidden;
  background: #000;
}

#game {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
}

#game canvas,
#game iframe,
#game video {
  max-width: none;
  max-height: none;
}

.boot-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
}

.boot-overlay[hidden] {
  display: none !important;
}

.icon-button:disabled {
  opacity: 0.45;
  cursor: wait;
  transform: none;
}

.emulator-frame:fullscreen,
.emulator-frame:-webkit-full-screen {
  width: 100vw !important;
  height: 100vh !important;
  max-width: none !important;
  max-height: none !important;
  border: 0;
  border-radius: 0;
}

.emulator-frame:fullscreen #game,
.emulator-frame:-webkit-full-screen #game {
  width: 100vw !important;
  height: 100vh !important;
}


/* --- RetroJS menu fix: do not stretch EmulatorJS UI controls. ---
   Keep the rendering surfaces sized to the frame, but let EmulatorJS position
   its own menus/toolbars. The old #game > * rule made the internal control
   overlay take the whole player area, which placed the menu in the middle. */
#game canvas,
#game iframe,
#game video {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

#game button,
#game input,
#game select,
#game [role="button"] {
  width: auto;
  height: auto;
}


/* --- RetroJS volume fix: hide the persistent EmulatorJS volume slider. ---
   EmulatorJS keeps a range input visible in the bottom toolbar on some browsers.
   We only target range inputs inside #game so the site UI outside the player is not affected. */
#game input[type="range"] {
  opacity: 0 !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  margin-inline: 0 !important;
  padding-inline: 0 !important;
  pointer-events: none !important;
}

/* Keep the small volume icon/control usable if EmulatorJS wraps the slider in a volume element. */
#game [class*="volume"]:hover input[type="range"],
#game [class*="Volume"]:hover input[type="range"],
#game input[type="range"]:focus {
  opacity: 1 !important;
  width: 72px !important;
  min-width: 72px !important;
  max-width: 72px !important;
  pointer-events: auto !important;
}
