/* ==========================================================================
   《绝对证明你是人类（2026地狱验证）》Style System (Scheme A+: Neo-Civic -> Pop Chaos)
   ========================================================================== */
:root {
  --bg-page: #EEF1F6;
  --bg-card: #FFFFFF;
  --bg-stage: #F7F9FC;
  --border-card: #D4DCE8;
  --border-comic: #18191C;

  --brand-blue: #00AEEC;
  --brand-blue-dark: #008FC5;
  --brand-pink: #FB7299;
  --safe-green: #00B578;
  --warn-amber: #FF9F1C;
  --rage-red: #FF3B5C;
  --bsod-blue: #0A2472;
  --terminal-bg: #0D1117;

  --text-main: #18191C;
  --text-sub: #555C66;
  --text-muted: #8E96A4;

  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
  --font-serif: "Songti SC", "STSong", "Noto Serif SC", "SimSun", Georgia, serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  overscroll-behavior: none;
  font-family: var(--font-sans);
  color: var(--text-main);
  background-color: var(--bg-page);
  background-image:
    linear-gradient(rgba(24, 25, 28, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 25, 28, 0.04) 1px, transparent 1px);
  background-size: 22px 22px;
  transition: background-color 0.45s ease;
}

body[data-mood="bsod"] {
  background-color: var(--bsod-blue);
  background-image: none;
}

body[data-mood="terminal"] {
  background-color: var(--terminal-bg);
  background-image: radial-gradient(rgba(126, 231, 135, 0.06) 1px, transparent 1px);
  background-size: 18px 18px;
}

body[data-mood="cert"] {
  background-color: #E7E2D7;
  background-image: none;
}

.tabular {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   Layout Shell & Top HUD
   ========================================================================== */
.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) 12px max(18px, env(safe-area-inset-bottom));
  gap: 10px;
  position: relative;
}

