:root {
  --bg: #101624;
  --panel: #18243b;
  --text: #f5f8ff;
  --muted: #c4cee4;
  --accent: #6fc3ff;
  --danger: #ff9f8f;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: radial-gradient(circle at top, #223760, var(--bg));
  color: var(--text);
}
.app { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.panel {
  background: color-mix(in srgb, var(--panel) 88%, #fff);
  border: 1px solid #31486e;
  border-radius: 14px;
  padding: 1rem;
}
.hidden { display: none !important; }
h1, h2, h3 { margin-top: 0; }
p { line-height: 1.45; color: var(--muted); }
.mode-buttons { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
button {
  border: 0;
  border-radius: 10px;
  padding: .75rem 1rem;
  cursor: pointer;
  font-weight: 650;
}
button:disabled { opacity: .6; cursor: not-allowed; }
.primary { background: var(--accent); color: #0c1c33; }
.secondary { background: #d5e5ff; color: #1f2f4f; }
.next-btn { background: #9de09d; color: #143014; margin-top: 1rem; }
.return-btn { background: #f9e0b1; color: #3d2a00; margin-top: 1rem; }

.domains-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: .75rem;
  margin-bottom: 1rem;
}
.domain-card {
  background: #13233d;
  border: 1px solid #2f4b76;
  border-radius: 12px;
  padding: .75rem;
  text-align: center;
}
.domain-title { display: flex; align-items: center; justify-content: center; gap: .5rem; font-weight: 700; }
.domain-title img { width: 26px; height: 26px; object-fit: contain; }
.stat-row { display: flex; justify-content: space-between; align-items: center; margin-top: .5rem; padding: .2rem .35rem; border-radius: 8px; font-size: .95rem; color: var(--muted); transition: background-color .2s ease, box-shadow .2s ease; }
.value {
  display: inline-block;
  min-width: 1.5ch;
  color: var(--text);
  font-weight: 700;
  transition: transform 1s ease;
}
.value.grow { transform: scale(1.25); }
.value.pulse { animation: pulse 2s ease; }
.stat-value-wrap {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}

.delta-chip {
  min-width: 2.5ch;
  text-align: center;
  padding: .1rem .35rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 800;
  opacity: 0;
  transform: translateY(-4px);
}

.delta-show {
  animation: delta-pop 1s ease;
}

.stat-row.stat-changed {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.15);
}

.stat-row.stat-good {
  background: rgba(88, 206, 132, 0.22);
}

.stat-row.stat-good .delta-chip {
  background: rgba(88, 206, 132, 0.35);
  color: #d8ffe4;
}

.stat-row.stat-bad {
  background: rgba(255, 139, 139, 0.2);
}

.stat-row.stat-bad .delta-chip {
  background: rgba(255, 139, 139, 0.35);
  color: #ffe0e0;
}

@keyframes delta-pop {
  0% { opacity: 0; transform: translateY(-6px) scale(.85); }
  20% { opacity: 1; transform: translateY(0) scale(1.08); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pulse {
  0% { transform: scale(1); }
  25% { transform: scale(2.5); }
  50% { transform: scale(1); }
  75% { transform: scale(2.5); }
  100% { transform: scale(1); }
}

.scenario-panel { min-height: 260px; }
.choices {
  display: grid;
  grid-template-columns: 1fr;
  gap: .75rem;
}
@media (min-width: 780px) { .choices { grid-template-columns: 1fr 1fr; } }
.choice {
  text-align: left;
  background: #1b2f50;
  color: var(--text);
  border: 1px solid #4a6695;
  font-size: 1.05rem;
  line-height: 1.4;
  transition: opacity .25s ease, transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.choice-label {
  display: block;
  font-size: 1.08rem;
  font-weight: 700;
  color: #ffffff;
}
.choice.is-selected {
  border-color: #9cd7ff;
  box-shadow: 0 0 0 2px rgba(111, 195, 255, 0.35);
}
.choice.is-faded {
  opacity: .35;
  transform: scale(.98);
}
.effects {
  margin-top: .6rem;
  padding-left: 0;
  color: #d7e8ff;
  font-size: .9rem;
}
.effect-item {
  list-style: none;
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-top: .2rem;
}
.effect-item img {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex: 0 0 16px;
}
.reason {
  margin-top: .75rem;
  padding: .75rem;
  background: #1f395f;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
}
.collapse-item {
  margin-top: .75rem;
  background: #2a1b26;
  border: 1px solid #6f425f;
  border-radius: 10px;
  padding: .8rem;
}
.collapse-item p { color: #f7dbea; }
.collapse-body { color: #f7dbea; line-height: 1.5; }


.scenario-heading {
  margin-bottom: .5rem;
}

.scenario-text {
  margin: 0 0 1rem;
  padding: .9rem 1rem;
  background: #122744;
  border: 1px solid #456390;
  border-left: 4px solid #6fc3ff;
  border-radius: 10px;
  color: #f3f7ff;
  font-size: 1.05rem;
  line-height: 1.6;
}

.scenario-actions {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  align-items: center;
}

#end-game-btn {
  margin-left: auto;
  border: 2px solid #ad7a15;
}

@media (max-width: 640px) {
  #end-game-btn {
    margin-left: 0;
  }
}
