/* Realm Console — shared shell.
   Dark slate with a parchment-gold accent: readable next to a game window at
   night, and distinct enough from the game's own UI that you never mistake one
   for the other. */

:root {
  --bg:        #070a0e;
  --panel:     #0e141c;
  --panel-2:   #131b25;
  --line:      #1e2a38;
  --line-soft: #17222e;
  --ink:       #ccd6e4;
  --ink-dim:   #7c8b9e;
  --ink-faint: #4d5a6b;
  --gold:      #e0b64f;
  --gold-dim:  #8a6f2c;
  --ally:      #4a8fe0;
  --horde:     #c0392b;
  --ok:        #4ec9a0;
  --warn:      #e0a54f;
  --bad:       #e05252;
  --radius:    10px;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  --sans: ui-sans-serif, system-ui, "Segoe UI", Inter, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--ink);
  font: 14px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- app shell ---------- */

.app { display: flex; flex-direction: column; height: 100%; }

header.bar {
  display: flex; align-items: center; gap: 1rem;
  padding: .55rem .9rem;
  background: linear-gradient(180deg, #121a24, #0c1219);
  border-bottom: 1px solid var(--line);
  flex: none;
}

.brand {
  font-weight: 650; letter-spacing: .14em; text-transform: uppercase;
  font-size: .74rem; color: var(--gold);
  display: flex; align-items: center; gap: .5rem;
}
.brand::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 10px var(--gold);
}

nav.tabs { display: flex; gap: .25rem; }
nav.tabs a {
  padding: .3rem .75rem; border-radius: 6px; font-size: .82rem;
  color: var(--ink-dim); text-decoration: none;
}
nav.tabs a:hover { background: var(--panel-2); color: var(--ink); }
nav.tabs a.on { background: var(--panel-2); color: var(--gold); }

.spacer { flex: 1; }

.pill {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .18rem .55rem; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line);
  font-size: .74rem; color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}
.pill b { color: var(--ink); font-weight: 600; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-faint); }
.dot.live { background: var(--ok); box-shadow: 0 0 8px var(--ok); animation: pulse 2.4s infinite; }
.dot.stale { background: var(--bad); box-shadow: 0 0 8px var(--bad); }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }

/* ---------- buttons & inputs ---------- */

button, .btn {
  font: inherit; font-size: .82rem;
  padding: .34rem .7rem; border-radius: 6px;
  background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--line); cursor: pointer;
}
button:hover, .btn:hover { border-color: var(--gold-dim); color: #fff; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--gold); color: #14100a; border-color: var(--gold); font-weight: 600; }
button.primary:hover { background: #f0c96a; color: #14100a; }
button.danger { border-color: #5a2222; color: #ff9a9a; }
button.danger:hover { background: #3a1414; border-color: var(--bad); color: #fff; }

input[type=text], input[type=number], input[type=search], select, textarea {
  font: inherit; font-size: .82rem;
  background: #0a0f15; color: var(--ink);
  border: 1px solid var(--line); border-radius: 6px;
  padding: .34rem .55rem; width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--gold-dim);
  box-shadow: 0 0 0 2px rgba(224, 182, 79, .12);
}

label.field { display: block; margin-bottom: .6rem; }
label.field > span {
  display: block; font-size: .7rem; text-transform: uppercase;
  letter-spacing: .08em; color: var(--ink-dim); margin-bottom: .22rem;
}

.switch { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--ink-dim); cursor: pointer; }
.switch input { accent-color: var(--gold); }

/* ---------- scrollbars ---------- */

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #1c2836; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #2a3a4d; }

/* ---------- toast ---------- */

#toasts {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 90;
  display: flex; flex-direction: column; gap: .5rem; max-width: 26rem;
}
.toast {
  background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 8px; padding: .55rem .75rem;
  box-shadow: 0 8px 30px rgba(0,0,0,.55);
  animation: rise .18s ease-out;
}
.toast.ok  { border-left-color: var(--ok); }
.toast.bad { border-left-color: var(--bad); }
.toast .t { font-size: .78rem; font-weight: 600; margin-bottom: .15rem; }
.toast .m { font-size: .76rem; color: var(--ink-dim); white-space: pre-wrap;
            font-family: var(--mono); max-height: 9rem; overflow: auto; }
@keyframes rise { from { transform: translateY(8px); opacity: 0 } }

/* ---------- modal ---------- */

.backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(4, 7, 10, .72); backdrop-filter: blur(3px);
  display: grid; place-items: center;
}
.modal {
  width: min(30rem, calc(100vw - 2rem));
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 24px 70px rgba(0,0,0,.7);
  overflow: hidden;
}
.modal h3 {
  margin: 0; padding: .7rem .9rem; font-size: .88rem;
  border-bottom: 1px solid var(--line); background: var(--panel-2);
  display: flex; align-items: center; gap: .5rem;
}
.modal h3 .x {
  margin-left: auto; border: none; background: none; color: var(--ink-faint);
  font-size: 1.35rem; line-height: 1; padding: 0 .2rem; border-radius: 4px;
}
.modal h3 .x:hover { color: #fff; background: #2a3444; }

button.warn { border-color: #5a4620; color: #ffce8a; }
button.warn:hover { background: #3a2c12; border-color: var(--warn); color: #fff; }
.modal .body { padding: .9rem; }
.modal .foot {
  display: flex; justify-content: flex-end; gap: .5rem;
  padding: .7rem .9rem; border-top: 1px solid var(--line); background: #0b1017;
}
.modal .note {
  font-size: .76rem; color: var(--warn);
  background: rgba(224,165,79,.08); border: 1px solid rgba(224,165,79,.22);
  border-radius: 6px; padding: .45rem .6rem; margin-bottom: .7rem;
}

.mono { font-family: var(--mono); font-size: .78rem; }
.dim  { color: var(--ink-dim); }
.faint { color: var(--ink-faint); }
.nums { font-variant-numeric: tabular-nums; }
