:root {
  --bg: #F4F6F9;
  --surface: #FFFFFF;
  --surface-muted: #F8FAFC;
  --border: #D9E2EC;
  --border-strong: #BCCCDC;
  --ink: #102A43;
  --ink-soft: #486581;
  --ink-muted: #829AB1;
  --blue: #1B4FD8;
  --blue-hover: #143FB0;
  --blue-soft: #EBF2FF;
  --green: #0F9D58;
  --green-soft: #E6F7EE;
  --red: #D92D20;
  --red-soft: #FEF3F2;
  --amber: #D97706;
  --amber-soft: #FFFBEB;
  --shadow: 0 12px 32px rgba(16, 42, 67, 0.08), 0 2px 6px rgba(16, 42, 67, 0.04);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(27, 79, 216, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(27, 79, 216, 0.045) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
}

.confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 60;
}

.confetti-piece {
  position: absolute;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  top: -20px;
  animation: confettiFall 2.4s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  85% { opacity: 1; }
  100% { transform: translateY(105vh) rotate(640deg); opacity: 0; }
}

/* Topbar */
.topbar {
  position: relative;
  z-index: 10;
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 20px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(27, 79, 216, 0.28);
  flex-shrink: 0;
}

.brand-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.brand-code {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--blue);
  background: var(--blue-soft);
  padding: 2px 7px;
  border-radius: 999px;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 2px;
  font-weight: 500;
}

.hud-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.hud-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease;
}

.hud-btn:hover {
  border-color: var(--blue);
  background: #fdfefe;
}

.hud-btn:active {
  transform: scale(0.96);
}

.hud-btn-accent {
  background: var(--blue-soft);
  border-color: #C7D8FF;
  color: var(--blue);
}

.hud-btn-ghost {
  color: var(--ink-soft);
}

.ach-pill {
  background: var(--blue);
  color: #fff;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
}

/* Main Card */
.main-wrap {
  position: relative;
  z-index: 5;
  max-width: 580px;
  margin: 12px auto 72px;
  padding: 0 16px;
}

.verify-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.25s ease;
}

.verify-card.card-shake {
  animation: cardShake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes cardShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px) rotate(-0.6deg); }
  40% { transform: translateX(7px) rotate(0.6deg); }
  60% { transform: translateX(-5px) rotate(-0.4deg); }
  80% { transform: translateX(4px) rotate(0.3deg); }
}

.card-progress-track {
  height: 5px;
  background: #EDF2F7;
  width: 100%;
  overflow: hidden;
}

.card-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), #3B82F6);
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1), background 0.3s ease;
}

.card-progress-bar.is-crash {
  background: var(--red);
}

.card-progress-bar.is-done {
  background: var(--green);
}