.hud {
  width: min(calc(100vw - 24px), 420px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  z-index: 10;
}

.hud-left, .hud-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hud-pill {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  border: 1.5px solid var(--border-card);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.hud-lv {
  color: var(--brand-blue-dark);
}

.hud-sus.warn {
  border-color: var(--warn-amber);
  color: #C76A00;
  background: #FFF7E6;
}

.hud-sus.danger {
  border-color: var(--rage-red);
  color: var(--rage-red);
  background: #FFF0F3;
}

.hud-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1.5px solid var(--border-card);
  background: rgba(255, 255, 255, 0.92);
  font-size: 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, border-color 0.15s ease;
}

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

/* ==========================================================================
   Main bCAPTCHA Card
   ========================================================================== */
.card {
  width: min(calc(100vw - 24px), 420px);
  background: var(--bg-card);
  border: 1.5px solid var(--border-card);
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.09);
  overflow: hidden;
  position: relative;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card.rage-border {
  border-color: var(--rage-red);
  box-shadow: 0 0 0 3px rgba(255, 59, 92, 0.2), 0 12px 32px rgba(255, 59, 92, 0.14);
}

.card.bsod-mode {
  background: var(--bsod-blue);
  border-color: rgba(255, 255, 255, 0.35);
  color: #FFFFFF;
}

.card.terminal-mode {
  background: var(--terminal-bg);
  border-color: #30363D;
  color: #E6EDF3;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px 11px;
  border-bottom: 1px solid #E7ECF3;
  background: #FFFFFF;
}

.card.bsod-mode .card-header,
.card.terminal-mode .card-header {
  background: transparent;
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-shield {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand-blue), #25C5FF);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(0, 174, 236, 0.28);
}

.brand-meta {
  min-width: 0;
}

.brand-org {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  line-height: 1.1;
}

.level-title {
  margin: 2px 0 0;
  font-size: 16.5px;
  font-weight: 800;
  line-height: 1.25;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card.bsod-mode .level-title,
.card.terminal-mode .level-title {
  color: #FFFFFF;
}

.version-chip {
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 3px 8px;
  border-radius: 999px;
  background: #EEF2F8;
  color: var(--text-sub);
  flex-shrink: 0;
}

.card.bsod-mode .version-chip,
.card.terminal-mode .version-chip {
  background: rgba(255, 255, 255, 0.14);
  color: #E2E8F0;
}

.level-prompt {
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-sub);
  background: #FAFBFE;
  border-bottom: 1px solid #EEF2F7;
  line-height: 1.45;
}

.card.bsod-mode .level-prompt,
.card.terminal-mode .level-prompt {
  background: rgba(255, 255, 255, 0.05);
  border-bottom-color: rgba(255, 255, 255, 0.1);
  color: #CBD5E1;
}

/* Interactive Stage Container */
.stage {
  position: relative;
  min-height: 360px;
  padding: 14px;
  background: var(--bg-stage);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.stage.allow-scroll {
  touch-action: pan-y;
}

.card.bsod-mode .stage {
  background: var(--bsod-blue);
}

.card.terminal-mode .stage {
  background: var(--terminal-bg);
}

/* Roast Feedback Bar */
.roast-bar {
  min-height: 44px;
  padding: 9px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  border-top: 1px solid #E7ECF3;
  background: #FFFFFF;
  color: var(--text-sub);
  line-height: 1.35;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.roast-bar[data-mood="roast"] {
  background: #FFF1F3;
  color: #D91E41;
}

.roast-bar[data-mood="warn"] {
  background: #FFF8E7;
  color: #B45309;
}

.roast-bar[data-mood="win"] {
  background: #ECFDF5;
  color: #047857;
}

.card.bsod-mode .roast-bar,
.card.terminal-mode .roast-bar {
  background: rgba(0, 0, 0, 0.25);
  border-top-color: rgba(255, 255, 255, 0.12);
  color: #FDE68A;
}

.roast-icon {
  font-size: 15px;
  flex-shrink: 0;
}

/* Footer */
.card-footer {
  height: 44px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-muted);
  background: #FAFBFE;
  border-top: 1px solid #EEF2F7;
}

.card.bsod-mode .card-footer,
.card.terminal-mode .card-footer {
  background: rgba(0, 0, 0, 0.2);
  border-top-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.55);
}

.skip-btn {
  padding: 5px 10px;
  border-radius: 8px;
  border: 1.5px dashed var(--rage-red);
  background: #FFF1F3;
  color: var(--rage-red);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  animation: dodgePop 0.3s ease;
}

.skip-btn:active {
  transform: scale(0.95);
}

/* Pass Flash Overlay */
.pass-flash {
  position: absolute;
  inset: 0;
  background: rgba(0, 181, 120, 0.16);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  pointer-events: none;
}

.pass-flash-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: 14px;
  background: #FFFFFF;
  border: 2.5px solid var(--safe-green);
  box-shadow: 0 12px 28px rgba(0, 181, 120, 0.26);
  animation: dodgePop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pass-check {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--safe-green);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 18px;
}

.pass-flash-msg {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
}

/* ==========================================================================
   Common Buttons & Comic Pop Accents
   ========================================================================== */
.btn-primary, .btn-secondary, .btn-outline, .btn-pink, .btn-danger, .btn-green {
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 11px;
  font-size: 14.5px;
  font-weight: 800;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.12s ease, opacity 0.15s ease, filter 0.15s ease;
}

.btn-primary:active, .btn-secondary:active, .btn-outline:active,
.btn-pink:active, .btn-danger:active, .btn-green:active {
  transform: scale(0.96);
}

.btn-primary {
  background: var(--brand-blue);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(0, 174, 236, 0.3);
}

.btn-green {
  background: var(--safe-green);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(0, 181, 120, 0.28);
}

.btn-danger {
  background: var(--rage-red);
  color: #FFFFFF;
  border: 2.5px solid var(--border-comic);
  box-shadow: 3px 3px 0 var(--border-comic);
}

.btn-pink {
  background: var(--brand-pink);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(251, 114, 153, 0.28);
}

