/* Legacy strategies / retro library */
.top-bar--legacy {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 10px;
  margin-bottom: 10px;
}
.legacy-top-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.legacy-top-nav .studio-home-link {
  min-height: 36px;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
}
.legacy-top-nav .btn {
  margin: 0;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}

.legacy-nav {
  margin: 0 0 12px;
}
.legacy-nav a {
  color: var(--text-soft);
  text-decoration: none;
}
.legacy-nav a:hover {
  color: var(--text-main);
}

.legacy-section {
  margin: 1.25rem 0 2rem;
}
.legacy-section-title {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
}
.legacy-section-note {
  margin: 0 0 0.85rem;
  opacity: 0.78;
  font-size: 0.92rem;
}
.legacy-section--series {
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.legacy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: 12px;
}
.legacy-card-tagline {
  display: block;
  font-size: 0.82rem;
  opacity: 0.75;
  line-height: 1.3;
}
.legacy-card--series {
  border-color: rgba(240, 200, 120, 0.45);
}
.legacy-kicker {
  margin: 0 0 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  opacity: 0.7;
}
.legacy-game-plat {
  background: rgba(142, 176, 240, 0.18);
}
.legacy-cover-missing {
  opacity: 0.35;
  object-fit: cover;
}

.legacy-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  text-decoration: none;
  color: inherit;
  border: 2px solid var(--frame-mid);
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(0,0,0,0.12));
  box-shadow: inset 0 0 0 1px var(--frame-inner);
  min-height: 100%;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) {
  .legacy-card:hover {
    border-color: #8eb0f0;
    background: linear-gradient(180deg, rgba(42, 62, 170, 0.22), rgba(0, 0, 0, 0.12));
    transform: translateY(-1px);
  }
}
.legacy-card:focus-visible {
  border-color: #8eb0f0;
  outline: 2px solid rgba(142, 176, 240, 0.5);
  outline-offset: 2px;
}
.legacy-card:active {
  border-color: #f0d890;
  transform: none;
}
.legacy-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  object-position: center;
  border: 1px solid rgba(0,0,0,0.35);
  background: #050a37;
}
.legacy-card strong {
  font-family: var(--title-font);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.legacy-card span {
  color: var(--text-soft);
  font-size: 0.92rem;
}
.legacy-card .legacy-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
}
.legacy-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: auto;
  padding-top: 4px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.legacy-search {
  margin: 0 0 16px;
  padding: 12px;
  border: 2px solid var(--frame-mid);
  background: rgba(0, 0, 0, 0.12);
  box-shadow: inset 0 0 0 1px var(--frame-inner);
}
.legacy-search-label {
  display: block;
  margin: 0 0 8px;
  font-family: var(--title-font);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.9rem;
}
.legacy-search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
}
.legacy-search-input {
  flex: 1 1 220px;
  min-width: 0;
  min-height: 40px;
  padding: 8px 12px;
  border: 2px solid var(--frame-mid);
  background: rgba(5, 10, 55, 0.85);
  color: var(--text-main);
  font: inherit;
  font-size: 1rem;
}
.legacy-search-input::placeholder {
  color: var(--text-muted);
}
.legacy-search-input:focus {
  outline: none;
  border-color: #f0d890;
}
.legacy-search-status {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.legacy-search-results {
  margin-top: 12px;
}
.legacy-game--search {
  align-items: center;
}
@media (min-width: 720px) {
  .legacy-game--search {
    grid-template-columns: 200px 1fr minmax(140px, 180px);
  }
  .legacy-game--search.legacy-game--desc-open {
    align-items: start;
  }
}
.legacy-game-platform {
  margin-top: 6px;
}
@media (min-width: 720px) {
  .legacy-game--search .legacy-game-platform {
    margin-top: 0;
    justify-self: stretch;
    align-self: center;
    text-align: center;
  }
}
.legacy-game-platform .legacy-badge {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid var(--frame-mid);
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.72rem;
  color: var(--text-soft);
  letter-spacing: 0.03em;
  max-width: 100%;
  word-break: break-word;
}
@media (min-width: 720px) {
  .legacy-game--search .legacy-game-platform .legacy-badge {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 8px;
    font-size: 0.78rem;
  }
}

.legacy-hero {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}
@media (min-width: 720px) {
  .legacy-hero {
    grid-template-columns: 160px 1fr;
    align-items: start;
  }
}
.legacy-hero img {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  object-position: center;
  border: 2px solid var(--frame-mid);
  background: #050a37;
}
.legacy-hero h2 {
  margin: 0 0 6px;
  font-family: var(--title-font);
}
.legacy-badge {
  display: inline-block;
  padding: 2px 8px;
  margin-right: 6px;
  border: 1px solid var(--frame-mid);
  font-size: 0.78rem;
  color: var(--text-soft);
}
.legacy-badge--warn {
  border-color: #c98a2e;
  color: #ffd89a;
}

.legacy-count {
  font-size: 0.85em;
  color: var(--text-soft);
  font-weight: normal;
}

/* Tabs: strategies / other */
.legacy-library {
  margin: 18px 0 28px;
}
.legacy-tabs {
  display: flex;
  gap: 0;
  border: 2px solid var(--frame-mid);
  border-bottom: none;
  background: rgba(0, 0, 0, 0.2);
}
.legacy-tab {
  flex: 1;
  min-height: 44px;
  padding: 10px 12px;
  border: none;
  border-right: 1px solid var(--frame-mid);
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-family: var(--title-font);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}
.legacy-tab:last-child {
  border-right: none;
}
.legacy-tab:hover {
  color: var(--text-main);
  background: rgba(42, 62, 170, 0.18);
}
.legacy-tab.is-active {
  color: #fff6d6;
  background: linear-gradient(180deg, #2a3eaa, #0a1458);
  box-shadow: inset 0 -2px 0 #e2c87a;
}
.legacy-tab-panels {
  border: 2px solid var(--frame-mid);
  padding: 12px;
  background: rgba(0, 0, 0, 0.12);
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
.legacy-browse {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}
.legacy-letter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: flex-end;
}
.legacy-letter-label {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 6px;
  font-family: var(--title-font);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.85rem;
  color: var(--text-soft);
  min-width: 0;
  flex: 1 1 180px;
  width: auto;
}
.legacy-letter-select {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 2px solid var(--frame-mid);
  background: rgba(5, 10, 55, 0.85);
  color: var(--text-main);
  font: inherit;
  font-size: 1rem;
  box-sizing: border-box;
  text-transform: none;
  letter-spacing: normal;
}
.legacy-letter-select:focus {
  outline: none;
  border-color: #f0d890;
}
.legacy-alpha {
  display: none;
}
.legacy-alpha-btn {
  min-width: 2rem;
  min-height: 2rem;
  padding: 2px 6px;
  border: 1px solid var(--frame-mid);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text-soft);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  line-height: 1.1;
}
.legacy-alpha-btn:hover:not(:disabled) {
  color: var(--text-main);
  background: rgba(42, 62, 170, 0.25);
}
.legacy-alpha-btn.is-active {
  color: #fff6d6;
  background: linear-gradient(180deg, #2a3eaa, #0a1458);
  border-color: #e2c87a;
}
.legacy-alpha-btn.is-empty,
.legacy-alpha-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.legacy-alpha-count {
  display: block;
  font-size: 0.65rem;
  opacity: 0.85;
}
.legacy-browse-status {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.9rem;
}
.legacy-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--frame-mid);
}
.legacy-page-btn {
  min-width: 2.2rem;
  min-height: 2rem;
  padding: 4px 8px;
  border: 1px solid var(--frame-mid);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-soft);
  font: inherit;
  cursor: pointer;
}
.legacy-page-btn:hover {
  color: var(--text-main);
  background: rgba(42, 62, 170, 0.2);
}
.legacy-page-btn.is-active {
  color: #fff6d6;
  background: #2a3eaa;
  border-color: #e2c87a;
}
.legacy-games {
  display: grid;
  gap: 8px;
}
.legacy-game {
  display: grid;
  gap: 10px;
  padding: 8px 10px;
  border: 2px solid var(--frame-mid);
  background: rgba(0,0,0,0.15);
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: start;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
@media (min-width: 640px) {
  .legacy-game {
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 12px;
    padding: 10px 12px;
    align-items: center;
  }
}
.legacy-game-cover-wrap {
  position: relative;
  width: 88px;
  height: 66px;
  border: 1px solid var(--frame-mid);
  background: #050a37;
  overflow: hidden;
  flex-shrink: 0;
}
@media (min-width: 640px) {
  .legacy-game-cover-wrap {
    width: 200px;
    height: 150px;
  }
}
.legacy-game--desc-open .legacy-game-cover-wrap {
  width: 88px;
  height: 66px;
}
@media (min-width: 640px) {
  .legacy-game--desc-open .legacy-game-cover-wrap {
    width: 200px;
    height: 150px;
  }
}
.legacy-game-cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.legacy-game-cover-img.is-active {
  opacity: 1;
  pointer-events: auto;
}
.legacy-cover-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 28px;
  height: 28px;
  border: 1px solid var(--frame-mid);
  background: rgba(5, 10, 55, 0.75);
  color: var(--text-main);
  cursor: pointer;
  line-height: 1;
  font-size: 1.1rem;
  padding: 0;
}
.legacy-cover-prev { left: 4px; }
.legacy-cover-next { right: 4px; }
.legacy-cover-nav:hover {
  background: rgba(19, 36, 141, 0.95);
}
.legacy-cover-count {
  position: absolute;
  right: 4px;
  bottom: 4px;
  z-index: 2;
  font-size: 0.65rem;
  padding: 1px 5px;
  background: rgba(5, 10, 55, 0.8);
  color: var(--text-soft);
}
.legacy-game-cover {
  width: 88px;
  height: 66px;
  object-fit: cover;
  border: 1px solid var(--frame-mid);
  background: #050a37;
}
@media (min-width: 640px) {
  .legacy-game-cover {
    width: 200px;
    height: 150px;
  }
}
.legacy-game--desc-open .legacy-game-cover {
  width: 88px;
  height: 66px;
}
@media (min-width: 640px) {
  .legacy-game--desc-open .legacy-game-cover {
    width: 200px;
    height: 150px;
  }
}
.legacy-game-cover--empty {
  background: linear-gradient(135deg, #0a1458, #13248d);
  opacity: 0.85;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: var(--text-soft);
  text-align: center;
  padding: 4px;
  width: 88px;
  height: 66px;
  border: 1px solid var(--frame-mid);
  box-sizing: border-box;
}
@media (min-width: 640px) {
  .legacy-game-cover--empty {
    width: 200px;
    height: 150px;
  }
}
.legacy-game-body {
  min-width: 0;
}
.legacy-game-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 8px;
  flex: 1 1 140px;
}
.legacy-game-lang {
  font-size: 0.72rem;
  color: #c9d4ff;
  border-color: #4a5a9a;
  white-space: nowrap;
}
.legacy-game-head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
}
@media (min-width: 640px) {
  .legacy-game-head {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    justify-content: space-between;
  }
}
.legacy-game-body h3 {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.legacy-game-title h3 {
  flex: 0 1 auto;
}
@media (min-width: 640px) {
  .legacy-game-body h3 {
    font-size: 0.95rem;
  }
}
.legacy-game-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}
.legacy-game-actions .btn,
.legacy-game-actions .legacy-desc-toggle {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  height: 2rem;
  padding: 0 8px;
  font-size: 0.68rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-sizing: border-box;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  color: #fff6d6;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.6);
  border: 2px solid var(--frame-inner);
  background: linear-gradient(180deg, #2a3eaa, #0a1458);
  box-shadow:
    inset 0 0 0 1px #f7e2a3,
    inset 0 0 0 4px rgba(20, 30, 100, 0.85);
}
@media (min-width: 640px) {
  .legacy-game-actions {
    flex-wrap: nowrap;
    flex-shrink: 0;
  }
  .legacy-game-actions .btn,
  .legacy-game-actions .legacy-desc-toggle {
    flex: 0 0 auto;
    min-width: 5.5rem;
    font-size: 0.72rem;
    letter-spacing: 0.07em;
  }
}
.legacy-game-actions .legacy-desc-toggle {
  appearance: none;
  cursor: pointer;
  border-radius: 2px;
}
.legacy-game-desc {
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 0.74rem;
  line-height: 1.35;
  white-space: pre-line;
}
@media (min-width: 640px) {
  .legacy-game-desc {
    font-size: 0.78rem;
  }
}
.legacy-game--desc-open {
  align-items: start;
}
.legacy-unavailable {
  font-size: 0.78rem;
  color: #c97878;
  opacity: 0.9;
}
.legacy-game .btn {
  margin: 0;
}
.legacy-hero-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  vertical-align: middle;
}
.legacy-hero-actions .btn {
  margin: 0;
  min-width: 11rem;
  height: 2rem;
  padding: 0 10px;
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  box-sizing: border-box;
  color: #fff6d6;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.6);
  border: 2px solid var(--frame-inner);
  background: linear-gradient(180deg, #2a3eaa, #0a1458);
  box-shadow:
    inset 0 0 0 1px #f7e2a3,
    inset 0 0 0 4px rgba(20, 30, 100, 0.85);
}
.legacy-top-nav .btn {
  color: #fff6d6;
  background: linear-gradient(180deg, #2a3eaa, #0a1458);
  box-shadow:
    inset 0 0 0 1px #f7e2a3,
    inset 0 0 0 4px rgba(20, 30, 100, 0.85);
}
.legacy-top-nav .btn:visited,
.legacy-hero-actions .btn:visited,
.legacy-game-actions .btn:visited,
.legacy-game-actions .legacy-desc-toggle:visited,
.retro-play-bar .btn:visited,
.legacy-top-nav .btn:focus-visible,
.legacy-hero-actions .btn:focus-visible,
.legacy-game-actions .btn:focus-visible,
.legacy-game-actions .legacy-desc-toggle:focus-visible,
.retro-play-bar .btn:focus-visible {
  background: linear-gradient(180deg, #2a3eaa, #0a1458);
  box-shadow:
    inset 0 0 0 1px #f7e2a3,
    inset 0 0 0 4px rgba(20, 30, 100, 0.85);
  filter: none;
  color: #fff6d6;
}
.legacy-top-nav .btn,
.legacy-hero-actions .btn,
.legacy-game-actions .btn,
.legacy-game-actions .legacy-desc-toggle,
.retro-play-bar .btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) {
  .legacy-top-nav .btn:hover,
  .legacy-hero-actions .btn:hover,
  .legacy-game-actions .btn:hover,
  .legacy-game-actions .legacy-desc-toggle:hover,
  .retro-play-bar .btn:hover {
    background: linear-gradient(180deg, #9f342d, #702319);
    box-shadow:
      inset 0 0 0 1px #f7e2a3,
      inset 0 0 0 4px rgba(94, 55, 18, 0.8);
    filter: brightness(1.08);
    color: #fff6d6;
  }
}
.legacy-top-nav .btn:active,
.legacy-hero-actions .btn:active,
.legacy-game-actions .btn:active,
.legacy-game-actions .legacy-desc-toggle:active,
.retro-play-bar .btn:active {
  background: linear-gradient(180deg, #9f342d, #702319);
  box-shadow:
    inset 0 0 0 1px #f7e2a3,
    inset 0 0 0 4px rgba(94, 55, 18, 0.8);
  filter: brightness(1.08);
  color: #fff6d6;
}

/* Emulator play page */
.screen-shell.screen-shell--retro-play {
  max-width: none;
  width: 100%;
  min-height: 100dvh;
  padding: 0;
  gap: 0;
}
.page-body--retro-play {
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.retro-play-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  background: #000;
  overflow: hidden;
  box-sizing: border-box;
}
.retro-play-shell:fullscreen,
.retro-play-shell:-webkit-full-screen {
  width: 100%;
  height: 100%;
  position: relative;
}
/* Fullscreen: hide site chrome so it does not cover the game */
.retro-play-shell:fullscreen .retro-play-bar,
.retro-play-shell:-webkit-full-screen .retro-play-bar,
.retro-play-shell:fullscreen .retro-landscape-hint,
.retro-play-shell:-webkit-full-screen .retro-landscape-hint,
.retro-play-shell:fullscreen .retro-x1-disk-hint,
.retro-play-shell:-webkit-full-screen .retro-x1-disk-hint {
  display: none !important;
}
.retro-play-shell:fullscreen .retro-emulator-wrap,
.retro-play-shell:-webkit-full-screen .retro-emulator-wrap {
  flex: 1;
  min-height: 0;
  height: 100%;
  max-height: 100%;
}
.retro-play-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 8px 10px;
  flex-shrink: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  background: linear-gradient(180deg, #13248d, #0a1458);
  border-bottom: 2px solid var(--frame-mid);
}
.retro-play-bar__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}
.retro-display-crt.retro-display-crt--on {
  border-color: rgba(226, 200, 122, 0.65);
  color: #e2c87a;
  box-shadow: inset 0 0 0 1px rgba(226, 200, 122, 0.25);
}
.retro-display-crt:not(.retro-display-crt--on) {
  opacity: 0.85;
}
.retro-play-bar .btn {
  margin: 0 !important;
  flex: 0 1 auto;
  min-width: 0;
  min-height: 2.2rem;
  height: auto;
  padding: 6px 10px;
  font-size: 0.68rem;
  line-height: 1.15;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  color: #fff6d6;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.6);
  border: 2px solid var(--frame-inner);
  background: linear-gradient(180deg, #2a3eaa, #0a1458);
  box-shadow:
    inset 0 0 0 1px #f7e2a3,
    inset 0 0 0 4px rgba(20, 30, 100, 0.85);
}
.retro-translate-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  flex: 1 1 100%;
  margin-left: 0;
  min-width: 0;
  max-width: 100%;
}
@media (min-width: 720px) {
  .retro-play-bar .btn {
    min-width: 5.5rem;
    min-height: 2.5rem;
    height: 2.5rem;
    padding: 0 12px;
    font-size: 0.75rem;
  }
  .retro-translate-controls {
    flex: 0 0 auto;
    margin-left: auto;
    max-width: none;
  }
}
.retro-translate-hotkey {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 2.2rem;
  height: auto;
  padding: 6px 10px;
  box-sizing: border-box;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff6d6;
  border: 2px solid var(--frame-inner);
  background: linear-gradient(180deg, #2a3eaa, #0a1458);
  box-shadow:
    inset 0 0 0 1px #f7e2a3,
    inset 0 0 0 4px rgba(20, 30, 100, 0.85);
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.6);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (min-width: 720px) {
  .retro-translate-hotkey {
    min-width: 5.5rem;
    min-height: 2.5rem;
    height: 2.5rem;
    padding: 0 12px;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
  }
}
.retro-translate-status {
  min-width: 0;
  max-width: 8rem;
  font-size: 0.68rem;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.retro-translate-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--text-soft);
}
.retro-translate-select {
  min-height: 36px;
  max-width: 11rem;
  padding: 4px 8px;
  border: 1px solid var(--frame-mid, #3a4a8a);
  border-radius: 4px;
  background: #0a1458;
  color: var(--text-main, #eee);
  font-size: 0.8rem;
}
.retro-translate-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--text-soft);
  user-select: none;
}
.retro-translate-btn {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 0.82rem;
}
.retro-translate-status.is-busy {
  color: #e2c87a;
}
.retro-translate-status.is-error {
  color: #f09090;
}
.retro-emulator-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  position: relative;
}
#retro-emulator {
  width: 100%;
  height: 100%;
  min-height: 320px;
  max-width: 960px;
}
.retro-translate-overlay {
  position: absolute;
  left: 50%;
  bottom: 4%;
  transform: translateX(-50%);
  z-index: 5;
  width: min(92%, 880px);
  max-width: 960px;
  padding: 10px 14px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.78);
  border: 1px solid rgba(226, 200, 122, 0.35);
  pointer-events: none;
  box-sizing: border-box;
}
/* Внутри fullscreen-элемента EmulatorJS — поверх canvas и панели. */
.retro-translate-overlay--fs {
  position: absolute;
  left: 50%;
  bottom: 72px;
  z-index: 2147483000;
  width: min(94%, 960px);
}
.retro-translate-overlay[hidden] {
  display: none !important;
}
.retro-translate-text {
  margin: 0;
  font-size: clamp(0.85rem, 2.2vw, 1.05rem);
  line-height: 1.35;
  color: #f5f0e6;
  text-align: left;
  white-space: pre-wrap;
  word-break: break-word;
  display: grid;
  gap: 10px;
}
.retro-translate-block-title {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #e2c87a;
  margin-bottom: 4px;
}
.retro-translate-block-body {
  white-space: pre-wrap;
}
.retro-translate-block--dialogue .retro-translate-block-body {
  font-size: 1.05em;
}
.retro-loader {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  background: rgba(0, 0, 0, 0.82);
  pointer-events: none;
}
.retro-loader--hidden {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}
.retro-loader-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(226, 200, 122, 0.25);
  border-top-color: #e2c87a;
  border-radius: 50%;
  animation: retro-spin 0.9s linear infinite;
}
@keyframes retro-spin {
  to { transform: rotate(360deg); }
}
.retro-loader-text {
  margin: 0;
  font-size: 1rem;
  color: var(--text-main);
}
.retro-loader-sub {
  margin: 0;
  max-width: 28rem;
  font-size: 0.88rem;
  color: var(--text-soft);
  line-height: 1.4;
}
.retro-emulator-wrap #retro-emulator,
.retro-emulator-wrap .ejs_parent,
.retro-emulator-wrap canvas {
  max-width: 100%;
  max-height: 100%;
}
.retro-emulator-wrap--ps2 {
  position: relative;
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}
.retro-play-canvas {
  display: block;
  width: 100%;
  max-width: 960px;
  height: auto;
  aspect-ratio: 4 / 3;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.retro-play-controls-hint {
  margin: 8px 12px 16px;
  font-size: 0.85rem;
  color: var(--text-soft);
}
.retro-play-controls-hint summary {
  cursor: pointer;
}
.retro-save-hint {
  margin: 0 12px 8px;
  font-size: 0.82rem;
  color: var(--text-soft);
  line-height: 1.35;
}
.retro-loader--error .retro-loader-text {
  color: #f88;
}
.retro-landscape-hint {
  display: none;
  margin: 0 12px 8px;
  padding: 8px 12px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-soft);
  background: rgba(0, 0, 0, 0.35);
}
.retro-x1-disk-hint {
  margin: 8px 12px 0;
  padding: 10px 14px;
  border: 1px solid rgba(212, 175, 55, 0.55);
  border-radius: 6px;
  background: rgba(8, 12, 28, 0.92);
  color: var(--text-soft);
  font-size: 0.88rem;
  line-height: 1.45;
  text-align: center;
}
.retro-x1-disk-hint[hidden] {
  display: none;
}
.retro-x1-disk-hint__text {
  margin: 0 0 8px;
}
.retro-x1-disk-hint__dismiss {
  cursor: pointer;
  border: 1px solid rgba(212, 175, 55, 0.45);
  border-radius: 4px;
  background: rgba(20, 30, 60, 0.9);
  color: #e8d9a0;
  font: inherit;
  font-size: 0.82rem;
  padding: 4px 12px;
}
.retro-x1-disk-btn--pulse {
  animation: retro-x1-pulse 1.4s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.55);
}
@keyframes retro-x1-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.45); }
  50% { box-shadow: 0 0 12px 3px rgba(212, 175, 55, 0.35); }
}
@media (max-width: 720px) and (orientation: portrait) {
  .retro-landscape-hint--heavy {
    display: block;
  }
}

