:root {
  --night: #070b22;
  --night-soft: #111a42;
  --paper: #fff8df;
  --gold: #f5c756;
  --gold-dark: #b97c20;
  --cyan: #6ef4e8;
  --cyan-deep: #119da1;
  --red: #ff5162;
  --purple: #8b5cf6;
  --ink: #181428;
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
  color: white;
  background: var(--night);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 20%, rgb(55 77 153 / 42%), transparent 35%),
    radial-gradient(circle at 15% 80%, rgb(10 187 180 / 16%), transparent 28%),
    linear-gradient(145deg, #050718, #0b1130 52%, #130a28);
}

body::before {
  position: fixed;
  inset: -40%;
  background-image:
    linear-gradient(90deg, transparent 48%, rgb(110 244 232 / 6%) 49%, rgb(110 244 232 / 6%) 51%, transparent 52%),
    linear-gradient(0deg, transparent 48%, rgb(245 199 86 / 5%) 49%, rgb(245 199 86 / 5%) 51%, transparent 52%);
  background-size: 90px 90px;
  content: "";
  opacity: .6;
  transform: perspective(500px) rotateX(62deg) translateY(8%);
  animation: outer-grid 8s linear infinite;
  pointer-events: none;
}

button {
  font: inherit;
}

button:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 4px;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
}

.game-frame {
  position: relative;
  isolation: isolate;
  width: min(100vw, calc((100dvh - 52px) * .55714), 430px);
  aspect-ratio: 390 / 700;
  overflow: hidden;
  border: 1px solid rgb(151 225 222 / 30%);
  border-radius: 24px;
  background: #0b1230;
  box-shadow:
    0 0 0 4px rgb(255 255 255 / 4%),
    0 28px 70px rgb(0 0 0 / 55%),
    0 0 70px rgb(27 190 190 / 12%);
  user-select: none;
}

.game-frame::after {
  position: absolute;
  z-index: 30;
  inset: 0;
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: inherit;
  box-shadow: inset 0 0 35px rgb(0 0 0 / 35%);
  content: "";
  pointer-events: none;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.screen {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: none;
  overflow: auto;
  align-items: center;
  justify-content: center;
  padding: clamp(18px, 5vh, 36px) 24px;
  background:
    linear-gradient(180deg, rgb(5 8 28 / 57%), rgb(5 8 28 / 90%)),
    radial-gradient(circle at 50% 28%, rgb(40 179 182 / 20%), transparent 37%);
  text-align: center;
  overscroll-behavior: contain;
}

.screen.is-active {
  display: flex;
  animation: screen-in 380ms ease both;
}

.start-content,
.result-content {
  width: 100%;
  max-width: 350px;
}

.brand-mark {
  position: relative;
  display: grid;
  width: clamp(68px, 12vh, 92px);
  aspect-ratio: 1;
  margin: 0 auto 14px;
  place-items: center;
  border: 1px solid rgb(245 199 86 / 70%);
  border-radius: 50%;
  color: var(--paper);
  background: radial-gradient(circle, #d24b51 0 38%, #8d1e37 40% 52%, transparent 54%);
  box-shadow: 0 0 30px rgb(255 81 98 / 38%), inset 0 0 0 5px rgb(255 255 255 / 8%);
}

.brand-mark__ring {
  position: absolute;
  inset: -8px;
  border: 1px dashed rgb(110 244 232 / 55%);
  border-radius: 50%;
  animation: ring-spin 14s linear infinite;
}

.brand-mark strong {
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(2rem, 6vh, 3.1rem);
  line-height: 1;
}

.eyebrow,
.result-kicker {
  margin: 0 0 6px;
  color: var(--cyan);
  font-size: clamp(.62rem, 1.5vh, .72rem);
  font-weight: 900;
  letter-spacing: .24em;
}

#game-title {
  margin: 0;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(1.65rem, 4.3vh, 2.3rem);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: .02em;
  text-shadow: 0 0 18px rgb(110 244 232 / 20%);
  white-space: nowrap;
}

#game-title span {
  color: var(--gold);
  font-family: inherit;
  font-size: .58em;
  letter-spacing: .08em;
}

