/* ==========================================================================
   《惡魔的條款 / FINE PRINT》 v2.0 — Museum-Grade Swiss Editorial Design System
   ========================================================================== */

:root {
  --paper: #f3efe5;
  --paper-bright: #faf8f2;
  --paper-dark: #e6e0d0;
  --ink: #111110;
  --ink-soft: #4a4842;
  --ink-muted: #78746a;
  --line: #181816;
  --line-subtle: #cdc6b6;

  --deck-bg: #131312;
  --deck-surface: #1c1c1a;
  --deck-surface-2: #252522;
  --deck-line: #31312c;
  --deck-text: #f3f1ea;
  --deck-muted: #9a968b;

  --hl-yellow: #f4ff00;
  --stamp-red: #c41e1e;
  --stamp-red-dark: #941414;
  --ok-green: #147a49;
  --warn-amber: #d97706;

  --font-sans: "Helvetica Neue", "PingFang TC", "Noto Sans TC", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: "Songti TC", "Noto Serif TC", "STSong", "Georgia", serif;
  --font-mono: "SF Mono", "Menlo", "IBM Plex Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

.hidden {
  display: none !important;
}

/* Tactile paper grain overlay */
.paper-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.048;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

mark.hl,
mark.hl-strong {
  background: linear-gradient(104deg, rgba(244, 255, 0, 0) 0.8%, var(--hl-yellow) 2.5%, var(--hl-yellow) 96.5%, rgba(244, 255, 0, 0) 98.5%);
  color: var(--ink);
  padding: 0.04em 0.28em;
  border-radius: 1px;
  font-weight: 700;
}
mark.hl-strong {
  background: var(--hl-yellow);
  box-shadow: 0 1px 0 rgba(17, 17, 16, 0.14);
}

.screen {
  display: none;
  min-height: 100vh;
}
.screen.active {
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   SCREEN 1: TITLE / SWISS LEGAL DOSSIER WITH BINDER STRIP
   ========================================================================== */
.screen-title {
  padding: 20px;
  justify-content: center;
  align-items: center;
  background:
    linear-gradient(to right, rgba(17, 17, 16, 0.045) 1px, transparent 1px) 0 0 / 44px 44px,
    linear-gradient(to bottom, rgba(17, 17, 16, 0.045) 1px, transparent 1px) 0 0 / 44px 44px,
    var(--paper);
}

.dossier-frame {
  width: 100%;
  max-width: 1280px;
  background: var(--paper-bright);
  border: 2.5px solid var(--ink);
  box-shadow: 12px 12px 0 rgba(17, 17, 16, 0.92);
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
}

.binder-strip {
  background: var(--paper-dark);
  border-right: 2px solid var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 34px 0;
}
.punch-hole {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: inset 2px 2px 3px rgba(17, 17, 16, 0.22);
}
.binder-code {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--ink-muted);
}

.dossier-content {
  display: flex;
  flex-direction: column;
}

.dossier-topbar {
  display: grid;
  grid-template-columns: 1.3fr 1fr 0.9fr auto;
  border-bottom: 2px solid var(--ink);
}

.meta-cell {
  padding: 10px 16px;
  border-right: 1px solid var(--line-subtle);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.meta-cell:last-child {
  border-right: none;
}
.meta-right {
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.meta-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
  text-transform: uppercase;
}
.meta-val {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}
.tag-red {
  color: var(--stamp-red);
}

.icon-toggle {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  background: transparent;
  border: 1.5px solid var(--ink);
  color: var(--ink);
  padding: 6px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, color 0.15s;
}
.icon-toggle:hover {
  background: var(--ink);
  color: var(--hl-yellow);
}
.sound-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok-green);
}
.icon-toggle.muted .sound-dot {
  background: var(--stamp-red);
}

.dossier-hero {
  display: grid;
  grid-template-columns: 1.28fr 0.92fr;
}

.hero-left {
  padding: 34px 36px;
  border-right: 2px solid var(--ink);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.swiss-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}
.kicker-num {
  background: var(--stamp-red);
  color: #fff;
  padding: 2px 7px;
  font-weight: 800;
}

.main-title {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  line-height: 1.02;
}
.title-zh {
  font-family: var(--font-serif);
  font-size: clamp(40px, 4.8vw, 60px);
  font-weight: 900;
  letter-spacing: -0.02em;
}
.title-en {
  font-family: var(--font-sans);
  font-size: clamp(20px, 2.3vw, 28px);
  font-weight: 900;
  letter-spacing: 0.14em;
  color: var(--stamp-red);
  display: flex;
  align-items: center;
  gap: 10px;
}
.title-ver {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--ink);
  color: var(--hl-yellow);
  padding: 2px 8px;
  letter-spacing: 0.06em;
}

.hero-lead {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.78;
  color: var(--ink-soft);
}

