:root {
  --ink: #191b1f;
  --muted: #606976;
  --line: #d7dde3;
  --panel: #ffffff;
  --page: #eef2ef;
  --screen: #111418;
  --red: #d93838;
  --red-dark: #9f2323;
  --teal: #167f7a;
  --yellow: #f2c94c;
  --focus: #0f6fff;
  --shadow: 0 16px 44px rgba(25, 27, 31, 0.12);
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(22, 127, 122, 0.08), transparent 340px),
    var(--page);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  padding: 12px clamp(16px, 4vw, 40px);
  color: #fff;
  background: #20242a;
  border-bottom: 4px solid var(--red);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  color: #fff;
  background: var(--red);
  border: 2px solid #fff;
  border-radius: 6px;
  font-weight: 900;
  line-height: 1;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topnav a,
.link-button,
.player-badge {
  color: #f7f7f7;
  text-decoration: none;
  border: 0;
  background: transparent;
  padding: 8px 0;
}

.player-badge {
  color: var(--yellow);
  font-weight: 800;
}

.topnav a:hover,
.link-button:hover {
  color: var(--yellow);
}

main {
  padding: clamp(14px, 3vw, 28px);
}

.flash-stack {
  position: fixed;
  top: 82px;
  right: clamp(14px, 3vw, 28px);
  z-index: 50;
  display: grid;
  gap: 8px;
  width: min(420px, calc(100vw - 28px));
}

.flash {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.flash-success {
  border-left-color: var(--teal);
}

.flash-error {
  border-left-color: var(--red);
}

.arcade-shell {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: clamp(14px, 2.4vw, 24px);
  max-width: 1500px;
  margin: 0 auto;
}

.library-panel,
.play-panel,
.auth-form,
.upload-form,
.rom-table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.library-panel {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 120px);
  padding: 18px;
}

.panel-title-row,
.screen-toolbar,
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1.1;
}

.library-panel h1,
.admin-header h1,
.auth-form h1 {
  font-size: clamp(1.45rem, 2vw, 2rem);
}

.screen-toolbar h2 {
  max-width: min(48vw, 720px);
  overflow: hidden;
  font-size: clamp(1.25rem, 2.1vw, 2.4rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button,
.tool-button,
.primary-button,
.danger-button,
.secondary-button,
.control-button {
  border: 0;
  border-radius: 8px;
  font-weight: 800;
  transition:
    transform 120ms ease,
    background 120ms ease,
    border-color 120ms ease,
    color 120ms ease;
}

.icon-button:focus-visible,
.tool-button:focus-visible,
.primary-button:focus-visible,
.danger-button:focus-visible,
.secondary-button:focus-visible,
.control-button:focus-visible,
.key-capture-button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: #fff;
  background: var(--teal);
}

.icon-button:hover {
  background: #10645f;
}

.icon-button.quiet {
  color: var(--ink);
  background: #eef2f4;
}

.icon-button.quiet:hover {
  background: #dfe6ea;
}

.search-box {
  display: block;
  margin: 16px 0;
}

.search-box input,
.auth-form input,
.upload-form input[type="text"],
.file-drop {
  width: 100%;
  min-height: 46px;
  padding: 12px 13px;
  color: var(--ink);
  background: #f8fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.game-list {
  display: grid;
  gap: 10px;
  overflow: auto;
  padding-right: 2px;
}

.game-card {
  display: grid;
  gap: 7px;
  width: 100%;
  padding: 13px;
  color: var(--ink);
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 5px solid var(--teal);
  border-radius: 8px;
}

.game-card:hover,
.game-card.active {
  border-left-color: var(--red);
  transform: translateY(-1px);
}

.game-card strong {
  overflow-wrap: anywhere;
  font-size: 0.98rem;
}

.game-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.8rem;
}

.empty-library {
  display: grid;
  place-items: center;
  gap: 12px;
  margin: auto 0;
  color: var(--muted);
  text-align: center;
}

.empty-library[hidden] {
  display: none;
}

