/* 竖屏壳：锁住滚动和缩放，舞台在桌面上居中成一列。 */

html,
body {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.backdrop {
  position: fixed;
  inset: 0;
  background: var(--backdrop);
}

.stage {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  width: min(100%, 480px);
  height: 100%;
  transform: translateX(-50%);
  overflow: hidden;
  background: #2a2140;
  touch-action: none;
}

.stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.stage.phase-playing canvas {
  cursor: pointer;
}

.hud {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + var(--safe-top, env(safe-area-inset-top, 0px)))
    calc(14px + var(--safe-right, env(safe-area-inset-right, 0px))) 0
    calc(14px + var(--safe-left, env(safe-area-inset-left, 0px)));
  pointer-events: none;
  text-shadow: 0 2px 12px rgba(16, 8, 20, 0.45);
}

.hud-readout { min-width: 0; }

.stage:not(.phase-playing):not(.phase-ending) .hud-readout { opacity: 0; }

.score-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.score-num {
  font-size: 46px;
  font-weight: 760;
  line-height: 0.9;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.score-unit {
  font-size: 14px;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.hud-best {
  margin: 4px 0 0;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.hud-best b,
.bestline b {
  font-weight: 700;
  color: var(--good);
  font-variant-numeric: tabular-nums;
}

.sound {
  pointer-events: auto;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(246, 239, 230, 0.28);
  background: rgba(18, 10, 22, 0.34);
  color: var(--ink);
  cursor: pointer;
}

.sound:focus-visible,
.primary:focus-visible,
.textbtn:focus-visible {
  outline: 2px solid var(--good);
  outline-offset: 3px;
}

.overlay {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: calc(16px + var(--safe-top, env(safe-area-inset-top, 0px)))
    calc(16px + var(--safe-right, env(safe-area-inset-right, 0px)))
    calc(16px + var(--safe-bottom, env(safe-area-inset-bottom, 0px)))
    calc(16px + var(--safe-left, env(safe-area-inset-left, 0px)));
  background: linear-gradient(
    180deg,
    rgba(16, 10, 22, 0.02) 0%,
    rgba(16, 10, 22, 0.04) 34%,
    rgba(16, 10, 22, 0.55) 58%,
    rgba(16, 10, 22, 0.8) 100%
  );
  pointer-events: none;
}

.stage.phase-playing .overlay,
.stage.phase-ending .overlay,
.stage.phase-ready .overlay-over,
.stage.phase-over .overlay-ready {
  display: none;
}

.sheet {
  pointer-events: auto;
  width: min(100%, 420px);
  margin: 0 auto;
  padding: 18px 18px 16px;
  border-radius: 24px;
  color: var(--sheet-ink, var(--ink));
  background: var(--sheet);
  border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgba(10, 6, 16, 0.35);
  backdrop-filter: blur(10px);
}

.perf-low .sheet { backdrop-filter: none; }

.eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--good);
}

.sheet h1,
.sheet h2 {
  margin: 4px 0 0;
  font-size: clamp(36px, 11vw, 58px);
  line-height: 1.02;
  letter-spacing: 0.04em;
  font-weight: 760;
}

.english {
  margin: 4px 0 0;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: lowercase;
  color: var(--dim);
}

.tagline,
.comment,
.bestline,
.sharenote {
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
}

.sharenote:empty { display: none; }

.rules {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.rules li {
  position: relative;
  margin: 0;
  padding-left: 14px;
  font-size: clamp(13px, 3.5vw, 15px);
  line-height: 1.55;
  color: var(--dim);
}

.rules li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.result {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 8px 0 0;
}

.result-num {
  font-size: clamp(52px, 16vw, 72px);
  font-weight: 760;
  line-height: 0.9;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.result-unit {
  font-size: 16px;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.record {
  display: inline-block;
  margin: 8px 0 0;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(242, 213, 138, 0.16);
  color: var(--good);
  font-size: 12px;
  letter-spacing: 0.16em;
}

.record[hidden] { display: none; }

.primary {
  display: block;
  width: 100%;
  min-height: 52px;
  margin-top: 14px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-size: 18px;
  font-weight: 760;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.primary:active { transform: translateY(1px); }

.textbtn {
  display: block;
  width: max-content;
  margin: 12px auto 0;
  padding: 8px 4px;
  border: 0;
  background: none;
  color: var(--dim);
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.12em;
  cursor: pointer;
}
