:root {
  color-scheme: light;
  --ink: #2d3b4f;
  --ink-strong: #202d3e;
  --muted: #7d8ca2;
  --soft: #f6faff;
  --card: rgba(255, 255, 255, .92);
  --line: #e6edf6;
  --blue: #4a8df6;
  --blue-soft: #e9f2ff;
  --green: #5dbc86;
  --orange: #e7a25d;
  --purple: #bd76d7;
  --shadow: 0 16px 38px rgba(93, 122, 158, .18);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--soft);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, #f9fcff 0%, #f4f8fe 46%, #fbfdff 100%);
}

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

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button {
  appearance: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(16px, 3vw, 36px);
  background: rgba(255, 255, 255, .88);
  border-bottom: 1px solid rgba(221, 231, 244, .9);
  backdrop-filter: blur(16px);
}

body[data-page="home"] .topbar {
  display: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand img {
  flex: 0 0 auto;
}

.brand strong,
.play-title strong {
  display: block;
  color: var(--ink-strong);
  font-size: 16px;
  line-height: 1.1;
}

.brand small,
.play-title span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topnav a,
.back-link,
.text-link,
.category-all {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--blue);
  font-weight: 700;
}

.text-link::after,
.category-all::after {
  content: ">";
  font-size: 15px;
}

.home-main {
  width: 100%;
  margin: 0;
}

.hero {
  min-height: clamp(360px, 34vw, 490px);
  display: grid;
  place-items: center;
  padding: clamp(44px, 7vw, 92px) 20px 82px;
  background:
    linear-gradient(180deg, rgba(247, 252, 255, .12) 0%, rgba(247, 252, 255, .34) 58%, rgba(247, 252, 255, .9) 100%),
    url("hero-seaside.jpg") center center / cover no-repeat;
}

.hero-copy {
  width: min(760px, 100%);
  display: grid;
  justify-items: center;
  text-align: center;
  transform: translateY(-8px);
}

.hero-copy h1 {
  margin: 0 0 18px;
  color: rgba(41, 54, 72, .9);
  font-size: clamp(30px, 3.6vw, 47px);
  font-weight: 500;
  line-height: 1.16;
  letter-spacing: 0;
}

.lead {
  max-width: 680px;
  margin: 0;
  color: rgba(77, 91, 113, .86);
  font-size: clamp(15px, 1.4vw, 18px);
  line-height: 1.7;
}

.searchbox {
  width: min(640px, 100%);
  min-height: 58px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-top: 42px;
  padding: 0 24px;
  border: 1px solid rgba(211, 224, 241, .82);
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 14px 40px rgba(94, 128, 165, .18);
  backdrop-filter: blur(12px);
}

.searchbox span {
  width: 18px;
  height: 18px;
  border: 3px solid #60728d;
  border-radius: 50%;
  position: relative;
}

.searchbox span::after {
  content: "";
  position: absolute;
  right: -7px;
  bottom: -6px;
  width: 9px;
  height: 3px;
  border-radius: 99px;
  background: #60728d;
  transform: rotate(45deg);
}

.searchbox input {
  width: 100%;
  min-width: 0;
  color: var(--ink-strong);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 16px;
}

.searchbox input::placeholder {
  color: #9aa8bb;
}

.home-shell {
  width: min(1530px, calc(100vw - 64px));
  margin: 0 auto;
  padding: 38px 0 26px;
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 34px;
  align-items: start;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 0 26px;
}

.section-head h2,
.category-card h2 {
  margin: 0;
  color: var(--ink-strong);
  font-size: 22px;
  line-height: 1.2;
  font-weight: 800;
}

.section-head h2 {
  position: relative;
  padding-left: 18px;
}

.section-head h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: 4px;
  border-radius: 99px;
  background: var(--blue);
}

.game-grid {
  display: grid;
  gap: 28px;
}

.featured-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.library-grid {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 20px;
}