/* Emulator area: never overflow viewport horizontally */
.retro-emulator-wrap,
#retro-emulator,
.retro-emulator-wrap .ejs_parent {
  max-width: 100% !important;
  width: 100% !important;
  box-sizing: border-box;
  min-width: 0;
}
.retro-emulator-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

/* EmulatorJS settings popup: fit mobile height, scroll inside */
@media (max-width: 900px) {
  .ejs_parent .ejs_settings_parent {
    max-height: min(72dvh, 520px) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    white-space: normal !important;
    width: min(94vw, 360px) !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    top: 48% !important;
    transform: translate(-50%, -50%) !important;
    margin-bottom: 0 !important;
    -webkit-overflow-scrolling: touch;
  }
  .ejs_parent .ejs_setting_menu,
  .ejs_parent .ejs_parent_option_div {
    max-height: min(58dvh, 420px) !important;
    overflow-y: auto !important;
  }
  .ejs_parent .ejs_popup_container,
  .ejs_parent .ejs_popup_box {
    max-height: min(80dvh, 560px) !important;
    overflow-y: auto !important;
  }
  .ejs_small_screen .ejs_menu_bar {
    max-height: min(45dvh, 280px) !important;
    overflow-y: auto !important;
  }
}

/*
 * Start / Select / Fast / Slow: move out of screen center
 * to above the D-pad (left safe zone).
 */
