:root {
  --ink: #16263a;
  --ink-soft: #5a6b80;
  --card: rgba(255, 255, 255, 0.9);
  --card-edge: #b6cde6;
  --stage-left: 0px;
  --stage-right: 0px;
  --stage-top: 0px;
  --stage-bottom: 0px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #d8e5f4;
}

body {
  font-family:
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", ui-sans-serif,
    system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#scene {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.hud {
  position: absolute;
  left: calc(var(--stage-left) + 30px);
  top: calc(var(--stage-top) + 28px);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  border: 1px solid var(--card-edge);
  border-radius: 999px;
  background: var(--card);
  box-shadow: 0 8px 22px rgba(60, 100, 145, 0.13);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--ink-soft);
  pointer-events: none;
}

.hud b {
  color: var(--ink);
  font-size: 19px;
  font-weight: 900;
}

.hud__kicker {
  font-size: 14px;
  font-weight: 800;
  color: #7c93aa;
}

.hud__step {
  padding-left: 12px;
  border-left: 1px solid rgba(150, 180, 210, 0.55);
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #7c93aa;
}

.bar {
  position: absolute;
  left: 50%;
  bottom: calc(var(--stage-bottom) + 26px);
  transform: translateX(-50%);
  width: min(1180px, calc(100vw - 60px));
  border: 1px solid var(--card-edge);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 14px 34px rgba(56, 96, 140, 0.16);
  overflow: hidden;
}

.bar__progress {
  height: 5px;
  background: rgba(150, 180, 210, 0.28);
}

.bar__progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(90deg, #e5484d, #12b886, #4dabf7, #ff9f1c);
}

.bar__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 16px;
}

.dots {
  display: flex;
  align-items: center;
  gap: 9px;
}

.dot {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid #d3e0ee;
  border-radius: 50%;
  background: #fff;
  color: var(--ink-soft);
  font: inherit;
  font-size: 15px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.dot:hover {
  border-color: #8fb6dc;
  color: var(--ink);
  transform: translateY(-1px);
}

.dot.is-active {
  border-color: #16263a;
  background: #16263a;
  color: #fff;
  box-shadow: 0 6px 14px rgba(22, 38, 58, 0.28);
}

.bar__controls {
  display: flex;
  align-items: center;
  gap: 9px;
}

.tool {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #d3e0ee;
  border-radius: 13px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    transform 140ms ease;
}

.tool svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool:hover {
  border-color: #8fb6dc;
  transform: translateY(-1px);
}

.tool:active {
  transform: translateY(0);
}

.tool--play {
  width: 52px;
  height: 52px;
  border-color: #16263a;
  background: #16263a;
  color: #fff;
}

.tool--play:hover {
  border-color: #24384f;
  background: #24384f;
}

.tool--play svg {
  width: 24px;
  height: 24px;
}

.tool--play .icon-play {
  fill: currentColor;
  stroke-width: 1.6;
}

.tool--play .icon-play {
  display: none;
}

.tool--play.is-paused .icon-play {
  display: block;
}

.tool--play.is-paused .icon-pause {
  display: none;
}

.tool--sound[hidden] {
  display: none;
}

.tool--sound .icon-sound-off {
  display: none;
}

.tool--sound.is-muted {
  color: #8ba3bb;
}

.tool--sound.is-muted .icon-sound-off {
  display: block;
}

.tool--sound.is-muted .icon-sound-on {
  display: none;
}

@keyframes sound-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 176, 32, 0.5);
  }
  60% {
    box-shadow: 0 0 0 12px rgba(255, 176, 32, 0);
  }
}

.tool--play.is-blocked {
  animation: sound-pulse 1.6s ease-out infinite;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: calc(var(--stage-bottom) + 152px);
  transform: translate(-50%, 10px);
  padding: 10px 22px;
  border: 1px solid #ffd79a;
  border-radius: 999px;
  background: rgba(255, 248, 234, 0.96);
  color: #9a6711;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: 0 8px 20px rgba(120, 90, 30, 0.14);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 200ms ease,
    transform 200ms ease,
    visibility 200ms;
  pointer-events: none;
}

.needs-sound .toast {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.time {
  margin-left: 4px;
  padding-left: 14px;
  border-left: 1px solid rgba(150, 180, 210, 0.55);
  font-size: 16px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}

@media (max-width: 900px) {
  .bar {
    width: calc(100vw - 32px);
  }

  .bar__row {
    flex-direction: column;
    gap: 12px;
  }

  .hud__kicker {
    display: none;
  }
}

/* 录制模式：逐帧导出时只保留画面和左上角章节标题 */
.is-recording .bar,
.is-recording .toast {
  display: none;
}
