/* web/style.css — all visual styling for the web prototype */

/* ── Design tokens ────────────────────────────────────────────────────── */
:root {
  --bg:          #0d0d1b;
  --bg2:         #141428;
  --bg3:         #1c1c38;
  --bg4:         #242448;
  --border:      #2a2a50;
  --border-hi:   #4a4a80;
  --gold:        #d4a843;
  --gold-dim:    #8a6520;
  --gold-bright: #f0c060;
  --text:        #c8c8e4;
  --text-dim:    #7070a0;
  --text-bright: #eeeeff;
  --hp:          #c0392b;
  --hp-hi:       #e74c3c;
  --hp-ok:       #e67e22;
  --hp-full:     #27ae60;
  --mp:          #2471a3;
  --mp-hi:       #3498db;
  --xp:          #1a7a40;
  --xp-hi:       #27ae60;
  --danger:      #e74c3c;
  --warning:     #f39c12;
  --success:     #2ecc71;
  --combat-bg:   #1a0d0d;
  --radius:      6px;
  --radius-lg:   10px;
}

/* ── Reset / base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Loading screen ───────────────────────────────────────────────────── */
#loading {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 999;
  flex-direction: column;
  gap: 20px;
}
#loading-title {
  font-size: 32px; font-weight: 700;
  color: var(--gold);
  letter-spacing: 3px;
  text-transform: uppercase;
  text-shadow: 0 0 30px rgba(212,168,67,0.5);
}
#loading-sub  { color: var(--text-dim); font-size: 13px; letter-spacing: 2px; }
#loading-bar-wrap {
  width: 260px; height: 4px;
  background: var(--bg3);
  border-radius: 2px; overflow: hidden;
}
#loading-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  transition: width 0.4s ease;
}

/* ── Top header ───────────────────────────────────────────────────────── */
#hdr {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  height: 44px;
  display: flex; align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
#hdr-title {
  font-size: 15px; font-weight: 700;
  color: var(--gold);
  letter-spacing: 2px;
  text-transform: uppercase;
}
#hdr-loc {
  font-size: 12px; color: var(--text-dim);
  letter-spacing: 1px;
}

/* ── Main layout ──────────────────────────────────────────────────────── */
#game-ui {
  flex: 1; overflow: hidden;
  display: flex; flex-direction: column;
}
#content-area {
  flex: 1; overflow: hidden;
  display: flex;
}

/* ── Sidebar ──────────────────────────────────────────────────────────── */
#sidebar {
  width: 190px; flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 12px 10px;
  display: flex; flex-direction: column; gap: 10px;
  overflow-y: auto;
}
#player-name-class {
  font-size: 13px; line-height: 1.4;
  border-bottom: 1px solid var(--border); padding-bottom: 8px;
}
.player-name  { font-weight: 700; color: var(--text-bright); }
.player-class { color: var(--text-dim); font-size: 12px; }

#level-line { font-size: 12px; color: var(--text-dim); margin-bottom: 3px; }
#level-line strong { color: var(--gold); }
.prestige-badge {
  background: var(--gold-dim); color: var(--gold-bright);
  border-radius: 3px; padding: 0 4px; font-size: 10px;
  font-weight: 700; margin-left: 4px; vertical-align: middle;
}

/* ── Stat bars ────────────────────────────────────────────────────────── */
.bar-wrap {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 3px; height: 8px;
  overflow: hidden; margin-bottom: 1px;
}
.bar-fill {
  height: 100%; width: 0%;
  transition: width 0.3s ease, background 0.3s ease;
}
#hp-bar   { background: var(--hp-full); }
#mp-bar   { background: var(--mp); }
#xp-bar   { background: var(--xp-hi); }
.bar-label {
  font-size: 11px; color: var(--text-dim);
  display: flex; justify-content: space-between;
  margin-bottom: 3px;
}
.bar-label span { color: var(--text); font-weight: 600; }

/* ── Stats grid ───────────────────────────────────────────────────────── */
#stats-grid {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 4px; padding-top: 4px;
  border-top: 1px solid var(--border);
}
.stat-box {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 5px 4px;
  text-align: center;
}
.stat-label { font-size: 10px; color: var(--text-dim); display: block; }
.stat-val   { font-size: 14px; font-weight: 700; color: var(--text-bright); }

