@import url("./tokens.css");

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--st-grad-night);
  color: var(--st-white);
  font-family: var(--st-font-ui);
  letter-spacing: 0;
}

body {
  min-height: 100svh;
  min-height: 100dvh;
  overflow: hidden;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button,
input {
  min-width: 0;
}

button:focus-visible,
input:focus-visible,
.codex-row-button:focus-visible,
.star-node:focus-visible,
.btn-chapter-nav:focus-visible,
.char-tab:focus-visible {
  outline: 3px solid var(--st-gold-1);
  outline-offset: 3px;
  box-shadow: 0 0 0 5px var(--st-black-55), var(--st-glow-gold);
}

button:disabled {
  cursor: default;
  opacity: 0.62;
}

img {
  display: block;
  max-width: 100%;
}

picture {
  display: contents;
}

source {
  display: none;
}

.app-shell {
  min-height: 100svh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: stretch;
  background:
    radial-gradient(circle at 20% 14%, var(--st-glass), var(--st-transparent) 26%),
    radial-gradient(circle at 76% 72%, var(--st-panel-2), var(--st-transparent) 30%),
    var(--st-grad-night);
}

.phone {
  position: relative;
  width: min(100vw, 480px);
  height: 100svh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  background: var(--st-grad-night);
  box-shadow: 0 0 0 1px var(--st-line), 0 0 80px var(--st-black-70);
  scrollbar-width: none;
}

.phone::-webkit-scrollbar {
  display: none;
}

.phone[data-screen="play"] {
  overflow-y: hidden;
}

.screen {
  height: 100svh;
  height: 100dvh;
  min-height: 0;
  width: 100%;
  padding: calc(var(--st-safe-top) + 6px) 16px calc(var(--st-safe-bottom) + 10px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.screen > * {
  min-width: 0;
}

.screen.is-title {
  justify-content: flex-start;
}

.title-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.55;
  mix-blend-mode: screen;
  z-index: -2;
}

.screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--st-black-40), var(--st-veil) 56%, var(--st-bg-night-2));
  z-index: -1;
}

.topbar {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  gap: 8px;
  min-height: 48px;
}

.topbar > .ribbon {
  width: 100%;
  min-width: 0;
  white-space: normal;
  text-align: center;
  line-height: 1.15;
}

.stage-topbar {
  grid-template-columns: 48px minmax(0, 1fr) 86px;
}

.chapter-pager {
  display: grid;
  grid-template-columns: repeat(2, 40px);
  gap: 6px;
  justify-content: end;
}

.title-stack {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-top: clamp(142px, 20dvh, 180px);
  margin-bottom: 8px;
}

.logo-main {
  width: min(340px, 88vw);
  filter: drop-shadow(0 12px 20px var(--st-black-55));
}

.title-tools {
  position: absolute;
  top: calc(var(--st-safe-top) + 6px);
  right: 16px;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(2, 48px);
  gap: 8px;
}

.subtitle {
  font-family: var(--st-font-mono);
  font-size: 11px;
  font-weight: 800;
  color: var(--st-gold-1);
  text-shadow: 0 0 8px var(--st-black-70);
}

.actions {
  display: grid;
  gap: 9px;
  z-index: 1;
}

.screen.is-title .actions {
  margin-top: auto;
}

.actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.goldframe {
  position: relative;
  min-width: 0;
  border-radius: var(--st-r-panel);
  padding: 3px;
  background: var(--st-grad-gold);
  box-shadow: var(--st-shadow-frame);
  overflow: hidden;
}

.goldframe::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid var(--st-line);
  border-radius: calc(var(--st-r-panel) - 4px);
  pointer-events: none;
}

.goldframe-body {
  position: relative;
  min-width: 0;
  border-radius: calc(var(--st-r-panel) - 3px);
  background: var(--st-grad-panel);
  padding: 14px;
  min-height: 100%;
}

.goldframe p {
  margin: 0;
  color: var(--st-muted);
  font-size: 13px;
  line-height: 1.55;
}

.ribbon {
  max-width: 100%;
  min-height: 34px;
  padding: 7px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--st-r-pill);
  border: 2px solid var(--st-gold-2);
  color: var(--st-white);
  font-family: var(--st-font-deco);
  font-size: 15px;
  line-height: 1;
  text-shadow: 0 2px 0 var(--st-pink-4), 0 0 8px var(--st-glass);
  box-shadow: 0 4px 0 var(--st-gold-4);
}

.ribbon.pink {
  background: var(--st-grad-pink);
}

.ribbon.gold {
  background: var(--st-grad-gold);
  color: var(--st-ink);
  text-shadow: 0 1px 0 var(--st-luna-sub), 0 0 6px var(--st-gold-1);
}

.ribbon.purple {
  background: var(--st-grad-purple);
}

.ribbon.small {
  min-height: 28px;
  padding: 6px 14px;
  font-size: 12px;
}

