/* style.css — BK-Simulator styles */

@font-face {
  font-family: 'PixelFont';
  src: url('../assets/fonts/pixel.ttf') format('truetype');
  font-display: swap;
}

:root {
  --blue:   #3a7bd5;
  --gold:   #DAA520;
  --green:  #228B22;
  --desk:   #5C4033;
  --desk-light: #7a5040;
  --wall:   #C2A882;
  --dark:   #1a1a2e;
  --text:   #f0e6d3;
  --pixel-font: 'PixelFont', 'Press Start 2P', 'Courier New', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: #0a0a0a;
  overflow: hidden;
  font-family: var(--pixel-font);
  color: var(--text);
}

/* ── Particle canvas (overlay, full window) ── */
#particle-canvas {
  position: fixed;
  pointer-events: none;
  z-index: 100;
}

/* ── Game Screen ── */
#game-screen {
  position: fixed;
  width: 960px;
  height: 540px;
  overflow: hidden;
  background: var(--wall);
  image-rendering: pixelated;
}

/* Scanline overlay */
#game-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.06) 2px,
    rgba(0,0,0,0.06) 4px
  );
  pointer-events: none;
  z-index: 99;
}

/* ── Background wall ── */
#bg-wall {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

/* ── Title Screen ── */
#title-screen {
  position: absolute;
  inset: 0;
  background: var(--dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 80;
  gap: 18px;
}

#title-screen h1 {
  font-size: 38px;
  color: var(--gold);
  text-shadow: 3px 3px 0 #000, 0 0 20px rgba(218,165,32,0.5);
  letter-spacing: 4px;
  animation: glow 2s ease-in-out infinite alternate;
}

#title-screen .subtitle {
  font-size: 9px;
  color: var(--text);
  text-align: center;
  line-height: 1.8;
  max-width: 600px;
  opacity: 0.85;
}

.floating-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.float-symbol {
  position: absolute;
  font-size: 24px;
  opacity: 0.12;
  animation: floatUp linear infinite;
}

#start-btn {
  margin-top: 10px;
  padding: 14px 40px;
  font-family: var(--pixel-font);
  font-size: 14px;
  background: var(--gold);
  color: #000;
  border: 3px solid #fff;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 2px;
  box-shadow: 4px 4px 0 #000;
  transition: transform 0.1s, box-shadow 0.1s;
}

#start-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 #000;
}
#start-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #000;
}

/* ── HUD bar (top) ── */
#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 44px;
  background: rgba(10,10,20,0.92);
  border-bottom: 3px solid var(--gold);
  display: none;
  align-items: center;
  justify-content: space-around;
  z-index: 50;
  padding: 0 8px;
}

.hud-counter {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 9px;
}

.hud-icon { font-size: 14px; }

.hud-label {
  font-size: 7px;
  opacity: 0.7;
  text-transform: uppercase;
}

.hud-value {
  font-size: 11px;
  font-weight: bold;
  will-change: transform;
  transition: transform 0.05s;
}

.hud-value.bump {
  animation: hudBump 0.2s ease-out;
}

#hud-partei-val { color: #7ab3ff; }
#hud-privat-val { color: var(--gold); }

/* ── Wall / Background Layer ── */
#wall-layer {
  position: absolute;
  top: 44px; left: 0; right: 0;
  height: 230px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px;
  overflow: visible;
  z-index: 4;
  pointer-events: none;
}

/* Shop desks on wall */
.shop-btn {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--pixel-font);
  font-size: 7px;
  transition: filter 0.2s;
}

.shop-btn:hover {
  filter: brightness(1.3) drop-shadow(0 0 8px rgba(218,165,32,0.6));
}

.shop-btn img {
  image-rendering: pixelated;
  width: 245px;
  height: 170px;
}

/* Wall plaque */
#plaque-el {
  position: absolute;
  left: 50%;
  top: 69%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: filter 0.2s;
  pointer-events: auto;
}

#plaque-el:hover {
  filter: brightness(1.4) drop-shadow(0 0 8px var(--gold));
}

#plaque-el img { image-rendering: pixelated; }

/* ── Desk Area ── */
#desk-area {
  position: absolute;
  bottom: 70px; left: 0; right: 0;
  height: 200px;
  background: linear-gradient(to bottom, var(--desk-light), var(--desk));
  display: none;
  align-items: center;
  justify-content: center;
  will-change: transform;
  z-index: 5;
}

/* Desk grain texture */
#desk-area::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Crect x='0' y='0' width='2' height='2' fill='rgba(0,0,0,0.05)'/%3E%3C/svg%3E") repeat;
}