.card-head {
  padding: 14px 20px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.card-step-tag {
  font-size: 12px;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: 0.02em;
}

.card-percent {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.status-banner {
  margin: 0 20px 14px;
  padding: 10px 13px;
  border-radius: 10px;
  background: var(--surface-muted);
  border: 1px solid #E6ECF2;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  font-weight: 500;
}

.status-banner.tone-warn {
  background: var(--amber-soft);
  border-color: #FDE68A;
  color: #92400E;
}

.status-banner.tone-danger {
  background: var(--red-soft);
  border-color: #FECACA;
  color: #991B1B;
}

.status-banner.tone-ok {
  background: var(--green-soft);
  border-color: #A7F3D0;
  color: #065F46;
}

.stage-body {
  padding: 4px 20px 20px;
  min-height: 300px;
  position: relative;
}

.card-foot {
  padding: 11px 20px;
  background: var(--surface-muted);
  border-top: 1px solid #E9EFF5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--ink-muted);
  gap: 10px;
}

.foot-right strong {
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.disclaimer-line {
  text-align: center;
  font-size: 12px;
  color: var(--ink-muted);
  margin: 14px 8px 0;
  line-height: 1.5;
}

/* Shared Buttons */
.btn-primary {
  appearance: none;
  border: none;
  background: var(--blue);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 11px 20px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 12px rgba(27, 79, 216, 0.22);
}

.btn-primary:hover {
  background: var(--blue-hover);
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-secondary {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn-secondary:hover {
  background: var(--surface-muted);
  border-color: var(--blue);
}

.btn-secondary:active {
  transform: scale(0.97);
}

.btn-danger {
  appearance: none;
  border: none;
  background: var(--red);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 11px 18px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(217, 45, 32, 0.22);
}

.btn-danger:active {
  transform: scale(0.96);
}

/* ================= Stage 1 ================= */
.s1-arena {
  position: relative;
  min-height: 230px;
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  background: #FAFCFF;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  overflow: hidden;
}

.captcha-box-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  max-width: 340px;
  padding: 14px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 3px 10px rgba(16, 42, 67, 0.06);
  cursor: pointer;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}

.captcha-box-row:hover {
  border-color: var(--blue);
}

.captcha-box-row.is-running {
  position: absolute;
  z-index: 4;
}

.captcha-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.captcha-check {
  width: 30px;
  height: 30px;
  border: 2px solid #9FB3C8;
  border-radius: 7px;
  background: #fff;
  display: grid;
  place-items: center;
  position: relative;
  flex-shrink: 0;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.captcha-check.checked {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.captcha-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  text-align: left;
}

.captcha-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 9px;
  color: var(--ink-muted);
  flex-shrink: 0;
}

.bubble-pop {
  position: absolute;
  top: -28px;
  left: 14px;
  background: #102A43;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  animation: popUp 0.25s ease-out;
  pointer-events: none;
}

@keyframes popUp {
  from { transform: translateY(6px) scale(0.85); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.decoy-stack {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.s1-feedback {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ================= Stage 2 ================= */
.s2-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}

.s2-prompt-bar {
  background: var(--blue);
  color: #fff;
  border-radius: 12px;
  padding: 13px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.s2-prompt-bar strong {
  font-size: 18px;
  display: block;
  margin-top: 2px;
}

.s2-prompt-sub {
  font-size: 12px;
  opacity: 0.88;
}

.s2-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  position: relative;
}

.s2-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #FAFBFD;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  display: grid;
  place-items: center;
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}

.s2-tile:hover {
  border-color: #93B4F7;
}

.s2-tile.selected {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 3px var(--blue);
  background: #EFF5FF;
  transform: scale(0.96);
}

.s2-tile svg,
.s2-photo {
  width: 100%;
  height: 100%;
  display: block;
}

.s2-photo {
  object-fit: cover;
  transition: filter 0.2s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.s2-photo.mosaic-lvl-1 {
  filter: blur(3px) contrast(1.2);
}

.s2-photo.mosaic-lvl-2 {
  filter: blur(7px) contrast(1.35);
}

.s2-photo.tile-flip-pop {
  animation: tileFlipPop 0.42s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes tileFlipPop {
  0% { transform: scale(0.86) rotate(-4deg); }
  60% { transform: scale(1.06) rotate(2deg); }
  100% { transform: scale(1) rotate(0); }
}

.s2-tile-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  display: none;
  place-items: center;
  z-index: 3;
  box-shadow: 0 2px 6px rgba(27, 79, 216, 0.35);
}

.s2-tile.selected .s2-tile-badge {
  display: grid;
}

.s2-tile-num {
  position: absolute;
  left: 6px;
  top: 6px;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  background: rgba(16, 42, 67, 0.72);
  padding: 1px 6px;
  border-radius: 6px;
  z-index: 3;
}

.s2-commentary {
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
}

.s2-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: relative;
}

.s2-verify-btn {
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.s2-verify-btn.tilted {
  transform: translateX(14px) rotate(9deg);
}

.runaway-horse-sprite {
  position: absolute;
  left: -90px;
  bottom: 4px;
  width: 82px;
  height: 62px;
  z-index: 20;
  pointer-events: none;
  animation: horseGallop 1.65s cubic-bezier(0.25, 0.7, 0.4, 1) forwards;
}

@keyframes horseGallop {
  0% { transform: translateX(0) translateY(0); }
  25% { transform: translateX(130px) translateY(-10px) rotate(-4deg); }
  50% { transform: translateX(250px) translateY(2px) rotate(4deg); }
  75% { transform: translateX(380px) translateY(-12px) rotate(-3deg); }
  100% { transform: translateX(520px) translateY(0); opacity: 0.9; }
}

/* ================= Stage 3 ================= */
.s3-scene {
  position: relative;
  height: 220px;
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: #DCEBFF;
  user-select: none;
  touch-action: none;
}

.s3-photo-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.s3-sun-hit {
  position: absolute;
  top: 12px;
  left: 16px;
  width: 72px;
  height: 62px;
  cursor: pointer;
  z-index: 5;
  display: grid;
  place-items: center;
}

.s3-sun-shades {
  background: rgba(16, 42, 67, 0.85);
  color: #FDE047;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
}

.s3-piece {
  position: absolute;
  top: 86px;
  width: 68px;
  height: 68px;
  z-index: 6;
  pointer-events: none;
  filter: drop-shadow(0 4px 8px rgba(16, 42, 67, 0.25));
}

.s3-hole {
  position: absolute;
  top: 86px;
  width: 68px;
  height: 68px;
  z-index: 7;
  cursor: grab;
  touch-action: none;
  transition: left 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.s3-hole.dragging-hole {
  transition: none;
  cursor: grabbing;
  transform: scale(1.06);
}

.s3-hole-bubble {
  position: absolute;
  top: -32px;
  left: 50%;
  transform: translateX(-50%);
  background: #102A43;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
}

.s3-track-wrap {
  margin-top: 14px;
  position: relative;
  padding: 4px 0;
}

.s3-track {
  position: relative;
  height: 46px;
  background: #EDF2F7;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  display: flex;
  align-items: center;
  padding: 0 58px 0 64px;
  font-size: 13px;
  color: var(--ink-soft);
  user-select: none;
  touch-action: none;
}

.s3-track-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 999px;
  background: rgba(27, 79, 216, 0.14);
  pointer-events: none;
}

.s3-knob {
  position: absolute;
  left: 4px;
  top: 4px;
  width: 52px;
  height: 36px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 800;
  cursor: grab;
  box-shadow: 0 3px 10px rgba(27, 79, 216, 0.35);
  touch-action: none;
  z-index: 4;
}

.s3-knob:active {
  cursor: grabbing;
}

.s3-endcap {
  position: absolute;
  right: -2px;
  top: -2px;
  width: 14px;
  height: 48px;
  background: #829AB1;
  border-radius: 0 999px 999px 0;
  transform-origin: bottom center;
  transition: transform 0.35s ease, background 0.2s ease;
}

.s3-endcap.broken {
  background: var(--red);
  transform: rotate(78deg) translate(8px, 6px);
}

.s3-push-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  z-index: 5;
  animation: pulsePop 0.9s infinite alternate;
}

@keyframes pulsePop {
  from { transform: translateY(-50%) scale(1); }
  to { transform: translateY(-50%) scale(1.08); }
}

.s3-readout {
  margin-top: 10px;
  font-size: 13px;
  color: var(--ink-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ================= Stage 4 ================= */
.s4-arena {
  position: relative;
  min-height: 280px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #F9FBFD;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  overflow: hidden;
}

.s4-timer-box {
  position: relative;
  text-align: center;
  padding: 12px 24px;
  border-radius: 14px;
  background: #fff;
  border: 2px solid var(--border);
  min-width: 210px;
  cursor: pointer;
  user-select: none;
}

.s4-timer-box.is-broken {
  border-color: var(--red);
  background: #FFF6F6;
}

.s4-digits {
  font-size: 52px;
  font-weight: 900;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  line-height: 1.05;
}

.s4-timer-box.is-broken .s4-digits {
  color: var(--red);
}

.s4-subtip {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 6px;
}

.s4-mosquito {
  position: absolute;
  width: 68px;
  height: 58px;
  z-index: 15;
  cursor: crosshair;
  padding: 2px;
}

.s4-mosquito svg {
  width: 100%;
  height: 100%;
  display: block;
  animation: mosquitoHover 0.35s ease-in-out infinite alternate;
}

@keyframes mosquitoHover {
  from { transform: translate(0, 0) rotate(-6deg); }
  to { transform: translate(7px, -6px) rotate(6deg); }
}

.s4-splat {
  position: absolute;
  width: 56px;
  height: 56px;
  z-index: 14;
  pointer-events: none;
}

.s4-redpacket {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 118px;
  cursor: pointer;
  z-index: 12;
  filter: drop-shadow(0 6px 14px rgba(217, 45, 32, 0.25));
  animation: slideInRight 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideInRight {
  from { transform: translateX(120px) rotate(12deg); opacity: 0; }
  to { transform: translateX(0) rotate(-3deg); opacity: 1; }
}

.s4-redpacket-result {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 175px;
  background: #FFF5F5;
  border: 1px solid #FECACA;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  color: #991B1B;
  z-index: 13;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.s4-rebel-guy {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 12;
  animation: peekIn 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes peekIn {
  from { transform: translateY(70px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.s4-dont-press {
  appearance: none;
  border: 2px solid #991B1B;
  background: radial-gradient(circle at 35% 30%, #FF6B6B, #D92D20);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 0 #7F1D1D;
}

.s4-dont-press:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #7F1D1D;
}

.s4-repairman {
  position: absolute;
  right: 18px;
  top: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 16;
  animation: peekIn 0.3s ease-out;
}

.s4-repair-bubble {
  background: #102A43;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 10px;
}

.s4-choice-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  z-index: 15;
}

.s4-duck-drop {
  position: absolute;
  top: -30px;
  width: 34px;
  height: 34px;
  pointer-events: none;
  z-index: 20;
  animation: duckRain 1.4s linear forwards;
}

@keyframes duckRain {
  to { transform: translateY(330px) rotate(220deg); opacity: 0.2; }
}

/* ================= Stage 5 ================= */
.s5-desktop {
  position: relative;
  min-height: 410px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at 18% 20%, rgba(59, 130, 246, 0.12), transparent 45%),
    linear-gradient(180deg, #EAF1FB 0%, #DCE6F7 100%);
  overflow: hidden;
  padding: 12px 14px;
  user-select: none;
  touch-action: none;
}

.s5-hint-strip {
  font-size: 12px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.85);
  border-radius: 8px;
  padding: 6px 10px;
  display: inline-block;
}

.s5-trash {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 74px;
  padding: 6px 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.8);
  border: 2px dashed transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  z-index: 3;
}

.s5-trash.trash-hot {
  transform: scale(1.12);
  border-color: var(--blue);
  background: #fff;
}

.s5-popup {
  position: absolute;
  left: 22px;
  top: 46px;
  width: min(350px, calc(100% - 44px));
  border-radius: 12px;
  border: 3px solid #D97706;
  background: linear-gradient(160deg, #FFF7CC 0%, #FFE4B5 48%, #FFD6D6 100%);
  box-shadow: 0 14px 28px rgba(127, 29, 29, 0.25);
  z-index: 10;
  cursor: grab;
  overflow: hidden;
  touch-action: none;
}

.s5-popup.is-dragging {
  cursor: grabbing;
  box-shadow: 0 22px 36px rgba(16, 42, 67, 0.32);
}

.s5-popup.is-dizzy {
  animation: dizzyWobble 0.45s ease-in-out infinite alternate;
}

@keyframes dizzyWobble {
  from { transform: rotate(-2deg); }
  to { transform: rotate(2deg); }
}

.s5-popup-bar {
  background: linear-gradient(90deg, #DC2626, #EA580C, #D97706);
  color: #fff;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
}

.s5-skip-pill {
  border: none;
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  cursor: pointer;
}

.s5-close-x {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-weight: 900;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.s5-peel-tag {
  position: absolute;
  right: 8px;
  top: 34px;
  background: #102A43;
  color: #FDE047;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  transform: rotate(7deg);
  pointer-events: none;
}

.s5-popup-content {
  padding: 10px 14px 14px;
  text-align: center;
  position: relative;
}

.s5-ad-photo {
  width: 100%;
  max-width: 240px;
  height: 118px;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid #F59E0B;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.28);
  margin: 2px auto 6px;
  display: block;
}

.s5-ad-title {
  font-size: 16px;
  font-weight: 900;
  color: #991B1B;
  margin: 4px 0;
}

.s5-ad-sub {
  font-size: 12px;
  color: #7C2D12;
  margin-bottom: 10px;
}

.s5-ad-btns {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.s5-btn-claim {
  border: none;
  background: linear-gradient(90deg, #EF4444, #F59E0B);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(239, 68, 68, 0.35);
}

.s5-btn-realclose {
  border: 2px solid #0F9D58;
  background: #E6F7EE;
  color: #065F46;
  font-size: 14px;
  font-weight: 800;
  padding: 9px 18px;
  border-radius: 10px;
  cursor: pointer;
}

.s5-crack-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20;
}

.s5-nested-dialog {
  margin-top: 10px;
  padding: 9px;
  border-radius: 9px;
  background: #fff;
  border: 1px solid #FCA5A5;
  font-size: 12px;
  color: #7F1D1D;
}

.s5-shatter-shard {
  position: absolute;
  width: 26px;
  height: 22px;
  background: linear-gradient(135deg, #FFE4B5, #FFF);
  border: 1px solid #D97706;
  pointer-events: none;
  z-index: 25;
  animation: shardFly 0.65s ease-out forwards;
}

@keyframes shardFly {
  to {
    transform: translate(var(--tx, 60px), var(--ty, 90px)) rotate(var(--rot, 180deg)) scale(0.3);
    opacity: 0;
  }
}

/* ================= Stage 6 ================= */
.s6-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.s6-canvas-box {
  position: relative;
  width: 100%;
  height: 250px;
  border-radius: 12px;
  border: 2px solid var(--border-strong);
  background: #fff;
  overflow: hidden;
  touch-action: none;
}

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

.s6-canvas-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  color: var(--ink-muted);
  font-size: 13px;
}

.s6-laser {
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, transparent, #1B4FD8, #00D4FF, #1B4FD8, transparent);
  box-shadow: 0 0 12px rgba(27, 79, 216, 0.7);
  top: 0;
  pointer-events: none;
  animation: laserScan 0.85s ease-in-out;
}

@keyframes laserScan {
  0% { top: 0; }
  50% { top: 96%; }
  100% { top: 0; }
}

.s6-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.s6-result-box {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.55;
}

/* ================= Finale ================= */
.finale-doors {
  position: relative;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #F0F7FF 0%, #FFFFFF 100%);
  padding: 16px;
  overflow: hidden;
}

.door-curtain {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  background: linear-gradient(135deg, #1B4FD8, #102A43);
  z-index: 30;
  pointer-events: none;
  transition: transform 0.75s cubic-bezier(0.22, 1, 0.36, 1);
}

.door-curtain.left { left: 0; }
.door-curtain.right { right: 0; }
.finale-doors.is-open .door-curtain.left { transform: translateX(-102%); }
.finale-doors.is-open .door-curtain.right { transform: translateX(102%); }

.duck-stage {
  text-align: center;
  padding: 8px 10px 14px;
  border-bottom: 1px dashed var(--border-strong);
}

.duck-btn {
  appearance: none;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 4px;
  transition: transform 0.14s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.duck-btn.is-squished {
  transform: scaleX(1.16) scaleY(0.82);
}

.duck-photo {
  width: 138px;
  height: 138px;
  object-fit: cover;
  border-radius: 20px;
  border: 2px solid #FDE68A;
  box-shadow: 0 8px 20px rgba(217, 119, 6, 0.2);
  display: block;
}

.duck-quack-pop {
  position: absolute;
  top: -8px;
  right: -14px;
  background: #DC2626;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  padding: 3px 9px;
  border-radius: 999px;
  transform: rotate(10deg);
  box-shadow: 0 3px 8px rgba(220, 38, 38, 0.35);
  pointer-events: none;
}

.duck-quack-pop.hidden {
  display: none;
}

.duck-quote {
  display: inline-block;
  margin-top: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  color: #92400E;
  font-size: 13px;
  font-weight: 700;
}

.cert-card {
  position: relative;
  margin-top: 14px;
  background: #FFFEFA;
  border: 2px solid #1E3A8A;
  border-radius: 12px;
  padding: 14px;
  box-shadow: inset 0 0 0 3px #EBF2FF;
}

.cert-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #CBD5E1;
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.cert-title {
  font-size: 15px;
  font-weight: 900;
  color: #1E3A8A;
}

.cert-body {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  align-items: center;
}

.cert-art-frame {
  width: 92px;
  height: 92px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 4px;
}

.cert-art-frame img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.cert-art-cap {
  font-size: 10px;
  color: var(--ink-muted);
  text-align: center;
  margin-top: 3px;
}

.cert-stats {
  font-size: 12px;
  line-height: 1.65;
  color: var(--ink);
}

.cert-stamp-slot {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 94px;
  height: 94px;
  pointer-events: none;
  opacity: 0;
  transform: scale(1.6) rotate(-18deg);
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
}

.cert-stamp-slot.stamped {
  opacity: 0.92;
  transform: scale(1) rotate(-12deg);
}

.finale-actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
}

/* Modal & Achievements */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 42, 67, 0.45);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 80;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-panel {
  width: 100%;
  max-width: 540px;
  max-height: 82vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 24px 48px rgba(16, 42, 67, 0.24);
  padding: 18px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
}

.modal-sub {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--ink-soft);
}

.modal-close {
  border: 1px solid var(--border);
  background: var(--surface-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

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

.ach-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 11px;
  background: var(--surface-muted);
}

.ach-item.unlocked {
  background: #F0F6FF;
  border-color: #BFDBFE;
}

.ach-item-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}

.ach-item-desc {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 4px;
  line-height: 1.4;
}

/* Toast */
.toast-box {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: #102A43;
  color: #fff;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(16, 42, 67, 0.25);
  z-index: 90;
  max-width: calc(100vw - 32px);
  text-align: center;
  pointer-events: none;
}

.toast-box.hidden {
  display: none;
}

/* Creator Debug Bar (?c) */
.creator-bar {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 95;
  background: rgba(16, 42, 67, 0.94);
  color: #fff;
  border-radius: 12px;
  padding: 8px 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
  max-width: calc(100vw - 24px);
}

.creator-bar.hidden {
  display: none;
}

.creator-title {
  font-size: 11px;
  font-weight: 800;
  color: #93C5FD;
  margin-bottom: 6px;
}

.creator-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.creator-btns button {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.creator-btns button:hover {
  background: rgba(59, 130, 246, 0.6);
}

/* Safe mode */
body.safe-mode .verify-card.card-shake,
body.safe-mode .s5-popup.is-dizzy,
body.safe-mode .s4-mosquito svg,
body.safe-mode .s3-push-btn {
  animation: none !important;
}

/* Mobile Responsive */
@media (max-width: 560px) {
  .topbar {
    padding: 12px 14px 6px;
  }
  .brand-title {
    font-size: 15px;
  }
  .hud-btn {
    font-size: 12px;
    padding: 6px 10px;
  }
  .main-wrap {
    padding: 0 10px;
    margin-top: 8px;
  }
  .card-head {
    padding: 12px 14px 6px;
  }
  .status-banner {
    margin: 0 14px 12px;
    font-size: 13px;
  }
  .stage-body {
    padding: 2px 14px 16px;
  }
  .card-foot {
    padding: 10px 14px;
    font-size: 11px;
  }
  .s2-grid {
    gap: 6px;
  }
  .s4-digits {
    font-size: 42px;
  }
  .cert-body {
    grid-template-columns: 1fr;
  }
  .cert-art-frame {
    margin: 0 auto;
  }
  .ach-grid {
    grid-template-columns: 1fr;
  }
}
