:root {
  --night: #060811;
  --ink: #0a0f20;
  --ink-soft: #111a34;
  --moon: #fff5dd;
  --gold: #ffd28a;
  --amber: #ffb35c;
  --mint: #91f0da;
  --cyan: #76d9ff;
  --lilac: #b8a8ff;
  --rose: #ff7595;
  --text: #eef2ff;
  --muted: #919bc2;
  --dim: #646d97;
  --hair: rgba(180, 196, 255, 0.16);
  --hair-strong: rgba(196, 210, 255, 0.28);
  --panel: rgba(10, 15, 32, 0.72);
  --serif: "STKaiti", "KaiTi", "Kaiti SC", "Songti SC", "SimSun", "Noto Serif CJK SC", Georgia, serif;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --latin: Georgia, "Times New Roman", serif;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--night);
  color: var(--text);
  font-family: var(--sans);
  overflow: hidden;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible {
  outline: 1px solid var(--gold);
  outline-offset: 5px;
}

#app {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(ellipse 80% 65% at 50% 46%, rgba(34, 48, 92, 0.48) 0%, transparent 67%),
    var(--night);
}

#stage {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
  z-index: 1;
}

body.is-playing #stage {
  cursor: none;
}

.grain {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0.055;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.75'/%3E%3C/svg%3E");
}

.is-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.micro-label {
  display: inline-block;
  font-family: var(--latin);
  font-size: 9px;
  letter-spacing: 0.32em;
  color: var(--dim);
  text-transform: uppercase;
}

/* ---------- HUD ---------- */

.hud {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  padding: max(18px, env(safe-area-inset-top)) clamp(16px, 3vw, 42px)
    max(18px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: opacity 0.45s var(--ease-soft);
}

.hud-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 20px;
}

.act-block {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  gap: 2px 10px;
  align-items: center;
  width: fit-content;
}

.act-roman {
  grid-row: 1 / 3;
  font-family: var(--latin);
  font-size: clamp(28px, 3.2vw, 42px);
  line-height: 0.9;
  font-style: italic;
  color: var(--gold);
  opacity: 0.95;
  padding-right: 12px;
  border-right: 1px solid var(--hair);
  text-shadow: 0 0 18px rgba(255, 210, 138, 0.25);
}

.act-copy {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.act-copy b {
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: 0.18em;
  font-weight: 400;
  color: #fff8e8;
  text-shadow: 0 0 18px rgba(255, 240, 210, 0.18);
}

.act-copy span {
  font-family: var(--latin);
  font-size: 8.5px;
  letter-spacing: 0.24em;
  color: #aab5d8;
}

.act-track {
  width: min(180px, 17vw);
  height: 1px;
  background: rgba(180, 196, 255, 0.14);
  overflow: hidden;
}

.act-track i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(255, 210, 138, 0.2), var(--gold));
  box-shadow: 0 0 8px rgba(255, 210, 138, 0.55);
  transition: width 0.15s linear;
}

.score-block {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 130px;
  padding-top: 1px;
}

.score-block #score {
  font-family: var(--latin);
  font-size: clamp(24px, 2.6vw, 36px);
  line-height: 1.05;
  letter-spacing: 0.08em;
  color: var(--moon);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 24px rgba(255, 229, 178, 0.25);
}

.combo-chip {
  margin-top: 4px;
  font-family: var(--latin);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--gold);
  opacity: 0.72;
  transition: color 0.2s var(--ease-soft), transform 0.2s var(--ease-soft), opacity 0.2s;
}

.combo-chip.is-hot {
  color: var(--mint);
  opacity: 1;
  transform: scale(1.06);
}

.state-block {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}

.health-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  margin-right: 2px;
}

.petals {
  display: flex;
  gap: 6px;
}

.petal {
  position: relative;
  width: 11px;
  height: 16px;
  border-radius: 80% 0 80% 0;
  transform: rotate(-45deg);
  background: linear-gradient(160deg, #fff7e3, var(--gold));
  box-shadow: 0 0 10px rgba(255, 210, 138, 0.65);
  transition: opacity 0.3s, transform 0.3s, box-shadow 0.3s;
}

.petal:nth-child(2n) {
  transform: rotate(-38deg) scale(0.92);
}

.petal.is-empty {
  background: transparent;
  border: 1px solid rgba(184, 168, 255, 0.26);
  box-shadow: none;
  opacity: 0.6;
}

.petal.is-empty::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: inherit;
  background: rgba(184, 168, 255, 0.09);
}

