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

/* ── Auth Screen ───────────────────────────────────────── */
#auth-screen {
  position: fixed;
  inset: 0;
  background: #0d1b2a;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
#auth-screen.hidden { display: none; }

#auth-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 48px 56px;
  background: rgba(5, 14, 24, 0.95);
  border: 1px solid #1e3a50;
  border-radius: 16px;
  box-shadow: 0 0 80px rgba(74, 156, 192, 0.1);
}

#auth-title {
  font-family: 'Courier New', monospace;
  font-size: 2em;
  color: #7ec8e3;
  letter-spacing: 6px;
  font-weight: bold;
}

#auth-subtitle {
  font-family: 'Courier New', monospace;
  font-size: 0.85em;
  color: #4a6a7a;
  letter-spacing: 1px;
  margin-top: -10px;
}

#auth-google-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: none;
  border-radius: 6px;
  padding: 12px 28px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  color: #333;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.1s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
#auth-google-btn:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.3); transform: translateY(-1px); }
#auth-google-btn:active { transform: translateY(0); }

#auth-status {
  font-family: 'Courier New', monospace;
  font-size: 0.78em;
  color: #4a7a8a;
  min-height: 1.2em;
}

#auth-skip-btn {
  background: none;
  border: none;
  color: #2a5060;
  font-family: 'Courier New', monospace;
  font-size: 0.72em;
  cursor: pointer;
  transition: color 0.15s;
}
#auth-skip-btn:hover { color: #4a8aaa; }

/* ── User Info (header) ────────────────────────────────── */
#user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72em;
  color: #5a9aaa;
}
#user-info.hidden { display: none; }

#user-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#logout-btn {
  background: none;
  border: 1px solid #1a3a50;
  border-radius: 3px;
  color: #3a6a7a;
  font-size: 1em;
  padding: 1px 6px;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s, border-color 0.15s;
}
#logout-btn:hover { color: #cc6644; border-color: #cc6644; }

body {
  background: #0d1b2a;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  font-family: 'Courier New', monospace;
  color: #e0e0e0;
  overflow: hidden;
}

/* ── Header ─────────────────────────────────────────────── */
#header {
  width: 100%;
  background: #050e18;
  border-bottom: 1px solid #1a3348;
  flex-shrink: 0;
  z-index: 100;
}

/* Game mode header */
#header-game {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
}

#header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

#header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

#header h1 {
  font-size: 1.1em;
  color: #7ec8e3;
  letter-spacing: 3px;
  font-weight: bold;
}

#location-display {
  font-size: 0.82em;
  color: #a0c4d8;
  background: #0a1a28;
  padding: 3px 10px;
  border: 1px solid #1e3a50;
  border-radius: 3px;
  min-width: 180px;
  transition: background 0.3s;
}

/* Editor mode header */
#header-editor {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
}

#editor-exit-btn {
  background: none;
  border: 1px solid #3a2020;
  border-radius: 4px;
  color: #c07060;
  font-family: 'Courier New', monospace;
  font-size: 0.78em;
  padding: 3px 12px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: border-color 0.15s, color 0.15s;
}
#editor-exit-btn:hover { border-color: #cc6644; color: #e8a080; }

#editor-header-title {
  font-size: 0.88em;
  color: #7ec8e3;
  letter-spacing: 3px;
  font-weight: bold;
}

#editor-header-actions {
  display: flex;
  gap: 8px;
}

#editor-header-actions button {
  background: none;
  border: 1px solid #1a3a50;
  border-radius: 4px;
  color: #4a8aaa;
  font-family: 'Courier New', monospace;
  font-size: 0.75em;
  padding: 3px 12px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: border-color 0.15s, color 0.15s;
}
#editor-header-actions button:hover { border-color: #4a9cc0; color: #7ec8e3; }

/* Editor-active: hide game HUD elements */
.editor-active #game-toolbar,
.editor-active #npc-panel,
.editor-active #minimap-container { display: none !important; }

/* ── Game Container ──────────────────────────────────────── */
#game-container {
  display: block;
  line-height: 0;
}

/* ── Dialogue / Chat Box ─────────────────────────────────── */
#dialogue-box {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  width: min(640px, 92vw);
  background: rgba(5, 12, 22, 0.97);
  border: 2px solid #4a9cc0;
  border-radius: 10px;
  z-index: 500;
  box-shadow: 0 0 40px rgba(74, 156, 192, 0.35);
  animation: dialogueFadeIn 0.15s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@keyframes dialogueFadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

#dialogue-box.hidden { display: none; }

/* Header strip */
#dialogue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 8px;
  border-bottom: 1px solid #1a3a50;
  background: rgba(10, 25, 40, 0.8);
}

#dialogue-header-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

#dialogue-header-name {
  font-size: 1.05em;
  font-weight: bold;
  color: #7ec8e3;
}

#dialogue-header-role {
  font-size: 0.75em;
  color: #4a7a8a;
  letter-spacing: 1px;
}

#dialogue-close-btn {
  background: none;
  border: 1px solid #2a4a5a;
  color: #4a7a8a;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 0.8em;
  font-family: inherit;
  transition: color 0.15s, border-color 0.15s;
}
#dialogue-close-btn:hover { color: #cc4444; border-color: #cc4444; }

/* Chat message log */
#chat-log {
  padding: 10px 14px;
  max-height: 340px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: #1e3a50 transparent;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 3px;
  animation: msgSlideIn 0.12s ease;
}

