:root {
  color-scheme: dark;
  --bg: #0b0c0f;
  --panel: #121419;
  --panel-raised: #181b21;
  --line: #292c34;
  --muted: #9297a3;
  --white: #f4f3ef;
  --lime: #d9f96b;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--white);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background: radial-gradient(ellipse at 18% 8%, #d9f96b0b, transparent 40%), radial-gradient(ellipse at 92% 90%, #6872ff0a, transparent 34%);
  content: '';
  pointer-events: none;
}

.topbar, .footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
  padding: 0 max(6vw, 24px);
  border-bottom: 1px solid #ffffff0c;
}

.wordmark, .screen-mark {
  color: var(--white);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -.1em;
  text-decoration: none;
}

.wordmark span, .screen-mark span { color: var(--lime); }

.topbar-label, .footer, .eyebrow, .console-header, .console-footer, .fine-print {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .14em;
}

.topbar-label, .footer { color: var(--muted); }

.text-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: 500 12px var(--sans);
}

.text-button:hover { color: var(--white); }

.layout {
  display: grid;
  grid-template-columns: minmax(260px, .82fr) minmax(370px, 1fr);
  gap: 32px 7vw;
  width: min(1180px, 88vw);
  margin: 90px auto 100px;
}

.welcome { padding: 28px 0; }

.eyebrow {
  margin: 0 0 22px;
  color: var(--lime);
  font-size: 10px;
}

h1 {
  margin: 0;
  font-size: clamp(52px, 7vw, 88px);
  font-weight: 700;
  letter-spacing: -.075em;
  line-height: .99;
}

h1 span { color: #8e919b; }

.intro {
  max-width: 410px;
  margin: 27px 0 0;
  color: #a9adb6;
  font-size: 15px;
  line-height: 1.8;
}

.setup-card {
  align-self: start;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(150deg, #16191f, #101216);
  box-shadow: 0 22px 70px #0005;
}

.section-heading { display: flex; gap: 15px; margin-bottom: 22px; }
.step { color: var(--lime); font: 12px var(--mono); }
.section-heading h2 { margin: 0 0 6px; font-size: 16px; font-weight: 700; }
.section-heading p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }

.field-label { display: block; margin: 18px 0 8px; color: #d3d5da; font-size: 11px; }
.game-select, .owner-input-row input {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid #383c46;
  border-radius: 5px;
  outline: none;
  background: #0c0e12;
  color: var(--white);
  font: 12px var(--sans);
}
.game-select:focus, .owner-input-row input:focus { border-color: var(--lime); }
.game-select:disabled { color: #888d97; }
.refresh-button { margin-top: 9px; min-height: 34px; }
.bios-status { margin-top: 0; }

.file-picker {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 70px;
  margin-top: 11px;
  padding: 12px 14px;
  border: 1px solid #2a2d35;
  border-radius: 7px;
  background: #0f1115;
  cursor: pointer;
  transition: border-color .16s, background .16s;
}

.file-picker[hidden] { display: none; }
.file-picker:hover { border-color: #666d4c; background: #131610; }
.file-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 6px; background: #22271a; color: var(--lime); font-size: 18px; }
.file-picker strong, .file-picker small { display: block; }
.file-picker strong { max-width: 260px; overflow: hidden; color: var(--white); font-size: 11px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.file-picker small { margin-top: 4px; color: #838894; font-size: 9px; }
.picker-arrow { margin-left: auto; color: #868b96; font-size: 15px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }
.visually-hidden:focus-visible + .file-picker { outline: 2px solid var(--lime); }

.status { min-height: 28px; margin: 11px 0; color: #8b909a; font-size: 10px; line-height: 1.5; }

.primary-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  padding: 0 16px;
  border: 0;
  border-radius: 5px;
  background: var(--lime);
  color: #11130d;
  cursor: pointer;
  font: 700 12px var(--sans);
  transition: opacity .16s, transform .16s;
}

.primary-button:hover:not(:disabled) { transform: translateY(-1px); }
.primary-button:disabled { cursor: not-allowed; opacity: .4; }
.legal-note { margin: 13px 0 0; color: #777c86; font-size: 9px; line-height: 1.7; }

.owner-card {
  grid-column: 1 / -1;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #111318;
}
.owner-card summary { color: #b2b6bf; cursor: pointer; font-size: 12px; font-weight: 600; }
.owner-copy { margin: 14px 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.owner-input-row { display: flex; gap: 9px; max-width: 480px; }
.owner-input-row input { flex: 1; min-width: 0; }
.secondary-button { padding: 0 18px; border: 1px solid #414650; border-radius: 5px; background: #20232a; color: var(--white); cursor: pointer; font: 600 11px var(--sans); }
.secondary-button:hover { border-color: var(--lime); }
.upload-picker { max-width: 560px; }
.owner-status { min-height: 0; margin: 10px 0 0; }

.console-card {
  grid-column: 1 / -1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #111318;
}

.console-header, .console-footer { display: flex; align-items: center; gap: 9px; min-height: 43px; padding: 0 18px; color: #8a909a; font-size: 9px; }
.console-header { border-bottom: 1px solid #ffffff0b; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 10px #d9f96b88; }
.console-system { margin-left: auto; color: var(--lime); }
.console-footer { justify-content: space-between; border-top: 1px solid #ffffff0b; font-size: 8px; }
.emulator-screen { position: relative; display: grid; min-height: 430px; place-items: center; overflow: hidden; background: radial-gradient(ellipse at center, #171a21, #08090b 76%); }
.screen-placeholder { text-align: center; }
.screen-mark { display: block; color: #dfe3e7; font-size: 39px; }
.screen-placeholder p { color: #777d88; font: 10px var(--mono); letter-spacing: .08em; }
#emulator { width: 100%; height: 100%; }
#emulator > * { max-width: 100%; }

.footer { height: 60px; border-top: 1px solid #ffffff0c; border-bottom: 0; font-size: 8px; }

.gate-page { display: grid; place-items: center; padding: 24px; }
.gate-card { width: min(390px, 100%); padding: 38px; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(150deg, #171a20, #101216); box-shadow: 0 24px 80px #0007; }
.gate-card h1 { font-size: 40px; }
.gate-card .intro { margin: 13px 0 25px; font-size: 13px; }
.gate-card label { display: block; margin-bottom: 8px; color: #d3d5da; font-size: 11px; }
.gate-card input { width: 100%; height: 44px; padding: 0 12px; border: 1px solid #383c46; border-radius: 5px; outline: none; background: #0c0e12; color: var(--white); font: 13px var(--sans); }
.gate-card input:focus { border-color: var(--lime); }
.gate-card .primary-button { margin-top: 14px; }
.fine-print { margin: 20px 0 0; color: #737984; text-align: center; font-size: 8px; }
.error { padding: 10px; border: 1px solid #784143; border-radius: 5px; background: #32191c; color: #ffc1c1; font-size: 11px; }

@media (max-width: 760px) {
  .topbar { height: 62px; }
  .layout { grid-template-columns: 1fr; gap: 25px; width: min(540px, 90vw); margin: 48px auto 65px; }
  .welcome { padding: 10px 0; }
  h1 { font-size: clamp(54px, 13vw, 74px); }
  .welcome .intro { margin-top: 19px; }
  .setup-card { padding: 22px; }
  .console-card, .owner-card { grid-column: auto; }
  .emulator-screen { min-height: 300px; }
  .footer { padding: 0 5vw; font-size: 7px; }
}
