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

body {
  font-family: 'Courier New', 'Menlo', monospace;
  background: #000;
  color: #fff;
  overflow: hidden;
  user-select: none;
}

#game {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* Screens */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.screen.active { display: flex; }

#game-screen { display: none; }
#game-screen.active { display: block; }

/* Title screen */
#title-screen {
  background: linear-gradient(135deg, #1a237e 0%, #b71c1c 50%, #1a237e 100%);
  text-align: center;
  padding: 40px;
}

.title-main {
  font-size: clamp(32px, 7vw, 72px);
  color: #ffeb3b;
  text-shadow: 4px 4px 0 #000, 8px 8px 20px rgba(0,0,0,0.8);
  letter-spacing: 3px;
  margin-bottom: 20px;
  font-weight: 900;
  transform: skew(-5deg);
}

.title-sub {
  font-size: clamp(18px, 3vw, 28px);
  color: #fff;
  margin-bottom: 30px;
  text-shadow: 2px 2px 0 #000;
}

.title-credit {
  font-size: 16px;
  color: #ffcc80;
  margin-bottom: 50px;
  font-style: italic;
}

/* Buttons */
.big-btn {
  background: linear-gradient(180deg, #d32f2f 0%, #7b1010 100%);
  color: #fff;
  border: 3px solid #ffeb3b;
  padding: 15px 40px;
  font-size: 20px;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  letter-spacing: 2px;
  box-shadow: 0 4px 0 #3d0808, 0 6px 20px rgba(0,0,0,0.5);
  transition: transform 0.1s;
}
.big-btn:hover {
  transform: translateY(-2px);
}
.big-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #3d0808;
}

/* Game screen */
.scene-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: background 0.5s;
}

.scene-courtroom {
  background-image: url('assets/bg-courtroom.svg');
  background-color: #3e2723;
  background-size: cover;
  background-position: center bottom;
}

.scene-livingroom {
  background-image: url('assets/bg-livingroom.svg');
  background-color: #1c2b33;
  background-size: cover;
  background-position: center bottom;
}

.scene-kitchen {
  background: linear-gradient(180deg, #e1f5fe 0%, #b3e5fc 50%, #ffecb3 100%);
}

#sprite-container {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -55%);
  width: 320px;
  height: 440px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 2;
}

.sprite {
  width: 100%;
  height: 100%;
  background-repeat: no-repeat;
  background-position: center bottom;
  background-size: contain;
  filter: drop-shadow(0 10px 20px rgba(0,0,0,0.6));
}

.sprite.shake {
  animation: shake 0.5s;
}
.sprite.slam {
  animation: slam 0.4s;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-8px); }
  20%, 40%, 60%, 80% { transform: translateX(8px); }
}
@keyframes slam {
  0% { transform: scale(1); }
  40% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* Textbox — Ace Attorney style */
#textbox {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, rgba(20,20,60,0.95) 0%, rgba(0,0,20,0.98) 100%);
  border-top: 4px solid #ffeb3b;
  padding: 20px 30px 30px;
  min-height: 140px;
  color: #fff;
  cursor: pointer;
  z-index: 5;
}

#speaker-name {
  position: absolute;
  top: -28px;
  left: 20px;
  background: linear-gradient(180deg, #d32f2f 0%, #7b1010 100%);
  border: 2px solid #ffeb3b;
  padding: 4px 20px;
  font-weight: bold;
  font-size: 18px;
  letter-spacing: 2px;
  text-shadow: 2px 2px 0 #000;
}

#dialogue-text {
  font-size: 22px;
  line-height: 1.5;
  white-space: pre-wrap;
  min-height: 70px;
}

#next-indicator {
  position: absolute;
  bottom: 8px;
  right: 20px;
  color: #ffeb3b;
  font-size: 20px;
  animation: bounce 0.8s infinite;
  opacity: 0;
}

#next-indicator.visible { opacity: 1; }

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* Choices */
.choices {
  position: absolute;
  bottom: 180px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 6;
  width: min(90%, 500px);
}

