/* =========================================================
   絶対「A」を押してください — neon4 Edition
   Swiss-Japanese Civic Editorial UI + Kinetic Comedy Physics
   ========================================================= */

:root {
  --bg: #f4f1ea;
  --surface: #ffffff;
  --surface-muted: #f8f6f1;
  --ink: #171614;
  --ink-soft: #5f5a51;
  --border: #dfd9cd;
  --border-strong: #c8c0b1;

  --a-main: #1d4ed8;
  --a-hover: #1e40af;
  --a-lip: #172554;
  --a-glow: rgba(29, 78, 216, 0.28);

  --b-main: #faf9f6;
  --b-ink: #1e1d1b;
  --b-border: #2c2a27;
  --b-lip: #cbc5b9;

  --rebel: #dc2626;
  --rebel-lip: #7f1d1d;
  --warn: #d97706;
  --hazard-yellow: #facc15;
  --hazard-black: #18181b;
  --ok: #15803d;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-card: 0 18px 48px rgba(23, 22, 20, 0.08), 0 2px 6px rgba(23, 22, 20, 0.04);

  --font-sans: "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", "Meiryo", system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "Consolas", monospace;
}

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

[hidden] {
  display: none !important;
}

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

.page-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 18% 12%, rgba(29, 78, 216, 0.06), transparent 42%),
    radial-gradient(circle at 86% 85%, rgba(220, 38, 38, 0.05), transparent 40%),
    radial-gradient(rgba(23, 22, 20, 0.075) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 22px 22px;
  z-index: 0;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 720px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 20px 16px 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}

/* ==================== Top Bar ==================== */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.system-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-soft);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  transition: background-color 0.25s, border-color 0.25s, color 0.25s;
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.18);
  transition: background-color 0.25s, box-shadow 0.25s;
}

.system-badge[data-level="warn"] {
  border-color: #f59e0b;
  color: #92400e;
  background: #fffbeb;
}
.system-badge[data-level="warn"] .badge-dot {
  background: #d97706;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.22);
}

.system-badge[data-level="alert"] {
  border-color: #ef4444;
  color: #991b1b;
  background: #fef2f2;
}
.system-badge[data-level="alert"] .badge-dot {
  background: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.25);
  animation: pulseDot 0.9s infinite;
}

.system-badge[data-level="surrender"] {
  border-color: #a8a29e;
  color: #57534e;
  background: #f5f5f4;
}
.system-badge[data-level="surrender"] .badge-dot {
  background: #78716c;
  box-shadow: none;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.7; }
}

.top-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mock-pill {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.15s, color 0.15s;
}
.icon-btn:hover {
  border-color: var(--border-strong);
  color: var(--ink);
}
.icon-btn:active {
  transform: scale(0.95);
}

/* ==================== Practice Banner ==================== */
.practice-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  font-size: 0.84rem;
  font-weight: 600;
}

.link-btn {
  background: #1d4ed8;
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}
.link-btn:hover { background: #1e40af; }

/* ==================== Main Card ==================== */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 24px 24px 18px;
  overflow: hidden;
}

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

@keyframes cardShake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
  40%, 60% { transform: translate3d(6px, 0, 0); }
}

.card-header {
  text-align: center;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.prompt-heading {
  margin: 0;
  font-size: clamp(1.12rem, 3.2vw, 1.42rem);
  line-height: 1.6;
  font-weight: 600;
  color: var(--ink);
}

.prompt-heading strong {
  color: var(--a-main);
  font-weight: 900;
  text-decoration: underline;
  text-decoration-color: rgba(29, 78, 216, 0.3);
  text-underline-offset: 4px;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.45em;
  height: 1.45em;
  margin: 0 3px;
  border-radius: 6px;
  font-weight: 900;
  font-size: 0.92em;
  vertical-align: 1px;
}
.chip-a {
  background: var(--a-main);
  color: #fff;
}
.chip-b {
  background: var(--surface-muted);
  color: var(--ink);
  border: 1.5px solid var(--b-border);
}

/* ==================== Telemetry Strip ==================== */
.telemetry-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  margin-bottom: 12px;
}

.telemetry-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
}

.telemetry-label {
  color: var(--ink-soft);
  font-weight: 700;
  white-space: nowrap;
}

.defense-meter {
  width: 112px;
  height: 8px;
  border-radius: 999px;
  background: #e5e0d5;
  overflow: hidden;
}