.btn-gacha,
.btn-gacha-gold,
.btn-gacha-secondary,
.btn-gacha-icon {
  min-height: 48px;
  padding: 0 18px;
  border: 2px solid var(--st-gold-2);
  border-radius: var(--st-r-pill);
  color: var(--st-white);
  font-family: var(--st-font-deco);
  text-shadow: 0 2px 0 var(--st-pink-4);
  box-shadow: 0 5px 0 var(--st-gold-4), 0 14px 26px var(--st-black-40);
  transition: transform 180ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 180ms cubic-bezier(0.34, 1.56, 0.64, 1);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-chapter-nav {
  width: 40px;
  min-height: 36px;
  padding: 0;
  border: 1px solid var(--st-gold-2);
  border-radius: var(--st-r-sm);
  display: grid;
  place-items: center;
  color: var(--st-gold-1);
  background: var(--st-black-40);
  box-shadow: 0 3px 0 var(--st-gold-4), 0 10px 18px var(--st-black-40);
  transition: transform 180ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 180ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-chapter-nav .ui-icon {
  width: 20px;
  height: 20px;
}

.btn-gacha {
  background: var(--st-grad-pink);
}

.btn-gacha-gold {
  min-height: 64px;
  background: var(--st-grad-gold);
  color: var(--st-ink);
  text-shadow: 0 1px 0 var(--st-luna-sub);
  box-shadow: 0 5px 0 var(--st-gold-4), var(--st-glow-gold);
}

.btn-gacha-secondary {
  background: var(--st-grad-purple);
  font-family: var(--st-font-ui);
  font-weight: 900;
  font-size: 13px;
}

.btn-gacha-icon {
  width: 48px;
  min-height: 48px;
  padding: 0;
  flex: 0 0 48px;
  display: grid;
  place-items: center;
  background: var(--st-grad-purple);
  font-family: var(--st-font-mono);
  font-size: 19px;
}

.ui-icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.btn-gacha:active,
.btn-gacha-gold:active,
.btn-gacha-secondary:active,
.btn-gacha-icon:active,
.btn-chapter-nav:active {
  transform: translateY(2px);
  box-shadow: var(--st-shadow-press);
}

.kira {
  position: absolute;
  width: 18px;
  height: 18px;
  transform: rotate(45deg);
  background: var(--st-gold-2);
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  filter: drop-shadow(0 0 8px var(--st-gold-2));
  animation: kira-pulse 2.4s ease-in-out infinite;
}

.kira.pink {
  background: var(--st-pink-2);
  filter: drop-shadow(0 0 8px var(--st-pink-2));
}

.kira.purple {
  background: var(--st-shion-main);
  filter: drop-shadow(0 0 8px var(--st-shion-main));
}

.adslot {
  width: min(320px, 100%);
  height: 50px;
  margin: 0 auto;
  border: 0;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--st-transparent);
}

.adslot.slim {
  height: 50px;
}

.adslot iframe {
  width: 320px;
  max-width: 100%;
  height: 50px;
  border: 0;
  display: block;
}

.map-panel {
  min-height: 0;
  overflow: hidden;
}

.map-panel .goldframe-body {
  padding: 8px;
}

.star-map {
  position: relative;
  height: clamp(362px, calc(100dvh - var(--st-safe-top) - var(--st-safe-bottom) - 330px), 414px);
  min-height: 362px;
  background:
    radial-gradient(circle at 32% 18%, var(--st-gold-1), var(--st-transparent) 2%),
    radial-gradient(circle at 68% 42%, var(--st-pink-2), var(--st-transparent) 2%),
    linear-gradient(180deg, var(--st-bg-night-1), var(--st-bg-night-2));
  background-image:
    linear-gradient(180deg, var(--st-black-40), var(--st-transparent) 42%, var(--st-black-40)),
    var(--stage-map-bg, url("../assets/img/bg/bg_chapter01_map.jpg"));
  background-size: cover;
  background-position: center;
  border-radius: var(--st-r-panel);
  overflow: hidden;
}

.boss-warning-map {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: start center;
  padding-top: 16px;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 28%, var(--st-pink-2), var(--st-transparent) 30%),
    linear-gradient(180deg, var(--st-black-55), var(--st-transparent) 48%, var(--st-black-40));
}

.boss-warning-map::before,
.boss-warning-map::after {
  content: "";
  position: absolute;
  left: -18%;
  right: -18%;
  height: 2px;
  background: var(--st-grad-gold);
  box-shadow: var(--st-glow-gold);
  transform: rotate(-12deg);
  opacity: 0.78;
}

.boss-warning-map::before {
  top: 31%;
}

.boss-warning-map::after {
  top: 44%;
  transform: rotate(12deg);
}

.boss-warning-img {
  width: min(330px, 92%);
  filter: drop-shadow(0 10px 16px var(--st-black-70)) drop-shadow(0 0 18px var(--st-pink-2));
  animation: boss-warning-pulse 1.4s ease-in-out infinite;
}

.boss-warning-map span {
  position: absolute;
  width: 16px;
  height: 16px;
  background: var(--st-gold-2);
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  filter: drop-shadow(0 0 8px var(--st-gold-2));
  animation: boss-warning-spark 1.1s ease-in-out infinite;
}

.boss-warning-map span:nth-of-type(1) {
  left: 14%;
  top: 22%;
}

.boss-warning-map span:nth-of-type(2) {
  right: 14%;
  top: 32%;
  background: var(--st-pink-2);
  filter: drop-shadow(0 0 8px var(--st-pink-2));
  animation-delay: 180ms;
}