.btn-secondary {
  background: #EEF2F8;
  color: var(--text-main);
  border: 1.5px solid var(--border-card);
}

.btn-outline {
  background: #FFFFFF;
  color: var(--text-main);
  border: 1.5px solid var(--border-card);
}

.btn-mini {
  padding: 5px 10px;
  border-radius: 8px;
  border: 1.5px solid var(--border-card);
  background: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
}

.btn-disabled {
  background: #E2E8F0;
  color: #94A3B8;
  border: 1.5px solid #CBD5E1;
  cursor: not-allowed;
}

.comic-box {
  border: 2.5px solid var(--border-comic);
  box-shadow: 4px 4px 0 var(--border-comic);
}

.stage-canvas {
  display: block;
  width: 100%;
  border-radius: 12px;
  background: #FFFFFF;
  border: 1.5px solid #DCE3EE;
  touch-action: none;
}

/* ==========================================================================
   Level-Specific Component Styles
   ========================================================================== */

/* Lv.1 Runaway Checkbox */
.lv1-bar {
  width: 100%;
  padding: 16px 14px;
  border-radius: 12px;
  background: #FFFFFF;
  border: 1.5px solid #D4DCE8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}

.lv1-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lv1-slot {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1.5px dashed #CBD5E1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #94A3B8;
}

.lv1-runner {
  position: absolute;
  width: 48px;
  height: 52px;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  transition: left 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), top 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 8;
}

.lv1-box {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: #FFFFFF;
  border: 2.5px solid var(--brand-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 13px;
  color: var(--text-main);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

.lv1-runner.escaped .lv1-box {
  border-color: var(--border-comic);
  box-shadow: 3px 3px 0 var(--border-comic);
}

.lv1-runner.caught .lv1-box {
  background: var(--safe-green);
  border-color: var(--safe-green);
  color: #FFFFFF;
  font-size: 20px;
}

/* Lv.2 3x3 Grid */
.grid-3x3 {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.grid-tile {
  aspect-ratio: 1 / 1;
  background: #FFFFFF;
  border: 2px solid #D8E0EC;
  border-radius: 12px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  position: relative;
  transition: transform 0.14s ease, border-color 0.14s ease, background-color 0.14s ease;
}

.grid-tile.selected {
  border-color: var(--brand-blue);
  background: #E8F8FF;
  transform: scale(0.95);
}

.grid-tile.selected::after {
  content: "✓";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--brand-blue);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}

.grid-tile.flipped {
  animation: dodgePop 0.3s ease;
}

.grid-tile-label {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--text-main);
  text-align: center;
  line-height: 1.15;
}

/* Lv.3 Slider Track */
.slider-track {
  width: 100%;
  height: 48px;
  margin-top: 12px;
  border-radius: 12px;
  background: #E8EEF6;
  border: 1.5px solid #CBD5E1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
  touch-action: none;
}

.slider-thumb {
  position: absolute;
  left: 4px;
  top: 4px;
  width: 52px;
  height: 38px;
  border-radius: 9px;
  background: var(--brand-blue);
  color: #FFFFFF;
  font-size: 18px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(0, 174, 236, 0.35);
  cursor: grab;
  touch-action: none;
}

.slider-thumb:active {
  cursor: grabbing;
  background: var(--brand-blue-dark);
}

/* Lv.4 Agreement Scrollbox */
.tos-box {
  width: 100%;
  height: 230px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #FFFFFF;
  border: 1.5px solid #D4DCE8;
  border-radius: 10px;
  padding: 12px;
  font-size: 12.5px;
  line-height: 1.65;
  color: #374151;
  touch-action: pan-y;
}

.tos-secret {
  color: #0086B8;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px dotted rgba(0, 134, 184, 0.55);
  cursor: pointer;
  padding: 2px 2px;
  border-radius: 3px;
}

.tos-secret:active {
  background: rgba(0, 174, 236, 0.16);
}

/* Lv.5 Blind Stopwatch */
.blind-clock-wrap {
  width: 100%;
  height: 140px;
  border-radius: 14px;
  background: #18191C;
  color: #00FF9D;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  border: 2.5px solid #2D323B;
}

.blind-clock-num {
  font-size: 46px;
  font-weight: 900;
  letter-spacing: 1px;
}

.blind-mask {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    #FFF4B8,
    #FFF4B8 14px,
    #FFE57F 14px,
    #FFE57F 28px
  );
  color: #18191C;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 16px;
  border: 3px solid #18191C;
  animation: stampSlam 0.2s ease forwards;
}