/* ── Wallet ───────────────────────────────────────────────────────────── */
#wallet-display {
  font-size: 12px; padding-top: 4px;
  border-top: 1px solid var(--border);
}
.cur-plat { color: #b19cd9; font-weight: 700; }
.cur-gold { color: var(--gold); font-weight: 700; }
.cur-silv { color: #aac4d8; font-weight: 700; }
.cur-cop  { color: #c8a080; }

/* ── Active effects ───────────────────────────────────────────────────── */
#effects-list {
  display: flex; flex-wrap: wrap; gap: 3px; padding-top: 4px;
}
.effect-chip {
  font-size: 10px; padding: 1px 5px;
  border-radius: 3px; border: 1px solid;
}
.effect-buff   { border-color: var(--success); color: var(--success); background: rgba(46,204,113,.1); }
.effect-debuff { border-color: var(--danger);  color: var(--danger);  background: rgba(231,76,60,.1); }

/* ── Main content area ────────────────────────────────────────────────── */
#main {
  flex: 1; overflow: hidden;
  display: flex; flex-direction: column;
}

/* ── Scene area (graphics) ────────────────────────────────────────────── */
#scene-area {
  flex-shrink: 0; height: 160px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  position: relative;
}
#scene-content { width: 100%; height: 100%; }

/* Generic scene fallback */
.scene-default {
  display: flex; align-items: center; justify-content: center;
  height: 100%;
  font-size: 48px; opacity: 0.15;
}