@keyframes msgSlideIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chat-name {
  font-size: 0.7em;
  font-weight: bold;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.chat-text {
  font-size: 0.9em;
  line-height: 1.55;
  padding: 7px 11px;
  border-radius: 7px;
  max-width: 88%;
}

/* NPC message — left aligned */
.chat-npc .chat-name  { color: #5aaed0; margin-left: 4px; }
.chat-npc .chat-text  {
  background: rgba(20, 50, 70, 0.75);
  color: #d0ecff;
  border: 1px solid #1e4a60;
  align-self: flex-start;
}

/* Player message — right aligned */
.chat-player          { align-items: flex-end; }
.chat-player .chat-name { color: #88aa77; margin-right: 4px; }
.chat-player .chat-text {
  background: rgba(25, 45, 20, 0.75);
  color: #ccddb8;
  border: 1px solid #2a4a20;
  align-self: flex-end;
}

/* Text input row */
#dialogue-input-row {
  display: flex;
  gap: 8px;
  padding: 8px 12px 10px;
  border-top: 1px solid #0e2030;
  background: rgba(5, 12, 20, 0.7);
}

#player-input {
  flex: 1;
  background: rgba(10, 28, 44, 0.95);
  border: 1px solid #2a5060;
  border-radius: 5px;
  color: #d0ecff;
  font-family: 'Courier New', monospace;
  font-size: 0.88em;
  padding: 7px 10px;
  outline: none;
  transition: border-color 0.15s;
}

#player-input:focus {
  border-color: #4a9cc0;
  box-shadow: 0 0 0 2px rgba(74, 156, 192, 0.2);
}

#player-input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#player-input::placeholder { color: #2a5060; }

#send-btn {
  background: #1a4a60;
  border: 1px solid #2a6a80;
  border-radius: 5px;
  color: #7ec8e3;
  font-family: 'Courier New', monospace;
  font-size: 0.82em;
  padding: 7px 13px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
#send-btn:hover:not(:disabled)  { background: #2a6a80; }
#send-btn:disabled               { opacity: 0.3; cursor: not-allowed; }

/* Typing indicator animation */
.typing .chat-text { opacity: 0.55; font-style: italic; }

/* Session date separator */
.chat-separator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  color: #2a5060;
  font-size: 0.7em;
}
.chat-separator::before,
.chat-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #0e2030;
}
.chat-separator span { white-space: nowrap; }

/* ── NPC Panel ───────────────────────────────────────────── */
#npc-panel {
  position: fixed;
  top: 46px;
  right: 10px;
  width: 178px;
  background: rgba(5, 14, 24, 0.88);
  border: 1px solid #1e3a50;
  border-radius: 6px;
  padding: 10px 10px 8px;
  font-size: 0.76em;
  z-index: 200;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.panel-title {
  color: #4a9cc0;
  font-size: 0.8em;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.panel-add-btn {
  background: #0a2a40;
  border: 1px solid #2a6a80;
  color: #7ec8e3;
  border-radius: 3px;
  cursor: pointer;
  font-size: 1em;
  line-height: 1;
  padding: 0 5px 1px;
  font-family: inherit;
  transition: background 0.15s;
}
.panel-add-btn:hover { background: #1a4a60; }

.npc-entry-custom .npc-delete {
  margin-left: auto;
  color: #cc4444;
  cursor: pointer;
  font-size: 0.9em;
  padding: 0 2px;
  display: none;
}
.npc-entry-custom:hover .npc-delete { display: inline; }
.npc-entry-custom:hover .npc-role   { display: none; }

.npc-entry {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  color: #90b8c8;
  border-bottom: 1px solid #0e2030;
}

.npc-entry:last-child { border-bottom: none; }

.npc-emoji { font-size: 1em; flex-shrink: 0; }

.npc-role {
  margin-left: auto;
  color: #3d6070;
  font-size: 0.85em;
}

/* ── Minimap ─────────────────────────────────────────────── */
#minimap-container {
  position: fixed;
  bottom: 10px;
  right: 10px;
  background: rgba(5, 14, 24, 0.9);
  border: 1px solid #1e3a50;
  border-radius: 4px;
  padding: 4px;
  z-index: 200;
}

#minimap {
  display: block;
  border-radius: 2px;
}

#minimap-label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6em;
  color: #3a5a6a;
  letter-spacing: 2px;
  margin-top: 2px;
}

/* ── Character Creation Modal ────────────────────────────── */
#create-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 600;
}
#create-modal.hidden { display: none; }

#create-panel {
  background: #050e18;
  border: 2px solid #2a6a80;
  border-radius: 10px;
  width: min(480px, 94vw);
  box-shadow: 0 0 50px rgba(74, 156, 192, 0.3);
  overflow: hidden;
}

#create-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(10, 25, 40, 0.9);
  border-bottom: 1px solid #1a3a50;
  color: #7ec8e3;
  font-weight: bold;
  letter-spacing: 1px;
}
#create-header button {
  background: none;
  border: 1px solid #2a4a5a;
  color: #4a7a8a;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 3px;
  font-family: inherit;
  transition: color 0.15s, border-color 0.15s;
}
#create-header button:hover { color: #cc4444; border-color: #cc4444; }

#create-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.create-row {
  display: flex;
  gap: 8px;
}

#create-body input,
#create-body textarea {
  width: 100%;
  background: rgba(10, 28, 44, 0.95);
  border: 1px solid #2a5060;
  border-radius: 5px;
  color: #d0ecff;
  font-family: 'Courier New', monospace;
  font-size: 0.85em;
  padding: 7px 10px;
  outline: none;
  resize: vertical;
  transition: border-color 0.15s;
}
#create-body input:focus,
#create-body textarea:focus { border-color: #4a9cc0; }
#create-body input::placeholder,
#create-body textarea::placeholder { color: #2a5060; }

.create-section-label {
  font-size: 0.72em;
  color: #4a9cc0;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: -2px;
}