.empty-library img {
  width: min(220px, 70%);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.empty-library a,
.secondary-link {
  color: var(--red-dark);
  font-weight: 800;
  text-decoration: none;
}

.play-panel {
  display: grid;
  gap: 16px;
  align-content: start;
  min-width: 0;
  padding: 18px;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 12px;
  color: #fff;
  background: #2d333a;
}

.tool-button:hover:not(:disabled) {
  background: var(--red-dark);
}

.tool-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.screen-wrap {
  display: grid;
  place-items: center;
  width: 100%;
  padding: clamp(8px, 1.5vw, 16px);
  background: #20242a;
  border: 5px solid #3b414a;
  border-radius: 8px;
}

.nes-container {
  position: relative;
  width: min(100%, calc((100vh - 270px) * 1.0667));
  min-width: 240px;
  aspect-ratio: 256 / 240;
  overflow: hidden;
  background: var(--screen);
  border: 3px solid #070809;
  border-radius: 4px;
}

.nes-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.remote-video {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  background: var(--screen);
  object-fit: contain;
  image-rendering: pixelated;
}

.remote-video[hidden] {
  display: none;
}

.screen-placeholder {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(90deg, transparent 0 49%, rgba(255, 255, 255, 0.04) 50% 51%, transparent 52%),
    #111418;
}

.screen-placeholder img {
  width: min(58%, 420px);
  border-radius: 8px;
  opacity: 0.92;
}

.screen-placeholder.hidden {
  display: none;
}

.status-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.key-settings-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: #f8fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.key-settings-panel[hidden],
.multiplayer-panel[hidden] {
  display: none;
}

.multiplayer-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: #f8fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.key-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.key-settings-header h3 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.1;
}

.key-bindings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.key-binding-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 52px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.key-binding-label {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.key-capture-button {
  min-width: 96px;
  min-height: 36px;
  padding: 0 12px;
  color: #fff;
  background: #2d333a;
  border: 0;
  border-radius: 8px;
  font-weight: 900;
}

.key-capture-button:hover {
  background: var(--teal);
}

.key-settings-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 4px;
  background: #e8eef2;
  border-radius: 8px;
}

.mode-button {
  min-height: 40px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-weight: 900;
}

.mode-button.active {
  color: #fff;
  background: var(--teal);
}

.multiplayer-pane {
  display: grid;
  gap: 12px;
}

.room-share {
  display: grid;
  grid-template-columns: auto minmax(160px, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.room-share[hidden] {
  display: none;
}

.room-code {
  display: inline-grid;
  place-items: center;
  min-height: 46px;
  padding: 0 14px;
  color: #fff;
  background: #2d333a;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 900;
}

.room-share input,
.join-room-field input {
  width: 100%;
  min-height: 46px;
  padding: 12px 13px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.join-room-field input {
  text-transform: uppercase;
}

.multiplayer-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.touch-controller {
  display: grid;
  grid-template-columns: 170px minmax(160px, 1fr) 210px;
  align-items: center;
  gap: clamp(12px, 3vw, 28px);
  padding-top: 4px;
}

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

.dpad::before {
  content: "";
  grid-column: 2;
  grid-row: 2;
  background: #2d333a;
  border-radius: 6px;
}

.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;
}

.system-buttons,
.action-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.control-button {
  display: grid;
  place-items: center;
  min-width: 54px;
  min-height: 54px;
  padding: 0 12px;
  color: #fff;
  background: #2d333a;
  border: 2px solid #15181c;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.22);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.control-button.small {
  min-width: 82px;
  min-height: 42px;
  font-size: 0.82rem;
}

.control-button.action {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  font-size: 1.3rem;
}

.control-button.primary {
  background: var(--red);
}

.control-button.secondary {
  background: var(--teal);
}

.control-button.pressed,
.control-button:active {
  transform: translateY(3px);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.22);
}

.admin-shell,
.auth-shell,
.entry-shell {
  width: min(1100px, 100%);
  margin: 0 auto;
}

.admin-shell {
  display: grid;
  gap: 18px;
}

.admin-header.secondary {
  margin-top: 10px;
}

.admin-header h2 {
  margin: 0;
  font-size: clamp(1.25rem, 1.8vw, 1.8rem);
}

.admin-count {
  color: var(--muted);
  font-weight: 800;
}

.auth-shell {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 150px);
}

.entry-shell {
  display: grid;
  gap: 18px;
  min-height: calc(100vh - 150px);
  align-content: center;
}

.entry-hero {
  display: grid;
  gap: 8px;
}

.entry-hero h1 {
  font-size: clamp(2rem, 5vw, 4rem);
}

