/* ============================================================
   Pokemon GBA for Meta Ray-Ban Display Glasses
   600x600dp viewport. Black = transparent (additive display).
   UI surfaces use dark gray so they emit some light and read
   as opaque against the see-through canvas.
   ============================================================ */

* { box-sizing: border-box; }

html, body {
  width: 600px;
  height: 600px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #000;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  position: relative;
  width: 600px;
  height: 600px;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  padding: 24px;
  display: flex;
  flex-direction: column;
}
.screen.hidden { display: none; }

/* ============== BOOT SCREEN ============== */
.boot-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
}
.boot-spinner {
  width: 56px;
  height: 56px;
  border: 4px solid #1C1E21;
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.boot-text { font-size: 22px; font-weight: 600; }
.boot-sub  { font-size: 14px; color: #B0B3B8; max-width: 480px; text-align: center; }

/* ============== MENU ============== */
.menu-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
}
.brand { text-align: center; }
.brand-title {
  font-size: 56px;
  font-weight: 800;
  letter-spacing: 6px;
  background: linear-gradient(180deg, #ffffff 0%, #B0B3B8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-sub {
  font-size: 14px;
  color: #B0B3B8;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: -6px;
}

.menu-list, .opt-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 420px;
}

.menu-btn, .opt-btn {
  width: 100%;
  min-height: 64px;
  border: 1px solid #2a2d33;
  background: #1C1E21;
  color: #E4E6EB;
  font-size: 18px;
  font-weight: 600;
  border-radius: 16px;
  padding: 14px 20px;
  cursor: pointer;
  transition:
    transform 475ms cubic-bezier(0.6, 0, 0.4, 1),
    background 300ms cubic-bezier(0.4, 0.04, 0.5, 1),
    border-color 300ms cubic-bezier(0.4, 0.04, 0.5, 1),
    opacity 300ms cubic-bezier(0.4, 0.04, 0.5, 1);
  opacity: 0.85;
  text-align: left;
}
.menu-btn.primary { background: #fff; color: #000; border-color: #fff; }
.menu-btn:focus, .opt-btn:focus, .back-btn:focus, .promote-btn:focus {
  outline: none;
  transform: scale(0.96);
  border-color: #4FC3F7;
  box-shadow: 0 0 0 2px rgba(79, 195, 247, 0.45);
  opacity: 1;
}
.opt-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.opt-title { font-size: 18px; font-weight: 700; }
.opt-sub { font-size: 13px; color: #B0B3B8; font-weight: 400; }

/* ============== SCREEN HEADER ============== */
.screen-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}
.screen-header h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
}
.back-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid #2a2d33;
  background: #1C1E21;
  color: #fff;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 300ms cubic-bezier(0.6,0,0.4,1), border-color 300ms;
}

/* ============== ROM LIST ============== */
#roms .opt-list { max-width: none; }
.rom-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rom-row .rom-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 17px;
}
.rom-row .rom-meta { font-size: 12px; color: #B0B3B8; }

/* ============== GAME ============== */
#game { padding: 0; }
.game-stage {
  width: 600px;
  height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000; /* transparent on display */
}
#screen {
  /* Native Game Boy = 160x144 (10:9). Scale 3.75x to 600x540, full width.
     image-rendering: pixelated keeps the upscale crisp.

     filter: invert(1) — on the additive waveguide display, black is fully
     transparent and white is fully bright. Game Boy games default to a
     white background with dark sprites, which renders as a transparent
     canvas with invisible sprites. Inverting the canvas makes the
     background transparent on purpose and the sprites glow bright.
     User-toggleable via the pause menu; .no-invert removes the filter. */
  width: 600px;
  height: 540px;
  image-rendering: pixelated !important; /* Keep native LCD pixels sharp over vendor inline styles. */
  background: #000;
  display: block;
  filter: invert(1);
}
#screen.no-invert { filter: none; }

/* ============== MODAL / PAUSE ============== */
.modal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.72);
  z-index: 10;
}
.modal.hidden { display: none; }
.modal-card {
  width: 360px;
  max-width: calc(100% - 48px);
  background: #1C1E21;
  border: 1px solid #2a2d33;
  border-radius: 20px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 540px;
  overflow-y: auto;
}
.modal-title {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
  color: #fff;
}
.modal .menu-btn { font-size: 16px; min-height: 56px; }