.game-card {
  min-height: 340px;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: 0 10px 28px rgba(81, 105, 137, .12);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.game-card:hover,
.game-card:focus-visible {
  transform: translateY(-3px);
  border-color: #c8dbf5;
  box-shadow: 0 18px 38px rgba(73, 102, 140, .18);
  outline: 0;
}

.game-thumb {
  position: relative;
  min-height: 0;
  aspect-ratio: 1 / 1.14;
  overflow: hidden;
  background: #dce9f7;
}

.thumb-img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

.hover-img {
  z-index: 2;
  opacity: 0;
  transition: opacity .18s ease;
}

.game-card:hover .hover-img,
.game-card:focus-visible .hover-img {
  opacity: 1;
}

.card-body {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 12px;
  padding: 16px 14px 14px;
}

.game-card h3 {
  margin: 0;
  color: var(--ink-strong);
  font-size: 18px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.card-meta span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.start-button {
  align-self: end;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #dfe8f4;
  border-radius: 999px;
  color: var(--blue);
  background: rgba(255, 255, 255, .82);
  font-size: 14px;
  font-weight: 800;
}

.start-button::before {
  content: "";
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 9px solid currentColor;
}

.category-card {
  display: grid;
  gap: 22px;
  padding: 28px 24px 22px;
  border: 1px solid rgba(229, 236, 246, .9);
  border-radius: 8px;
  background: rgba(255, 255, 255, .9);
  box-shadow: var(--shadow);
}

.genre-strip {
  display: grid;
  gap: 10px;
}

.category-row {
  width: 100%;
  min-height: 36px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: #526276;
  text-align: left;
}

.category-row[aria-pressed="true"] {
  color: var(--blue);
  font-weight: 800;
}

.cat-mark {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: var(--cat-color, var(--blue));
  box-shadow: inset 0 -3px rgba(0, 0, 0, .12);
}

.category-row span {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-row strong {
  color: #9aa8bb;
  font-weight: 600;
}

.category-all {
  justify-self: start;
  min-height: 30px;
  width: 100%;
  justify-content: flex-start;
  padding: 18px 0 0;
  border-top: 1px solid var(--line);
  background: transparent;
}

.library-block {
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.library-count {
  color: var(--muted);
  font-size: 14px;
}

.library-count strong {
  color: var(--blue);
  font-size: 22px;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 28px;
  border: 1px dashed #cad8e9;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, .62);
}

.site-foot {
  width: min(1530px, calc(100vw - 64px));
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin: 10px auto 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: #a3b0c1;
  font-size: 13px;
}

.site-foot a {
  color: var(--blue);
}

.playbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(16px, 3vw, 36px);
  background: rgba(255, 255, 255, .88);
  border-bottom: 1px solid rgba(221, 231, 244, .9);
  backdrop-filter: blur(16px);
}

.play-title {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.mini-select {
  display: grid;
  grid-template-columns: auto minmax(130px, 260px);
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.mini-select select {
  width: 100%;
  min-width: 0;
  height: 34px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.play-layout {
  width: min(1280px, calc(100vw - 32px));
  min-height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: minmax(230px, 320px) minmax(0, 1fr);
  gap: clamp(16px, 3vw, 32px);
  align-items: center;
  margin: 0 auto;
  padding: 24px 0;
}

.game-side {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 10px 28px rgba(81, 105, 137, .1);
}

.game-side h1 {
  margin: 4px 0 10px;
  color: var(--ink-strong);
  font-size: clamp(24px, 4vw, 42px);
  line-height: 1.08;
}

.game-side p {
  color: var(--muted);
  line-height: 1.65;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.status-line {
  display: grid;
  gap: 5px;
  margin: 18px 0;
  padding: 12px;
  border-radius: 8px;
  background: #f1f6fc;
}

.status-line span {
  color: var(--muted);
  font-size: 12px;
}

.status-line strong {
  color: var(--blue);
}

.actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.command {
  min-height: 38px;
  color: var(--blue);
  background: #fff;
  border: 1px solid #dfe8f4;
  border-radius: 8px;
  font-weight: 800;
}

.command:hover {
  border-color: #b9d3f8;
}

.keymap {
  display: grid;
  gap: 8px;
  margin: 18px 0 0;
}

.keymap div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.keymap dt {
  color: var(--muted);
}

.keymap dd {
  margin: 0;
  color: var(--ink);
  font-weight: 800;
}

.emulator-stage {
  min-width: 0;
}

.cabinet {
  display: grid;
  gap: 16px;
  padding: clamp(14px, 3vw, 28px);
  border: 8px solid #d9e4f1;
  border-radius: 8px;
  background: #fff;
  box-shadow: 12px 12px 0 #dfeeff, 0 26px 70px rgba(73, 102, 140, .18);
}

.screen-frame {
  position: relative;
  width: min(100%, 768px);
  aspect-ratio: 256 / 240;
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 14px;
  border-radius: 6px;
  background: #141922;
  box-shadow: inset 0 0 0 8px #222a36;
}

#nesScreen {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  background: black;
}

.mobile-pad {
  display: grid;
  grid-template-columns: 150px 1fr 150px;
  gap: 16px;
  align-items: center;
}

.mobile-pad button {
  min-height: 42px;
  color: var(--ink);
  background: #f1f6fc;
  border: 1px solid #d8e3f1;
  border-radius: 8px;
  font-weight: 800;
}

.mobile-pad button.is-pressed {
  transform: translateY(1px);
  background: var(--blue-soft);
  color: var(--blue);
}

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 42px);
  grid-template-rows: repeat(3, 42px);
  gap: 4px;
  justify-content: center;
}

.dpad button:first-child {
  grid-column: 2;
}

.dpad button:nth-child(2) {
  grid-row: 2;
}

.dpad button:nth-child(3) {
  grid-column: 3;
  grid-row: 2;
}

.dpad button:nth-child(4) {
  grid-column: 2;
  grid-row: 3;
}

.face-buttons,
.center-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.face-buttons {
  justify-content: end;
}

.face-buttons button {
  width: 62px;
  height: 62px;
  border-radius: 50%;
}

.center-buttons button {
  min-width: 78px;
}

@media (max-width: 1180px) {
  .home-shell {
    width: min(100% - 32px, 980px);
  }

  .home-grid {
    grid-template-columns: 1fr;
  }

  .featured-grid {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  }

  .category-card {
    order: -1;
  }

  .genre-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .hero {
    min-height: 430px;
    padding: 48px 16px 72px;
    background-position: 42% center;
  }

  .hero-copy h1 {
    font-size: 30px;
  }

  .searchbox {
    min-height: 54px;
    margin-top: 30px;
    padding: 0 18px;
  }

  .home-shell,
  .site-foot {
    width: calc(100vw - 28px);
  }

  .section-head {
    align-items: flex-start;
  }

  .featured-grid,
  .library-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .game-card {
    min-height: 286px;
  }

  .game-card h3 {
    font-size: 15px;
  }

  .card-body {
    padding: 12px;
  }

  .card-meta span {
    font-size: 11px;
  }

  .start-button {
    min-height: 34px;
    font-size: 12px;
  }

  .genre-strip {
    grid-template-columns: 1fr;
  }

  .site-foot {
    display: grid;
  }

  .playbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .play-title {
    text-align: left;
  }

  .mini-select {
    grid-template-columns: 1fr;
  }

  .play-layout {
    grid-template-columns: 1fr;
    width: calc(100vw - 28px);
    align-items: start;
  }

  .mobile-pad {
    grid-template-columns: 1fr;
  }

  .face-buttons {
    justify-content: center;
  }
}

@media (max-width: 430px) {
  .featured-grid,
  .library-grid {
    grid-template-columns: 1fr;
  }
}

body[data-page="play"] {
  min-height: 100vh;
  overflow-x: hidden;
  color: #f2f4ff;
  background:
    radial-gradient(circle at 18% 18%, rgba(97, 56, 214, .32), transparent 28%),
    radial-gradient(circle at 85% 18%, rgba(239, 77, 136, .22), transparent 28%),
    radial-gradient(circle at 50% 86%, rgba(24, 118, 255, .22), transparent 34%),
    linear-gradient(135deg, #070713 0%, #12051f 48%, #050914 100%);
}

body[data-page="play"]::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(115deg, transparent 0 16%, rgba(95, 60, 217, .22) 16.5% 17.2%, transparent 17.8% 100%),
    linear-gradient(70deg, transparent 0 70%, rgba(255, 59, 120, .14) 70.5% 71.2%, transparent 71.8% 100%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .035) 0 1px, transparent 1px 120px);
  filter: blur(.2px);
}

body[data-page="play"]::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse at center, transparent 0%, rgba(3, 3, 9, .12) 50%, rgba(0, 0, 0, .72) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, .05), transparent 22%, rgba(0, 0, 0, .42));
  pointer-events: none;
}