.ejs_virtualGamepad_bottom {
  left: 10px !important;
  right: auto !important;
  margin-left: 0 !important;
  bottom: 185px !important;
  width: auto !important;
  max-width: 46vw;
  height: auto !important;
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
  justify-content: flex-start !important;
}
.ejs_virtualGamepad_bottom .ejs_virtualGamepad_button {
  position: relative !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  bottom: auto !important;
  width: auto !important;
  min-width: 52px;
  height: 34px !important;
  line-height: 34px !important;
  font-size: 12px !important;
  border-radius: 6px !important;
  padding: 0 8px;
}
@media (orientation: landscape) and (max-height: 480px) {
  .ejs_virtualGamepad_bottom {
    bottom: 8px !important;
    left: 50% !important;
    transform: translateX(-50%);
    max-width: 70vw;
    justify-content: center !important;
  }
  .ejs_virtualGamepad_left {
    bottom: 8px !important;
    transform: scale(0.85);
    transform-origin: left bottom;
  }
  .ejs_virtualGamepad_right {
    bottom: 8px !important;
    transform: scale(0.85);
    transform-origin: right bottom;
  }
}

/* Nintendo 3DS — Azahar launch hub (no browser WASM core) */
.retro-3ds-play {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(40, 70, 160, 0.45), transparent 55%),
    linear-gradient(180deg, #0a0f2a, #050812 70%);
  overflow: auto;
}
.retro-3ds-play__panel {
  width: min(720px, 100%);
  margin: auto;
  padding: 20px 18px 24px;
  border: 2px solid var(--frame-inner, #e6c86a);
  background: linear-gradient(180deg, rgba(18, 36, 120, 0.95), rgba(8, 14, 60, 0.98));
  box-shadow: inset 0 0 0 1px rgba(247, 226, 163, 0.35);
  box-sizing: border-box;
}
.retro-3ds-play__cover {
  display: block;
  width: min(220px, 55%);
  height: auto;
  margin: 0 auto 14px;
  border: 2px solid rgba(230, 200, 106, 0.55);
}
.retro-3ds-play__title {
  margin: 0 0 10px;
  font-size: clamp(1.15rem, 4vw, 1.55rem);
  color: #fff6d6;
  text-align: center;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.55);
}
.retro-3ds-play__lead {
  margin: 0 0 14px;
  color: #d7e0ff;
  line-height: 1.45;
  font-size: 0.95rem;
}
.retro-3ds-play__steps {
  margin: 0 0 16px;
  padding-left: 1.25rem;
  color: #eef2ff;
  line-height: 1.5;
  font-size: 0.92rem;
}
.retro-3ds-play__steps code {
  font-size: 0.85em;
  color: #ffe9a8;
}
.retro-3ds-play__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.retro-3ds-play__actions .btn {
  margin: 0 !important;
}
.retro-3ds-play__note {
  margin: 0;
  color: #aeb8e0;
  font-size: 0.82rem;
  line-height: 1.4;
}
.retro-3ds-play__note code {
  color: #ffe9a8;
}