.mode-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.mode-card {
  text-align: left;
  background: var(--paper);
  border: 1.5px solid var(--line-subtle);
  padding: 12px 13px;
  cursor: pointer;
  transition: all 0.14s ease;
  color: var(--ink);
}
.mode-card:hover {
  border-color: var(--ink);
}
.mode-card.selected {
  background: var(--paper-bright);
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
}
.mode-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: 4px;
}
.mode-code {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
}
.mode-badge {
  font-family: var(--font-mono);
  font-size: 9.5px;
  padding: 2px 5px;
  background: var(--hl-yellow);
  font-weight: 800;
}
.mode-badge.badge-red {
  background: var(--stamp-red);
  color: #fff;
}
.mode-badge.badge-dark {
  background: var(--ink);
  color: var(--hl-yellow);
}
.mode-name {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 4px;
}
.mode-desc {
  font-size: 11.5px;
  line-height: 1.48;
  color: var(--ink-soft);
}

.start-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: stretch;
  margin-top: 2px;
}

.btn-primary-stamp {
  background: var(--ink);
  color: var(--paper-bright);
  border: 2px solid var(--ink);
  padding: 13px 22px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 800;
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
  box-shadow: 4px 4px 0 var(--stamp-red);
}
.btn-primary-stamp:hover {
  background: var(--stamp-red);
  border-color: var(--stamp-red);
  box-shadow: 4px 4px 0 var(--ink);
  transform: translate(-1px, -1px);
}
.btn-primary-stamp:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}
.btn-primary-stamp .btn-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--hl-yellow);
  font-weight: 600;
}
.btn-primary-stamp.small {
  padding: 10px 18px;
  font-size: 13.5px;
  flex-direction: row;
  align-items: center;
}

.btn-ghost-swiss {
  background: transparent;
  color: var(--ink);
  border: 2px solid var(--ink);
  padding: 10px 16px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
}
.btn-ghost-swiss:hover {
  background: var(--hl-yellow);
}
.btn-ghost-swiss.btn-ink {
  background: var(--paper-dark);
}

.hero-right {
  padding: 32px 30px;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.sample-contract-card {
  position: relative;
  background: var(--paper-bright);
  border: 1.5px solid var(--ink);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.seal-svg {
  pointer-events: none;
  mix-blend-mode: multiply;
  opacity: 0.9;
}
.seal-tilted {
  position: absolute;
  top: -12px;
  right: 8px;
  transform: rotate(-12deg);
}

.sample-header {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  padding-bottom: 10px;
  border-bottom: 1.5px solid var(--ink);
  padding-right: 90px;
}

.sample-clause {
  margin: 0 0 10px;
  font-family: var(--font-serif);
  font-size: 14.5px;
  line-height: 1.8;
}
.sample-fine {
  margin: 0;
  font-size: 11px;
  line-height: 1.6;
  color: var(--ink-muted);
}

.sample-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-top: 1.5px solid var(--line-subtle);
  padding-top: 12px;
  gap: 10px;
}
.stat-k {
  display: block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--ink-muted);
}
.stat-v {
  font-size: 14px;
  font-weight: 800;
}

.highscore-strip {
  border: 1.5px solid var(--ink);
  background: var(--paper-bright);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.hs-label {
  font-size: 13px;
  font-weight: 800;
}
.hs-sub {
  font-size: 10.5px;
  color: var(--ink-muted);
  margin-top: 2px;
}
.hs-val {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 800;
  color: var(--stamp-red);
}

.dossier-footer {
  border-top: 2px solid var(--ink);
  padding: 10px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-muted);
  background: var(--paper);
}
.barcode-visual {
  letter-spacing: -1px;
  font-weight: 900;
  color: var(--ink);
  opacity: 0.55;
}