/* Stats on desk */
#desk-stats {
  position: absolute;
  bottom: 6px; right: 14px;
  font-size: 7px;
  color: rgba(255,255,255,0.45);
  text-align: right;
  line-height: 1.8;
}

/* Approval rating */
#approval-rating {
  position: absolute;
  bottom: 6px; left: 14px;
  font-size: 7px;
  color: rgba(255,200,100,0.6);
}

/* Portrait */
#portrait-el {
  position: absolute;
  right: 80px;
  bottom: 20px;
  image-rendering: pixelated;
  opacity: 0.7;
}

/* Schwarzgeld Koffer easter egg */
#bg-koffer {
  display: none;
  position: absolute;
  left: 30px;
  bottom: 10px;
  font-size: 32px;
}

#bg-koffer.koffer-appear {
  animation: kofferPop 0.5s ease-out forwards;
}

/* ── Egg Element ── */
#egg-el {
  position: relative;
  display: none;
  flex-direction: column;
  align-items: center;
  will-change: transform;
  cursor: pointer;
  overflow: visible; /* allow tongue particles to extend outside */
}

#egg-img {
  width: 80px;
  height: 80px;
  image-rendering: pixelated;
  filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.5));
}

#licks-label {
  position: absolute;
  top: -36px;
  font-size: 22px;
  color: #fff;
  text-shadow: 2px 2px 0 #000;
  will-change: transform;
}

#licks-label.bounce {
  animation: numberBounce 0.15s ease-out;
}

#egg-info {
  position: absolute;
  left: calc(100% + 20px);
  top: 50%;
  transform: translateY(-50%);
  width: 220px;
  background: rgba(10,10,20,0.85);
  border: 2px solid var(--gold);
  padding: 8px 10px;
  font-size: 7px;
  line-height: 1.7;
}

#egg-name {
  color: var(--gold);
  font-size: 7px;
  margin-bottom: 4px;
  line-height: 1.5;
}

#egg-donation {
  color: #7fff7f;
  margin-bottom: 4px;
}

#egg-desc { color: var(--text); margin-bottom: 4px; }

#egg-source a {
  color: #7ab3ff;
  text-decoration: none;
  font-size: 6px;
}

#egg-source a:hover { text-decoration: underline; }

/* Tongue particles — spawned per lick, multiple can coexist */
.tongue-particle {
  position: absolute;
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
  pointer-events: none;
  background: url('../assets/sprites/tongue.png') 0 0 no-repeat;
  background-size: 256px 64px; /* 4 frames × 64px wide */
  animation: tongueFrames 0.22s steps(4, end) forwards;
  z-index: 10;
  will-change: background-position;
}

/* Horizontally flipped variant for right-side licks */
.tongue-particle.flipped {
  transform: scaleX(-1);
}

/* CSS-only fallback when tongue.png is missing */
.tongue-particle.no-sprite {
  background-image: none;
  background-color: #FF6B8A;
  border-radius: 0 60% 60% 0;
  border: 2px solid #cc3355;
  animation: tongueFallback 0.22s ease-out forwards;
}

/* ── Contract Element ── */
#contract-el {
  display: none;
  flex-direction: column;
  align-items: center;
  position: relative;
  will-change: transform;
}

#contract-img {
  width: 120px;
  height: 150px;
  image-rendering: pixelated;
  filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.5));
}

/* Big icon centered on the scroll — purely decorative, no text here */
#contract-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 32px;          /* emoji icon only */
  line-height: 1;
  pointer-events: none;
  text-shadow: 0 2px 6px rgba(0,0,0,0.4);
  z-index: 2;
}

/* Full demand text lives in the prompt bar (dark bg = always readable) */
#contract-demand {
  font-size: 10px;
  color: #fff;
  text-align: center;
  line-height: 1.5;
  padding: 0 12px;
  text-shadow: 1px 1px 0 #000;
}

/* ABGELEHNT stamp */
#stamp-el {
  display: none;
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(180,0,0,0.85);
  color: #fff;
  font-size: 13px;
  padding: 4px 10px;
  border: 3px solid #ff4444;
  letter-spacing: 2px;
  pointer-events: none;
  white-space: nowrap;
  will-change: transform;
}

/* Speech bubble */
#speech-bubble {
  display: none;
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  color: #111;
  font-size: 7px;
  padding: 6px 10px;
  border: 2px solid #333;
  max-width: 240px;
  text-align: center;
  line-height: 1.5;
  white-space: normal;
}

#speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #333;
}

#speech-bubble.pop-in {
  animation: popIn 0.2s ease-out;
}

/* ── Prompt bar (bottom) ── */
#prompt-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 70px;
  background: rgba(10,10,20,0.9);
  border-top: 3px solid var(--gold);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  z-index: 50;
  padding: 6px 20px;
}

#prompt-text {
  font-size: 9px;
  color: var(--text);
}

#prompt-text.pulsing {
  animation: pulse 1s ease-in-out infinite;
}

#mobile-lick-btn {
  display: none;
  padding: 8px 24px;
  font-family: var(--pixel-font);
  font-size: 11px;
  background: var(--gold);
  color: #000;
  border: 3px solid #fff;
  cursor: pointer;
  box-shadow: 3px 3px 0 #000;
}

#mobile-lick-btn:active {
  transform: translate(2px,2px);
  box-shadow: 1px 1px 0 #000;
}

#answer-buttons {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  width: 100%;
}

.answer-btn {
  padding: 5px 10px;
  font-family: var(--pixel-font);
  font-size: 7px;
  background: #2a1a3e;
  color: var(--text);
  border: 2px solid #7a5ab0;
  cursor: pointer;
  transition: background 0.1s, transform 0.1s;
  max-width: 260px;
  text-align: center;
  line-height: 1.4;
}

.answer-btn:hover {
  background: #4a2a6e;
  transform: translateY(-2px);
}

.answer-btn:active {
  transform: translateY(1px);
}

/* ── Modals ── */
.modal {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-box {
  background: var(--dark);
  border: 3px solid var(--gold);
  max-width: 820px;
  width: 90%;
  max-height: 90%;
  overflow-y: auto;
  padding: 20px;
  position: relative;
  box-shadow: 6px 6px 0 rgba(0,0,0,0.7);
}

.modal-box h2 {
  font-size: 12px;
  color: var(--gold);
  margin-bottom: 14px;
  text-align: center;
  border-bottom: 2px solid var(--gold);
  padding-bottom: 8px;
}

.modal-close {
  position: absolute;
  top: 10px; right: 14px;
  background: none;
  border: none;
  color: var(--gold);
  font-size: 18px;
  cursor: pointer;
  font-family: var(--pixel-font);
}

.modal-close:hover { color: #fff; }

/* Plaque modal */
.plaque-card {
  border: 2px solid rgba(218,165,32,0.3);
  padding: 10px 12px;
  margin-bottom: 12px;
  background: rgba(255,255,255,0.04);
}

.plaque-card h3 {
  font-size: 9px;
  color: var(--gold);
  margin-bottom: 6px;
  line-height: 1.5;
}

.plaque-card p {
  font-size: 7px;
  line-height: 1.8;
  color: var(--text);
  margin-bottom: 5px;
}

.plaque-people {
  color: #adf !important;
}

.plaque-sources {
  font-size: 7px;
  color: rgba(255,255,255,0.5);
}

.plaque-sources a {
  color: #7ab3ff;
  text-decoration: none;
}

.plaque-sources a:hover { text-decoration: underline; }

/* Shop modal */
.shop-item-list { display: flex; flex-direction: column; gap: 8px; }

.shop-item {
  border: 2px solid rgba(255,255,255,0.15);
  padding: 8px 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  background: rgba(255,255,255,0.04);
}

.shop-item:hover { background: rgba(255,255,255,0.1); }

.shop-item.affordable {
  border-color: var(--gold);
  box-shadow: 0 0 8px rgba(218,165,32,0.3);
  animation: affordableGlow 1.5s ease-in-out infinite alternate;
}

.shop-item.maxed {
  opacity: 0.4;
  cursor: default;
}

.shop-item-name {
  font-size: 8px;
  color: var(--gold);
  margin-bottom: 3px;
}

.shop-item-desc {
  font-size: 7px;
  color: var(--text);
  margin-bottom: 3px;
}

.shop-item-joke {
  font-size: 6px;
  color: rgba(255,255,255,0.4);
  font-style: italic;
  margin-bottom: 4px;
}

.shop-item-cost {
  font-size: 9px;
  color: #7fff7f;
  text-align: right;
}

.level-badge {
  font-size: 6px;
  color: rgba(255,255,255,0.5);
  margin-left: 6px;
}

.shop-item.shake-no {
  animation: shakeNo 0.3s ease-out;
}

/* Shop sections (unified modal) */
.shop-section { margin-bottom: 12px; }
.shop-section-header {
  font-family: var(--pixel-font);
  font-size: 9px;
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}
.shop-section:nth-child(1) .shop-section-header { background: rgba(58,123,213,0.2); color: #7ab3ff; border-bottom: 2px solid #3a7bd5; }
.shop-section:nth-child(2) .shop-section-header { background: rgba(218,165,32,0.2); color: var(--gold); border-bottom: 2px solid var(--gold); }
.section-arrow { font-size: 8px; }

/* ── Konami Message ── */
#konami-msg {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 300;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

#konami-msg p {
  font-size: 13px;
  color: var(--gold);
  text-align: center;
  padding: 20px;
  line-height: 2;
  text-shadow: 0 0 20px var(--gold);
  animation: glow 1s ease-in-out infinite alternate;
}

/* ── Milestone message ── */
#milestone-msg {
  display: none;
  position: absolute;
  top: 60px; left: 50%;
  transform: translateX(-50%);
  background: var(--gold);
  color: #000;
  font-size: 9px;
  padding: 8px 16px;
  border: 3px solid #fff;
  box-shadow: 4px 4px 0 #000;
  z-index: 150;
  white-space: nowrap;
}

#milestone-msg.milestone-anim {
  animation: milestoneSlide 3s ease-out forwards;
}

