:root {
  --scale: 1;
  --ink: #e8f5ec;
  --panel-border: #2a3d31;
  --accent: #2e4a3d;
  --accent-dark: #1a2b23;
  --shadow: rgba(0, 0, 0, 0.7);
  --muted: #8fa396;


  --dialog-bg-top: rgba(15, 25, 20, 0.95);
  --dialog-bg-bottom: rgba(5, 10, 8, 0.98);
  --speaker-bg: rgba(160, 232, 175, 0.15);
  --speaker-text: #a0e8af;
}

html,
body {
  height: 100%;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #050806;
}

img {
  display: block;
  max-width: 100%;
}

button {
  font: inherit;
}

code,
pre {
  font-family: "Consolas", "Courier New", monospace;
}

h1,
h2,
p {
  margin: 0;
}

.app-shell {
  width: 100%;
  height: 100%;
}

.viewport {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: relative;
  background: #050806;
}

.stage-screen {
  width: 1440px;
  height: 1080px;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(var(--scale, 1));
  transform-origin: center;
  overflow: hidden;
  background: #0a0f0c;
}

.scene {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}

.scene.is-active {
  opacity: 1;
  pointer-events: auto;
}

.scene-background {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.7) saturate(1.1);
}

.steps {
  display: none;
}


.character {
  position: absolute;
  z-index: 1;
  object-fit: contain;
  filter: brightness(0.92) saturate(0.92);
  transition: opacity 200ms ease, transform 200ms ease, filter 200ms ease;
}


.character[data-char^="xavier"] {
  left: 8%;
  bottom: -15rem;
  height: 750px;
}


.character[data-char="birkes"] {
  right: 5%;
  bottom: +9rem;
  height: 600px;
  transform: scaleX(-1);
}


.character[data-char="baever"],
.character[data-char="muldvarp"] {
  right: 15%;
  bottom: 5rem;
  height: 300px;
}


.character[data-char="feen"] {
  right: 18%;
  bottom: 25rem;
  height: 300px;
  animation: float 4s ease-in-out infinite;
}


.character[data-char="sword"] {
  left: 50%;
  margin-left: -125px;
  bottom: 22rem;
  height: 350px;
  animation: float 3s ease-in-out infinite;
}


.character.active,
.character.is-focused {
  filter: brightness(1.1) saturate(1.05) drop-shadow(0 0 15px rgba(160, 232, 175, 0.15));
  transform: translateY(-8px);
  z-index: 2;
}

.character[data-char="birkes"].active,
.character[data-char="birkes"].is-focused {
  transform: scaleX(-1) translateY(-8px);
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-20px); filter: drop-shadow(0 0 15px rgba(255,255,255,0.4)); }
  100% { transform: translateY(0px); }
}

.ending-screen {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 1.25rem;
  padding: 4rem;
  text-align: center;
  background: rgba(5, 8, 6, 0.9);
  color: #f8f2eb;
  backdrop-filter: blur(8px);
}

.ending-screen--bad {
  background: rgba(20, 10, 10, 0.9);
}

.ending-kicker {
  padding: 0.45rem 1rem;
  border-radius: 999px;
  background: rgba(160, 232, 175, 0.15);
  color: var(--speaker-text);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.85rem;
  font-weight: 700;
  border: 1px solid var(--panel-border);
}

.ending-screen h1 {
  font-size: 4.5rem;
  margin-bottom: 1rem;
  font-family: Georgia, serif;
}

.ending-screen--good h1 { color: #f9e076; text-shadow: 0 0 30px rgba(249, 224, 118, 0.4); }
.ending-screen--bad h1 { color: #8fa396; }

.ending-lead {
  max-width: 48rem;
  line-height: 1.7;
  font-size: 1.2rem;
  color: #ccdcd1;
}

.ending-note {
  max-width: 34rem;
  padding: 0.65rem 0.9rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.14);
  line-height: 1.5;
}

.is-hidden {
  display: none !important;
}

.story-ui {
  left: 1.25rem;
  right: 1.25rem;
  bottom: 1.25rem;
  position: absolute;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.story-ui.is-hidden {
  display: none;
}

.dialog-panel,
.debug-panel {
  border: 2px solid var(--panel-border);
  border-top: 2px solid #4a6b54;
  border-radius: 16px;
  box-shadow: 0 18px 40px var(--shadow), inset 0 0 20px rgba(160, 232, 175, 0.05);
}

.dialog-panel,
.action-panel,
.debug-panel {
  position: relative;
  z-index: 2;
  padding: 1rem;
  backdrop-filter: blur(10px);
}

.dialog-panel {
  width: 100%;
  min-height: 148px;
  display: grid;
  gap: 0.75rem;
  background: linear-gradient(180deg, var(--dialog-bg-top), var(--dialog-bg-bottom));
  padding: 24px 32px;
}

.speaker-label {
  width: fit-content;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  background: var(--speaker-bg);
  border: 1px solid #3e5c4a;
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--speaker-text);
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.speaker-label:empty {
  display: none;
}

.dialog-text {
  font-size: 1.15rem;
  line-height: 1.65;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.action-panel {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  padding: 0;
  backdrop-filter: none;
  width: min(720px, 100%);
}

.choice-list {
  display: grid;
  gap: 0.75rem;
  justify-items: center;
  width: 100%;
}

.choice-list:empty {
  display: none;
}

.primary-button,
.choice-list button {
  border: 1px solid #3e5c4a;
  border-radius: 999px;
  padding: 0.9rem 1.4rem;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
  transition: transform 150ms ease, background 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
  color: #fff8f1;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  font-weight: 600;
  letter-spacing: 0.03em;
}

.choice-list button {
  min-width: min(420px, 100%);
}

.primary-button:hover,
.choice-list button:hover {
  transform: translateY(-3px);
  background: linear-gradient(135deg, #3e5c4a, var(--accent));
  border-color: var(--speaker-text);
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.8), 0 0 15px rgba(160, 232, 175, 0.2);
}

.primary-button:active,
.choice-list button:active {
  transform: translateY(1px);
}

.debug-line {
  line-height: 1.55;
  color: var(--muted);
}

.debug-panel {
  top: 1.25rem;
  right: 1.25rem;
  width: auto;
  padding: 0;
  background: rgba(15, 25, 20, 0.8);
  border: 1px solid var(--panel-border);
  overflow: hidden;
}

.debug-panel summary {
  list-style: none;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.debug-panel summary::-webkit-details-marker {
  display: none;
}

.debug-panel summary::before {
  content: "+ ";
}

.debug-panel[open] {
  width: 320px;
  background: rgba(15, 25, 20, 0.95);
}

.debug-panel[open] summary {
  border-bottom: 1px solid var(--panel-border);
}

.debug-panel[open] summary::before {
  content: "- ";
}

.debug-content {
  padding: 0.8rem;
}

.debug-content h2 {
  margin-bottom: 0.5rem;
  font-size: 1rem;
  color: var(--speaker-text);
}

.debug-panel pre {
  margin-top: 0.75rem;
  margin-bottom: 0;
  padding: 0.7rem;
  min-height: 88px;
  max-height: 240px;
  overflow: auto;
  border-radius: 12px;
  background: #0a0f0c;
  color: #a0e8af;
  font-size: 0.78rem;
  border: 1px solid #1a2b23;
}