.boss-warning-map span:nth-of-type(3) {
  left: 44%;
  top: 52%;
  background: var(--st-shion-main);
  filter: drop-shadow(0 0 8px var(--st-shion-main));
  animation-delay: 320ms;
}

.star-map-inner {
  position: absolute;
  left: 50%;
  top: 6px;
  width: 282px;
  height: 414px;
  transform: translateX(-50%);
}

.star-line {
  position: absolute;
  height: 2px;
  background: var(--st-line);
  transform-origin: left center;
  pointer-events: none;
}

.star-node {
  position: absolute;
  width: 42px;
  height: 42px;
  border: 2px solid var(--st-gold-2);
  border-radius: 50%;
  background: var(--st-grad-purple);
  color: var(--st-white);
  display: grid;
  grid-template-rows: 13px 1fr;
  place-items: center;
  gap: 0;
  font-family: var(--st-font-mono);
  font-weight: 900;
  box-shadow: 0 0 16px var(--st-pink-2);
  z-index: 1;
}

.star-node.current {
  width: 52px;
  height: 52px;
  grid-template-rows: 15px 1fr;
  background: var(--st-grad-gold);
  color: var(--st-ink);
}

.star-node.boss {
  background: var(--st-grad-pink);
  box-shadow: var(--st-glow-pink);
}

.star-node.boss.current {
  background: var(--st-grad-gold);
  box-shadow: var(--st-glow-gold);
}

.star-node.locked {
  filter: grayscale(1);
  opacity: 0.55;
  border-style: dashed;
  border-radius: var(--st-r-sm);
}

.node-mark {
  align-self: end;
  font-size: 7px;
  line-height: 1;
}

.star-node > span:last-child {
  align-self: start;
  font-size: 15px;
  line-height: 1.1;
}

.stage-summary {
  min-height: 42px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 6px 10px;
  border: 2px solid var(--st-gold-2);
  border-radius: var(--st-r-panel);
  background: var(--st-grad-panel);
  box-shadow: 0 5px 0 var(--st-gold-4), 0 10px 22px var(--st-black-40);
}

.stage-summary > .ribbon {
  width: 100%;
}

.stage-summary span {
  color: var(--st-gold-1);
  font-family: var(--st-font-mono);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.boss-warning-strip {
  height: 46px;
  display: grid;
  place-items: center;
  margin: -2px 0;
  pointer-events: none;
}

.boss-warning-strip.story {
  height: 54px;
}

.boss-warning-strip-img {
  width: min(300px, 92%);
  max-height: 58px;
  object-fit: contain;
  filter: drop-shadow(0 8px 14px var(--st-black-70)) drop-shadow(0 0 14px var(--st-pink-2));
  animation: boss-warning-pulse 1.4s ease-in-out infinite;
}

.char-card {
  display: grid;
  grid-template-columns: minmax(142px, 46%) minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  min-height: 292px;
  overflow: hidden;
}

.char-picker {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
}

.char-tab {
  position: relative;
  height: clamp(56px, 8dvh, 66px);
  border: 2px solid var(--st-line);
  border-radius: var(--st-r-sm);
  background: var(--st-grad-panel);
  overflow: hidden;
  padding: 0;
  box-shadow: 0 4px 0 var(--st-black-40);
}

.char-tab img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  opacity: 0.86;
}

.char-tab.active {
  border-color: var(--st-gold-2);
  box-shadow: var(--st-glow-gold);
}

.char-tab.locked {
  filter: grayscale(1);
  opacity: 0.58;
}

.char-portrait {
  align-self: end;
  object-fit: contain;
  filter: drop-shadow(0 14px 18px var(--st-black-55));
  max-height: clamp(300px, 43dvh, 390px);
}

.char-portrait-stage {
  position: relative;
  min-height: 292px;
  overflow: hidden;
  border-radius: var(--st-r-sm);
  background:
    radial-gradient(circle at 52% 28%, var(--st-glass), var(--st-transparent) 38%),
    var(--st-black-40);
}

.char-portrait-stage .char-portrait {
  position: absolute;
  left: 50%;
  bottom: -4px;
  width: auto;
  height: calc(100% + 8px);
  max-width: none;
  max-height: none;
  transform: translateX(-50%);
}

.char-info {
  display: grid;
  align-content: center;
  gap: 7px;
  min-width: 0;
}

.phone[data-screen="char"] .char-card {
  min-height: clamp(260px, 35dvh, 300px);
}

.phone[data-screen="char"] .char-card h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1.1;
}

.phone[data-screen="char"] .char-card .subtitle {
  margin: 0;
}

.phone[data-screen="char"] .stat-list {
  gap: 7px;
}

.phone[data-screen="char"] .goldframe-body {
  padding: 12px;
}

.stat-list,
.skill-list,
.settings-list,
.stats-table {
  display: grid;
  gap: 9px;
}

.stat-line,
.skill-line,
.setting-line,
.stats-row {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  font-size: 12px;
  font-weight: 800;
}

.skill-line-detail {
  grid-template-columns: 64px minmax(0, 1fr);
}