/* Main menu scene */
.scene-menu {
  display: flex; align-items: center; justify-content: center;
  height: 100%; flex-direction: column; gap: 8px;
  background: radial-gradient(ellipse at center, #1a1a35 0%, #0d0d1b 100%);
}
.scene-menu-title {
  font-size: 28px; font-weight: 900;
  color: var(--gold);
  letter-spacing: 4px; text-transform: uppercase;
  text-shadow: 0 0 40px rgba(212,168,67,0.6);
}
.scene-menu-sub {
  font-size: 12px; color: var(--text-dim);
  letter-spacing: 3px; text-transform: uppercase;
}

/* Location scene */
.scene-location {
  display: flex; align-items: center; padding: 0 24px;
  height: 100%; gap: 20px;
}
.scene-loc-icon {
  font-size: 64px; flex-shrink: 0;
  filter: drop-shadow(0 0 12px rgba(255,255,255,0.2));
}
.scene-loc-info { flex: 1; }
.scene-loc-name {
  font-size: 22px; font-weight: 700;
  color: var(--gold); margin-bottom: 4px;
}
.scene-loc-desc { font-size: 13px; color: var(--text-dim); }

/* Combat scene */
.scene-combat {
  display: flex; align-items: stretch;
  height: 100%;
  background: linear-gradient(135deg, #1a0505 0%, #0d0d1b 60%);
}
.combat-enemy-panel {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px; padding: 12px;
  border-right: 1px solid var(--border);
}
.combat-enemy-art  { font-size: 52px; line-height: 1; }
.combat-enemy-name {
  font-size: 15px; font-weight: 700;
  color: var(--text-bright); text-align: center;
}
.combat-enemy-tags { display: flex; gap: 4px; }
.elite-tag {
  font-size: 10px; padding: 1px 6px;
  background: rgba(255,165,0,.15); color: #ffa500;
  border: 1px solid #ffa500; border-radius: 3px;
  font-weight: 700;
}
.combat-hp-wrap { width: 100%; max-width: 180px; }
.combat-hp-label { font-size: 11px; color: var(--text-dim); margin-bottom: 3px; }
.combat-hp-bar-bg {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 3px; height: 10px; overflow: hidden;
}
.combat-hp-fill {
  height: 100%; transition: width 0.4s ease;
  background: linear-gradient(90deg, var(--hp), var(--hp-hi));
}
.combat-hp-text {
  font-size: 11px; color: var(--text-dim);
  text-align: right; margin-top: 2px;
}
.combat-info-panel {
  width: 200px; flex-shrink: 0;
  padding: 10px; display: flex;
  flex-direction: column; gap: 6px;
}
.combat-turn-label {
  font-size: 11px; color: var(--gold-dim);
  text-transform: uppercase; letter-spacing: 1px;
}
.snipe-ready {
  background: rgba(255,165,0,.1); border: 1px solid #ffa500;
  color: #ffa500; border-radius: var(--radius);
  padding: 4px 8px; font-size: 12px; text-align: center;
}

/* ── Game log ─────────────────────────────────────────────────────────── */
#log-area { flex: 1; overflow: hidden; position: relative; }
#game-log {
  height: 100%; overflow-y: auto;
  padding: 10px 14px;
  display: flex; flex-direction: column; gap: 3px;
  scroll-behavior: smooth;
}
#game-log::-webkit-scrollbar { width: 4px; }
#game-log::-webkit-scrollbar-track { background: var(--bg2); }
#game-log::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.msg         { font-size: 13px; color: var(--text); }
.msg-system  { color: var(--text-dim); font-style: italic; font-size: 12px; }
.msg-player  { color: #7eb8f5; }
.msg-enemy   { color: #f57e7e; }
.msg-info    { color: var(--text-dim); font-size: 12px; }
.msg-success { color: var(--success); font-weight: 600; }
.msg-xp      { color: var(--xp-hi); font-weight: 600; }
.msg-loot    { color: var(--gold); }
.msg-level   { color: var(--gold-bright); font-weight: 700; font-size: 14px; }
.msg-warn    { color: var(--warning); }
.dmg         { color: var(--hp-hi); font-weight: 700; }
.heal        { color: var(--hp-full); font-weight: 700; }
.msg-divider { height: 1px; background: var(--border); margin: 4px 0; border: none; }

/* ── Button area ──────────────────────────────────────────────────────── */
#btn-area {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 8px 12px;
  min-height: 56px;
  display: flex; flex-wrap: wrap;
  align-items: center; gap: 6px;
  flex-shrink: 0;
}

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  background: var(--bg3);
  border: 1px solid var(--border-hi);
  color: var(--text);
  border-radius: var(--radius);
  padding: 7px 14px;
  font-size: 13px; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn:hover {
  background: var(--bg4);
  border-color: var(--gold-dim);
  color: var(--text-bright);
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, #2c3e7a, #1a2a5a);
  border-color: #4a6aaa;
  color: #b0c8ff;
  font-weight: 600;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #3d5499, #2a3a7a);
  border-color: var(--gold-dim);
  color: var(--gold);
}

.btn-combat {
  background: linear-gradient(135deg, #3a1515, #2a0d0d);
  border-color: #6a2020;
  color: #f5a0a0;
  font-weight: 600;
}
.btn-combat:hover {
  background: linear-gradient(135deg, #5a2020, #3a1010);
  border-color: var(--hp-hi);
}

.btn-danger {
  background: linear-gradient(135deg, #4a1515, #2a0808);
  border-color: var(--danger);
  color: var(--danger);
  font-weight: 600;
}
.btn-danger:hover { background: #5a1515; color: #ff7070; }

.btn-ability {
  background: linear-gradient(135deg, #1a1a4a, #0d0d2a);
  border-color: #4040a0;
  color: #a0a0ff;
  font-size: 12px;
}
.btn-ability:hover { border-color: #7070e0; color: #c0c0ff; }
.btn-ability:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-location {
  background: var(--bg3);
  border: 1px solid var(--border-hi);
  padding: 8px 12px;
  text-align: left; min-width: 130px;
}
.btn-location .loc-icon { font-size: 16px; margin-right: 6px; }
.btn-location .loc-name { font-size: 13px; font-weight: 600; color: var(--text-bright); }

.btn-class {
  background: var(--bg3);
  border: 1px solid var(--border-hi);
  padding: 10px 16px;
  text-align: left; min-width: 180px;
}
.btn-class .class-name  { font-weight: 700; color: var(--gold); font-size: 14px; }
.btn-class .class-desc  { font-size: 11px; color: var(--text-dim); margin-top: 2px; display: block; }
.btn-class .class-stats { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

/* ── Char creation name input ─────────────────────────────────────────── */
.name-input-wrap {
  display: flex; gap: 8px; align-items: center; width: 100%;
}
.name-input {
  flex: 1;
  background: var(--bg3); border: 1px solid var(--border-hi);
  color: var(--text-bright);
  border-radius: var(--radius); padding: 7px 12px;
  font-size: 14px; font-family: inherit;
  outline: none;
}
.name-input:focus { border-color: var(--gold-dim); }

/* ── Shop / inventory item cards ──────────────────────────────────────── */
.item-card {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px 10px;
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.item-card:hover { border-color: var(--gold-dim); background: var(--bg4); }
.q-normal     { color: var(--text-dim); }
.q-good       { color: #5dade2; border: 1px solid #5dade2; background: rgba(93,173,226,.08); }
.q-great      { color: #a569bd; border: 1px solid #a569bd; background: rgba(165,105,189,.08); }
.q-perfect    { color: var(--gold); border: 1px solid var(--gold); background: rgba(212,168,67,.08); }
.q-masterwork { color: #f0c060; border: 1px solid #f0c060; background: rgba(240,192,96,.1); }
.q-legendary  { color: #ff8c42; border: 1px solid #ff8c42; background: rgba(255,140,66,.1); }

/* ── Game over ────────────────────────────────────────────────────────── */
.scene-gameover {
  display: flex; align-items: center; justify-content: center;
  height: 100%; flex-direction: column; gap: 8px;
  background: radial-gradient(ellipse at center, #2a0505 0%, #0d0d1b 100%);
}
.gameover-title {
  font-size: 40px; font-weight: 900;
  color: var(--hp-hi); letter-spacing: 6px;
  text-transform: uppercase;
  text-shadow: 0 0 40px rgba(231,76,60,0.7);
}
.gameover-sub { font-size: 13px; color: var(--text-dim); }

/* ── Scrollbar global ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Utility ──────────────────────────────────────────────────────────── */
.hidden      { display: none !important; }
.text-gold   { color: var(--gold); }
.text-dim    { color: var(--text-dim); }
.text-bright { color: var(--text-bright); }
hr.divider   { border: none; border-top: 1px solid var(--border); margin: 4px 0; }