/* ==========================================================================
   MODALS: PLAYBOOK & CODEX ARCHIVE
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 17, 16, 0.68);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-sheet {
  width: 100%;
  max-width: 780px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--paper-bright);
  border: 2.5px solid var(--ink);
  box-shadow: 10px 10px 0 var(--ink);
}
.modal-sheet-wide {
  max-width: 960px;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 22px;
  border-bottom: 2px solid var(--ink);
  flex-shrink: 0;
}
.modal-head h2 {
  margin: 4px 0 0;
  font-size: 21px;
  font-family: var(--font-serif);
}
.btn-close-modal {
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--ink);
  background: transparent;
  font-size: 16px;
  cursor: pointer;
}
.btn-close-modal:hover {
  background: var(--ink);
  color: var(--paper-bright);
}
.playbook-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 22px;
  overflow-y: auto;
}
.pb-card {
  border: 1.5px solid var(--ink);
  padding: 15px;
  background: var(--paper);
}
.pb-num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  background: var(--ink);
  color: var(--hl-yellow);
  display: inline-block;
  padding: 2px 6px;
  margin-bottom: 8px;
}
.pb-card h3 {
  margin: 0 0 6px;
  font-size: 15.5px;
}
.pb-card p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--ink-soft);
}
.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--line-subtle);
  display: flex;
  justify-content: flex-end;
}

/* Codex Tabs & Cards */
.codex-tabs {
  display: flex;
  border-bottom: 2px solid var(--ink);
  background: var(--paper);
  flex-shrink: 0;
}
.codex-tab {
  flex: 1;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-right: 1.5px solid var(--ink);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  color: var(--ink-soft);
}
.codex-tab:last-child {
  border-right: none;
}
.codex-tab.active {
  background: var(--ink);
  color: var(--hl-yellow);
}
.codex-body {
  padding: 18px 22px;
  overflow-y: auto;
}
.codex-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.codex-item {
  border: 1.5px solid var(--ink);
  background: var(--paper-bright);
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.codex-item.locked {
  background: var(--paper);
  border-style: dashed;
  border-color: var(--line-subtle);
  opacity: 0.65;
}
.codex-item-head {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
}
.rarity-pill {
  padding: 1px 5px;
  border: 1px solid var(--ink);
  font-size: 9px;
}
.rarity-legendary {
  background: var(--stamp-red);
  color: #fff;
  border-color: var(--stamp-red);
}
.rarity-rare {
  background: var(--hl-yellow);
  color: var(--ink);
}
.codex-item-text {
  font-family: var(--font-serif);
  font-size: 12.5px;
  line-height: 1.55;
}

.ach-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.ach-card {
  border: 1.5px solid var(--ink);
  background: var(--paper-bright);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.ach-card.locked {
  opacity: 0.5;
  background: var(--paper);
  border-style: dashed;
}
.ach-icon {
  width: 40px;
  height: 40px;
  background: var(--ink);
  color: var(--hl-yellow);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ach-card.locked .ach-icon {
  background: var(--line-subtle);
  color: var(--ink-muted);
}
.ach-name {
  font-size: 13.5px;
  font-weight: 800;
}
.ach-desc {
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-top: 2px;
}

/* ==========================================================================
   SCREEN 2: MAIN GAME WORKBENCH
   ========================================================================== */
.screen-game {
  height: 100vh;
  overflow: hidden;
  background: var(--deck-bg);
}

.hud-bar {
  height: 60px;
  background: var(--paper-bright);
  border-bottom: 2px solid var(--ink);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-shrink: 0;
  transition: box-shadow 0.2s;
}
.hud-bar.heat-critical {
  box-shadow: inset 0 -3px 0 var(--stamp-red);
}

.hud-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.hud-logo-box {
  width: 34px;
  height: 34px;
  background: var(--ink);
  color: var(--hl-yellow);
  font-family: var(--font-mono);
  font-weight: 900;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hud-title {
  font-size: 13.5px;
  font-weight: 900;
}
.hud-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-muted);
}

.hud-metrics {
  display: flex;
  align-items: center;
  gap: 16px;
}
.hud-metric {
  display: flex;
  flex-direction: column;
  padding-left: 14px;
  border-left: 1px solid var(--line-subtle);
}
.hud-k {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}
.hud-v {
  font-size: 19px;
  font-weight: 900;
  line-height: 1.1;
}

.hud-timer-box.urgent .hud-v {
  color: var(--stamp-red);
  animation: pulseUrgent 0.5s infinite alternate;
}
@keyframes pulseUrgent {
  from { transform: scale(1); }
  to { transform: scale(1.07); }
}

.hud-heat-box {
  width: 150px;
}
.heat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.hud-heat-pct {
  font-size: 11px;
  font-weight: 800;
}
.heat-track {
  height: 8px;
  background: var(--paper-dark);
  border: 1.5px solid var(--ink);
  margin-top: 4px;
  overflow: hidden;
}
.heat-fill {
  height: 100%;
  width: 0%;
  background: var(--ink);
  transition: width 0.16s linear, background 0.2s;
}
.heat-fill.warn {
  background: var(--warn-amber);
}
.heat-fill.danger {
  background: var(--stamp-red);
}

.hud-controls {
  display: flex;
  gap: 8px;
}
.hud-btn {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  padding: 6px 10px;
  border: 1.5px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.hud-btn:hover {
  background: var(--ink);
  color: var(--paper-bright);
}
.hud-btn-danger:hover {
  background: var(--stamp-red);
  border-color: var(--stamp-red);
}

/* Workbench Split */
.workbench {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.52fr) minmax(370px, 0.98fr);
}

/* LEFT PANE */
.pane-sandbox {
  background: var(--paper-dark);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-height: 0;
  border-right: 2px solid var(--ink);
}

/* VP Boss Directive Strip */
.vp-directive-bar {
  background: var(--ink);
  color: var(--paper-bright);
  border: 1.5px solid var(--ink);
  border-left: 5px solid var(--hl-yellow);
  padding: 7px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  flex-shrink: 0;
  animation: slideDownIn 0.24s ease-out;
}
@keyframes slideDownIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.vp-badge {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 800;
  background: var(--hl-yellow);
  color: var(--ink);
  padding: 2px 6px;
  flex-shrink: 0;
}
.vp-text {
  flex: 1;
  font-weight: 700;
}
.vp-reward {
  font-size: 11px;
  font-weight: 800;
  color: var(--hl-yellow);
  flex-shrink: 0;
}

.victim-dossier-bar {
  background: var(--paper-bright);
  border: 1.5px solid var(--ink);
  padding: 9px 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.victim-identity {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.victim-avatar {
  width: 42px;
  height: 42px;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.victim-name-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.victim-name {
  font-size: 14.5px;
  font-weight: 800;
}
.victim-tag {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 800;
  padding: 1px 6px;
  background: var(--ink);
  color: var(--hl-yellow);
}
.victim-mult {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  color: var(--stamp-red);
}
.victim-trait {
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-top: 2px;
}

.victim-meters {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}
.v-meter {
  width: 124px;
}
.v-meter-head {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  margin-bottom: 4px;
}
.v-track {
  height: 7px;
  background: var(--paper-dark);
  border: 1px solid var(--ink);
}
.v-fill {
  height: 100%;
  width: 0%;
  transition: width 0.1s linear;
}
.v-fill-red {
  background: var(--stamp-red);
}
.v-fill-ink {
  background: var(--ink);
}

/* Browser Shell */
.browser-shell {
  flex: 1;
  min-height: 0;
  background: var(--paper-bright);
  border: 2px solid var(--ink);
  box-shadow: 6px 6px 0 rgba(17, 17, 16, 0.24);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
.browser-shell.shake {
  animation: stampShake 0.32s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
@keyframes stampShake {
  10%, 90% { transform: translate3d(-2px, 1px, 0); }
  20%, 80% { transform: translate3d(3px, -2px, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 2px, 0); }
  40%, 60% { transform: translate3d(4px, -1px, 0); }
}

.browser-chrome {
  height: 36px;
  background: var(--paper);
  border-bottom: 1.5px solid var(--ink);
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}
.browser-dots {
  display: flex;
  gap: 6px;
}
.b-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
}
.browser-url {
  flex: 1;
  background: var(--paper-bright);
  border: 1px solid var(--line-subtle);
  padding: 3px 8px;
  font-size: 11px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}
.url-scenario-pill {
  background: var(--ink);
  color: var(--hl-yellow);
  font-size: 9px;
  font-weight: 800;
  padding: 1px 5px;
  flex-shrink: 0;
}
.browser-tab-close {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  background: transparent;
  border: 1px solid var(--line-subtle);
  padding: 3px 8px;
  color: var(--ink-soft);
  pointer-events: none;
}

.browser-viewport {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--paper-bright);
}

.doc-watermark {
  position: absolute;
  top: 52%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-24deg);
  font-family: var(--font-mono);
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: rgba(17, 17, 16, 0.032);
  white-space: nowrap;
  pointer-events: none;
  z-index: 1;
}

/* Cookie Layout Shift Trap Banner */
.trap-cookie-banner {
  max-height: 0;
  overflow: hidden;
  background: var(--ink);
  color: var(--paper-bright);
  border-bottom: 0 solid var(--hl-yellow);
  transition: max-height 0.14s cubic-bezier(0.2, 0.9, 0.2, 1), border-bottom-width 0.14s;
  flex-shrink: 0;
  z-index: 20;
}
.trap-cookie-banner.open {
  max-height: 116px;
  border-bottom-width: 3px;
}
.cookie-inner {
  padding: 11px 16px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.cookie-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--hl-yellow);
  font-weight: 800;
}
.cookie-text {
  font-size: 11.5px;
  line-height: 1.45;
  color: #e4e1d8;
}
.cookie-btns {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 2px;
}
.cookie-btn-accept {
  background: var(--hl-yellow);
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
}
.cookie-btn-manage {
  font-size: 10px;
  color: #8a877e;
  text-decoration: underline;
}

.trap-urgency-bar {
  background: var(--stamp-red);
  color: #fff;
  padding: 6px 14px;
  font-size: 11.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  z-index: 18;
}
.urgency-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--hl-yellow);
  animation: pulseUrgent 0.4s infinite alternate;
}

/* Scrollable Legal Contract */
.contract-scroll-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 26px 34px;
  position: relative;
  z-index: 2;
}

