:root {
  --mist: #d5dee8;
  --mist-deep: #aebccb;
  --steam-cyan: #7ed0ff;
  --steam-ink: rgba(28, 36, 48, 0.88);
  --glass: rgba(255, 255, 255, 0.22);
  --cta-a: #ff3b6b;
  --cta-b: #d9184a;
}

.stage {
  position: relative;
  width: 100%;
  max-width: 430px;
  height: 100dvh;
  height: 100svh;
  overflow: hidden;
  background: #0c1016;
  touch-action: none;
  isolation: isolate;
}

.media-layer { position: absolute; inset: 0; z-index: 1; }

/* 强制铺满，避免 canvas 默认 300×150 */
#steamCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  display: block;
  touch-action: none;
  transition: opacity 0.85s cubic-bezier(0.22, 1, 0.36, 1), filter 0.85s ease;
}
#steamCanvas.gone {
  opacity: 0;
  filter: blur(6px);
  pointer-events: none;
}

/* 轻雾氛围：不动 canvas 玩法，只加一层氛围 */
.mist-veil {
  position: absolute; inset: 0; z-index: 6; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(190, 210, 230, 0.28), transparent 55%),
    radial-gradient(ellipse 70% 40% at 50% 110%, rgba(120, 150, 180, 0.18), transparent 50%);
  mix-blend-mode: soft-light;
  opacity: 0.85;
  transition: opacity 0.9s ease;
}
.stage.is-clear .mist-veil { opacity: 0; }

.clear-flash {
  position: absolute; inset: 0; z-index: 12; pointer-events: none;
  background: radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.55), rgba(126, 208, 255, 0.12) 40%, transparent 70%);
  opacity: 0;
}
.clear-flash.burst {
  animation: clearBurst 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes clearBurst {
  0% { opacity: 0; transform: scale(0.96); }
  35% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.04); }
}

.top-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  pointer-events: none;
  color: var(--steam-ink);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}
.top-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dwell { display: none; }
.dwell.on {
  display: inline;
  font-size: 11px;
  font-weight: 700;
  color: var(--steam-ink);
  opacity: 0.75;
}
.dwell.on.ok { color: #1a7a4c; opacity: 1; }

.wipe-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 5px 10px 5px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 4px 18px rgba(20, 30, 45, 0.12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.wipe-progress.done {
  opacity: 0;
  transform: translateY(-6px);
}
.wipe-progress-track {
  width: 56px; height: 5px;
  border-radius: 999px;
  background: rgba(40, 50, 65, 0.18);
  overflow: hidden;
}
.wipe-progress-fill {
  height: 100%; width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8ec8e8, var(--steam-cyan));
  box-shadow: 0 0 8px rgba(126, 208, 255, 0.55);
  transition: width 0.18s linear;
}
.wipe-progress-label {
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 750;
  color: var(--steam-ink);
  min-width: 2.4em;
  text-align: right;
}

.wipe-hint {
  position: absolute;
  left: 50%; top: 44%;
  transform: translate(-50%, -50%);
  z-index: 10;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 18px;
  color: var(--steam-ink);
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 10px 36px rgba(30, 40, 55, 0.16);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: hintFloat 2.2s infinite ease-in-out;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.wipe-hint-hand {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(40, 50, 65, 0.45);
  box-shadow: inset 0 0 0 3px rgba(126, 208, 255, 0.35);
  animation: wipeSwipe 1.8s infinite ease-in-out;
}
.wipe-hint.hide {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.96);
  animation: none;
}
@keyframes hintFloat {
  0%, 100% { opacity: 0.72; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -48%) scale(1.02); }
}
@keyframes wipeSwipe {
  0%, 100% { transform: translateX(-3px); opacity: 0.55; }
  50% { transform: translateX(5px); opacity: 1; }
}

.done-panel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 15;
  display: none;
  flex-direction: column;
  text-align: center;
  padding: 88px 20px calc(28px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(
    to top,
    rgba(6, 10, 16, 0.96) 28%,
    rgba(8, 14, 22, 0.55) 68%,
    transparent 100%
  );
  animation: rise 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
.done-panel.show { display: flex; }
@keyframes rise {
  from { transform: translateY(36px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.done-badge {
  align-self: center;
  background: linear-gradient(135deg, #5eb8e8, #7ed0ff);
  color: #0b1520;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.06em;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 12px;
  box-shadow: 0 0 24px rgba(126, 208, 255, 0.35);
}
.done-title {
  font-size: 26px;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.45);
}
.done-text {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.45;
}
.cta-btn {
  width: 100%;
  padding: 16px;
  border-radius: 18px;
  border: none;
  margin-top: 18px;
  background: linear-gradient(135deg, var(--cta-a), var(--cta-b));
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(255, 45, 85, 0.38);
  transition: transform 0.15s ease, filter 0.15s ease;
}
.cta-btn:active { transform: scale(0.98); filter: brightness(1.05); }