.skill-line-detail em {
  display: block;
  margin: 2px 0 0;
  color: var(--st-muted);
  font-size: 11px;
  line-height: 1.35;
  font-style: normal;
  font-weight: 800;
}

.stat-line span,
.skill-line span,
.setting-line span,
.stats-row span,
.skill-line strong,
.stats-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.bars {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
}

.bar {
  height: 8px;
  border-radius: var(--st-r-pill);
  border: 1px solid var(--st-line);
  background: var(--st-black-40);
}

.bar.on {
  background: var(--st-grad-gold);
}

.story-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: 2px -16px -8px;
  overflow: hidden;
}

.story-stage::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 45%;
  background: linear-gradient(180deg, var(--st-transparent), var(--st-bg-night-2));
  pointer-events: none;
}

.story-char {
  position: absolute;
  bottom: -32px;
  max-height: 104%;
  object-fit: contain;
  filter: drop-shadow(0 16px 20px var(--st-black-70));
}

.story-char.focus {
  left: 8%;
  width: 58%;
  z-index: 1;
}

.story-char.dim {
  right: -2%;
  width: 48%;
  opacity: 0.58;
  filter: grayscale(0.2) drop-shadow(0 14px 18px var(--st-black-70));
}

.play-screen {
  gap: 6px;
}

.hud-grid {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 68px;
  gap: 8px;
  align-items: center;
}

.score-plate {
  padding: 7px 9px;
  border: 2px solid var(--st-gold-2);
  border-radius: var(--st-r-pill);
  background: var(--st-grad-panel);
  box-shadow: var(--st-glow-gold);
  text-align: center;
  min-width: 0;
}

.score-plate span {
  display: block;
  color: var(--st-muted);
  font-size: 9px;
  font-family: var(--st-font-mono);
}

.score-plate strong,
.timer,
.combo {
  font-family: var(--st-font-mono);
  font-weight: 900;
  font-size: 13px;
  line-height: 1.15;
}

.timer {
  color: var(--st-gold-1);
  text-align: right;
}

.hud-row {
  display: grid;
  grid-template-columns: auto minmax(70px, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.hearts {
  display: flex;
  gap: 4px;
  min-width: max-content;
}

.life-heart {
  width: 18px;
  height: 16px;
  background: var(--st-grad-pink);
  clip-path: polygon(50% 92%, 10% 48%, 10% 20%, 30% 8%, 50% 24%, 70% 8%, 90% 20%, 90% 48%);
  box-shadow: var(--st-glow-pink);
}

.life-heart.empty {
  background: var(--st-black-55);
  border: 1px solid var(--st-line);
}

.gauge {
  height: 12px;
  border-radius: var(--st-r-pill);
  border: 1px solid var(--st-line);
  background: var(--st-black-40);
  overflow: hidden;
}

.gauge-fill {
  height: 100%;
  width: 0%;
  background: var(--st-grad-pink);
}

.combo {
  min-width: 70px;
  text-align: right;
  white-space: nowrap;
}

.game-board {
  position: relative;
  width: min(100%, 350px, calc((100dvh - var(--st-safe-top) - var(--st-safe-bottom) - 276px) * 0.6667));
  min-width: min(100%, 288px);
  margin: 0 auto;
  aspect-ratio: 320 / 480;
  padding: 3px;
  border: 2px solid var(--st-gold-2);
  border-radius: var(--st-r-panel);
  background: var(--st-grad-gold);
  box-shadow: var(--st-shadow-frame);
  overflow: hidden;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: calc(var(--st-r-panel) - 4px);
  background: var(--st-bg-night-2);
  touch-action: none;
}

.play-status-strip {
  min-height: 54px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) minmax(86px, auto);
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid var(--st-line);
  border-radius: var(--st-r-sm);
  background: var(--st-grad-panel);
}

.play-status-strip img {
  width: 42px;
  height: 42px;
  border-radius: var(--st-r-sm);
  object-fit: cover;
  object-position: top center;
  border: 1px solid var(--st-gold-2);
}

.play-status-strip strong {
  display: block;
  color: var(--st-gold-1);
  font-size: 11px;
}

.play-status-strip p {
  margin: 2px 0 0;
  color: var(--st-white);
  font-size: 10px;
  line-height: 1.35;
}

.play-effect-note {
  min-width: 0;
  color: var(--st-muted);
  font-size: 10px;
  line-height: 1.25;
  font-weight: 800;
  text-align: right;
  overflow-wrap: anywhere;
}

.play-effect-note span {
  display: block;
  color: var(--st-gold-1);
  font-family: var(--st-font-mono);
  font-size: 9px;
}

.play-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.burst-layer {
  position: absolute;
  inset: 0;
  z-index: 12;
  overflow: hidden;
  background: var(--st-black-70);
}

.burst-layer.active {
  animation: burst-flash 800ms ease both;
}

.burst-layer.active.skill {
  animation-duration: 720ms;
}

.burst-layer.active.ult {
  animation-duration: 950ms;
}

.burst-rays {
  position: absolute;
  inset: -20%;
  background:
    repeating-conic-gradient(from 0deg, var(--st-glass) 0deg 5deg, var(--st-transparent) 5deg 13deg),
    radial-gradient(circle at 50% 50%, var(--st-pink-2), var(--st-transparent) 42%);
  opacity: 0.75;
  animation: spin 4s linear infinite;
}

.burst-cutin {
  position: absolute;
  left: -48px;
  bottom: -70px;
  width: min(68%, 320px);
  max-height: 82%;
  object-fit: contain;
  transform: rotate(-4deg) translateX(-30px);
  filter: drop-shadow(0 18px 18px var(--st-black-70));
}

.burst-layer.active .burst-cutin {
  animation: cutin-in 800ms cubic-bezier(0.2, 0.9, 0.24, 1) both;
}

.burst-logo-stack {
  position: absolute;
  right: 8px;
  top: calc(var(--st-safe-top) + 20px);
  width: min(62%, 280px);
  display: grid;
  gap: 6px;
  justify-items: end;
}

.burst-kind {
  display: inline-grid;
  place-items: center;
  min-height: 42px;
  padding: 7px 18px;
  border: 2px solid var(--st-gold-2);
  border-radius: var(--st-r-pill);
  background: var(--st-grad-gold);
  color: var(--st-ink);
  font-family: var(--st-font-deco);
  font-size: 22px;
  line-height: 1;
  text-shadow: 0 1px 0 var(--st-luna-sub);
  box-shadow: var(--st-glow-gold);
}

.burst-skill-name {
  max-width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--st-line);
  border-radius: var(--st-r-sm);
  background: var(--st-veil);
  color: var(--st-white);
  font-family: var(--st-font-deco);
  font-size: 18px;
  line-height: 1.2;
  text-align: right;
  text-shadow: 0 2px 0 var(--st-pink-4);
  box-shadow: 0 8px 18px var(--st-black-55);
}

