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

body {
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  background-color: #1a1a1a;
  color: #eeeeee;
  overflow: hidden;
}

.container {
  display: flex;
  width: 100vw;
  height: 100vh;
}

/* 20% Text Log Panel */
.log-panel {
  width: 20%;
  height: 100%;
  background-color: #2c2f33;
  border-right: 2px solid #4f545c;
  display: flex;
  flex-direction: column;
}

.log-panel h2 {
  text-align: center;
  padding: 15px;
  background-color: #23272a;
  color: #bfa15f;
  border-bottom: 2px solid #4f545c;
  font-size: 1.2rem;
}

#logs {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  font-size: 0.95rem;
  line-height: 1.6;
}

.log-entry {
  background-color: #36393f;
  padding: 12px;
  border-radius: 8px;
  border-left: 4px solid #bfa15f;
  animation: fadeIn 0.5s ease;
}

.log-time {
  font-size: 0.75rem;
  color: #a0a0a0;
  margin-bottom: 5px;
}

.summary {
  font-weight: bold;
  color: #ffd700;
  margin-bottom: 5px;
}

.body-text {
  color: #dddddd;
  white-space: pre-line;
}

/* 80% Simulation Panel */
.simulation-panel {
  width: 80%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle, #2a2d34 0%, #15161a 100%);
}

.village-container {
  width: 1024px;
  height: 768px;
  background-image: url('images/village_bg.png');
  background-size: cover;
  background-position: center;
  position: relative;
  border: 10px solid #5a4b3c;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.8);
  overflow: hidden;
}

/* Background elements (simple CSS shapes for now) */
.background-elements {
  display: none; /* Hide placeholder shapes since we use a real background image */
}

/* Dynamic Characters */
#characters {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  z-index: 10;
}

.character {
  position: absolute;
  width: 100px;
  height: 130px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  transition: all 4s ease-in-out;
  /* Basic dynamic animation */
  animation: bounce 2s infinite alternate;
}

.char-sprite {
  width: 80px;
  height: 80px;
  background-color: #fff;
  border-radius: 50%;
  border: 4px solid #000;
  box-shadow: 3px 3px 8px rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.8rem;
}

.char-name {
  font-size: 1.1rem;
  background-color: rgba(0,0,0,0.8);
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  margin-top: 8px;
  white-space: nowrap;
  font-family: inherit;
  font-weight: bold;
}

.chat-bubble {
  position: absolute;
  top: -65px;
  background-color: rgba(0, 0, 0, 0.85); /* Dark background */
  color: #fff; /* White text overall */
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: bold;
  white-space: nowrap;
  box-shadow: 2px 2px 5px rgba(0,0,0,0.4);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s;
  pointer-events: none;
  max-width: 280px;
  white-space: normal;
  text-align: center;
  z-index: 100;
  line-height: 1.4;
}
.chat-bubble .speaker-name {
  color: #ffd700; /* Yellow */
}
.chat-bubble.visible {
  opacity: 1;
  transform: translateY(0);
}
.chat-bubble::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  margin-left: -5px;
  border-width: 5px 5px 0;
  border-style: solid;
  border-color: rgba(0, 0, 0, 0.85) transparent transparent transparent;
}


.status-overlay {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 1.1rem;
  z-index: 20;
  box-shadow: 0 4px 6px rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  max-width: 800px;
  text-align: center;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes bounce {
  0% { transform: translateY(0); }
  100% { transform: translateY(-3px); }
}

/* Emotion Filters */
.emotion-angry {
  filter: drop-shadow(0 0 15px #ff2a2a) sepia(0.5) hue-rotate(-50deg) saturate(3);
}
.emotion-happy {
  filter: drop-shadow(0 0 15px #ffff4d) brightness(1.2);
}
.emotion-sad {
  filter: grayscale(80%) drop-shadow(0 0 10px #4d4dff);
}
.emotion-surprised {
  filter: drop-shadow(0 0 15px #4dffff) contrast(1.2);
}