/* ── Toast ── */
#toast-msg {
  display: none;
  position: absolute;
  bottom: 80px; left: 50%;
  transform: translateX(-50%);
  background: rgba(20,20,40,0.95);
  border: 2px solid var(--gold);
  color: var(--text);
  font-size: 7px;
  padding: 8px 14px;
  z-index: 150;
  max-width: 300px;
  text-align: center;
  line-height: 1.7;
  white-space: pre-line;
}

#toast-msg.toast-anim {
  animation: toastSlide 2.5s ease-out forwards;
}

/* ── Golden background easter egg ── */
body.golden #game-screen {
  filter: sepia(0.5) hue-rotate(20deg) saturate(1.3);
  transition: filter 3s;
}

/* ── Animations ── */
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.97); }
}

@keyframes glow {
  from { text-shadow: 2px 2px 0 #000, 0 0 8px rgba(218,165,32,0.3); }
  to   { text-shadow: 2px 2px 0 #000, 0 0 24px rgba(218,165,32,0.9); }
}

@keyframes hudBump {
  0%  { transform: scale(1); }
  50% { transform: scale(1.25); }
  100%{ transform: scale(1); }
}

@keyframes numberBounce {
  0%  { transform: scale(1.4) translateY(-4px); }
  70% { transform: scale(0.9) translateY(2px); }
  100%{ transform: scale(1) translateY(0); }
}

/* Sprite-sheet walk: frame 0→1→2→3 (each 64px wide) */
@keyframes tongueFrames {
  from { background-position: 0 0; }
  to   { background-position: -256px 0; }
}

/* CSS fallback (no sprite) */
@keyframes tongueFallback {
  0%   { transform: scaleX(0.3); opacity: 0.9; }
  40%  { transform: scaleX(1.1); opacity: 1; }
  100% { transform: scaleX(1);   opacity: 0; }
}

@keyframes popIn {
  0%  { transform: translateX(-50%) scale(0.5); opacity: 0; }
  80% { transform: translateX(-50%) scale(1.1); }
  100%{ transform: translateX(-50%) scale(1); opacity: 1; }
}

@keyframes floatUp {
  0%   { transform: translateY(100vh); opacity: 0.15; }
  100% { transform: translateY(-100px); opacity: 0; }
}

@keyframes affordableGlow {
  from { box-shadow: 0 0 4px rgba(218,165,32,0.3); }
  to   { box-shadow: 0 0 14px rgba(218,165,32,0.7); }
}

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

@keyframes milestoneSlide {
  0%   { opacity: 0; transform: translateX(-50%) translateY(-20px) scale(0.8); }
  15%  { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.1); }
  25%  { transform: translateX(-50%) scale(1); }
  80%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-30px); }
}