.icon-btn {
  pointer-events: auto;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--hair);
  border-radius: 50%;
  background: rgba(10, 15, 32, 0.32);
  color: var(--muted);
  backdrop-filter: blur(8px);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.icon-btn:hover {
  color: var(--moon);
  border-color: var(--hair-strong);
  background: rgba(25, 36, 70, 0.64);
}

.icon-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn.is-muted .sound-wave {
  opacity: 0.18;
}

.icon-btn svg path {
  stroke: currentColor;
  fill: none;
}

.icon-btn svg .sound-body {
  fill: currentColor;
  stroke: none;
}

.hud-floor {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.bloom-meter {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
  padding: 6px 12px;
  border: 1px solid rgba(180, 196, 255, 0.1);
  border-radius: 999px;
  background: rgba(8, 12, 26, 0.38);
  backdrop-filter: blur(8px);
}

.bloom-dots {
  display: flex;
  gap: 6px;
}

.bloom-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1px solid rgba(184, 168, 255, 0.34);
  background: transparent;
  transition: background 0.35s, box-shadow 0.35s, transform 0.35s;
}

.bloom-dot.is-lit {
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 9px rgba(255, 210, 138, 0.9);
  transform: scale(1.2);
}

.bloom-meter b {
  font-family: var(--latin);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.14em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.announce {
  align-self: center;
  margin-bottom: 2px;
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.34em;
  color: var(--moon);
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 0.35s, transform 0.35s;
  text-shadow: 0 0 20px rgba(255, 210, 138, 0.42);
  white-space: nowrap;
}

.announce.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.moonwave-btn {
  pointer-events: auto;
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 114px;
  height: 46px;
  padding: 0 15px;
  border: 1px solid rgba(145, 240, 218, 0.34);
  border-radius: 999px;
  background: rgba(9, 17, 34, 0.68);
  overflow: hidden;
  color: var(--mint);
  backdrop-filter: blur(10px);
  transition: border-color 0.2s, color 0.2s, transform 0.2s, opacity 0.2s;
}

.moonwave-btn:hover {
  border-color: rgba(145, 240, 218, 0.8);
  transform: translateY(-1px);
}

.moonwave-btn:active {
  transform: translateY(0) scale(0.98);
}

.moonwave-btn.is-cooling {
  color: var(--dim);
  border-color: var(--hair);
}

.moonwave-btn.is-ready::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  border: 1px solid rgba(145, 240, 218, 0.34);
  animation: wave-breathe 2.8s var(--ease-soft) infinite;
  pointer-events: none;
}

@keyframes wave-breathe {
  0%,
  100% {
    opacity: 0.15;
    transform: scale(1);
  }
  50% {
    opacity: 0.72;
    transform: scale(1.035);
  }
}

.moonwave-glyph {
  font-family: var(--latin);
  font-size: 20px;
  line-height: 1;
  transform: translateY(-1px);
}

.moonwave-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  position: relative;
  z-index: 1;
}

.moonwave-copy b {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
}

.moonwave-copy small {
  font-family: var(--latin);
  font-size: 7px;
  letter-spacing: 0.2em;
  opacity: 0.55;
}

.wave-fill {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, rgba(145, 240, 218, 0.16), rgba(145, 240, 218, 0.04));
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 0.15s linear;
  z-index: 0;
}