/* ============== HOW TO PLAY ============== */
.how-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 16px;
  color: #E4E6EB;
}
.how-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #1C1E21;
  border: 1px solid #2a2d33;
  border-radius: 12px;
  padding: 12px 14px;
}
.how-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 84px;
  height: 36px;
  padding: 0 10px;
  background: #0a0a0f;
  border: 1px solid #2a2d33;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 1px;
  color: #fff;
}
.how-tip { color: #B0B3B8; font-style: italic; background: transparent; border: none; padding: 4px 0; }

/* ============== TOAST ============== */
.toast {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1C1E21;
  border: 1px solid #2a2d33;
  border-radius: 24px;
  padding: 10px 18px;
  font-size: 14px;
  color: #fff;
  opacity: 0;
  transition: opacity 250ms ease;
  pointer-events: none;
  z-index: 20;
  max-width: 480px;
  text-align: center;
}
.toast.visible { opacity: 1; }

/* ============== PHONE HINT ============== */
.phone-hint {
  display: none;
  position: fixed;
  bottom: 12px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 12px;
  color: #888;
  z-index: 30;
}
html.is-phone .phone-hint { display: block; }

/* Public library: readable native phone controls and a bounded glasses panel. */
html, body { width:100%; height:100%; min-height:100dvh; }
body { display:flex; align-items:center; justify-content:center; background:#000; color:#f3efdf; }
#app { width:min(600px,100vw); height:min(600px,100dvh); background:#080f10; }
.screen { padding:20px; }
[hidden] { display:none !important; }
.menu-wrap { gap:14px; min-height:0; overflow-y:auto; justify-content:flex-start; padding:8px 3px; }
.brand { flex:none; }
.brand-kicker { font-size:12px; letter-spacing:2.5px; color:#b6c6b7; margin-bottom:8px; }
.brand-title { margin:0; font:700 39px Georgia,serif; letter-spacing:-1px; color:#f6e3b6; background:none; }
.brand-title span { color:#afd2bd; }
.brand-sub { margin:8px 0 0; font-size:12px; letter-spacing:2px; color:#bbc6bc; }
.library-intro { display:flex; gap:15px; align-items:center; width:100%; max-width:440px; border:1px solid #465d54; background:linear-gradient(135deg,#1c302b,#101b1b); border-radius:12px; padding:15px; }
.library-mark { font-size:38px; color:#ebd1a0; }
.library-intro strong { font:700 19px Georgia,serif; }
.library-intro p { margin:6px 0 0; font-size:14px; line-height:1.45; color:#c8d1c7; }
.menu-list { max-width:440px; gap:8px; }
.menu-btn, .opt-btn { min-height:49px; flex-shrink:0; padding:12px 16px; border-radius:8px; color:#eef0df; background:#182925; border-color:#42574e; opacity:1; transition:background .1s,border-color .1s; }
.menu-btn.primary { background:#dcc394; color:#17231e; border-color:#e1c793; }
.menu-btn[data-action=pick-rom] { display:flex; align-items:center; justify-content:space-between; }
.menu-btn:focus, .opt-btn:focus, .back-btn:focus { transform:none; outline:2px solid #bfe4cc; outline-offset:2px; box-shadow:none; border-color:#bfe4cc; }
.library-note { margin:0; max-width:430px; text-align:center; font-size:12px; line-height:1.5; color:#b4c3b6; }
.screen-header { margin-bottom:14px; flex-shrink:0; }
.screen-header h2 { font:700 25px Georgia,serif; color:#f2dfb8; }
.back-btn { border-radius:8px; background:#182925; border-color:#42574e; flex-shrink:0; }
.how-content, .opt-list { min-height:0; overflow-y:auto; padding:3px; }
.how-content { gap:8px; }
.how-row { padding:10px; border-radius:8px; background:#14251f; border-color:#344c42; line-height:1.4; font-size:15px; flex-shrink:0; }
.how-key { min-width:85px; flex-shrink:0; background:#0c1814; border-color:#3e5848; color:#e7d9ad; }
.save-note { border-top:1px solid #485343; margin-top:8px; padding-top:13px; font-size:14px; line-height:1.45; color:#c6d1c7; }
.save-note strong { font:700 18px Georgia,serif; color:#f2dfb8; }
.save-note p { margin:8px 0; }
.game-stage { width:100%; height:calc(100% - 68px); }
#screen { width:min(100%,600px); height:auto; max-height:100%; object-fit:contain; aspect-ratio:10/9; }
.game-actions { position:absolute; bottom:8px; left:8px; right:8px; display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
.game-actions .menu-btn { min-height:52px; padding:5px 4px; text-align:center; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; }
.game-actions strong { font-size:18px; line-height:1.1; }
.game-actions span { font-size:14px; line-height:1.2; white-space:nowrap; }
.modal-card { background:#14211b; border-color:#8e8968; border-radius:12px; }
.modal-card .menu-btn { min-height:48px; }
.toast { background:#20352c; border-color:#a8b997; max-width:calc(100% - 40px); line-height:1.4; }
@media (max-width:450px) {
  .screen { padding:16px; }
  .brand-title { font-size:31px; }
  .brand-kicker { font-size:11px; }
  .library-intro { padding:12px; }
  .library-intro p { font-size:14px; }
  .menu-wrap { gap:12px; }
  .how-row { gap:10px; }
  .how-key { min-width:73px; font-size:12px; }
  .screen-header h2 { font-size:23px; }
}

.button-detail { font-size:12px; font-weight:400; margin-left:8px; opacity:.85; }
.transfer-content { overflow-y:auto; min-height:0; display:flex; flex-direction:column; gap:12px; padding:3px; }
.transfer-content p { margin:0; line-height:1.5; }
.transfer-content > * { flex-shrink:0; }
.transfer-content label { font-weight:600; color:#edddb9; }
.pairing-code { padding:17px 10px; text-align:center; border:1px solid #94b39e; border-radius:10px; background:#162c23; color:#f5e8be; font:700 30px ui-monospace,monospace; letter-spacing:2px; overflow-wrap:anywhere; }
.transfer-input { width:100%; font:600 24px ui-monospace,monospace; padding:14px; color:#f5e8be; background:#10221b; border:1px solid #94b39e; border-radius:8px; }
.transfer-input:focus { outline:2px solid #bfe4cc; outline-offset:2px; }
.transfer-status { color:#cae5cd; font-size:16px; }
.transfer-file { padding:12px; border:1px solid #566b5b; background:#14261f; border-radius:8px; overflow-wrap:anywhere; color:#f1dfb7; }
.transfer-note { font-size:13px; color:#b7c6bb; }
.menu-btn:disabled { opacity:.45; cursor:default; }
@media(max-width:450px) { .pairing-code { font-size:22px; letter-spacing:1px; } .button-detail { display:block; margin:3px 0 0; } }