.legal-doc {
  max-width: 660px;
  margin: 0 auto;
}
.legal-doc.doc-enter {
  animation: docSlideIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes docSlideIn {
  from { opacity: 0; transform: translateX(26px); }
  to { opacity: 1; transform: translateX(0); }
}

.legal-header {
  border-bottom: 2px solid var(--ink);
  padding-bottom: 10px;
  margin-bottom: 14px;
}
.legal-doc-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--ink-muted);
  margin-bottom: 5px;
}
.legal-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 900;
}
.legal-subtitle {
  margin: 3px 0 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.clauses-container {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.clause-block {
  padding: 10px 12px;
  border-left: 3px solid var(--line-subtle);
  background: rgba(244, 241, 232, 0.55);
  transition: box-shadow 0.14s;
}
.clause-block.is-devil {
  border-left-color: var(--ink);
  background: rgba(244, 255, 0, 0.24);
}
.clause-block.is-reading {
  box-shadow: inset 4px 0 0 var(--stamp-red), 0 0 0 1.5px rgba(196, 30, 30, 0.4);
}
.clause-block.is-flood {
  font-family: var(--font-mono);
  font-size: 10px !important;
  color: var(--ink-muted);
  border-left-color: #d6d1c4;
  background: transparent;
  padding: 5px 10px;
  line-height: 1.5;
}

.clause-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
}
.clause-devil-badge {
  background: var(--hl-yellow);
  color: var(--ink);
  padding: 1px 5px;
  font-size: 9px;
  border: 1px solid var(--ink);
}
.clause-devil-badge.legendary {
  background: var(--stamp-red);
  color: #fff;
  border-color: var(--stamp-red);
}
.clause-text {
  margin: 0;
  font-family: var(--font-serif);
  line-height: 1.72;
}

.prechecked-maze {
  margin-top: 14px;
  border: 1px dashed var(--ink);
  background: var(--paper);
  padding: 11px 13px;
}
.maze-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  margin-bottom: 7px;
}
.maze-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink-soft);
  margin-bottom: 5px;
}