.tutorial {
  position: absolute;
  left: 50%;
  bottom: clamp(82px, 12vh, 112px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 18px;
  border: 1px solid rgba(180, 196, 255, 0.09);
  border-radius: 999px;
  background: rgba(6, 10, 22, 0.44);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  backdrop-filter: blur(8px);
  transition: opacity 0.7s var(--ease-soft), transform 0.7s var(--ease-soft);
  white-space: nowrap;
  pointer-events: none;
}

.tutorial b {
  color: var(--moon);
  font-weight: 500;
}

.tutorial i {
  width: 1px;
  height: 12px;
  background: var(--hair);
}

.tutorial.is-gone {
  opacity: 0;
  transform: translate(-50%, 5px);
}

/* ---------- Screens ---------- */

.screen {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: opacity 0.5s var(--ease-soft), visibility 0.5s;
}

.screen--title {
  padding: clamp(26px, 5vh, 60px) clamp(24px, 6vw, 96px) clamp(58px, 8vh, 80px);
  background:
    linear-gradient(100deg, rgba(4, 7, 15, 0.96) 0%, rgba(4, 7, 15, 0.9) 34%, rgba(4, 7, 15, 0.48) 62%, rgba(4, 7, 15, 0.06) 86%),
    radial-gradient(ellipse at 20% 52%, rgba(22, 31, 66, 0.46), transparent 55%);
}

.title-layout {
  width: min(1240px, 100%);
  margin: auto;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(310px, 0.72fr);
  gap: clamp(40px, 7vw, 110px);
  align-items: center;
}

.title-main {
  min-width: 0;
  max-width: 650px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 22px;
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.34em;
  color: var(--muted);
  text-transform: uppercase;
}

.eyebrow i {
  width: 34px;
  height: 1px;
  background: var(--hair);
}

.title-main h1 {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.title-cn {
  font-family: var(--serif);
  font-size: clamp(84px, 11.5vw, 158px);
  font-weight: 400;
  line-height: 0.86;
  letter-spacing: 0.1em;
  color: var(--moon);
  background: linear-gradient(168deg, #fffdf4 8%, #ffe8ba 48%, #d8a95e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 10px 40px rgba(255, 210, 138, 0.12));
  animation: title-reveal 1.1s var(--ease-out) both;
}

.title-en {
  font-family: var(--latin);
  font-size: 11px;
  letter-spacing: 0.72em;
  color: var(--gold);
  opacity: 0.86;
  padding-left: 7px;
  animation: title-reveal 1.1s 0.12s var(--ease-out) both;
}

@keyframes title-reveal {
  from {
    opacity: 0;
    transform: translateY(16px);
    filter: blur(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

.tagline {
  margin: 27px 0 0;
  font-family: var(--serif);
  font-size: clamp(17px, 1.7vw, 22px);
  letter-spacing: 0.3em;
  color: var(--gold);
  animation: title-reveal 1s 0.22s var(--ease-out) both;
}

.lede {
  max-width: 480px;
  margin: 22px 0 0;
  font-size: 13px;
  line-height: 2;
  letter-spacing: 0.08em;
  color: var(--muted);
  animation: title-reveal 1s 0.32s var(--ease-out) both;
}

.title-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 34px;
  animation: title-reveal 1s 0.42s var(--ease-out) both;
}

.best-line {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin: 24px 0 0;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--dim);
}

.best-line b {
  font-family: var(--latin);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--moon);
}

.best-line span {
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--dim);
  opacity: 0.7;
}

.best-line span.is-hidden {
  display: none;
}

/* ---------- Buttons ---------- */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
  min-height: 50px;
  padding: 0 22px;
  border: 1px solid var(--hair-strong);
  border-radius: 2px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-align: left;
  transition: color 0.25s, background 0.25s, border-color 0.25s, transform 0.25s;
}

.btn::before,
.btn::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  border-color: var(--gold);
  border-style: solid;
  opacity: 0.6;
  transition: opacity 0.25s, transform 0.25s;
}

.btn::before {
  top: -1px;
  left: -1px;
  border-width: 1px 0 0 1px;
}

.btn::after {
  right: -1px;
  bottom: -1px;
  border-width: 0 1px 1px 0;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:hover::before,
.btn:hover::after {
  opacity: 1;
  transform: scale(1.3);
}

.btn--primary {
  min-width: 228px;
  border-color: rgba(255, 210, 138, 0.6);
  background: linear-gradient(110deg, rgba(255, 210, 138, 0.1), rgba(255, 210, 138, 0.02));
  color: var(--moon);
}

.btn--primary:hover {
  background: linear-gradient(110deg, rgba(255, 210, 138, 0.94), rgba(255, 185, 104, 0.94));
  border-color: var(--gold);
  color: #1a130a;
}

.btn--primary:hover kbd {
  border-color: rgba(26, 19, 10, 0.3);
  color: rgba(26, 19, 10, 0.72);
}

.btn--ghost {
  min-width: 122px;
  color: var(--muted);
  border-color: var(--hair);
}

.btn--ghost:hover {
  color: var(--moon);
  border-color: var(--hair-strong);
  background: rgba(255, 255, 255, 0.03);
}

.btn--text {
  min-width: 0;
  border-color: transparent;
  color: var(--dim);
  padding-inline: 6px;
}

.btn--text:hover {
  color: var(--muted);
}

.btn--text::before,
.btn--text::after {
  display: none;
}

.btn kbd,
.boon-hint kbd {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border: 1px solid var(--hair);
  border-radius: 2px;
  font-family: var(--latin);
  font-size: 8px;
  letter-spacing: 0.08em;
  color: var(--dim);
  font-weight: 400;
}

/* ---------- Title guide ---------- */

.guide-panel {
  width: 100%;
  max-width: 390px;
  justify-self: end;
  padding: 4px 0 4px clamp(24px, 3.5vw, 48px);
  border-left: 1px solid var(--hair);
  animation: title-reveal 1s 0.5s var(--ease-out) both;
}

.guide-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--hair);
}

