/* ══════════════════════════════════════════════════════
   HAWKING COVE GM TOOL — styles.css
   Dark fantasy aesthetic. Functional first, styled second.
   ══════════════════════════════════════════════════════ */

/* ── TOKENS ── */
:root {
  --ink:        #0e0c0a;
  --panel:      #16120e;
  --panel-2:    #1e1814;
  --border:     #2e2820;
  --border-hi:  #4a3c30;
  --ember:      #c8622a;
  --ember-hi:   #e07840;
  --gold:       #b8922a;
  --gold-hi:    #d4aa4a;
  --ash:        #6b6259;
  --fog:        #9c9088;
  --text:       #d8c9b0;
  --text-dim:   #7a6e62;
  --blood:      #7a2020;
  --success:    #4a8a5a;
  --radius:     4px;
  --gap:        1rem;
}

/* ── RESET & BASE ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: Georgia, 'Times New Roman', serif;
  background: var(--ink);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── UTILITY ── */
.hidden { display: none !important; }
.loading-placeholder { color: var(--text-dim); font-style: italic; font-size: 0.8rem; padding: 0.5rem 0; }

/* ── HEADER ── */
#header {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  height: 48px;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

#campaign-title {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  font-family: 'Courier New', monospace;
  color: var(--gold);
  font-weight: bold;
}

#header-sep { color: var(--ember); margin: 0 0.5rem; }

#session-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: 'Courier New', monospace;
}

#header-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

/* ── STATUS ── */
#status-indicator { display: flex; align-items: center; gap: 0.4rem; }
#status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ash);
}
#status-dot.ok    { background: var(--success); }
#status-dot.busy  { background: var(--gold); animation: pulse 1s infinite; }
#status-dot.error { background: var(--blood); }

@keyframes pulse { 50% { opacity: 0.3; } }

#status-text { font-size: 0.72rem; color: var(--text-dim); font-family: 'Courier New', monospace; }

/* ── DICE ── */
.btn-dice {
  background: var(--panel-2);
  border: 1px solid var(--border-hi);
  color: var(--text);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: Georgia, serif;
  transition: border-color 0.15s, color 0.15s;
}
.btn-dice:hover { border-color: var(--ember); color: var(--ember-hi); }

.dice-result {
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  font-weight: bold;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius);
  background: var(--panel-2);
  border: 1px solid var(--border);
  transition: all 0.2s;
}
.dice-result.pos { color: var(--success); border-color: var(--success); }
.dice-result.neg { color: var(--blood); border-color: var(--blood); }
.dice-result.zero { color: var(--fog); }

/* ── MAIN LAYOUT ── */
#layout {
  display: grid;
  grid-template-columns: 240px 1fr 220px;
  gap: 0;
  flex: 1;
  overflow: hidden;
}

/* ── PANELS ── */
section {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 1rem;
}
section:last-child { border-right: none; }

section::-webkit-scrollbar { width: 3px; }
section::-webkit-scrollbar-thumb { background: var(--border); }

.panel-title {
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  font-family: 'Courier New', monospace;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

/* ── PC CARDS ── */
.pc-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem;
  margin-bottom: 0.65rem;
}

.pc-card:last-child { margin-bottom: 0; }

.pc-name {
  font-size: 0.82rem;
  font-weight: bold;
  color: var(--gold-hi);
  margin-bottom: 0.2rem;
  letter-spacing: 0.05em;
}

.pc-concept {
  font-size: 0.75rem;
  font-style: italic;
  color: var(--fog);
  margin-bottom: 0.3rem;
  line-height: 1.4;
}

.pc-trouble {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.pc-trouble strong { color: var(--blood); }

.pc-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Fate point pips */
.fate-pips {
  display: flex;
  gap: 3px;
  align-items: center;
}

.fate-pip {
  width: 9px; height: 9px;
  border-radius: 50%;
  border: 1px solid var(--border-hi);
  background: transparent;
  cursor: pointer;
  transition: background 0.1s;
}

.fate-pip.filled { background: var(--gold); border-color: var(--gold); }
.fate-pip:hover { border-color: var(--ember); }

.fate-label {
  font-size: 0.62rem;
  color: var(--text-dim);
  font-family: 'Courier New', monospace;
  margin-right: 0.3rem;
}

.btn-compel-pc {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.65rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: Georgia, serif;
  transition: all 0.15s;
}

.btn-compel-pc:hover { border-color: var(--ember); color: var(--ember-hi); }

/* Stress boxes */
.stress-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.4rem;
  font-size: 0.62rem;
  color: var(--text-dim);
}