.entry-hero p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.entry-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.entry-option,
.entry-option button {
  display: grid;
  gap: 10px;
  min-height: 148px;
  width: 100%;
  padding: 18px;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 5px solid var(--teal);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.entry-option {
  padding: 0;
  overflow: hidden;
}

a.entry-option {
  padding: 18px;
}

.entry-option button {
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  cursor: pointer;
  box-shadow: none;
}

.entry-option:hover,
.entry-option button:hover {
  border-left-color: var(--red);
}

.entry-option strong {
  font-size: 1.2rem;
}

.entry-option span {
  color: var(--muted);
  line-height: 1.55;
}

.auth-form,
.upload-form {
  display: grid;
  gap: 14px;
  width: min(480px, 100%);
  padding: clamp(18px, 4vw, 28px);
}

.upload-form {
  width: 100%;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.4fr) auto;
  align-items: end;
}

.auth-form label,
.upload-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.file-drop {
  display: grid;
  gap: 8px;
  min-height: 74px;
}

.file-drop input {
  width: 100%;
}

.primary-button,
.danger-button,
.secondary-button {
  min-height: 46px;
  padding: 0 18px;
}

.primary-button,
.danger-button {
  color: #fff;
}

.primary-button {
  background: var(--red);
}

.primary-button:hover {
  background: var(--red-dark);
}

.danger-button {
  background: #2d333a;
}

.danger-button:hover {
  background: var(--red-dark);
}

.danger-button.compact {
  min-height: 38px;
  padding: 0 14px;
}

.secondary-button {
  color: var(--ink);
  background: #e8eef2;
}

.secondary-button:hover {
  background: #d9e2e8;
}

.rom-table-wrap {
  overflow-x: auto;
}

.rom-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.rom-table th,
.rom-table td {
  padding: 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.rom-table th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.rom-table td strong,
.rom-table td span {
  display: block;
}

.rom-table td span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.table-empty {
  color: var(--muted);
  text-align: center !important;
}

@media (max-width: 980px) {
  .arcade-shell {
    grid-template-columns: 1fr;
  }

  .library-panel {
    min-height: 0;
  }

  .screen-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .screen-toolbar h2 {
    max-width: calc(100vw - 64px);
  }

  .toolbar-actions {
    justify-content: flex-start;
  }

  .key-bindings {
    grid-template-columns: 1fr;
  }

  .key-settings-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .room-share {
    grid-template-columns: 1fr;
  }

  .multiplayer-status-row {
    align-items: stretch;
    flex-direction: column;
  }

  .touch-controller {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .system-buttons {
    order: 3;
  }

  .action-buttons {
    width: min(260px, 100%);
    justify-content: space-between;
  }

  .upload-form {
    grid-template-columns: 1fr;
  }

  .entry-options {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  main {
    padding: 12px;
  }

  .library-panel,
  .play-panel {
    padding: 14px;
  }

  .tool-button {
    flex: 1 1 calc(50% - 8px);
  }

  .screen-wrap {
    padding: 6px;
    border-width: 3px;
  }

  .nes-container {
    min-width: 0;
    width: 100%;
  }

  .status-row {
    flex-direction: column;
  }

  .flash-stack {
    top: 108px;
  }
}
#fps-meter {
  display: none !important; visibility: hidden !important; opacity: 0 !important;
}
.fps-meter, .debug-meter, .performance-meter { display: none !important;
}

/* NES 全屏优化 */
#screen-wrap:fullscreen,
#screen-wrap:-webkit-full-screen {
  width: 100vw !important;
  height: 100vh !important;
  background: #000 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  margin: 0 !important;
}

#screen-wrap:fullscreen #nes-container,
#screen-wrap:-webkit-full-screen #nes-container {
  width: 100vw !important;
  height: 100vh !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: #000 !important;
}