.guide-head span {
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: 0.24em;
  color: var(--moon);
}

.guide-head small {
  font-family: var(--latin);
  font-size: 7px;
  letter-spacing: 0.26em;
  color: var(--dim);
}

.guide-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.guide-list li {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  padding: 18px 0;
  border-bottom: 1px solid rgba(180, 196, 255, 0.08);
}

.guide-num {
  font-family: var(--latin);
  font-size: 12px;
  font-style: italic;
  color: var(--gold);
  opacity: 0.72;
  padding-top: 2px;
}

.guide-list b {
  display: block;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--text);
  margin-bottom: 7px;
}

.guide-list p {
  margin: 0;
  font-size: 11px;
  line-height: 1.9;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.guide-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding-top: 18px;
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--dim);
}

.title-footer {
  position: absolute;
  left: clamp(24px, 6vw, 96px);
  right: clamp(24px, 6vw, 96px);
  bottom: max(22px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--dim);
  opacity: 0.7;
}

.footer-mark {
  color: var(--gold);
  font-size: 14px;
  opacity: 0.65;
}

/* ---------- Boon ---------- */

.screen--boon {
  padding: clamp(24px, 5vh, 60px) clamp(20px, 5vw, 64px);
  background:
    radial-gradient(ellipse at 50% 46%, rgba(26, 38, 76, 0.72), transparent 65%),
    rgba(4, 7, 15, 0.9);
  backdrop-filter: blur(10px);
}

.boon-shell {
  width: min(1080px, 100%);
  margin: auto;
  text-align: center;
}

.boon-shell h2,
.screen--pause h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(40px, 5vw, 62px);
  letter-spacing: 0.18em;
  color: var(--moon);
  text-shadow: 0 0 50px rgba(255, 210, 138, 0.14);
}

.boon-shell .eyebrow,
.screen--pause .eyebrow {
  justify-content: center;
  margin-bottom: 18px;
}

.boon-lede {
  margin: 14px 0 0;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.boon-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 2vw, 24px);
  margin-top: clamp(28px, 5vh, 52px);
}

.boon-card {
  position: relative;
  min-height: 310px;
  padding: 34px 26px 28px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  border: 1px solid var(--hair);
  border-radius: 2px;
  background:
    linear-gradient(165deg, rgba(34, 48, 92, 0.28), rgba(8, 12, 26, 0.44)),
    var(--panel);
  overflow: hidden;
  color: var(--text);
  transition: transform 0.3s var(--ease-out), border-color 0.3s, background 0.3s;
  animation: card-rise 0.6s var(--ease-out) both;
}

.boon-card:nth-child(2) {
  animation-delay: 0.07s;
}

.boon-card:nth-child(3) {
  animation-delay: 0.14s;
}

@keyframes card-rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.boon-card::before {
  content: "";
  position: absolute;
  top: -40%;
  left: 50%;
  width: 160px;
  height: 160px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 210, 138, 0.16), transparent 68%);
  transition: opacity 0.3s, transform 0.3s;
  opacity: 0.38;
}

.boon-watermark {
  position: absolute;
  right: 18px;
  bottom: -28px;
  font-family: var(--serif);
  font-size: 140px;
  line-height: 1;
  color: rgba(255, 210, 138, 0.045);
  pointer-events: none;
  transition: color 0.3s, transform 0.3s;
}

.boon-card:hover .boon-watermark {
  color: rgba(255, 210, 138, 0.09);
  transform: translateY(-4px);
}

.boon-card:hover,
.boon-card:focus-visible {
  transform: translateY(-6px);
  border-color: rgba(255, 210, 138, 0.5);
  background:
    linear-gradient(165deg, rgba(48, 64, 112, 0.4), rgba(10, 15, 32, 0.54)),
    var(--panel);
  outline: none;
}