.scroll-abyss {
  overflow: hidden;
  transition: height 0.14s ease;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.6;
}
.abyss-wall {
  padding: 11px 0;
  border-top: 1px dotted var(--line-subtle);
  border-bottom: 1px dotted var(--line-subtle);
  margin: 10px 0;
  opacity: 0.65;
}

/* Contract Action Buttons */
.contract-actions {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 2px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  min-height: 76px;
}
.contract-actions.swapped {
  flex-direction: row-reverse;
}
.action-slot {
  display: flex;
  align-items: center;
}

.doc-btn {
  font-family: var(--font-sans);
  font-weight: 800;
  cursor: default;
  border: 2px solid var(--ink);
  padding: 11px 20px;
  font-size: 13.5px;
  transition: all 0.15s ease;
  pointer-events: none;
}
.doc-btn-agree {
  background: var(--ink);
  color: var(--paper-bright);
}
.doc-btn-decline {
  background: var(--paper-bright);
  color: var(--ink);
  transition: transform 0.14s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.15s;
}
.doc-btn-decline.targeted {
  outline: 2.5px solid var(--stamp-red);
  outline-offset: 3px;
  animation: targetPulse 0.32s infinite alternate;
}
@keyframes targetPulse {
  from { box-shadow: 0 0 0 0 rgba(196, 30, 30, 0.55); }
  to { box-shadow: 0 0 0 8px rgba(196, 30, 30, 0); }
}

.contract-actions.hijacked .doc-btn-agree {
  background: #0f8a4c;
  border-color: #095930;
  color: #ffffff;
  font-size: 16.5px;
  padding: 15px 28px;
  box-shadow: 0 4px 14px rgba(15, 138, 76, 0.35);
}
.contract-actions.hijacked .doc-btn-decline {
  border: none;
  background: transparent;
  font-size: 10.5px;
  font-weight: 500;
  padding: 4px 6px;
  color: #b8b3a6;
  text-decoration: underline;
}

/* Trap 2: Confirm-Shaming Modal */
.trap-modal {
  position: absolute;
  inset: 0;
  background: rgba(17, 17, 16, 0.58);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  padding: 18px;
}
.trap-modal-card {
  width: 100%;
  max-width: 410px;
  background: var(--paper-bright);
  border: 2.5px solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
  padding: 20px;
  text-align: center;
}
.trap-modal-kicker {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  color: var(--stamp-red);
  margin-bottom: 6px;
}
.trap-modal-title {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 900;
}
.trap-modal-desc {
  margin: 0 0 15px;
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.55;
}
.trap-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 9px;
  align-items: center;
}
.shaming-btn-yes {
  width: 100%;
  background: #0f8a4c;
  color: #fff;
  padding: 11px 16px;
  font-weight: 800;
  font-size: 13.5px;
  border: 2px solid var(--ink);
}
.shaming-btn-no {
  font-size: 11px;
  color: var(--ink-muted);
  text-decoration: underline;
  padding: 4px 8px;
}

/* Trap 3: Fake Close Popup */
.trap-fake-close {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 32;
  width: 336px;
}
.fake-close-card {
  position: relative;
  background: var(--hl-yellow);
  border: 2.5px solid var(--ink);
  box-shadow: 7px 7px 0 var(--ink);
  padding: 18px;
  color: var(--ink);
}
.fake-close-x {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border: 1.5px solid var(--ink);
  background: var(--paper-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 900;
}
.fake-close-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  margin-bottom: 4px;
}
.fake-close-headline {
  font-size: 16.5px;
  font-weight: 900;
  margin-bottom: 6px;
}
.fake-close-sub {
  font-size: 11px;
  line-height: 1.45;
}

/* Trap 8: Captcha Hell Modal */
.captcha-card {
  width: 326px;
  background: var(--paper-bright);
  border: 2.5px solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
  overflow: hidden;
}
.captcha-head {
  background: var(--ink);
  color: var(--paper-bright);
  padding: 12px 14px;
}
.captcha-kicker {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--hl-yellow);
  font-weight: 800;
  margin-bottom: 3px;
}
.captcha-prompt {
  font-size: 13px;
  line-height: 1.4;
}
.captcha-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 10px;
  background: var(--paper);
}
.cap-cell {
  height: 62px;
  background: var(--paper-bright);
  border: 1.5px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}
