/* Legenden von Andor – Styles */

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

:root {
  --bg:         #1a1410;
  --surface:    #2a2018;
  --surface2:   #362c1c;
  --border:     #5a4a2a;
  --gold:       #c8a040;
  --gold-light: #e8c060;
  --text:       #e8d8b0;
  --text-dim:   #8a7850;
  --red:        #cc3322;
  --green:      #448844;
  --accent:     #7a4a10;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Georgia', serif;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ─── Header ──────────────────────────────────────────────────────────────── */
#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  background: var(--surface2);
  border-bottom: 2px solid var(--border);
  flex-shrink: 0;
}
#header h1 {
  font-size: 1.1rem;
  color: var(--gold);
  letter-spacing: 1px;
}
#header-controls { display: flex; gap: 8px; }

/* ─── Main layout ─────────────────────────────────────────────────────────── */
#main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ─── Left panel – hero stats ─────────────────────────────────────────────── */
#left-panel {
  width: 200px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
#left-panel-header {
  padding: 6px 10px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Hero cards */
.hero-card {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.hero-card.active { background: rgba(200, 160, 64, 0.1); }
.hero-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-left: 6px;
  margin-bottom: 6px;
}
.hero-name { font-size: 0.85rem; font-weight: bold; color: var(--gold-light); }
.active-badge {
  font-size: 0.65rem;
  background: var(--gold);
  color: #1a1000;
  padding: 1px 5px;
  border-radius: 3px;
}
.hero-stats { font-size: 0.75rem; }
.stat-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 3px;
}
.stat-label { width: 48px; color: var(--text-dim); }
.stat-val { font-weight: bold; font-size: 0.8rem; }
.wp-bar-bg {
  flex: 1;
  height: 6px;
  background: #333;
  border-radius: 3px;
  overflow: hidden;
}
.wp-bar { height: 100%; border-radius: 3px; transition: width 0.3s; }
.hero-items { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 3px; }
.item-badge {
  font-size: 0.65rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--text-dim);
}
.hero-asleep {
  margin-top: 4px;
  font-size: 0.75rem;
  color: #88aaff;
  text-align: center;
}
.region-name { font-size: 0.7rem; color: var(--text-dim); max-width: 90px; }

/* ─── Center – board ──────────────────────────────────────────────────────── */
#center {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#board-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #2a4a2a;
}
#board-canvas {
  display: block;
  cursor: pointer;
}

/* ─── Action bar ──────────────────────────────────────────────────────────── */
#action-bar {
  padding: 8px 12px;
  background: var(--surface2);
  border-top: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.action-info { font-size: 0.85rem; color: var(--text); }
.action-buttons { display: flex; gap: 6px; }
.btn-action {
  padding: 5px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}
.btn-action:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--gold);
}
.btn-action.active {
  background: var(--gold);
  color: #1a1000;
  border-color: var(--gold-light);
}
.btn-action:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-end  { border-color: #664422; }
.btn-end:hover  { background: #662211; border-color: var(--red); }
.btn-sleep { border-color: #334488; }
.btn-sleep:hover { background: #223366; border-color: #6688cc; }
.action-hint {
  font-size: 0.75rem;
  color: var(--gold);
  font-style: italic;
  width: 100%;
}
.phase-msg { font-size: 0.85rem; color: var(--gold); font-style: italic; }

/* ─── Right panel ─────────────────────────────────────────────────────────── */
#right-panel {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-left: 2px solid var(--border);
  display: flex;
  flex-direction: column;
}

/* Status bars */
#status-panel {
  padding: 10px;
  border-bottom: 1px solid var(--border);
}
.panel-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.marker-track {
  height: 8px;
  background: #333;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 2px;
}
.marker-fill { height: 100%; border-radius: 4px; transition: width 0.3s; }
.marker-val { font-size: 0.75rem; color: var(--text); }

#phase-display {
  padding: 6px 10px;
  font-size: 0.8rem;
  color: var(--gold);
  border-bottom: 1px solid var(--border);
  text-align: center;
}

/* Log */
#log-container {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
}
#log-header {
  padding: 4px 10px;
  background: var(--surface2);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}
.log-entry {
  font-size: 0.72rem;
  padding: 3px 4px;
  border-bottom: 1px solid rgba(90,74,42,0.3);
  line-height: 1.4;
  color: var(--text);
}
.log-entry:first-child { color: var(--gold-light); }

/* ─── Buttons general ─────────────────────────────────────────────────────── */
.btn {
  padding: 6px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
}
.btn:hover { background: var(--accent); border-color: var(--gold); }
.btn-primary {
  background: var(--gold);
  color: #1a1000;
  border-color: var(--gold-light);
  font-weight: bold;
}
.btn-primary:hover { background: var(--gold-light); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── Modal ───────────────────────────────────────────────────────────────── */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
#modal-overlay.hidden { display: none; }
#modal-box {
  background: var(--surface);
  border: 2px solid var(--gold);
  border-radius: 8px;
  padding: 24px;
  max-width: 480px;
  width: 90%;
}
#modal-title {
  font-size: 1.1rem;
  color: var(--gold);
  margin-bottom: 12px;
}
#modal-text {
  font-size: 0.88rem;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--text);
  margin-bottom: 20px;
}
#modal-btn { float: right; }

/* ─── Setup screen ────────────────────────────────────────────────────────── */
#setup-screen {
  position: fixed;
  inset: 0;
  background: rgba(10,8,5,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  flex-direction: column;
  gap: 20px;
}
#setup-screen.hidden { display: none; }
#setup-box {
  background: var(--surface);
  border: 2px solid var(--gold);
  border-radius: 10px;
  padding: 30px 36px;
  max-width: 560px;
  width: 90%;
}
#setup-box h2 {
  font-size: 1.4rem;
  color: var(--gold);
  margin-bottom: 6px;
  text-align: center;
}
#setup-subtitle {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.82rem;
  margin-bottom: 20px;
}
#hero-select {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}
.hero-choice {
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.hero-choice:hover { border-color: var(--gold); }
.hero-choice.selected {
  border-color: var(--gold);
  background: rgba(200,160,64,0.12);
}
.hero-choice-name {
  font-weight: bold;
  color: var(--gold-light);
  margin-bottom: 4px;
}
.hero-choice-stats {
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.5;
}
.hero-choice-special {
  font-size: 0.72rem;
  color: #88aaff;
  margin-top: 4px;
  font-style: italic;
}
#setup-actions { display: flex; gap: 10px; justify-content: center; }

/* ─── Game over ───────────────────────────────────────────────────────────── */
#game-over-screen {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
}
#game-over-screen.hidden { display: none; }
#game-over-box {
  background: var(--surface);
  border: 3px solid var(--red);
  border-radius: 10px;
  padding: 30px 40px;
  text-align: center;
  max-width: 420px;
}
#game-over-title {
  font-size: 2rem;
  margin-bottom: 12px;
  color: var(--gold);
}
#game-over-msg {
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 20px;
  color: var(--text);
}

/* ─── Scrollbars ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