.boon-card:hover::before {
  opacity: 0.85;
  transform: translateX(-50%) scale(1.25);
}

.boon-icon {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 26px;
  border: 1px solid rgba(255, 210, 138, 0.32);
  border-radius: 50%;
  font-family: var(--serif);
  font-size: 24px;
  color: var(--gold);
  background: rgba(255, 210, 138, 0.04);
}

.boon-index {
  position: absolute;
  top: 18px;
  right: 20px;
  font-family: var(--latin);
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--dim);
}

.boon-name {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 400;
  letter-spacing: 0.2em;
  color: var(--moon);
}

.boon-en {
  margin: 7px 0 0;
  font-family: var(--latin);
  font-size: 7px;
  letter-spacing: 0.3em;
  color: var(--dim);
}

.boon-desc {
  position: relative;
  z-index: 1;
  margin: auto 0 0;
  padding-top: 26px;
  font-size: 12px;
  line-height: 1.8;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.boon-stack {
  display: inline-block;
  margin-top: 10px;
  font-family: var(--latin);
  font-size: 8px;
  letter-spacing: 0.16em;
  color: var(--gold);
  opacity: 0.65;
}

.boon-hint {
  margin: 30px 0 0;
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--dim);
}

.boon-hint kbd {
  height: 18px;
  min-width: 18px;
  margin: 0 2px;
  font-size: 7px;
}

/* ---------- Pause ---------- */

.screen--pause {
  background: rgba(4, 7, 15, 0.78);
  backdrop-filter: blur(14px);
  align-items: center;
  text-align: center;
}

.modal {
  width: min(460px, 100%);
  padding: 46px clamp(24px, 5vw, 54px);
  border: 1px solid var(--hair);
  background:
    linear-gradient(165deg, rgba(34, 48, 92, 0.26), rgba(8, 12, 26, 0.78)),
    rgba(8, 12, 26, 0.985);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.42);
  animation: card-rise 0.45s var(--ease-out) both;
}

.modal h2 {
  font-size: clamp(36px, 4vw, 48px);
}

.modal-lede {
  margin: 16px 0 0;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 32px;
}

.modal-actions .btn {
  width: 100%;
}

/* ---------- End ---------- */

.screen--end {
  padding: clamp(22px, 4vh, 48px) clamp(20px, 5vw, 64px);
  background:
    radial-gradient(ellipse at 50% 34%, rgba(42, 56, 102, 0.62), transparent 62%),
    rgba(4, 7, 15, 0.93);
  backdrop-filter: blur(10px);
  overflow-y: auto;
}

.end-shell {
  width: min(780px, 100%);
  margin: auto;
  text-align: center;
  animation: card-rise 0.7s var(--ease-out) both;
}

.end-heading .eyebrow {
  justify-content: center;
  margin-bottom: 14px;
}

.end-heading h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(42px, 6vw, 72px);
  letter-spacing: 0.18em;
  color: var(--moon);
  text-shadow: 0 0 70px rgba(255, 210, 138, 0.18);
}

.end-subtitle {
  margin: 14px 0 0;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.end-score-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(30px, 7vw, 74px);
  margin-top: clamp(26px, 5vh, 46px);
}

.end-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.end-score b {
  font-family: var(--latin);
  font-size: clamp(46px, 6vw, 72px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.04em;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 40px rgba(255, 210, 138, 0.22);
}

.new-best {
  margin-top: 4px;
  padding: 3px 9px;
  border: 1px solid rgba(255, 210, 138, 0.4);
  font-size: 8px;
  letter-spacing: 0.2em;
  color: var(--gold);
}

.new-best.is-hidden {
  display: none;
}

.rank-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 92px;
  height: 92px;
  border: 1px solid rgba(184, 168, 255, 0.28);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(184, 168, 255, 0.1), transparent 70%);
}

.rank-badge span {
  font-size: 7px;
  letter-spacing: 0.18em;
  color: var(--dim);
}

.rank-badge b {
  font-family: var(--latin);
  font-size: 34px;
  font-style: italic;
  font-weight: 400;
  color: var(--moon);
  line-height: 1.1;
}

.end-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin-top: clamp(26px, 4vh, 40px);
  background: var(--hair);
  border: 1px solid var(--hair);
}

.end-stat {
  padding: 16px 10px;
  background: rgba(6, 10, 22, 0.94);
}

.end-stat span {
  display: block;
  font-size: 8px;
  letter-spacing: 0.16em;
  color: var(--dim);
  margin-bottom: 7px;
}