.choice-btn {
  background: linear-gradient(180deg, #1565c0 0%, #0d3c7a 100%);
  border: 2px solid #64b5f6;
  color: #fff;
  padding: 14px 20px;
  font-size: 18px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 4px 0 rgba(0,0,0,0.3);
  transition: transform 0.1s;
}
.choice-btn:hover {
  transform: translateY(-2px);
  background: linear-gradient(180deg, #1976d2 0%, #1565c0 100%);
}

/* HUD */
#hud {
  position: absolute;
  top: 15px;
  left: 15px;
  right: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 4;
}

.hud-btn {
  background: linear-gradient(180deg, #37474f 0%, #1c2428 100%);
  border: 2px solid #ffeb3b;
  color: #ffeb3b;
  padding: 8px 18px;
  font-size: 14px;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  letter-spacing: 1px;
}
.hud-btn:hover {
  background: linear-gradient(180deg, #455a64 0%, #263238 100%);
}

#mute-btn {
  min-width: 110px;
  background: linear-gradient(180deg, #e91e63 0%, #880e4f 100%);
  border-color: #ffeb3b;
  color: #fff;
}
#mute-btn:hover {
  background: linear-gradient(180deg, #c2185b 0%, #6a0d3a 100%);
}

.title-mute {
  margin-top: 15px;
  font-size: 14px;
  padding: 10px 25px;
  background: linear-gradient(180deg, #37474f 0%, #1c2428 100%);
  border-color: #4fc3f7;
  color: #4fc3f7;
}
.title-mute:hover {
  background: linear-gradient(180deg, #455a64 0%, #263238 100%);
}

.install-hint {
  margin-top: 30px;
  max-width: 340px;
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid #ffeb3b;
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}
.install-hint strong {
  color: #ffeb3b;
}

#health {
  display: flex;
  gap: 4px;
}
.heart {
  font-size: 28px;
  color: #f44336;
  text-shadow: 1px 1px 0 #000;
}
.heart.lost {
  color: #37474f;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-content {
  background: linear-gradient(180deg, #263238 0%, #102027 100%);
  border: 3px solid #ffeb3b;
  padding: 30px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  text-align: center;
}

.modal-content h3 {
  color: #ffeb3b;
  margin-bottom: 20px;
  font-size: 24px;
  letter-spacing: 2px;
}

.evidence-item {
  display: flex;
  align-items: center;
  gap: 15px;
  background: rgba(255,255,255,0.05);
  border: 2px solid #546e7a;
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s;
}
.evidence-item:hover {
  border-color: #ffeb3b;
  background: rgba(255,235,59,0.1);
}

.evidence-icon {
  font-size: 36px;
  min-width: 50px;
  text-align: center;
}

.evidence-info {
  flex: 1;
}
.evidence-name {
  font-weight: bold;
  color: #ffeb3b;
  margin-bottom: 4px;
}
.evidence-desc {
  font-size: 14px;
  color: #b0bec5;
}

/* Game over */
#gameover-screen {
  background: linear-gradient(135deg, #000 0%, #1a237e 100%);
  text-align: center;
  padding: 40px;
}

#gameover-title {
  font-size: 72px;
  color: #ffeb3b;
  margin-bottom: 30px;
  text-shadow: 4px 4px 0 #000;
}

#gameover-title.win { color: #4caf50; }
#gameover-title.lose { color: #f44336; }

#gameover-text {
  font-size: 20px;
  max-width: 600px;
  margin-bottom: 40px;
  line-height: 1.6;
}

/* OBJECTION banner */
.objection-banner {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-size: clamp(50px, 12vw, 140px);
  font-weight: 900;
  color: #ffeb3b;
  text-shadow:
    4px 4px 0 #b71c1c,
    8px 8px 0 #000,
    0 0 40px rgba(255,235,59,0.8);
  letter-spacing: 4px;
  transform-origin: center;
  z-index: 10;
  pointer-events: none;
  font-style: italic;
  white-space: nowrap;
}

.objection-banner.show {
  animation: objection 1.2s forwards;
}

@keyframes objection {
  0% { transform: translate(-50%, -50%) scale(0) rotate(-10deg); opacity: 0; }
  20% { transform: translate(-50%, -50%) scale(1.3) rotate(5deg); opacity: 1; }
  30% { transform: translate(-50%, -50%) scale(1) rotate(-2deg); }
  40% { transform: translate(-50%, -50%) scale(1.1) rotate(2deg); }
  50% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  85% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(0.8) rotate(0deg); opacity: 0; }
}

.hidden { display: none !important; }

/* (removed unused pseudo-element) */