.defense-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2563eb, #f59e0b, #dc2626);
  transition: width 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.telemetry-value, .telemetry-count {
  font-family: var(--font-mono);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.telemetry-count {
  min-width: 28px;
  text-align: center;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
}

.telemetry-count.bump {
  animation: countBump 0.25s ease;
}

@keyframes countBump {
  0% { transform: scale(1); }
  45% { transform: scale(1.28); color: var(--rebel); border-color: #fca5a5; }
  100% { transform: scale(1); }
}

/* ==================== Commentary Box ==================== */
.commentary-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 10px 14px;
  margin-bottom: 14px;
  border-radius: var(--radius-md);
  background: #f8fafc;
  border: 1px solid #dbe4f0;
  transition: background-color 0.25s, border-color 0.25s;
}

.commentary-box[data-mood="warn"] {
  background: #fffbeb;
  border-color: #fde68a;
}
.commentary-box[data-mood="alert"] {
  background: #fef2f2;
  border-color: #fecaca;
}
.commentary-box[data-mood="sad"] {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.commentary-box[data-mood="surrender"] {
  background: #f5f5f4;
  border-color: #d6d3d1;
}

.commentary-tag {
  flex-shrink: 0;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  background: var(--a-main);
  color: #fff;
}
.commentary-box[data-mood="warn"] .commentary-tag { background: #d97706; }
.commentary-box[data-mood="alert"] .commentary-tag { background: #dc2626; }
.commentary-box[data-mood="sad"] .commentary-tag { background: #3b82f6; }
.commentary-box[data-mood="surrender"] .commentary-tag { background: #57534e; }

.commentary-text {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
  font-weight: 600;
  color: var(--ink);
}

.error-banner {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  font-size: 0.86rem;
  font-weight: 700;
}

/* ==================== Arena ==================== */
.arena {
  position: relative;
  width: 100%;
  height: 320px;
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, #faf9f5 0%, #f2eee6 100%);
  border: 1.5px solid var(--border);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.particle-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 25;
  overflow: hidden;
}

/* ==================== Vote Buttons ==================== */
.vote-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 16px;
  font-family: inherit;
  cursor: pointer;
  position: relative;
  transition:
    transform 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.16s ease,
    background-color 0.2s ease,
    border-color 0.2s ease,
    filter 0.2s ease;
}

.vote-btn:focus-visible {
  outline: 3px solid #60a5fa;
  outline-offset: 3px;
}

.btn-letter {
  font-size: 2.35rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.02em;
}

.btn-sub {
  font-size: 0.74rem;
  font-weight: 700;
  opacity: 0.88;
  white-space: nowrap;
}

/* --- Button A --- */
.btn-a {
  position: absolute;
  left: 0;
  top: 0;
  width: 164px;
  height: 106px;
  border: 2px solid #1e3a8a;
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  box-shadow: 0 6px 0 var(--a-lip), 0 12px 24px var(--a-glow);
  z-index: 8;
  will-change: transform;
}

.btn-a:hover {
  background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
  filter: brightness(1.04);
}

.btn-a:active {
  box-shadow: 0 2px 0 var(--a-lip), 0 4px 10px var(--a-glow);
}

.btn-a.a-glow {
  box-shadow:
    0 6px 0 var(--a-lip),
    0 0 0 6px rgba(37, 99, 235, 0.16),
    0 16px 34px rgba(29, 78, 216, 0.42);
}

.btn-a.a-crying {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  animation: subtleSob 0.42s ease-in-out infinite alternate;
}

@keyframes subtleSob {
  0% { filter: brightness(1); }
  100% { filter: brightness(1.06); }
}

.btn-a-badge {
  position: absolute;
  top: -12px;
  right: -10px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #facc15;
  color: #422006;
  font-size: 0.72rem;
  font-weight: 900;
  border: 1.5px solid #ca8a04;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
  transform: rotate(7deg);
}

/* Cute crying face on Button A (Stage 9) */
.btn-a-face {
  position: absolute;
  top: 9px;
  left: 50%;
  transform: translateX(-50%);
  width: 58px;
  height: 24px;
  pointer-events: none;
}

.btn-a-face .eye {
  position: absolute;
  top: 4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ffffff;
}
.btn-a-face .eye.left { left: 11px; }
.btn-a-face .eye.right { right: 11px; }

.btn-a-face .tear {
  position: absolute;
  top: 12px;
  width: 5px;
  height: 9px;
  border-radius: 50% 50% 50% 50% / 35% 35% 65% 65%;
  background: #bae6fd;
  animation: tearDrop 0.85s ease-in infinite;
}
.btn-a-face .tear.left { left: 12px; }
.btn-a-face .tear.right { right: 12px; animation-delay: 0.35s; }

.btn-a-face .mouth {
  position: absolute;
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 7px;
  border-top: 2.5px solid #ffffff;
  border-radius: 50% 50% 0 0;
}

@keyframes tearDrop {
  0% { transform: translateY(0) scale(0.9); opacity: 0.95; }
  100% { transform: translateY(18px) scale(0.6); opacity: 0; }
}

.btn-a.a-crying .btn-letter {
  margin-top: 16px;
  font-size: 2rem;
}

/* --- Button B & Wrapper --- */
.btn-b-wrap {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 10;
  padding: 10px; /* forgiving touch padding when button visually shrinks */
  margin: -10px;
  will-change: transform;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.btn-b-wrap.gravity-drop {
  transition: transform 0.55s cubic-bezier(0.34, 1.48, 0.64, 1);
}

.btn-b-wrap.instant {
  transition: none;
}

.btn-b {
  width: 164px;
  height: 106px;
  border: 2px solid var(--b-border);
  background: var(--b-main);
  color: var(--b-ink);
  box-shadow: 0 6px 0 var(--b-lip), 0 10px 20px rgba(23, 22, 20, 0.08);
  overflow: hidden;
}

.btn-b:hover {
  background: #ffffff;
}

/* Tiny shrunken B (Stage 3) */
.btn-b.b-tiny {
  transform: scale(0.56);
  transform-origin: center center;
}

/* Caution Tape & Cracked Glass (Stage 4-5) */
.hazard-overlay {
  position: absolute;
  inset: -4px;
  z-index: 4;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.34);
  backdrop-filter: blur(1px);
}

.hazard-overlay .tape {
  position: absolute;
  left: -34px;
  right: -34px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #ffffff;
  background: repeating-linear-gradient(
    -45deg,
    var(--hazard-yellow),
    var(--hazard-yellow) 10px,
    var(--hazard-black) 10px,
    var(--hazard-black) 20px
  );
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 0 6px rgba(0, 0, 0, 0.9);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.28);
}

.hazard-overlay .tape-1 {
  top: 24px;
  transform: rotate(-16deg);
}
.hazard-overlay .tape-2 {
  bottom: 22px;
  transform: rotate(15deg);
}

.crack-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Steel Armor (Stage 11-13) */
.armor-hp {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #18181b;
  color: #f4f4f5;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 800;
  white-space: nowrap;
  z-index: 12;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.24);
}

.armor-hp-pips {
  display: inline-flex;
  gap: 3px;
}

.armor-hp-pips .pip {
  width: 10px;
  height: 7px;
  border-radius: 2px;
  background: #3f3f46;
  transition: background-color 0.2s, transform 0.2s;
}
.armor-hp-pips .pip.active {
  background: #ef4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.7);
}

.btn-b.b-armored {
  background: linear-gradient(145deg, #52525b 0%, #27272a 52%, #3f3f46 100%);
  border-color: #18181b;
  color: #f4f4f5;
  box-shadow: 0 6px 0 #09090b, 0 14px 26px rgba(0, 0, 0, 0.3);
}

.armor-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 4px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
}

.armor-overlay .rivet {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #e4e4e7, #52525b);
  box-shadow: inset 0 -1px 1px rgba(0, 0, 0, 0.5);
}
.armor-overlay .r1 { top: 8px; left: 8px; }
.armor-overlay .r2 { top: 8px; right: 8px; }
.armor-overlay .r3 { bottom: 8px; left: 8px; }
.armor-overlay .r4 { bottom: 8px; right: 8px; }

.armor-crack-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.btn-b.armor-dmg-1 .ac-1 { opacity: 1; }
.btn-b.armor-dmg-2 .ac-1,
.btn-b.armor-dmg-2 .ac-2 { opacity: 1; }

.btn-b.hit-flash {
  animation: hitFlash 0.24s ease;
}

@keyframes hitFlash {
  0% { filter: brightness(2.1); transform: scale(0.94); }
  100% { filter: brightness(1); transform: scale(1); }
}

/* Surrendered B (Stage 14 — Clickable!) */
.btn-b.b-surrendered {
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
  border-color: #7f1d1d;
  color: #ffffff;
  box-shadow: 0 6px 0 var(--rebel-lip), 0 0 0 6px rgba(220, 38, 38, 0.18), 0 14px 28px rgba(220, 38, 38, 0.34);
  animation: surrenderPulse 1.5s ease-in-out infinite;
}

@keyframes surrenderPulse {
  0%, 100% { box-shadow: 0 6px 0 var(--rebel-lip), 0 0 0 4px rgba(220, 38, 38, 0.16), 0 14px 26px rgba(220, 38, 38, 0.32); }
  50% { box-shadow: 0 6px 0 var(--rebel-lip), 0 0 0 10px rgba(220, 38, 38, 0.24), 0 16px 32px rgba(220, 38, 38, 0.44); }
}

.surrender-flag {
  position: absolute;
  top: 6px;
  right: 9px;
  font-size: 1.05rem;
  animation: waveFlag 1.2s ease-in-out infinite alternate;
  transform-origin: bottom left;
}

@keyframes waveFlag {
  0% { transform: rotate(-8deg); }
  100% { transform: rotate(14deg); }
}

/* ==================== Arena Mini-Game Overlays ==================== */
.arena-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(244, 241, 234, 0.94);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  animation: fadeIn 0.22s ease;
}

.arena-overlay[hidden] {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

/* Stage 6: Bureaucracy Modal */
.mini-modal {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border: 1.5px solid var(--border-strong);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.12);
}

.mini-modal-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.modal-stamp {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 5px;
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.mini-modal h2 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 800;
}

.mini-modal-desc {
  margin: 0 0 12px;
  font-size: 0.83rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.modal-primary-btn {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: none;
  background: var(--a-main);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--a-lip);
  transition: transform 0.1s, background-color 0.15s;
}
.modal-primary-btn:hover { background: var(--a-hover); }
.modal-primary-btn:active { transform: translateY(2px); }

.modal-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 8px;
  color: #8a8377;
  font-size: 0.72rem;
  font-weight: 700;
}
.modal-divider::before,
.modal-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.modal-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--ink);
  cursor: pointer;
  margin-bottom: 10px;
}
.modal-check input {
  margin-top: 2px;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: var(--rebel);
}