@keyframes toastSlide {
  0%   { opacity: 0; transform: translateX(-50%) translateY(10px); }
  10%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  80%  { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes kofferPop {
  0%   { opacity: 0; transform: scale(0) rotate(-20deg); }
  60%  { transform: scale(1.3) rotate(10deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   OUTSIDE SCENE — window + protest system + DDR minigame
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Window element in wall ─────────────────────────────────────────────── */

#window-el {
  position: absolute;
  right: 20px;
  bottom: 70px;
  cursor: pointer;
  transition: filter 0.2s;
  z-index: 3;
}

#window-el:hover {
  filter: brightness(1.3) drop-shadow(0 0 6px rgba(135,206,235,0.6));
}

#window-img {
  width: 300px;
  height: 310px;
  display: block;
  image-rendering: pixelated;
}

#window-badge {
  position: absolute;
  top: 40%;
  right: 8px;
  background: #FF3333;
  color: #fff;
  font-size: 7px;
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  box-shadow: 1px 1px 0 #000;
  animation: badgePulse 1.2s ease-in-out infinite;
  font-family: var(--pixel-font);
}

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

/* ── Outside Scene ────────────────────────────────────────────────────────── */

#outside-scene {
  position: absolute;
  inset: 0;
  z-index: 70;
  overflow: hidden;
}

#outside-bg {
  position: absolute;
  inset: 0;
  /* Use outside-bg.png when available; gradient fallback for dev / missing asset */
  background:
    url('../assets/sprites/outside-bg.png') center bottom / cover no-repeat,
    linear-gradient(to bottom, #080818 0%, #0d0d2a 58%, #181410 59%, #3a3226 100%);
}

#outside-sky-bg {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 60%;
  /* Transparent — shows through to #outside-bg image/gradient */
}

#outside-street-bg {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 40%;
  /* Transparent — shows through to #outside-bg image/gradient */
  /* A faint border hints at the horizon line */
  border-top: 2px solid rgba(255,160,60,0.18);
}

/* ── Protesters ─────────────────────────────────────────────────────────── */

#protester-container {
  position: absolute;
  bottom: 0; left: 0;
  width: 62%;
  height: 100%;
  overflow: hidden;
}

.protester-wrap {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: protesterAppear 0.3s ease-out;
}

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

.protester-sign {
  background: #fff;
  color: #111;
  font-size: 5px;
  font-family: var(--pixel-font);
  padding: 2px 4px;
  border: 2px solid #333;
  margin-bottom: 2px;
  max-width: 56px;
  text-align: center;
  line-height: 1.4;
  word-break: break-word;
  box-shadow: 1px 1px 0 #000;
}

.protester-sprite {
  /* 2× scale of one frame (44×48) → 88×96 element */
  width: 88px;
  height: 96px;
  background: url('../assets/sprites/protester.png') 0 0 no-repeat;
  background-size: 88px 288px; /* 2× of full sheet: 44×144 */
  image-rendering: pixelated;
}

/* Sign disappears when cops hit the protester */
.protester-wrap.hit .protester-sign { display: none; }

/* ── Cops ───────────────────────────────────────────────────────────────── */

#cops-el {
  position: absolute;
  right: 10px;
  bottom: 0;
  width: 96px;   /* 1.5× of 64px frame width */
  height: 256px; /* 1.5× of 128px frame height */
  background: url('../assets/sprites/cops.png') 0 0 no-repeat;
  background-size: 192px 385px; /* 1.5× of full sheet 128×257 */
  image-rendering: pixelated;
  z-index: 250; /* above all protesters (max z-index 120) */
}

/* Idle walk cycle: 2 horizontal frames, each 96px wide at 1.5× */
@keyframes copsIdle {
  from { background-position-x: 0px;    }
  to   { background-position-x: -192px; }
}
#cops-el:not(.running) {
  animation: copsIdle 0.7s steps(2, end) infinite;
}

/* ── Outside Message (entry/exit headlines) ─────────────────────────────── */

#outside-msg {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

#outside-msg-text {
  font-family: var(--pixel-font);
  font-size: 10px;
  color: var(--text);
  text-align: center;
  line-height: 2.2;
  white-space: pre-line;
  text-shadow: 0 0 12px rgba(218,165,32,0.4);
  max-width: 700px;
  animation: msgFadeIn 0.4s ease-out;
}

/* Strikethrough styling for exit headline ~~text~~ */
.strikethrough {
  text-decoration: line-through;
  color: #FF6B6B;
}

@keyframes msgFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

/* FIGHT! — sprite version (img injected by JS; text fallback also styled) */
#outside-msg-text.msg-type-fight {
  animation: fightPop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
  /* Fallback text style (when fight.png missing) */
  font-size: 56px;
  color: #FFD700;
  letter-spacing: 10px;
  line-height: 1.3;
  text-shadow:
    4px 4px 0 #000,
    0 0 24px rgba(255,200,0,0.95),
    0 0 60px rgba(255,150,0,0.6);
  white-space: nowrap;
}
#outside-msg-text.msg-type-fight img {
  width: 520px;
  max-width: 90%;
  height: auto;
  image-rendering: pixelated;
  display: block;
}

