:root {
  /* Purple theme */
  --bg: #24003f;
  --panel: #12062a;
  --line: #4c2a72;
  --text: #f9fafb;
  --accent: #fbbf24;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #5b21b6, var(--bg));
  color: var(--text);
  font-family: "Courier New", monospace;
  display: grid;
  place-items: center;
}

.shell {
  width: min(1120px, 96vw);
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
}

.game-panel, .side-panel {
  background: rgba(17, 24, 39, 0.96);
  border: 3px solid var(--line);
  box-shadow: 0 0 0 3px #000, 0 18px 50px rgba(0,0,0,0.35);
}

.game-panel { padding: 16px; }
.side-panel { padding: 20px; }

canvas {
  width: 100%;
  max-width: 640px;
  display: block;
  margin: 0 auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 4px solid #000;
  background: #7ec8ff;
}

h1 {
  margin-top: 0;
  color: var(--accent);
  font-size: 24px;
}

.section {
  margin-bottom: 14px;
}

.section-title {
  margin-bottom: 8px;
  color: #fcd34d;
  font-weight: bold;
}

.npc-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.7;
}

.active-npc {
  margin-top: 14px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  background: #111827;
  color: #fcd34d;
}

.dialogue {
  margin-top: 12px;
  min-height: 120px;
  padding: 14px;
  border: 2px solid var(--line);
  background: #0b1220;
  line-height: 1.6;
  white-space: pre-line;
}

.chat-form {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

.hint {
  margin-top: 8px;
  font-size: 12px;
  color: #9ca3af;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
}

.status-label {
  font-size: 13px;
  color: #cbd5e1;
}

.switch-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.switch-side {
  font-size: 12px;
  color: #cbd5e1;
  user-select: none;
}

.switch {
  position: relative;
  display: inline-block;
  width: 54px;
  height: 28px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #0b1220;
  border: 2px solid var(--line);
  transition: 0.15s;
  border-radius: 999px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 2px;
  background: #fbbf24;
  transition: 0.15s;
  border-radius: 999px;
  box-shadow: 0 0 0 2px #000;
}

.switch input:checked + .slider {
  background: #111827;
}

.switch input:checked + .slider:before {
  transform: translateX(24px);
}

.status-indicator {
  font-size: 12px;
  color: #cbd5e1;
  min-width: 56px;
  text-align: right;
}

.chat-form input {
  flex: 1;
  background: #0b1220;
  color: #fff;
  border: 2px solid var(--line);
  padding: 12px;
  font: inherit;
}

.chat-form button {
  background: #fbbf24;
  color: #111827;
  border: 2px solid #000;
  padding: 12px 14px;
  font: inherit;
  font-weight: bold;
  cursor: pointer;
}

.chat-log {
  margin-top: 12px;
  min-height: 220px;
  max-height: 320px;
  overflow: auto;
  border: 2px solid var(--line);
  background: #0b1220;
  padding: 12px;
}

.chat-entry {
  margin-bottom: 10px;
  padding: 8px 10px;
  border-left: 4px solid var(--line);
  background: rgba(255,255,255,0.03);
  white-space: pre-line;
}

.chat-entry.player { border-left-color: #ef4444; }
.chat-entry.npc { border-left-color: #22c55e; }
.chat-entry.system { border-left-color: #60a5fa; }

.dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  border: 1px solid #000;
}
.merchant { background: #f59e0b; }
.engineer { background: #10b981; }
.professor { background: #8b5cf6; }
.player { background: #ef4444; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
}