.end-stat b {
  font-family: var(--latin);
  font-size: 19px;
  font-weight: 400;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.end-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: clamp(24px, 4vh, 36px);
}

.end-foot {
  margin: 22px 0 0;
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--dim);
}

.end-foot b {
  font-family: var(--latin);
  color: var(--gold);
  font-weight: 400;
}

/* ---------- Announcements ---------- */

.announce-layer {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: clamp(132px, 17vh, 190px);
  pointer-events: none;
}

.announce-layer .big-announce {
  font-family: var(--serif);
  font-size: clamp(23px, 3.2vw, 42px);
  letter-spacing: 0.3em;
  color: var(--moon);
  text-shadow:
    0 0 38px rgba(255, 210, 138, 0.36),
    0 2px 0 rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  animation: announce-big 2s var(--ease-out) forwards;
  text-align: center;
  padding-left: 0.3em;
}

@keyframes announce-big {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
    filter: blur(5px);
  }
  18%,
  68% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-8px) scale(1.015);
    filter: blur(3px);
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
  .title-layout {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.64fr);
    gap: 36px;
  }

  .title-cn {
    font-size: clamp(72px, 12vw, 118px);
  }

  .guide-panel {
    padding-left: 24px;
  }
}

@media (max-width: 760px) {
  .screen--title {
    overflow-y: auto;
    padding: max(24px, env(safe-area-inset-top)) 22px max(54px, env(safe-area-inset-bottom));
    background:
      linear-gradient(180deg, rgba(4, 7, 15, 0.94) 0%, rgba(4, 7, 15, 0.86) 52%, rgba(4, 7, 15, 0.42) 82%, transparent 100%),
      radial-gradient(ellipse at 50% 28%, rgba(22, 31, 66, 0.5), transparent 62%);
  }

  .title-layout {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
    margin: 0;
    padding-top: 6vh;
  }

  .title-main {
    max-width: 100%;
  }

  .eyebrow {
    margin-bottom: 18px;
  }

  .title-cn {
    font-size: clamp(76px, 23vw, 112px);
  }

  .title-en {
    font-size: 9px;
    letter-spacing: 0.58em;
  }

  .tagline {
    margin-top: 22px;
    font-size: 16px;
  }

  .lede {
    margin-top: 16px;
    font-size: 12px;
    line-height: 1.9;
  }

  .title-actions {
    margin-top: 26px;
    width: 100%;
  }

  .title-actions .btn--primary {
    flex: 1;
  }

  .title-actions .btn--ghost {
    min-width: 104px;
  }

  .best-line {
    margin-top: 18px;
  }

  .guide-panel {
    max-height: 0;
    width: 100%;
    max-width: 100%;
    padding: 0;
    border-left: 0;
    border-top: 1px solid var(--hair);
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.45s var(--ease-soft), opacity 0.4s, padding 0.4s;
  }

  .guide-panel.is-open {
    max-height: 520px;
    padding: 18px 0 4px;
    opacity: 1;
  }

  .guide-list li {
    padding: 14px 0;
  }

  .guide-foot {
    padding-bottom: 8px;
  }

  .title-footer {
    left: 22px;
    right: 22px;
    font-size: 8px;
    letter-spacing: 0.1em;
    bottom: max(16px, env(safe-area-inset-bottom));
  }

  .title-footer .footer-mark {
    display: none;
  }

  .hud {
    padding: max(12px, env(safe-area-inset-top)) 14px max(12px, env(safe-area-inset-bottom));
  }

  .hud-bar {
    gap: 8px;
  }

  .act-roman {
    font-size: 24px;
    padding-right: 8px;
  }

  .act-copy b {
    font-size: 14px;
    letter-spacing: 0.1em;
  }

  .act-copy span {
    display: none;
  }

  .act-track {
    width: 86px;
    grid-column: 2;
  }

  .score-block {
    min-width: 86px;
  }

  .score-block #score {
    font-size: 25px;
  }

  .combo-chip {
    font-size: 8px;
    letter-spacing: 0.08em;
  }

  .health-wrap .micro-label {
    display: none;
  }

  .petals {
    gap: 4px;
  }

  .petal {
    width: 8px;
    height: 12px;
  }

  .icon-btn {
    width: 30px;
    height: 30px;
  }

  .icon-btn svg {
    width: 13px;
    height: 13px;
  }

  .state-block {
    gap: 7px;
  }

  .health-wrap {
    gap: 0;
  }

  .bloom-meter {
    gap: 7px;
    padding: 5px 10px;
  }

  .bloom-meter .micro-label {
    display: none;
  }

  .moonwave-btn {
    min-width: 88px;
    height: 42px;
    padding: 0 12px;
    gap: 6px;
  }

  .moonwave-glyph {
    font-size: 18px;
  }

  .moonwave-copy b {
    font-size: 11px;
  }

  .tutorial {
    bottom: clamp(74px, 11vh, 96px);
    font-size: 10px;
    padding: 8px 12px;
    gap: 8px;
  }

  .announce-layer {
    padding-top: 18vh;
  }

  .boon-cards {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 24px;
  }

  .boon-card {
    min-height: 0;
    padding: 16px 18px;
    display: grid;
    grid-template-columns: 46px 1fr;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 14px;
  }

  .boon-watermark {
    right: 10px;
    bottom: -18px;
    font-size: 80px;
  }

  .boon-icon {
    grid-row: 1 / 3;
    width: 42px;
    height: 42px;
    margin: 0;
    font-size: 21px;
  }

  .boon-name {
    font-size: 19px;
    align-self: end;
  }

  .boon-en {
    display: none;
  }

  .boon-desc {
    padding-top: 4px;
    margin: 0;
    font-size: 11px;
    align-self: start;
  }

  .boon-stack {
    display: none;
  }

  .boon-index {
    top: 14px;
    right: 16px;
  }

  .boon-hint {
    margin-top: 20px;
  }

  .screen--end {
    padding: max(20px, env(safe-area-inset-top)) 18px max(20px, env(safe-area-inset-bottom));
  }

  .end-score-row {
    gap: 26px;
    margin-top: 24px;
  }

  .rank-badge {
    width: 76px;
    height: 76px;
  }

  .rank-badge b {
    font-size: 28px;
  }

  .end-stats {
    grid-template-columns: repeat(2, 1fr);
    margin-top: 24px;
  }

  .end-stat {
    padding: 12px 8px;
  }

  .end-actions {
    flex-direction: column;
    margin-top: 22px;
  }

  .end-actions .btn {
    width: 100%;
  }

  .end-foot {
    margin-top: 16px;
  }
}

