/* stats-panel.html — trap stage + Norma console */
:root {
  --trap-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --trap-spring: cubic-bezier(0.34, 1.35, 0.64, 1);
  --trap-amber: #e8c07a;
  --trap-pink: #e87898;
  --trap-cyan: #7ec8e3;
  --trap-red: #e06a6a;
  --trap-ink: rgba(248, 244, 238, 0.92);
  --trap-muted: rgba(248, 244, 238, 0.55);
}

body.trap-stage.site-v3 {
  min-height: 100vh;
  overflow-x: hidden;
  background: #07060b;
}

body.trap-stage .stage {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--nav-offset, 78px) + 24px) 16px 52px;
  min-height: calc(100vh - 56px);
}

.trap-aurora,
.trap-floor,
.trap-spark {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.trap-aurora {
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(232, 120, 152, 0.18), transparent 55%),
    radial-gradient(ellipse 60% 40% at 85% 110%, rgba(126, 200, 227, 0.14), transparent 50%),
    radial-gradient(ellipse 50% 30% at 50% 50%, rgba(232, 192, 122, 0.06), transparent 60%);
  animation: trapAurora 14s ease-in-out infinite alternate;
}

.trap-floor {
  z-index: 0;
  opacity: 0.35;
  background:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, transparent 40%, black 85%);
  transform: perspective(500px) rotateX(58deg) scale(1.4);
  transform-origin: 50% 100%;
}

.trap-spark {
  z-index: 1;
  width: 100%;
  height: 100%;
  opacity: 0.55;
}

/* boot overlay */
.trap-boot {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: center;
  background: rgba(4, 3, 8, 0.94);
  transition: opacity 0.55s ease, visibility 0.55s ease;
}

.trap-boot.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.trap-boot__frame {
  width: min(420px, calc(100vw - 40px));
  padding: 28px 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(12, 11, 18, 0.9);
  box-shadow: 0 0 60px rgba(232, 192, 122, 0.08);
}

.trap-boot__tag {
  margin: 0 0 16px;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  color: var(--trap-cyan);
}

.trap-boot__line {
  min-height: 1.6em;
  margin: 0 0 18px;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.95rem;
  color: var(--trap-ink);
}

.trap-boot__line.is-glitch {
  animation: trapGlitch 0.35s steps(2) 2;
  color: var(--trap-red);
}

.trap-boot__bar {
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.trap-boot__bar i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--trap-cyan), var(--trap-amber));
  transition: width 0.35s var(--trap-ease);
}

/* main console */
.trap-console {
  position: relative;
  z-index: 2;
  width: min(700px, calc(100vw - 24px));
  padding: 26px 24px 22px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.015)),
    rgba(10, 9, 15, 0.82);
  box-shadow:
    0 32px 90px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(232, 192, 122, 0.06) inset,
    0 0 80px rgba(126, 200, 227, 0.04);
  backdrop-filter: blur(16px);
  opacity: 0;
  transform: translateY(18px) scale(0.98);
  transition: opacity 0.7s var(--trap-ease), transform 0.7s var(--trap-spring);
}

.trap-console.is-live {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.trap-radar {
  position: absolute;
  top: -40px;
  right: -20px;
  width: 120px;
  height: 120px;
  opacity: 0.35;
}

.trap-radar i {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(126, 200, 227, 0.35);
  border-radius: 50%;
  animation: trapRadar 3.2s linear infinite;
}

.trap-radar i:last-child {
  animation-delay: -1.6s;
  border-color: rgba(232, 192, 122, 0.25);
}

.trap-console__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.trap-chip {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  color: var(--trap-muted);
}

.trap-chip--hot {
  border-color: rgba(232, 120, 152, 0.4);
  background: rgba(232, 120, 152, 0.12);
  color: #f5b8c8;
  animation: trapHot 2.4s ease-in-out infinite;
}

.trap-chip.is-ok {
  border-color: rgba(126, 200, 227, 0.35);
  color: #b8e4f5;
}

.trap-console.is-repeat {
  border-color: rgba(232, 120, 152, 0.22);
  box-shadow:
    0 32px 90px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(232, 120, 152, 0.08) inset,
    0 0 80px rgba(232, 120, 152, 0.05);
}

.trap-console__title.is-wink .trap-glitch {
  animation: trapGlitch 0.28s steps(2) 2;
}

.trap-console.is-repeat .trap-chip--hot {
  animation: none;
  opacity: 0.85;
}

.trap-console__title {
  margin: 0 0 10px;
  font-family: var(--font-display, "Ma Shan Zheng", serif);
  font-size: clamp(2rem, 6.5vw, 2.75rem);
  font-weight: 400;
  line-height: 1.05;
  color: var(--trap-ink);
}

.trap-glitch {
  position: relative;
  display: inline-block;
}

.trap-console.is-live .trap-glitch::before,
.trap-console.is-live .trap-glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  opacity: 0;
}