#c-sprite-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sprite-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  padding: 5px 4px 4px;
  border: 2px solid transparent;
  border-radius: 6px;
  background: rgba(10, 28, 44, 0.6);
  transition: border-color 0.15s, background 0.15s;
  font-size: 0.65em;
  color: #4a7a8a;
}
.sprite-swatch:hover { border-color: #2a6a80; background: rgba(20, 50, 70, 0.6); }
.sprite-swatch.selected { border-color: #4a9cc0; background: rgba(20, 60, 90, 0.8); color: #7ec8e3; }

#generate-btn {
  background: #0a2a3a;
  border: 1px solid #2a6a50;
  color: #7ec8c8;
  font-family: 'Courier New', monospace;
  font-size: 0.8em;
  padding: 6px 12px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s;
  align-self: flex-start;
}
#generate-btn:hover:not(:disabled) { background: #1a4a40; }
#generate-btn:disabled { opacity: 0.4; cursor: not-allowed; }

#create-error {
  color: #cc6666;
  font-size: 0.8em;
  padding: 4px 0;
}
#create-error.hidden { display: none; }

#create-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 4px;
}
#create-actions button {
  font-family: 'Courier New', monospace;
  font-size: 0.85em;
  padding: 7px 16px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s;
}
#create-submit-btn {
  background: #1a4a60;
  border: 1px solid #2a6a80;
  color: #7ec8e3;
}
#create-submit-btn:hover:not(:disabled) { background: #2a6a80; }
#create-submit-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-secondary {
  background: #0a1a28;
  border: 1px solid #1e3a50;
  color: #4a7a8a;
}
.btn-secondary:hover { background: #0e2030; }

/* ── World Lobby Overlay ─────────────────────────────────── */
#world-lobby {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 18, 0.97);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease;
}
#world-lobby.hidden { display: none; }

#lobby-panel {
  background: #050e18;
  border: 2px solid #2a6a80;
  border-radius: 12px;
  width: min(520px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: 0 0 60px rgba(74, 156, 192, 0.2);
  scrollbar-width: thin;
  scrollbar-color: #1e3a50 transparent;
}

.lobby-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 1.3em;
  font-weight: bold;
  color: #7ec8e3;
  letter-spacing: 4px;
  padding-bottom: 14px;
  border-bottom: 1px solid #1a3a50;
}

#lobby-close-btn {
  background: none;
  border: none;
  color: #2a6a80;
  font-size: 1em;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}
#lobby-close-btn:hover { color: #7ec8e3; }

#worlds-btn {
  background: none;
  border: 1px solid #1a3a50;
  border-radius: 4px;
  color: #4a8aaa;
  font-family: 'Courier New', monospace;
  font-size: 0.75em;
  padding: 3px 10px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: border-color 0.15s, color 0.15s;
}
#worlds-btn:hover { border-color: #4a9cc0; color: #7ec8e3; }

.lobby-section { display: flex; flex-direction: column; gap: 10px; }

.lobby-section-title {
  font-size: 0.72em;
  color: #4a9cc0;
  letter-spacing: 2px;
  text-transform: uppercase;
}

#lobby-premise {
  width: 100%;
  background: rgba(10, 28, 44, 0.95);
  border: 1px solid #2a5060;
  border-radius: 6px;
  color: #d0ecff;
  font-family: 'Courier New', monospace;
  font-size: 0.88em;
  padding: 10px 12px;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
}
#lobby-premise:focus { border-color: #4a9cc0; }
#lobby-premise::placeholder { color: #2a4a5a; }

#lobby-generate-btn {
  background: #1a4a60;
  border: 1px solid #2a6a80;
  border-radius: 6px;
  color: #7ec8e3;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  padding: 9px 18px;
  cursor: pointer;
  align-self: flex-start;
  transition: background 0.15s;
}
#lobby-generate-btn:hover:not(:disabled) { background: #2a6a80; }
#lobby-generate-btn:disabled { opacity: 0.4; cursor: not-allowed; }

#lobby-status { font-size: 0.8em; color: #7ec8e3; min-height: 1.2em; }

.lobby-divider {
  text-align: center;
  color: #2a5060;
  font-size: 0.72em;
  letter-spacing: 1px;
}

.lobby-world-card {
  background: rgba(10, 25, 40, 0.7);
  border: 1px solid #1a3a50;
  border-radius: 6px;
  padding: 10px 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 6px;
}
.lobby-world-card:hover { border-color: #2a6a80; background: rgba(15, 35, 55, 0.9); }
.lobby-world-card:last-child { margin-bottom: 0; }

.lobby-world-title {
  color: #7ec8e3;
  font-weight: bold;
  font-size: 0.92em;
  margin-bottom: 4px;
}
.lobby-world-premise { color: #90b0c0; font-size: 0.78em; line-height: 1.45; margin-bottom: 4px; }
.lobby-world-date { color: #3a5a6a; font-size: 0.67em; }

.lobby-no-worlds { color: #3a5a6a; font-size: 0.8em; text-align: center; padding: 8px 0; }

.lobby-default-btn {
  background: none;
  border: none;
  color: #3a5a6a;
  font-family: 'Courier New', monospace;
  font-size: 0.8em;
  cursor: pointer;
  align-self: center;
  padding: 4px 8px;
  transition: color 0.15s;
}
.lobby-default-btn:hover { color: #5a9aaa; }

/* ── Scenario Intro Card ─────────────────────────────────── */
#scenario-intro {
  position: fixed;
  top: 54px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(5, 12, 22, 0.97);
  border: 2px solid #4a9cc0;
  border-radius: 10px;
  padding: 22px 28px;
  z-index: 700;
  width: min(520px, 92vw);
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  box-shadow: 0 0 40px rgba(74, 156, 192, 0.3);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: dialogueFadeIn 0.2s ease;
  scrollbar-width: thin;
  scrollbar-color: #1e3a50 transparent;
}
#scenario-intro.hidden { display: none; }

#intro-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
#intro-close-btn {
  background: none;
  border: none;
  color: #4a9cc0;
  font-size: 1.1em;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
  flex-shrink: 0;
}
#intro-close-btn:hover { color: #7ec8e3; }

#intro-title {
  font-size: 1.15em;
  color: #7ec8e3;
  font-weight: bold;
  letter-spacing: 2px;
}
#intro-setting {
  font-size: 0.95em;
  color: #8ab0c0;
  line-height: 1.6;
}
#intro-role {
  font-size: 0.95em;
  color: #b0d8e8;
  line-height: 1.5;
  padding: 8px 12px;
  background: rgba(10, 30, 50, 0.6);
  border-left: 3px solid #4a9cc0;
  border-radius: 0 6px 6px 0;
}
#intro-hook {
  font-size: 0.95em;
  color: #d0ecff;
  font-style: italic;
  line-height: 1.6;
}