.tagline {
  margin: 10px 0 17px;
  color: rgb(255 255 255 / 68%);
  font-size: clamp(.74rem, 1.8vh, .88rem);
  font-weight: 700;
  letter-spacing: .05em;
}

.pilot-select {
  margin: 0 auto 14px;
  padding: 8px 9px 9px;
  border: 1px solid rgb(245 199 86 / 28%);
  border-radius: 13px;
  background: rgb(7 12 39 / 82%);
  box-shadow: inset 0 0 18px rgb(245 199 86 / 4%);
}

.pilot-select__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
  padding: 0 2px;
  color: rgb(255 255 255 / 45%);
  font-size: .48rem;
  font-weight: 900;
  letter-spacing: .14em;
}

.pilot-select__header strong {
  color: var(--gold);
  font-size: .58rem;
  letter-spacing: .09em;
}

.pilot-list {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding: 3px 1px 5px;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}

.pilot-list::-webkit-scrollbar {
  display: none;
}

.pilot-option {
  position: relative;
  display: grid;
  min-width: 40px;
  flex: 1 0 40px;
  gap: 3px;
  padding: 2px 2px 4px;
  border: 1px solid rgb(255 255 255 / 13%);
  border-radius: 9px;
  color: rgb(255 255 255 / 48%);
  background: rgb(255 255 255 / 5%);
  cursor: pointer;
  scroll-snap-align: center;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease, transform 140ms ease;
  touch-action: manipulation;
}

.pilot-option:hover {
  color: white;
  border-color: rgb(110 244 232 / 48%);
  transform: translateY(-2px);
}

.pilot-option[aria-checked="true"] {
  color: var(--gold);
  border-color: var(--gold);
  background: rgb(245 199 86 / 12%);
  box-shadow: 0 0 13px rgb(245 199 86 / 18%);
}

.pilot-option__portrait {
  position: relative;
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  place-items: center;
  border-radius: 7px;
  background: #fff;
}

.pilot-option img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.pilot-option__fallback {
  display: none;
  color: #14223a;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: .8rem;
  font-weight: 900;
}

.pilot-option.is-image-missing img {
  display: none;
}

.pilot-option.is-image-missing .pilot-option__fallback {
  display: block;
}

.pilot-option > small {
  overflow: hidden;
  font-size: .38rem;
  font-weight: 900;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mission-card {
  display: grid;
  gap: 1px;
  overflow: hidden;
  margin: 0 auto 20px;
  border: 1px solid rgb(110 244 232 / 18%);
  border-radius: 14px;
  background: rgb(255 255 255 / 8%);
  text-align: left;
}

.mission-card > div {
  display: grid;
  grid-template-columns: 35px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 45px;
  padding: 7px 13px;
  background: rgb(10 16 48 / 82%);
}

.mission-card > div > span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid rgb(110 244 232 / 34%);
  border-radius: 9px;
  color: var(--cyan);
  background: rgb(110 244 232 / 7%);
  font-weight: 900;
}