.burst-layer.skill .burst-rays {
  background:
    repeating-conic-gradient(from 10deg, var(--st-glass) 0deg 7deg, var(--st-transparent) 7deg 18deg),
    radial-gradient(circle at 52% 48%, var(--st-gold-2), var(--st-transparent) 40%);
}

.burst-layer.ult .burst-kind {
  background: var(--st-grad-pink);
  color: var(--st-white);
  text-shadow: 0 2px 0 var(--st-pink-4);
}

.burst-label-img {
  width: 68%;
  filter: drop-shadow(0 8px 12px var(--st-black-70));
}

.burst-title-img {
  width: 100%;
  filter: drop-shadow(0 10px 16px var(--st-black-70));
}

.meteor {
  position: absolute;
  width: 84px;
  height: 4px;
  border-radius: var(--st-r-pill);
  background: var(--st-grad-gold);
  box-shadow: var(--st-glow-gold);
  transform: rotate(-28deg);
}

.meteor::before {
  content: "";
  position: absolute;
  right: -6px;
  top: -7px;
  width: 18px;
  height: 18px;
  background: var(--st-pink-2);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}

.burst-layer.active .meteor {
  animation: meteor-fall 720ms ease-in both;
}

.m1 {
  left: 70%;
  top: 34%;
}

.m2 {
  left: 58%;
  top: 50%;
  animation-delay: 80ms;
}

.m3 {
  left: 76%;
  top: 64%;
  animation-delay: 140ms;
}

.m4 {
  left: 46%;
  top: 24%;
  animation-delay: 200ms;
}

.m5 {
  left: 84%;
  top: 18%;
  animation-delay: 260ms;
}

.result-logo {
  width: min(286px, 82vw);
  margin: 0 auto;
  filter: drop-shadow(0 10px 16px var(--st-black-55));
}

.rank-medal-img {
  width: 86px;
  margin: 0;
  aspect-ratio: 1;
  object-fit: contain;
  filter: drop-shadow(0 0 16px var(--st-gold-2)) drop-shadow(0 12px 16px var(--st-black-55));
}

