:root {
  color-scheme: dark;
  --base: #090619;
  --panel: #151127;
  --border: #44375e;
  --text: #f9f7ff;
  --muted: #c8bfdc;
  --cyan: #77f8eb;
  --gold: #e4ff86;
  --pink: #ff7ad7;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-family: "Segoe UI", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  min-width: 280px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(ellipse at 96% 8%, #3f144b 0, transparent 53%),
    radial-gradient(ellipse at -10% 60%, #0e3a47 0, transparent 54%),
    var(--base);
}
button { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }

.site-header { border-bottom: 1px solid #b39af238; background: #090619ab; }
.site-nav {
  width: min(100% - 3rem, 1160px);
  min-height: 55px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}
.home-link {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  font-size: 1rem;
  font-weight: 650;
  text-decoration: none;
}
.home-link:hover { color: var(--cyan); }
.orbit-mark {
  flex: 0 0 25px;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  border: 1px solid #83fbef72;
  position: relative;
}
.orbit-mark::before {
  content: "";
  position: absolute;
  inset: 8px -3px;
  border: 1px solid var(--cyan);
  border-radius: 50%;
  transform: rotate(-36deg);
}
.orbit-mark::after {
  content: "";
  position: absolute;
  background: var(--cyan);
  width: 5px;
  height: 5px;
  inset: 6px -1px auto auto;
  border-radius: 50%;
  box-shadow: 0 0 9px var(--cyan);
}
.site-section {
  padding-left: 16px;
  border-left: 1px solid #51627b;
  color: var(--muted);
  font-size: .875rem;
}
#game-share { margin-inline-start: auto; }
#game-share .share-trigger {
  border-color: var(--border);
  background: var(--panel);
  color: var(--cyan);
  white-space: nowrap;
}
#game-share .share-trigger:is(:hover, :focus-visible),
#game-share details[open] > .share-trigger { border-color: var(--cyan); }
#game-share .share-panel {
  inset-inline: auto 0;
  width: min(22rem, calc(100vw - 24px));
  border-color: var(--border);
  background: var(--panel);
  box-shadow: 0 10px 28px #090619b3;
}
#game-share .share-message {
  margin: 0 0 3px;
  color: var(--text);
  font-size: .95rem;
  line-height: 1.4;
}
#game-share .share-address { resize: vertical; }
@media (max-width: 405px) {
  .site-section { display: none; }
  .site-nav { gap: 8px; }
  .home-link { gap: 7px; }
}