.arcade-layout {
  width: min(1830px, calc(100vw - 52px));
  min-height: 100vh;
  display: grid;
  grid-template-columns: 300px minmax(620px, 1fr) 300px;
  gap: clamp(18px, 2.4vw, 34px);
  align-items: center;
  margin: 0 auto;
  padding: clamp(22px, 4vw, 56px) 0;
}

.arcade-left,
.arcade-right {
  display: grid;
  gap: 14px;
}

.arcade-center {
  min-width: 0;
  display: grid;
  place-items: center;
}

.glass-panel {
  border: 1px solid rgba(137, 151, 213, .18);
  border-radius: 14px;
  background:
    linear-gradient(145deg, rgba(14, 16, 36, .78), rgba(5, 5, 16, .62)),
    radial-gradient(circle at 90% 0%, rgba(126, 52, 204, .2), transparent 36%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .08),
    0 18px 40px rgba(0, 0, 0, .32);
  backdrop-filter: blur(18px);
}

.glass-panel h2 {
  margin: 0;
  color: #fff;
  font-size: 18px;
  line-height: 1.2;
}

.game-profile {
  padding: 18px;
}

.arcade-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 26px;
  margin-bottom: 20px;
  color: rgba(226, 231, 255, .7);
  font-weight: 800;
}