/* Lv.7 Crank Charger */
.battery-shell {
  width: 100%;
  height: 44px;
  border-radius: 12px;
  border: 2.5px solid #18191C;
  background: #FFFFFF;
  padding: 4px;
  position: relative;
  overflow: hidden;
}

.battery-fill {
  height: 100%;
  border-radius: 7px;
  background: linear-gradient(90deg, #FF3B5C, #FF9F1C, #00B578);
  transition: width 0.08s linear;
}

.battery-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 15px;
  color: #18191C;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.9);
}

.crank-wheel {
  width: 146px;
  height: 146px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #FFFFFF, #DDE5F0);
  border: 3px solid #18191C;
  box-shadow: 0 6px 0 #18191C;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
}

.crank-arm {
  position: absolute;
  width: 58px;
  height: 12px;
  background: var(--brand-blue);
  border: 2px solid #18191C;
  border-radius: 6px;
  transform-origin: left center;
  left: 50%;
  top: calc(50% - 6px);
}

.crank-knob {
  position: absolute;
  right: -12px;
  top: -8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--rage-red);
  border: 2.5px solid #18191C;
}

.thief-chip {
  padding: 6px 10px;
  border-radius: 999px;
  background: #FFF1F3;
  border: 2px solid var(--rage-red);
  color: var(--rage-red);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  animation: dodgePop 0.25s ease, pulseBait 1s infinite;
}