.cap-cell.picked {
  background: rgba(244, 255, 0, 0.55);
  border-color: var(--stamp-red);
}
.captcha-foot {
  padding: 10px;
  border-top: 1.5px solid var(--ink);
  text-align: center;
}
.captcha-skip-agree {
  background: #0f8a4c;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  padding: 9px 12px;
  border: 1.5px solid var(--ink);
}

/* Audit Freeze Overlay */
.audit-overlay {
  position: absolute;
  inset: 0;
  background: rgba(196, 30, 30, 0.14);
  border: 4px solid var(--stamp-red);
  z-index: 40;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 16px;
  pointer-events: none;
}
.audit-box {
  background: var(--stamp-red);
  color: #fff;
  padding: 12px 18px;
  border: 2px solid var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
  text-align: center;
  max-width: 440px;
}
.audit-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--hl-yellow);
  font-weight: 800;
}
.audit-title {
  font-size: 17px;
  font-weight: 900;
  margin: 2px 0;
}
.audit-desc {
  font-size: 12px;
}

/* Outcome Stamp Overlay */
.outcome-overlay {
  position: absolute;
  inset: 0;
  background: rgba(244, 241, 232, 0.54);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 45;
  pointer-events: none;
}
.outcome-stamp {
  border: 5px solid var(--stamp-red);
  padding: 6px;
  background: rgba(250, 248, 242, 0.94);
  color: var(--stamp-red);
  transform: rotate(-10deg) scale(1);
  animation: slamStamp 0.25s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
  text-align: center;
  min-width: 280px;
}
.outcome-stamp.escaped {
  border-color: var(--ink);
  color: var(--ink);
  transform: rotate(7deg);
}
.outcome-stamp-top {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  border-bottom: 1.5px solid currentColor;
  padding: 4px 12px;
}
.outcome-stamp-main {
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 0.06em;
  padding: 8px 16px;
}
.outcome-stamp-sub {
  font-size: 13px;
  font-weight: 800;
  border-top: 1.5px solid currentColor;
  padding: 5px 12px;
}
@keyframes slamStamp {
  0% { opacity: 0; transform: rotate(-18deg) scale(2.2); }
  100% { opacity: 0.96; transform: rotate(-10deg) scale(1); }
}

/* Floating FX Popups */
.fx-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 44;
  overflow: hidden;
}
.fx-float {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 900;
  background: var(--ink);
  color: var(--hl-yellow);
  border: 1.5px solid var(--hl-yellow);
  padding: 3px 8px;
  white-space: nowrap;
  animation: fxRise 1.05s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.fx-float.red {
  background: var(--stamp-red);
  color: #fff;
  border-color: var(--ink);
}
@keyframes fxRise {
  0% { opacity: 0; transform: translate(-50%, 6px) scale(0.8); }
  18% { opacity: 1; transform: translate(-50%, -10px) scale(1.06); }
  100% { opacity: 0; transform: translate(-50%, -56px) scale(0.95); }
}

.callout-stack {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 42;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}
.callout-pill {
  background: var(--ink);
  color: var(--hl-yellow);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 800;
  padding: 6px 11px;
  border: 1.5px solid var(--hl-yellow);
  box-shadow: 3px 3px 0 rgba(17, 17, 16, 0.4);
  animation: calloutIn 0.22s ease-out;
}
.callout-pill.red {
  background: var(--stamp-red);
  color: #fff;
  border-color: var(--ink);
}
@keyframes calloutIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* AI Cursor Layer */
.ai-cursor-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 38;
  overflow: hidden;
}
.ai-cursor {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform;
}
.cursor-windup-svg {
  position: absolute;
  top: -17px;
  left: -17px;
}
.cursor-svg {
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}
.cursor-click-ring {
  position: absolute;
  top: -8px;
  left: -8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2.5px solid var(--stamp-red);
  opacity: 0;
  transform: scale(0.4);
}
.cursor-click-ring.pulse {
  animation: clickPulse 0.36s ease-out;
}
@keyframes clickPulse {
  0% { opacity: 1; transform: scale(0.3); }
  100% { opacity: 0; transform: scale(2.1); }
}
.ai-thought {
  position: absolute;
  left: 22px;
  top: -6px;
  background: var(--ink);
  color: var(--paper-bright);
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 10px;
  white-space: nowrap;
  max-width: 255px;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1.5px solid var(--hl-yellow);
  box-shadow: 3px 3px 0 rgba(17, 17, 16, 0.25);
}
.ai-thought.flip-left {
  left: auto;
  right: 22px;
}

/* ==========================================================================
   RIGHT PANE: DARK UX CONTROL DECK
   ========================================================================== */
.pane-controls {
  background: var(--deck-bg);
  color: var(--deck-text);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  min-height: 0;
}

.deck-section {
  background: var(--deck-surface);
  border: 1px solid var(--deck-line);
  padding: 11px 13px;
}

