@charset "UTF-8";
:root {
  color-scheme:dark;
  --bg:#080f21;
  --panel:#101c30;
  --surface:#15243b;
  --border:#283b52;
  --text:#edf5ff;
  --muted:#9cafc4;
  --cyan:#70e4f2;
  --gold:#ffd38a;
  --pink:#ff93b1;
  --violet:#b6a4ff;
  --radius:20px;
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif
}

* {
  box-sizing:border-box
}

body {
  margin:0;
  background:var(--bg);
  color:var(--text);
  min-width:280px
}

button,input,select {
  font:inherit
}

button,a,input,select {
  -webkit-tap-highlight-color:transparent
}

button {
  cursor:pointer
}

button:disabled {
  cursor:default;
  opacity:.4
}

button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,canvas:focus-visible {
  outline:3px solid var(--gold);
  outline-offset:4px
}

a {
  color:inherit
}

button {
  color:inherit
}

button,input,select {
  border:1px solid var(--border)
}

[hidden] {
  display:none!important
}

h1,h2,h3,p {
  margin:0
}

button {
  touch-action:manipulation
}

body:before {
  content:"";
  position:fixed;
  inset:0;
  background:radial-gradient(ellipse at 75% 10%,#182b442f,transparent 55%);
  pointer-events:none;
  z-index:-1
}

.app {
  min-height:100svh
}

.eyebrow {
  font-size:10px;
  letter-spacing:2px;
  font-weight:650;
  color:var(--muted);
  line-height:1.8
}

.muted {
  color:var(--muted)
}

.mini-label {
  font-size:9px;
  letter-spacing:1.2px;
  color:var(--muted);
  display:block
}

.button {
  min-height:48px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:20px;
  padding:12px 20px;
  border-radius:12px;
  background:var(--surface);
  font-size:14px;
  font-weight:600;
  transition:background .15s,transform .15s
}

.button:hover:not(:disabled) {
  background:#20334c;
  transform:translateY(-1px)
}

.button.primary {
  color:#08202a;
  background:var(--cyan);
  border-color:var(--cyan)
}

.button.primary:hover:not(:disabled) {
  background:#a1edf5
}

.button.danger {
  color:var(--pink);
  border-color:#694255
}

.button.compact {
  padding:10px 14px;
  font-size:13px;
  min-height:44px;
  gap:12px
}

.text-button {
  border:0;
  min-height:44px;
  padding:6px 0;
  background:transparent;
  color:var(--cyan);
  font-size:13px;
  text-align:left
}

.text-button:hover {
  text-decoration:underline
}

.icon-button {
  border:1px solid var(--border);
  background:transparent;
  min-width:44px;
  min-height:44px;
  border-radius:12px;
  font-size:19px;
  display:grid;
  place-items:center
}

.icon-button:hover {
  background:var(--surface)
}

.home {
  max-width:1280px;
  margin:auto;
  padding:42px 60px 24px;
  min-height:100svh;
  display:flex;
  flex-direction:column
}

.brand {
  display:flex;
  align-items:center;
  gap:10px;
  font-weight:750;
  font-size:18px;
  letter-spacing:4px
}

.brand-mark {
  color:var(--cyan);
  font-size:27px
}

.brand-caption {
  font-size:11px;
  font-weight:400;
  letter-spacing:.3px;
  margin-left:auto;
  color:var(--muted)
}

.home-layout {
  display:grid;
  grid-template-columns:1.1fr 1fr;
  align-items:center;
  gap:40px;
  flex:1;
  min-height:650px
}

.home-copy {
  padding:45px 0
}

.home h1 {
  font-size:clamp(64px,8vw,108px);
  font-weight:550;
  letter-spacing:-7px;
  line-height:1.02;
  margin:20px 0 26px
}

.home h1 span {
  color:var(--cyan)
}

.home-description {
  color:var(--muted);
  font-size:16px;
  line-height:1.85;
  max-width:410px
}

.home-actions {
  display:flex;
  flex-direction:column;
  align-items:stretch;
  max-width:410px;
  gap:10px;
  margin-top:32px
}

.home-actions>.button {
  justify-content:space-between;
  min-height:54px
}

.paired-actions {
  display:flex;
  gap:10px
}

.paired-actions .button {
  flex:1;
  font-size:12px;
  gap:8px;
  padding:12px
}

.home-meta {
  margin-top:15px;
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:18px;
  max-width:420px
}

.home-meta>span {
  font-size:10px;
  color:var(--muted)
}

.orbit-art {
  position:relative
}

.hero-art {
  width:100%;
  display:block
}

.art-caption {
  font-size:11px;
  color:var(--muted);
  display:flex;
  justify-content:center;
  align-items:center;
  gap:8px;
  margin-top:12px
}

.status-dot {
  width:5px;
  height:5px;
  border-radius:100%;
  background:var(--cyan)
}

.home-footer {
  display:flex;
  justify-content:space-between;
  padding:20px 0;
  border-top:1px solid var(--border);
  font-size:11px;
  color:var(--muted)
}

.campaign {
  max-width:1100px;
  margin:auto;
  padding:40px 40px 70px
}

.page-header {
  display:flex;
  gap:24px;
  align-items:center
}

.page-header h1 {
  font-size:36px;
  letter-spacing:-1px;
  font-weight:550
}

.star-total {
  color:var(--gold);
  margin-left:auto;
  font-size:14px
}

.map-description {
  color:var(--muted);
  max-width:590px;
  font-size:14px;
  line-height:1.8;
  margin:22px 0 38px
}

.chapter-list {
  display:grid;
  gap:34px
}

.chapter-heading {
  display:flex;
  align-items:baseline;
  gap:14px;
  margin-bottom:15px
}

.chapter-heading h2 {
  font-weight:550;
  font-size:23px
}

.chapter-heading p {
  color:var(--muted);
  font-size:12px
}

.stage-grid {
  display:grid;
  grid-template-columns:repeat(6,1fr);
  gap:12px
}

.stage-card {
  min-height:150px;
  background:linear-gradient(160deg,var(--surface),#101b2d);
  border:1px solid var(--border);
  border-radius:16px;
  padding:18px 14px;
  text-align:left;
  display:flex;
  flex-direction:column;
  gap:10px;
  transition:border-color .15s
}

.stage-card:hover:not(:disabled) {
  border-color:var(--chapter-color)
}

.stage-card.current {
  border-color:var(--chapter-color);
  box-shadow:0 0 24px #70e4f20a
}

.stage-card .stage-number {
  color:var(--chapter-color);
  font-size:24px;
  font-weight:400
}

.stage-card .stage-name {
  font-size:12px;
  min-height:30px;
  line-height:1.4
}

.stage-stars {
  color:var(--gold);
  font-size:13px;
  letter-spacing:3px;
  margin-top:auto
}

.stage-card:disabled .stage-stars {
  color:var(--muted)
}

.play {
  height:100svh;
  min-height:580px;
  max-width:1280px;
  margin:auto;
  display:grid;
  grid-template-columns:minmax(220px,1fr) minmax(290px,430px) minmax(180px,1fr);
  gap:44px;
  align-items:center;
  padding:18px 42px;
  padding-top:max(18px,env(safe-area-inset-top));
  padding-bottom:max(18px,env(safe-area-inset-bottom))
}

.play-aside {
  align-self:center;
  max-width:280px
}

.wordmark {
  font-weight:700;
  letter-spacing:4px;
  text-decoration:none;
  font-size:16px;
  display:inline-block;
  margin-bottom:62px;
  color:var(--cyan);
  min-height:44px
}

.play-aside h1 {
  font-size:34px;
  letter-spacing:-1px;
  line-height:1.15;
  font-weight:550;
  margin:12px 0 18px
}

.stage-lesson {
  font-size:13px;
  line-height:1.85;
  color:var(--muted)
}

.objective-card {
  padding:20px 0;
  margin:25px 0;
  border-top:1px solid var(--border);
  border-bottom:1px solid var(--border)
}

.objective-card p {
  font-size:12px;
  line-height:1.8;
  margin-top:8px
}

.legend {
  font-size:11px;
  color:var(--muted);
  display:grid;
  gap:12px
}

.legend-dot {
  width:9px;
  height:9px;
  border-radius:2px;
  display:inline-block;
  margin-right:10px;
  border:1px solid var(--cyan)
}

.legend-dot.bomb {
  border-color:var(--pink);
  border-radius:100%
}

.legend-dot.shield {
  border-color:var(--gold);
  border-top-width:3px
}

.legend-dot.prism {
  border-color:var(--violet);
  transform:rotate(45deg)
}

.keyboard-hint {
  font-size:11px;
  line-height:2;
  color:var(--muted);
  margin-top:25px
}

.right-aside {
  align-self:center;
  max-width:210px
}

.run-log {
  min-height:230px;
  margin:16px 0 30px;
  display:flex;
  flex-direction:column;
  justify-content:flex-end;
  gap:14px
}

.log-item {
  font-size:11px;
  line-height:1.65;
  color:var(--muted);
  border-left:1px solid var(--border);
  padding-left:12px
}

.log-item strong {
  color:var(--text);
  display:block;
  font-weight:500
}

.seed-card {
  border-top:1px solid var(--border);
  padding-top:18px
}

.seed-card code {
  display:block;
  overflow-wrap:anywhere;
  color:var(--text);
  font-size:11px;
  line-height:1.8;
  margin-top:7px
}

.quiet-note {
  font-size:10px;
  line-height:1.9;
  color:var(--muted);
  margin-top:24px
}

.game-shell {
  height:100%;
  max-height:940px;
  min-height:0;
  display:flex;
  flex-direction:column;
  background:#0b1426;
  border:1px solid var(--border);
  border-radius:var(--radius);
  overflow:hidden;
  box-shadow:0 25px 100px #0005
}

.game-header {
  padding:12px 14px;
  display:flex;
  align-items:center;
  gap:14px;
  border-bottom:1px solid var(--border);
  flex:none
}

.game-header strong {
  display:block;
  font-size:14px;
  font-weight:550
}

.game-header .eyebrow {
  font-size:8px;
  letter-spacing:1.2px
}

.score-display {
  margin-left:auto;
  text-align:right
}

.board-wrap {
  position:relative;
  min-height:0;
  flex:1;
  display:flex;
  justify-content:center;
  align-items:center;
  overflow:hidden;
  background:#080f21
}

canvas {
  display:block;
  touch-action:none;
  user-select:none;
  -webkit-user-select:none;
  outline-offset:-4px!important
}

.board-toast {
  position:absolute;
  top:48px;
  left:8%;
  right:8%;
  text-align:center;
  font-size:12px;
  padding:10px 14px;
  border:1px solid #506779;
  background:#132338f2;
  border-radius:10px;
  opacity:0;
  pointer-events:none;
  transition:opacity .15s
}

.board-toast.visible {
  opacity:1
}

.game-footer {
  padding:12px 14px 9px;
  border-top:1px solid var(--border);
  flex:none
}

.loadout-row {
  display:flex;
  align-items:center;
  gap:26px
}

.loadout-row strong {
  font-size:20px;
  font-weight:500;
  display:block;
  line-height:1.6
}

.resonance-label {
  margin-left:auto;
  text-align:right
}

.resonance-label>span:last-child {
  color:var(--cyan);
  font-size:13px;
  letter-spacing:3px;
  line-height:2.45
}

.buff-row {
  min-height:32px;
  display:flex;
  align-items:center;
  gap:5px;
  flex-wrap:wrap;
  margin:2px 0 7px
}

.buff-chip {
  font-size:10px;
  border:1px solid var(--border);
  padding:4px 7px;
  border-radius:6px;
  display:inline-block;
  color:var(--buff-color)
}

.buff-empty {
  font-size:10px;
  color:var(--muted)
}

.control-row {
  display:grid;
  grid-template-columns:auto 1fr auto;
  gap:7px
}

.turn-hint {
  text-align:center;
  font-size:10px;
  color:var(--muted);
  padding-top:8px;
  min-height:22px
}

.modal {
  border:1px solid #3b526b;
  background:#101c30;
  color:var(--text);
  border-radius:24px;
  padding:30px;
  width:min(92vw,490px);
  max-height:90svh;
  overflow:auto;
  box-shadow:0 20px 100px #0009
}

.modal::backdrop {
  background:#030918b8;
  backdrop-filter:blur(8px)
}

.modal h2 {
  font-size:30px;
  letter-spacing:-.7px;
  font-weight:550;
  margin:7px 0 15px
}

.modal p {
  font-size:13px;
  line-height:1.85;
  color:var(--muted);
  margin-bottom:16px
}

.modal-actions {
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:22px
}

.modal-actions>.button {
  flex:1
}

.modal .wide-button {
  width:100%;
  margin-top:10px
}

.modal-close {
  float:right
}

.result-stars {
  font-size:38px;
  letter-spacing:10px;
  color:var(--gold);
  margin:14px 0
}

.result-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:16px;
  padding:18px 0;
  border-top:1px solid var(--border);
  border-bottom:1px solid var(--border)
}

.result-grid strong {
  display:block;
  font-size:24px;
  font-weight:500;
  margin-top:5px
}

.upgrade-list {
  display:grid;
  gap:10px;
  margin-top:20px
}

.upgrade-card {
  display:grid;
  grid-template-columns:36px 1fr;
  gap:13px;
  min-height:96px;
  padding:17px;
  text-align:left;
  border:1px solid var(--border);
  border-radius:14px;
  background:var(--surface)
}

.upgrade-card:hover {
  border-color:var(--cyan)
}

.upgrade-card>span {
  font-size:25px;
  color:var(--cyan)
}

.upgrade-card strong {
  font-size:14px
}

.upgrade-card small {
  display:block;
  color:var(--muted);
  font-size:12px;
  line-height:1.6;
  margin-top:6px
}

.setting-row {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  min-height:52px;
  border-bottom:1px solid var(--border);
  font-size:13px
}

.setting-row input[type=checkbox] {
  accent-color:var(--cyan);
  width:22px;
  height:22px
}

.setting-row input[type=range] {
  width:125px;
  accent-color:var(--cyan)
}

.setting-row select {
  background:var(--surface);
  color:var(--text);
  border-radius:8px;
  padding:10px;
  max-width:160px
}

.modal input[type=text] {
  width:100%;
  background:var(--bg);
  padding:14px;
  color:var(--text);
  border-radius:10px;
  min-height:48px
}

.help-list {
  display:grid;
  gap:12px;
  margin:20px 0
}

.help-item {
  font-size:12px;
  line-height:1.75;
  color:var(--muted)
}

.help-item strong {
  color:var(--text)
}

.save-status {
  font-size:11px!important;
  color:var(--gold)!important;
  margin-top:18px
}

.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
}

