:root {
  --bg: #14100c;
  --panel: #221a12;
  --panel-edge: #4a3520;
  --ink: #e8d9b8;
  --dim: #8a7a5c;
  --gold: #e2b94c;
  --jade: #6cc28e;
  --red: #d4604f;
  --blue: #6f9fd4;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Courier New", Courier, monospace;
  display: flex;
  justify-content: center;
  padding: 12px;
  min-height: 100vh;
}

#frame {
  width: 100%;
  max-width: 760px;
  border: 3px solid var(--panel-edge);
  background: var(--panel);
  box-shadow: 0 0 32px #000;
  display: flex;
  flex-direction: column;
}

#titlebar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 12px;
  border-bottom: 2px solid var(--panel-edge);
  letter-spacing: 2px;
  font-weight: bold;
}

#statsbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  padding: 6px 12px;
  font-size: 13px;
  border-bottom: 2px solid var(--panel-edge);
  background: #1b150e;
}

.stat { white-space: nowrap; }

canvas#scene {
  width: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
  background: #000;
  border-bottom: 2px solid var(--panel-edge);
}

#panel {
  padding: 12px 14px;
  min-height: 220px;
  display: flex;
  flex-direction: column;
}

#speaker {
  color: var(--gold);
  font-weight: bold;
  margin-bottom: 6px;
  letter-spacing: 1px;
}

#text {
  line-height: 1.5;
  font-size: 15px;
  margin-bottom: 12px;
  white-space: pre-wrap;
}

#choices {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: auto;
}

#choices button, .footbtn {
  font-family: inherit;
  font-size: 14px;
  text-align: left;
  background: #2e2316;
  color: var(--ink);
  border: 2px solid var(--panel-edge);
  padding: 8px 12px;
  cursor: pointer;
}

#choices button:hover, .footbtn:hover {
  background: #3d2f1d;
  border-color: var(--gold);
  color: var(--gold);
}

#choices button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#footbar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border-top: 2px solid var(--panel-edge);
}

.footbtn { font-size: 12px; padding: 4px 10px; }

#foot-hint { margin-left: auto; font-size: 12px; }

.t-gold  { color: var(--gold); }
.t-jade  { color: var(--jade); }
.t-red   { color: var(--red); }
.t-blue  { color: var(--blue); }
.t-dim   { color: var(--dim); }

.hidden { display: none !important; }

.codex-entry {
  border: 1px solid var(--panel-edge);
  padding: 8px 10px;
  margin-bottom: 8px;
  background: #1b150e;
}

.codex-entry h3 { color: var(--jade); font-size: 14px; margin-bottom: 4px; }
.codex-entry p  { font-size: 13px; line-height: 1.45; color: var(--ink); }
.codex-entry .route { font-size: 11px; color: var(--dim); margin-top: 4px; }

#whisper {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  border-top: 2px solid var(--panel-edge);
  background: #1b150e;
}

#whisper-input {
  flex: 1;
  font-family: "Courier New", Courier, monospace;
  font-size: 14px;
  background: #2e2316;
  color: var(--gold);
  border: 2px solid var(--panel-edge);
  padding: 6px 10px;
  letter-spacing: 1px;
}

#whisper-input:focus {
  outline: none;
  border-color: var(--gold);
}

#toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: #2e2316;
  color: var(--gold);
  border: 2px solid var(--gold);
  padding: 8px 18px;
  font-family: "Courier New", Courier, monospace;
  font-size: 14px;
  letter-spacing: 1px;
  z-index: 10;
  box-shadow: 0 0 18px #000;
}