.mission-card p {
  display: flex;
  margin: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.mission-card strong {
  font-size: .78rem;
}

.mission-card small {
  color: rgb(255 255 255 / 48%);
  font-size: .62rem;
}

.primary-button {
  position: relative;
  display: grid;
  width: min(100%, 310px);
  min-height: 67px;
  margin: 0 auto;
  padding: 11px 54px 12px 22px;
  border: 1px solid #ffe397;
  border-radius: 14px;
  color: #261704;
  background: linear-gradient(145deg, #ffe28c, var(--gold) 48%, #dd962d);
  box-shadow: 0 6px 0 #8d5515, 0 12px 28px rgb(245 199 86 / 24%);
  text-align: left;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
  touch-action: manipulation;
}

.primary-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #8d5515, 0 15px 30px rgb(245 199 86 / 28%);
}

.primary-button:active {
  transform: translateY(5px);
  box-shadow: 0 1px 0 #8d5515, 0 5px 12px rgb(245 199 86 / 20%);
}

.button-kicker {
  font-size: .57rem;
  font-weight: 900;
  letter-spacing: .17em;
  opacity: .66;
}

.primary-button strong {
  font-size: 1.05rem;
  letter-spacing: .07em;
}

.primary-button i {
  position: absolute;
  top: 50%;
  right: 18px;
  display: grid;
  width: 31px;
  height: 31px;
  border: 1px solid rgb(38 23 4 / 35%);
  border-radius: 50%;
  place-items: center;
  font-size: 1.5rem;
  font-style: normal;
  transform: translateY(-50%);
}

.high-score {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  margin: 18px 0 0;
  color: rgb(255 255 255 / 58%);
}

.high-score span,
.result-high-score {
  font-size: .62rem;
  font-weight: 900;
  letter-spacing: .16em;
}

.high-score strong {
  color: white;
  font-size: 1rem;
}

.game-hud {
  position: absolute;
  z-index: 8;
  top: 0;
  right: 0;
  left: 0;
  display: none;
  padding: 11px 12px 0;
  pointer-events: none;
}

.game-hud.is-active {
  display: block;
  animation: hud-in 250ms ease both;
}

.hud-top {
  display: grid;
  grid-template-columns: .8fr 1.35fr .85fr;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 15%);
  border-radius: 12px;
  background: rgb(5 9 31 / 74%);
  box-shadow: 0 7px 20px rgb(0 0 0 / 22%);
  backdrop-filter: blur(6px);
}

.hud-block {
  position: relative;
  display: flex;
  min-height: 50px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5px;
}

.hud-block + .hud-block::before {
  position: absolute;
  top: 17%;
  bottom: 17%;
  left: 0;
  width: 1px;
  background: rgb(255 255 255 / 13%);
  content: "";
}

.hud-label {
  color: rgb(255 255 255 / 52%);
  font-size: .52rem;
  font-weight: 900;
  letter-spacing: .15em;
}

.hud-block strong {
  font-size: clamp(1rem, 4.8vw, 1.5rem);
  line-height: 1.05;
  text-shadow: 0 0 10px rgb(255 255 255 / 20%);
}

.hud-block--time strong {
  color: var(--gold);
}

.hud-block--score strong {
  font-size: clamp(.95rem, 4.2vw, 1.3rem);
}

.hud-block small {
  margin-left: 2px;
  font-size: .45em;
}

.health-row {
  display: grid;
  grid-template-columns: auto 1fr 30px;
  align-items: center;
  gap: 7px;
  margin-top: 7px;
  color: rgb(255 255 255 / 68%);
  font-size: .51rem;
  font-weight: 900;
  letter-spacing: .08em;
}

.health-row > strong {
  color: white;
  font-size: .64rem;
  text-align: right;
}

.health-track,
.boss-track {
  overflow: hidden;
  height: 7px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 999px;
  background: rgb(0 0 0 / 38%);
}

.health-fill,
.boss-fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #43dcab, var(--cyan));
  box-shadow: 0 0 9px var(--cyan);
  transform-origin: left center;
  transition: width 180ms ease, background 180ms ease;
}

.health-fill.is-low {
  background: linear-gradient(90deg, #d92849, var(--red));
  box-shadow: 0 0 9px var(--red);
}

.power-status {
  display: flex;
  gap: 5px;
  margin-top: 8px;
}

.power-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px 3px 4px;
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 999px;
  color: rgb(255 255 255 / 28%);
  background: rgb(5 9 31 / 54%);
  font-size: .48rem;
  font-weight: 900;
  letter-spacing: .05em;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.power-pill b {
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  border-radius: 50%;
  background: rgb(255 255 255 / 7%);
  font-size: .55rem;
}

.power-pill.is-active {
  border-color: rgb(110 244 232 / 65%);
  color: white;
  background: rgb(15 123 133 / 68%);
  box-shadow: 0 0 14px rgb(110 244 232 / 28%);
}

.power-pill.is-active b {
  color: #061721;
  background: var(--cyan);
}

.boss-hud {
  position: absolute;
  z-index: 9;
  top: 122px;
  right: 18px;
  left: 18px;
  display: none;
  padding: 7px 10px 9px;
  border: 1px solid rgb(255 81 98 / 50%);
  border-radius: 10px;
  background: rgb(44 5 21 / 78%);
  box-shadow: 0 0 20px rgb(255 81 98 / 18%);
  pointer-events: none;
}

.boss-hud.is-active {
  display: block;
  animation: boss-hud-in 350ms ease both;
}

.boss-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  color: rgb(255 255 255 / 65%);
  font-size: .5rem;
  font-weight: 900;
  letter-spacing: .1em;
}