.modal-secondary-btn {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface-muted);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}
.modal-secondary-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.modal-secondary-btn:not(:disabled):hover {
  background: #fee2e2;
  border-color: #f87171;
  color: #991b1b;
}

/* Stage 7: Shell Game */
.shell-panel {
  width: 100%;
  max-width: 470px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.shell-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--ink);
}

.shell-giveup-btn {
  border: none;
  border-radius: 8px;
  background: var(--a-main);
  color: #fff;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  padding: 6px 10px;
  cursor: pointer;
}
.shell-giveup-btn:hover { background: var(--a-hover); }

.shell-grid {
  position: relative;
  width: 100%;
  height: 186px;
}

.shell-card {
  position: absolute;
  width: calc(33.33% - 10px);
  height: 82px;
  border-radius: 12px;
  border: 2px solid var(--border-strong);
  background: #ffffff;
  font-family: inherit;
  font-size: 1.65rem;
  font-weight: 900;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 0 #d5cfc3;
  transition: left 0.22s cubic-bezier(0.22, 1, 0.36, 1), top 0.22s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.2s, border-color 0.2s;
}

.shell-card.hidden-face {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  border-color: #172554;
  color: #ffffff;
  box-shadow: 0 4px 0 #172554;
}

.shell-card.revealed-a {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.shell-card.revealed-b {
  background: #fef2f2;
  border-color: #ef4444;
  color: #dc2626;
}

.shell-card-sub {
  font-size: 0.62rem;
  font-weight: 700;
  margin-top: 2px;
}

.shell-note {
  margin: 0;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-soft);
}

