/* ============================================================ */
/* styles.css — 8-Bit UI Aesthetics */
/* ============================================================ */

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

body {
  font-family: 'Press Start 2P', monospace;
  background-color: #111;
  color: #eee;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  font-size: 12px;
  line-height: 1.6;
}

/* 
  Container to fill screen natively 
*/
#game-container {
  width: 100%;
  height: 100%;
  background-color: #000;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Screens are toggled via display property */
.screen {
  width: 100%;
  min-height: 100%;
  padding: 24px;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.screen.active {
  display: flex;
}

/* Typography elements */
h1 {
  font-size: 28px;
  text-align: center;
  margin-bottom: 16px;
  color: #eee;
  text-shadow: 2px 2px #555;
}

h2 {
  font-size: 16px;
  text-align: center;
  margin-bottom: 24px;
  color: #ffcc00;
}

.subtitle {
  color: #888;
  font-size: 10px;
  text-align: center;
}

.text-center { text-align: center; }
.text-green { color: #0f0; }
.text-red { color: #f00; }
.text-black { color: #000; }
.mt-4 { margin-top: 16px; }
.mt-8 { margin-top: 32px; }
.mb-4 { margin-bottom: 16px; }

.caution { color: #f5a623; }

/* Buttons */
button {
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  padding: 16px;
  border: 4px solid #fff;
  background: #222;
  color: #fff;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.1s;
  width: 100%;
  max-width: 300px;
}

button:hover:not(:disabled) {
  background: #fff;
  color: #000;
}

button:active:not(:disabled) {
  transform: translateY(2px);
}

button:disabled {
  border-color: #555;
  color: #555;
  cursor: not-allowed;
}

.btn-primary { border-color: #2196F3; }
.btn-primary:hover:not(:disabled) { background: #2196F3; color: white; }

.btn-warning { border-color: #FF9800; color: #FF9800; }
.btn-warning:hover:not(:disabled) { background: #FF9800; color: black; }

/* Grids for Study / Decision screens */
.char-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  width: 100%;
}

.char-card {
  position: relative;
  border: 4px solid #444;
  background: #1a1a1a;
  padding: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: border-color 0.2s;
}

.char-card.interactive:hover { border-color: #888; }
.char-card.selected-real { border-color: #0f0; background: #0a200a; color: #fff; }
.char-card.selected-doppel { border-color: #f00; background: #200a0a; color: #fff; }

.char-card p {
  margin-top: 8px;
  font-size: 10px;
}

.house-scene {
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  /* Dark blue sky `#0b0f24`, dark green grass `#1e3814`, black road with white stripe */
  /* Using exact pixel offsets from the bottom so the ground is perfectly sized relative to the house */
  background: linear-gradient(
    to bottom, 
    #0b0f24 0%, #0b0f24 calc(100% - 140px), 
    #1e3814 calc(100% - 140px), #1e3814 calc(100% - 40px), 
    #FFF calc(100% - 40px), #FFF calc(100% - 24px),
    #000 calc(100% - 24px), #000 100%
  );
  width: calc(100% + 48px);
  margin-left: -24px;
  margin-right: -24px;
  /* Lift house up above the road to rest exactly on the grass */
  padding-bottom: 40px; 
  position: relative;
  overflow: hidden;
}

/* 8-bit stars using box-shadow */
.stars {
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 3px;
  background: transparent;
  box-shadow: 
    40px 30px #fff, 120px 80px #eed, 250px 20px #fff, 350px 100px #dde,
    450px 40px #fff, 550px 120px #fff, 60px 150px #fff, 180px 200px #eed,
    300px 180px #fff, 400px 220px #dde, 520px 180px #fff, 620px 40px #fff,
    750px 90px #eed, 850px 30px #fff, 950px 150px #dde, 1050px 70px #fff,
    1150px 190px #fff, 1250px 50px #fff, 1350px 120px #eed, 1450px 20px #fff,
    1550px 180px #dde, 1650px 60px #fff, 1750px 110px #fff, 1850px 160px #eed,
    800px 210px #fff, 1000px 240px #fff, 1200px 200px #fff, 1400px 170px #fff;
  opacity: 0.8;
  animation: twinkle 3s infinite alternate;
}

@keyframes twinkle {
  0% { opacity: 0.5; }
  100% { opacity: 1; }
}

.house-facade {
  display: flex;
  flex-direction: column;
  align-items: center;
  image-rendering: pixelated;
  transform: scale(1.1); /* Scale it up slightly to feel imposing */
  transform-origin: bottom center;
}

.house-roof {
  width: 540px;
  height: 120px;
  background-color: #4a2d12;
  /* Blocky 8-bit stair-stepped roof */
  clip-path: polygon(
    0% 100%, 
    0% 80%, 10% 80%, 
    10% 60%, 20% 60%, 
    20% 40%, 30% 40%, 
    30% 20%, 40% 20%, 
    40% 0%,  60% 0%, 
    60% 20%, 70% 20%, 
    70% 40%, 80% 40%, 
    80% 60%, 90% 60%, 
    90% 80%, 100% 80%, 
    100% 100%
  );
}

.house-body {
  width: 480px;
  height: 280px;
  background-color: #6a4622;
  /* Distinct, chunky horizontal lines for siding */
  background-image: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 24px,
    #4a2d12 24px,
    #4a2d12 36px
  );
  border-left: 16px solid #3c2410;
  border-right: 16px solid #3c2410;
  display: flex;
  justify-content: space-between;
  align-items: flex-end; /* Align elements to the floor */
  position: relative;
}

.house-window {
  width: 80px;
  height: 100px;
  background-color: #c9a635; /* Solid gold/yellow */
  border: 12px solid #3c2410;
  position: relative;
  /* Flat inner shadow for depth without high-res smoothness */
  box-shadow: inset 0 0 0 8px rgba(120, 60, 0, 0.4);
}

/* Lowered windows */
.house-window.left { margin-left: 20px; margin-bottom: 70px; }
.house-window.right { margin-right: 20px; margin-bottom: 70px; }

/* The cross framing for windows using pseudo elements (gapless) */
.house-window::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 50%;
  width: 12px;
  margin-left: -6px;
  background-color: #3c2410;
}

.house-window::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 12px;
  margin-top: -6px;
  background-color: #3c2410;
}

.house-doorway {
  width: 220px;
  height: 288px; /* Character height */
  background: #3c2816; /* Dimly lit brown inside instead of black */
  display: flex;
  justify-content: center;
  align-items: flex-end;
  position: absolute;
  /* Inner shadow to give a blocky recessed feel */
  box-shadow: inset 0 24px 0 rgba(0,0,0,0.4), inset 16px 0 0 rgba(0,0,0,0.3), inset -16px 0 0 rgba(0,0,0,0.3);
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
}

/* Police Report Style */
.report-paper {
  background: #fdf5e6; /* Old paper */
  width: 100%;
  max-width: 600px;
  padding: 32px;
  border: 4px solid #111;
  box-shadow: 8px 8px 0 rgba(0,0,0,0.5);
  color: #111;
  position: relative;
}

.report-header {
  margin-bottom: 24px;
  text-align: center;
}

.report-header h2 {
  color: #111;
  font-size: 24px;
  letter-spacing: 2px;
  margin-bottom: 8px;
  text-decoration: underline;
}

.divider {
  height: 4px;
  background: #111;
  width: 100%;
  margin-bottom: 4px;
}

.report-paper::before {
  content: "";
  position: absolute;
  top: 68px; left: 32px; right: 32px;
  height: 2px;
  background: #111;
}

.report-paper h3 {
  font-size: 16px;
  margin-bottom: 16px;
}

.report-highlight {
  background: #ff0;
  padding: 4px;
  display: inline-block;
}

/* Override primary button for paper theme */
.report-paper button {
  margin: 32px auto 0 auto;
  display: block;
}

.report-paper .btn-primary {
  background: #fff;
  color: #111;
  border-color: #111;
}
.report-paper .btn-primary:hover {
  background: #111;
  color: #fff;
}
.report-paper .btn-warning {
  background: #ffeb3b;
  color: #111;
  border-color: #111;
}
.report-paper .btn-warning:hover {
  background: #111;
  color: #fff;
}

/* Dialogue Box */
.dialogue-box {
  width: 100%;
  min-height: 80px;
  border: 4px solid #fff;
  background: #000;
  padding: 16px;
  margin-top: 16px;
}

/* Animations */
@keyframes blink {
  0% { opacity: 1; }
  50% { opacity: 0; }
  100% { opacity: 1; }
}
.blink { animation: blink 1s infinite steps(1); }

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); text-shadow: 0 0 10px rgba(255,255,255,0.8); }
  100% { transform: scale(1); }
}
.pulse { animation: pulse 2s infinite; }

@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-5px); }
  100% { transform: translateX(0); }
}
.shake { animation: shake 0.4s; }

/* Flash effect */
.flash-red {
  animation: flashRed 0.5s ease-out;
}
@keyframes flashRed {
  0% { background-color: #f00; }
  100% { background-color: #000; }
}

.flash-green {
  animation: flashGreen 0.5s ease-out;
}
@keyframes flashGreen {
  0% { background-color: #0f0; }
  100% { background-color: #000; }
}

/* Canvas crisp mode */
canvas {
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-crisp-edges;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