/* ── Bottom HUD Toolbar ──────────────────────────────────── */
#game-toolbar {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  background: rgba(5, 14, 24, 0.92);
  border: 1px solid #1e3a50;
  border-radius: 24px;
  padding: 0;
  z-index: 600;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

#game-toolbar button {
  background: none;
  border: none;
  border-right: 1px solid #1a2e3e;
  color: #7ec8e3;
  font-family: 'Courier New', monospace;
  font-size: 1em;
  padding: 12px 22px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: background 0.15s;
  white-space: nowrap;
}
#game-toolbar button:last-child { border-right: none; }
#game-toolbar button:hover { background: rgba(20, 50, 70, 0.6); }

#game-toolbar #accuse-btn { color: #d08060; }
#game-toolbar #accuse-btn:hover { background: rgba(60, 20, 10, 0.5); }
#game-toolbar #journal-btn { color: #5aaa80; }
#game-toolbar #journal-btn:hover { background: rgba(15, 40, 25, 0.5); }
#game-toolbar #hint-btn { color: #b89060; }
#game-toolbar #hint-btn:hover { background: rgba(36, 26, 10, 0.5); }

#briefing-btn.hidden,
#hint-btn.hidden,
#accuse-btn.hidden { display: none; }

/* ── Hint Modal ────────────────────────────────────────────── */
#hint-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: dialogueFadeIn 0.15s ease;
}
#hint-modal.hidden { display: none; }

#hint-panel {
  background: rgba(5, 12, 22, 0.99);
  border: 2px solid #6a4a20;
  border-radius: 10px;
  width: min(480px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 0 36px rgba(180, 140, 60, 0.22);
}

#hint-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid #3a2a10;
  font-size: 0.95em;
  color: #e0b878;
  letter-spacing: 1px;
}
#hint-header button {
  background: none;
  border: none;
  color: #6a4a20;
  font-size: 1em;
  cursor: pointer;
}
#hint-header button:hover { color: #e0b878; }

#hint-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#hint-meta {
  font-size: 0.74em;
  color: #7a8a9a;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.hint-meta-sep { margin: 0 8px; color: #3a4a5a; }
.hint-penalty-note { color: #a07050; }

#hint-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hint-card {
  background: rgba(20, 14, 6, 0.7);
  border-left: 3px solid #8a6a30;
  border-radius: 4px;
  padding: 10px 12px;
  font-size: 0.88em;
  line-height: 1.55;
  color: #d8c8a8;
  animation: dialogueFadeIn 0.2s ease;
}
.hint-card-label {
  font-size: 0.72em;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #b89060;
  margin-bottom: 4px;
  display: block;
}

#hint-get-btn {
  background: #3a2a10;
  border: 1px solid #6a4a20;
  border-radius: 5px;
  color: #e8c898;
  font-family: inherit;
  font-size: 0.88em;
  padding: 8px 14px;
  cursor: pointer;
  align-self: flex-start;
  transition: background 0.15s;
}
#hint-get-btn:hover:not(:disabled) { background: #5a3a18; }
#hint-get-btn:disabled { opacity: 0.4; cursor: not-allowed; }

#hint-divider {
  height: 1px;
  background: #1a2a3a;
  margin: 4px 0;
}

#hint-solution-section { display: flex; flex-direction: column; gap: 10px; }

#hint-solution-blurb {
  font-size: 0.8em;
  color: #8a6a5a;
  line-height: 1.5;
}

#hint-solution-content {
  background: rgba(40, 12, 6, 0.6);
  border-left: 3px solid #8a3020;
  border-radius: 4px;
  padding: 10px 12px;
  font-size: 0.86em;
  line-height: 1.6;
  color: #e0b8a8;
}
#hint-solution-content.hidden { display: none; }
#hint-solution-content .truth-line { margin: 3px 0; }

#hint-reveal-btn {
  background: rgba(40, 15, 8, 0.9);
  border: 1px solid #5a3020;
  border-radius: 5px;
  color: #d8a070;
  font-family: inherit;
  font-size: 0.85em;
  padding: 8px 14px;
  cursor: pointer;
  align-self: flex-start;
  transition: background 0.15s;
}
#hint-reveal-btn:hover:not(:disabled) { background: rgba(60, 20, 8, 0.95); color: #f0c090; }
#hint-reveal-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Hide toolbar when dialogue is open */
body.dialogue-open #game-toolbar,
body.dialogue-open #progress-hud { display: none !important; }

/* Accuse button pulse when hinted */
@keyframes accusePulse {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: 0 0 14px rgba(208, 128, 96, 0.5); }
}
#accuse-btn.pulse { animation: accusePulse 2s ease-in-out infinite; }

/* ── Onboarding Hint Toast ──────────────────────────────── */
#game-hint {
  position: fixed;
  bottom: 68px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 28, 44, 0.95);
  border: 1px solid #2a6a80;
  border-radius: 8px;
  color: #a0d8e8;
  font-family: 'Courier New', monospace;
  font-size: 0.88em;
  padding: 10px 20px;
  z-index: 590;
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  animation: hintFadeIn 0.3s ease;
  white-space: nowrap;
}
#game-hint.hidden { display: none; }

@keyframes hintFadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Accusation Modal ────────────────────────────────────── */
#accuse-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: dialogueFadeIn 0.15s ease;
}
#accuse-modal.hidden { display: none; }

#accuse-panel {
  background: rgba(5, 12, 22, 0.99);
  border: 2px solid #7a4030;
  border-radius: 10px;
  width: min(480px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 0 40px rgba(180, 80, 40, 0.3);
}