@keyframes fightPop {
  0%   { transform: scale(3.5); opacity: 0; filter: blur(8px); }
  60%  { transform: scale(0.9);  opacity: 1; filter: blur(0); }
  80%  { transform: scale(1.08); }
  100% { transform: scale(1);    opacity: 1; }
}

/* ── DDR Minigame ────────────────────────────────────────────────────────── */

#ddr-wrap {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.78);
  z-index: 8;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10px;
}

#ddr-panel {
  position: relative;
  width: 600px;
  background: rgba(10,10,30,0.9);
  border: 3px solid var(--gold);
  box-shadow: 0 0 30px rgba(218,165,32,0.2);
}

/* ── IQ Bar ───────────────────────────────────────────────────────────────── */
#ddr-iq-bar-wrap {
  padding: 8px 14px 8px;
  border-bottom: 2px solid #222;
  background: rgba(0,0,0,0.3);
  transform-origin: center left; /* JS shakeIQBar uses this element */
}

#ddr-iq-bar-label {
  font-family: var(--pixel-font);
  font-size: 6px;
  color: var(--gold);
  letter-spacing: 0.5px;
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.9;
}

#ddr-iq-track {
  position: relative;
  height: 30px;
  background: rgba(0,0,0,0.6);
  border: 2px solid #444;
  border-radius: 3px;
  overflow: hidden; /* clips fill at 100%; becomes visible when .broken */
  transform-origin: center left;
}

/* Spritesheet fill — swap in url('../assets/sprites/iq_bar.png') when ready.
   background-size: auto 100%; background-repeat: repeat-x;
   animation: iqBarScroll 0.6s steps(4) infinite; */
#ddr-iq-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  background: linear-gradient(90deg,
    #3a7bd5 0%, #00d4aa 40%, var(--gold) 80%, #FFD700 100%);
  background-size: 200% 100%;
  animation: iqFillShimmer 1.5s linear infinite;
  transition: width 0.15s ease-out;
  will-change: width;
}

@keyframes iqFillShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position:   0% 0; }
}

/* Overflow segment — appears to the right of the bar when broken */
#ddr-iq-overflow {
  display: none;
  position: absolute;
  left: 100%;
  top: -2px;
  bottom: -2px;
  width: 0%;
  background: linear-gradient(90deg, #FFD700, #FF6600, #FF0000);
  background-size: 200% 100%;
  animation: iqFillShimmer 0.4s linear infinite;
  border: 2px solid rgba(255,100,0,0.8);
  border-left: none;
  border-radius: 0 3px 3px 0;
  transition: width 0.2s ease-out;
  will-change: width;
  /* Glitchy flicker */
  filter: brightness(1.3) saturate(1.8);
}

/* Shake is driven by JS (shakeIQBar) — no CSS animation class needed.
   The .shaking class exists only as a visual marker for debugging. */
#ddr-iq-track.shaking { outline: 1px solid rgba(255,180,0,0.3); }

/* Broken state — let fill overflow, crack the right edge */
#ddr-iq-track.broken {
  overflow: visible;
  border-color: #FF6600;
  border-right-color: transparent; /* open right side so overflow spills out */
  box-shadow: 0 0 8px rgba(255,100,0,0.6);
}
#ddr-iq-track.broken #ddr-iq-fill {
  background: linear-gradient(90deg, #3a7bd5, var(--gold), #FF6600);
  background-size: 300% 100%;
  animation: iqFillShimmer 0.5s linear infinite;
}

/* Timer bar */
#ddr-timer-track {
  height: 12px;
  background: #111;
  width: 100%;
  border-bottom: 2px solid #333;
}

#ddr-timer-fill {
  height: 100%;
  background: linear-gradient(to right, #FF4444, var(--gold), #44FF44);
  width: 100%;
  transition: width 0.1s linear;
  will-change: width;
}

/* Stats row */
#ddr-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 14px;
  font-size: 8px;
  border-bottom: 2px solid #222;
  height: 34px;
}

#ddr-combo-display {
  color: var(--gold);
  font-family: var(--pixel-font);
  transition: transform 0.1s;
  will-change: transform;
}

#ddr-combo-display.combo-big {
  animation: comboBig 0.15s ease-out;
}

@keyframes comboBig {
  0%   { transform: scale(1.6); color: #fff; }
  100% { transform: scale(1);   color: var(--gold); }
}

#ddr-score-display {
  color: #7ab3ff;
  font-family: var(--pixel-font);
  font-size: 8px;
}