.boss-label strong {
  color: var(--red);
  letter-spacing: .18em;
}

.boss-fill {
  background: linear-gradient(90deg, #ffb237, var(--red), #c01d69);
  box-shadow: 0 0 10px var(--red);
}

.combo-burst {
  position: absolute;
  z-index: 11;
  top: 25%;
  left: 50%;
  color: white;
  font-size: clamp(1.5rem, 7vw, 2.4rem);
  font-style: italic;
  font-weight: 1000;
  letter-spacing: .02em;
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 0 8px var(--cyan), 3px 3px 0 #126a7d;
  transform: translate(-50%, -50%) scale(.7) rotate(-5deg);
  white-space: nowrap;
}

.combo-burst.is-active {
  animation: combo-pop 620ms ease-out both;
}

.warning {
  position: absolute;
  z-index: 16;
  top: 42%;
  right: 0;
  left: 0;
  width: 100%;
  display: none;
  overflow: hidden;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 12px;
  padding: 16px 24px;
  color: white;
  background: repeating-linear-gradient(-45deg, rgb(163 8 40 / 94%) 0 11px, rgb(121 4 29 / 94%) 11px 22px);
  box-shadow: 0 0 40px rgb(255 31 76 / 55%);
  pointer-events: none;
}

.warning.is-active {
  display: grid;
  animation: warning-in 1.55s ease both;
}

.warning strong {
  grid-column: 1;
  font-size: clamp(2.1rem, 10vw, 3.3rem);
  font-style: italic;
  font-weight: 1000;
  line-height: .95;
  letter-spacing: .05em;
  text-align: right;
  text-shadow: 3px 3px 0 #45000e;
}

.warning small {
  grid-column: 1;
  color: rgb(255 255 255 / 78%);
  font-size: .57rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-align: right;
}

.warning-line {
  grid-column: 2;
  grid-row: 1 / 3;
  width: 7px;
  height: 100%;
  border-right: 2px solid var(--gold);
  border-left: 2px solid var(--gold);
}

.warning-line:last-child {
  display: none;
}

.hit-vignette {
  position: absolute;
  z-index: 13;
  inset: 0;
  border: 0 solid rgb(255 81 98 / 0%);
  opacity: 0;
  pointer-events: none;
}

.hit-vignette.is-active {
  animation: hit-flash 240ms ease-out both;
}

.screen--result {
  background:
    linear-gradient(180deg, rgb(5 8 28 / 72%), rgb(5 8 28 / 94%)),
    radial-gradient(circle at 50% 25%, rgb(245 199 86 / 20%), transparent 37%);
}

.result-kicker {
  margin-bottom: 5px;
  color: var(--gold);
}

#result-title {
  margin: 0;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(2rem, 6vh, 2.9rem);
  line-height: 1.1;
}

.result-message {
  margin: 9px auto 17px;
  color: rgb(255 255 255 / 56%);
  font-size: .7rem;
  line-height: 1.6;
}

.result-score {
  position: relative;
  display: flex;
  min-height: 115px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid rgb(245 199 86 / 45%);
  border-radius: 17px;
  background: linear-gradient(145deg, rgb(255 248 223 / 96%), rgb(240 218 169 / 94%));
  box-shadow: 0 12px 35px rgb(0 0 0 / 30%), 0 0 25px rgb(245 199 86 / 12%);
}

.result-score > span {
  color: #85622b;
  font-size: .59rem;
  font-weight: 900;
  letter-spacing: .19em;
}

.result-score strong {
  color: #542e19;
  font-size: clamp(2.8rem, 10vh, 4rem);
  line-height: 1.05;
}

.result-score em {
  position: absolute;
  right: -7px;
  bottom: -10px;
  padding: 5px 9px;
  border-radius: 5px;
  color: #2b1b04;
  background: var(--gold);
  box-shadow: 0 3px 0 #8d5515;
  font-size: .55rem;
  font-style: normal;
  font-weight: 1000;
  transform: rotate(-3deg);
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 19px 0 11px;
}

