:root{
  --bg0:#070713;
  --bg1:#0b0b1a;
  --card:#101026;
  --card2:#0d0d20;
  --border:#23235a;
  --text:#e8e8ff;
  --muted:#a6a6d6;
  --hot:#ff4fd8;
  --cyan:#4ff6ff;
  --lime:#7CFF6B;
  --amber:#ffd36b;
  --shadow: 0 12px 40px rgba(0,0,0,.55);
  --radius: 18px;
}

* { box-sizing: border-box; }
body{
  margin:0;
  min-height:100vh;
  color:var(--text);
  background:
    radial-gradient(1000px 600px at 20% 10%, rgba(79,246,255,.12), transparent 60%),
    radial-gradient(900px 600px at 80% 30%, rgba(255,79,216,.10), transparent 55%),
    radial-gradient(900px 600px at 40% 90%, rgba(124,255,107,.08), transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.wrap{
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  margin-bottom: 18px;
}

.brand{
  display:flex;
  flex-direction:column;
  gap:2px;
}

.brand h1{
  margin:0;
  font-size: 28px;
  letter-spacing: .4px;
  text-transform: uppercase;
  text-shadow: 0 0 18px rgba(255,79,216,.20);
}
.brand .sub{
  color:var(--muted);
  font-size: 12px;
  letter-spacing: .6px;
}

.pillrow{ display:flex; gap:10px; flex-wrap:wrap; justify-content:flex-end; }
.pillLink{
  border:1px solid var(--border);
  background: rgba(16,16,38,.55);
  padding:8px 12px;
  border-radius: 999px;
  color: var(--text);
  font-size: 12px;
  text-decoration:none;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  transition: border-color .12s ease, background .12s ease, transform .06s ease;
}
.pillLink:hover{
  background: rgba(16,16,38,.90);
  border-color: rgba(79,246,255,.45);
}
.pillLink:active{ transform: translateY(1px); }

.grid{
  display:grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 18px;
}
@media (max-width: 980px){
  .grid{ grid-template-columns: 1fr; }
}

.card{
  border:1px solid var(--border);
  background: linear-gradient(180deg, rgba(16,16,38,.85), rgba(13,13,32,.85));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.card .hd{
  padding: 14px 16px;
  border-bottom: 1px solid rgba(35,35,90,.65);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
}
.card .hd h2{
  margin:0;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}
.card .bd{
  padding: 14px 16px 16px;
}

/* Emulator container */
.gameShell{
  padding: 14px 0px 18px;
}
.gameTitle{
  font-size: 18px;
  text-align: center;
  margin: 0;
  letter-spacing: .2px;
  text-shadow: 0 0 12px rgba(79,246,255,.16);
}
.gameHint{
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

/* ----------------------------
   Emulator: safe layout wrapper
   ---------------------------- */

/* Keep content aligned with the emulator frame */
.gameShell > .gameTitle,
.gameShell > .gameHint,
.gameShell > .emuFrame{
  max-width: 980px;
  margin-inline: auto;
}

.emuFrame{
  width: 100%;
  max-width: 980px;
  aspect-ratio: 4 / 3;

  min-height: 320px;
  height: min(70vh, 720px);

  margin-top: 14px;
  margin-inline: auto;

  background: #000;

  /* 👇 remove side borders that interfere with touch */
  border-top: 1px solid rgba(35,35,90,.9);
  border-bottom: 1px solid rgba(35,35,90,.9);
  border-left: 0;
  border-right: 0;

  /* 👇 flatten sides, keep subtle rounding vertically */
  border-radius: 10px 10px 0 0;

  overflow: visible;

  /* scanlines stay safe here */
  background-image:
    linear-gradient(rgba(255,255,255,.02), rgba(255,255,255,.02)),
    repeating-linear-gradient(
      to bottom,
      rgba(255,255,255,.00) 0px,
      rgba(255,255,255,.00) 2px,
      rgba(0,0,0,.12) 3px,
      rgba(0,0,0,.12) 4px
    );
  background-blend-mode: screen, normal;
}

.emuFrame { position: relative; }

.bootOverlay.bootOverlay--inFrame{
  position: absolute;
  inset: 0;
  z-index: 50;           /* above canvas */
  padding: 16px;
  border-radius: 10px 10px 0 0;  /* match your .emuFrame rounding */
}


/* #game is a plain injection point */
#game{
  width: 100%;
  height: 100%;
  position: relative;
  background: transparent;
  border: 0;
  margin: 0;
  touch-action: none;
}

/* Only size real render surfaces (NOT every div) */
#game canvas,
#game iframe{
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* If your build injects these wrappers, sizing them is safe */
#game .ejs_parent,
#game .ejs_canvas_parent{
  width: 100% !important;
  height: 100% !important;
}
.btnRow{ display:flex; gap:10px; flex-wrap:wrap; }
.btn{
  appearance:none;
  border:1px solid rgba(35,35,90,.9);
  background: rgba(16,16,38,.65);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  cursor:pointer;
  transition: transform .06s ease, background .12s ease, border-color .12s ease;
  user-select:none;
}
.btn:hover{ background: rgba(16,16,38,.9); border-color: rgba(79,246,255,.45); }
.btn:active{ transform: translateY(1px); }

.btnPrimary{
  border-color: rgba(255,79,216,.55);
  background: linear-gradient(180deg, rgba(255,79,216,.22), rgba(255,79,216,.10));
}
.btnPrimary:hover{ border-color: rgba(255,79,216,.85); }

.btnGreen{
  border-color: rgba(124,255,107,.55);
  background: linear-gradient(180deg, rgba(124,255,107,.18), rgba(124,255,107,.08));
}
.btnGreen:hover{ border-color: rgba(124,255,107,.85); }

.btn[disabled]{
  opacity:.5;
  cursor:not-allowed;
  filter:saturate(.6);
}

.stack{ display:flex; flex-direction:column; gap:12px; }

.small{
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.divider{
  height:1px;
  background: rgba(35,35,90,.65);
  margin: 10px 0;
}

.kv{
  display:flex;
  justify-content:space-between;
  gap:10px;
  font-size: 12px;
  color: var(--muted);
}
.kv span:last-child{ color: var(--text); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.statusLine{
  font-size: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border:1px solid rgba(35,35,90,.75);
  background: rgba(7,7,19,.35);
  color: var(--muted);
}
.ok{ color: var(--lime); }
.warn{ color: var(--amber); }
.bad{ color: #ff6b6b; }

.input{
  width:100%;
  padding: 10px 12px;
  border-radius: 12px;
  border:1px solid rgba(35,35,90,.85);
  background: rgba(7,7,19,.45);
  color: var(--text);
  outline:none;
  font-size: 13px;
}
.input:focus{ border-color: rgba(79,246,255,.55); box-shadow: 0 0 0 3px rgba(79,246,255,.12); }

.lb{
  list-style:none;
  padding:0;
  margin:0;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.lb li{
  display:flex;
  justify-content:space-between;
  gap:12px;
  padding: 10px 12px;
  border-radius: 12px;
  border:1px solid rgba(35,35,90,.60);
  background: rgba(7,7,19,.22);
}
.lb .left{
  display:flex;
  gap:10px;
  min-width:0;
}
.rank{
  width: 28px;
  text-align:right;
  color: rgba(230,230,255,.55);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  flex: 0 0 auto;
}
.name{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.score{
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text);
  flex: 0 0 auto;
}

.footerNote{
  margin-top: 16px;
  color: rgba(230,230,255,.50);
  font-size: 11px;
  line-height: 1.4;
}

.glowline{
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(79,246,255,.9), rgba(255,79,216,.9), transparent);
  opacity: .35;
}

.controlsTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.controlsTable th {
  text-align: left;
  padding: 6px 8px;
  color: #9adfff;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}

.controlsTable td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.controlsTable tr:last-child td {
  border-bottom: none;
}

.muted {
  opacity: 0.75;
}

kbd {
  display: inline-block;
  min-width: 28px;
  text-align: center;
  padding: 4px 8px;
  margin: 0 3px;
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 6px;
  box-shadow:
    inset 0 -2px 0 rgba(0,0,0,0.5),
    0 1px 2px rgba(0,0,0,0.4);
}

.controlsTable {
  table-layout: fixed;
}

.controlsTable td:nth-child(1),
.controlsTable th:nth-child(1) {
  padding-right: 36px;
}

.controlsTable td:nth-child(2),
.controlsTable th:nth-child(2) {
  padding-left: 12px;
}

.pillLinkLogin{
  border: 1px solid rgba(124,255,107,.65);
  background: linear-gradient(180deg, rgba(124,255,107,.22), rgba(124,255,107,.10));
}
.pillLinkLogin:hover{
  border-color: rgba(124,255,107,.95);
  background: linear-gradient(180deg, rgba(124,255,107,.30), rgba(124,255,107,.14));
}

.bootOverlay{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0,0,0,.88);
  backdrop-filter: blur(6px);
}
.bootCard{
  width: min(680px, 92vw);
  border: 1px solid rgba(79,246,255,.25);
  background: rgba(16,16,38,.92);
  border-radius: 18px;
  box-shadow: 0 18px 60px rgba(0,0,0,.65);
  padding: 18px 18px 14px;
}
.bootTitle{
  font-size: 18px;
  margin: 0 0 8px;
  letter-spacing: .5px;
}
.bootMsg{
  margin: 0 0 14px;
  color: rgba(232,232,255,.85);
  line-height: 1.35;
}
.bootBar{
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.10);
  overflow: hidden;
}
.bootFill{
  height: 100%;
  width: 0%;
  background: rgba(79,246,255,.85);
  transition: width .25s linear;
}
.bootMeta{
  display:flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  font-size: 12px;
  color: rgba(166,166,214,.9);
}
.bootBtn{
  border: 1px solid rgba(79,246,255,.35);
  background: rgba(79,246,255,.10);
  color: rgba(232,232,255,.95);
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
}




