:root {
  --bg: #000000;
  --panel: #0a0a0a;
  --panel-2: #111111;
  --line: #330d0d;
  --line-strong: #e50914;
  --text: #ffffff;
  --muted: #b3b3b3;
  --accent: #ff2a2a;
  --accent-2: #cc0000;
  --danger: #ff1a1a;
  --ok: #00e676;
  --touch-control-opacity: .5;
  --cabinet: #100505;
  --cabinet-edge: #4a0d0d;
  --screen: #000000;
}

* { box-sizing: border-box; }
html {
  background: transparent !important;
  color: var(--text);
}
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: transparent;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }

/* Full-viewport ambient game artwork wallpaper */
.arcade-wallpaper-stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.arcade-wallpaper-stage.is-active {
  opacity: 1;
  visibility: visible;
}

.arcade-wallpaper-img {
  position: absolute;
  inset: -30px;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  filter: blur(14px) brightness(0.38) saturate(1.3);
  transform: scale(1.06);
  transition: background-image 0.6s ease-in-out;
}

.arcade-wallpaper-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.8) 65%, #000000 100%),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.55) 0%, transparent 25%, transparent 75%, rgba(0, 0, 0, 0.95) 100%);
}

.arcade-shell { position: relative; z-index: 1; width: min(1500px, 100%); margin: 0 auto; padding: 20px clamp(14px, 3vw, 42px) 48px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.brand-block { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 48px; height: 48px; border: 2px solid var(--accent); border-radius: 14px; display: grid; place-items: center; font-weight: 900; letter-spacing: -.06em; background: linear-gradient(145deg, #1f0505, #0a0000); color: #ffffff; box-shadow: 0 0 15px rgba(255, 42, 42, 0.35); }
.brand-block h1 { margin: 0; font-size: clamp(1.15rem, 2vw, 1.7rem); letter-spacing: .08em; color: #ffffff; }
.brand-block p { margin: 4px 0 0; color: var(--muted); font-size: .88rem; }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.nav-btn, .secondary-btn, .session-controls button, .pager button, .ingestion-actions button {
  border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 10px; padding: 10px 14px; transition: all 0.15s ease;
}
.nav-btn.is-active { border-color: var(--accent); background: rgba(255, 42, 42, 0.16); box-shadow: 0 0 12px rgba(255, 42, 42, 0.25); }
.primary-btn { border: 1px solid var(--accent); border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #ffffff; font-weight: 800; padding: 11px 18px; box-shadow: 0 0 18px rgba(255, 42, 42, 0.4); }
.secondary-btn:hover, .nav-btn:hover, .session-controls button:hover, .pager button:hover { border-color: var(--accent); color: #ffffff; box-shadow: 0 0 8px rgba(255, 42, 42, 0.2); }

.view { display: none; }
.view.is-visible { display: block; }
.search-row { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(180px, 260px) auto; gap: 12px; margin-bottom: 16px; align-items: end; }
.search-box, .system-filter { display: grid; gap: 6px; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.search-box input, .system-filter select, .console-form input {
  min-height: 44px; border: 1px solid var(--line); background: #050505; color: #ffffff; border-radius: 10px; padding: 10px 12px; outline: none;
}
.system-filter select optgroup {
  font-weight: 800;
  font-size: .85rem;
  color: var(--accent);
  background: #0d0202;
  padding: 6px 4px;
}
.system-filter select option {
  font-weight: 500;
  color: #ffffff;
  background: #080808;
  padding: 4px 8px;
}
.search-box input:focus, .system-filter select:focus, .console-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 42, 42, 0.25); }

.web-games-filter-btn {
  min-height: 44px;
  border: 1px solid var(--line);
  background: rgba(20, 10, 10, 0.85);
  color: #ffffff;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: .82rem;
  letter-spacing: .04em;
  cursor: pointer;
  white-space: nowrap;
  transition: all .2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.web-games-filter-btn:hover {
  border-color: var(--accent);
  background: rgba(255, 42, 42, 0.15);
  color: #ffffff;
}
.web-games-filter-btn.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(255, 42, 42, 0.5);
}

.quick-access-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-bottom: 20px; }
.quick-access-section { background: rgba(10, 5, 5, 0.85); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; backdrop-filter: blur(8px); }
.quick-access-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.quick-access-title-wrap { display: flex; align-items: center; gap: 6px; }
.quick-access-controls { display: flex; align-items: center; gap: 8px; font-weight: 400; text-transform: none; letter-spacing: normal; }
.quick-size-selector { padding: 1px 4px; }
.quick-size-selector .page-size-btn { padding: 2px 5px; font-size: .7rem; }
.quick-pager { gap: 5px; font-size: .72rem; }
.quick-pager button { padding: 3px 6px; font-size: .7rem; border-radius: 6px; }
.quick-pager span { min-width: 32px; text-align: center; font-size: .7rem; font-weight: 700; color: var(--muted); }
.quick-access-icon { font-size: .95rem; }
.fav-clear-btn { appearance: none; background: transparent; border: 1px solid rgba(255,42,42,.35); color: var(--muted); border-radius: 8px; padding: 2px 8px; font-size: .72rem; font-weight: 700; letter-spacing: .03em; cursor: pointer; transition: all .15s ease; line-height: 1.2; }
.fav-clear-btn:hover:not(:disabled) { color: #ff6b6b; background: rgba(255,42,42,.15); border-color: #ff4444; }
.fav-clear-btn:disabled { opacity: .35; cursor: not-allowed; border-color: transparent; }
.quick-access-bubbles { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-height: 38px; }
.quick-empty-hint { font-size: .75rem; color: var(--muted); font-style: italic; }
.quick-bubble { appearance: none; border: 1px solid rgba(255,255,255,.10); background: #131923; color: var(--text); border-radius: 20px; padding: 4px 10px 4px 5px; display: inline-flex; align-items: center; gap: 7px; cursor: pointer; transition: all .15s ease; text-decoration: none; user-select: none; max-width: 240px; position: relative; }
.quick-bubble:hover { border-color: var(--accent); background: #1c2535; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.bubble-cover { width: 26px; height: 26px; border-radius: 50%; overflow: hidden; background: #0b0e14; display: grid; place-items: center; flex-shrink: 0; border: 1px solid rgba(255,255,255,.15); pointer-events: none; }
.bubble-cover img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.bubble-cover .fallback { font-size: .7rem; font-weight: 900; color: var(--accent); pointer-events: none; }
.bubble-title { font-size: .78rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.bubble-tag { font-size: .62rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); background: rgba(85,200,255,.12); padding: 1px 5px; border-radius: 6px; flex-shrink: 0; pointer-events: none; }
.bubble-remove-btn { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(255,255,255,.2); background: rgba(0,0,0,.65); color: #8899ac; font-size: .65rem; line-height: 1; margin-left: auto; flex-shrink: 0; cursor: pointer; transition: all .15s ease; z-index: 2; }
.bubble-remove-btn:hover { background: #ff2a2a; border-color: #ff4444; color: #ffffff; transform: scale(1.15); box-shadow: 0 0 8px rgba(255,42,42,.6); }

.featured { display: none !important; }
.featured-bg { position: absolute; inset: 0; background-position: center; background-size: cover; opacity: .22; filter: saturate(.75); transform: scale(1.02); }
.featured::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(10,12,17,.96) 0%, rgba(10,12,17,.78) 44%, rgba(10,12,17,.42) 100%); pointer-events: none; }
.featured-content { position: relative; z-index: 1; display: grid; grid-template-columns: 190px minmax(260px, 1fr) minmax(250px, 430px); align-items: center; gap: clamp(18px, 3vw, 38px); padding: clamp(20px, 4vw, 44px); }
.featured-cover-wrap { aspect-ratio: 3 / 4; max-height: 235px; border-radius: 14px; overflow: hidden; background: #0a0c10; border: 1px solid rgba(255,255,255,.1); display: grid; place-items: center; }
.featured-cover { width: 100%; height: 100%; object-fit: cover; }
.cover-placeholder { font-size: 4rem; color: #3d4858; font-weight: 900; }
.featured-copy { min-width: 0; }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 800; }
.featured-copy h2, .player-title-row h2, .ingestion-head h2 { font-size: clamp(1.7rem, 4vw, 3.2rem); line-height: 1; margin: 8px 0 12px; }
.featured-copy p { color: #c0cad6; line-height: 1.55; max-width: 680px; }
.featured-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 18px; }
.favorite-toggle-btn.is-favorite { background: #ffd700; color: #000; border-color: #ffd700; font-weight: 800; }
.preview-frame { aspect-ratio: 16/10; border: 1px solid rgba(255,255,255,.12); border-radius: 14px; overflow: hidden; background: #050608; display: grid; place-items: center; }
.preview-frame img, .preview-frame video { width: 100%; height: 100%; object-fit: cover; }
.preview-placeholder { color: #556174; letter-spacing: .18em; text-transform: uppercase; font-size: .75rem; }

.catalog-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.catalog-title-group { display: flex; flex-direction: column; }
.catalog-title-row { display: flex; align-items: center; gap: 10px; }
.catalog-head h2 { margin: 0; }
.catalog-head p { margin: 4px 0 0; color: var(--muted); }
.catalog-toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.page-size-selector { display: inline-flex; align-items: center; gap: 3px; background: rgba(10,5,5,.9); border: 1px solid var(--line); border-radius: 8px; padding: 2px 6px; }
.toolbar-label { font-size: .72rem; color: var(--muted); font-weight: 700; text-transform: uppercase; margin-right: 4px; letter-spacing: .05em; }
.page-size-btn { appearance: none; background: transparent; border: 1px solid transparent; color: var(--muted); padding: 3px 8px; font-size: .75rem; font-weight: 700; border-radius: 6px; cursor: pointer; transition: all .15s ease; line-height: 1.2; }
.page-size-btn:hover { color: #ffffff; background: rgba(255,42,42,.15); }
.page-size-btn.is-active { background: var(--accent); color: #ffffff; border-color: var(--accent); font-weight: 800; box-shadow: 0 0 10px rgba(255,42,42,.4); }
.pager { display: flex; align-items: center; gap: 9px; color: var(--muted); }
.pager[hidden] { display: none !important; }

/* Master Bulk Toggle Button */
.system-bulk-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--accent);
  background: rgba(255, 42, 42, 0.12);
  color: #ffffff;
  border-radius: 8px;
  padding: 4px 11px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.15s ease;
}
.system-bulk-toggle-btn[hidden] {
  display: none !important;
}
.system-bulk-toggle-btn:hover {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(255, 42, 42, 0.4);
}
.bulk-toggle-icon {
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1;
}

/* Apple-Style Activity Indicator (Thinking Rotator) */
.apple-rotator {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 18px;
  vertical-align: middle;
}
.apple-rotator[hidden] {
  display: none !important;
}
.apple-rotator .rotator-blade {
  position: absolute;
  left: 44.5%;
  top: 0;
  width: 11%;
  height: 28%;
  background-color: var(--ordis-primary, #00d2ff);
  border-radius: 50px;
  box-shadow: 0 0 5px rgba(0, 210, 255, 0.7);
  transform-origin: center 180%;
  animation: apple-rotator-fade 1.2s linear infinite;
}
.apple-rotator .rotator-blade:nth-child(1) { transform: rotate(0deg); animation-delay: 0s; }
.apple-rotator .rotator-blade:nth-child(2) { transform: rotate(30deg); animation-delay: -1.1s; }
.apple-rotator .rotator-blade:nth-child(3) { transform: rotate(60deg); animation-delay: -1.0s; }
.apple-rotator .rotator-blade:nth-child(4) { transform: rotate(90deg); animation-delay: -0.9s; }
.apple-rotator .rotator-blade:nth-child(5) { transform: rotate(120deg); animation-delay: -0.8s; }
.apple-rotator .rotator-blade:nth-child(6) { transform: rotate(150deg); animation-delay: -0.7s; }
.apple-rotator .rotator-blade:nth-child(7) { transform: rotate(180deg); animation-delay: -0.6s; }
.apple-rotator .rotator-blade:nth-child(8) { transform: rotate(210deg); animation-delay: -0.5s; }
.apple-rotator .rotator-blade:nth-child(9) { transform: rotate(240deg); animation-delay: -0.4s; }
.apple-rotator .rotator-blade:nth-child(10) { transform: rotate(270deg); animation-delay: -0.3s; }
.apple-rotator .rotator-blade:nth-child(11) { transform: rotate(300deg); animation-delay: -0.2s; }
.apple-rotator .rotator-blade:nth-child(12) { transform: rotate(330deg); animation-delay: -0.1s; }

@keyframes apple-rotator-fade {
  0% { opacity: 1; }
  100% { opacity: 0.12; }
}

.apple-rotator.rotator-large {
  width: 48px;
  height: 48px;
}
.apple-rotator.rotator-large .rotator-blade {
  width: 10%;
  height: 28%;
  box-shadow: 0 0 10px rgba(0, 210, 255, 0.95);
}

.catalog-toolbar.is-loading .page-size-btn.is-active {
  animation: ordis-pulse-btn 1s ease infinite alternate;
}
@keyframes ordis-pulse-btn {
  from { opacity: 0.65; }
  to { opacity: 1; }
}
.catalog-main.is-loading {
  pointer-events: none;
}
.catalog-main.is-loading #catalog-grid {
  opacity: 0.35;
  filter: blur(1px);
  transition: opacity 0.2s ease, filter 0.2s ease;
}

/* Prominent Centered Activity Indicator (Thinking Mode) */
.catalog-prominent-loader {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1200;
  pointer-events: none;
  animation: ordis-loader-pop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.catalog-prominent-loader[hidden] {
  display: none !important;
}
@keyframes ordis-loader-pop {
  from { opacity: 0; transform: translate(-50%, -46%) scale(0.96); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.prominent-loader-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 26px 38px;
  min-width: 270px;
  max-width: calc(100vw - 40px);
  background: rgba(10, 4, 8, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(0, 210, 255, 0.5);
  border-radius: 18px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.9), 0 0 35px rgba(0, 210, 255, 0.3);
  text-align: center;
}
.prominent-loader-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.prominent-loader-title {
  font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.03em;
  text-shadow: 0 0 12px rgba(0, 210, 255, 0.5);
}
.prominent-loader-sub {
  font-size: 0.82rem;
  color: var(--text-dim, rgba(255, 255, 255, 0.7));
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* Collapsible System Sections */
.catalog-system-section {
  margin-bottom: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(12, 6, 6, 0.55);
  overflow: hidden;
  transition: border-color 0.2s ease;
}
.catalog-system-section:hover {
  border-color: rgba(255, 42, 42, 0.3);
}
.catalog-system-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: linear-gradient(90deg, rgba(26, 6, 6, 0.85) 0%, rgba(10, 2, 2, 0.95) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}
.catalog-system-header:hover {
  background: linear-gradient(90deg, rgba(38, 10, 10, 0.95) 0%, rgba(18, 4, 4, 0.98) 100%);
}
.catalog-system-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.system-chevron {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--accent);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.catalog-system-section.is-collapsed .system-chevron {
  transform: rotate(-90deg);
}
.catalog-system-name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #ffffff;
  text-shadow: 0 0 8px rgba(255, 42, 42, 0.35);
}
.catalog-system-count {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.system-section-toggle-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.5);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.system-section-toggle-btn:hover {
  color: #ffffff;
  border-color: var(--accent);
  background: rgba(255, 42, 42, 0.2);
}
.catalog-system-section .system-grid {
  padding: 16px;
}
.catalog-system-section.is-collapsed .system-grid {
  display: none !important;
}

.catalog-grid.has-sections {
  display: flex !important;
  flex-direction: column !important;
  gap: 20px !important;
}

.catalog-container { display: grid; grid-template-columns: minmax(0, 1fr) 36px; gap: 14px; position: relative; }
.catalog-main { min-width: 0; }
.alphabet-sidebar { display: flex; flex-direction: column; gap: 1px; position: sticky; top: 16px; align-self: start; max-height: calc(100vh - 32px); padding: 6px 3px; background: rgba(10,5,5,.95); border: 1px solid var(--line); border-radius: 10px; backdrop-filter: blur(8px); z-index: 10; user-select: none; }
.alpha-btn { appearance: none; border: none; background: transparent; color: #8899ac; font-size: .65rem; font-weight: 700; padding: 2px 0; border-radius: 4px; cursor: pointer; text-align: center; line-height: 1.1; transition: all .12s ease; width: 100%; }
.alpha-btn:hover { background: rgba(255,42,42,.2); color: #ffffff; transform: scale(1.15); }
.alpha-btn.is-active { background: var(--accent); color: #ffffff; font-weight: 900; box-shadow: 0 0 10px rgba(255,42,42,.6); }

.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 15px; }
.catalog-grid.is-landscape-system { grid-template-columns: repeat(auto-fill, minmax(195px, 1fr)); gap: 18px; }
.catalog-grid.is-square-system { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 16px; }
.game-card { appearance: none; width: 100%; border: 1px solid transparent; background: transparent; color: var(--text); text-align: left; padding: 0; min-width: 0; border-radius: 14px; position: relative; cursor: pointer; }
.game-card.is-selected .game-cover, .game-card:focus-visible .game-cover { outline: 2px solid var(--accent); outline-offset: 3px; }
.game-cover { aspect-ratio: 3/4; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: linear-gradient(150deg,#140505,#000000); display: grid; place-items: center; transition: transform .2s cubic-bezier(0.16, 1, 0.3, 1), border-color .2s ease, box-shadow .2s ease; position: relative; }
.game-card.is-landscape .game-cover,
.game-cover.is-landscape,
.game-card.system-snes .game-cover,
.game-card.system-n64 .game-cover {
  aspect-ratio: 1.37 / 1;
}
.game-card.is-square .game-cover,
.game-cover.is-square,
.game-card.system-gba .game-cover,
.game-card.system-gameboy .game-cover,
.game-card.system-ngpc .game-cover,
.game-card.system-wsc .game-cover,
.game-card.system-gamegear .game-cover {
  aspect-ratio: 1 / 1;
}
.card-fav-btn { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; border: 1px solid rgba(255,255,255,.2); background: rgba(0,0,0,.85); color: #8899ac; font-size: .95rem; display: grid; place-items: center; cursor: pointer; transition: all .15s ease; z-index: 25; line-height: 1; }
.card-fav-btn:hover { background: #260505; color: #ffd700; transform: scale(1.12); }
.card-fav-btn.is-favorite { color: #ffd700; background: rgba(0,0,0,.85); border-color: #ffd700; text-shadow: 0 0 8px rgba(255,215,0,.6); }
.game-cover img { width: 100%; height: 100%; object-fit: cover; }
.game-cover .fallback { font-size: 2.5rem; font-weight: 900; color: #4a1515; }
.game-card:hover { z-index: 30; }
.game-card:hover .game-cover { transform: scale(1.14) translateY(-6px); border-color: var(--accent); box-shadow: 0 16px 32px rgba(0,0,0,.9), 0 0 22px rgba(255,42,42,.45); }
.game-card strong { display: block; margin-top: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #ffffff; }
.game-card small { display: block; margin-top: 3px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty-state { border: 1px dashed var(--line); border-radius: 14px; padding: 34px; text-align: center; color: var(--muted); }

.hover-popout {
  position: fixed;
  z-index: 1000;
  width: 280px;
  background: rgba(10, 2, 2, 0.98);
  border: 1.5px solid var(--accent);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9), 0 0 30px rgba(255, 42, 42, 0.35);
  padding: 12px;
  backdrop-filter: blur(12px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  transform: translateY(0);
  opacity: 1;
}
.hover-popout[hidden] {
  display: none !important;
  opacity: 0;
  transform: translateY(4px);
}
.hover-popout-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hover-popout-cover {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 10px;
  overflow: hidden;
  background: #0b0e14;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.hover-popout.is-landscape .hover-popout-cover,
.hover-popout-cover.is-landscape,
.hover-popout.system-snes .hover-popout-cover,
.hover-popout.system-n64 .hover-popout-cover {
  aspect-ratio: 1.37 / 1;
}
.hover-popout.is-square .hover-popout-cover,
.hover-popout-cover.is-square,
.hover-popout.system-gba .hover-popout-cover,
.hover-popout.system-gameboy .hover-popout-cover,
.hover-popout.system-ngpc .hover-popout-cover {
  aspect-ratio: 1 / 1;
}
.hover-popout-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hover-popout-details h4 {
  font-size: 0.92rem;
  font-weight: 700;
  margin: 6px 0 0;
  color: var(--text);
  line-height: 1.3;
}
.hover-popout-shot {
  margin-top: 8px;
  aspect-ratio: 16 / 10;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #000;
}
.hover-popout-shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-title-row { display: flex; justify-content: space-between; gap: 20px; align-items: end; margin-bottom: 15px; }
.player-title-row h2 { margin-bottom: 0; }
.player-title-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.player-fav-btn { transition: all .15s ease; cursor: pointer; }
.player-fav-btn.is-favorite { color: #ffd700 !important; border-color: #ffd700 !important; background: rgba(255,215,0,.12) !important; box-shadow: 0 0 12px rgba(255,215,0,.35); font-weight: 700; }
.player-fav-btn:hover { border-color: #ffd700; color: #ffd700; }
.cabinet-stage { width: min(1120px, 100%); margin: 0 auto; filter: drop-shadow(0 24px 28px rgba(0,0,0,.32)); }
.cabinet-marquee { min-height: 72px; border-radius: 24px 24px 4px 4px; border: 2px solid var(--accent); border-bottom: 0; background: linear-gradient(180deg, #200404, #080000); display: flex; align-items: center; justify-content: center; gap: 14px; letter-spacing: .16em; font-weight: 700; box-shadow: inset 0 0 20px rgba(255, 42, 42, 0.25); }
.cabinet-marquee strong { font-size: 1.65rem; color: #ffffff; text-shadow: 0 0 12px rgba(255, 42, 42, 0.8); }
.cabinet-marquee span:last-child { color: var(--accent); font-size: .75rem; font-weight: 800; }
.cabinet-body { display: grid; grid-template-columns: 70px minmax(0, 1fr) 70px; gap: 15px; align-items: center; background: linear-gradient(90deg,#0a0000,var(--cabinet),#0a0000); border-inline: 2px solid var(--cabinet-edge); padding: 22px; }
.monitor-bezel { border: 14px solid #080202; border-radius: 20px; padding: 6px; background: #000000; box-shadow: inset 0 0 0 2px var(--accent); }
.emulator-screen { position: relative; aspect-ratio: 4/3; width: 100%; min-height: 240px; background: var(--screen); overflow: hidden; display: block; border-radius: 7px; }
.emulator-screen > .ejs_parent,
.emulator-screen .ejs_game { width: 100% !important; height: 100% !important; }
.emulator-screen canvas { display: block !important; visibility: visible !important; opacity: 1 !important; width: 100% !important; height: 100% !important; object-fit: contain; }
.emulator-screen .ejs_virtualGamepad_parent,
.emulator-screen .ejs_virtualGamepad_top,
.emulator-screen .ejs_virtualGamepad_bottom,
.emulator-screen .ejs_virtualGamepad_left,
.emulator-screen .ejs_virtualGamepad_right { display: none !important; }
.emulator-screen .ejs_menu_bar { top: auto !important; bottom: 0 !important; }
.emulator-screen .ejs_menu_bar { z-index: 20 !important; }
.emulator-screen .ejs_cheat,
.emulator-screen .ejs_settings,
.emulator-screen [class*="ejs_popup"],
.emulator-screen [class*="ejs_dialog"] { z-index: 100 !important; }
.emulator-placeholder { display: grid; gap: 8px; text-align: center; color: var(--muted); padding: 20px; }
.emulator-placeholder strong { color: var(--text); }
.speaker { aspect-ratio: 1/4; max-height: 260px; background: radial-gradient(circle, #ff2a2a 0 2px, transparent 2.2px) 0 0/9px 9px, #080202; border-radius: 12px; border: 1px solid var(--line); }
.control-deck { min-height: 185px; border: 2px solid var(--accent); border-top: 1px solid var(--accent); border-radius: 0 0 28px 28px; background: linear-gradient(165deg,#1f0505 0%,#0f0202 45%,#000000 100%); display: grid; grid-template-columns: 1fr .7fr 1fr; align-items: center; gap: 20px; padding: 24px 8%; box-shadow: 0 10px 30px rgba(0,0,0,.9); }
.dpad-container { display: flex; flex-direction: column; align-items: center; justify-self: center; user-select: none; -webkit-user-select: none; }
.dpad-row { display: flex; align-items: center; }
.dpad-center { width: 44px; height: 44px; background: #000000; border: 1px solid #330d0d; }
.dpad-btn { width: 44px; height: 44px; border: 2px solid #330d0d; background: linear-gradient(145deg,#240505,#0f0202); color: #ffffff; font-size: 1.15rem; font-weight: bold; display: flex; align-items: center; justify-content: center; cursor: pointer; user-select: none; -webkit-user-select: none; box-shadow: 0 5px 0 #000000, inset 0 2px 4px rgba(255,42,42,.2); transition: transform 45ms ease, box-shadow 45ms ease, background 45ms; }
.dpad-btn:active, .dpad-btn.is-pressed { transform: translateY(4px); box-shadow: 0 1px 0 #000000, inset 0 2px 4px rgba(0,0,0,.6); background: var(--accent); color: #ffffff; }
.dpad-up { border-radius: 9px 9px 0 0; }
.dpad-down { border-radius: 0 0 9px 9px; }
.center-controls { display: flex; gap: 12px; justify-content: center; align-self: end; margin-bottom: 20px; }
.mini-arcade { min-height: 34px; border-radius: 20px; border: 2px solid var(--accent); background: #1a0505; color: #ffffff; font-size: .67rem; font-weight: 900; box-shadow: 0 6px 0 #000000; padding: 5px 12px; cursor: pointer; user-select: none; -webkit-user-select: none; }
.mini-arcade:active, .mini-arcade.is-pressed { transform: translateY(5px); box-shadow: 0 1px 0 #000000; background: var(--accent); color: #ffffff; }
.arcade-buttons { display: grid; gap: 10px; justify-content: center; }
.action-btn-row { display: flex; gap: 10px; justify-content: center; }
.arcade-button { width: 62px; height: 62px; border-radius: 50%; border: 3px solid #000000; color: white; font-weight: 900; font-size: 1.15rem; box-shadow: 0 7px 0 #000000, inset 0 3px 8px rgba(255,255,255,.3); transition: transform 45ms ease, box-shadow 45ms ease, filter 45ms ease; cursor: pointer; user-select: none; -webkit-user-select: none; }
.arcade-button span { display: inline-block; }
.arcade-button:active, .arcade-button.is-pressed { transform: translateY(6px); box-shadow: 0 1px 0 #000000, inset 0 2px 6px rgba(0,0,0,.5); filter: brightness(1.3) contrast(1.1); }

/* System Controller Layouts */
.arcade-buttons.sega-layout { display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.sega-top-row { display: flex; gap: 10px; justify-content: center; transform: translateX(-4px); }
.sega-bottom-row { display: flex; gap: 10px; justify-content: center; }
.sega-top-row .arcade-button { width: 50px; height: 50px; font-size: .95rem; }
.sega-bottom-row .arcade-button { width: 58px; height: 58px; font-size: 1.15rem; }

.arcade-buttons.nes-layout { display: flex; align-items: center; justify-content: center; }
.nes-row { display: flex; gap: 16px; align-items: center; transform: rotate(-6deg); }
.nes-row .arcade-button { width: 62px; height: 62px; border-radius: 12px; }

/* SNES Authentic Diamond & Shoulders Layout */
.snes-layout-wrapper { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.shoulder-btn-row { display: flex; justify-content: space-between; width: 100%; max-width: 220px; margin-bottom: 2px; }
.shoulder-btn { width: 72px; height: 32px; border-radius: 16px; font-size: .85rem; font-weight: 900; background: #6b778d; border: 2px solid #0c0f14; box-shadow: 0 4px 0 #0d1015; }
.snes-diamond { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.snes-diamond-mid { display: flex; gap: 46px; align-items: center; }
.snes-x { background: #8874b3; }
.snes-y { background: #8874b3; }
.snes-a { background: #4f3b78; }
.snes-b { background: #4f3b78; }

/* N64 Authentic Tri-Wing Layout */
.n64-layout-wrapper { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
.n64-shoulders { display: flex; justify-content: space-between; width: 100%; max-width: 260px; }
.n64-l-btn, .n64-r-btn { width: 64px; height: 32px; border-radius: 14px; background: #718093; }
.n64-z-btn { width: 56px; height: 32px; border-radius: 14px; background: #2f3640; color: #f5f6fa; border-color: #1e272e; }
.n64-actions-grid { display: flex; align-items: center; gap: 18px; }
.n64-ab-cluster { display: flex; flex-direction: column; gap: 12px; align-items: center; transform: rotate(18deg); margin-top: 14px; }
.n64-btn-b { background: #10ac84; width: 52px; height: 52px; font-size: 1.1rem; }
.n64-btn-a { background: #2e86de; width: 56px; height: 56px; font-size: 1.15rem; }
.n64-c-cluster { display: flex; flex-direction: column; align-items: center; gap: 3px; background: rgba(0,0,0,.25); padding: 8px; border-radius: 50%; border: 1px solid rgba(255,255,255,.08); }
.n64-c-row { display: flex; gap: 26px; align-items: center; }
.n64-c-btn { background: #f1c40f; color: #1e272e; width: 44px; height: 44px; font-size: .85rem; border-color: #d68910; }
.n64-start-pill { background: #e74c3c !important; color: white !important; }

/* GBA Layout */
/* GBA Layout */
.gba-layout-wrapper { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.gba-ab-row { display: flex; gap: 16px; align-items: center; transform: rotate(-12deg); margin-top: 8px; }
.gba-ab-row .arcade-button { width: 58px; height: 58px; }

/* Neo Geo Curved 4-Button Arc */
.arcade-neogeo-arc { display: flex; gap: clamp(4px, 1.5vw, 10px); align-items: flex-end; padding-top: 6px; }
.neogeo-a { background: #e74c3c; transform: translateY(12px); }
.neogeo-b { background: #f1c40f; color: #1e272e; transform: translateY(4px); }
.neogeo-c { background: #2ecc71; transform: translateY(0px); }
.neogeo-d { background: #3498db; transform: translateY(-4px); }

/* TurboGrafx-16 TurboPad Layout */
.tg16-layout-wrapper { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.tg16-turbo-switches { display: flex; gap: 14px; justify-content: center; }
.tg16-turbo-toggle { background: #e67e22 !important; color: #fff !important; font-size: .7rem !important; padding: 4px 8px !important; }
.tg16-action-row { display: flex; gap: 16px; align-items: center; margin-top: 6px; }
.tg16-btn-i { background: #c0392b; width: 58px; height: 58px; }
.tg16-btn-ii { background: #2980b9; width: 58px; height: 58px; }
.touch-tg16-wrapper { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.touch-tg16-turbos { display: flex; gap: 8px; justify-content: flex-end; }
.touch-tg16-turbos button { width: clamp(38px, 9.5vw, 48px); height: clamp(26px, 6.5vw, 32px); border-radius: 8px; font-size: .75rem; background: #e67e22 !important; }
.tg16-touch-actions button { width: clamp(42px, 11vw, 56px); height: clamp(42px, 11vw, 56px); }

/* NGPC Layout */
.ngpc-row { display: flex; gap: 14px; align-items: center; transform: rotate(-10deg); }
.ngpc-btn-a { background: #e74c3c; width: 56px; height: 56px; }
.ngpc-btn-b { background: #3498db; width: 56px; height: 56px; }

/* Atari 2600 Layout */
.atari-row { display: flex; justify-content: center; }
.atari-fire { background: #e74c3c; width: 68px; height: 68px; font-size: 1.1rem; font-weight: 900; }
.atari-touch-fire { background: #e74c3c !important; width: clamp(54px, 14vw, 70px) !important; height: clamp(54px, 14vw, 70px) !important; font-size: 1.1rem !important; }
.atari-switch { background: #7f8c8d !important; font-size: .68rem !important; }

/* Master System / SG-1000 Layout */
.sms-row { display: flex; gap: 14px; align-items: center; }
.sms-btn-1 { background: #34495e; width: 58px; height: 58px; }
.sms-btn-2 { background: #2c3e50; width: 58px; height: 58px; }

/* Game Gear Handheld Layout */
.gamegear-row { display: flex; gap: 14px; align-items: center; transform: rotate(-8deg); }
.gamegear-btn-1 { background: #1e272e; border: 2px solid #00d2d3 !important; color: #00d2d3 !important; width: 58px; height: 58px; font-weight: 900; }
.gamegear-btn-2 { background: #1e272e; border: 2px solid #00d2d3 !important; color: #00d2d3 !important; width: 58px; height: 58px; font-weight: 900; }
.gamegear-start-pill { background: #0984e3 !important; color: #ffffff !important; font-weight: 900; letter-spacing: 0.08em; }
.touch-row.gamegear-touch-row { display: flex; gap: 10px; }
.touch-btn.gamegear-btn-1, .touch-btn.gamegear-btn-2 { background: #1e272e !important; border-color: #00d2d3 !important; color: #00d2d3 !important; }

/* Game Boy / Color Handheld Layout */
.gameboy-row { display: flex; gap: 16px; align-items: center; transform: rotate(-25deg); }
.gameboy-btn-b { background: #8b1d42; width: 56px; height: 56px; font-weight: 900; }
.gameboy-btn-a { background: #8b1d42; width: 56px; height: 56px; font-weight: 900; }
.gameboy-pill { background: #4b515d !important; color: #dcdde1 !important; transform: rotate(-25deg); border-radius: 12px !important; font-size: 0.62rem !important; }
.touch-row.gameboy-touch-row { display: flex; gap: 12px; transform: rotate(-18deg); }
.touch-btn.gameboy-btn-b, .touch-btn.gameboy-btn-a { background: #8b1d42 !important; border-color: #b33939 !important; }

/* Atari 7800 ProLine Layout */
.atari7800-row { display: flex; gap: 16px; align-items: center; }
.atari7800-btn-1 { background: #c0392b; width: 62px; height: 62px; font-weight: 900; }
.atari7800-btn-2 { background: #d35400; width: 62px; height: 62px; font-weight: 900; }
.touch-row.atari7800-touch-row { display: flex; gap: 14px; }
.touch-btn.atari7800-btn-1 { background: #c0392b !important; }
.touch-btn.atari7800-btn-2 { background: #d35400 !important; }

.button-a { background: #d24545; }
.button-b { background: #3f75c9; }
.button-c { background: #229954; }
.button-x { background: #5da55d; }
.button-y { background: #b5963a; }
.button-z { background: #2980b9; }
.button-triangle { background: #22b28c; }
.button-circle { background: #dc3545; }
.button-cross { background: #4a7ad4; }
.button-square { background: #cc4c98; }

/* Mobile Touch Overlay Styles */
.touch-snes-wrapper, .touch-n64-wrapper, .touch-gba-wrapper { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.touch-snes-shoulders, .touch-n64-top { display: flex; gap: clamp(4px, 1.2vw, 8px); justify-content: flex-end; width: 100%; }
.touch-snes-shoulders button, .touch-n64-top button { width: clamp(40px, 10.5vw, 54px); height: clamp(26px, 7vw, 34px); border-radius: 12px; font-size: clamp(.68rem, 2vw, .8rem); }
.touch-diamond { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.touch-diamond-mid { display: flex; gap: clamp(24px, 6.5vw, 38px); }
.touch-diamond button { width: clamp(38px, 10vw, 50px); height: clamp(38px, 10vw, 50px); }

.touch-n64-bottom { display: flex; gap: clamp(8px, 2.5vw, 14px); align-items: center; }
.touch-n64-ab { display: flex; flex-direction: column; gap: 8px; }
.touch-n64-a { background: #2e86de !important; width: clamp(38px, 10vw, 50px); height: clamp(38px, 10vw, 50px); }
.touch-n64-b { background: #10ac84 !important; width: clamp(36px, 9.5vw, 48px); height: clamp(36px, 9.5vw, 48px); }
.touch-n64-c { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.touch-c-mid { display: flex; gap: clamp(16px, 4.5vw, 24px); }
.touch-c-btn { background: #f1c40f !important; color: #1e272e !important; width: clamp(30px, 8vw, 38px); height: clamp(30px, 8vw, 38px); font-size: clamp(.65rem, 1.8vw, .75rem) !important; }
.touch-z-trigger { background: #2f3640 !important; }

.sega-touch-actions { display: flex; flex-direction: column; gap: 6px; }
.sega-touch-row { display: flex; gap: clamp(4px, 1.5vw, 8px); justify-content: flex-end; }
.sega-touch-row button { width: clamp(34px, 9vw, 48px); height: clamp(34px, 9vw, 48px); font-size: clamp(.75rem, 2.2vw, .95rem); }

.session-controls { width: min(1120px,100%); margin: 14px auto 0; display: flex; flex-wrap: wrap; gap: 8px; }
.session-controls button.is-active { border-color: var(--accent); background: rgba(85,200,255,.13); }
.session-fav-btn { transition: all .15s ease; cursor: pointer; }
.session-fav-btn.is-favorite { color: #ffd700 !important; border-color: #ffd700 !important; background: rgba(255,215,0,.15) !important; box-shadow: 0 0 10px rgba(255,215,0,.3); font-weight: 700; }
.session-fav-btn:hover { border-color: #ffd700; color: #ffd700; }
.touch-controls { display: none; grid-template-columns: 1fr auto 1fr; gap: clamp(6px, 1.8vw, 12px); align-items: center; margin: 10px auto 0; padding: 8px 3px; width: 100%; max-width: min(760px,100vw); box-sizing: border-box; overflow: hidden; opacity: var(--touch-control-opacity); }
.touch-stick-zone { width: clamp(100px, 27vw, 156px); height: clamp(100px, 27vw, 156px); display: grid; place-items: center; position: relative; touch-action: none; user-select: none; -webkit-user-select: none; justify-self: start; }
.touch-stick-hit { position: absolute; z-index: 2; border: 0; background: transparent; padding: 0; touch-action: none; }
.touch-stick-up { left: 24%; right: 24%; top: 0; height: 35%; }
.touch-stick-down { left: 24%; right: 24%; bottom: 0; height: 35%; }
.touch-stick-left { left: 0; top: 24%; bottom: 24%; width: 35%; }
.touch-stick-right { right: 0; top: 24%; bottom: 24%; width: 35%; }
.touch-stick-zone > span { position: absolute; bottom: 3px; color: white; font-size: .6rem; letter-spacing: .14em; }
.touch-stick-ring { width: clamp(80px, 22vw, 126px); height: clamp(80px, 22vw, 126px); border-radius: 50%; border: 2px solid rgba(255,255,255,.8); background: rgba(26,34,46,.68); box-shadow: inset 0 0 22px rgba(0,0,0,.35); display: grid; place-items: center; pointer-events: none; }
.touch-stick-ring::before, .touch-stick-ring::after { content: ""; position: absolute; background: rgba(255,255,255,.4); pointer-events: none; }
.touch-stick-ring::before { width: 60%; height: 1px; }
.touch-stick-ring::after { width: 1px; height: 60%; }
.touch-stick-knob { width: clamp(36px, 9.5vw, 54px); height: clamp(36px, 9.5vw, 54px); border-radius: 50%; border: 1px solid rgba(255,255,255,.85); background: rgba(116,137,165,.82); box-shadow: 0 5px 15px rgba(0,0,0,.35); transition: transform 45ms linear; will-change: transform; }
.touch-actions { display:flex; gap:clamp(4px, 1.5vw, 10px); justify-content:flex-end; align-items:center; }
.touch-actions button { width: clamp(38px, 10vw, 62px); height: clamp(38px, 10vw, 62px); border-radius:50%; font-size:clamp(.8rem, 2.4vw, 1.15rem); font-weight:900; }
.touch-middle { display:grid; gap:clamp(4px, 1vw, 8px); align-self:end; padding-bottom:8px; }
.touch-middle button { border-radius:14px; padding:clamp(3px, 1vw, 6px) clamp(5px, 1.5vw, 9px); font-size:clamp(.58rem, 1.8vw, .68rem); white-space:nowrap; }
.touch-actions button, .touch-middle button { touch-action: none; user-select: none; -webkit-user-select: none; border: 1px solid rgba(255,255,255,.75); background: rgba(32,39,51,.9); color: white; transition: transform 45ms ease, background 45ms ease; }
.touch-actions button:active, .touch-actions button.is-pressed,
.touch-middle button:active, .touch-middle button.is-pressed { transform: translateY(3px); background: var(--accent) !important; color: #07090d !important; }
/* Arcade Fullscreen Mode (Cross-Browser: Chrome, Safari/WebKit, Firefox, Edge + Pseudo-Fullscreen) */
#arcade-fullscreen-stage:fullscreen,
#arcade-fullscreen-stage:-webkit-full-screen,
#arcade-fullscreen-stage:-moz-full-screen,
#arcade-fullscreen-stage.is-pseudo-fullscreen {
  width: 100vw;
  height: 100dvh;
  max-width: 100vw;
  max-height: 100dvh;
  margin: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overflow: hidden;
  background: #000000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
}

#arcade-fullscreen-stage.is-pseudo-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 9998;
}

body.arcade-pseudo-fullscreen {
  overflow: hidden;
}

/* Hide non-game cabinet chrome in fullscreen so the game canvas completely fills the screen */
#arcade-fullscreen-stage:fullscreen .cabinet-marquee,
#arcade-fullscreen-stage:-webkit-full-screen .cabinet-marquee,
#arcade-fullscreen-stage:-moz-full-screen .cabinet-marquee,
#arcade-fullscreen-stage.is-pseudo-fullscreen .cabinet-marquee,
#arcade-fullscreen-stage:fullscreen .speaker,
#arcade-fullscreen-stage:-webkit-full-screen .speaker,
#arcade-fullscreen-stage:-moz-full-screen .speaker,
#arcade-fullscreen-stage.is-pseudo-fullscreen .speaker,
#arcade-fullscreen-stage:fullscreen .control-deck,
#arcade-fullscreen-stage:-webkit-full-screen .control-deck,
#arcade-fullscreen-stage:-moz-full-screen .control-deck,
#arcade-fullscreen-stage.is-pseudo-fullscreen .control-deck {
  display: none !important;
}

/* Cabinet body expands to 100% available viewport */
#arcade-fullscreen-stage:fullscreen .cabinet-body,
#arcade-fullscreen-stage:-webkit-full-screen .cabinet-body,
#arcade-fullscreen-stage:-moz-full-screen .cabinet-body,
#arcade-fullscreen-stage.is-pseudo-fullscreen .cabinet-body {
  flex: 1 1 0%;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  background: transparent !important;
  min-height: 0;
  min-width: 0;
}

/* Monitor bezel strips borders and fills cabinet body */
#arcade-fullscreen-stage:fullscreen .monitor-bezel,
#arcade-fullscreen-stage:-webkit-full-screen .monitor-bezel,
#arcade-fullscreen-stage:-moz-full-screen .monitor-bezel,
#arcade-fullscreen-stage.is-pseudo-fullscreen .monitor-bezel {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  min-width: 0;
  position: relative;
}

/* Emulator screen fills available space cleanly without aspect-ratio overflow */
#arcade-fullscreen-stage:fullscreen .emulator-screen,
#arcade-fullscreen-stage:-webkit-full-screen .emulator-screen,
#arcade-fullscreen-stage:-moz-full-screen .emulator-screen,
#arcade-fullscreen-stage.is-pseudo-fullscreen .emulator-screen {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  aspect-ratio: auto !important;
  min-height: 0 !important;
  border-radius: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#arcade-fullscreen-stage:fullscreen .emulator-screen canvas,
#arcade-fullscreen-stage:-webkit-full-screen .emulator-screen canvas,
#arcade-fullscreen-stage:-moz-full-screen .emulator-screen canvas,
#arcade-fullscreen-stage.is-pseudo-fullscreen .emulator-screen canvas {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
}

/* Floating exit button in fullscreen */
.arcade-exit-fullscreen {
  display: none;
}
#arcade-fullscreen-stage:fullscreen .arcade-exit-fullscreen,
#arcade-fullscreen-stage:-webkit-full-screen .arcade-exit-fullscreen,
#arcade-fullscreen-stage:-moz-full-screen .arcade-exit-fullscreen,
#arcade-fullscreen-stage.is-pseudo-fullscreen .arcade-exit-fullscreen {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  z-index: 120;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 42, 42, 0.4);
  background: rgba(10, 0, 0, 0.75);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  backdrop-filter: blur(4px);
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s ease, background 0.2s ease;
}
#arcade-fullscreen-stage:fullscreen .arcade-exit-fullscreen:hover,
#arcade-fullscreen-stage:-webkit-full-screen .arcade-exit-fullscreen:hover,
#arcade-fullscreen-stage:-moz-full-screen .arcade-exit-fullscreen:hover,
#arcade-fullscreen-stage.is-pseudo-fullscreen .arcade-exit-fullscreen:hover {
  opacity: 1;
  background: rgba(255, 42, 42, 0.25);
  border-color: var(--accent);
}
.control-settings[hidden] { display: none; }
.control-settings { position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; padding: 16px; }
.control-settings-backdrop { position: absolute; inset: 0; background: rgba(2,4,8,.82); backdrop-filter: blur(6px); }
.control-settings-panel { position: relative; width: min(760px,100%); max-height: min(88vh,820px); overflow-y: auto; border: 1.5px solid var(--accent); border-radius: 18px; background: #080202; box-shadow: 0 24px 80px rgba(0,0,0,.95), 0 0 30px rgba(255,42,42,.35); padding: 20px; }
.control-settings-panel header, .control-settings-panel footer, .controller-status-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.control-settings-panel h3 { margin: 5px 0 0; font-size: 1.5rem; color: #ffffff; }
.settings-close { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: #000000; color: #ffffff; }
.settings-help { color: var(--muted); line-height: 1.45; }
.controller-status-row { margin: 16px 0; padding: 12px; border-radius: 10px; background: #000000; border: 1px solid var(--line); }
.controller-status-row strong { min-width: 0; overflow-wrap: anywhere; color: #ffffff; }
.controller-status-row label, .mapping-options label { color: var(--muted); display: grid; gap: 6px; font-size: .78rem; }
.controller-status-row select, .mapping-row select, .mapping-options select { border: 1px solid var(--line); border-radius: 8px; background: #000000; color: #ffffff; padding: 8px; }
.mapping-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.mapping-row { display: grid; grid-template-columns: 72px 1fr 112px; align-items: center; gap: 8px; padding: 7px; border: 1px solid var(--line); border-radius: 9px; background: #050101; }
.map-key { min-height: 36px; border: 1px solid var(--line); border-radius: 8px; background: #120303; color: #ffffff; }
.mapping-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin: 16px 0; padding-top: 16px; border-top: 1px solid var(--line); }
.mapping-options input[type="range"] { width: 100%; accent-color: var(--accent); }
.control-settings-panel footer { border-top: 1px solid var(--line); padding-top: 15px; }
body.controls-open { overflow: hidden; }
.cheat-entry-panel { width: min(580px, 100%); }
.cheat-form { display: grid; gap: 16px; margin-top: 14px; }
.cheat-field-group { display: grid; gap: 6px; }
.cheat-field-group label { color: var(--muted); font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.cheat-field-group input { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #000000; color: #ffffff; padding: 10px 12px; font-size: 0.95rem; }
.cheat-field-group input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 10px rgba(255,42,42,0.3); }
.cheat-field-group .mono-code-input { font-family: "Cascadia Code", Consolas, monospace; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700; }
.cheat-feedback { padding: 10px 14px; border-radius: 8px; font-size: 0.88rem; font-weight: 600; }
.cheat-feedback.is-ok { background: rgba(46,204,113,0.15); border: 1px solid #2ecc71; color: #2ecc71; }
.cheat-feedback.is-error { background: rgba(231,76,60,0.15); border: 1px solid #e74c3c; color: #e74c3c; }
.cheat-active-section { margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--line); }
.active-cheats-list { display: grid; gap: 8px; margin-top: 8px; max-height: 160px; overflow-y: auto; padding-right: 4px; }
.active-cheat-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: #050101; }
.active-cheat-name { font-size: 0.88rem; color: #ffffff; font-weight: 600; }
.active-cheat-code { font-size: 0.82rem; color: var(--accent); background: #120303; padding: 3px 8px; border-radius: 4px; border: 1px solid rgba(255,42,42,0.3); font-family: monospace; font-weight: 700; }
.cheat-modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: 12px; border-top: 1px solid var(--line); padding-top: 16px; margin-top: 6px; }
.command-console { width: min(1120px,100%); margin: 18px auto 0; border: 1.5px solid var(--accent); border-radius: 13px; overflow: hidden; background: #000000; font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace; box-shadow: 0 10px 30px rgba(0,0,0,.8), 0 0 15px rgba(255,42,42,.2); }
.console-head { display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); background: #0c0202; color: var(--accent); font-size: .74rem; letter-spacing: .08em; font-weight: 800; }
.console-output { min-height: 118px; max-height: 230px; overflow-y: auto; padding: 10px 13px; color: #ffffff; font-size: .82rem; line-height: 1.55; }
.console-output .ok { color: var(--ok); }
.console-output .error { color: var(--danger); }
.console-form { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding: 8px 11px; background: #050000; }
.console-form input { border: 0; background: transparent; min-height: 38px; font-family: inherit; color: #ffffff; }
.console-form input:focus { box-shadow: none; }
.console-form button { border: 1px solid var(--accent); background: #1f0505; color: #ffffff; border-radius: 8px; padding: 8px 13px; }

.ingestion-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 18px; }
.ingestion-head h2 { margin-bottom: 8px; color: #ffffff; }
.ingestion-head p { color: var(--muted); margin: 0; }
.ingestion-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.status-cards { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 14px; }
.status-cards article { border: 1px solid var(--line); border-radius: 13px; background: var(--panel); padding: 16px; }
.status-cards span { display: block; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 7px; }
.status-cards strong { overflow-wrap: anywhere; color: #ffffff; }
.ingestion-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.panel { border: 1px solid var(--line); border-radius: 13px; background: var(--panel); padding: 17px; }
.panel h3 { margin: 0 0 13px; color: #ffffff; }
.provider-list { display: grid; gap: 9px; }
.provider { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 9px; }
.provider:last-child { border-bottom: 0; padding-bottom: 0; }
.provider .good { color: var(--ok); }
.provider .bad { color: #e8b25b; }
.result-list { display: grid; grid-template-columns: 110px 1fr; gap: 9px 12px; margin: 0; }
.result-list dt { color: var(--muted); }
.result-list dd { margin: 0; overflow-wrap: anywhere; }
.ingestion-log { max-height: 390px; overflow-y: auto; display: grid; gap: 7px; font-family: "Cascadia Code", Consolas, monospace; font-size: .78rem; }
.log-line { display: grid; grid-template-columns: 160px 70px 120px 1fr; gap: 8px; border-bottom: 1px solid #202833; padding: 5px 0; }
.log-line .warning { color: #e8b25b; }
.log-line .error { color: var(--danger); }

@media (max-width: 980px) {
  .featured-content { grid-template-columns: 140px 1fr; }
  .preview-frame { display: none; }
  .status-cards { grid-template-columns: 1fr 1fr; }
  .ingestion-columns { grid-template-columns: 1fr; }
  .cabinet-body { grid-template-columns: 24px minmax(0,1fr) 24px; gap: 8px; padding: 12px; }
  .speaker { opacity: .35; }
  .control-deck { display:none; }
  .touch-controls { display:grid; }
}

@media (max-width: 680px) {
  .arcade-shell { padding: 12px 10px 34px; }
  .topbar { align-items: flex-start; }
  .brand-mark { width: 40px; height: 40px; border-radius: 11px; }
  .top-actions { gap: 5px; }
  .nav-btn { padding: 8px 9px; font-size: .82rem; }
  .search-row { grid-template-columns: 1fr; }
  .featured { min-height: 0; }
  .featured-bg { opacity: .16; }
  .featured::after { background: rgba(10,12,17,.72); }
  .featured-content { grid-template-columns: 92px 1fr; padding: 16px; gap: 14px; }
  .featured-cover-wrap { max-height: 132px; }
  .featured-copy h2 { font-size: 1.35rem; }
  .featured-copy p { display: none; }
  .featured-actions .secondary-btn { display: none; }
  .catalog-grid { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
  .game-card strong { font-size: .78rem; }
  .game-card small { font-size: .68rem; }
  .player-title-row { align-items: center; }
  .player-title-row h2 { font-size: 1.25rem; }
  .cabinet-marquee { min-height: 48px; border-radius: 16px 16px 3px 3px; font-size: .72rem; }
  .cabinet-marquee strong { font-size: 1.1rem; }
  .cabinet-body { grid-template-columns: 1fr; padding: 8px; border-inline-width: 1px; }
  .speaker { display: none; }
  .monitor-bezel { border-width: 7px; border-radius: 11px; padding: 3px; }
  .control-deck { display: none; }
  .session-controls { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 5px; }
  .session-controls button { white-space: nowrap; }
  .touch-controls { display: grid; grid-template-columns: 1fr auto 1fr; gap: clamp(6px, 1.8vw, 12px); align-items: center; margin: 10px 0; padding: 8px 3px; opacity: var(--touch-control-opacity); max-width: 100vw; box-sizing: border-box; overflow: hidden; }
  .touch-stick-zone { width: clamp(100px, 26vw, 140px); height: clamp(100px, 26vw, 140px); display: grid; place-items: center; position: relative; touch-action: none; user-select: none; -webkit-user-select: none; justify-self: start; }
  .touch-stick-hit { position: absolute; z-index: 2; border: 0; background: transparent; padding: 0; touch-action: none; }
  .touch-stick-up { left: 24%; right: 24%; top: 0; height: 35%; }
  .touch-stick-down { left: 24%; right: 24%; bottom: 0; height: 35%; }
  .touch-stick-left { left: 0; top: 24%; bottom: 24%; width: 35%; }
  .touch-stick-right { right: 0; top: 24%; bottom: 24%; width: 35%; }
  .touch-stick-zone > span { position: absolute; bottom: 3px; color: white; font-size: .6rem; letter-spacing: .14em; }
  .touch-stick-ring { width: clamp(80px, 22vw, 120px); height: clamp(80px, 22vw, 120px); border-radius: 50%; border: 2px solid rgba(255,255,255,.8); background: rgba(26,34,46,.68); box-shadow: inset 0 0 22px rgba(0,0,0,.35); display: grid; place-items: center; }
  .touch-stick-ring::before, .touch-stick-ring::after { content: ""; position: absolute; background: rgba(255,255,255,.4); pointer-events: none; }
  .touch-stick-ring::before { width: 60%; height: 1px; }
  .touch-stick-ring::after { width: 1px; height: 60%; }
  .touch-stick-knob { width: clamp(34px, 9vw, 50px); height: clamp(34px, 9vw, 50px); border-radius: 50%; border: 1px solid rgba(255,255,255,.85); background: rgba(116,137,165,.82); box-shadow: 0 5px 15px rgba(0,0,0,.35); transition: transform 45ms linear; will-change: transform; }
  .touch-actions button, .touch-middle button { touch-action: none; user-select: none; -webkit-user-select: none; border: 1px solid rgba(255,255,255,.75); background: rgba(32,39,51,.9); color: white; }
  .touch-actions { display:flex; gap:clamp(4px, 1.5vw, 8px); justify-content:flex-end; align-items:center; }
  .touch-actions button { width: clamp(36px, 9.5vw, 52px); height: clamp(36px, 9.5vw, 52px); border-radius:50%; font-size:clamp(.75rem, 2.2vw, 1rem); font-weight:900; }
  .touch-middle { display:grid; gap:clamp(4px, 1vw, 8px); align-self:end; padding-bottom:8px; }
  .touch-middle button { border-radius:14px; padding:clamp(3px, 1vw, 6px) clamp(5px, 1.5vw, 9px); font-size:clamp(.55rem, 1.8vw, .68rem); white-space:nowrap; }
  .mapping-grid { grid-template-columns: 1fr; }
  .command-console { margin-top: 10px; }
  .console-output { min-height: 90px; max-height: 150px; }
  .status-cards { grid-template-columns: 1fr 1fr; }
  .ingestion-head { align-items: flex-start; flex-direction: column; }
  .log-line { grid-template-columns: 1fr; gap: 2px; }
}

@media (any-pointer: coarse) {
  .control-deck { display:none; }
  .touch-controls { display:grid; }
  #arcade-fullscreen-stage:fullscreen .touch-controls,
  #arcade-fullscreen-stage:-webkit-full-screen .touch-controls,
  #arcade-fullscreen-stage:-moz-full-screen .touch-controls,
  #arcade-fullscreen-stage.is-pseudo-fullscreen .touch-controls { display:flex; }
}

@media (orientation: landscape) and (any-pointer: coarse) {
  #arcade-fullscreen-stage:fullscreen .touch-controls,
  #arcade-fullscreen-stage:-webkit-full-screen .touch-controls,
  #arcade-fullscreen-stage:-moz-full-screen .touch-controls,
  #arcade-fullscreen-stage.is-pseudo-fullscreen .touch-controls {
    position: absolute;
    inset: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    margin: 0;
    padding: max(6px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    pointer-events: none;
    z-index: 50;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    box-sizing: border-box;
  }

  #arcade-fullscreen-stage:fullscreen .touch-controls > *,
  #arcade-fullscreen-stage:-webkit-full-screen .touch-controls > *,
  #arcade-fullscreen-stage:-moz-full-screen .touch-controls > *,
  #arcade-fullscreen-stage.is-pseudo-fullscreen .touch-controls > * {
    pointer-events: auto;
  }
}

@media (orientation: portrait) and (any-pointer: coarse) {
  #arcade-fullscreen-stage:fullscreen .touch-controls,
  #arcade-fullscreen-stage:-webkit-full-screen .touch-controls,
  #arcade-fullscreen-stage:-moz-full-screen .touch-controls,
  #arcade-fullscreen-stage.is-pseudo-fullscreen .touch-controls {
    display: grid;
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
    margin-top: auto;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
}

/* Galaxy Z Fold 6 / Fold 7 Folded Outer Screen & Ultra-Narrow Phones (320px - 420px) */
@media (max-width: 420px) {
  .brand-block p { display: none; }
  .catalog-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
  .touch-controls { grid-template-columns: 1fr auto 1fr; gap: 4px; padding: 4px 2px; }
  .touch-stick-zone { width: clamp(86px, 24vw, 110px); height: clamp(86px, 24vw, 110px); }
  .touch-stick-ring { width: clamp(72px, 20vw, 96px); height: clamp(72px, 20vw, 96px); }
  .touch-stick-knob { width: clamp(30px, 8vw, 40px); height: clamp(30px, 8vw, 40px); }
  .touch-actions button { width: clamp(32px, 8.5vw, 44px); height: clamp(32px, 8.5vw, 44px); font-size: clamp(.68rem, 2vw, .85rem); }
  .touch-middle { gap: 4px; padding-bottom: 4px; }
  .touch-middle button { padding: 3px 6px; font-size: .58rem; }
  .arcade-neogeo-arc { gap: 4px; }
  .arcade-neogeo-arc button { width: clamp(30px, 8vw, 38px) !important; height: clamp(30px, 8vw, 38px) !important; font-size: .7rem !important; }
  .sega-touch-row button { width: clamp(30px, 8vw, 38px); height: clamp(30px, 8vw, 38px); font-size: .75rem; }
  .touch-snes-shoulders button, .touch-n64-top button { width: clamp(34px, 9vw, 42px); height: 26px; font-size: .65rem; }
  .touch-diamond button { width: clamp(32px, 8.5vw, 40px); height: clamp(32px, 8.5vw, 40px); }
  .touch-diamond-mid { gap: 20px; }
  .mapping-row { grid-template-columns: 56px 1fr 104px; padding: 5px; }
  .mapping-options { grid-template-columns: 1fr; }
  .controller-status-row { align-items: stretch; flex-direction: column; }
  .status-cards { grid-template-columns: 1fr; }
}

@media (max-width: 360px) {
  .touch-controls { grid-template-columns: 1fr auto 1fr; gap: 2px; }
  .touch-stick-zone { width: 84px; height: 84px; }
  .touch-stick-ring { width: 70px; height: 70px; }
  .touch-actions button { width: 30px; height: 30px; font-size: .65rem; }
  .arcade-neogeo-arc button { width: 28px !important; height: 28px !important; font-size: .62rem !important; }
}

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

.panel-heading-row { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.panel-heading-row > span { color:var(--muted); font-size:.78rem; }
.game-admin-panel { margin-bottom:14px; }
.game-admin-list { display:grid; gap:9px; margin-top:12px; }
.game-admin-row { display:grid; grid-template-columns:minmax(180px,1.4fr) 130px 130px minmax(220px,1fr) auto; gap:10px; align-items:center; border-top:1px solid #222b37; padding-top:9px; }
.game-admin-row:first-child { border-top:0; padding-top:0; }
.game-admin-row strong { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.game-admin-row .status-ready { color:var(--ok); }
.game-admin-row .status-failed { color:var(--danger); }
.game-admin-row .status-needs_rom_selection { color:#e8b25b; }
.game-admin-row select { min-width:0; border:1px solid var(--line); background:#0e131b; color:var(--text); border-radius:8px; padding:7px 9px; }
.game-admin-row button { border:1px solid var(--line); background:#111822; color:var(--text); border-radius:8px; padding:7px 10px; }
.game-admin-error { color:var(--muted); font-size:.75rem; overflow-wrap:anywhere; }
@media (max-width:900px) { .game-admin-row { grid-template-columns:1fr 110px; } .game-admin-row .game-admin-error, .game-admin-row select { grid-column:1 / -1; } }

.active-filters-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 8px 14px;
  background: rgba(10, 3, 3, 0.9);
  border: 1px solid rgba(255, 42, 42, 0.45);
  border-radius: 10px;
  backdrop-filter: blur(8px);
}
.active-filters-bar[hidden] {
  display: none !important;
}
.active-filters-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.active-filters-list {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(255, 42, 42, 0.15);
  border: 1px solid rgba(255, 42, 42, 0.6);
  color: #ffffff;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.filter-pill:hover {
  background: rgba(255, 42, 42, 0.35);
  border-color: #ff2a2a;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(255, 42, 42, 0.5);
}
.filter-pill-dismiss {
  font-size: 0.85rem;
  font-weight: 800;
  opacity: 0.85;
}
.clear-all-btn {
  margin-left: auto;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.clear-all-btn:hover {
  background: rgba(255, 42, 42, 0.25);
  border-color: var(--accent);
  color: #ffffff;
}

/* Floating Back-To-Top Button — sits to the LEFT of the Ordis chat bubble.
   Desktop/tablet (>900px): bubble is ~200px pill → needs ~246px clearance.
   Mobile/foldable/flip (≤900px): bubble collapses to 50px circle → only ~90px clearance needed. */
.back-to-top-btn {
  position: fixed;
  bottom: calc(max(28px, env(safe-area-inset-bottom, 0px)) + 8px);
  right: calc(max(240px, env(safe-area-inset-right, 0px)) + 6px);
  z-index: 99;
  background: linear-gradient(135deg, #1f0505, #0a0000);
  color: #ffffff;
  border: 1.5px solid var(--accent);
  border-radius: 50px;
  padding: 10px 18px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.8), 0 0 14px rgba(255, 42, 42, 0.4);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}
.back-to-top-btn:hover {
  background: var(--accent);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255, 42, 42, 0.6);
}

/* Phones, flips, foldable inner/outer (≤900px) — bubble is 50px circle, much less clearance needed */
@media (max-width: 900px) {
  .back-to-top-btn {
    right: calc(max(86px, env(safe-area-inset-right, 0px)) + 6px);
    padding: 8px 14px;
    font-size: 0.75rem;
  }
}

/* Fold 6 / Flip outer cover screens and ultra-narrow phones (≤420px) */
@media (max-width: 420px) {
  .back-to-top-btn {
    right: calc(max(76px, env(safe-area-inset-right, 0px)) + 6px);
    padding: 7px 11px;
    font-size: 0.70rem;
  }
}

/* Sub-360px (very small cover screens) — hide the button, no room to share the bottom bar */
@media (max-width: 360px) {
  .back-to-top-btn {
    display: none;
  }
}

/* --- Retro Cheat Vault & Game Genie Badges --- */
.player-cheats-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 184, 0, 0.12);
  border: 1.5px solid rgba(255, 184, 0, 0.55);
  border-radius: 999px;
  padding: 6px 16px;
  color: #ffcf48;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-shadow: 0 0 10px rgba(255, 184, 0, 0.5);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 14px rgba(255, 184, 0, 0.18);
  backdrop-filter: blur(8px);
}
.player-cheats-badge:hover {
  background: rgba(255, 184, 0, 0.25);
  border-color: #ffcf48;
  color: #ffffff;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 20px rgba(255, 184, 0, 0.45);
}
.player-cheats-badge .cheats-badge-icon {
  font-size: 1.05rem;
  filter: drop-shadow(0 0 6px rgba(255, 184, 0, 0.8));
}

.card-cheats-pill {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(18, 10, 4, 0.88);
  border: 1px solid rgba(255, 184, 0, 0.7);
  color: #ffcf48;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.7), 0 0 8px rgba(255, 184, 0, 0.3);
  z-index: 2;
  pointer-events: none;
  backdrop-filter: blur(4px);
}

.bubble-tag.cheats-tag {
  background: rgba(255, 184, 0, 0.2);
  border: 1px solid #ffcf48;
  color: #ffcf48;
}

/* EmulatorJS Context Menu & Overlays */
.emulator-screen .ejs_context_menu,
#game .ejs_context_menu,
.ejs_context_menu {
  z-index: 1000 !important;
  background: rgba(14, 18, 28, 0.96) !important;
  border: 1px solid rgba(80, 160, 255, 0.4) !important;
  border-radius: 8px !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8), 0 0 12px rgba(0, 180, 255, 0.25) !important;
  backdrop-filter: blur(12px) !important;
  color: #e2e8f0 !important;
  padding: 6px 0 !important;
  min-width: 170px !important;
}

.ejs_context_menu_close_row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 4px 10px 6px 12px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
  margin-bottom: 4px !important;
}

.ejs_context_title {
  font-size: 0.75rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.08em !important;
  color: #8da2c0 !important;
}

.ejs_context_close_btn {
  background: transparent !important;
  border: none !important;
  color: #ff5c77 !important;
  font-size: 1rem !important;
  font-weight: bold !important;
  cursor: pointer !important;
  padding: 0 4px !important;
  line-height: 1 !important;
  border-radius: 4px !important;
  transition: all 0.15s ease !important;
}

.ejs_context_close_btn:hover {
  color: #ffffff !important;
  background: rgba(255, 92, 119, 0.25) !important;
  transform: scale(1.1) !important;
}

.emulator-screen .ejs_context_menu > div:not(.ejs_context_menu_close_row),
#game .ejs_context_menu > div:not(.ejs_context_menu_close_row),
.ejs_context_menu > div:not(.ejs_context_menu_close_row) {
  padding: 8px 14px !important;
  font-size: 0.85rem !important;
  cursor: pointer !important;
  transition: background 0.15s ease !important;
  color: #f1f5f9 !important;
}

.emulator-screen .ejs_context_menu > div:not(.ejs_context_menu_close_row):hover,
#game .ejs_context_menu > div:not(.ejs_context_menu_close_row):hover,
.ejs_context_menu > div:not(.ejs_context_menu_close_row):hover {
  background: rgba(0, 180, 255, 0.2) !important;
  color: #38bdf8 !important;
}