.stress-label { font-family: 'Courier New', monospace; width: 1.5rem; }

.stress-box {
  width: 13px; height: 13px;
  border: 1px solid var(--border-hi);
  border-radius: 2px;
  background: transparent;
  cursor: pointer;
  transition: background 0.1s;
}

.stress-box.marked { background: var(--ember); border-color: var(--ember); }
.stress-box.mental.marked { background: var(--blood); border-color: var(--blood); }
.stress-box:hover { border-color: var(--fog); }

/* ── SCENE ── */
#scene-block {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem;
  margin-bottom: 0.75rem;
}

.scene-name {
  font-size: 1rem;
  font-style: italic;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.aspect-list { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.5rem; }

.aspect-tag {
  display: inline-block;
  background: var(--panel-2);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  color: var(--text-dim);
  font-style: italic;
  cursor: pointer;
  transition: all 0.15s;
  align-self: flex-start;
}

.aspect-tag:hover { border-color: var(--ember); color: var(--text); }

.scene-stakes {
  font-size: 0.72rem;
  color: var(--ash);
  font-style: italic;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border);
  margin-top: 0.4rem;
}

/* ── ACTION BAR ── */
#action-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.btn-action {
  background: var(--panel);
  border: 1px solid var(--border-hi);
  color: var(--text);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.78rem;
  font-family: Georgia, serif;
  transition: all 0.15s;
  flex: 1;
  min-width: 120px;
}

.btn-action:hover { border-color: var(--ember); color: var(--ember-hi); }
.btn-action:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-action.active { border-color: var(--ember); background: var(--panel-2); }

/* ── AI RESPONSE PANEL ── */
#ai-panel {
  background: var(--panel);
  border: 1px solid var(--ember);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  overflow: hidden;
}

#ai-panel-header {
  background: var(--panel-2);
  padding: 0.4rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

#ai-panel-label {
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  font-family: 'Courier New', monospace;
  color: var(--ember);
  text-transform: uppercase;
}

#ai-panel-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0 0.25rem;
  transition: color 0.1s;
}
#ai-panel-close:hover { color: var(--text); }

#ai-response {
  padding: 0.85rem;
  font-size: 0.82rem;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
  max-height: 260px;
  overflow-y: auto;
}

#ai-response::-webkit-scrollbar { width: 3px; }
#ai-response::-webkit-scrollbar-thumb { background: var(--border); }

/* Loading animation in AI panel */
.ai-loading { color: var(--text-dim); font-style: italic; }
.ai-loading::after {
  content: '...';
  animation: ellipsis 1.2s infinite;
}
@keyframes ellipsis {
  0%   { content: '.'; }
  33%  { content: '..'; }
  66%  { content: '...'; }
}

/* ── SESSION LOG ── */
#log-block { margin-top: 0.25rem; }

#log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.btn-small {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.7rem;
  font-family: Georgia, serif;
  transition: all 0.15s;
}
.btn-small:hover { border-color: var(--border-hi); color: var(--text); }
.btn-ghost { border-color: transparent; }
.btn-ghost:hover { border-color: var(--border); }

#event-input-row {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
  align-items: center;
}

#event-input {
  flex: 1;
  background: var(--panel-2);
  border: 1px solid var(--border-hi);
  color: var(--text);
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-family: Georgia, serif;
  outline: none;
  transition: border-color 0.15s;
}
#event-input:focus { border-color: var(--ember); }
#event-input::placeholder { color: var(--text-dim); font-style: italic; }

#event-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-height: 200px;
  overflow-y: auto;
}

#event-list::-webkit-scrollbar { width: 3px; }
#event-list::-webkit-scrollbar-thumb { background: var(--border); }

.event-item {
  font-size: 0.75rem;
  color: var(--text-dim);
  padding: 0.3rem 0.5rem;
  border-left: 2px solid var(--border);
  line-height: 1.4;
}

.event-item.new {
  border-left-color: var(--ember);
  color: var(--text);
  background: var(--panel-2);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.event-time {
  font-size: 0.62rem;
  color: var(--ash);
  font-family: 'Courier New', monospace;
  margin-right: 0.4rem;
}

/* ── NPC CARDS ── */
.npc-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: border-color 0.15s;
}

.npc-card:hover { border-color: var(--border-hi); }
.npc-card.selected { border-color: var(--ember); }

