:root { color-scheme: dark; }
* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; background: #070b0b; color: #adc9ba; font-family: "Courier New", Courier, monospace; font-size: clamp(14px, 1.8vw, 16px); }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: #85f9cb; }
.site-shell { min-height: 100svh; display: grid; place-items: center; padding: 32px 20px; }
.terminal { width: min(100%, 760px); }
.prompt { color: #85f9cb; }
.command-line { display: flex; align-items: center; gap: 1ch; }
.command-line label { white-space: nowrap; }
.command-input { position: relative; flex: 1; min-width: 0; }
.command-line input { width: 100%; padding: 0; border: 0; outline: 0; background: transparent; color: #d7f7df; caret-color: #85f9cb; }
.command-cursor { display: none; position: absolute; left: 0; top: 0; color: #85f9cb; pointer-events: none; animation: cursor-blink 1s steps(1) infinite; }
.command-line input:placeholder-shown:not(:focus) + .command-cursor { display: block; }
@keyframes cursor-blink { 50% { opacity: 0; } }
.command-response { display: block; margin: 16px 0 0; white-space: pre-wrap; line-height: 1.6; font-size: .85em; }
.command-response:empty { display: none; }
.libraries { display: grid; gap: 16px; white-space: normal; overflow-wrap: anywhere; }
.credits-title { color: #d7f7df; }
.credit-note { display: block; margin-top: 2px; }
.logo-stage { margin-bottom: 32px; text-align: center; }
.ascii-logo { display: inline-block; max-width: 100%; margin: 0; color: #e9f5d5; font-family: inherit; font-size: clamp(5.3px, 1.45vw, 12px); line-height: 1; text-align: left; }
.construction-stage { margin-bottom: 32px; text-align: center; }
.ascii-sign { display: block; width: 100%; border: 0; padding: 0; background: transparent; font-family: inherit; font-size: clamp(4.4px, 1.3vw, 11px); line-height: 1.15; }
.ascii-sign:focus-visible { outline: 2px solid #fff78b; outline-offset: 6px; }
.ascii-word { display: flex; justify-content: center; gap: 1ch; }
.ascii-word + .ascii-word { margin-top: 1em; }
.ascii-letter { flex: 0 0 5ch; width: 5ch; white-space: pre; text-align: left; color: hsl(var(--hue) 90% 72%); animation: rainbow 7s linear infinite; animation-delay: var(--phase); }
.secret { margin: 10px 0 0; color: #fff78b; font-size: .75rem; }
@keyframes rainbow {
  0%, 100% { color: #ff7e96; }
  16.67% { color: #ffb76c; }
  33.33% { color: #f5ef7b; }
  50% { color: #8df0a5; }
  66.67% { color: #7bdcf5; }
  83.33% { color: #c59dff; }
}
@media (prefers-reduced-motion: reduce) {
  .command-cursor { animation: none; }
}
.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; }
.sr-only:focus-visible { position: static; width: auto; height: auto; margin: 0; padding: 4px 8px; clip: auto; color: #85f9cb; background: transparent; outline: 1px solid currentColor; }
.fire-screen, .matrix-screen { position: fixed; inset: 0; z-index: 10; pointer-events: none; background: #070707; }
.fire-screen canvas, .matrix-screen canvas { display: block; width: 100%; height: 100%; }
.fire-screen canvas { image-rendering: pixelated; }
.fire-screen button, .matrix-screen button { position: absolute; top: 16px; right: 16px; padding: 8px 12px; border: 1px solid #ffc64d; background: #07121a; color: #ffe58b; pointer-events: auto; }
.fire-screen button:focus-visible, .matrix-screen button:focus-visible { outline: 2px solid #fff4cb; outline-offset: 3px; }
.matrix-screen button { border-color: #3ee14e; color: #e6ffe9; background: #000; }

.life-screen { position: fixed; inset: 0; z-index: 10; background: #070b0b; }
.life-screen:not([hidden]) { display: flex; flex-direction: column; }
.life-header { padding: 14px 18px; border-bottom: 1px solid #254337; }
.life-heading { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.life-heading strong { color: #85f9cb; font-weight: normal; }
.life-heading output { flex: 1; font-size: .75em; }
.life-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.life-screen button { border: 1px solid #254337; padding: 7px 10px; background: #070b0b; color: #adc9ba; }
.life-screen button:hover, .life-screen button[aria-pressed="true"] { color: #85f9cb; border-color: #85f9cb; background: #11261c; }
.life-screen button:focus-visible { outline: 2px solid #85f9cb; outline-offset: 3px; }
.life-tool-group { display: flex; gap: 4px; }
#life-canvas { display: block; width: 100%; flex: 1; min-height: 0; touch-action: none; cursor: crosshair; }
#life-canvas:focus-visible { outline: 1px solid #85f9cb; outline-offset: -1px; }
.life-hint { margin: 0; padding: 10px 18px; border-top: 1px solid #254337; font-size: .7em; line-height: 1.5; }
@media (max-width: 600px) {
  .life-header { padding: 10px; }
  .life-heading { gap: 8px; flex-wrap: wrap; }
  .life-heading output { order: 3; flex-basis: 100%; }
  #life-exit { margin-left: auto; }
  .life-controls { gap: 6px; }
  .life-screen button { padding: 8px; }
  .life-hint { padding: 8px 10px; }
}

.maze-screen { position: fixed; inset: 0; z-index: 10; background: #070b0b; }
.maze-screen:not([hidden]) { display: flex; flex-direction: column; }
.maze-header { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 12px 18px; border-bottom: 1px solid #254337; }
.maze-title { color: #85f9cb; }
.maze-header output { flex: 1; font-size: .75em; }
.maze-screen button { border: 1px solid #365346; padding: 8px 10px; color: #c0e5cc; background: rgba(7,11,11,.85); }
.maze-screen button:hover, .maze-screen button[aria-pressed="true"] { border-color: #85f9cb; color: #85f9cb; }
.maze-screen button:focus-visible { outline: 2px solid #85f9cb; outline-offset: 3px; }
.maze-view { position: relative; flex: 1; min-height: 0; overflow: hidden; }
#maze-canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; touch-action: none; }
#maze-canvas:focus-visible { outline: 1px solid #85f9cb; outline-offset: -1px; }
#maze-map { position: absolute; top: 16px; right: 16px; width: 134px; height: 134px; border: 1px solid #365346; pointer-events: none; }
.maze-crosshair { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); color: #c0e5cc; font-size: 12px; opacity: .5; pointer-events: none; }
.maze-hint { margin: 0; padding: 10px 18px; border-top: 1px solid #254337; font-size: .7em; line-height: 1.5; }
.maze-pad { display: none; position: absolute; bottom: 20px; left: 16px; grid-template-columns: repeat(3,48px); grid-template-rows: repeat(2,48px); gap: 6px; }
.maze-pad button { touch-action: none; user-select: none; font-size: 22px; }
.maze-forward { grid-column: 2; }
.maze-left { grid-column: 1; grid-row: 2; }
.maze-back { grid-column: 2; grid-row: 2; }
.maze-right { grid-column: 3; grid-row: 2; }
.maze-touch-hint { display: none; }
.maze-finish { position: absolute; inset: 0; padding: 24px; background: rgba(7,11,11,.72); text-align: center; }
.maze-finish:not([hidden]) { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.maze-finish p { color: #ffd078; font-size: 1.2em; }
@media (pointer: coarse), (max-width: 600px) {
  .maze-header { gap: 6px; padding: 10px; }
  .maze-header output { flex-basis: calc(100% - 6ch); }
  .maze-pad { display: grid; }
  .maze-touch-hint { display: inline; }
  #maze-map { width: 105px; height: 105px; top: 10px; right: 10px; }
  .maze-hint { padding: 8px 10px; }
}

.boot-screen { position: fixed; inset: 0; z-index: 10; background: #070b0b; }
.boot-screen iframe { display: block; width: 100%; height: 100%; border: 0; }
#boot-cancel { position: absolute; top: 10px; right: 12px; z-index: 1; padding: 10px 12px; border: 1px solid #365346; background: #070b0b; color: #adc9ba; }
#boot-cancel:focus-visible { outline: 2px solid #85f9cb; outline-offset: 3px; }

#boot-menu { max-width: 480px; margin: 0 auto; padding: max(90px,env(safe-area-inset-top)) 20px 20px; }
#boot-menu h1 { font-size: 1.1em; color: #85f9cb; }
#boot-menu p { font-size: .75em; margin-bottom: 30px; }
#boot-menu button { display: block; width: 100%; margin: 16px 0; padding: 22px 18px; text-align: left; color: #adc9ba; background: #070b0b; border: 1px solid #365346; }
#boot-menu strong { display: block; color: #85f9cb; font-size: .9em; font-weight: normal; }
#boot-menu span { display: block; margin-top: 12px; font-size: .65em; line-height: 1.5; }
#boot-menu button:focus-visible { outline: 2px solid #85f9cb; outline-offset: 3px; }

#boot-menu [data-cartridge="unicorn"] { border-color: #9d557e; }
#boot-menu [data-cartridge="unicorn"] strong { color: #f5a4d1; }
