@font-face {
  font-family: "Emerald";
  src: url("./fonts/emerald.ttf") format("truetype");
  font-display: swap;
}
:root { color-scheme: light; --ink: #383838; --shadow: #d8d8d8; --paper: #fff8c8; }
* { box-sizing: border-box; }
body { margin: 0; background: #252936; color: var(--ink); font: 2rem/1.1 "Emerald", monospace; }
button, input, select { font: inherit; color: inherit; }
button, a, summary, label { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
button:disabled { color: #989898; cursor: not-allowed; }
[hidden], .screen:not(.active) { display: none !important; }
:focus-visible { outline: 0.25rem solid #e85848; outline-offset: 0.125rem; }
.skip { position: fixed; top: -6.25rem; z-index: 5; background: white; padding: 0.75rem; }
.skip:focus { top: 0.25rem; left: 0.25rem; }
.game-shell {
  width: min(60rem, calc(100% - 2rem)); margin: 1.5rem auto 0;
  display: grid; grid-template-columns: 17.5rem minmax(0, 1fr);
  grid-template-rows: 3rem 27.5rem auto 2rem;
  background: repeating-linear-gradient(#a088f8 0 0.25rem, #9878e8 0.25rem 0.5rem);
  border: 0.25rem solid #383848; box-shadow: 0 0 0 0.25rem #606078;
  image-rendering: pixelated;
}
.game-header { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding: 0 1.25rem; background: #6858a8; color: white; text-shadow: 0.125rem 0.125rem #403868; border-bottom: 0.25rem solid #c0b0ff; }
.game-header h1 { margin: 0; font-size: inherit; font-weight: normal; line-height: 1; }
.brand { font-size: 2rem; }
.game-header > span { color: #d8d0ff; font-size: 1.5rem; }
.game-header { gap: 1rem; }
.game-header > span { margin-left: auto; }
.game-header .language-picker { margin: 0; }
#language { width: auto; min-height: 1.75rem; padding: 0 .375rem; font-size: 1.25rem; line-height: 1; border: .125rem solid #c0b0ff; background: #6858a8; color: white; text-shadow: .125rem .125rem #403868; }
#language option { background: #fff8c8; color: #383838; }
#customize > summary > span + span { margin-left: .25rem; }
.menu-rail { min-width: 0; padding: 0.75rem 0.5rem 0.5rem 0.75rem; }
.pocket-label { background: #f8d880; border: 0.25rem solid #986040; box-shadow: inset 0 0.25rem #fff0b0, 0 0.25rem #c8b8f8; display: flex; align-items: center; justify-content: space-between; padding: 0.25rem 0.5rem; font-size: 1.5rem; }
.pocket-label span { font-size: 1rem; }
.starter-art { position: relative; height: 11.5rem; }
.starter-art img { position: absolute; width: 8rem; height: 8rem; image-rendering: pixelated; }
.treecko { left: 4rem; top: 0; }
.torchic { left: -0.5rem; top: 3.5rem; }
.mudkip { right: -0.25rem; top: 3.5rem; }
.game-nav { padding: 0 0.5rem; }
.game-nav button { position: relative; display: block; width: 100%; background: none; border: 0; text-align: left; padding: 0.125rem 0.5rem 0.125rem 2rem; line-height: 2rem; color: white; text-shadow: 0.125rem 0.125rem #504078; }
.game-nav button[aria-current="step"] { color: #383838; text-shadow: 0.125rem 0.125rem #fff0b0; background: #f8e098; }
.game-nav button[aria-current="step"]::before,
.preset[aria-pressed="true"]::before { content: ""; position: absolute; left: 0.5rem; top: 50%; transform: translateY(-50%); width: 0.75rem; height: 1.25rem; background: #383838; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.game-nav button:disabled { color: #d0b8e8; text-shadow: 0.125rem 0.125rem #786898; }
.menu-window { min-width: 0; min-height: 0; margin: 0.5rem 0.5rem 0.25rem 0; background: var(--paper); border: 1rem solid transparent; border-image: url("./gen3/window.png") 8 stretch; }
.window-heading { display: flex; justify-content: space-between; gap: 0.75rem; background: #f8e090; margin: -0.0625rem -0.0625rem 0; padding: 0.25rem 0.75rem 0.5rem; height: 2.5rem; border-bottom: 0.25rem solid #e0c878; font-size: 1.5rem; }
#screen-number { white-space: nowrap; }
.panel-scroll { height: calc(100% - 2.5rem); overflow: auto; scrollbar-width: thin; scrollbar-color: #e89048 #f8e8a0; padding: 0.75rem 1rem 1.25rem; }
h2 { font-size: 2rem; font-weight: normal; margin: 0 0 0.25rem; }
p { margin: 0.25rem 0 0.75rem; }
.step-head { margin-bottom: 1rem; }
.step-head > span { display: none; }
.step-head p { font-size: 1.5rem; line-height: 1.25; }
.screen { text-shadow: 0.125rem 0.125rem var(--shadow); }
.drop { display: flex; position: relative; align-items: center; justify-content: center; flex-direction: column; min-height: 7.5rem; margin: 1.25rem 0; padding: 1rem; border: 0.25rem solid #b09860; outline: 0.25rem solid #e8d898; background: #fffce8; text-align: center; cursor: pointer; }
.drop::before { content: "▶"; color: #d85038; margin-bottom: 0.25rem; text-shadow: 0.125rem 0.125rem #f8c080; }
.drop strong { font-weight: normal; }
.drop span { font-size: 1.5rem; margin-top: 0.5rem; }
.drop input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.drop:focus-within { outline-color: #d85038; }
.fine { font-size: 1.5rem; line-height: 1.25; }
.game-info { border-top: 0.125rem solid #e0d098; margin: 1.25rem 0; padding-top: 0.75rem; font-size: 1.5rem; }
.game-info p { margin: 0 0 0.375rem; }
button, .file-button { position: relative; min-height: 2.25rem; border: 0; background: #f0e4b0; padding: 0.375rem 0.75rem; text-shadow: 0.125rem 0.125rem var(--shadow); }
button:hover:not(:disabled), .file-button:hover { color: #b84028; }
.next { display: block; margin: 0.75rem 0 0 auto; font-size: 1.5rem; background: none; color: #a04030; }
.presets { display: grid; gap: 0.25rem; }
.preset { padding: 0.5rem 0.75rem 0.5rem 2rem; text-align: left; background: transparent; min-height: 2.75rem; }
.preset strong { font-size: 2rem; font-weight: normal; }
.preset small { display: none; }
.preset[aria-pressed="true"] { background: #f8e8a0; }
.preset-tools { border-top: 0.125rem solid #d8c898; margin-top: 1rem; }
summary { cursor: pointer; padding: 0.5rem 0; font-size: 1.5rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.toolbar label:first-child { flex-basis: 100%; }
.toolbar button, .toolbar .file-button { font-size: 1.5rem; }
label:not(.drop):not(.file-button) { display: flex; flex-direction: column; gap: 0.5rem; font-size: 1.5rem; }
input:not([type="checkbox"]):not([type="file"]), select { width: 100%; min-width: 0; max-width: 100%; border: 0.125rem solid #b0a880; border-bottom-width: 0.25rem; border-radius: 0; background: #fffef0; padding: 0.5rem 0.625rem; min-height: 2.75rem; font-size: 1.5rem; text-shadow: 0.125rem 0.125rem #e0e0d8; }
select { cursor: pointer; }
.file-button { display: inline-flex; align-items: center; cursor: pointer; }
.file-button input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.file-button:focus-within { outline: 0.25rem solid #e85848; }
.saved { margin-top: 0.625rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.saved > div { display: flex; }
.saved button { font-size: 1.5rem; }
.category-label { margin-bottom: 1rem; }
#customize > summary { font-size: 1rem; color: #787050; padding-top: 0; }
#customize { margin-top: 1rem; }
fieldset { margin: 0; padding: 0; border: 0; }
legend { font-size: 1.5rem; color: #a84030; padding: 0.75rem 0; }
.fields { display: grid; gap: 1rem; }
.fields label { border-bottom: 0.125rem solid #e8ddb0; padding-bottom: 0.625rem; }
.fields label.check, #tweaks label { flex-direction: row; justify-content: space-between; align-items: center; gap: 1rem; }
input[type="checkbox"] { appearance: none; flex: 0 0 1.5rem; width: 1.5rem; height: 1.5rem; padding: 0; margin: 0 0.25rem; background: #fffce8; border: 0.25rem solid #888068; cursor: pointer; }
input[type="checkbox"]:checked { background: #e86848; box-shadow: inset 0 0 0 0.1875rem #fff0b0; border-color: #a84830; }
.disabled { color: #989080; }
.fields small { font-size: 1rem; }
.extra { display: grid; gap: 1rem; margin-top: 1.25rem; border-top: 0.125rem solid #d8c898; padding-top: 0.75rem; }
#tweaks label { margin-bottom: 1rem; }
.seed-row { display: flex; align-items: end; gap: 0.5rem; flex-wrap: wrap; }
.seed-row label { flex: 1; min-width: 13.75rem; }
.seed-row button { font-size: 1.5rem; }
#seed { font-size: 2rem; }
.summary { white-space: pre-line; font-size: 1.5rem; line-height: 1.35; padding: 1rem 0; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.actions button { font-size: 1.5rem; }
button.primary { font-size: 2rem; border: 0.25rem solid #985840; background: #f8d890; box-shadow: inset 0 0.25rem #fff0b0, inset 0 -0.25rem #d8a858; padding: 0.5rem 1rem; min-height: 3rem; }
button.primary::before { content: "▶ "; }
#error, #notice { padding: 0.75rem; border: 0.25rem solid #c08058; background: #fff0c0; margin-bottom: 0.75rem; font-size: 1.5rem; white-space: pre-wrap; }
#error { color: #a83028; }
.result h2 { margin: 0.75rem 0; }
.result p { font-size: 1.5rem; line-height: 1.35; }
.eyebrow { font-size: 1.5rem; color: #487848; }
#progress { font-size: 1.5rem; }
.dialogue { position: relative; grid-column: 1 / -1; min-height: 7rem; border: 1rem solid transparent; border-image: url("./gen3/window.png") 8 stretch; background: #f8f8f8; margin: 0.25rem 0.5rem; padding: 0.25rem 1.5rem 0.5rem 0.5rem; text-shadow: 0.125rem 0.125rem #d0d0d0; }
.dialogue p { margin: 0; line-height: 1.3; }
.dialogue-arrow { position: absolute; right: 0.375rem; bottom: 0.375rem; width: 1rem; height: 0.625rem; background: #d85840; clip-path: polygon(0 0, 100% 0, 50% 100%); }
.key-hints { grid-column: 1 / -1; display: flex; gap: 1.5rem; align-items: center; padding: 0 1rem; color: white; text-shadow: 0.125rem 0.125rem #584888; font-size: 1rem; }
.key-hints > span:last-child { margin-left: auto; }
kbd { font: inherit; border: 0.125rem solid #e0d8ff; padding: 0.0625rem 0.1875rem; margin-right: 0.375rem; }
footer { width: min(60rem, calc(100% - 2rem)); margin: 1.25rem auto; color: #b8b8c8; font-size: 1rem; }
footer nav { display: flex; gap: 1.5rem; }
footer a:hover { color: white; }
footer details { margin-top: 0.5rem; }
footer summary { font-size: 1rem; }
footer p { line-height: 1.5; max-width: 50rem; }
/* One shared scale keeps the Emerald font, sprites and window frame proportional.
   Reserve room for the dialogue and footer; short or narrow screens stay at 1x.
   rem in the root font-size refers to the browser default, preserving text sizing. */
@media (min-width: 1000px) {
  :root { font-size: clamp(100%, min(calc((100vw - 2rem) / 60), calc((100svh - 2rem) / 48)), 300%); }
  .game-shell { margin-top: 1rem; }
  footer { margin: 1rem auto; }
}
@media (max-width: 720px) {
  .game-header > span { display: none; }
  .game-header .language-picker { margin-left: auto; }
  body { font-size: 1.5rem; }
  .game-shell { width: calc(100% - 1rem); margin-top: 0.75rem; grid-template-columns: 1fr; grid-template-rows: 2.5rem auto 30rem auto 1.75rem; }
  .game-header { padding: 0 0.75rem; }.brand { font-size: 1.5rem; }.game-header > span { font-size: 1rem; }
  .menu-rail { padding: 0.5rem; display: grid; grid-template-columns: 5.5rem 1fr; gap: 0.25rem; }
  .pocket-label { display: none; }
  .starter-art { height: 5.75rem; }.starter-art .treecko { width: 6rem; height: 6rem; left: -0.25rem; top: -0.5rem; }.torchic,.mudkip { display: none; }
  .game-nav { display: flex; flex-wrap: wrap; align-content: center; gap: 0.25rem; padding: 0; }
  .game-nav button { width: auto; min-height: 2.25rem; font-size: 1.5rem; line-height: 1.5rem; padding: 0.25rem 0.5rem 0.25rem 1.25rem; }
  .game-nav button[aria-current="step"]::before { width: 0.5rem; height: 0.75rem; left: 0.3125rem; }
  .menu-window { margin: 0 0.25rem; border-width: 0.75rem; }.window-heading { font-size: 1rem; height: 2.25rem; padding: 0.375rem 0.25rem; }
  .panel-scroll { height: calc(100% - 2.25rem); padding: 0.75rem 0.5rem 1rem; }
  h2 { font-size: 1.5rem; }.step-head p, .fine { font-size: 1.5rem; }
  .drop { min-height: 7rem; padding: 0.75rem 0.5rem; }.drop strong { font-size: 1.5rem; }.drop span { font-size: 1rem; }
  .game-info { font-size: 1rem; }.next { font-size: 1.5rem; padding-left: 0; padding-right: 0; }
  .preset { min-height: 2.5rem; padding-top: 0.375rem; padding-bottom: 0.375rem; }.preset strong { font-size: 1.5rem; }
  .dialogue { font-size: 1.5rem; min-height: 7.25rem; padding: 0.25rem 1rem 0.5rem 0.25rem; margin: 0.25rem; border-width: 0.75rem; }
  .key-hints { gap: 0.5rem; padding: 0 0.5rem; }.key-hints > span:last-child { display: none; }
  .seed-row label { min-width: 0; flex-basis: 100%; }#seed { font-size: 1.5rem; }
  footer { width: calc(100% - 1.5rem); }footer nav { flex-wrap: wrap; gap: 0.75rem; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