body.high-contrast {
  --muted:#c5d5e8;
  --border:#657b96;
  --surface:#15263e
}

body.high-contrast .game-shell {
  border-color:#657b96
}

body.reduced-motion *,body.reduced-motion *:before,body.reduced-motion *:after {
  transition:none!important;
  animation:none!important
}

@media(min-width:1500px) {
  .home {
    max-width:1400px
  }
  .home-layout {
    min-height:750px
  }
  .play {
    gap:65px
  }
}

@media(max-width:1100px) {
  .play {
    gap:25px;
    padding:14px 24px;
    grid-template-columns:1fr minmax(290px,410px)
  }
  .right-aside {
    display:none
  }
  .home {
    padding:30px 36px
  }
  .home-layout {
    min-height:590px;
    gap:15px
  }
  .stage-grid {
    grid-template-columns:repeat(3,1fr)
  }
  .stage-card {
    min-height:135px
  }
}

@media(max-width:720px) {
  .home {
    padding:25px 24px 20px
  }
  .brand-caption {
    display:none
  }
  .home-layout {
    grid-template-columns:1fr;
    min-height:0
  }
  .home-copy {
    padding:52px 0 15px
  }
  .home h1 {
    font-size:76px;
    letter-spacing:-5px
  }
  .home-description {
    font-size:14px
  }
  .orbit-art {
    max-width:290px;
    margin:5px auto 25px
  }
  .hero-art {
    max-height:320px
  }
  .art-caption {
    font-size:10px
  }
  .home-actions {
    max-width:none
  }
  .home-footer {
    font-size:10px;
    gap:20px
  }
  .home-meta {
    max-width:none
  }
  .campaign {
    padding:25px 20px 50px
  }
  .page-header {
    gap:14px;
    flex-wrap:wrap
  }
  .page-header h1 {
    font-size:27px
  }
  .star-total {
    font-size:12px
  }
  .chapter-heading {
    display:block
  }
  .chapter-heading p {
    margin-top:5px
  }
  .stage-grid {
    gap:8px
  }
  .stage-card {
    padding:14px 10px;
    min-height:130px
  }
  .play {
    padding:0;
    grid-template-columns:1fr;
    display:flex;
    justify-content:center;
    height:100svh;
    min-height:560px
  }
  .play-aside {
    display:none
  }
  .game-shell {
    height:100%;
    width:min(100%,470px);
    max-height:none;
    border-radius:0;
    border-top:none;
    border-bottom:none;
    box-shadow:none;
    padding-top:env(safe-area-inset-top);
    padding-bottom:env(safe-area-inset-bottom)
  }
  .game-header {
    padding:8px 12px
  }
  .game-footer {
    padding:9px 12px 7px
  }
  .modal {
    padding:24px
  }
  .game-header .icon-button {
    min-width:44px
  }
  .board-toast {
    top:42px
  }
  .modal h2 {
    font-size:27px
  }
}

