/* ARCHON 2.5D — professional theme (slate / gold / crimson). No purple. */
:root {
  --bg-900: #0b1220;
  --bg-800: #0f172a;
  --bg-700: #1e293b;
  --bg-600: #273449;
  --line:   #33445f;
  --text:   #e6edf6;
  --muted:  #93a4bd;

  --light:  #f6c453;   /* Order / Light side gold */
  --light-2:#fff2cc;
  --dark:   #e2503f;   /* Chaos / Dark side crimson */
  --dark-2: #7f1d1d;
  --teal:   #2dd4bf;
  --sky:    #38bdf8;

  --ok:     #34d399;
  --warn:   #fbbf24;
  --shadow: 0 12px 40px rgba(0,0,0,.55);
  --radius: 14px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%;
  background:
    radial-gradient(1200px 700px at 70% -10%, #16233c 0%, rgba(22,35,60,0) 60%),
    radial-gradient(900px 600px at -10% 110%, #201826 0%, rgba(32,24,38,0) 55%),
    var(--bg-900);
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
}
#app { display: flex; flex-direction: column; height: 100%; }

/* ---------- Top bar ---------- */
#topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 12px 22px;
  background: linear-gradient(180deg, rgba(20,32,54,.95), rgba(15,23,42,.85));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-mark { color: var(--light); font-size: 20px; text-shadow: 0 0 14px rgba(246,196,83,.6); }
.brand-name { font-weight: 800; letter-spacing: 4px; font-size: 20px; }
.brand-sub  { color: var(--muted); font-size: 12px; letter-spacing: 1px; }

.turn-indicator {
  margin-left: auto; display: flex; align-items: center; gap: 10px;
  padding: 7px 16px; border: 1px solid var(--line); border-radius: 999px;
  background: rgba(255,255,255,.03); font-weight: 600; font-size: 14px;
}
.turn-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--light);
  box-shadow: 0 0 12px currentColor; }
.topbar-actions { display: flex; gap: 8px; }

.btn {
  font-family: var(--font); font-weight: 600; font-size: 13px; letter-spacing: .3px;
  color: var(--text); background: linear-gradient(180deg, var(--bg-600), var(--bg-700));
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 16px; cursor: pointer;
  transition: transform .08s ease, border-color .15s ease, box-shadow .15s ease;
}
.btn:hover { border-color: var(--teal); box-shadow: 0 0 0 1px rgba(45,212,191,.25); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-ghost { background: rgba(255,255,255,.03); }
.btn-primary { background: linear-gradient(180deg, #f6c453, #e0a834); color: #2a1c04; border-color: #b98718; }
.btn-danger  { background: linear-gradient(180deg, #e2503f, #b6362a); color: #fff; border-color: #8f271d; }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }

/* ---------- Stage ---------- */
#stage-wrap { flex: 1; display: flex; min-height: 0; }
#game { flex: 1; display: flex; align-items: center; justify-content: center; }
#game canvas { border-radius: 10px; }

#sidebar {
  width: 320px; flex: 0 0 320px; padding: 16px; overflow-y: auto;
  border-left: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(15,23,42,.6), rgba(11,18,32,.6));
  display: flex; flex-direction: column; gap: 14px;
}
.panel {
  background: linear-gradient(180deg, rgba(39,52,73,.55), rgba(23,33,52,.55));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
}
.panel h3 { margin: 0 0 10px; font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
.hint { color: var(--muted); font-size: 12.5px; line-height: 1.5; margin: 6px 0 0; }

/* Luminance bar */
.lumibar { display: flex; gap: 4px; height: 26px; }
.lumibar span { flex: 1; border-radius: 5px; border: 1px solid rgba(255,255,255,.08); }

/* Inspect */
#inspect-title { color: var(--text); text-transform: none; letter-spacing: .3px; font-size: 16px; }
.stat-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 13px; margin-top: 8px; }
.stat-grid .k { color: var(--muted); }
.stat-grid .v { font-weight: 600; text-align: right; }
.hpbar { height: 8px; border-radius: 4px; background: #223; overflow: hidden; margin-top: 4px; }
.hpbar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--ok), #a7f3d0); }
.piece-emoji { font-size: 30px; }

/* Score */
.score-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; }
.score-row + .score-row { border-top: 1px solid rgba(255,255,255,.05); }
.side-tag { font-size: 10px; font-weight: 800; letter-spacing: 1px; padding: 3px 8px; border-radius: 6px; }
.side-tag.light { background: rgba(246,196,83,.15); color: var(--light); border: 1px solid rgba(246,196,83,.35); }
.side-tag.dark  { background: rgba(226,80,63,.15); color: var(--dark); border: 1px solid rgba(226,80,63,.35); }
.side-tag.neutral { background: rgba(45,212,191,.12); color: var(--teal); border: 1px solid rgba(45,212,191,.3); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; display: none; align-items: center; justify-content: center;
  background: rgba(6,10,20,.72); backdrop-filter: blur(4px); z-index: 50;
}
.modal-overlay.show { display: flex; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(680px, 92vw); max-height: 86vh; overflow: hidden; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--bg-700), var(--bg-800));
  border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
  animation: pop .2s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes pop { from { transform: translateY(12px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 19px; letter-spacing: .5px; }
.modal-close { margin-left: auto; background: none; border: none; color: var(--muted); font-size: 26px; line-height: 1; cursor: pointer; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px 22px; overflow-y: auto; line-height: 1.6; font-size: 14px; }
.modal-body h4 { margin: 16px 0 6px; color: var(--light); font-size: 14px; }
.modal-body p, .modal-body li { color: #cdd8e8; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }

/* Spell grid */
.spell-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.spell-card {
  border: 1px solid var(--line); border-radius: 12px; padding: 14px; cursor: pointer;
  background: rgba(255,255,255,.02); transition: border-color .15s, transform .08s;
}
.spell-card:hover { border-color: var(--teal); transform: translateY(-2px); }
.spell-card.used { opacity: .35; pointer-events: none; }
.spell-card .sc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.spell-card .sc-emoji { font-size: 24px; }
.spell-card .sc-name { font-weight: 700; }
.spell-card .sc-desc { color: var(--muted); font-size: 12.5px; line-height: 1.45; }

.center-msg { text-align: center; }
.center-msg .big { font-size: 40px; margin: 6px 0; }
.win-light { color: var(--light); }
.win-dark  { color: var(--dark); }

kbd {
  background: var(--bg-600); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 6px; padding: 2px 7px; font-family: var(--font); font-size: 12px; font-weight: 600;
}