#ddr-diff-display {
  color: rgba(255,255,255,0.4);
  font-size: 7px;
}

/* Note area — overflow:visible lets notes travel into the target row below */
#ddr-note-area {
  position: relative;
  height: 240px;
  overflow: visible;
  z-index: 2;
  border-bottom: none;
}

/* Lane guide lines — at 150px intervals matching target column widths */
#ddr-note-area::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent                0px, transparent              149px,
    rgba(255,255,255,0.05) 149px, rgba(255,255,255,0.05) 151px,
    transparent                151px, transparent             299px,
    rgba(255,255,255,0.05) 299px, rgba(255,255,255,0.05) 301px,
    transparent                301px, transparent             449px,
    rgba(255,255,255,0.05) 449px, rgba(255,255,255,0.05) 451px
  );
  pointer-events: none;
  z-index: 0;
}

/* Notes */
.ddr-note {
  position: absolute;
  width: 54px;
  height: 54px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0; /* text hidden; sprite shows instead */
  font-family: var(--pixel-font);
  border: 3px solid rgba(255,255,255,0.5);
  box-shadow: 0 0 8px currentColor;
  will-change: top;
  transition: opacity 0.08s;
  z-index: 3;
  background-image: url('../assets/sprites/ddr_arrows.png');
  background-size: 216px 54px;
  background-repeat: no-repeat;
}

/* left = lane_center - 27px  (lane centers: 75/225/375/525, -27 = half of 54px note)
   background-origin: border-box so sprite isn't offset by the 3px border */
.ddr-note.lane-0 { background-color: rgba(255,80,80,0.85);   color: #FF8888; left:  48px; background-position: 0 0;      background-origin: border-box; }
.ddr-note.lane-1 { background-color: rgba(70,150,220,0.85);  color: #88CCFF; left: 198px; background-position: -54px 0;  background-origin: border-box; }
.ddr-note.lane-2 { background-color: rgba(70,200,120,0.85);  color: #88FFAA; left: 348px; background-position: -108px 0; background-origin: border-box; }
.ddr-note.lane-3 { background-color: rgba(255,180,60,0.85);  color: #FFCC88; left: 498px; background-position: -162px 0; background-origin: border-box; }

.ddr-note.hit    { opacity: 0 !important; transform: scale(1.4); transition: all 0.1s; }
.ddr-note.missed { opacity: 0 !important; }

/* Target row is the receptor zone — notes visually fall INTO it */
#ddr-target-row {
  display: flex;
  height: 70px;
  position: relative;
  z-index: 1;
  /* Subtle gold tint to mark it as the hit zone */
  background: linear-gradient(to bottom,
    rgba(255,220,100,0.18) 0%,
    rgba(255,220,100,0.06) 60%,
    transparent 100%);
  border-top: 2px solid rgba(255,220,100,0.7);
}

.ddr-target {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0;
  border-right: 2px solid #222;
  background-color: transparent;
  transition: background-color 0.05s, box-shadow 0.05s;
  position: relative;
}

.ddr-target:last-child { border-right: none; }

/* Receptor arrow via ::before — exactly one frame (54×54), centered in 150px target */
.ddr-target::before {
  content: '';
  position: absolute;
  width: 54px;
  height: 54px;
  left: calc(50% - 27px);
  top: calc(50% - 27px);
  background-image: url('../assets/sprites/ddr_arrows.png');
  background-size: 216px 54px;
  background-repeat: no-repeat;
  background-position-y: 0;
  opacity: 0.35;
  filter: saturate(0.5);
}

.ddr-target[data-lane="0"]::before { background-position-x:    0px; }
.ddr-target[data-lane="1"]::before { background-position-x:  -54px; }
.ddr-target[data-lane="2"]::before { background-position-x: -108px; }
.ddr-target[data-lane="3"]::before { background-position-x: -162px; }

.ddr-target[data-lane="0"] { color: #FF8888; }
.ddr-target[data-lane="1"] { color: #88CCFF; }
.ddr-target[data-lane="2"] { color: #88FFAA; }
.ddr-target[data-lane="3"] { color: #FFCC88; }

.ddr-target.hit-perfect {
  background-color: rgba(255,255,180,0.3) !important;
  box-shadow: inset 0 0 20px rgba(255,255,100,0.5);
}
.ddr-target.hit-perfect::before { opacity: 1 !important; filter: saturate(2) brightness(1.6) !important; }

.ddr-target.hit-good {
  background-color: rgba(100,200,255,0.2) !important;
  box-shadow: inset 0 0 14px rgba(100,200,255,0.4);
}
.ddr-target.hit-good::before { opacity: 0.9 !important; filter: saturate(1.5) brightness(1.2) !important; }

.ddr-target.hit-miss {
  background-color: rgba(255,60,60,0.15) !important;
}
.ddr-target.hit-miss::before { opacity: 0.15 !important; filter: saturate(0) brightness(0.5) !important; }

.ddr-key-hint {
  font-size: 7px;
  opacity: 0.5;
  position: absolute;
  top: 6px;
  font-family: var(--pixel-font);
}

/* Rating flash */
#ddr-rating-display {
  position: absolute;
  bottom: 74px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  font-family: var(--pixel-font);
  pointer-events: none;
  text-shadow: 2px 2px 0 #000;
  white-space: nowrap;
}

#ddr-rating-display.rating-perfect {
  color: #FFD700;
  animation: ratingPop 0.5s ease-out forwards;
}
#ddr-rating-display.rating-good {
  color: #88CCFF;
  animation: ratingPop 0.5s ease-out forwards;
}
#ddr-rating-display.rating-miss {
  color: #FF4444;
  animation: ratingPop 0.5s ease-out forwards;
}

@keyframes ratingPop {
  0%   { opacity: 1; transform: translateX(-50%) scale(1.3) translateY(0); }
  60%  { opacity: 1; transform: translateX(-50%) scale(1)   translateY(-12px); }
  100% { opacity: 0; transform: translateX(-50%) scale(0.9) translateY(-20px); }
}

/* Cops run animation */
@keyframes copsRunAnim {
  from { left: 810px; }
  to   { left: -160px; }
}

#cops-el.running {
  animation: copsRunAnim 2.4s linear forwards;
}

/* ── Phoenix Wright DDR Dialogue ─────────────────────────────────────────── */

/* ── DDR Dialogue overlay ─────────────────────────────────────────────────── */

#ddr-dialogue-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  z-index: 20;
  pointer-events: none;
  background: rgba(0,0,0,0.55); /* dim the note area behind dialogue */
}

/* ── OBJECTION! splash — full-panel centered, marks game-end transition ── */

#ddr-objection-splash {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  transition: opacity 0.4s ease;
}
#ddr-objection-splash.fading-out { opacity: 0; }