/* Lv.8 Red Button */
.big-red-btn {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  border: 4px solid #18191C;
  background: radial-gradient(circle at 35% 30%, #FF6B81, #E0243C 65%, #A61226);
  color: #FFFFFF;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 0 #7A0B1B, 0 16px 24px rgba(224, 36, 60, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px;
  line-height: 1.3;
  position: relative;
  transition: transform 0.1s ease;
}

.big-red-btn.gold-bait {
  background: radial-gradient(circle at 35% 30%, #FFE066, #F59E0B 70%, #B45309);
  color: #18191C;
  box-shadow: 0 10px 0 #78350F, 0 16px 24px rgba(245, 158, 11, 0.4);
}

.big-red-btn:active {
  transform: translateY(5px);
}

/* Lv.10 Poker Table */
.poker-stage {
  width: 100%;
  border-radius: 14px;
  padding: 14px;
  background: radial-gradient(circle at 50% 30%, #176037, #0A331C);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.poker-card {
  width: 210px;
  min-height: 185px;
  background: #FFFFFF;
  border: 2.5px solid #18191C;
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.slam-stamp {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 6;
}

.slam-stamp span {
  padding: 6px 14px;
  border: 4px solid var(--rage-red);
  background: rgba(255, 255, 255, 0.94);
  color: var(--rage-red);
  font-size: 22px;
  font-weight: 900;
  border-radius: 8px;
  animation: stampSlam 0.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Lv.11 Password Capsules */
.pwd-display {
  width: 100%;
  min-height: 46px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #FFFFFF;
  border: 2px solid var(--brand-blue);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 800;
  word-break: break-all;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pwd-rules {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 8px 0;
}

.pwd-rule {
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 8px;
  background: #FFF1F3;
  color: #BE123C;
  border: 1px solid #FECDD3;
}

.pwd-rule.ok {
  background: #ECFDF5;
  color: #047857;
  border-color: #A7F3D0;
}

.pwd-keys {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.pwd-key {
  min-width: 38px;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  background: #FFFFFF;
  border: 1.5px solid #CBD5E1;
  font-weight: 800;
  font-size: 13px;
  color: var(--text-main);
  cursor: pointer;
}

.pwd-key:active {
  transform: scale(0.93);
  background: #E8F8FF;
}

/* Lv.12 Spam Popups */
.spam-popup {
  position: absolute;
  width: 196px;
  background: #FFFFFF;
  border: 2.5px solid #18191C;
  border-radius: 10px;
  box-shadow: 4px 4px 0 #18191C;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

.spam-head {
  padding: 5px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 900;
  color: #FFFFFF;
}

.spam-x {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.25);
  color: #FFFFFF;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.spam-x.real-x {
  background: var(--safe-green);
  border-color: #FFFFFF;
  box-shadow: 0 0 10px rgba(0, 181, 120, 0.9);
  animation: pulseBait 1.3s infinite;
}

.spam-body {
  padding: 10px;
  font-size: 12px;
  font-weight: 700;
  color: #18191C;
  text-align: center;
}

/* Lv.13 Stroop */
.stroop-word {
  font-size: 62px;
  font-weight: 900;
  line-height: 1.1;
  margin: 14px 0 18px;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.08);
}

.stroop-rule-banner {
  width: 100%;
  padding: 8px 12px;
  border-radius: 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 900;
  background: #E8F8FF;
  color: var(--brand-blue-dark);
  border: 2px solid var(--brand-blue);
}

.stroop-rule-banner.flipped {
  background: #FFF0F3;
  color: var(--rage-red);
  border-color: var(--rage-red);
  animation: dodgePop 0.28s ease;
}

/* Lv.16 Rubber Bar */
.rubber-track {
  width: 100%;
  height: 36px;
  border-radius: 10px;
  background: #E2E8F0;
  border: 2px solid #18191C;
  position: relative;
  overflow: visible;
}

.rubber-fill {
  height: 100%;
  border-radius: 8px 0 0 8px;
  background: linear-gradient(90deg, var(--brand-blue), var(--safe-green));
  position: relative;
}

.rubber-handle {
  position: absolute;
  right: -18px;
  top: -7px;
  width: 38px;
  height: 46px;
  border-radius: 10px;
  background: #FFF4B8;
  border: 2.5px solid #18191C;
  box-shadow: 3px 3px 0 #18191C;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 900;
  cursor: grab;
  touch-action: none;
}

/* Lv.20 Terminal */
.terminal-log {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.75;
  color: #7EE787;
  min-height: 175px;
  padding: 6px 4px;
}

.terminal-final-box {
  width: 100%;
  margin-top: 14px;
  padding: 14px;
  border-radius: 12px;
  background: #FFFFFF;
  color: #18191C;
  border: 2px solid #30363D;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  animation: dodgePop 0.35s ease;
}

/* ==========================================================================
   Chapter Interlude, Result Screen, Leaderboard Modal, Debug Bar
   ========================================================================== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
  cursor: pointer;
}

.chapter-card {
  width: min(100%, 360px);
  background: #FFFFFF;
  border: 3px solid #18191C;
  box-shadow: 6px 6px 0 #18191C;
  border-radius: 16px;
  padding: 24px 20px;
  text-align: center;
  animation: dodgePop 0.3s ease;
}

.chapter-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: #18191C;
  color: #FFF4B8;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
}

.chapter-name {
  margin: 12px 0 8px;
  font-size: 20px;
  font-weight: 900;
}

.chapter-desc {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-sub);
  line-height: 1.5;
}

.chapter-hint {
  margin-top: 16px;
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Result Certificate Screen */
.result-screen {
  width: min(calc(100vw - 24px), 430px);
  z-index: 20;
}

.result-card {
  background: #FFFFFF;
  border: 1.5px solid #D4DCE8;
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.12);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-head {
  text-align: center;
}

.result-head h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 900;
}

.result-sub {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--text-sub);
}

.cert-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.cert-img {
  width: 100%;
  max-width: 340px;
  border-radius: 10px;
  border: 1.5px solid #CBD5E1;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.1);
  display: block;
}

.cert-tip {
  font-size: 11.5px;
  color: var(--text-muted);
}

.name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
}

.name-row input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1.5px solid #CBD5E1;
  font-size: 13px;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 60;
}

.modal-panel {
  width: min(100%, 400px);
  max-height: 82dvh;
  background: #FFFFFF;
  border-radius: 16px;
  border: 1.5px solid var(--border-card);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-head {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #EEF2F7;
}

.modal-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: #EEF2F8;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.rank-meta-bar {
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  background: #FAFBFE;
  border-bottom: 1px solid #EEF2F7;
}

.rank-status {
  padding: 8px 16px;
  font-size: 12.5px;
  font-weight: 700;
  background: #FFF8E7;
  color: #B45309;
  border-bottom: 1px solid #FDE68A;
}

.rank-list {
  overflow-y: auto;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rank-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 10px;
  border-radius: 10px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  font-size: 13px;
}

.rank-item.is-me {
  background: #E8F8FF;
  border-color: var(--brand-blue);
  font-weight: 800;
}

.rank-pos {
  width: 28px;
  font-family: var(--font-mono);
  font-weight: 900;
  color: var(--text-sub);
}

.rank-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 8px;
}

.rank-time {
  font-family: var(--font-mono);
  font-weight: 800;
  color: var(--brand-blue-dark);
}

.rank-my-bar {
  padding: 10px 16px;
  border-top: 1px solid #EEF2F7;
  background: #FAFBFE;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-sub);
  text-align: center;
}

/* Debug Toolbar */
.debug-bar {
  position: fixed;
  bottom: max(8px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(24, 25, 28, 0.92);
  color: #FFFFFF;
  border-radius: 999px;
  padding: 5px 8px;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 5px;
  z-index: 70;
  font-size: 11px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  max-width: calc(100vw - 16px);
  overflow-x: auto;
  white-space: nowrap;
}

.debug-bar.collapsed .dbg-controls {
  display: none;
}

.dbg-controls {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 4px;
}

.dbg-toggle, .dbg-btn {
  background: rgba(255, 255, 255, 0.14);
  color: #FFFFFF;
  border: none;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.dbg-select {
  background: #2D323B;
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  padding: 3px 6px;
  font-size: 11px;
  width: 108px;
  flex-shrink: 0;
}

/* Toast */
.toast {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(24, 25, 28, 0.92);
  color: #FFFFFF;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  z-index: 80;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  white-space: nowrap;
}

.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  pointer-events: none;
  z-index: 55;
}

/* ==========================================================================
   Keyframe Animations
   ========================================================================== */
@keyframes rageShake {
  0%, 100% { transform: translateX(0); }
  18% { transform: translateX(-8px) rotate(-0.8deg); }
  38% { transform: translateX(8px) rotate(0.8deg); }
  58% { transform: translateX(-5px); }
  78% { transform: translateX(4px); }
}

.anim-shake {
  animation: rageShake 0.34s ease-in-out;
}

@keyframes stampSlam {
  0% { transform: scale(2.4) rotate(-24deg); opacity: 0; }
  70% { transform: scale(0.94) rotate(-10deg); opacity: 1; }
  100% { transform: scale(1) rotate(-12deg); opacity: 1; }
}

@keyframes glitchTear {
  0% { transform: translate(0); filter: none; }
  22% { transform: translate(-5px, 2px) skewX(6deg); filter: hue-rotate(45deg); }
  48% { transform: translate(6px, -2px) skewX(-5deg); filter: invert(0.18); }
  75% { transform: translate(-3px, 1px); }
  100% { transform: translate(0); filter: none; }
}

.anim-glitch {
  animation: glitchTear 0.34s steps(2, end);
}

@keyframes dodgePop {
  0% { transform: scale(0.86); opacity: 0.6; }
  60% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes pulseBait {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.anim-pulse {
  animation: pulseBait 1.3s ease-in-out infinite;
}
