:root {
  --bg: #0c1018;
  --panel: #141c28;
  --panel-edge: #243044;
  --text: #e8eef6;
  --muted: #8fa3b8;
  --gold: #d4a84b;
  --gold-dim: #a07830;
  --alliance: #4a8fd4;
  --horde: #c44c4c;
  --online: #3ecf7a;
  --offline: #6b7a8a;
  --input: #0a0e14;
  --radius: 10px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

.bg-glow {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(212, 168, 75, 0.12), transparent 55%),
    radial-gradient(ellipse 40% 40% at 100% 100%, rgba(74, 143, 212, 0.06), transparent 50%),
    radial-gradient(ellipse 40% 40% at 0% 80%, rgba(196, 76, 76, 0.05), transparent 50%);
  z-index: 0;
}

.top, .wrap, .foot {
  position: relative;
  z-index: 1;
}

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--panel-edge);
  background: linear-gradient(180deg, rgba(20, 28, 40, 0.95), rgba(12, 16, 24, 0.85));
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.crest {
  font-size: 1.75rem;
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #2a2210, #1a1408);
  border: 1px solid var(--gold-dim);
  color: var(--gold);
  box-shadow: 0 0 20px rgba(212, 168, 75, 0.15);
}

.brand h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--gold);
}

.sub {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  font-family: ui-monospace, "Cascadia Code", monospace;
}

.stats {
  display: flex;
  gap: 1rem;
}

.stat {
  text-align: center;
  min-width: 4.5rem;
  padding: 0.4rem 0.75rem;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
}

.stat .n {
  display: block;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--online);
  line-height: 1.2;
}

.stat .l {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 12px;
  padding: 1.15rem 1.25rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.panel h2 {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.panel-head h2 { margin: 0; }

.search-row {
  display: flex;
  gap: 0.5rem;
}

.search-row input {
  flex: 1;
  min-width: 0;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--panel-edge);
  background: var(--input);
  color: var(--text);
  font-size: 1rem;
  outline: none;
}

.search-row input:focus {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 2px rgba(212, 168, 75, 0.2);
}

button, .ghost {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 0.65rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 600;
  background: linear-gradient(180deg, #c9a04a, #8a6828);
  color: #1a1208;
  transition: filter 0.15s, transform 0.1s;
}

button:hover { filter: brightness(1.08); }
button:active { transform: scale(0.98); }

.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--panel-edge);
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.ghost:hover {
  color: var(--text);
  border-color: var(--muted);
  filter: none;
}

.linkish {
  background: none;
  border: none;
  color: var(--gold);
  padding: 0 0 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}

.linkish:hover { text-decoration: underline; filter: none; }

.hint {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.hint.error { color: #e07070; }

.results {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 0.65rem 1rem;
  align-items: center;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  width: 100%;
}

.row:hover {
  border-color: var(--panel-edge);
  background: rgba(212, 168, 75, 0.06);
  filter: none;
  transform: none;
}

.row .name {
  font-weight: 600;
}

.row .meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.row .lvl {
  font-variant-numeric: tabular-nums;
  color: var(--gold);
  font-weight: 600;
  font-size: 0.9rem;
}

.badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.badge.online { background: rgba(62, 207, 122, 0.15); color: var(--online); }
.badge.offline { background: rgba(107, 122, 138, 0.2); color: var(--offline); }
.badge.alliance { background: rgba(74, 143, 212, 0.15); color: var(--alliance); }
.badge.horde { background: rgba(196, 76, 76, 0.15); color: var(--horde); }

.empty {
  padding: 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.char-sheet {
  margin-top: 0.25rem;
}

.char-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--panel-edge);
  margin-bottom: 1rem;
}

.char-header h3 {
  margin: 0;
  font-size: 1.6rem;
  color: var(--gold);
}

.char-header .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.45rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.field {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--panel-edge);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
}

.field .k {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.field .v {
  font-weight: 600;
  font-size: 0.95rem;
}

.money .gold { color: #e8c84a; }
.money .silver { color: #c0c8d0; }
.money .copper { color: #c08050; }

.foot {
  text-align: center;
  padding: 1.5rem 1rem 2rem;
  color: var(--muted);
  font-size: 0.8rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem 1.5rem;
}

.foot a {
  color: var(--gold-dim);
  text-decoration: none;
}

.foot a:hover { color: var(--gold); }

@media (max-width: 560px) {
  .row {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
  }
  .row .meta { grid-column: 1 / -1; }
}