.trap-console.is-live .trap-glitch::before {
  color: var(--trap-cyan);
  animation: trapGlitchTop 4s infinite 1.2s;
}

.trap-console.is-live .trap-glitch::after {
  color: var(--trap-pink);
  animation: trapGlitchBot 4s infinite 1.6s;
}

.trap-console__sub {
  margin: 0 0 22px;
  color: var(--trap-muted);
  font-size: 0.94rem;
  line-height: 1.7;
}

.trap-odometer {
  margin-bottom: 18px;
  text-align: center;
}

.trap-odometer__label {
  margin: 0 0 8px;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--trap-muted);
}

.trap-odometer__ring {
  position: relative;
  display: inline-grid;
  place-items: center;
  padding: 18px 28px;
}

.trap-odometer__ring::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: conic-gradient(from 0deg, var(--trap-amber), var(--trap-pink), var(--trap-cyan), var(--trap-amber));
  opacity: 0.45;
  animation: trapSpin 6s linear infinite;
  filter: blur(8px);
}

.trap-odometer__num {
  position: relative;
  margin: 0;
  padding: 10px 22px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(6, 5, 10, 0.88);
  font-family: "Courier New", Courier, monospace;
  font-size: clamp(2.4rem, 11vw, 3.6rem);
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--trap-amber);
  text-shadow: 0 0 30px rgba(232, 192, 122, 0.35);
  cursor: default;
  outline: none;
}

.trap-odometer__num.is-pop {
  animation: trapPop 0.55s var(--trap-spring);
}

.trap-odometer__note {
  min-height: 1.2em;
  margin: 10px 0 0;
  font-size: 0.84rem;
  color: rgba(248, 244, 238, 0.45);
}

.trap-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.trap-tag {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transition: opacity 0.4s var(--trap-ease), transform 0.4s var(--trap-spring);
}

.trap-tag.is-show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.trap-tag strong {
  display: block;
  margin-bottom: 3px;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(248, 244, 238, 0.38);
  font-weight: 600;
}

.trap-tag span {
  font-size: 0.86rem;
  color: var(--trap-ink);
}

.trap-meter {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(0, 0, 0, 0.2);
}

.trap-meter__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.trap-meter__head h2 {
  margin: 0;
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(248, 244, 238, 0.55);
}

.trap-meter__grade {
  font-family: var(--font-display, "Ma Shan Zheng", serif);
  font-size: 1.35rem;
  color: var(--trap-amber);
}

.trap-meter__track {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}

.trap-meter__track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6a8fbf, var(--trap-amber) 40%, var(--trap-pink) 75%, var(--trap-red));
  box-shadow: 0 0 16px rgba(232, 192, 122, 0.4);
  transition: width 1s var(--trap-ease);
}

.trap-meter__hint {
  margin: 10px 0 0;
  font-size: 0.84rem;
  color: var(--trap-muted);
  line-height: 1.55;
}

.trap-terminal {
  position: relative;
  margin-bottom: 18px;
  padding: 14px 16px 16px;
  border-radius: 14px;
  border: 1px solid rgba(126, 200, 227, 0.15);
  background: rgba(0, 0, 0, 0.28);
}