#accuse-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid #3a1a10;
  font-size: 0.95em;
  color: #e09070;
  letter-spacing: 1px;
}
#accuse-header button {
  background: none;
  border: none;
  color: #7a4030;
  font-size: 1em;
  cursor: pointer;
}
#accuse-header button:hover { color: #e09070; }

#accuse-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#accuse-intro {
  font-size: 0.8em;
  color: #6a8a9a;
  line-height: 1.5;
}

.accuse-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.accuse-field label {
  font-size: 0.72em;
  color: #c07050;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.accuse-field select,
.accuse-field textarea {
  background: rgba(10, 20, 32, 0.95);
  border: 1px solid #3a2010;
  border-radius: 5px;
  color: #d8c8b8;
  font-family: 'Courier New', monospace;
  font-size: 0.87em;
  padding: 8px 10px;
  outline: none;
  transition: border-color 0.15s;
  resize: vertical;
}
.accuse-field select:focus,
.accuse-field textarea:focus { border-color: #7a4030; }
.accuse-field textarea::placeholder { color: #3a3020; }

#accuse-error {
  color: #cc6655;
  font-size: 0.8em;
}
#accuse-error.hidden { display: none; }

#accuse-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
#accuse-submit-btn {
  background: #5a2010;
  border: 1px solid #8a4030;
  border-radius: 5px;
  color: #e8b898;
  font-family: inherit;
  font-size: 0.88em;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.15s;
}
#accuse-submit-btn:hover:not(:disabled) { background: #7a3020; }
#accuse-submit-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Debrief Modal ───────────────────────────────────────── */
#debrief-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.82);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: dialogueFadeIn 0.2s ease;
}
#debrief-modal.hidden { display: none; }

#debrief-panel {
  background: rgba(4, 10, 18, 0.99);
  border: 2px solid #4a9cc0;
  border-radius: 12px;
  width: min(520px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 0 60px rgba(74, 156, 192, 0.25);
  display: flex;
  flex-direction: column;
  gap: 0;
}

#debrief-header {
  padding: 16px 20px 14px;
  font-size: 0.8em;
  color: #4a9cc0;
  letter-spacing: 3px;
  text-transform: uppercase;
  border-bottom: 1px solid #1a3040;
  text-align: center;
}

#debrief-score-row {
  padding: 20px 20px 16px;
  text-align: center;
  border-bottom: 1px solid #1a3040;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
#debrief-score-number {
  font-size: 2.2em;
  font-weight: bold;
  color: #7ec8e3;
  letter-spacing: 2px;
}
#debrief-rating-label {
  font-size: 1em;
  color: #a8d8f0;
  letter-spacing: 1.5px;
}
#debrief-stars {
  font-size: 1.3em;
  color: #c8a840;
  letter-spacing: 3px;
}

#debrief-results {
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-bottom: 1px solid #1a3040;
}
.debrief-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.83em;
  line-height: 1.5;
}
.db-label {
  color: #4a8aa0;
  min-width: 110px;
  font-size: 0.78em;
  letter-spacing: 1px;
  text-transform: uppercase;
  flex-shrink: 0;
}
.db-value  { color: #a8c8d8; }
.db-correct { color: #60c880; font-weight: bold; }
.db-partial { color: #c8a040; font-weight: bold; }
.db-wrong   { color: #c06060; font-weight: bold; }
.db-hint    { color: #6a9aaa; font-size: 0.9em; font-style: italic; }
.db-feedback { color: #7a9aaa; font-style: italic; }

#debrief-truth {
  padding: 16px 20px;
  border-bottom: 1px solid #1a3040;
}
.debrief-truth-title {
  text-align: center;
  font-size: 0.72em;
  color: #4a9cc0;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.truth-line {
  font-size: 0.82em;
  color: #90b8c8;
  line-height: 1.6;
  margin-bottom: 6px;
}
.truth-line strong { color: #7ec8e3; }

#debrief-actions {
  padding: 14px 20px;
  display: flex;
  justify-content: center;
}
#debrief-actions button {
  background: #0a2030;
  border: 1px solid #2a6080;
  border-radius: 6px;
  color: #7ec8e3;
  font-family: inherit;
  font-size: 0.85em;
  padding: 8px 24px;
  cursor: pointer;
  transition: background 0.15s;
}
#debrief-actions button:hover { background: #1a3a50; }

/* ── Room Entry Popup ────────────────────────────────────── */
#room-popup {
  position: fixed;
  top: 54px;
  left: 10px;
  background: rgba(5, 14, 24, 0.92);
  border: 1px solid #2a6a50;
  border-radius: 8px;
  padding: 8px 14px 10px;
  z-index: 600;
  width: min(280px, 40vw);
  box-shadow: 0 0 20px rgba(40, 140, 100, 0.15);
  animation: dialogueFadeIn 0.2s ease;
}
#room-popup.hidden { display: none; }

#room-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
#room-popup-zone {
  font-size: 0.78em;
  color: #5aaa80;
  font-weight: bold;
  letter-spacing: 1px;
  text-transform: uppercase;
}
#room-popup-header button {
  background: none;
  border: none;
  color: #3a6a5a;
  cursor: pointer;
  font-size: 0.9em;
  font-family: inherit;
  padding: 0 2px;
  transition: color 0.15s;
}
#room-popup-header button:hover { color: #cc8844; }
#room-popup-text {
  font-size: 0.84em;
  line-height: 1.6;
  color: #b0d8c0;
  font-style: italic;
}

/* ── Journal count badge ─────────────────────────────────── */
#journal-count {
  font-size: 0.9em;
  opacity: 0.7;
}

/* ── Journal Modal ───────────────────────────────────────── */
#journal-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
#journal-modal.hidden { display: none; }

#journal-panel {
  background: #050e18;
  border: 2px solid #1a4a30;
  border-radius: 10px;
  width: min(520px, 92vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(40, 120, 80, 0.2);
}