.arcade {
  width: min(100% - 3rem, 1160px, max(650px, calc(128.57svh - 108px)));
  margin: 24px auto 45px;
}
.intro { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 17px; }
.intro h1 {
  margin: 0;
  font-family: "Bahnschrift", "Arial Black", system-ui, sans-serif;
  font-size: clamp(2.55rem, 5.5vw, 4.85rem);
  line-height: .97;
  font-weight: 850;
  letter-spacing: -.07em;
  text-transform: uppercase;
}
.intro h1 span { color: var(--cyan); text-shadow: 0 0 23px #5be8e75c; }
.intro p { color: var(--muted); margin: 0 0 3px; max-width: 21rem; font-size: 1rem; line-height: 1.35; }
.console {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 258px;
  gap: 13px;
  align-items: start;
}
.game, .record-panel, .control-panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
}
.game {
  padding: 9px;
  scroll-margin-top: 8px;
  border-color: transparent;
  background:
    linear-gradient(136deg, #19263e 0, #14142b 49%, #261331 100%) padding-box,
    linear-gradient(128deg, #7df8ed 0, #3a436b 26%, #5e3979 69%, #ed6aca 100%) border-box;
  box-shadow: -12px 4px 50px #47e6e719, 16px 16px 65px #ff39b520, 0 20px 48px #0006;
}
.scoreboard {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: end;
  gap: 8px;
  margin: 3px 3px 9px;
}
.scoreboard > div { min-width: 0; padding-left: 9px; }
.scoreboard > div + div { border-left: 1px solid var(--border); }
.scoreboard dt { margin-bottom: 1px; color: var(--muted); font-size: .875rem; }
.scoreboard dd { margin: 0; font: 650 clamp(1.06rem, 3.3vw, 1.45rem)/1.2 var(--mono); }
#score { color: var(--cyan); text-shadow: 0 0 12px #66f8ec62; }
.lives { display: flex; align-items: center; gap: 7px; min-height: 1.2em; }
.lives span {
  width: 13px;
  height: 12px;
  clip-path: polygon(50% 0, 100% 100%, 50% 72%, 0 100%);
  background: var(--cyan);
}
.lives span.lost { background: #688097; opacity: .43; }
.flight-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 8px;
}
.combo-status, .pulse-status {
  display: grid;
  min-width: 0;
  gap: 5px;
  min-height: 45px;
  padding: 5px 9px 6px;
  border: 1px solid #334953;
  border-radius: 7px;
  background: #0c1620;
  color: var(--text);
  text-align: left;
}
.pulse-status:disabled { opacity: 1; }
.pulse-status:not(:disabled) { color: #1a1307; background: var(--gold); border-color: #ffe9b9; cursor: pointer; }
.pulse-status:not(:disabled):hover { background: #fff0c4; }
.flight-line { display: flex; align-items: center; gap: 6px; white-space: nowrap; font-size: .875rem; }
.flight-line strong { font: 700 .9rem var(--mono); }
.combo-status strong { color: var(--cyan); }
.combo-status[data-chained="true"] { border-color: #66ddcf; box-shadow: inset 0 0 10px #67ecbe21; }
.combo-status[data-chained="true"] strong { text-shadow: 0 0 12px #83f6d99c; }
#combo-count, #pulse-value { margin-left: auto; }
#combo-count { color: var(--muted); }
.pulse-shortcut kbd { min-width: 19px; min-height: 19px; margin-left: 3px; padding: 0 3px; font-size: .75rem; }
.flight-strip progress { width: 100%; height: 4px; align-self: end; }
.combo-status progress { accent-color: var(--cyan); }
.pulse-status progress { accent-color: var(--gold); }
.pulse-status:not(:disabled) progress { accent-color: #7e521b; }
.playfield {
  --arena-light: #71ecff24;
  position: relative;
  overflow: hidden;
  border: 1px solid #695997;
  border-radius: 8px;
  isolation: isolate;
  background: #050b18;
}
.playfield::after {
  position: absolute;
  z-index: 2;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 23px var(--arena-light);
  transition: box-shadow .25s ease;
  pointer-events: none;
  content: "";
}
.playfield[data-cue="combo"] { --arena-light: #66f7f276; }
.playfield[data-cue="pulse"] { --arena-light: #d8ff7e94; }
.playfield[data-cue="boss"] { --arena-light: #ff76df94; }
.playfield[data-cue="victory"] { --arena-light: #ffd2938f; }
.playfield[data-cue="wave"] { --arena-light: #8791ff65; }
.playfield[data-cue="shield"] { --arena-light: #7bafff88; }
canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 9 / 7;
  touch-action: pan-y;
}
.playfield[data-mode="playing"] canvas { touch-action: none; }
canvas:focus-visible { outline-offset: -3px; }
.boss-meter, .life-hint, .boost-hud, .formation-hud {
  position: absolute;
  margin: 0;
  border-radius: 6px;
  background: #081325e6;
  color: var(--text);
  font: 600 .875rem/1.2 var(--mono);
  pointer-events: none;
}
.boss-meter, .life-hint {
  top: 7px;
  left: 50%;
  translate: -50%;
  width: min(79%, 345px);
  padding: 5px 9px;
}
.boss-meter { display: flex; align-items: center; gap: 10px; color: #ffd6b0; }
.boss-meter span { max-width: 72%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.boss-meter progress { flex: 1; min-width: 26px; height: 9px; accent-color: #ff9268; }
.boss-meter[data-charging="true"] { color: #fff3d5; box-shadow: inset 0 0 0 1px #e59871; }
.life-hint { text-align: center; color: #a9ffcc; }
.boost-hud { bottom: 5px; left: 7px; padding: 4px 7px; color: var(--cyan); }
.formation-hud { top: 8px; left: 8px; padding: 4px 7px; border-left: 2px solid #6ac1af; }
.arena-cue {
  position: absolute;
  z-index: 1;
  top: 41px;
  right: 10px;
  max-width: calc(100% - 20px);
  margin: 0;
  padding: 6px 11px;
  border: 1px solid var(--arena-light);
  border-radius: 4px;
  background: #120a27ec;
  color: var(--cyan);
  box-shadow: 0 0 14px var(--arena-light);
  font: 700 clamp(.8rem, 2vw, 1.03rem) var(--mono);
  line-height: 1.2;
  pointer-events: none;
}
.playfield[data-cue="boss"] .arena-cue { color: var(--pink); }
.playfield[data-cue="victory"] .arena-cue { color: #ffe2a6; }
.playfield[data-cue="pulse"] .arena-cue { color: var(--gold); }
.playfield:not([data-mode="playing"]) .arena-cue { display: none; }
.boost-help { margin-top: 14px; color: var(--muted); font-size: .875rem; }
.boost-help summary { color: var(--cyan); cursor: pointer; }
.boost-help p { line-height: 1.45; margin: 6px 0 0; }
@media (max-width: 405px) {
  .boost-hud { bottom: 3px; font-size: .75rem; }
}
.screen {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 15px;
  text-align: center;
  background:
    linear-gradient(90deg, #05091421, #05091490 43%, #05091490 57%, #05091421),
    radial-gradient(ellipse at 50% 50%, #091322f2 0%, #080f24b3 34%, #070c1b22 78%);
}
.playfield[data-mode="ready"] .screen {
  isolation: isolate;
  background:
    radial-gradient(ellipse at center, #08061c65 0, #08061c3d 42%, transparent 72%),
    url("/orbita/neon-hero.webp") center / cover;
}
.playfield[data-mode="ready"] .screen::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    radial-gradient(ellipse at 81% 24%, #6efff46f 0, transparent 27%),
    radial-gradient(ellipse at 7% 88%, #2ff1ff6b 0, transparent 30%);
  opacity: .53;
  mix-blend-mode: screen;
  pointer-events: none;
  content: "";
}
.screen h2 {
  margin: 0;
  font-size: clamp(1.4rem, 5vw, 3.5rem);
  font-weight: 810;
  letter-spacing: -.048em;
  line-height: 1.05;
  text-wrap: balance;
}
#screen-title::before {
  display: block;
  width: 42px;
  height: 2px;
  margin: 0 auto 12px;
  background: linear-gradient(90deg, var(--cyan), var(--pink));
  box-shadow: 0 0 17px #ed8dff8a;
  content: "";
}
.screen p { max-width: 23rem; margin: 11px 0 19px; color: #cbd8e9; text-wrap: balance; }
.playfield[data-mode="ready"] #screen-title {
  color: #fffaff;
  text-shadow: 0 3px 18px #070417, 0 0 29px #dac7ff53;
}
.playfield[data-mode="ready"] #screen-copy { color: #eee5ff; text-shadow: 0 2px 8px #08031b; }
.playfield[data-mode="ready"] .screen::before { animation: portal-glow 4s ease-in-out infinite alternate; }
.playfield[data-mode="over"] .screen { animation: result-in .25s ease-out .24s both; }
.playfield[data-cue="victory"]::after { animation: victory-glow 1.36s ease-out both; }
@keyframes portal-glow { from { opacity: .36; } to { opacity: .77; } }
@keyframes victory-glow {
  from { box-shadow: inset 0 0 14px #ff76d966; }
  33% { box-shadow: inset 0 0 32px #ffcb92b0, inset 0 0 8px #fff2ceaa; }
  to { box-shadow: inset 0 0 23px #ffab6824; }
}
@keyframes result-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.action {
  color: #17220b;
  background: linear-gradient(110deg, #efffa0, #bdff75);
  border: 1px solid #f4ffd1;
  border-radius: 6px;
  min-height: 46px;
  min-width: 124px;
  padding: 8px 22px;
  font-weight: 740;
  box-shadow: 0 3px 19px #c1ff5352;
  cursor: pointer;
}
.action:hover { background: #f2ffc7; }
.wave-banner {
  position: absolute;
  top: 53%;
  left: 50%;
  translate: -50% -50%;
  width: max-content;
  max-width: 92%;
  padding: 10px 18px;
  border: 1px solid #83fbef66;
  border-radius: 8px;
  background: #0b1b2ff2;
  color: var(--cyan);
  font: 650 1rem var(--mono);
  pointer-events: none;
}

.side { display: grid; gap: 16px; }
.record-panel, .control-panel { padding: 15px 16px; }
.side h2 { margin: 0; font-size: 1.05rem; font-weight: 700; }
.record-panel {
  background: linear-gradient(138deg, #302049, transparent 69%), var(--panel);
  box-shadow: inset 2px 0 #7eeedc, 0 0 20px #1cc5c116;
}
.record-panel p {
  color: var(--gold);
  margin: 10px 0 4px;
  font: 700 clamp(1.6rem, 3vw, 2rem)/1.1 var(--mono);
}
.record-panel span { color: var(--muted); font-size: .875rem; }
.control-panel dl { margin: 7px 0 12px; }
.control-panel dl div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
}
.control-panel dd { display: flex; gap: 4px; margin: 0; }
kbd {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  min-height: 25px;
  padding: 2px 5px;
  border: 1px solid #405674;
  border-radius: 5px;
  background: #142035;
  color: var(--text);
  font: 600 .875rem var(--mono);
}
.settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.settings button, .touch-pad button {
  min-height: 44px;
  padding: 5px 10px;
  border: 1px solid #405674;
  border-radius: 7px;
  background: #13213a;
  color: var(--text);
  cursor: pointer;
  font-size: .875rem;
  font-weight: 600;
}
.settings button:hover { background: #203657; }
.settings button:disabled { opacity: .58; cursor: default; }
.settings button[aria-pressed="true"] { color: var(--cyan); border-color: #63adad; }
.touch-help { display: none; margin: 10px 0 15px; color: var(--muted); line-height: 1.45; }
.touch-pad { display: none; grid-template-columns: 58px 58px 1fr; gap: 8px; margin-top: 9px; }
.touch-pad button { touch-action: none; user-select: none; }
.touch-pad button span { font-size: 1.7rem; line-height: 1; }
.touch-pad button.fire { color: var(--cyan); border-color: #477a89; }
.touch-pad button[data-active] { color: #061824; background: var(--cyan); }
.touch-pad button:disabled { opacity: .58; cursor: default; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (pointer: coarse), (max-width: 700px) {
  .touch-pad { display: grid; }
}
@media (pointer: coarse) {
  #keyboard-help { display: none; }
  .touch-help { display: block; }
  .pulse-shortcut kbd { display: none; }
}
@media (max-width: 780px) {
  .console { grid-template-columns: minmax(0, 1fr) 218px; gap: 11px; }
  .side { gap: 11px; }
}
@media (min-width: 701px) and (max-height: 820px) {
  .site-nav { min-height: 45px; }
  .arcade {
    width: min(100% - 3rem, 1160px, max(650px, calc(128.57svh - 78px)));
    margin-block: 16px 25px;
  }
  .intro { margin-bottom: 13px; }
  .intro h1 { font-size: clamp(2.75rem, 5vw, 3.8rem); }
}
@media (min-width: 701px) and (max-height: 620px) {
  .arcade { margin-block: 13px 16px; }
  .intro h1 { font-size: 2.65rem; }
  .scoreboard { margin-bottom: 8px; }
}
@media (max-width: 700px) {
  .site-nav, .arcade { width: min(100% - 1.5rem, 570px); }
  .site-nav { min-height: 51px; }
  .arcade { margin-block: 18px 26px; }
  .intro { display: block; margin-bottom: 13px; }
  .intro p { margin-top: 7px; }
  .console { grid-template-columns: 1fr; }
  .game { padding: 7px; border-radius: 10px; }
  .scoreboard { margin-bottom: 9px; }
  .side { grid-template-columns: minmax(0, .9fr) minmax(0, 1.2fr); }
  .record-panel, .control-panel { padding: 12px; }
}
@media (max-width: 405px) {
  .side { grid-template-columns: 1fr; }
  .flight-line { gap: 4px; font-size: .8rem; }
  .combo-status, .pulse-status { padding-inline: 6px; }
  .pulse-shortcut kbd { display: none; }
  .screen p { margin-bottom: 13px; }
}
