:root{
  color-scheme: dark;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*{
  box-sizing: border-box;
}

html, body{
  min-height: 100%;
  margin: 0;
  background: #090b10;
  color: #f5f7ff;
}

body{
  min-height: 100svh;
  padding: 8px;
  overscroll-behavior: contain;
}

button{
  font: inherit;
}

button:focus-visible{
  outline: 3px solid #ffd33d;
  outline-offset: 2px;
}

[hidden]{
  display: none !important;
}

.arcade{
  width: min(100%, 1280px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid #303747;
  border-radius: 20px;
  background: #111620;
}

.topbar{
  position: relative;
  z-index: 50;
  min-height: 62px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid #303747;
  background: #0d1119;
}

.branding{
  min-width: 190px;
  flex: 1 1 240px;
}

.branding strong, .branding small{
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.branding strong{
  letter-spacing: .05em;
}

.branding small{
  margin-top: 3px;
  color: #9da7b8;
}





.tool, .arrow{
  min-height: 38px;
  border: 1px solid #41495a;
  border-radius: 10px;
  background: #1c2330;
  color: #fff;
  cursor: pointer;
}

.tool{
  padding: 0 12px;
}

.tool:hover, .arrow:hover{
  border-color: #6d7890;
  background: #252e3e;
}

.tool:active, .arrow:active{
  transform: translateY(1px);
}

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



.player-view{
  background: #080a0d;
}

.screen{
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #000;
}

.emulator-canvas{
  position: relative;
  z-index: 1;
  display: block;
  flex: none;
  max-width: 100%;
  max-height: 100%;
  image-rendering: pixelated;
}

.loading{
  position: absolute;
  z-index: 30;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 7px;
  padding: 24px;
  text-align: center;
  background: radial-gradient(circle at center, #253149, #080a0e 72%);
}

.loading span{
  color: #b5bdca;
}







.keyboard-help{
  min-width: 0;
  display: grid;
  gap: 3px;
}

.keyboard-help strong{
  color: #fff;
}

.keyboard-help span{
  color: #aeb7c6;
  font-size: .86rem;
  line-height: 1.4;
}











.dpad, .actions{
  display: grid;
  grid-template-columns: repeat(3, 58px);
  grid-template-rows: repeat(3, 58px);
}





.dpad [data-button="up"]{
  grid-column: 2;
  grid-row: 1;
}

.dpad [data-button="left"]{
  grid-column: 1;
  grid-row: 2;
}

.dpad [data-button="right"]{
  grid-column: 3;
  grid-row: 2;
}

.dpad [data-button="down"]{
  grid-column: 2;
  grid-row: 3;
}

.actions [data-button="x"]{
  grid-column: 2;
  grid-row: 1;
}

.actions [data-button="y"]{
  grid-column: 1;
  grid-row: 2;
}

.actions [data-button="a"]{
  grid-column: 3;
  grid-row: 2;
}

.actions [data-button="b"]{
  grid-column: 2;
  grid-row: 3;
}

.center{
  display: flex;
  gap: 10px;
}



.pad{
  min-width: 50px;
  min-height: 50px;
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 50%;
  background: rgba(35, 43, 58, .92);
  color: rgba(255, 255, 255, .96);
  font-weight: 850;
  text-shadow: 0 1px 2px #000;
  touch-action: none;
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.pad.pill{
  width: 100%;
  min-width: 82px;
  border-radius: 999px;
  font-size: .75rem;
}

.pad:active, .pad.active{
  transform: scale(.94);
  background: rgba(255, 211, 61, .88);
  color: #171300;
  text-shadow: none;
}

























.library-view{
  padding: clamp(14px, 3vw, 24px);
  border-top: 1px solid #303747;
  background: #111620;
}

.library-header{
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 14px;
}

.library-header > div:first-child{
  min-width: 0;
  flex: 1;
}

.library-header h1, .library-header p{
  margin: 0;
}

.library-header h1{
  font-size: clamp(1.2rem, 3vw, 1.7rem);
}

.library-header p{
  margin-top: 4px;
  color: #aab3c2;
}

.arrows{
  display: flex;
  gap: 7px;
}

.arrow{
  width: 44px;
  font-size: 1.7rem;
}

.carousel{
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(135px, 22vw, 190px);
  gap: 14px;
  overflow-x: auto;
  padding: 4px 2px 14px;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 2px;
  scrollbar-width: thin;
  touch-action: pan-x;
}

.game-card{
  scroll-snap-align: center;
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 2px solid transparent;
  border-radius: 15px;
  background: #1a202c;
  color: #fff;
  text-align: left;
  cursor: pointer;
}

.game-card[aria-selected="true"]{
  border-color: #ffd33d;
  background: #252b38;
}

.cover-wrap{
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 10px;
  background: #080a0e;
}

.cover{
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.card-system{
  position: absolute;
  left: 7px;
  bottom: 7px;
  max-width: calc(100% - 14px);
  padding: 5px 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(0, 0, 0, .78);
  color: #ffd33d;
  font: 800 .66rem ui-monospace, SFMono-Regular, Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-title{
  min-height: 2.4em;
  overflow: hidden;
  font-weight: 750;
  line-height: 1.2;
}

.dots{
  min-height: 18px;
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-top: 2px;
}

.dot{
  width: 9px;
  height: 9px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #586174;
  cursor: pointer;
}

.dot.active{
  width: 23px;
  border-radius: 999px;
  background: #ffd33d;
}

.empty{
  padding: 28px;
  border: 1px dashed #3b4558;
  border-radius: 14px;
  color: #b5bdca;
  text-align: center;
}

.empty strong{
  display: block;
  color: #fff;
}

.empty p{
  margin: 8px 0 0;
}



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

  

  

  
}

@media (max-width: 700px) {
  body{
    padding: 0;
  }

  .arcade{
    border: 0;
    border-radius: 0;
  }

  .topbar{
    padding: 8px;
  }

  .branding{
    width: 100%;
    min-width: 0;
    flex: none;
  }

  .branding strong{
    font-size: .9rem;
  }

  .branding small{
    font-size: .78rem;
  }

  

  

  

  

  

  

  

  

  .dpad, .actions{
    grid-template-columns: repeat(3, 46px);
    grid-template-rows: repeat(3, 46px);
  }

  .pad{
    min-width: 43px;
    min-height: 43px;
  }

  

  .library-view{
    padding: 14px 10px;
  }

  .carousel{
    grid-auto-columns: min(56vw, 185px);
    margin-inline: -10px;
    padding-inline: 10px;
    scroll-padding-inline: 10px;
  }

  .arrows{
    display: none;
  }

  

  

  

  
}

@media (max-width: 470px) {
  

  

  

  .dpad, .actions{
    grid-template-columns: repeat(3, 40px);
    grid-template-rows: repeat(3, 40px);
  }

  .pad{
    min-width: 38px;
    min-height: 38px;
    font-size: .76rem;
  }

  

  

  

  
}


/* v1.8.26: public/premium libraries, metadata cards and two-step launch */
.arcade.demo-mode{
  height: min(86svh, 820px);
  display: grid;
  grid-template-columns: minmax(200px, 28%) minmax(0, 1fr);
  grid-template-areas: "library player";
}

.arcade.demo-mode .topbar{
  display: none;
}

.arcade.demo-mode .library-view{
  grid-area: library;
  min-width: 0;
  min-height: 0;
  padding: 12px;
  overflow: hidden;
  border-top: 0;
  border-right: 1px solid #303747;
}

.arcade.demo-mode .library-header, .arcade.demo-mode .dots, .arcade.demo-mode .legacy-details{
  display: none;
}

.arcade.demo-mode .carousel{
  width: 100%;
  height: 100%;
  display: grid;
  grid-auto-flow: row;
  grid-auto-rows: max-content;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 2px 6px 2px 2px;
  scroll-snap-type: y proximity;
  touch-action: pan-y;
}

.arcade.demo-mode .game-card{
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  scroll-snap-align: center;
}

.arcade.demo-mode .cover-wrap{
  width: 76px;
}

.arcade.demo-mode .card-title{
  min-height: 0;
}

.arcade.demo-mode .player-view{
  grid-area: player;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: stretch;
}

.arcade.demo-mode .screen{
  width: 100%;
  height: 100%;
  min-height: 0;
  aspect-ratio: auto;
}



.arcade.game-mode .library-view{
  display: none;
}

.arcade.game-mode .topbar{
  display: flex;
}



html.retro-pseudo-fullscreen, body.retro-pseudo-fullscreen{
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
}

.player-view.pseudo-fullscreen{
  position: fixed;
  z-index: 9999;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
  background: #000;
}
















.save-dialog{
  width: min(92vw, 560px);
  border: 1px solid #41495a;
  border-radius: 16px;
  padding: 0;
  background: #111620;
  color: #fff;
}

.save-dialog::backdrop{
  background: rgba(0, 0, 0, .72);
}

.save-dialog-card{
  display: grid;
  gap: 14px;
  padding: 16px;
}

.save-dialog-card header, .save-dialog-card footer{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.save-dialog-card h2, .save-dialog-card p{
  margin: 0;
}

.save-dialog-card button, .save-name-input{
  min-height: 42px;
  border: 1px solid #41495a;
  border-radius: 10px;
  background: #1c2330;
  color: #fff;
  padding: 8px 12px;
}

.save-name-input{
  width: 100%;
}

.save-dialog-card .primary{
  background: #ffd33d;
  color: #191400;
  font-weight: 800;
}

.save-slot-list{
  display: grid;
  gap: 8px;
  max-height: 48vh;
  overflow-y: auto;
}

.save-slot{
  width: 100%;
  display: grid;
  gap: 3px;
  text-align: left;
}

.save-slot.selected{
  border-color: #ffd33d;
  box-shadow: inset 0 0 0 1px #ffd33d;
}

.save-slot span{
  color: #aeb7c6;
  font-size: .85rem;
}

@media (max-width: 700px) {
  .arcade.demo-mode{
    height: 100svh;
    grid-template-columns: minmax(108px, 31%) minmax(0, 1fr);
  }

  .arcade.demo-mode .library-view{
    padding: 8px;
  }

  .arcade.demo-mode .carousel{
    gap: 8px;
    padding-right: 3px;
  }

  .arcade.demo-mode .game-card{
    grid-template-columns: minmax(0, 1fr);
    padding: 6px;
  }

  .arcade.demo-mode .cover-wrap{
    width: 100%;
  }

  .arcade.demo-mode .card-title{
    font-size: .75rem;
  }

  
}

/* v1.8.26: two-step cards, metadata, premium session controls */
.library-toolbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.library-scope{
  min-width: 0;
  overflow: hidden;
  color: #aeb7c6;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.library-links{
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.library-link{
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border: 1px solid #41495a;
  border-radius: 999px;
  background: #1c2330;
  color: #fff;
  font-size: .75rem;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

.library-link:hover{
  border-color: #6d7890;
  background: #252e3e;
}

.arcade[data-library-scope="premium"] .library-scope{
  color: #ffd33d;
}

.arcade[data-library-scope="premium"].demo-mode .library-toolbar{
  align-items: flex-start;
  flex-direction: column;
}

.arcade[data-library-scope="premium"].demo-mode .library-links{
  width: 100%;
  justify-content: flex-start;
}

.card-info{
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 4px;
}

.card-metadata, .card-extended{
  display: block;
  overflow: hidden;
  color: #aeb7c6;
  font-size: .72rem;
  line-height: 1.35;
}

.card-metadata{
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-extended{
  max-height: 0;
  opacity: 0;
  transition: max-height .18s ease, opacity .18s ease;
}

.game-card[aria-selected="true"] .card-extended{
  max-height: 7.2em;
  opacity: 1;
}

.premium-message{
  position: fixed;
  z-index: 12000;
  right: 12px;
  bottom: 12px;
  max-width: min(420px, calc(100vw - 24px));
  margin: 0;
  padding: 10px 13px;
  border: 1px solid #ffd33d;
  border-radius: 12px;
  background: rgba(13, 17, 25, .94);
  color: #fff;
  font-size: .84rem;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .35);
}

.premium-message.error{
  border-color: #ff6b6b;
}

.arcade.demo-mode .library-view{
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0;
}

.arcade.demo-mode .carousel{
  height: auto;
}

.arcade.demo-mode .game-card{
  min-height: 108px;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: stretch;
}

.arcade.demo-mode .game-card[aria-selected="true"]{
  min-height: 154px;
  grid-template-columns: 92px minmax(0, 1fr);
}

.arcade.demo-mode .game-card[aria-selected="true"] .cover-wrap{
  width: 92px;
}

@media (max-width: 700px) {
  .library-toolbar{
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .library-links{
    width: 100%;
    justify-content: flex-start;
  }

  .library-link{
    min-height: 29px;
    padding-inline: 7px;
    font-size: .68rem;
  }

  .arcade.demo-mode{
    grid-template-columns: minmax(150px, 42%) minmax(0, 1fr);
  }

  .arcade.demo-mode .game-card, .arcade.demo-mode .game-card[aria-selected="true"]{
    min-height: 82px;
    grid-template-columns: 48px minmax(0, 1fr);
    padding: 5px;
  }

  .arcade.demo-mode .cover-wrap, .arcade.demo-mode .game-card[aria-selected="true"] .cover-wrap{
    width: 48px;
  }

  .arcade.demo-mode .game-card[aria-selected="true"]{
    min-height: 132px;
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .arcade.demo-mode .game-card[aria-selected="true"] .cover-wrap{
    width: 58px;
  }

  .arcade.demo-mode .card-title{
    font-size: .72rem;
  }

  .arcade.demo-mode .card-metadata, .arcade.demo-mode .card-extended{
    font-size: .62rem;
  }

  .arcade.demo-mode .card-metadata{
    white-space: normal;
  }

  .arcade.demo-mode .game-card:not([aria-selected="true"]) .card-metadata, .arcade.demo-mode .game-card:not([aria-selected="true"]) .card-extended{
    display: none;
  }
}

/* v1.8.26: controles adaptativos por plataforma */








.shoulders{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}



.pad.shoulder{
  min-width: 76px;
  min-height: 42px;
  border-radius: 14px;
}

.actions{
  align-content: center;
  justify-content: center;
  gap: 7px;
}

.actions .action-slot{
  grid-column: auto !important;
  grid-row: auto !important;
}

.actions[data-face-count="1"]{
  grid-template-columns: 64px;
  grid-template-rows: 64px;
}

.actions[data-face-count="2"]{
  grid-template-columns: repeat(2, 60px);
  grid-template-rows: 60px;
}

.actions[data-face-count="3"]{
  grid-template-columns: repeat(3, 56px);
  grid-template-rows: 56px;
}

.actions[data-face-count="4"]{
  grid-template-columns: repeat(2, 58px);
  grid-template-rows: repeat(2, 58px);
}

.actions[data-face-count="6"]{
  grid-template-columns: repeat(3, 54px);
  grid-template-rows: repeat(2, 54px);
}






.arcade[data-controller-profile="megadrive-3"] .actions .pad, .arcade[data-controller-profile="megadrive-6"] .actions .pad, .arcade[data-controller-profile="pce-6"] .actions .pad{
  border-radius: 18px;
}

@media (max-width: 700px) {
  

  

  .pad.shoulder{
    min-width: 64px;
    min-height: 36px;
  }

  .actions[data-face-count="1"]{
    grid-template-columns: 46px;
    grid-template-rows: 46px;
  }

  .actions[data-face-count="2"]{
    grid-template-columns: repeat(2, 44px);
    grid-template-rows: 44px;
  }

  .actions[data-face-count="3"]{
    grid-template-columns: repeat(3, 40px);
    grid-template-rows: 40px;
  }

  .actions[data-face-count="4"]{
    grid-template-columns: repeat(2, 42px);
    grid-template-rows: repeat(2, 42px);
  }

  .actions[data-face-count="6"]{
    grid-template-columns: repeat(3, 38px);
    grid-template-rows: repeat(2, 38px);
  }

  

  
}

@media (max-width: 470px) {
  

  .pad.shoulder{
    min-width: 54px;
  }

  .actions[data-face-count="3"]{
    grid-template-columns: repeat(3, 34px);
    grid-template-rows: 36px;
  }

  .actions[data-face-count="4"]{
    grid-template-columns: repeat(2, 36px);
    grid-template-rows: repeat(2, 36px);
  }

  .actions[data-face-count="6"]{
    grid-template-columns: repeat(3, 33px);
    grid-template-rows: repeat(2, 35px);
    gap: 4px;
  }
}


/* v1.8.26: filtros de consola, passkeys multiusuario y responsive móvil */
.emulator-canvas{
  width: var(--canvas-display-width, auto) !important;
  height: var(--canvas-display-height, auto) !important;
}

.arcade.demo-mode .library-view{
  grid-template-rows: auto auto minmax(0, 1fr);
}

.console-filters{
  min-width: 0;
  display: flex;
  align-items: stretch;
  gap: 7px;
  margin: 0 0 10px;
  padding: 1px 1px 5px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
  touch-action: pan-x;
}

.console-filter{
  min-width: 58px;
  min-height: 54px;
  flex: 0 0 auto;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  padding: 5px 7px;
  border: 1px solid #41495a;
  border-radius: 11px;
  background: #171d28;
  color: #fff;
  cursor: pointer;
  scroll-snap-align: start;
}

.console-filter:hover{
  border-color: #6d7890;
  background: #222a38;
}

.console-filter[aria-pressed="true"]{
  border-color: #ffd33d;
  background: #2a2c25;
  color: #ffd33d;
}

.console-filter-icon{
  position: relative;
  min-width: 34px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 5px;
  font: 900 .54rem ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: -.03em;
}

.console-filter-icon-home::before{
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  top: 4px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  opacity: .55;
}

.console-filter-icon-handheld, .console-filter-icon-handheld-wide{
  height: 28px;
  border-radius: 7px 7px 10px 7px;
}

.console-filter-icon-handheld-wide{
  min-width: 42px;
  height: 24px;
  border-radius: 10px;
}

.console-filter-icon-joystick{
  border: 0;
  border-bottom: 5px solid currentColor;
  border-radius: 0 0 7px 7px;
}

.console-filter-icon-joystick::before{
  content: "";
  position: absolute;
  width: 3px;
  height: 17px;
  bottom: 3px;
  left: 11px;
  background: currentColor;
  transform: rotate(-12deg);
  transform-origin: bottom;
}

.console-filter-icon-all{
  border-style: dashed;
}

.console-filter-label{
  max-width: 76px;
  overflow: hidden;
  font-size: .62rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.premium-auth-dialog{
  width: min(92vw, 470px);
  border: 1px solid #41495a;
  border-radius: 16px;
  padding: 0;
  background: #111620;
  color: #fff;
}

.premium-auth-dialog::backdrop{
  background: rgba(0, 0, 0, .76);
}

.premium-auth-card{
  display: grid;
  gap: 14px;
  padding: 16px;
}

.premium-auth-card header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.premium-auth-card h2, .premium-auth-card p{
  margin: 0;
}

.premium-auth-card p{
  color: #aeb7c6;
  line-height: 1.45;
}

.premium-auth-name{
  display: grid;
  gap: 7px;
  margin: 14px 0;
  color: #d8deea;
  font-weight: 700;
}

.premium-auth-name[hidden]{
  display: none;
}

.premium-auth-name input{
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #41495a;
  border-radius: 10px;
  background: #111722;
  color: #fff;
  font: inherit;
}

.premium-auth-name input:focus{
  border-color: #ffd33d;
  outline: 2px solid rgba(255, 211, 61, .25);
  outline-offset: 1px;
}

.premium-auth-status{
  min-height: 22px;
  margin: 8px 0 12px;
  color: #d8deea !important;
}

.premium-auth-status.error{
  color: #ff9b9b !important;
}

.premium-auth-card header button{
  width: 38px;
  height: 38px;
  border: 1px solid #41495a;
  border-radius: 10px;
  background: #1c2330;
  color: #fff;
  cursor: pointer;
}

.premium-auth-actions{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.premium-auth-actions .primary{
  border-color: #ffd33d;
  background: #ffd33d;
  color: #191400;
  font-weight: 800;
}

@media (max-width: 700px) {
  body{
    padding: 0;
  }

  .arcade{
    border-radius: 0;
  }

  .arcade.demo-mode{
    width: 100%;
    height: auto;
    min-height: 100svh;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    grid-template-areas:
      "library"
      "player";
    overflow: visible;
  }

  .arcade.demo-mode .library-view{
    width: 100%;
    min-height: 0;
    padding: 9px;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid #303747;
    grid-template-rows: auto auto auto;
  }

  .arcade.demo-mode .library-toolbar{
    margin-bottom: 7px;
  }

  .arcade.demo-mode .console-filters{
    margin-bottom: 7px;
  }

  .arcade.demo-mode .carousel{
    width: 100%;
    height: auto;
    display: flex;
    gap: 9px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 2px 8px;
    scroll-snap-type: x mandatory;
    touch-action: pan-x;
  }

  .arcade.demo-mode .game-card, .arcade.demo-mode .game-card[aria-selected="true"]{
    width: auto;
    min-width: 0;
    min-height: 0;
    flex: 0 0 132px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    padding: 6px;
    scroll-snap-align: center;
  }

  .arcade.demo-mode .game-card[aria-selected="true"]{
    flex-basis: min(232px, 72vw);
  }

  .arcade.demo-mode .cover-wrap, .arcade.demo-mode .game-card[aria-selected="true"] .cover-wrap{
    width: 100%;
    max-height: 164px;
    aspect-ratio: 3 / 4;
  }

  .arcade.demo-mode .game-card:not([aria-selected="true"]) .cover-wrap{
    max-height: 148px;
  }

  .arcade.demo-mode .card-title{
    font-size: .76rem;
  }

  .arcade.demo-mode .card-metadata, .arcade.demo-mode .card-extended{
    font-size: .66rem;
  }

  .arcade.demo-mode .game-card:not([aria-selected="true"]) .card-metadata, .arcade.demo-mode .game-card:not([aria-selected="true"]) .card-extended{
    display: none;
  }

  .arcade.demo-mode .player-view{
    width: 100%;
    min-height: 0;
    display: block;
  }

  .arcade.demo-mode .screen{
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 4 / 3;
  }

  .premium-auth-actions{
    grid-template-columns: 1fr;
  }
}


/* v1.8.26: Game Gear, ficha seleccionada y fullscreen Safari/iOS */
.player-view.pseudo-fullscreen .screen{
  width: 100%;
  height: 100%;
  min-height: 0;
  aspect-ratio: auto;
}











.selected-game-details{
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(88px, 34%) minmax(0, 1fr);
  gap: 12px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #394255;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(31, 39, 54, .96), rgba(15, 20, 29, .96));
}
.selected-game-cover-wrap{ min-width: 0; }
.selected-game-cover{
  width: 100%;
  height: auto;
  display: block;
  border-radius: 11px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: #0a0d12;
}
.selected-game-copy{ min-width: 0; }
.selected-game-system{
  color: #ffd33d;
  font-size: .7rem;
  font-weight: 850;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.selected-game-details h2{ margin: 3px 0 8px; font-size: 1rem; line-height: 1.15; }
.selected-game-description{ margin: 0 0 10px; color: #d9deea; font-size: .78rem; line-height: 1.48; }
.selected-game-metadata{
  display: grid;
  grid-template-columns: minmax(72px, auto) minmax(0, 1fr);
  gap: 4px 8px;
  margin: 0;
  font-size: .7rem;
  line-height: 1.35;
}
.selected-game-metadata dt{ color: #909bad; font-weight: 750; }
.selected-game-metadata dd{ min-width: 0; margin: 0; color: #eef1f7; overflow-wrap: anywhere; }
.selected-game-links{ display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.selected-game-links a{
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid #ffd33d;
  border-radius: 999px;
  color: #ffd33d;
  font-size: .72rem;
  font-weight: 800;
  text-decoration: none;
}

.arcade.demo-mode .library-view{
  grid-template-rows: auto auto minmax(120px, 1fr) auto;
  overflow-y: auto;
}
.arcade.demo-mode .carousel{ min-height: 120px; }

@media (max-width: 700px) {
  .arcade.demo-mode .library-view{ grid-template-rows: auto auto auto auto; }
  .selected-game-details{
    grid-template-columns: 92px minmax(0, 1fr);
    margin-top: 4px;
    padding: 10px;
  }
  .selected-game-description{ font-size: .74rem; }
  .selected-game-metadata{ font-size: .67rem; }
  
}


/* v1.8.26: layout correcto de portada, iframe dinámico y fullscreen iOS */
html, body{
  height: auto;
  overflow-x: hidden;
}

.arcade.demo-mode{
  height: auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(210px, 28%) minmax(0, 1fr);
  grid-template-areas:
    "library player"
    "details details";
  grid-template-rows: clamp(430px, 58vw, 760px) auto;
  align-items: stretch;
}

.arcade.demo-mode .library-view{
  grid-area: library;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 0;
  padding: 12px;
  overflow: hidden;
  border-top: 0;
  border-right: 1px solid #303747;
}

.arcade.demo-mode .carousel{
  width: 100%;
  height: 100%;
  min-height: 120px;
  display: grid;
  grid-auto-flow: row;
  grid-auto-rows: max-content;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 2px 6px 2px 2px;
  scroll-snap-type: y proximity;
  touch-action: pan-y;
}

.arcade.demo-mode .game-card, .arcade.demo-mode .game-card[aria-selected="true"]{
  min-height: 96px;
  grid-template-columns: 68px minmax(0, 1fr);
  align-items: center;
  padding: 7px;
}

.arcade.demo-mode .cover-wrap, .arcade.demo-mode .game-card[aria-selected="true"] .cover-wrap{
  width: 68px;
}

.card-extended{
  display: none !important;
}

.arcade.demo-mode .card-info{
  align-content: center;
  gap: 5px;
}

.arcade.demo-mode .card-title{
  min-height: 0;
  font-size: .82rem;
}

.arcade.demo-mode .card-metadata{
  display: block;
  color: #aeb7c6;
  font-size: .7rem;
  line-height: 1.3;
  white-space: normal;
}

.arcade.demo-mode .player-view{
  grid-area: player;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: stretch;
}

.arcade.demo-mode .screen{
  width: 100%;
  height: 100%;
  min-height: 0;
  aspect-ratio: auto;
}

.arcade.demo-mode > .selected-game-details{
  grid-area: details;
  width: auto;
  min-width: 0;
  grid-template-columns: minmax(130px, 180px) minmax(0, 1fr);
  gap: clamp(14px, 2vw, 24px);
  margin: 12px;
  padding: clamp(14px, 2vw, 22px);
  border-color: #445069;
  background:
    radial-gradient(circle at 8% 15%, rgba(255, 211, 61, .10), transparent 26%),
    linear-gradient(145deg, rgba(31, 39, 54, .98), rgba(15, 20, 29, .98));
}

.arcade.demo-mode > .selected-game-details .selected-game-cover{
  width: 100%;
  max-width: 180px;
  margin: 0 auto;
}

.arcade.demo-mode > .selected-game-details h2{
  margin: 4px 0 10px;
  font-size: clamp(1.2rem, 2.4vw, 1.75rem);
}

.arcade.demo-mode > .selected-game-details .selected-game-description{
  max-width: 80ch;
  font-size: .9rem;
  line-height: 1.6;
}

.arcade.demo-mode > .selected-game-details .selected-game-metadata{
  grid-template-columns: minmax(82px, auto) minmax(120px, 1fr) minmax(82px, auto) minmax(120px, 1fr);
  gap: 6px 12px;
  font-size: .78rem;
  line-height: 1.45;
}

.arcade.game-mode .screen{
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: 4 / 3;
  contain: layout paint size;
}

.player-view.pseudo-fullscreen{
  top: 0;
  left: 0;
  right: auto;
  bottom: auto;
  width: var(--retro-viewport-width, 100vw);
  height: var(--retro-viewport-height, 100dvh);
  max-width: none;
  max-height: none;
}

.player-view.pseudo-fullscreen .screen, .screen:fullscreen{
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  aspect-ratio: auto;
}

@media (max-width: 700px) {
  body{
    padding: 0;
  }

  .arcade{
    border-radius: 0;
  }

  .arcade.demo-mode{
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "library"
      "player"
      "details";
    grid-template-rows: auto auto auto;
  }

  .arcade.demo-mode .library-view{
    padding: 10px;
    border-right: 0;
    border-bottom: 1px solid #303747;
    grid-template-rows: auto auto auto;
  }

  .arcade.demo-mode .carousel{
    height: auto;
    min-height: 0;
    grid-auto-flow: column;
    grid-auto-columns: min(72vw, 230px);
    grid-auto-rows: auto;
    grid-template-columns: none;
    gap: 9px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 3px 8px;
    scroll-snap-type: x mandatory;
    touch-action: pan-x;
  }

  .arcade.demo-mode .game-card, .arcade.demo-mode .game-card[aria-selected="true"]{
    min-height: 92px;
    grid-template-columns: 62px minmax(0, 1fr);
    padding: 7px;
  }

  .arcade.demo-mode .cover-wrap, .arcade.demo-mode .game-card[aria-selected="true"] .cover-wrap{
    width: 62px;
  }

  .arcade.demo-mode .player-view{
    min-height: 0;
  }

  .arcade.demo-mode .screen{
    height: auto;
    min-height: 220px;
    aspect-ratio: 4 / 3;
  }

  .arcade.demo-mode > .selected-game-details{
    grid-template-columns: 92px minmax(0, 1fr);
    margin: 10px;
    padding: 12px;
  }

  .arcade.demo-mode > .selected-game-details .selected-game-metadata{
    grid-template-columns: minmax(74px, auto) minmax(0, 1fr);
    font-size: .7rem;
  }

  .arcade.demo-mode > .selected-game-details .selected-game-description{
    font-size: .78rem;
  }
}



html, body{
  overscroll-behavior: auto;
}

.arcade.demo-mode, .arcade.demo-mode .player-view, .arcade.demo-mode .screen, .arcade.demo-mode > .selected-game-details{
  touch-action: pan-y;
}

.arcade.demo-mode .carousel{
  overscroll-behavior: contain;
}





































.player-view.pseudo-fullscreen{
  width: var(--retro-viewport-width, 100vw);
  height: var(--retro-viewport-height, 100dvh);
}

@media (max-width: 700px) {
  .arcade.demo-mode .library-view, .arcade.demo-mode .player-view, .arcade.demo-mode > .selected-game-details{
    overflow: visible;
  }
  .arcade.demo-mode .carousel{
    touch-action: pan-x pan-y;
    overscroll-behavior-x: contain;
    overscroll-behavior-y: auto;
  }
}




/* v1.8.26: botones táctiles grandes, máximo dos por fila */














/* No volver a reducir los botones en móviles estrechos o apaisados. */


/* iOS/Safari: el área de juego ocupa siempre el viewport actualizado. */
.player-view.pseudo-fullscreen{
  min-width: var(--retro-viewport-width, 100vw);
  min-height: var(--retro-viewport-height, 100dvh);
}

.player-view.pseudo-fullscreen .screen, .screen:fullscreen{
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}




/* v1.8.26: reproductor standalone top-level general */
html.retro-standalone-player, body.retro-standalone-player{
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #000;
}

.arcade.standalone-player{
  position: fixed;
  inset: 0 auto auto 0;
  width: var(--retro-viewport-width, 100vw);
  height: var(--retro-viewport-height, 100dvh);
  min-width: 0;
  min-height: 0;
  max-width: none;
  margin: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #000;
}

.arcade.standalone-player > .topbar, .arcade.standalone-player > .library-view, .arcade.standalone-player > .selected-game-details{
  display: none !important;
}

.arcade.standalone-player .player-view, .arcade.standalone-player .player-view.pseudo-fullscreen{
  position: fixed;
  top: var(--retro-viewport-top, 0px);
  left: var(--retro-viewport-left, 0px);
  right: auto;
  bottom: auto;
  display: flex !important;
  width: var(--retro-viewport-width, 100vw);
  height: var(--retro-viewport-height, 100dvh);
  min-width: 0;
  min-height: 0;
  max-width: none;
  max-height: none;
  margin: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #000;
}

.arcade.standalone-player .player-view .screen{
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-width: none;
  max-height: none;
  aspect-ratio: auto;
  background: #000;
}






/* v1.8.26: desbloqueo explícito de audio en el reproductor mínimo de iPhone */
.standalone-audio-unlock{
  position: absolute;
  left: 50%;
  bottom: max(20px, calc(env(safe-area-inset-bottom) + 12px));
  z-index: 80;
  display: grid;
  gap: 3px;
  width: min(88vw, 360px);
  min-height: 58px;
  padding: 10px 16px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 16px;
  background: rgba(8, 12, 18, .82);
  color: #fff;
  text-align: center;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  touch-action: manipulation;
}

.standalone-audio-unlock[hidden]{ display: none !important; }
.standalone-audio-unlock strong{ font-size: 16px; }
.standalone-audio-unlock small{ color: rgba(255, 255, 255, .78); font-size: 12px; }


/* v1.8.26: reproductor standalone único, controles híbridos y transparencia 1-4 */
.arcade.standalone-player .player-view, .arcade.standalone-player .player-view.pseudo-fullscreen{
  display: flex !important;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
}

.arcade.standalone-player .player-view .screen{
  position: relative;
  flex: 1 1 100%;
  display: flex;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  aspect-ratio: auto;
}


















/* Las utilidades permanecen como máximo en el nivel 3 incluso cuando los mandos son invisibles. */


/* Las zonas transparentes siguen aceptando pulsaciones. */

/* v1.8.26: único sistema de controles superpuestos para táctil, teclado y gamepad */
.visually-hidden{
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.arcade.game-mode .topbar{
  display: none;
}

.arcade.game-mode .player-view, .arcade.game-mode .screen, .arcade.standalone-player .player-view, .arcade.standalone-player .screen{
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  aspect-ratio: auto;
}

.touch-controls{
  position: absolute;
  inset: 0;
  z-index: 45;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.game-controls .pad, .game-controls .overlay-tool{
  border: 1px solid var(--control-border);
  background: var(--control-background);
  color: var(--control-color);
  text-shadow: var(--control-shadow);
  -webkit-backdrop-filter: var(--control-blur);
  backdrop-filter: var(--control-blur);
  transition: opacity .12s ease, background .12s ease, color .12s ease;
}

.game-controls .pad{
  pointer-events: auto;
}

.overlay-tools{
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  z-index: 3;
  display: grid;
  gap: 7px;
  pointer-events: none;
}

.overlay-tools-left{
  left: max(12px, env(safe-area-inset-left));
}

.overlay-tools-right{
  right: max(12px, env(safe-area-inset-right));
}

.overlay-tool{
  min-width: 78px;
  min-height: 38px;
  padding: 0 13px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 800;
  pointer-events: auto;
  touch-action: manipulation;
  cursor: pointer;
}

.overlay-tools-right .overlay-tool{
  justify-self: end;
}

.overlay-opacity-control{
  width: 46px;
  min-width: 46px;
  justify-self: start;
  padding-inline: 0;
  font-size: 1rem;
}

.overlay-back{
  position: absolute;
  z-index: 4;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  min-width: 76px;
  transform: translateX(-50%);
}

.overlay-fullscreen{
  position: absolute;
  z-index: 4;
  top: max(10px, env(safe-area-inset-top));
  left: calc(50% + 48px);
  width: 40px;
  min-width: 40px;
  padding-inline: 0;
  font-size: 1.1rem;
  line-height: 1;
}

.overlay-dpad, .overlay-actions{
  position: absolute;
  bottom: max(14px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(3, clamp(43px, 7.2vw, 62px));
  grid-template-rows: repeat(3, clamp(43px, 7.2vw, 62px));
  pointer-events: none;
}

.overlay-dpad{
  left: max(12px, env(safe-area-inset-left));
}

.overlay-actions{
  right: max(12px, env(safe-area-inset-right));
}

.overlay-center{
  position: absolute;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  width: min(29vw, 250px);
  transform: translateX(-50%);
  pointer-events: none;
}

.overlay-shoulders{
  position: absolute;
  z-index: 2;
  top: max(62px, calc(env(safe-area-inset-top) + 52px));
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

.overlay-center .pad, .overlay-shoulders .pad{
  pointer-events: auto;
}

.game-controls .pad.pill{
  min-width: 66px;
}

.arcade.overlay-opacity-1{
  --control-border: rgba(255,255,255,.58);
  --control-background: rgba(18,24,34,.46);
  --control-color: rgba(255,255,255,.92);
  --control-shadow: 0 1px 2px rgba(0,0,0,.72);
  --control-blur: blur(4px);
}

.arcade.overlay-opacity-2{
  --control-border: rgba(255,255,255,.24);
  --control-background: rgba(18,24,34,.10);
  --control-color: rgba(255,255,255,.42);
  --control-shadow: 0 1px 2px rgba(0,0,0,.38);
  --control-blur: blur(1px);
}

.arcade.overlay-opacity-3, .arcade.overlay-opacity-4{
  --control-border: rgba(255,255,255,.11);
  --control-background: rgba(18,24,34,.025);
  --control-color: rgba(255,255,255,.20);
  --control-shadow: 0 1px 1px rgba(0,0,0,.22);
  --control-blur: none;
}

.arcade.overlay-opacity-4 .game-controls .pad, .arcade.overlay-opacity-4 .game-controls .pad:active, .arcade.overlay-opacity-4 .game-controls .pad.active{
  border-color: transparent;
  background: transparent;
  color: transparent;
  text-shadow: none;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  pointer-events: auto;
}

.game-controls .pad:active, .game-controls .pad.active{
  background: rgba(255,211,61,.32);
  color: rgba(23,19,0,.72);
  text-shadow: none;
}

.legacy-iphone-performance .game-controls .pad,
.legacy-iphone-performance .game-controls .overlay-tool{
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  transition: none;
}

@media (max-width: 700px) {
  .arcade.game-mode .player-view, .arcade.game-mode .screen{
    height: 100svh;
    contain: layout paint size;
  }

  .overlay-tools{
    gap: 6px;
  }

  .overlay-tool{
    min-width: 72px;
    min-height: 38px;
    padding-inline: 10px;
    font-size: .72rem;
  }

  .overlay-opacity-control{
    width: 44px;
    min-width: 44px;
    padding-inline: 0;
  }

  .overlay-back{
    min-width: 70px;
  }

  .overlay-fullscreen{
    left: calc(50% + 44px);
    width: 38px;
    min-width: 38px;
  }

  .overlay-center{
    bottom: max(10px, env(safe-area-inset-bottom));
    width: min(32vw, 180px);
    gap: 6px;
  }

  .overlay-dpad, .overlay-actions{
    bottom: max(10px, env(safe-area-inset-bottom));
    grid-template-columns: repeat(3, 44px);
    grid-template-rows: repeat(3, 44px);
  }

  .overlay-shoulders{
    top: max(58px, calc(env(safe-area-inset-top) + 48px));
  }

  .game-controls .pad{
    min-width: 41px;
    min-height: 41px;
  }

  .game-controls .pad.pill{
    min-width: 58px;
    font-size: .64rem;
  }

  .game-controls .pad.shoulder{
    min-width: 56px;
    min-height: 34px;
    font-size: .68rem;
  }
}

@media (max-width: 470px) {
  .overlay-dpad, .overlay-actions{
    grid-template-columns: repeat(3, 40px);
    grid-template-rows: repeat(3, 40px);
  }

  .overlay-dpad{
    left: max(6px, env(safe-area-inset-left));
  }

  .overlay-actions{
    right: max(6px, env(safe-area-inset-right));
  }
}

/* v1.8.26: fullscreen nativo real; solo juego + overlay. */
html body .arcade .screen:fullscreen{
  position: fixed !important;
  inset: 0 !important;
  display: flex !important;
  width: 100vw !important;
  height: 100vh !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
  border-radius: 0 !important;
  aspect-ratio: auto !important;
  contain: none !important;
  background: #000 !important;
}

html body .arcade .screen:fullscreen::backdrop{
  background: #000;
}


/* v1.8.26: immersive native fullscreen on Android/Chromium. */
.screen:fullscreen,
.screen:-webkit-full-screen {
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: none !important;
  max-height: none !important;
  background: #000 !important;
}

.screen:fullscreen::backdrop {
  background: #000;
}

html.retro-standalone-player:fullscreen,
html.retro-standalone-player:-webkit-full-screen,
html.retro-standalone-player:fullscreen body,
html.retro-standalone-player:-webkit-full-screen body,
html.retro-standalone-player:fullscreen .arcade.standalone-player,
html.retro-standalone-player:-webkit-full-screen .arcade.standalone-player,
html.retro-standalone-player:fullscreen .arcade.standalone-player .player-view,
html.retro-standalone-player:-webkit-full-screen .arcade.standalone-player .player-view,
html.retro-standalone-player:fullscreen .arcade.standalone-player .screen,
html.retro-standalone-player:-webkit-full-screen .arcade.standalone-player .screen {
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  max-width: none !important;
  max-height: none !important;
  background: #000 !important;
}