.result-summary {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.result-message {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.result-message p {
  margin: 8px 0 0;
  color: var(--st-muted);
  font-size: 13px;
  line-height: 1.6;
}

.result-char {
  width: 72px;
  height: 92px;
  object-fit: contain;
  filter: drop-shadow(0 10px 14px var(--st-black-55));
}

.phone[data-screen="result"] .screen,
.phone[data-screen="over"] .screen {
  gap: 8px;
}

.phone[data-screen="result"] .goldframe-body,
.phone[data-screen="over"] .goldframe-body {
  padding: 10px;
}

.phone[data-screen="result"] .stats-table,
.phone[data-screen="over"] .stats-table {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.phone[data-screen="result"] .stats-row,
.phone[data-screen="over"] .stats-row {
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px;
}

.result-char.muted {
  filter: grayscale(0.28) saturate(0.72) drop-shadow(0 10px 14px var(--st-black-55));
  opacity: 0.82;
}

.reward-panel,
.item-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.reward-panel img,
.item-row img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 10px 16px var(--st-black-55));
}

.reward-panel strong,
.item-row strong {
  display: block;
  margin-top: 6px;
  font-family: var(--st-font-deco);
  color: var(--st-gold-1);
  text-shadow: 0 2px 0 var(--st-pink-4);
}

.reward-panel p,
.item-row p {
  margin: 4px 0 0;
  color: var(--st-muted);
  font-size: 12px;
  line-height: 1.55;
}

.item-row span {
  display: block;
  margin-top: 2px;
  color: var(--st-muted);
  font-family: var(--st-font-mono);
  font-size: 10px;
}

.info-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.info-row {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  font-size: 12px;
  font-weight: 900;
}

.info-row span {
  color: var(--st-gold-1);
  font-family: var(--st-font-mono);
}

.info-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.codex-row-button {
  width: 100%;
  min-height: 66px;
  border: 2px solid var(--st-line);
  border-radius: var(--st-r-sm);
  color: var(--st-white);
  background: var(--st-grad-panel);
  text-align: left;
  padding: 5px 8px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  box-shadow: 0 4px 0 var(--st-black-40);
}

.codex-row-button strong,
.locked-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.codex-row-button:disabled {
  cursor: default;
}

.codex-row-button.locked {
  filter: grayscale(1);
  opacity: 0.58;
}

.thumb {
  width: 54px;
  height: 54px;
  border-radius: var(--st-r-sm);
  object-fit: cover;
  object-position: center;
  background: var(--st-grad-panel);
  border: 1px solid var(--st-line);
}

.locked-thumb {
  filter: grayscale(1);
  opacity: 0.58;
}

.locked-text {
  color: var(--st-muted);
  font-family: var(--st-font-mono);
  font-size: 10px;
}

.codex-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.codex-detail-screen {
  gap: 8px;
}

.codex-hero-frame .goldframe-body {
  padding: 0;
  height: calc(100dvh - var(--st-safe-top) - var(--st-safe-bottom) - 76px);
  min-height: 0;
  overflow: hidden;
}

.codex-hero {
  position: relative;
  height: 100%;
  background:
    radial-gradient(circle at 50% 24%, var(--st-glass), var(--st-transparent) 36%),
    var(--st-grad-panel);
  overflow: hidden;
}

.codex-full {
  position: absolute;
  left: 50%;
  bottom: -58px;
  width: min(78%, 300px);
  max-height: none;
  object-fit: contain;
  transform: translateX(-50%);
  filter: drop-shadow(0 16px 20px var(--st-black-70));
}

.codex-overlay {
  position: absolute;
  inset: 10px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
  pointer-events: none;
}

.codex-nameplate,
.codex-stat-overlay,
.codex-skill-overlay {
  min-width: 0;
  border: 1px solid var(--st-line);
  border-radius: var(--st-r-sm);
  background: var(--st-veil);
  box-shadow: 0 8px 18px var(--st-black-55);
}

.codex-nameplate {
  justify-self: start;
  max-width: min(260px, 76%);
  padding: 8px;
}

.codex-nameplate strong,
.codex-nameplate span {
  display: block;
}

.codex-nameplate strong {
  margin-top: 5px;
  font-family: var(--st-font-deco);
  font-size: 22px;
  line-height: 1.05;
}

.codex-nameplate span {
  min-width: 0;
  font-family: var(--st-font-mono);
  font-size: 10px;
  color: var(--st-gold-1);
  text-shadow: 0 2px 0 var(--st-black-70);
}

.codex-stat-overlay {
  align-self: center;
  justify-self: end;
  width: min(150px, 44%);
  padding: 8px;
  display: grid;
  gap: 6px;
}

.codex-skill-overlay {
  padding: 8px;
  display: grid;
  gap: 6px;
}

.codex-skill-overlay .skill-line-detail {
  grid-template-columns: 58px minmax(0, 1fr);
  font-size: 11px;
}

.profile-frame .goldframe-body {
  display: grid;
  gap: 9px;
}

.profile-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.profile-head strong,
.profile-head span {
  display: block;
}

.profile-head strong {
  font-size: 15px;
  overflow-wrap: anywhere;
}

.profile-head span {
  font-family: var(--st-font-mono);
  color: var(--st-muted);
  font-size: 10px;
}

.profile-frame p {
  margin: 0;
  color: var(--st-muted);
  font-size: 12px;
  line-height: 1.65;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.profile-stat {
  display: grid;
  gap: 4px;
  font-size: 12px;
  font-weight: 900;
}

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

.segmented button {
  border: 1px solid var(--st-line);
  border-radius: var(--st-r-pill);
  min-height: 34px;
  background: var(--st-black-40);
  color: var(--st-white);
  font-weight: 900;
}

.segmented button.active {
  background: var(--st-grad-gold);
  color: var(--st-ink);
}

.range {
  width: 100%;
  accent-color: var(--st-gold-2);
}

.settings-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 12px;
  margin-top: 12px;
  font-size: 11px;
  font-weight: 900;
}

.settings-links a {
  color: var(--st-muted);
  text-decoration: none;
}

.settings-links a:focus-visible {
  outline: 2px solid var(--st-gold-1);
  outline-offset: 3px;
  border-radius: var(--st-r-sm);
}

.orientation-lock {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  background: var(--st-grad-night);
  padding: calc(var(--st-safe-top) + 24px) 28px calc(var(--st-safe-bottom) + 24px);
  text-align: center;
}

.orientation-lock img {
  width: min(260px, 72vw);
  margin: 0 auto 18px;
}

.orientation-lock p {
  margin: 0;
  font-family: var(--st-font-deco);
  color: var(--st-gold-1);
  text-shadow: 0 2px 0 var(--st-pink-4);
}

@keyframes kira-pulse {
  0%,
  100% {
    opacity: 0.58;
    transform: rotate(45deg) scale(0.82);
  }
  50% {
    opacity: 1;
    transform: rotate(82deg) scale(1.18);
  }
}

@keyframes burst-flash {
  0% {
    opacity: 0;
  }
  8%,
  88% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes cutin-in {
  0% {
    transform: rotate(-8deg) translateX(-90px) scale(0.94);
  }
  20%,
  82% {
    transform: rotate(-4deg) translateX(0) scale(1);
  }
  100% {
    transform: rotate(-4deg) translateX(-12px) scale(1.02);
  }
}

@keyframes meteor-fall {
  0% {
    opacity: 0;
    transform: translate(120px, -80px) rotate(-28deg);
  }
  22%,
  86% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-220px, 120px) rotate(-28deg);
  }
}