@media(max-height:700px) and (min-width:721px) {
  .play {
    min-height:540px
  }
  .play-aside .wordmark {
    margin-bottom:20px
  }
  .play-aside .legend {
    display:none
  }
  .game-header {
    padding:8px 12px
  }
  .game-footer {
    padding:8px 12px
  }
  .stage-lesson {
    font-size:12px
  }
  .objective-card {
    margin:15px 0;
    padding:14px 0
  }
}

@media(max-height:520px) and (orientation:landscape) {
  .play {
    display:flex;
    justify-content:center;
    min-height:300px;
    height:100svh;
    padding:0
  }
  .play-aside,.right-aside {
    display:none
  }
  .game-shell {
    width:min(100%,740px);
    min-height:0;
    height:100%;
    display:grid;
    grid-template-columns:minmax(180px,1fr) 230px;
    grid-template-rows:75px 1fr;
    border-radius:0
  }
  .board-wrap {
    grid-column:1;
    grid-row:1/3;
    height:100%;
    border-right:1px solid var(--border)
  }
  .game-header {
    grid-column:2;
    grid-row:1;
    gap:8px;
    border-bottom:none;
    padding:8px
  }
  .game-header strong {
    font-size:12px
  }
  .game-footer {
    grid-column:2;
    grid-row:2;
    align-self:end;
    border-top:none;
    padding:12px
  }
  .loadout-row {
    gap:18px;
    flex-wrap:wrap
  }
  .resonance-label {
    width:100%;
    text-align:left;
    margin-left:0
  }
  .resonance-label>span:last-child {
    line-height:1.8
  }
  .control-row {
    grid-template-columns:1fr 1fr
  }
  .control-row #fireBtn {
    grid-column:1/3;
    grid-row:1
  }
  .turn-hint {
    line-height:1.7;
    font-size:9px
  }
  .board-toast {
    top:45px
  }
  .home-layout {
    min-height:0
  }
  .home-copy {
    padding-top:30px
  }
}

@media(prefers-reduced-motion:reduce) {
  * {
    scroll-behavior:auto
  }
}