.npc-name { font-size: 0.8rem; color: var(--text); margin-bottom: 0.15rem; font-weight: bold; }
.npc-role { font-size: 0.68rem; color: var(--ash); font-style: italic; margin-bottom: 0.3rem; }
.npc-aspects { display: flex; flex-direction: column; gap: 0.2rem; }
.npc-aspect-tag {
  font-size: 0.65rem;
  color: var(--text-dim);
  font-style: italic;
  background: var(--panel-2);
  padding: 0.15rem 0.4rem;
  border-radius: 2px;
  align-self: flex-start;
}

.btn-npc-dialogue {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.62rem;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius);
  cursor: pointer;
  margin-top: 0.35rem;
  font-family: Georgia, serif;
  transition: all 0.15s;
}
.btn-npc-dialogue:hover { border-color: var(--ember); color: var(--ember-hi); }

/* ── THREADS ── */
#threads-block { margin-top: 1rem; }

.thread-item {
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: padding-left 0.15s;
}

.thread-item:hover { padding-left: 0.3rem; }
.thread-item:last-child { border-bottom: none; }

.thread-name {
  font-size: 0.75rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.15rem;
}

.thread-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.thread-dot.active  { background: var(--ember); }
.thread-dot.seeded  { background: var(--gold); }
.thread-dot.hidden  { background: var(--ash); }

.thread-status { font-size: 0.65rem; color: var(--text-dim); font-style: italic; padding-left: 1rem; }

/* ── MODALS ── */
#modal-overlay, #fp-modal-overlay, #interpret-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

#modal, #fp-modal {
  background: var(--panel-2);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  width: 420px;
  max-width: 90vw;
  overflow: hidden;
}

#modal-header, #fp-modal-header {
  background: var(--panel);
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

#modal-title, #fp-modal-title {
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  font-family: 'Courier New', monospace;
  color: var(--ember);
  text-transform: uppercase;
}

#modal-close, #fp-modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.8rem;
  transition: color 0.1s;
}
#modal-close:hover, #fp-modal-close:hover { color: var(--text); }

#modal-body, #fp-modal-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

label {
  font-size: 0.65rem;
  font-family: 'Courier New', monospace;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

select, textarea {
  background: var(--ink);
  border: 1px solid var(--border-hi);
  color: var(--text);
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-family: Georgia, serif;
  outline: none;
  width: 100%;
  transition: border-color 0.15s;
}

select:focus, textarea:focus { border-color: var(--ember); }
textarea { resize: vertical; }

/* ── FP EDITOR IN MODAL ── */
.fp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}
.fp-row:last-child { border-bottom: none; }
.fp-char-name { font-size: 0.8rem; color: var(--text); }
.fp-controls { display: flex; align-items: center; gap: 0.5rem; }
.fp-btn {
  background: none;
  border: 1px solid var(--border-hi);
  color: var(--text-dim);
  width: 22px; height: 22px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.1s;
}
.fp-btn:hover { color: var(--ember); border-color: var(--ember); }
.fp-count {
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  color: var(--gold-hi);
  min-width: 1.5rem;
  text-align: center;
}

/* ── PC ASPECT TAGS (in PC cards) ── */
.pc-aspects-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}

.pc-aspect-tag {
  font-size: 0.62rem;
  font-style: italic;
  color: var(--text-dim);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.15rem 0.4rem;
  cursor: pointer;
  transition: all 0.15s;
}

.pc-aspect-tag:hover { border-color: var(--ember); color: var(--text); }

/* ── INTERPRET MODAL ── */
#interpret-modal {
  background: var(--panel-2);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  width: 380px;
  max-width: 90vw;
  overflow: hidden;
}

#interpret-modal-header {
  background: var(--panel);
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

#interpret-modal-title {
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  font-family: 'Courier New', monospace;
  color: var(--ember);
  text-transform: uppercase;
}

#interpret-modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.8rem;
  transition: color 0.1s;
}
#interpret-modal-close:hover { color: var(--text); }

#interpret-modal-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#interpret-skill {
  background: var(--ink);
  border: 1px solid var(--border-hi);
  color: var(--text);
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-family: Georgia, serif;
  outline: none;
  width: 100%;
  transition: border-color 0.15s;
}
#interpret-skill:focus { border-color: var(--ember); }
#interpret-skill::placeholder { color: var(--text-dim); font-style: italic; }

/* ── SCROLLBAR GLOBAL ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