@keyframes boss-warning-pulse {
  0%,
  100% {
    transform: scale(0.98);
    opacity: 0.88;
  }
  50% {
    transform: scale(1.02);
    opacity: 1;
  }
}

@keyframes boss-warning-spark {
  0%,
  100% {
    opacity: 0.35;
    transform: rotate(45deg) scale(0.72);
  }
  50% {
    opacity: 1;
    transform: rotate(92deg) scale(1.18);
  }
}

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

@media (orientation: landscape) and (max-height: 520px) {
  .orientation-lock {
    display: grid;
  }
}

@media (max-width: 400px) {
  .screen {
    padding-right: 14px;
    padding-left: 14px;
    gap: 10px;
  }

  .topbar {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    gap: 7px;
    min-height: 44px;
  }

  .btn-gacha,
  .btn-gacha-secondary {
    min-height: 46px;
    padding-right: 14px;
    padding-left: 14px;
  }

  .btn-gacha-gold {
    min-height: 58px;
  }

  .btn-gacha-icon {
    width: 44px;
    min-height: 44px;
    font-size: 17px;
  }

  .actions-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 7px;
  }

  .goldframe-body {
    padding: 12px;
  }

  .map-panel .goldframe-body {
    padding: 7px;
  }

  .char-picker {
    gap: 6px;
  }

  .story-stage {
    margin-right: -14px;
    margin-left: -14px;
  }
}

