.standalone-player,.standalone-player *{box-sizing:border-box}
.standalone-player{min-height:100vh;min-height:100dvh;padding:24px;background:radial-gradient(ellipse at 50% 20%,#25203d 0,transparent 58%),#0c0f1b;color:#eeeaf8}
.standalone-player main{width:min(920px,100%);max-width:none;display:flex;flex-direction:column;min-height:calc(100dvh - 48px)}
.player-bar{display:flex;align-items:center;justify-content:space-between;gap:24px;width:100%;padding:0 0 20px;border-bottom:1px solid #292b40}
.machine-rail-toolbar,.player-machine-toggle{display:none}
.standalone-player .player-back{display:inline-flex;align-items:center;gap:10px;min-height:42px;padding:0 16px;border:1px solid #3b3557;border-radius:12px;background:#211d33;color:#ded3ff;font-size:13px;font-weight:600;transition:background .15s}
.standalone-player .player-back:hover{background:#332a4e}.player-back svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}
.standalone-player h1{margin:0;font-size:15px;font-weight:600;color:#bdb4d2;text-align:right;overflow-wrap:anywhere}
.player-workspace{display:flex;flex:1;align-items:center;justify-content:center;min-height:0;padding:28px 0}
.player-resize-frame{margin:0;background:#191b2a;border-radius:14px;box-shadow:0 12px 55px #0006,inset 0 0 0 1px #41405a}
.standalone-player .j2me-display{border-radius:8px}.standalone-player .j2me-overlay{background:rgba(13,15,27,.94)}
.player-help{margin:0;text-align:center;font-size:12px;line-height:1.8;color:#8d879f}.player-help span{padding:0 6px;color:#514b66}
@media(max-width:700px), (hover:none) and (pointer:coarse){
  .standalone-player{padding:0;min-height:100dvh;overflow:hidden;background:#0c0f1b}
  .standalone-player main{width:100%;height:100dvh;min-height:0;padding-top:env(safe-area-inset-top);box-sizing:border-box}
  .player-bar{flex:none;gap:12px;min-height:56px;padding:8px 12px;border-bottom:1px solid #292b40}
  .standalone-player .player-back{gap:7px;padding:0 10px;font-size:12px;min-height:36px;border-radius:9px;white-space:nowrap}
  .standalone-player h1{font-size:12px;max-width:40%;line-height:1.4}
  .player-workspace{padding:0;overflow:hidden;width:100%}
  .player-resize-frame{width:100%;height:100%;padding:0;border-radius:0;box-shadow:none}
  .player-resize-edge,.player-help{display:none}
  .standalone-player .j2me-display{border-radius:0}
  .standalone-player .j2me-phone-controls{width:min(340px,calc(100% - 24px));grid-template-columns:minmax(48px,1fr) 140px minmax(48px,1fr);gap:8px;margin:12px auto 0;padding-bottom:calc(12px + env(safe-area-inset-bottom))}
  .standalone-player .j2me-side-keys{height:120px}.standalone-player .j2me-side-keys button{height:38px;font-size:13px;border-radius:9px}
  .standalone-player .j2me-dpad{grid-template-columns:repeat(3,44px);grid-template-rows:34px 44px 34px;gap:4px}
  .standalone-player .j2me-dpad button{border-radius:8px}.standalone-player .j2me-dpad [data-key=SELECT]{width:44px;height:44px;font-size:12px}
}
/* Expanded emulator workspace: stable machine IDs drive the left rail. */
.standalone-player main.expanded-layout{width:min(1200px,100%);max-width:none;min-width:0}
.expanded-body{display:grid;grid-template-columns:88px minmax(0,1fr);gap:24px;flex:1;min-height:0;padding-top:24px}
.expanded-stage{display:flex;flex-direction:column;min-width:0;min-height:0}
.machine-rail{align-self:start;max-height:calc(100dvh - 148px);overflow-y:auto;padding:10px 8px;background:var(--panel,#fff);border:1px solid var(--border,#d6e3ed);border-radius:14px;scrollbar-width:thin}
.machine-rail nav{display:grid;gap:8px}
.standalone-player .machine-rail a.machine-rail-link{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:10px 4px;min-height:66px;border:1px solid transparent;border-radius:10px;color:var(--muted);font-size:12px;font-weight:600;text-decoration:none;white-space:nowrap}
.standalone-player .machine-rail a.machine-rail-link:hover{background:#087fae12;color:var(--purple)}
.standalone-player .machine-rail a.machine-rail-link[aria-current=page]{background:#087fae18;border-color:#087fae55;color:var(--purple)}
.machine-rail-link svg{width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.machine-rail-empty{display:block;text-align:center;color:var(--muted);font-size:11px;line-height:1.6}
.player-heading{display:flex;align-items:center;gap:14px;min-width:0}
.player-heading #playerSize{display:block;flex:none;padding:6px 10px;border:1px solid var(--border);border-radius:8px;background:var(--panel);color:var(--muted);font-size:13px;font-weight:600;font-variant-numeric:tabular-nums;white-space:nowrap}
.player-back .back-short{display:none}
.standalone-player .j2me-display{display:flex;align-items:center;justify-content:center}
.standalone-player .j2me-display canvas{width:auto;height:auto;max-width:100%;max-height:100%;flex:none;object-fit:contain}
@media(max-width:700px), (hover:none) and (pointer:coarse){
  .standalone-player main.expanded-layout{width:100%;height:100dvh;min-height:0}
  .standalone-player .player-machine-toggle{display:grid;place-items:center;flex:none;width:34px;height:30px;margin:0 12px;padding:0;border:1px solid var(--border);border-radius:8px;background:var(--panel);color:var(--text);cursor:pointer;touch-action:manipulation}
  .player-machine-toggle svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
  .player-machine-toggle[aria-expanded=false] svg{transform:rotate(180deg)}
  .player-bar{display:grid;grid-template-columns:58px minmax(0,1fr) auto;gap:6px;padding:8px 6px}
  .machine-rail-toolbar{display:flex;align-items:center;justify-content:center;width:58px}
  .standalone-player .player-machine-toggle{margin:0}
  .player-bar .player-back{justify-self:start}
  .expanded-body{grid-template-columns:58px minmax(0,1fr);gap:6px;padding:6px 6px calc(6px + env(safe-area-inset-bottom));overflow:hidden}
  .expanded-body.machine-rail-collapsed{grid-template-columns:minmax(0,1fr)}
  .expanded-body .expanded-stage{grid-column:2;grid-row:1}
  .expanded-body.machine-rail-collapsed .expanded-stage{grid-column:1}
  .machine-rail{grid-column:1;grid-row:1;align-self:stretch;max-height:none;min-height:0;padding:8px 3px;border-radius:10px}
  .machine-rail[hidden]{display:none}
  .machine-rail nav{gap:6px}
  .standalone-player .machine-rail a.machine-rail-link{font-size:10px;min-height:56px;padding:8px 2px;gap:5px;border-radius:7px}.machine-rail-link svg{width:20px;height:20px}
  .player-heading{flex-direction:column;align-items:flex-end;gap:2px}
  .standalone-player .player-heading h1{font-size:14px;max-width:none}
  .player-heading #playerSize{font-size:11px;padding:2px 6px;border:0;background:none}
  .player-back .back-full{display:none}.player-back .back-short{display:inline}
  .standalone-player .player-back{font-size:12px;padding:0 9px}
  .expanded-stage .player-workspace{padding:0;flex:1;min-height:0}
}
/* Extra controls belong to mobile expanded windows; dashboard and desktop retain their layout. */
.j2me-player .expanded-device-keyboard,.j2me-player .toggle-number-pad,.j2me-number-pad{display:none}
:is(.standalone-player.device-game-keyboard,.device-game-keyboard .demo-expanded) .player-resize-frame{overflow:auto;overscroll-behavior:contain}
:is(.standalone-player.device-game-keyboard,.device-game-keyboard .demo-expanded) .j2me-player:not(.j2me-readonly){min-height:410px}
:is(.standalone-player.device-game-keyboard,.device-game-keyboard .demo-expanded) .j2me-display{min-height:120px}
:is(.standalone-player.device-game-keyboard,.device-game-keyboard .demo-expanded) .j2me-phone-controls.j2me-expanded-controls{width:min(340px,calc(100% - 16px));grid-template-columns:minmax(42px,1fr) 116px minmax(42px,1fr);gap:8px 6px;margin:8px auto;padding-bottom:0}
:is(.standalone-player.device-game-keyboard,.device-game-keyboard .demo-expanded) .j2me-expanded-controls .j2me-side-keys{height:100px;justify-content:flex-start;gap:2px}
:is(.standalone-player.device-game-keyboard,.device-game-keyboard .demo-expanded) .j2me-expanded-controls .j2me-side-keys button{width:100%;min-width:0;height:32px;min-height:32px;padding:0;flex:none;align-self:stretch;border-radius:8px;font-size:13px}
:is(.standalone-player.device-game-keyboard,.device-game-keyboard .demo-expanded) .j2me-expanded-controls .j2me-side-keys :is([data-key=ASTERISK],[data-key=POUND]){display:none}
:is(.standalone-player.device-game-keyboard,.device-game-keyboard .demo-expanded) .j2me-expanded-controls :is(.expanded-device-keyboard,.toggle-number-pad){display:flex;align-items:center;justify-content:center;margin-top:auto}
.expanded-device-keyboard svg,.toggle-number-pad svg{width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.toggle-number-pad[aria-expanded=false] .number-pad-chevron{transform:rotate(180deg);transform-origin:12px 20px}
:is(.standalone-player.device-game-keyboard,.device-game-keyboard .demo-expanded) .j2me-expanded-controls .j2me-dpad{grid-template-columns:repeat(3,36px);grid-template-rows:28px 36px 28px;gap:4px}
:is(.standalone-player.device-game-keyboard,.device-game-keyboard .demo-expanded) .j2me-expanded-controls .j2me-dpad [data-key=SELECT]{width:36px;height:36px}
:is(.standalone-player.device-game-keyboard,.device-game-keyboard .demo-expanded) .j2me-expanded-controls .j2me-number-pad{display:grid;grid-column:1/-1;grid-template-columns:repeat(3,minmax(0,1fr));grid-auto-rows:30px;gap:6px}
:is(.standalone-player.device-game-keyboard,.device-game-keyboard .demo-expanded) .j2me-number-pad button{height:30px;min-height:30px;line-height:1;border-radius:8px;font-size:17px;font-weight:600;font-variant-numeric:tabular-nums}
:is(.standalone-player.device-game-keyboard,.device-game-keyboard .demo-expanded) .number-pad-hidden .j2me-number-pad{display:none}
:is(.standalone-player.device-game-keyboard,.device-game-keyboard .demo-expanded) .j2me-player.number-pad-hidden:not(.j2me-readonly){min-height:250px}
:is(.standalone-player,.demo-expanded) .j2me-player button{box-shadow:none}
:is(.standalone-player.device-game-keyboard,.device-game-keyboard .demo-expanded) .j2me-idle button[data-key]:disabled{opacity:1}
.standalone-player .j2me-readonly .j2me-expanded-controls{display:none}