#ddr-objection-img {
  width: 460px;           /* big — fills most of the 600px panel */
  height: auto;
  max-width: 90%;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 20px rgba(255,80,0,1));
}

#ddr-objection-img.objection-pop {
  animation: objectionPop 0.55s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes objectionPop {
  0%   { transform: scale(5) rotate(-25deg); opacity: 0; }
  55%  { transform: scale(0.9) rotate(4deg);  opacity: 1; }
  75%  { transform: scale(1.06) rotate(-1deg); }
  100% { transform: scale(1) rotate(0deg);     opacity: 1; }
}

/* ── Q+A transcript box ────────────────────────────────────────────────── */

#ddr-dialogue-box {
  width: 100%;
  background: rgba(6,6,20,0.97);
  border: 3px solid var(--gold);
  padding: 10px 14px;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.8), 0 0 18px rgba(218,165,32,0.3);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Each row = speaker label + text block */
.ddr-dlg-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ddr-dlg-speaker {
  font-family: var(--pixel-font);
  font-size: 6px;
  letter-spacing: 1px;
  opacity: 0.9;
}
#ddr-dialogue-q-speaker { color: #88CCFF; }
#ddr-dialogue-a-speaker { color: var(--gold); }

.ddr-dlg-text {
  font-family: var(--pixel-font);
  font-size: 7px;
  color: var(--text);
  line-height: 1.9;
  white-space: pre-wrap;
}

/* Divider between Q and A */
#ddr-dlg-divider {
  text-align: center;
  font-size: 9px;
  color: var(--gold);
  opacity: 0.5;
  margin: 1px 0;
  letter-spacing: 4px;
}

#ddr-dialogue-source {
  font-family: var(--pixel-font);
  font-size: 5px;
  color: rgba(200,180,140,0.5);
  margin-top: 6px;
  line-height: 1.6;
  border-top: 1px solid rgba(218,165,32,0.18);
  padding-top: 4px;
}

/* ── Placeholder fallback for cops + protester if PNGs missing */
#cops-el.no-sprite {
  background: none;
  background-color: #2244aa;
  border: 2px solid #4466cc;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.protester-sprite.no-sprite {
  background: none !important;
  background-color: #cc4422 !important;
  border: 2px solid #ee6644;
}