@media (max-height: 700px) {
  .screen {
    padding-top: calc(var(--st-safe-top) + 4px);
    padding-bottom: calc(var(--st-safe-bottom) + 6px);
    gap: 6px;
  }

  .topbar {
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    min-height: 40px;
    gap: 6px;
  }

  .btn-gacha,
  .btn-gacha-secondary {
    min-height: 42px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .btn-gacha-gold {
    min-height: 50px;
  }

  .btn-gacha-icon {
    width: 40px;
    min-height: 40px;
    flex-basis: 40px;
  }

  .stage-topbar {
    grid-template-columns: 40px minmax(0, 1fr) 74px;
  }

  .chapter-pager {
    grid-template-columns: repeat(2, 34px);
    gap: 5px;
  }

  .btn-chapter-nav {
    width: 34px;
    min-height: 32px;
  }

  .btn-chapter-nav .ui-icon {
    width: 18px;
    height: 18px;
  }

  .ribbon {
    min-height: 30px;
    padding: 6px 14px;
    font-size: 13px;
  }

  .ribbon.small {
    min-height: 24px;
    padding: 5px 10px;
    font-size: 10px;
  }

  .goldframe-body {
    padding: 9px;
  }

  .title-tools {
    grid-template-columns: repeat(2, 40px);
    gap: 7px;
  }

  .title-stack {
    margin-top: clamp(104px, 18dvh, 126px);
    gap: 6px;
  }

  .logo-main {
    width: min(318px, 88vw);
  }

  .star-map {
    height: clamp(246px, calc(100dvh - var(--st-safe-top) - var(--st-safe-bottom) - 310px), 278px);
    min-height: 246px;
  }

  .star-map-inner {
    top: 4px;
    transform: translateX(-50%) scale(0.72);
    transform-origin: top center;
  }

  .star-node {
    width: 40px;
    height: 40px;
  }

  .star-node.current {
    width: 48px;
    height: 48px;
  }

  .stage-summary {
    min-height: 36px;
    padding: 4px 8px;
  }

  .boss-warning-map {
    padding-top: 8px;
  }

  .boss-warning-img {
    width: min(286px, 92%);
  }

  .boss-warning-strip {
    height: 34px;
  }

  .boss-warning-strip-img {
    max-height: 44px;
    width: min(260px, 90%);
  }

  .goldframe p {
    font-size: 11px;
    line-height: 1.35;
  }

  .skill-list,
  .stat-list,
  .settings-list,
  .stats-table {
    gap: 5px;
  }

  .skill-line,
  .stat-line,
  .stats-row {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 6px;
    font-size: 11px;
  }

  .char-picker {
    gap: 5px;
  }

  .char-tab {
    height: 46px;
  }

  .char-card,
  .phone[data-screen="char"] .char-card {
    min-height: 214px;
    grid-template-columns: minmax(132px, 44%) minmax(0, 1fr);
    gap: 9px;
  }

  .char-portrait-stage {
    min-height: 214px;
  }

  .char-portrait-stage .char-portrait {
    bottom: -4px;
    width: auto;
    height: calc(100% + 8px);
  }

  .char-info {
    gap: 5px;
  }

  .phone[data-screen="char"] .char-card h1 {
    font-size: 22px;
  }

  .phone[data-screen="char"] .stat-list {
    gap: 5px;
  }

  .skill-line-detail {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .skill-line-detail em {
    margin-top: 1px;
    font-size: 10px;
    line-height: 1.2;
  }

  .story-char.focus {
    left: 4%;
    width: 54%;
  }

  .story-char.dim {
    width: 44%;
  }

  .play-screen {
    gap: 5px;
  }

  .hud-grid {
    grid-template-columns: 40px minmax(0, 1fr) 56px;
    gap: 6px;
  }

  .score-plate {
    padding: 5px 8px;
  }

  .hud-row {
    gap: 6px;
  }

  .life-heart {
    width: 15px;
    height: 14px;
  }

  .game-board {
    width: min(100%, 330px, calc((100dvh - var(--st-safe-top) - var(--st-safe-bottom) - 176px) * 0.6667));
    min-width: 0;
  }

  .play-status-strip {
    min-height: 30px;
    grid-template-columns: 30px minmax(0, 1fr) 44px;
    padding: 3px 6px;
  }

  .play-status-strip img {
    width: 28px;
    height: 28px;
  }

  .play-status-strip p {
    display: none;
  }

  .play-effect-note {
    font-size: 9px;
  }

  .phone[data-screen="play"] .adslot {
    display: none;
  }

  .result-logo {
    width: min(236px, 72vw);
  }

  .rank-medal-img {
    width: 68px;
  }

  .result-summary {
    grid-template-columns: 68px minmax(0, 1fr);
  }

  .result-message {
    grid-template-columns: 60px minmax(0, 1fr);
  }

  .result-message p {
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.35;
  }

  .result-char {
    width: 56px;
    height: 72px;
  }

  .reward-panel,
  .item-row {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 8px;
  }

  .reward-panel img,
  .item-row img {
    width: 52px;
    height: 52px;
  }

  .reward-panel p,
  .item-row p {
    font-size: 10px;
    line-height: 1.3;
  }

  .codex-row-button {
    min-height: 56px;
    grid-template-columns: 46px minmax(0, 1fr);
    padding: 4px 7px;
  }

  .thumb {
    width: 46px;
    height: 46px;
  }

  .codex-list {
    gap: 6px;
  }

  .codex-hero-frame .goldframe-body {
    height: calc(100dvh - var(--st-safe-top) - var(--st-safe-bottom) - 58px);
  }

  .codex-full {
    bottom: -44px;
    width: min(72%, 250px);
  }

  .codex-overlay {
    inset: 8px;
    gap: 6px;
  }

  .codex-nameplate {
    padding: 6px;
  }

  .codex-nameplate strong {
    font-size: 19px;
  }

  .codex-stat-overlay {
    width: min(136px, 42%);
    padding: 6px;
    gap: 4px;
  }

  .codex-skill-overlay {
    padding: 6px;
    gap: 4px;
  }
}

@media (min-width: 430px) {
  .screen {
    padding-right: 18px;
    padding-left: 18px;
  }

  .logo-main {
    width: min(380px, 86vw);
  }
}

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

  .kira,
  .burst-rays,
  .burst-layer.active,
  .burst-layer.active .burst-cutin,
  .burst-layer.active .meteor,
  .boss-warning-img,
  .boss-warning-strip-img,
  .boss-warning-map span {
    animation: none !important;
  }

  .meteor {
    opacity: 0;
  }
}

:root[data-motion="reduce"] *,
:root[data-motion="reduce"] *::before,
:root[data-motion="reduce"] *::after,
:root[data-motion="off"] *,
:root[data-motion="off"] *::before,
:root[data-motion="off"] *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  scroll-behavior: auto !important;
  transition-duration: 0.01ms !important;
}

:root[data-motion="reduce"] .kira,
:root[data-motion="reduce"] .burst-rays,
:root[data-motion="reduce"] .burst-layer.active,
:root[data-motion="reduce"] .burst-layer.active .burst-cutin,
:root[data-motion="reduce"] .burst-layer.active .meteor,
:root[data-motion="reduce"] .boss-warning-img,
:root[data-motion="reduce"] .boss-warning-strip-img,
:root[data-motion="reduce"] .boss-warning-map span,
:root[data-motion="off"] .kira,
:root[data-motion="off"] .burst-rays,
:root[data-motion="off"] .burst-layer.active,
:root[data-motion="off"] .burst-layer.active .burst-cutin,
:root[data-motion="off"] .burst-layer.active .meteor,
:root[data-motion="off"] .boss-warning-img,
:root[data-motion="off"] .boss-warning-strip-img,
:root[data-motion="off"] .boss-warning-map span {
  animation: none !important;
}

:root[data-motion="off"] .meteor {
  opacity: 0;
}
