:root {
  --ink: #343d50;
  --blue: #315b90;
  --blue-dark: #213951;
  --accent: #ed9d2b;
  --edition: #b79131;
  --paper: #fff;
  --theme-bar: #315b90;
  --theme-dark: #213951;
  --theme-edge: #91b0d1;
  --theme-pale: #e3ecf8;
  --theme-line: #64738a;
  --theme-text: #324a6e;
  --theme-selected: #5c82af;
  --theme-glow: #c2d7ed;
  --theme-bg: #e3e6e8;
  --theme-grid: #b5bbc24d;
  --theme-hover: #fff6df;
  --theme-hover-edge: #cf841b;
  --theme-hover-glow: #ffd68b;
  font-family: "Lucida Console", "Courier New", monospace;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--theme-bg);
  background-image: linear-gradient(var(--theme-grid) 2px, transparent 2px), linear-gradient(90deg, var(--theme-grid) 2px, transparent 2px);
  background-size: 40px 40px;
}
body[data-game="soulsilver"] {
  --edition: #425b90;
  --theme-bar: #485f91;
  --theme-dark: #263859;
  --theme-edge: #b3c7df;
  --theme-pale: #e5edf8;
  --theme-line: #798baa;
  --theme-text: #364d79;
  --theme-selected: #526b9b;
  --theme-glow: #c4d5ee;
  --theme-bg: #e0e7f2;
  --theme-grid: #91a5c34d;
  --accent: #607eaf;
  --theme-hover: #edf3ff;
  --theme-hover-edge: #526b9b;
  --theme-hover-glow: #c4d5ee;
}
body[data-game="heartgold"] {
  --edition: #805813;
  --theme-bar: #826020;
  --theme-dark: #503a18;
  --theme-edge: #e7c977;
  --theme-pale: #fff0c9;
  --theme-line: #9d8350;
  --theme-text: #674b20;
  --theme-selected: #8a6524;
  --theme-glow: #ead69b;
  --theme-bg: #f2e9d5;
  --theme-grid: #b69b5c4d;
  --accent: #a6731b;
  --theme-hover: #fff6df;
  --theme-hover-edge: #a6731b;
  --theme-hover-glow: #ead69b;
}
button, input, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }
a { color: #244d85; }
button:disabled { cursor: not-allowed; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.game-menu { max-width: 620px; margin: 40px auto; padding: 0 24px; }
.menu-header { border: 3px solid var(--theme-line); background: #eef1f4; box-shadow: 0 3px 0 #a3a9b3; }
.header-title { background: var(--theme-bar); color: #fff; border-bottom: 3px solid var(--theme-edge); padding: 15px 20px; display: flex; gap: 12px; align-items: center; }
h1 { font-size: 22px; line-height: 1.3; margin: 0; font-weight: bold; text-shadow: 2px 2px var(--theme-dark); letter-spacing: -.5px; }
h1 span { color: #bfcede; }
.header-symbol { width: 18px; height: 18px; background: #eff3f8; border: 3px solid #acc1d9; box-shadow: 2px 2px #1f3853; flex-shrink: 0; transform: rotate(45deg); }
.menu-header > p { margin: 0; padding: 7px 20px; text-align: right; color: #4c5d73; font-size: 12px; letter-spacing: 1px; font-weight: bold; }
.screens { display: grid; grid-template-columns: 1fr; gap: 20px; align-items: start; margin: 22px 0 20px; }
.screen { background: #f7f8fa; border: 3px solid var(--theme-line); box-shadow: inset 0 0 0 3px #cdd3dc, 0 3px 0 #a6adb7; padding: 0 18px 16px; min-width: 0; }
.section-bar { background: var(--theme-bar); color: white; border-bottom: 3px solid var(--theme-edge); margin: 0 -18px 16px; padding: 9px 14px; font-size: 15px; font-weight: bold; letter-spacing: .8px; }
.section-bar > span { color: #c0d1e5; margin-right: 12px; font-size: 13px; }
.game-display { background-color: #e7e9ec; background-image: linear-gradient(#c7ccd380 1px, transparent 1px), linear-gradient(90deg, #c7ccd380 1px, transparent 1px); background-size: 24px 24px; border: 2px solid #9ba5b4; padding: 20px 12px 14px; text-align: center; min-height: 192px; }
.game-display canvas { width: 64px; height: 64px; image-rendering: pixelated; display: block; margin: 0 auto 12px; }
.empty-icon { width: 64px; height: 64px; margin: 0 auto 12px; border: 3px solid #747f92; box-shadow: inset 0 0 0 3px #d7dde5, 2px 2px 0 #b2bac6; background: #f2f4f7; display: flex; flex-direction: column; justify-content: center; color: #66748a; font-weight: bold; font-size: 16px; line-height: 1.3; }
body[data-game] .empty-icon { display: none; }
#edition { font-size: 16px; font-weight: bold; margin: 0; color: #3c4d65; overflow-wrap: anywhere; }
body[data-game] #edition { color: var(--edition); }
.display-subtitle { font-size: 12px; margin: 5px 0 0; color: #5c687c; }
.menu-action { display: flex; align-items: center; gap: 13px; border: 3px solid var(--theme-line); box-shadow: inset 0 0 0 2px #d5e2ef, 0 2px 0 #afb7c1; background: #fff; padding: 12px; min-height: 54px; text-decoration: none; color: #293e59; }
.menu-action:hover:not(:disabled), .dropzone.dragging { border-color: var(--theme-hover-edge); box-shadow: inset 0 0 0 2px var(--theme-hover-glow), 0 2px 0 #afb7c1; background: var(--theme-hover); }
.menu-arrow, .selection-arrow { width: 0; height: 0; border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-left: 9px solid #526984; flex-shrink: 0; }
.dropzone { margin: 15px 0 12px; position: relative; cursor: pointer; min-width: 0; }
.file-copy { display: flex; flex-direction: column; min-width: 0; gap: 4px; }
#file-heading { font-size: 14px; overflow-wrap: anywhere; }
#file-description { font-size: 11px; color: #596d84; }
.dropzone input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone:focus-within { outline: 3px solid var(--accent); outline-offset: 3px; }
.rom-status { margin: 10px 0; color: #5d687b; font-size: 11px; overflow-wrap: anywhere; }
.rom-status.valid { color: #285c36; }
.status-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 2px dotted #bdc8d5; font-size: 11px; }
.status-row > span { color: #677489; }
.status-row > strong { text-align: right; }
.privacy-note { margin: 4px 0 0; color: #56677f; font-size: 11px; }
.menu-description { font-size: 13px; margin: 0 0 14px; }
fieldset { min-width: 0; border: 0; margin: 0; padding: 0; }
.option { display: flex; align-items: center; gap: 10px; border: 2px solid #8998ac; border-left: 5px solid var(--theme-edge); box-shadow: inset 0 0 0 2px #e4e9ef; background: #fff; padding: 10px 9px; margin-bottom: 10px; min-height: 64px; position: relative; cursor: pointer; }
.option input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.option:hover, .option:focus-within { border-color: var(--theme-hover-edge); box-shadow: inset 0 0 0 2px var(--theme-hover-glow); background: var(--theme-hover); }
.option .selection-arrow { border-left-color: #b7c6d9; border-top-width: 5px; border-bottom-width: 5px; border-left-width: 7px; }
.option:focus-within .selection-arrow, .option:hover .selection-arrow { border-left-color: var(--theme-hover-edge); }
.option-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.option-copy strong { font-size: 13px; color: #3c4a60; }
.option-copy > span { font-size: 10px; color: #5c6b80; }
.language-choice { display: flex; align-items: center; margin-left: auto; font-size: 12px; font-weight: bold; gap: 4px; flex-shrink: 0; }
.language-choice > span { border: 1px solid #a6b4c7; background: #e5eaf0; color: #78879b; padding: 5px 4px; min-width: 27px; text-align: center; }
.nl-choice { background: var(--theme-selected) !important; color: white !important; border-color: var(--theme-dark) !important; }
.option input:checked ~ .language-choice .nl-choice { background: #e5eaf0 !important; color: #78879b !important; border-color: #a6b4c7 !important; }
.option input:checked ~ .language-choice .en-choice { background: var(--theme-selected); color: white; border-color: var(--theme-dark); }
fieldset:disabled .option { background: #eff1f4; cursor: default; opacity: .65; }
fieldset:disabled input { cursor: default; }
fieldset:disabled .option:hover { border-color: #8998ac; box-shadow: inset 0 0 0 2px #e4e9ef; }
.consistency { font-size: 11px; margin: 4px 0 12px; color: #52627b; }
.dialogue { background: #fff; border: 3px solid #5b6b81; box-shadow: inset 0 0 0 2px #d1dce9; padding: 9px 12px; position: relative; }
.dialogue::before { content: ""; position: absolute; left: -3px; top: -3px; width: 16px; height: 16px; background: #b33a47; clip-path: polygon(0 0, 100% 0, 0 100%); }
.dialogue p { margin: 0; font-size: 11px; line-height: 1.6; }
.patch-button { width: 100%; margin-top: 14px; text-align: left; background: var(--theme-pale); color: var(--theme-text); font-weight: bold; border-color: var(--theme-dark); box-shadow: inset 0 0 0 2px var(--theme-glow), 0 2px 0 #afb7c1; }
.patch-button:disabled { opacity: .5; }
.progress-wrap { margin-top: 16px; }
progress { appearance: none; width: 100%; height: 15px; border: 2px solid #526784; background: #dce3ed; accent-color: var(--theme-selected); }
progress::-webkit-progress-bar { background: #dce3ed; }
progress::-webkit-progress-value { background: repeating-linear-gradient(90deg, var(--theme-selected) 0 12px, var(--theme-edge) 12px 14px); }
.progress-wrap > p { font-size: 11px; margin: 7px 0 0; }
.error { margin-top: 15px; color: #872f3c; font-size: 12px; overflow-wrap: anywhere; }
.done { border-top: 2px dotted #b1bfd0; padding-top: 10px; margin-top: 14px; }
.done h3 { font-size: 16px; color: var(--theme-text); margin: 0 0 7px; }
.done > p { font-size: 12px; margin: 0 0 12px; }
.download.menu-action { background: #326c49; color: #fff; border-color: #20452e; box-shadow: inset 0 0 0 2px #8fbc9b, 0 3px 0 #b0bbaf; font-weight: bold; }
.download.menu-action .menu-arrow { border-left-color: #fff; }
.download.menu-action:hover { background: #245438; border-color: #173922; box-shadow: inset 0 0 0 2px #b4d7bd, 0 3px 0 #b0bbaf; }
.text-button { border: 0; background: transparent; color: var(--theme-text); text-decoration: underline; min-height: 44px; padding: 8px 0; font-size: 11px; }
.info-menu { border: 3px solid var(--theme-line); box-shadow: inset 0 0 0 2px #d0dbe7, 0 3px 0 #a6adb7; background: #f9fafc; }
details + details { border-top: 2px solid #c0cbd9; }
summary { cursor: pointer; min-height: 48px; padding: 13px 16px; color: var(--theme-text); font-size: 13px; font-weight: bold; }
summary:hover { background: var(--theme-pale); }
.info-content { padding: 0 18px 14px; color: #46576f; font-family: system-ui, sans-serif; font-size: 13px; line-height: 1.75; }
.info-content h3 { font-size: 13px; color: var(--theme-text); margin: 18px 0 4px; }
.info-content p { margin: 8px 0; }
.source-list { padding-left: 20px; }
.source-list li { margin: 10px 0; }
.source-examples { margin: 10px 0; }
.source-examples > div { display: flex; justify-content: space-between; gap: 15px; padding: 6px 0; border-bottom: 1px solid #d4dce7; }
.source-examples dt { font-weight: bold; }
.source-examples dd { margin: 0; text-align: right; }
#supported-roms { padding-left: 20px; }
footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding: 15px 1px 0; color: #53657c; font-size: 9px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 700px) {
  .game-menu { max-width: 500px; padding: 0 14px; margin: 16px auto; }
  h1 { font-size: 16px; }
  .header-title { padding: 13px 12px; gap: 10px; }
  .header-symbol { width: 14px; height: 14px; }
  .menu-header > p { font-size: 10px; padding: 6px 12px; }
  .screens { grid-template-columns: 1fr; gap: 16px; margin: 16px 0; }
  .game-display { min-height: 170px; padding: 15px 10px 12px; }
  .screen { padding: 0 14px 14px; }
  .section-bar { margin: 0 -14px 13px; }
}
@media (max-width: 360px) {
  .game-menu { padding: 0 9px; }
  h1 { font-size: 14px; }
  .header-title { gap: 8px; padding: 12px 10px; }
  .option-copy strong { font-size: 11px; }
  .option-copy > span { font-size: 9px; }
  .option { gap: 7px; padding: 9px 6px; }
  .language-choice { font-size: 11px; gap: 3px; }
  .source-examples > div { flex-direction: column; gap: 2px; }
  .source-examples dd { text-align: left; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

#rom-icon:not([hidden]) + .empty-icon { display: none; }
body[data-rom-frame] .option, body[data-rom-frame] .dialogue {
  border: 12px solid transparent;
  border-image: var(--rom-menu-frame) 8 fill / 12px / 0 stretch;
  box-shadow: none;
  image-rendering: pixelated;
}
body[data-rom-frame] .option { padding: 4px 3px; }
body[data-rom-frame] .option:focus-within, body[data-rom-frame] .option:hover { outline: 2px solid var(--theme-hover-edge); outline-offset: 0; }
body[data-rom-frame] .dialogue { padding: 5px 6px; }
body[data-rom-frame] .dialogue::before { display: none; }

.step-track { display: flex; list-style: none; margin: 20px 0 0; padding: 0; border: 2px solid var(--theme-line); background: #e9edf3; }
.step-track li { flex: 1; padding: 10px 4px; text-align: center; color: #68768a; font-size: 12px; }
.step-track li[aria-current] { background: var(--theme-bar); color: white; box-shadow: inset 0 -3px var(--theme-edge); }
.screens { overflow: hidden; gap: 0; margin-top: 12px; }
.screen { animation: step-in 240ms ease-out; }
#wizard[data-direction="back"] .screen { animation-name: step-back; }
.step-actions { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 20px; }
.step-actions .primary { margin-left: auto; min-width: 150px; justify-content: space-between; background: var(--theme-pale); font-weight: bold; }
.primary:disabled { opacity: .5; }
.shared-status { margin: -5px 0 20px; }
.section-bar:focus { outline: none; }
@keyframes step-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes step-back { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }
@media (prefers-reduced-motion: reduce) { .screen { animation: none !important; } }

#sources .info-content h3 {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  margin: 20px 0 8px;
  border-left: 4px solid var(--theme-bar);
  border-bottom: 2px solid var(--theme-edge);
  background: var(--theme-pale);
  color: var(--theme-text);
  font-family: "Lucida Console", "Courier New", monospace;
  font-size: 12px;
  letter-spacing: .7px;
  text-transform: uppercase;
}
#sources .info-content h3::before {
  content: "";
  width: 7px;
  height: 7px;
  background: var(--theme-bar);
  transform: rotate(45deg);
  flex-shrink: 0;
}