.deck-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--deck-line);
}
.deck-num {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  background: var(--hl-yellow);
  color: var(--ink);
  padding: 1px 5px;
}
.deck-title {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  flex: 1;
}
.deck-kbd-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--deck-muted);
}
.deck-mini-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  background: transparent;
  color: var(--hl-yellow);
  border: 1px solid var(--deck-line);
  padding: 3px 8px;
  cursor: pointer;
}
.deck-mini-btn:hover {
  border-color: var(--hl-yellow);
  background: rgba(244, 255, 0, 0.14);
}

.control-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.ctrl-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ctrl-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
}
.ctrl-en {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--deck-muted);
  font-weight: 500;
  margin-left: 4px;
}
.ctrl-val {
  font-size: 11.5px;
  color: var(--hl-yellow);
  font-weight: 800;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: #2f2f2b;
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  background: var(--hl-yellow);
  border: 2px solid var(--ink);
  cursor: pointer;
}

.toggle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 2px;
}
.dark-toggle {
  text-align: left;
  background: var(--deck-surface-2);
  border: 1px solid var(--deck-line);
  color: var(--deck-text);
  padding: 8px 9px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: all 0.13s;
}
.dark-toggle:hover {
  border-color: var(--hl-yellow);
}
.dark-toggle.active {
  background: rgba(244, 255, 0, 0.14);
  border-color: var(--hl-yellow);
}
.dt-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}
.dt-name {
  font-size: 11.5px;
  font-weight: 800;
}
.dt-state {
  font-family: var(--font-mono);
  font-size: 9.5px;
  padding: 1px 5px;
  background: #353530;
  color: var(--deck-muted);
}
.dark-toggle.active .dt-state {
  background: var(--hl-yellow);
  color: var(--ink);
  font-weight: 800;
}
.dt-desc {
  font-size: 10px;
  line-height: 1.3;
  color: var(--deck-muted);
}

/* 8 Active Trap Buttons */
.trap-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.trap-btn {
  position: relative;
  text-align: left;
  background: var(--deck-surface-2);
  border: 1.5px solid var(--deck-line);
  color: var(--deck-text);
  padding: 8px 9px 10px;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.1s, border-color 0.12s, background 0.12s;
}
.trap-btn:hover:not(:disabled) {
  border-color: var(--hl-yellow);
  background: #2e2e29;
}
.trap-btn:active:not(:disabled) {
  transform: translateY(1px);
}
.trap-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.trap-btn.recommended {
  border-color: var(--hl-yellow);
  box-shadow: 0 0 0 1.5px var(--hl-yellow);
  animation: recPulse 0.42s infinite alternate;
}
@keyframes recPulse {
  from { background: #2e2e29; }
  to { background: #3e3e1c; }
}
.trap-btn-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.trap-key {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 900;
  background: var(--paper-bright);
  color: var(--ink);
  padding: 1px 5px;
}
.trap-heat {
  font-family: var(--font-mono);
  font-size: 9px;
  color: #f87171;
}
.trap-name {
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 2px;
}
.trap-sub {
  font-size: 10px;
  line-height: 1.3;
  color: var(--deck-muted);
}
.trap-cd-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 0%;
  background: var(--hl-yellow);
}

/* Telemetry Log */
.deck-log {
  background: #0d0d0c;
  border: 1px solid var(--deck-line);
  padding: 9px 11px;
  flex: 1;
  min-height: 82px;
  display: flex;
  flex-direction: column;
}
.log-head {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--deck-muted);
  margin-bottom: 5px;
}
.log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
}
.log-item {
  color: #cfccc3;
  line-height: 1.4;
}
.log-item.good {
  color: var(--hl-yellow);
}
.log-item.bad {
  color: #f87171;
}

/* ==========================================================================
   SCREEN 3: RESULT & CERTIFICATE
   ========================================================================== */
.screen-result {
  padding: 24px 20px 40px;
  background:
    linear-gradient(to right, rgba(17, 17, 16, 0.04) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(to bottom, rgba(17, 17, 16, 0.04) 1px, transparent 1px) 0 0 / 40px 40px,
    var(--paper);
}

.result-shell {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.result-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 14px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 14px;
}
.result-heading {
  margin: 4px 0 0;
  font-family: var(--font-serif);
  font-size: 27px;
  font-weight: 900;
}
.result-top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.result-grid {
  display: grid;
  grid-template-columns: 1.48fr 0.88fr;
  gap: 22px;
  align-items: start;
}

.cert-stage {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cert-paper {
  background: var(--paper-bright);
  border: 3px solid var(--ink);
  padding: 12px;
  box-shadow: 10px 10px 0 rgba(17, 17, 16, 0.9);
}
.cert-border-inner {
  border: 1.5px solid var(--ink);
  padding: 24px 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}

.cert-head-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 12px;
}
.cert-dept-en {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
}
.cert-dept-zh {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 900;
  margin-top: 2px;
}
.cert-serial {
  font-size: 11px;
  font-weight: 800;
  background: var(--ink);
  color: var(--hl-yellow);
  padding: 4px 8px;
}

.cert-grade-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.cert-small-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  margin-bottom: 4px;
}
.cert-name-input {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 900;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 2px dashed var(--line-subtle);
  padding: 2px 0;
  width: 100%;
  max-width: 360px;
  outline: none;
}
.cert-name-input:focus {
  border-bottom-color: var(--stamp-red);
  background: rgba(244, 255, 0, 0.25);
}
.cert-rank-title {
  margin-top: 6px;
  font-size: 16px;
  font-weight: 800;
  color: var(--stamp-red);
}
.cert-rank-comment {
  margin-top: 3px;
  font-size: 13px;
  color: var(--ink-soft);
}
.cert-grade-badge {
  width: 82px;
  height: 82px;
  border: 3px solid var(--ink);
  background: var(--hl-yellow);
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 4px 4px 0 var(--ink);
}