/* Stage 10: Rubber-band Slider */
.slider-panel {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border: 1.5px solid var(--border-strong);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.12);
}

.slider-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.slider-title {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 900;
}

.slider-sub {
  margin: 0 0 16px;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.rubber-track {
  position: relative;
  height: 54px;
  border-radius: 999px;
  background: #f1ede5;
  border: 2px solid var(--border-strong);
  touch-action: none;
  cursor: grab;
  overflow: hidden;
}

.rubber-track:active {
  cursor: grabbing;
}

.rubber-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, #fca5a5, #ef4444);
  opacity: 0.45;
  pointer-events: none;
}

.rubber-goal {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.78rem;
  font-weight: 900;
  color: #991b1b;
  letter-spacing: 0.08em;
  pointer-events: none;
}

.rubber-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #18181b;
  color: #ffffff;
  font-weight: 900;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.rubber-pusher {
  position: absolute;
  top: 50%;
  left: 52px;
  transform: translateY(-50%) scaleX(-1);
  font-size: 1.25rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}

.rubber-pusher.pushing {
  opacity: 1;
}

.slider-hint {
  margin: 10px 0 0;
  text-align: center;
  font-size: 0.75rem;
  color: var(--ink-soft);
  font-weight: 600;
}

/* ==================== Card Footer ==================== */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--ink-soft);
}

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