.journal-header-row {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  color: #5aaa80;
  font-size: 0.82em;
  letter-spacing: 2px;
  border-bottom: 1px solid #0e2a1e;
  background: rgba(10, 30, 20, 0.6);
  flex-shrink: 0;
}

.journal-close-btn {
  margin-left: auto;
  background: none;
  border: 1px solid #1a3a28;
  color: #3a6a4a;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 3px;
  font-family: inherit;
  font-size: 0.9em;
  transition: color 0.15s, border-color 0.15s;
}
.journal-close-btn:hover { color: #cc6644; border-color: #cc6644; }

#journal-entries {
  overflow-y: auto;
  padding: 4px 0;
  scrollbar-width: thin;
  scrollbar-color: #1a3a28 transparent;
}

.journal-entry {
  padding: 8px 14px;
  border-bottom: 1px solid #0a1e16;
  cursor: pointer;
  transition: background 0.12s;
}
.journal-entry:hover { background: rgba(20, 60, 40, 0.45); }
.journal-entry:last-child { border-bottom: none; }

.journal-source {
  display: block;
  color: #3a7a5a;
  font-size: 0.72em;
  margin-bottom: 3px;
  letter-spacing: 0.5px;
}
.journal-ts { color: #2a5a3a; margin-left: 6px; }

.journal-text {
  color: #90c8a8;
  line-height: 1.5;
  font-size: 0.82em;
}

.journal-empty { padding: 12px 14px; color: #2a5a3a; font-style: italic; font-size: 0.82em; }

/* Journal entry delete button */
.journal-entry {
  position: relative;
}
.journal-delete {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  color: #2a4a3a;
  font-size: 0.82em;
  cursor: pointer;
  padding: 0 4px;
  font-family: inherit;
  transition: color 0.15s;
  display: none;
}
.journal-entry:hover .journal-delete { display: block; }
.journal-delete:hover { color: #cc5544; }

.journal-entry-pending { background: rgba(40, 20, 15, 0.3); }

.journal-confirm-row {
  position: absolute;
  top: 7px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.journal-confirm-label {
  font-size: 0.72em;
  color: #cc7755;
}
.journal-confirm-yes,
.journal-confirm-no {
  background: none;
  border: 1px solid #2a3a2a;
  border-radius: 3px;
  font-family: inherit;
  font-size: 0.72em;
  padding: 1px 8px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.journal-confirm-yes { color: #cc5544; border-color: #4a2a20; }
.journal-confirm-yes:hover { background: #4a2a20; color: #ee8877; }
.journal-confirm-no { color: #5a8a6a; border-color: #1a3a2a; }
.journal-confirm-no:hover { background: #1a3a2a; color: #90c8a8; }

/* Journal add-note input row */
#journal-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid #0e2a1e;
  background: rgba(8, 24, 16, 0.5);
  flex-shrink: 0;
}

#journal-input {
  flex: 1;
  background: rgba(10, 28, 22, 0.9);
  border: 1px solid #1a3a2a;
  border-radius: 5px;
  color: #90c8a8;
  font-family: 'Courier New', monospace;
  font-size: 0.85em;
  padding: 7px 10px;
  outline: none;
  transition: border-color 0.15s;
}
#journal-input:focus { border-color: #3a7a5a; }
#journal-input::placeholder { color: #2a4a3a; }

#journal-add-btn {
  background: #0a2a1e;
  border: 1px solid #1a4a30;
  border-radius: 5px;
  color: #5aaa80;
  font-family: 'Courier New', monospace;
  font-size: 0.82em;
  padding: 7px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
#journal-add-btn:hover { background: #1a4a30; color: #90c8a8; }

/* ── Evidence Picker (above chat input) ─────────────────── */
#evidence-picker {
  background: rgba(5, 14, 22, 0.98);
  border: 1px solid #2a5060;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  max-height: 180px;
  overflow-y: auto;
  font-size: 0.78em;
  scrollbar-width: thin;
  scrollbar-color: #1e3a50 transparent;
}
#evidence-picker.hidden { display: none; }

.evidence-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 12px;
  cursor: pointer;
  border-bottom: 1px solid #0e2030;
  transition: background 0.12s;
}
.evidence-item:hover { background: rgba(20, 50, 70, 0.7); }
.evidence-item:last-child { border-bottom: none; }

.evidence-source { color: #3a7a8a; font-size: 0.9em; }
.evidence-text   { color: #90b8c8; line-height: 1.4; }
.evidence-empty  { padding: 8px 12px; color: #2a5060; font-style: italic; }

/* ── Evidence button ─────────────────────────────────────── */
#evidence-btn {
  background: #0a1e2e;
  border: 1px solid #1a3a50;
  border-radius: 5px;
  color: #4a8a9a;
  font-size: 1em;
  padding: 5px 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
#evidence-btn:hover { background: #0e2a3e; color: #7ec8e3; }

/* ── Map Editor ─────────────────────────────────────────── */
#editor-panel {
  position: fixed;
  top: 46px;
  left: 10px;
  width: 220px;
  background: rgba(5, 14, 24, 0.96);
  border: 1px solid #1e3a50;
  border-radius: 8px;
  padding: 12px;
  z-index: 700;
  display: none;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #1e3a50 transparent;
}
#editor-panel.active { display: flex; }

#editor-overview-btn {
  width: 100%;
  background: #1a4a60;
  border: 1px solid #2a6a80;
  border-radius: 6px;
  color: #7ec8e3;
  font-family: 'Courier New', monospace;
  font-size: 0.82em;
  padding: 8px 0;
  cursor: pointer;
  letter-spacing: 1px;
  transition: background 0.15s;
  text-align: center;
}
#editor-overview-btn:hover { background: #2a6a80; }

.editor-section-title {
  font-size: 0.65em;
  color: #4a8aa0;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 2px;
}

.editor-palette {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.editor-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  padding: 5px 3px 4px;
  border: 2px solid transparent;
  border-radius: 5px;
  background: rgba(10, 28, 44, 0.5);
  transition: border-color 0.15s, background 0.15s;
  font-size: 0.6em;
  color: #5a8a9a;
}
.editor-swatch:hover { border-color: #2a6a80; background: rgba(20, 50, 70, 0.5); }
.editor-swatch.selected { border-color: #00ddff; background: rgba(0, 80, 120, 0.4); color: #7ec8e3; }

.editor-swatch-color {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.08);
}

.editor-swatch-solid {
  font-size: 0.85em;
  color: #cc6666;
  line-height: 1;
}

.editor-tools {
  display: flex;
  gap: 4px;
}

.editor-panel-row {
  display: flex;
  gap: 4px;
}

.editor-tool-btn {
  flex: 1;
  background: #0a2a40;
  border: 1px solid #1e3a50;
  border-radius: 5px;
  color: #7ec8e3;
  font-family: 'Courier New', monospace;
  font-size: 0.72em;
  padding: 6px 4px;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, border-color 0.15s;
}
.editor-tool-btn:hover { background: #1a4a60; border-color: #2a6a80; }
.editor-tool-btn.active { background: #1a5a70; border-color: #00ddff; color: #ffffff; }

.editor-action-btn {
  flex: 1;
  background: #0a1a28;
  border: 1px solid #1e3a50;
  border-radius: 5px;
  color: #90b8c8;
  font-family: 'Courier New', monospace;
  font-size: 0.7em;
  padding: 6px 4px;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s;
}
.editor-action-btn:hover { background: #0e2a3e; }

#editor-status {
  font-size: 0.68em;
  color: #3a6a7a;
  min-height: 1.2em;
  padding-top: 2px;
  border-top: 1px solid #0e2030;
}

/* ── Minimap edit button ─────────────────────────────────── */
#minimap-edit-btn {
  background: none;
  border: none;
  color: #3a5a6a;
  font-size: 1.1em;
  cursor: pointer;
  padding: 0 2px;
  margin-left: 4px;
  transition: color 0.15s;
}
#minimap-edit-btn:hover { color: #7ec8e3; }

/* ── Tutorial Overlay ──────────────────────────────────────── */
#tutorial-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: dialogueFadeIn 0.3s ease;
}
#tutorial-overlay.hidden { display: none; }

#tutorial-panel {
  background: rgba(5, 12, 22, 0.99);
  border: 2px solid #4a9cc0;
  border-radius: 12px;
  width: min(440px, 90vw);
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: 0 0 60px rgba(74, 156, 192, 0.3);
}

#tutorial-icon { font-size: 2.5em; }

#tutorial-title {
  font-size: 1.15em;
  color: #7ec8e3;
  font-weight: bold;
  letter-spacing: 2px;
}

#tutorial-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.tutorial-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.85em;
  color: #a0c4d8;
  line-height: 1.5;
}

.tutorial-num {
  background: #1a4a60;
  color: #7ec8e3;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75em;
  font-weight: bold;
  flex-shrink: 0;
}

#tutorial-close-btn {
  background: #1a4a60;
  border: 1px solid #2a6a80;
  border-radius: 6px;
  color: #7ec8e3;
  font-family: 'Courier New', monospace;
  font-size: 0.95em;
  padding: 10px 28px;
  cursor: pointer;
  margin-top: 6px;
  transition: background 0.15s;
  letter-spacing: 1px;
}
#tutorial-close-btn:hover { background: #2a6a80; }

/* ── Progress HUD ──────────────────────────────────────────── */
#progress-hud {
  position: fixed;
  top: 46px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(5, 14, 24, 0.9);
  border: 1px solid #1e3a50;
  border-radius: 0 0 8px 8px;
  padding: 4px 16px;
  font-family: 'Courier New', monospace;
  font-size: 0.72em;
  color: #5a9aaa;
  z-index: 150;
  letter-spacing: 0.5px;
}
#progress-hud.hidden { display: none; }

.hud-sep { color: #1e3a50; }

#hud-clues { color: #5aaa80; }
#hud-secrets { color: #c8a040; }
#hud-talked { color: #7a9cc0; }

/* ── Case File Tabs ────────────────────────────────────────── */
#casefile-tabs {
  display: flex;
  border-bottom: 1px solid #0e2a1e;
  background: rgba(8, 24, 16, 0.4);
  flex-shrink: 0;
  overflow-x: auto;
}

.cf-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: #3a6a4a;
  font-family: 'Courier New', monospace;
  font-size: 0.72em;
  padding: 8px 12px;
  cursor: pointer;
  letter-spacing: 0.5px;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  position: relative;
}
.cf-tab:hover { color: #5aaa80; }
.cf-tab.active { color: #5aaa80; border-bottom-color: #5aaa80; }

.cf-badge {
  background: #c06040;
  color: #fff;
  font-size: 0.85em;
  padding: 1px 5px;
  border-radius: 8px;
  margin-left: 4px;
}
.cf-badge.hidden { display: none; }

#casefile-content {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #1a3a28 transparent;
}

.cf-pane { display: none; padding: 4px 0; }
.cf-pane.active { display: block; }

.cf-empty { padding: 16px 14px; color: #2a5a3a; font-style: italic; font-size: 0.82em; text-align: center; }

/* Statement entries */
.cf-statement {
  padding: 8px 14px;
  border-bottom: 1px solid #0a1e16;
}
.cf-statement-speaker {
  color: #4a8aaa;
  font-size: 0.72em;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}
.cf-statement-text {
  color: #90c8a8;
  font-size: 0.82em;
  line-height: 1.5;
}

/* Contradiction entries */
.cf-contradiction {
  padding: 10px 14px;
  border-bottom: 1px solid #0a1e16;
  background: rgba(60, 20, 10, 0.15);
  border-left: 3px solid #c06040;
}
.cf-contradiction-title {
  color: #c06040;
  font-size: 0.75em;
  font-weight: bold;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.cf-contradiction-quote {
  color: #a09080;
  font-size: 0.8em;
  line-height: 1.4;
  font-style: italic;
  padding: 3px 0;
}
.cf-contradiction-quote strong { color: #c8a888; font-style: normal; }

/* Timeline entries */
.cf-timeline-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 14px;
  border-bottom: 1px solid #0a1e16;
}
.cf-timeline-time {
  color: #4a8aaa;
  font-size: 0.75em;
  min-width: 50px;
  font-weight: bold;
  flex-shrink: 0;
}
.cf-timeline-event {
  color: #90c8a8;
  font-size: 0.8em;
  line-height: 1.4;
}
.cf-timeline-who { color: #5aaa80; font-weight: bold; }
.cf-timeline-gap {
  background: rgba(60, 40, 10, 0.2);
  border-left: 3px solid #c8a040;
}

/* ── Topic Buttons ─────────────────────────────────────────── */
#topic-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 6px 12px;
  border-top: 1px solid #0e2030;
  background: rgba(5, 14, 22, 0.6);
}
#topic-buttons.hidden { display: none; }

.topic-btn {
  background: rgba(10, 28, 44, 0.9);
  border: 1px solid #1a3a50;
  border-radius: 12px;
  color: #5a9aaa;
  font-family: 'Courier New', monospace;
  font-size: 0.72em;
  padding: 4px 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.topic-btn:hover { background: rgba(20, 50, 70, 0.8); color: #7ec8e3; border-color: #2a6a80; }
.topic-btn.locked { opacity: 0.4; cursor: not-allowed; }

/* ── Accuse Readiness Warning ──────────────────────────────── */
#accuse-readiness {
  font-size: 0.78em;
  padding: 8px 12px;
  border-radius: 6px;
  line-height: 1.4;
}
#accuse-readiness.hidden { display: none; }
#accuse-readiness.warning {
  background: rgba(60, 40, 10, 0.3);
  border: 1px solid #5a4020;
  color: #c8a060;
}
#accuse-readiness.ready {
  background: rgba(10, 40, 25, 0.3);
  border: 1px solid #2a5a3a;
  color: #5aaa80;
}

/* ── NPC Unvisited Indicator ───────────────────────────────── */
@keyframes npcPulse {
  0%, 100% { opacity: 0.5; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
}
.npc-unvisited-indicator {
  font-size: 10px;
  color: #ffcc44;
  text-shadow: 0 0 6px rgba(255, 200, 60, 0.6);
  animation: npcPulse 2s ease-in-out infinite;
}

/* Object glint */
@keyframes objectGlint {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
.object-unexamined {
  text-shadow: 0 0 8px rgba(255, 255, 200, 0.8);
  animation: objectGlint 2.5s ease-in-out infinite;
}

/* ── NPC Cooperation Bar ───────────────────────────────────── */
#npc-coop-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px 6px;
  font-size: 0.68em;
  color: #3a6a7a;
}
#npc-coop-bar.hidden { display: none; }

#coop-label { letter-spacing: 0.5px; }

#coop-meter {
  flex: 1;
  height: 4px;
  background: #0e2030;
  border-radius: 2px;
  overflow: hidden;
  max-width: 120px;
}
#coop-fill {
  height: 100%;
  background: #4a9cc0;
  border-radius: 2px;
  transition: width 0.5s ease;
  width: 0%;
}

/* Room cards in editor panel */
.editor-room-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid #1a2e3e;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  margin-bottom: 3px;
}
.editor-room-card:last-child { margin-bottom: 0; }
.editor-room-card:hover { background: rgba(20, 50, 70, 0.4); border-color: #2a5a6a; }
.editor-room-card.active { border-color: #00ddff; background: rgba(0, 80, 120, 0.25); }

.editor-room-stripe {
  width: 4px;
  height: 28px;
  border-radius: 2px;
  flex-shrink: 0;
}

.editor-room-info {
  flex: 1;
  min-width: 0;
}
.editor-room-name {
  font-size: 0.72em;
  color: #b0d0e0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.editor-room-card.active .editor-room-name { color: #fff; }
.editor-room-meta {
  font-size: 0.6em;
  color: #3a5a6a;
}

/* ── Editor Overview Overlay ─────────────────────────────── */
#editor-overview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 8, 16, 0.96);
  z-index: 850;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: dialogueFadeIn 0.15s ease;
}
#editor-overview-overlay.hidden { display: none; }

#editor-overview-panel {
  background: #050e18;
  border: 2px solid #2a6a80;
  border-radius: 12px;
  width: min(900px, 94vw);
  height: min(700px, 88vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(74, 156, 192, 0.15);
}

#editor-overview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid #1a3a50;
  background: rgba(10, 25, 40, 0.8);
  color: #7ec8e3;
  font-size: 0.88em;
  font-weight: bold;
  letter-spacing: 2px;
  flex-shrink: 0;
}

#editor-overview-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

#editor-add-room-btn {
  background: #0a2a40;
  border: 1px solid #2a6a80;
  border-radius: 5px;
  color: #7ec8e3;
  font-family: 'Courier New', monospace;
  font-size: 0.82em;
  padding: 5px 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
#editor-add-room-btn:hover { background: #1a4a60; border-color: #4a9cc0; }

#editor-overview-close {
  background: none;
  border: 1px solid #2a4a5a;
  color: #4a7a8a;
  cursor: pointer;
  padding: 3px 10px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.9em;
  transition: color 0.15s, border-color 0.15s;
}
#editor-overview-close:hover { color: #cc4444; border-color: #cc4444; }

#editor-overview-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
}

#editor-overview-canvas {
  border-radius: 6px;
  cursor: pointer;
}

#editor-overview-status {
  padding: 8px 18px;
  border-top: 1px solid #1a3040;
  font-size: 0.72em;
  color: #4a7a8a;
  min-height: 2em;
  flex-shrink: 0;
}