.result-stats div + div {
  border-left: 1px solid rgb(255 255 255 / 13%);
}

.result-stats dt {
  color: rgb(255 255 255 / 48%);
  font-size: .58rem;
  font-weight: 700;
}

.result-stats dd {
  margin: 3px 0 0;
  font-size: 1.35rem;
  font-weight: 900;
}

.result-stats small {
  margin-left: 2px;
  font-size: .42em;
}

.result-high-score {
  margin: 0 0 16px;
  color: rgb(255 255 255 / 45%);
}

.result-high-score strong {
  margin-left: 7px;
  color: white;
  font-size: .9rem;
}

.primary-button--compact {
  min-height: 60px;
}

.text-button {
  margin-top: 15px;
  padding: 5px 9px;
  border: 0;
  border-bottom: 1px solid rgb(255 255 255 / 35%);
  color: rgb(255 255 255 / 58%);
  background: transparent;
  font-size: .7rem;
  font-weight: 700;
  cursor: pointer;
}

.desktop-note {
  margin: 0;
  color: rgb(255 255 255 / 42%);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
}

.desktop-note span {
  margin-right: 5px;
  color: var(--cyan);
}

noscript {
  position: fixed;
  z-index: 100;
  right: 10px;
  bottom: 10px;
  left: 10px;
  padding: 12px;
  border-radius: 10px;
  color: white;
  background: #a00f36;
  text-align: center;
}

@keyframes outer-grid {
  from { background-position: 0 0, 0 0; }
  to { background-position: 0 90px, 0 90px; }
}

@keyframes ring-spin {
  to { transform: rotate(360deg); }
}

@keyframes screen-in {
  from { opacity: 0; transform: scale(1.025); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes hud-in {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes boss-hud-in {
  from { opacity: 0; transform: scaleX(.65); }
  to { opacity: 1; transform: scaleX(1); }
}

@keyframes combo-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.65) rotate(-7deg); }
  30% { opacity: 1; transform: translate(-50%, -50%) scale(1.16) rotate(2deg); }
  72% { opacity: 1; transform: translate(-50%, -58%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -92%) scale(.88); }
}

@keyframes warning-in {
  0% { opacity: 0; transform: translateX(-100%); }
  14% { opacity: 1; transform: translateX(0); }
  22%, 42%, 62% { filter: brightness(1.45); }
  32%, 52%, 72% { filter: brightness(.8); }
  86% { opacity: 1; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(100%); }
}

@keyframes hit-flash {
  0% { opacity: 1; border-width: 22px; border-color: rgb(255 81 98 / 82%); background: rgb(255 255 255 / 22%); }
  100% { opacity: 0; border-width: 0; border-color: transparent; background: transparent; }
}

@media (max-width: 600px) {
  .app-shell {
    padding: 0;
  }

  .game-frame {
    width: min(100vw, calc(100dvh * .55714));
    border-radius: 0;
    border-top: 0;
    border-bottom: 0;
  }

  .desktop-note {
    display: none;
  }
}

@media (max-height: 650px) {
  .screen {
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .brand-mark {
    width: 59px;
    margin-bottom: 8px;
  }

  .tagline {
    margin-top: 6px;
    margin-bottom: 10px;
  }

  .pilot-select {
    margin-bottom: 9px;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .pilot-select__header {
    margin-bottom: 4px;
  }

  .pilot-option {
    min-width: 36px;
    flex-basis: 36px;
  }

  .mission-card {
    margin-bottom: 13px;
  }

  .mission-card > div {
    min-height: 40px;
    padding-top: 4px;
    padding-bottom: 4px;
  }

  .high-score {
    margin-top: 12px;
  }

  .result-message {
    margin-top: 6px;
    margin-bottom: 11px;
  }

  .result-score {
    min-height: 94px;
  }

  .result-stats {
    margin-top: 13px;
    margin-bottom: 8px;
  }

  .result-high-score {
    margin-bottom: 11px;
  }

  .text-button {
    margin-top: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