.cert-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1.5px solid var(--ink);
}
.cert-kpi {
  padding: 11px;
  border-right: 1px solid var(--ink);
  background: var(--paper);
}
.cert-kpi:last-child {
  border-right: none;
}
.cert-kpi-k {
  font-size: 11px;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.cert-kpi-v {
  font-size: 23px;
  font-weight: 900;
}

.cert-tactic-box {
  background: rgba(244, 255, 0, 0.35);
  border: 1.5px solid var(--ink);
  padding: 12px 15px;
}
.cert-tactic-name {
  font-size: 16.5px;
  font-weight: 900;
  margin-bottom: 3px;
}
.cert-tactic-desc {
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.5;
}

.cert-clauses-box {
  border-top: 1px solid var(--line-subtle);
  padding-top: 12px;
}
.cert-clauses-list {
  margin: 6px 0 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-family: var(--font-serif);
  font-size: 13px;
  line-height: 1.5;
}

.cert-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding-top: 14px;
  border-top: 2px solid var(--ink);
  gap: 12px;
}
.sig-line {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 20px;
  border-bottom: 1.5px solid var(--ink);
  padding-bottom: 2px;
  min-width: 190px;
}
.sig-caption {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--ink-muted);
  margin-top: 4px;
}
.cert-date {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
}
.cert-red-stamp {
  color: var(--stamp-red);
  border: 3px solid var(--stamp-red);
  padding: 3px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  mix-blend-mode: multiply;
  transform: rotate(-8deg);
}
.cert-red-stamp.slam {
  animation: certStampSlam 0.35s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}
@keyframes certStampSlam {
  0% { opacity: 0; transform: rotate(-18deg) scale(2.1); }
  100% { opacity: 0.92; transform: rotate(-8deg) scale(1); }
}
.stamp-inner {
  border: 1.5px solid var(--stamp-red);
  padding: 5px 10px;
  text-align: center;
}
.stamp-top,
.stamp-bot {
  font-size: 8.5px;
  letter-spacing: 0.14em;
  font-weight: 700;
}
.stamp-big {
  font-size: 14.5px;
  font-weight: 900;
  letter-spacing: 0.08em;
  margin: 2px 0;
}

.cert-edit-tip {
  font-size: 11.5px;
  color: var(--ink-muted);
  font-family: var(--font-mono);
}

.result-breakdown {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.bd-card {
  background: var(--paper-bright);
  border: 2px solid var(--ink);
  padding: 15px;
}
.bd-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  border-bottom: 1.5px solid var(--ink);
  padding-bottom: 7px;
  margin-bottom: 9px;
}
.bd-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 12.5px;
}
.bd-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 6px;
  border-bottom: 1px dotted var(--line-subtle);
  gap: 8px;
}
.bd-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.bd-tag-ok {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  background: var(--hl-yellow);
  border: 1px solid var(--ink);
  padding: 1px 5px;
}
.bd-tag-miss {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-muted);
  border: 1px solid var(--line-subtle);
  padding: 1px 5px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--hl-yellow);
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 800;
  padding: 10px 18px;
  border: 1.5px solid var(--hl-yellow);
  box-shadow: 5px 5px 0 rgba(17, 17, 16, 0.35);
  z-index: 800;
}

@media (max-width: 1060px) {
  .dossier-frame {
    grid-template-columns: 1fr;
  }
  .binder-strip {
    display: none;
  }
  .dossier-topbar {
    grid-template-columns: 1fr 1fr;
  }
  .dossier-hero {
    grid-template-columns: 1fr;
  }
  .hero-left {
    border-right: none;
    border-bottom: 2px solid var(--ink);
    padding: 24px;
  }
  .screen-game {
    height: auto;
    overflow: auto;
  }
  .workbench {
    grid-template-columns: 1fr;
  }
  .pane-sandbox {
    min-height: 600px;
    border-right: none;
    border-bottom: 2px solid var(--ink);
  }
  .result-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .mode-selector,
  .playbook-grid,
  .codex-grid,
  .ach-grid,
  .cert-kpi-grid {
    grid-template-columns: 1fr;
  }
  .hud-bar {
    height: auto;
    padding: 10px;
    flex-wrap: wrap;
  }
  .victim-dossier-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}