.trap-terminal__label {
  margin: 0 0 10px;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--trap-cyan);
}

.trap-terminal__label i {
  margin-right: 6px;
  font-size: 0.65rem;
}

.trap-terminal__body {
  min-height: 4.5em;
  font-size: 0.92rem;
  line-height: 1.8;
  color: rgba(248, 244, 238, 0.86);
  white-space: pre-wrap;
}

.trap-cursor {
  display: inline-block;
  width: 8px;
  height: 1.1em;
  margin-left: 2px;
  background: var(--trap-cyan);
  vertical-align: text-bottom;
  animation: trapBlink 0.9s step-end infinite;
}

.trap-cursor.is-off {
  opacity: 0;
}

.trap-sign {
  margin: 0 0 14px;
  color: rgba(248, 244, 238, 0.5);
  font-size: 0.86rem;
  font-style: italic;
}

.trap-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.trap-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: var(--trap-ink);
  font-size: 0.86rem;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.22s var(--trap-ease), box-shadow 0.22s ease, border-color 0.22s ease;
}

.trap-btn--fake {
  border-color: rgba(232, 192, 122, 0.35);
  background: linear-gradient(135deg, rgba(232, 192, 122, 0.18), rgba(232, 120, 152, 0.1));
  color: #f5e0b8;
}

.trap-btn--fake.is-shake {
  animation: trapShake 0.45s ease;
}

.trap-btn--accent {
  border-color: rgba(126, 200, 227, 0.35);
  color: #c8ecf8;
}

.trap-btn--ghost {
  color: var(--trap-muted);
}

.trap-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.trap-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  z-index: 9500;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 18px;
  border-radius: 12px;
  border: 1px solid rgba(224, 106, 106, 0.4);
  background: rgba(28, 12, 16, 0.92);
  color: #ffc9c9;
  font-size: 0.88rem;
  line-height: 1.5;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateX(-50%) translateY(12px);
  transition: opacity 0.35s ease, transform 0.35s var(--trap-ease);
  pointer-events: none;
}

.trap-toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.trap-pending {
  animation: trapPulse 1s ease-in-out infinite;
}

@keyframes trapAurora {
  from { filter: hue-rotate(0deg); transform: scale(1); }
  to { filter: hue-rotate(18deg); transform: scale(1.04); }
}

@keyframes trapRadar {
  from { transform: scale(0.3); opacity: 0.8; }
  to { transform: scale(1.2); opacity: 0; }
}

@keyframes trapSpin {
  to { transform: rotate(360deg); }
}

@keyframes trapHot {
  0%, 100% { box-shadow: 0 0 0 rgba(232, 120, 152, 0); }
  50% { box-shadow: 0 0 18px rgba(232, 120, 152, 0.25); }
}

@keyframes trapPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes trapGlitch {
  0% { transform: translate(0); }
  25% { transform: translate(-2px, 1px); }
  50% { transform: translate(2px, -1px); }
  75% { transform: translate(-1px, -1px); }
  100% { transform: translate(0); }
}

@keyframes trapGlitchTop {
  0%, 90%, 100% { opacity: 0; transform: translate(0); }
  92% { opacity: 0.7; transform: translate(-2px, -1px); }
  94% { opacity: 0; }
}

@keyframes trapGlitchBot {
  0%, 88%, 100% { opacity: 0; transform: translate(0); }
  90% { opacity: 0.6; transform: translate(2px, 1px); }
  92% { opacity: 0; }
}

@keyframes trapBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes trapPulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

@keyframes trapShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

@media (max-width: 640px) {
  .trap-console {
    padding: 22px 16px 18px;
  }

  .trap-radar {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .trap-aurora,
  .trap-radar i,
  .trap-chip--hot,
  .trap-glitch::before,
  .trap-glitch::after,
  .trap-odometer__ring::before,
  .trap-pending,
  .trap-cursor {
    animation: none !important;
  }

  .trap-boot {
    display: none !important;
  }

  .trap-console {
    opacity: 1;
    transform: none;
  }

  .trap-tag {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