/* Emulators catalog */
.legacy-card--emulators {
  border-color: rgba(94, 224, 168, 0.45);
  max-width: 280px;
}
.legacy-emu-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  justify-content: space-between;
  margin: 12px 0 8px;
}
.legacy-emu-crumbs {
  font-size: 0.88rem;
  opacity: 0.9;
}
.legacy-emu-crumbs a {
  color: #9ec9ff;
  text-decoration: none;
}
.legacy-emu-crumbs a:hover {
  text-decoration: underline;
}
.legacy-emu-crumb-sep {
  opacity: 0.5;
  margin: 0 2px;
}
.legacy-emu-search-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.legacy-emu-search {
  min-width: 180px;
  max-width: 280px;
}
.legacy-emu-error {
  color: #ffb4b4;
}
.legacy-emu-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.legacy-emu-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.18);
}
.legacy-emu-row--dir {
  border-color: rgba(94, 224, 168, 0.28);
}
.legacy-emu-row-main {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: baseline;
  min-width: 0;
  flex: 1;
}
.legacy-emu-row-main strong {
  font-size: 0.95rem;
}
.legacy-emu-size,
.legacy-emu-systems,
.legacy-emu-desc {
  font-size: 0.8rem;
  opacity: 0.75;
}
.legacy-emu-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.legacy-emu-upstream {
  font-size: 0.8rem;
  color: #9ec9ff;
  margin-right: 4px;
}
@media (max-width: 640px) {
  .legacy-emu-row {
    flex-direction: column;
    align-items: stretch;
  }
  .legacy-emu-row-actions {
    justify-content: flex-start;
  }
}