/* ==================== Particles & Confetti ==================== */
.particle {
  position: absolute;
  pointer-events: none;
  will-change: transform, opacity;
  animation: particleFly var(--dur, 0.55s) cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes particleFly {
  0% {
    transform: translate(0, 0) scale(1) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate(var(--dx), var(--dy)) scale(var(--end-scale, 0.2)) rotate(var(--rot, 180deg));
    opacity: 0;
  }
}

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

.confetti {
  position: absolute;
  top: -12px;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  animation: confettiFall var(--dur, 1.8s) cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes confettiFall {
  0% {
    transform: translateY(0) translateX(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(420px) translateX(var(--sway, 40px)) rotate(var(--rot, 540deg));
    opacity: 0;
  }
}

/* ==================== Result View ==================== */
.result-card {
  padding: 28px 24px 24px;
}

.result-hero {
  position: relative;
  z-index: 6;
  text-align: center;
  margin-bottom: 22px;
}

.result-stamp {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  background: #eff6ff;
  color: var(--a-main);
  border: 1px solid #bfdbfe;
  margin-bottom: 12px;
}

.result-hero.is-b .result-stamp {
  background: #fef2f2;
  color: var(--rebel);
  border-color: #fecaca;
}

.result-choice-badge {
  width: 72px;
  height: 72px;
  margin: 0 auto 12px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  font-weight: 900;
  color: #ffffff;
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 6px 0 var(--a-lip), 0 14px 26px var(--a-glow);
  animation: popIn 0.42s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.result-hero.is-b .result-choice-badge {
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 6px 0 var(--rebel-lip), 0 14px 26px rgba(220, 38, 38, 0.34);
}

@keyframes popIn {
  0% { transform: scale(0.5) rotate(-8deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.result-title {
  margin: 0 0 8px;
  font-size: clamp(1.35rem, 4vw, 1.7rem);
  font-weight: 900;
}

.result-message {
  margin: 0 auto;
  max-width: 520px;
  font-size: 0.94rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

/* Personal Stats Grid */
.personal-stats {
  position: relative;
  z-index: 6;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}

.stat-box {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 10px;
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.stat-val {
  font-size: 1.02rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* Global Summary Section */
.summary-section {
  position: relative;
  z-index: 6;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 20px;
}

.summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.summary-head h2 {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 800;
}

.refresh-btn {
  padding: 5px 11px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}
.refresh-btn:hover { background: #f3f0e9; }

.bar-labels {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 0.84rem;
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}

.bar-label-a strong { color: var(--a-main); font-size: 1rem; }
.bar-label-b strong { color: var(--rebel); font-size: 1rem; }

.ratio-bar {
  display: flex;
  width: 100%;
  height: 22px;
  border-radius: 999px;
  overflow: hidden;
  background: #e5e0d5;
  margin-bottom: 12px;
}

.ratio-a {
  background: linear-gradient(90deg, #1d4ed8, #3b82f6);
  transition: width 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.ratio-b {
  background: linear-gradient(90deg, #f87171, #dc2626);
  transition: width 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.summary-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.summary-meta strong {
  color: var(--ink);
  font-family: var(--font-mono);
}

/* Result Actions */
.result-actions {
  position: relative;
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.action-btn {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.12s, background-color 0.15s;
}
.action-btn:active { transform: scale(0.99); }

.action-primary {
  background: var(--ink);
  color: #ffffff;
  border: none;
}
.action-primary:hover { background: #2d2b28; }

.action-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1.5px dashed var(--border-strong);
}
.action-ghost:hover {
  background: #fef2f2;
  color: var(--rebel);
  border-color: #fca5a5;
}

/* ==================== Responsive ==================== */
@media (max-width: 560px) {
  .app-shell {
    padding: 14px 12px 24px;
  }
  .card {
    padding: 18px 14px 16px;
    border-radius: 16px;
  }
  .telemetry-bar {
    padding: 8px 10px;
    gap: 8px;
  }
  .defense-meter {
    width: 72px;
  }
  .arena {
    height: 310px;
  }
  .btn-a, .btn-b {
    width: 132px;
    height: 92px;
  }
  .btn-letter {
    font-size: 2rem;
  }
  .personal-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.05s !important;
  }
}