.arcade-back::before {
  content: "<";
  color: #aeb6dd;
  font-size: 20px;
}

.profile-main {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.profile-main img {
  width: 92px;
  height: 92px;
  object-fit: cover;
  border: 2px solid rgba(144, 162, 226, .35);
  border-radius: 8px;
  image-rendering: pixelated;
  background: #101324;
}

.profile-main h1 {
  margin: 0 0 7px;
  color: #fff;
  font-size: 24px;
  line-height: 1.16;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-main p {
  margin: 0 0 10px;
  color: rgba(222, 226, 251, .7);
  font-weight: 700;
}

.profile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-tags span {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid rgba(143, 155, 211, .22);
  border-radius: 6px;
  color: #c3c9e7;
  background: rgba(255, 255, 255, .05);
  font-size: 13px;
  font-weight: 800;
}

.rating-line {
  margin: 22px 0 0;
  color: #e9ecff;
  font-size: 16px;
  font-weight: 800;
}

.rating-line span {
  color: #ffbd3f;
}

.rating-line em {
  margin-left: 8px;
  color: rgba(216, 222, 249, .62);
  font-style: normal;
  font-weight: 700;
}

.control-guide,
.save-panel,
.tool-panel,
.related-panel {
  padding: 22px;
}

.control-guide .keymap {
  margin: 18px 0 0;
  display: grid;
  gap: 12px;
}

.control-guide .keymap div {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 0;
  border: 0;
}

.control-guide dt,
.control-guide dd {
  margin: 0;
}

.control-guide dd {
  color: rgba(230, 233, 255, .74);
  font-weight: 800;
}

.control-guide dd:last-child {
  color: rgba(214, 221, 255, .62);
}

.key-icon,
.key-pill {
  min-width: 34px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(160, 172, 232, .35);
  border-radius: 999px;
  color: #dbe1ff;
  background: rgba(255, 255, 255, .04);
  font-weight: 900;
  font-size: 12px;
}

.dpad-icon {
  font-size: 22px;
}

.key-pill {
  padding: 0 8px;
  font-size: 10px;
}

.save-slots {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.save-slot {
  width: 100%;
  min-height: 62px;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: center;
  padding: 9px;
  border: 1px solid rgba(98, 114, 170, .18);
  border-radius: 8px;
  color: #e8edff;
  background: rgba(5, 9, 22, .5);
  text-align: left;
}

.save-slot.is-active {
  border-color: rgba(57, 120, 255, .72);
  background: linear-gradient(135deg, rgba(22, 80, 203, .55), rgba(8, 18, 50, .72));
}

.save-slot img,
.save-slot i {
  grid-row: 1 / span 2;
  width: 52px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  image-rendering: pixelated;
  background: #101525;
}

.save-slot i {
  display: grid;
  place-items: center;
  border: 1px solid rgba(145, 154, 208, .22);
  color: rgba(229, 233, 255, .58);
  font-size: 27px;
  font-style: normal;
}

.save-slot span {
  font-weight: 900;
}

.save-slot small {
  color: rgba(224, 230, 255, .62);
}

.save-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.save-actions button {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  color: #fff;
  background: linear-gradient(135deg, #315fea, #6b33d8);
  font-weight: 900;
}

.save-actions button:last-child {
  background: linear-gradient(135deg, #7f36d9, #c23cba);
}

.cabinet {
  width: min(100%, 980px);
  display: grid;
  gap: 0;
  padding: 0 44px 28px;
  border: 0;
  border-radius: 26px 26px 16px 16px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, .8), rgba(30, 32, 49, .96) 8%, rgba(7, 8, 15, .96) 50%, rgba(34, 32, 48, .96) 92%, rgba(0, 0, 0, .82)),
    radial-gradient(circle at 50% 100%, rgba(102, 35, 177, .34), transparent 46%);
  box-shadow:
    inset 0 0 0 2px rgba(109, 126, 191, .18),
    inset 0 0 60px rgba(0, 0, 0, .72),
    0 30px 90px rgba(0, 0, 0, .62);
  position: relative;
}

.cabinet::before,
.cabinet::after {
  content: "";
  position: absolute;
  top: 84px;
  bottom: 36px;
  width: 28px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(74, 106, 239, .25), rgba(255, 84, 121, .24));
  box-shadow: 0 0 26px rgba(84, 105, 251, .2);
}

.cabinet::before {
  left: 12px;
}

.cabinet::after {
  right: 12px;
}

.cabinet-marquee {
  min-height: 126px;
  display: grid;
  grid-template-columns: 94px 1fr 94px;
  gap: 20px;
  align-items: center;
  padding: 18px 36px 22px;
  border-radius: 0 0 20px 20px;
  background:
    linear-gradient(135deg, rgba(14, 16, 34, .95), rgba(25, 18, 54, .88)),
    radial-gradient(circle at 50% 50%, rgba(96, 45, 219, .65), transparent 58%);
  box-shadow:
    inset 0 -2px 0 rgba(255, 255, 255, .06),
    0 18px 34px rgba(0, 0, 0, .45);
}

.cabinet-marquee i {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background:
    radial-gradient(circle, #05060d 0 28%, transparent 29%),
    radial-gradient(circle, rgba(132, 142, 190, .18) 0 2px, transparent 3px) 0 0 / 9px 9px,
    #080913;
  box-shadow: inset 0 0 0 6px rgba(255, 255, 255, .03), 0 0 20px rgba(78, 86, 164, .25);
}

.cabinet-marquee strong {
  color: #ffd05a;
  font-size: clamp(36px, 5vw, 62px);
  line-height: 1;
  font-style: italic;
  font-weight: 1000;
  letter-spacing: 0;
  text-align: center;
  text-shadow: 4px 4px 0 #a21a5f, 0 0 20px rgba(120, 60, 255, .9);
}

.cabinet-screen {
  margin: 42px 30px 0;
  padding: clamp(18px, 2.5vw, 28px);
  border-radius: 28px;
  background:
    linear-gradient(180deg, #151722, #050609),
    radial-gradient(circle at 50% 0%, rgba(76, 112, 255, .35), transparent 44%);
  box-shadow:
    inset 0 0 0 12px rgba(12, 15, 27, .92),
    inset 0 0 0 18px rgba(61, 72, 108, .16),
    0 18px 50px rgba(0, 0, 0, .7);
}

body[data-page="play"] .screen-frame {
  width: 100%;
  max-width: none;
  aspect-ratio: 256 / 150;
  margin: 0;
  padding: 0;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  box-shadow:
    inset 0 0 0 8px rgba(0, 0, 0, .8),
    0 0 0 1px rgba(87, 110, 194, .28);
}

body[data-page="play"] #nesScreen {
  width: 100%;
  height: 100%;
  object-fit: fill;
  image-rendering: pixelated;
  background: #000;
}

.coin-label {
  margin: 26px 0 12px;
  color: rgba(235, 237, 255, .78);
  font-size: clamp(16px, 1.9vw, 24px);
  font-weight: 1000;
  letter-spacing: 2px;
  text-align: center;
  text-shadow: 0 0 14px rgba(117, 105, 255, .7);
}

.arcade-controls {
  min-height: 126px;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: clamp(28px, 4vw, 58px);
  padding-bottom: 8px;
}

.joystick {
  width: 95px;
  height: 95px;
  border-radius: 50%;
  background: radial-gradient(circle, #2b59ca 0 42%, #071326 44% 100%);
  box-shadow: inset 0 -8px 18px rgba(0, 0, 0, .72), 0 12px 24px rgba(0, 0, 0, .45);
  position: relative;
}

.joystick::before {
  content: "";
  position: absolute;
  left: 39px;
  bottom: 52px;
  width: 17px;
  height: 86px;
  border-radius: 999px;
  background: linear-gradient(90deg, #1a1620, #4c3b49, #15131a);
  transform: rotate(-4deg);
}

.joystick span {
  position: absolute;
  left: 16px;
  bottom: 108px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #ff8ba5, #b2053e 62%, #5a001f);
  box-shadow: inset -8px -12px 18px rgba(0, 0, 0, .38), 0 10px 18px rgba(0, 0, 0, .52);
}

.arcade-btn {
  width: 88px;
  min-height: 58px;
  display: grid;
  place-items: end center;
  padding: 0 0 6px;
  border: 0;
  border-radius: 50%;
  color: rgba(242, 244, 255, .82);
  font-size: 15px;
  font-weight: 1000;
  letter-spacing: 1px;
  box-shadow: inset 0 -10px 16px rgba(0, 0, 0, .38), 0 10px 18px rgba(0, 0, 0, .42);
}

.arcade-btn.red {
  background: radial-gradient(circle at 35% 26%, #ff9aaa, #db2e56 56%, #7e0726 100%);
}

.arcade-btn.blue {
  background: radial-gradient(circle at 35% 26%, #66cbff, #166bea 56%, #062767 100%);
}

.arcade-btn.is-pressed,
.hidden-dpad button.is-pressed {
  transform: translateY(2px);
  filter: brightness(1.25);
}

.hidden-dpad {
  position: absolute;
  left: 48px;
  bottom: 34px;
  display: grid;
  grid-template-columns: repeat(3, 32px);
  grid-template-rows: repeat(3, 32px);
  gap: 4px;
  opacity: .02;
}

.hidden-dpad button {
  border: 0;
  border-radius: 8px;
  background: #fff;
}

.hidden-dpad button:first-child {
  grid-column: 2;
}

.hidden-dpad button:nth-child(2) {
  grid-row: 2;
}

.hidden-dpad button:nth-child(3) {
  grid-column: 3;
  grid-row: 2;
}

.hidden-dpad button:nth-child(4) {
  grid-column: 2;
  grid-row: 3;
}

.tool-panel {
  display: grid;
  gap: 18px;
}

.tool-row {
  width: 100%;
  min-height: 34px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 0;
  color: rgba(235, 239, 255, .86);
  background: transparent;
  text-align: left;
  font-weight: 900;
}

.tool-row span {
  color: #b9c0e1;
  font-size: 20px;
}

.tool-row em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: normal;
}

.tool-row strong {
  color: rgba(235, 239, 255, .62);
}

.tool-row select {
  grid-column: 2 / span 2;
  min-width: 0;
  height: 34px;
  color: #edf1ff;
  border: 1px solid rgba(134, 151, 216, .22);
  border-radius: 7px;
  background: rgba(6, 9, 24, .82);
}

.tool-row input[type="range"] {
  width: 112px;
  accent-color: #8a5cf6;
}

.tool-panel .status-line {
  margin: 6px 0 0;
  padding: 12px;
  border: 1px solid rgba(115, 132, 197, .2);
  border-radius: 9px;
  background: rgba(5, 8, 20, .56);
}

.tool-panel .status-line span {
  color: rgba(230, 235, 255, .55);
}

.tool-panel .status-line strong {
  color: #7bf4ff;
}

.related-panel {
  display: grid;
  gap: 18px;
}

.related-list {
  display: grid;
  gap: 15px;
}

.related-game {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  color: #f2f4ff;
}

.related-game img {
  width: 62px;
  height: 62px;
  object-fit: cover;
  border-radius: 7px;
  image-rendering: pixelated;
}

.related-game strong {
  display: block;
  margin-bottom: 5px;
  overflow: hidden;
  color: #fff;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.related-game span {
  color: #ffbd3f;
  font-weight: 900;
}

.more-games {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid rgba(125, 142, 204, .2);
  border-radius: 8px;
  color: rgba(235, 239, 255, .7);
  font-weight: 900;
}

.more-games::after {
  content: ">";
  font-size: 22px;
}

@media (max-width: 1420px) {
  .arcade-layout {
    grid-template-columns: 280px minmax(520px, 1fr);
  }

  .arcade-right {
    grid-column: 1 / -1;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 980px) {
  .arcade-layout {
    width: min(100vw - 28px, 760px);
    grid-template-columns: 1fr;
    align-items: start;
    padding: 18px 0 30px;
  }

  .arcade-left,
  .arcade-right {
    grid-template-columns: 1fr;
  }

  .arcade-center {
    order: -1;
  }

  .cabinet {
    padding: 0 16px 18px;
    border-radius: 18px;
  }

  .cabinet::before,
  .cabinet::after {
    display: none;
  }

  .cabinet-marquee {
    min-height: 80px;
    grid-template-columns: 42px 1fr 42px;
    gap: 10px;
    padding: 12px 16px;
  }

  .cabinet-marquee i {
    width: 40px;
    height: 40px;
  }

  .cabinet-marquee strong {
    font-size: clamp(26px, 9vw, 42px);
  }

  .cabinet-screen {
    margin: 18px 0 0;
    padding: 12px;
  }

  .arcade-controls {
    gap: 16px;
    transform: scale(.82);
    transform-origin: top center;
    margin-bottom: -18px;
  }

  .joystick {
    display: none;
  }

  .hidden-dpad {
    position: static;
    opacity: 1;
    order: -1;
  }

  .hidden-dpad button {
    color: #fff;
    background: rgba(87, 105, 190, .48);
  }
}

@media (max-width: 540px) {
  .arcade-controls {
    flex-wrap: wrap;
    transform: none;
    margin-bottom: 0;
  }

  .arcade-btn {
    width: 66px;
    min-height: 48px;
  }

  .profile-main {
    grid-template-columns: 74px minmax(0, 1fr);
  }

  .profile-main img {
    width: 74px;
    height: 74px;
  }
}

@media (min-width: 981px) {
  body[data-page="play"] {
    overflow-y: auto;
  }

  .arcade-layout {
    width: min(1830px, calc(100vw - 36px));
    min-height: 100dvh;
    grid-template-columns: clamp(250px, 18vw, 300px) minmax(500px, 1fr) clamp(250px, 18vw, 300px);
    gap: clamp(14px, 2vw, 34px);
    padding: clamp(14px, 2.2vh, 40px) 0;
  }

  .arcade-left,
  .arcade-right {
    align-self: center;
    gap: clamp(10px, 1.35vh, 14px);
  }

  .glass-panel {
    border-radius: 13px;
  }

  .game-profile {
    padding: clamp(14px, 1.8vh, 18px);
  }

  .arcade-back {
    margin-bottom: clamp(10px, 1.9vh, 20px);
  }

  .profile-main {
    grid-template-columns: clamp(68px, 6.3vw, 92px) minmax(0, 1fr);
    gap: 12px;
  }

  .profile-main img {
    width: clamp(68px, 6.3vw, 92px);
    height: clamp(68px, 6.3vw, 92px);
  }

  .profile-main h1 {
    font-size: clamp(19px, 1.55vw, 24px);
  }

  .profile-main p {
    margin-bottom: 8px;
    font-size: clamp(13px, 1vw, 16px);
    line-height: 1.35;
  }

  .profile-tags {
    gap: 6px;
  }

  .profile-tags span {
    min-height: 23px;
    padding: 0 10px;
  }

  .rating-line {
    margin-top: clamp(12px, 2vh, 22px);
  }

  .control-guide,
  .save-panel,
  .tool-panel,
  .related-panel {
    padding: clamp(14px, 1.9vh, 22px);
  }

  .control-guide .keymap {
    margin-top: clamp(12px, 1.8vh, 18px);
    gap: clamp(7px, 1.25vh, 12px);
  }

  .control-guide .keymap div {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 10px;
  }

  .save-slots {
    gap: clamp(7px, 1.15vh, 10px);
    margin: clamp(12px, 1.8vh, 18px) 0;
  }

  .save-slot {
    min-height: clamp(52px, 7.4vh, 62px);
    grid-template-columns: 46px minmax(0, 1fr);
    padding: 8px;
  }

  .save-slot img,
  .save-slot i {
    width: 46px;
    height: 38px;
  }

  .save-actions button {
    min-height: clamp(34px, 5vh, 42px);
  }

  .cabinet {
    width: min(100%, calc((100dvh - 40px) * 1.24), 980px);
    max-height: calc(100dvh - 30px);
    padding: 0 clamp(22px, 2.3vw, 44px) clamp(14px, 2.2vh, 28px);
  }

  .cabinet::before,
  .cabinet::after {
    top: clamp(64px, 10vh, 84px);
    bottom: clamp(22px, 4vh, 36px);
    width: clamp(18px, 1.8vw, 28px);
  }

  .cabinet-marquee {
    min-height: clamp(86px, 14.2vh, 126px);
    grid-template-columns: clamp(58px, 7vw, 94px) 1fr clamp(58px, 7vw, 94px);
    gap: clamp(12px, 1.6vw, 20px);
    padding: clamp(12px, 2vh, 18px) clamp(20px, 2.3vw, 36px) clamp(14px, 2.2vh, 22px);
  }

  .cabinet-marquee i {
    width: clamp(54px, 6.4vw, 86px);
    height: clamp(54px, 6.4vw, 86px);
  }

  .cabinet-marquee strong {
    font-size: clamp(34px, 3.8vw, 62px);
    white-space: nowrap;
  }

  .cabinet-screen {
    margin: clamp(16px, 3vh, 42px) clamp(14px, 2vw, 30px) 0;
    padding: clamp(12px, 2vh, 28px);
    border-radius: clamp(18px, 2.2vw, 28px);
  }

  .coin-label {
    margin: clamp(12px, 2vh, 26px) 0 clamp(4px, 1vh, 12px);
    font-size: clamp(15px, 1.55vw, 24px);
  }

  .arcade-controls {
    min-height: clamp(82px, 13vh, 126px);
    gap: clamp(20px, 3.2vw, 58px);
    padding-bottom: clamp(2px, .8vh, 8px);
  }

  .joystick {
    width: clamp(70px, 7.2vw, 95px);
    height: clamp(70px, 7.2vw, 95px);
  }

  .joystick::before {
    left: calc(50% - 8px);
    bottom: 54%;
    height: clamp(56px, 7.4vh, 86px);
  }

  .joystick span {
    left: calc(50% - clamp(23px, 2.4vw, 31px));
    bottom: clamp(76px, 10.7vh, 108px);
    width: clamp(46px, 4.8vw, 62px);
    height: clamp(46px, 4.8vw, 62px);
  }

  .arcade-btn {
    width: clamp(68px, 6.2vw, 88px);
    min-height: clamp(46px, 6.2vh, 58px);
  }

  .tool-panel {
    gap: clamp(10px, 1.75vh, 18px);
  }

  .tool-row {
    min-height: clamp(29px, 4.7vh, 34px);
  }

  .tool-panel .status-line {
    margin-top: 2px;
    padding: clamp(9px, 1.5vh, 12px);
  }

  .related-panel {
    gap: clamp(11px, 1.8vh, 18px);
  }

  .related-list {
    gap: clamp(9px, 1.55vh, 15px);
  }

  .related-game {
    grid-template-columns: clamp(48px, 4.6vw, 62px) minmax(0, 1fr);
    gap: 12px;
  }

  .related-game img {
    width: clamp(48px, 4.6vw, 62px);
    height: clamp(48px, 4.6vw, 62px);
  }

  .more-games {
    min-height: clamp(34px, 5vh, 42px);
  }
}

@media (min-width: 1181px) and (max-width: 1420px) {
  .arcade-layout {
    grid-template-columns: 250px minmax(500px, 1fr) 250px;
  }

  .arcade-right {
    grid-column: auto;
    grid-template-columns: 1fr;
  }
}

@media (min-width: 981px) and (max-height: 780px) {
  .glass-panel h2 {
    font-size: 16px;
  }

  .arcade-layout {
    padding: 10px 0;
  }

  .game-profile,
  .control-guide,
  .save-panel,
  .tool-panel,
  .related-panel {
    padding: 12px;
  }

  .arcade-back {
    margin-bottom: 8px;
  }

  .profile-main {
    grid-template-columns: 60px minmax(0, 1fr);
  }

  .profile-main img {
    width: 60px;
    height: 60px;
  }

  .profile-main h1 {
    margin-bottom: 5px;
    font-size: 18px;
  }

  .profile-main p {
    margin-bottom: 6px;
    font-size: 12px;
  }

  .profile-tags span {
    min-height: 21px;
    font-size: 12px;
  }

  .rating-line {
    margin-top: 10px;
    font-size: 15px;
  }

  .key-icon,
  .key-pill {
    height: 21px;
  }

  .control-guide .keymap {
    margin-top: 10px;
    gap: 6px;
  }

  .save-slot {
    min-height: 42px;
    grid-template-columns: 40px minmax(0, 1fr);
    padding: 6px;
  }

  .save-slot img,
  .save-slot i {
    width: 40px;
    height: 30px;
  }

  .save-slots {
    gap: 6px;
    margin: 10px 0;
  }

  .save-actions button {
    min-height: 30px;
  }

  .save-slot small,
  .tool-panel .status-line span {
    font-size: 11px;
  }

  body[data-page="play"] .screen-frame {
    width: min(100%, calc((100dvh - 390px) * 16 / 9), 760px);
  }

  .cabinet-screen {
    margin-top: 14px;
    padding: 12px;
  }

  .coin-label {
    margin: 9px 0 2px;
  }

  .arcade-controls {
    min-height: 72px;
    gap: 24px;
  }

  .joystick {
    width: 64px;
    height: 64px;
  }

  .joystick::before {
    height: 50px;
  }

  .joystick span {
    left: calc(50% - 21px);
    bottom: 68px;
    width: 42px;
    height: 42px;
  }

  .arcade-btn {
    width: 62px;
    min-height: 40px;
    font-size: 12px;
  }

  .tool-panel {
    gap: 8px;
  }

  .tool-row {
    min-height: 25px;
    grid-template-columns: 22px minmax(0, 1fr) auto;
    gap: 8px;
  }

  .tool-row select {
    height: 28px;
  }

  .tool-row input[type="range"] {
    width: 90px;
  }

  .tool-panel .status-line {
    padding: 8px;
  }

  .related-panel {
    gap: 9px;
  }

  .related-list {
    gap: 7px;
  }

  .related-game {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 8px;
  }

  .related-game img {
    width: 42px;
    height: 42px;
  }

  .more-games {
    min-height: 30px;
  }
}