@media (max-width: 390px) {
  .act-block {
    grid-template-columns: auto auto;
    column-gap: 6px;
  }

  .act-copy b {
    font-size: 12px;
  }

  .act-track {
    width: 64px;
  }

  .score-block {
    min-width: 76px;
  }

  .score-block #score {
    font-size: 21px;
  }

  .icon-btn {
    width: 28px;
    height: 28px;
  }

  .petals {
    gap: 3px;
  }

  .petal {
    width: 7px;
    height: 11px;
  }

  .moonwave-btn {
    min-width: 78px;
  }

  .moonwave-copy small {
    display: none;
  }

  .bloom-dots {
    gap: 4px;
  }

  .tutorial {
    max-width: calc(100vw - 28px);
    white-space: normal;
    text-align: center;
    line-height: 1.6;
    border-radius: 12px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .tutorial i {
    display: none;
  }
}

@media (max-width: 380px) {
  .title-actions {
    flex-wrap: wrap;
  }

  .title-actions .btn--primary,
  .title-actions .btn--ghost {
    flex: 1 1 100%;
    min-width: 0;
  }
}

@media (max-height: 620px) and (orientation: landscape) {
  .announce-layer {
    display: none;
  }

  .screen--title {
    padding-top: 20px;
    padding-bottom: 20px;
  }

  .title-layout {
    grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.7fr);
    gap: 30px;
  }

  .title-cn {
    font-size: clamp(52px, 9vw, 82px);
  }

  .tagline {
    margin-top: 14px;
    font-size: 14px;
  }

  .lede {
    display: none;
  }

  .title-actions {
    margin-top: 18px;
  }

  .best-line {
    margin-top: 14px;
  }

  .title-footer {
    display: none;
  }

  .guide-list li {
    padding: 10px 0;
  }

  .guide-list p {
    line-height: 1.6;
  }

  .tutorial {
    display: none;
  }

  .screen--end {
    justify-content: flex-start;
  }

  .end-heading h2 {
    font-size: 38px;
  }

  .end-stats {
    margin-top: 18px;
  }

  .end-actions {
    margin-top: 16px;
  }
}

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