/* Strata Pulse 3D · Ben McNelly · MIT */
:root {
  color-scheme: dark;
  --ink: #101314;
  --ivory: #faf6ee;
  --muted: #a9b4b6;
  --solar: #ff6a2b;
  --aether: #5ad9f4;
  --gold: #ffd76a;
  font-family: Arial, "Helvetica Neue", sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body { background: #080c0e; color: var(--ivory); }
button, input, select { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--ivory); outline-offset: 3px; }
.game-shell { position: relative; isolation: isolate; width: 100%; height: 100vh; height: 100dvh; max-width: 1680px; margin: auto; overflow: hidden; background: #101a20; }
.stage-wrap { position: absolute; inset: 0; z-index: -2; }
#starter-stage { display: block; width: 100%; height: 100%; touch-action: none; }
.game-shell::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: linear-gradient(180deg, #080c10ed 0, #080c1070 115px, transparent 34%, transparent 64%, #080c10b0 86%, #080c10ed 100%); }
.topbar { position: absolute; inset: max(12px, env(safe-area-inset-top)) 18px auto; display: flex; justify-content: space-between; align-items: center; gap: 8px; z-index: 40; }
.title-row { display: flex; align-items: center; min-width: 0; gap: 13px; }
h1 { margin: 0; color: var(--ivory); font-size: 18px; line-height: 1.2; font-weight: 900; letter-spacing: -.8px; white-space: nowrap; }
h1 span { color: var(--solar); }
h1 sup { margin-left: 4px; font-size: 9px; letter-spacing: 0; vertical-align: top; }
.creator-credit { font-size: 10px; color: var(--muted); white-space: nowrap; }
.utility-row { display: flex; gap: 5px; }
.utility-btn { min-width: 47px; min-height: 34px; padding: 7px 9px; border: 1px solid #d9f2ff29; border-radius: 7px; background: #121c23d9; color: #e4eceb; font-size: 10px; font-weight: 700; }
.utility-btn:hover, .utility-btn[aria-pressed="true"] { border-color: var(--solar); color: var(--solar); }
.utility-btn:disabled { opacity: .4; }
.hud-strip { position: absolute; top: calc(max(12px, env(safe-area-inset-top)) + 47px); left: 18px; right: 18px; max-width: 740px; margin: 0 auto; display: grid; grid-template-columns: 1.2fr repeat(4, 1fr); gap: 6px; pointer-events: none; }
.hud-card { position: relative; min-width: 0; padding: 8px 12px; border: 1px solid #c5e9fa1b; border-radius: 8px; background: #101a23d9; backdrop-filter: blur(8px); }
.hud-label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.hud-value { display: block; font-size: 23px; line-height: 1; font-weight: 800; letter-spacing: -.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.score-card { border-color: #ff6a2b77; }
.score-card .hud-value { color: var(--solar); }
.shields { color: var(--aether); letter-spacing: 2px; }
.charge-track { position: absolute; left: 12px; right: 12px; bottom: 4px; height: 2px; background: #ffffff20; border-radius: 2px; overflow: hidden; }
.charge-track span { display: block; width: var(--charge, 0%); height: 100%; background: var(--gold); }
.control-deck { position: absolute; bottom: max(15px, env(safe-area-inset-bottom)); left: 18px; right: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; max-width: 850px; margin: 0 auto; }
.status-banner { grid-column: 1 / -1; overflow: hidden; margin: 0; min-height: 15px; color: #edf5f2; text-shadow: 0 1px 5px #000; font-size: 11px; line-height: 1.3; font-weight: 600; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.touch-bar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.action-bar { display: grid; grid-template-columns: 1.3fr 1fr; gap: 8px; }
.btn { display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 0; min-height: 54px; padding: 10px; border: 1px solid #c5e9fa3d; border-radius: 9px; background: #18242ee8; color: var(--ivory); font-weight: 800; font-size: 12px; line-height: 1.2; white-space: nowrap; box-shadow: 0 3px 0 #0006; }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #0006; }
.lane-btn { font-size: 10px; }
.lane-btn > span { font-size: 19px; }
.lane-btn[aria-pressed="true"] { border-color: var(--solar); background: #6c301ee6; color: #ffcfb3; }
kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 18px; padding: 1px 4px; border: 1px solid #d7e6e02a; border-radius: 3px; color: #b6c3c6; font-family: inherit; font-size: 10px; line-height: 1; }
.lane-btn kbd { margin-left: 2px; }
.btn-polarity { flex-direction: column; gap: 3px; border-color: var(--solar); background: #bc451dee; color: #fff5eb; font-size: 16px; }
.btn-polarity[data-polarity="aether"] { border-color: var(--aether); background: #12647aee; color: #e4fbff; }
.action-hint { font-size: 8px; font-weight: 700; letter-spacing: 1px; }
.btn-overdrive { flex-direction: column; gap: 3px; border-color: #fae4a133; background: #242923e8; color: #a5aaa2; font-size: 15px; }
.btn-overdrive:not(:disabled) { border-color: #ffe89e; background: var(--gold); color: #30240b; box-shadow: 0 0 24px #ffd76a30, 0 3px 0 #806024; }
.game-overlay { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; padding: 65px 20px 120px; background: #07101754; backdrop-filter: blur(4px); }
.start-card { display: grid; grid-template-columns: 1.25fr 1fr; align-items: center; gap: 32px; width: min(100%, 680px); padding: 28px; border: 1px solid #c4e3f439; border-top: 3px solid var(--solar); border-radius: 14px; background: #101a23f5; box-shadow: 0 25px 100px #0007; }
.card-byline { display: flex; flex-wrap: wrap; gap: 5px 10px; margin: 0 0 15px; color: var(--solar); font-size: 9px; line-height: 1.4; letter-spacing: 1.3px; font-weight: 800; }
.card-byline span { color: var(--muted); font-size: 8px; }
h2 { margin: 0 0 10px; color: var(--ivory); font-size: 36px; line-height: 1.03; letter-spacing: -1.4px; }
.overlay-description { margin: 0 0 19px; max-width: 290px; color: #bdcbd0; font-size: 13px; line-height: 1.5; }
.how-to-play { display: grid; gap: 10px; }
.how-to-play p { display: grid; gap: 3px; margin: 0; color: #aebdc3; font-size: 10px; line-height: 1.4; }
.how-to-play strong { color: var(--solar); font-size: 10px; font-weight: 700; }
.how-to-play strong span { margin-left: 5px; color: var(--ivory); }
.solar-mark { color: #ffa273; font-weight: 600; }
.aether-mark { color: var(--aether); font-weight: 600; }
.how-to-play kbd { min-width: 12px; height: 14px; font-size: 9px; padding: 0 3px; }
.controls-form { display: grid; gap: 10px; margin: 0; }
.configuration { display: grid; gap: 6px; }
.configuration label { color: #bdcbd0; font-size: 10px; font-weight: 700; }
.configuration input, .configuration select { min-width: 0; width: 100%; height: 39px; margin: 0 0 5px; padding: 8px 10px; border: 1px solid #bddbeb35; border-radius: 7px; background: #080f16; color: var(--ivory); font-size: 12px; }
.seed-note { margin: -1px 0 5px; color: #82959f; font-size: 9px; }
.btn-primary { justify-content: space-between; width: 100%; min-height: 47px; border-color: var(--solar); background: var(--solar); color: #1a130d; font-size: 14px; }
.btn-primary > span { font-size: 22px; }
.enter-hint { margin: 9px 0 0; color: #82959f; font-size: 10px; text-align: center; }
.result-summary { display: none; grid-template-columns: 1fr 1fr; gap: 14px; margin: 19px 0 0; }
.result-summary > div:first-child { grid-column: 1 / -1; }
.result-summary dt { color: var(--muted); font-size: 10px; }
.result-summary dd { margin: 4px 0 0; color: var(--ivory); font-size: 22px; font-weight: 800; }
.result-summary > div:first-child dd { color: var(--solar); font-size: 46px; line-height: 1; letter-spacing: -2px; }
#btn-resume { display: none; }
.game-shell[data-state="running"] .game-overlay { display: none; }
.game-shell[data-state="paused"] #configuration, .game-shell[data-state="paused"] .how-to-play, .game-shell[data-state="paused"] .enter-hint { display: none; }
.game-shell[data-state="paused"] #btn-resume { display: flex; }
.game-shell[data-state="paused"] #btn-start { min-height: 39px; border-color: #bddbeb35; background: transparent; color: #aebdc3; font-size: 12px; }
.game-shell[data-state="finished"] .how-to-play { display: none; }
.game-shell[data-state="finished"] .result-summary { display: grid; }
.no-script { position: absolute; inset: 30% 20px auto; z-index: 100; padding: 20px; background: var(--ink); color: var(--ivory); }
@media (max-width: 600px) {
  .topbar { left: 12px; right: 12px; }
  h1 { font-size: 16px; }
  .creator-credit { display: none; }
  .utility-btn { min-width: 43px; min-height: 34px; padding: 6px; font-size: 9px; }
  .utility-row { gap: 4px; }
  .hud-strip { left: 12px; right: 12px; gap: 4px; }
  .hud-card { padding: 7px 7px 10px; border-radius: 6px; }
  .hud-label { font-size: 8px; letter-spacing: .5px; }
  .hud-value { font-size: 18px; }
  .shields { letter-spacing: 0; font-size: 16px; }
  .charge-track { left: 7px; right: 7px; }
  .control-deck { left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); grid-template-columns: minmax(0,1fr); gap: 7px; }
  .btn { min-height: 47px; }
  .touch-bar { gap: 6px; }
  .action-bar { grid-template-columns: 1.2fr 1fr; }
  .lane-btn { font-size: 10px; }
  .lane-btn kbd { display: none; }
  .game-overlay { padding: 57px 12px 133px; }
  .start-card { grid-template-columns: 1fr; width: min(100%, 390px); gap: 17px; padding: 20px; border-radius: 11px; }
  .card-byline { margin-bottom: 9px; font-size: 8px; letter-spacing: 1px; }
  .card-byline span { font-size: 7px; }
  h2 { margin-bottom: 8px; font-size: 31px; letter-spacing: -1px; }
  .overlay-description { max-width: none; margin-bottom: 12px; font-size: 11px; line-height: 1.4; }
  .how-to-play { gap: 6px; }
  .how-to-play p { grid-template-columns: 66px minmax(0, 1fr); gap: 4px; font-size: 9px; }
  .how-to-play strong { font-size: 9px; }
  .how-to-play .keyboard-hint { display: none; }
  .configuration { grid-template-columns: 1fr 1fr; gap: 5px 9px; }
  .configuration label:first-child { grid-column: 1; grid-row: 1; }
  .configuration label[for="seed-input"] { grid-column: 2; grid-row: 1; }
  .configuration select { grid-column: 1; grid-row: 2; }
  .configuration input { grid-column: 2; grid-row: 2; }
  .configuration input, .configuration select { height: 38px; margin: 0; padding: 7px; font-size: 10px; }
  .seed-note { grid-column: 1 / -1; margin: 2px 0 0; font-size: 8px; }
  .enter-hint { display: none; }
  .result-summary { margin: 12px 0 0; grid-template-columns: 1.3fr 1fr 1fr; gap: 9px; }
  .result-summary > div:first-child { grid-column: auto; }
  .result-summary dt { font-size: 9px; }
  .result-summary dd { font-size: 20px; }
  .result-summary > div:first-child dd { font-size: 30px; letter-spacing: -1px; }
}
@media (max-width: 360px) {
  h1 { font-size: 14px; }
  h1 sup { font-size: 7px; margin-left: 2px; }
  .utility-btn { min-width: 39px; padding: 5px; font-size: 8px; }
  .hud-value { font-size: 16px; }
  .hud-label { font-size: 7px; }
  .shields { font-size: 13px; }
  .start-card { padding: 16px; gap: 13px; }
  .card-byline { letter-spacing: .6px; }
  .btn-polarity { font-size: 14px; }
}
@media (max-height: 570px) and (orientation: portrait) {
  .game-overlay { padding-top: 49px; }
  .start-card { gap: 12px; padding-top: 14px; padding-bottom: 14px; }
  .card-byline { margin-bottom: 7px; }
  h2 { font-size: 28px; }
  .overlay-description { margin-bottom: 9px; }
  .how-to-play { gap: 4px; }
  .btn { min-height: 44px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .topbar { top: max(8px, env(safe-area-inset-top)); left: max(14px, env(safe-area-inset-left)); right: max(14px, env(safe-area-inset-right)); }
  h1 { font-size: 15px; }
  .utility-btn { min-height: 30px; }
  .hud-strip { top: 46px; left: 14px; right: 14px; max-width: 560px; }
  .hud-card { padding: 6px 10px; }
  .hud-label { margin-bottom: 3px; font-size: 7px; }
  .hud-value { font-size: 17px; }
  .control-deck { left: max(14px, env(safe-area-inset-left)); right: max(14px, env(safe-area-inset-right)); bottom: max(9px, env(safe-area-inset-bottom)); grid-template-columns: 1fr 1fr; gap: 5px 12px; max-width: 760px; }
  .status-banner { font-size: 10px; min-height: 12px; }
  .btn { min-height: 46px; padding: 7px; }
  .lane-btn { font-size: 10px; }
  .game-overlay { padding: 46px 16px 80px; }
  .start-card { width: min(100%, 640px); grid-template-columns: 1.25fr 1fr; gap: 26px; padding: 16px 21px; }
  .card-byline { margin-bottom: 8px; font-size: 8px; }
  .card-byline span { font-size: 7px; }
  h2 { margin-bottom: 7px; font-size: 28px; }
  .overlay-description { margin-bottom: 10px; font-size: 10px; line-height: 1.4; }
  .how-to-play { gap: 5px; }
  .how-to-play p { grid-template-columns: 60px 1fr; font-size: 8px; }
  .how-to-play strong { font-size: 8px; }
  .how-to-play .keyboard-hint { display: none; }
  .configuration { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 9px; }
  .configuration label:first-child { grid-column: 1; grid-row: 1; }
  .configuration label[for="seed-input"] { grid-column: 2; grid-row: 1; }
  .configuration select { grid-column: 1; grid-row: 2; }
  .configuration input { grid-column: 2; grid-row: 2; }
  .configuration input, .configuration select { height: 36px; margin: 0; padding: 7px; font-size: 10px; }
  .seed-note { grid-column: 1 / -1; margin: 2px 0; font-size: 8px; }
  .controls-form { gap: 8px; }
  .btn-primary { min-height: 43px; font-size: 13px; }
  .enter-hint { display: none; }
  .result-summary { grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 12px; }
  .result-summary > div:first-child { grid-column: auto; }
  .result-summary dt { font-size: 8px; }
  .result-summary dd, .result-summary > div:first-child dd { font-size: 24px; line-height: 1; letter-spacing: -.5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