#screen-wrap:fullscreen canvas,
#screen-wrap:-webkit-full-screen canvas {
  max-width: 100vw !important;
  max-height: 100vh !important;
  width: auto !important;
  height: 100vh !important;
  image-rendering: pixelated !important;
  image-rendering: crisp-edges !important;
}
/* 手机游玩优化：横屏显示虚拟按键，避免画面挤压 */
@media (max-width: 980px) and (orientation: landscape) {
  html,
  body {
    height: 100%;
    overflow: hidden;
    background: #000 !important;
  }

  .topbar,
  .library-panel,
  .screen-toolbar,
  .status-row,
  .key-settings-panel,
  .multiplayer-panel {
    display: none !important;
  }

  main {
    width: 100vw !important;
    height: 100vh !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: #000 !important;
  }

  .arcade-shell {
    display: block !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    margin: 0 !important;
  }

  .play-panel {
    position: fixed !important;
    inset: 0 !important;
    display: block !important;
    width: 100vw !important;
    height: 100vh !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: #000 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  .screen-wrap {
    position: absolute !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #000 !important;
  }

  .nes-container {
    width: 100vw !important;
    height: 100vh !important;
    min-width: 0 !important;
    max-width: none !important;
    aspect-ratio: auto !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #000 !important;
  }

  .nes-container canvas {
    width: 100vw !important;
    height: 100vh !important;
    object-fit: contain !important;
  }

  .touch-controller {
    position: fixed !important;
    inset: 0 !important;
    z-index: 80 !important;
    display: block !important;
    padding: 0 !important;
    pointer-events: none !important;
  }

  .dpad {
    position: absolute !important;
    left: max(16px, 4vw) !important;
    bottom: max(16px, 5vh) !important;
    display: grid !important;
    grid-template-columns: repeat(3, 48px) !important;
    grid-template-rows: repeat(3, 48px) !important;
    gap: 4px !important;
    pointer-events: auto !important;
  }

  .action-buttons {
    position: absolute !important;
    right: max(16px, 4vw) !important;
    bottom: max(18px, 6vh) !important;
    display: flex !important;
    gap: 18px !important;
    pointer-events: auto !important;
  }

  .system-buttons {
    position: absolute !important;
    left: 50% !important;
    bottom: max(12px, 4vh) !important;
    transform: translateX(-50%) !important;
    display: flex !important;
    gap: 10px !important;
    pointer-events: auto !important;
  }

  .control-button {
    opacity: 0.72 !important;
    backdrop-filter: blur(2px);
  }

  .control-button.action {
    width: 64px !important;
    height: 64px !important;
  }

  .control-button.small {
    min-width: 70px !important;
    min-height: 36px !important;
  }
}

/* 手机竖屏优化：减少留白，按键更像掌机布局 */
@media (max-width: 560px) and (orientation: portrait) {
  .topbar {
    min-height: 54px;
    gap: 8px;
    padding: 8px 12px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }

  .brand {
    font-size: 1.05rem;
  }

  .topnav {
    gap: 12px;
    font-size: 0.95rem;
  }

  main {
    padding: 8px;
  }

  .play-panel {
    gap: 10px;
  }

  .screen-toolbar {
    display: none;
  }

  .screen-wrap {
    padding: 4px;
  }

  .touch-controller {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "dpad actions"
      "system system";
    align-items: end;
    gap: 8px;
    padding-top: 4px;
  }

  .dpad {
    grid-area: dpad;
    justify-self: center;
    grid-template-columns: repeat(3, 46px);
    grid-template-rows: repeat(3, 46px);
  }

  .action-buttons {
    grid-area: actions;
    align-self: center;
    justify-self: center;
    width: 100%;
    justify-content: space-evenly;
  }

  .system-buttons {
    grid-area: system;
    display: flex;
    justify-content: center;
    gap: 10px;
    order: initial;
  }

  .control-button.action {
    width: 72px;
    height: 72px;
  }

  .status-row {
    display: none;
  }
}

/* 全屏时把虚拟按键一起带进去 */
.play-panel:fullscreen,
.play-panel:-webkit-full-screen {
  width: 100vw !important;
  height: 100vh !important;
  background: #000 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

.play-panel:fullscreen .screen-wrap,
.play-panel:-webkit-full-screen .screen-wrap {
  position: absolute !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #000 !important;
}

.play-panel:fullscreen .nes-container,
.play-panel:-webkit-full-screen .nes-container {
  width: 100vw !important;
  height: 100vh !important;
  min-width: 0 !important;
  max-width: none !important;
  aspect-ratio: auto !important;
  border: 0 !important;
}

.play-panel:fullscreen .touch-controller,
.play-panel:-webkit-full-screen .touch-controller {
  position: fixed !important;
  inset: 0 !important;
  z-index: 80 !important;
  pointer-events: none !important;
}

.play-panel:fullscreen .dpad,
.play-panel:fullscreen .action-buttons,
.play-panel:fullscreen .system-buttons,
.play-panel:-webkit-full-screen .dpad,
.play-panel:-webkit-full-screen .action-buttons,
.play-panel:-webkit-full-screen .system-buttons {
  pointer-events: auto !important;
}
