/* The page is a fixed matte dark grey. Only the armory panel is tinted: it
   mixes the selected character's class colour (--cc, set in assets/app.js)
   into its bands and stage. */
:root {
  --font: Tahoma, Verdana, Geneva, sans-serif;
  --bg: #121212;        /* matte dark-mode background */
  --ink: #e2e2e2;       /* text sitting directly on the page */
  --ink-muted: #9a9a9a;
  --panel: #1c1c1c;
  --panel-2: #282828;
  --well: #141414;
  --line: #343434;
  --accent: #f0f0f0;
  --tan: #c9b28a;
  --text: #e6e6e6;      /* text inside panels */
  --muted: #9c9c9c;
  --discord: #5865f2;
  --radius: 10px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font);
}
h1, h2, h3 { margin: 0; }
a { color: var(--accent); }
code { background: #0006; padding: 1px 6px; border-radius: 4px; }
.muted { color: var(--muted); }
:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

/* ---- Top bar ---- */
.topbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 24px;
  padding: 10px max(16px, calc(50% - 644px));
  background: var(--panel); border-bottom: 1px solid var(--line); color: var(--text);
}
.topbar h1 { font-size: 20px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.tagline { color: var(--muted); font-size: 13px; }
.stats { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-left: auto; font-size: 13px; color: var(--muted); }
.stat b { color: var(--text); margin-right: 4px; }
.nav { display: flex; gap: 18px; }
.nav a { color: var(--muted); text-decoration: none; font-size: 13px; }
.nav a:hover { color: var(--accent); }

.banner { background: #2b2618; color: #f3e3b3; border-bottom: 1px solid #4a4230; text-align: center; padding: 10px 16px; font-size: 14px; }

/* ---- Layout ---- */
main { max-width: 1320px; margin: 0 auto; padding: 0 16px; }
section { padding: 22px 0 8px; }
.section-head .muted, footer { color: var(--ink-muted); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.section-head h2 { font-size: 20px; color: var(--ink); }

.roster-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; align-items: start; }

/* ---- Roster list ---- */
.roster-side {
  position: sticky; top: 12px;
  display: flex; flex-direction: column;
  max-height: calc(100dvh - 24px);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; color: var(--text);
}
.controls { display: flex; gap: 8px; margin-bottom: 10px; }
input[type=search], select {
  background: var(--well); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 14px;
}
input[type=search] { flex: 1; min-width: 0; }
.chips { display: flex; gap: 4px; margin-bottom: 10px; }
.chip {
  flex: 1 1 0; min-width: 0; white-space: nowrap;
  background: var(--well); border: 1px solid var(--line); color: var(--muted);
  border-radius: 6px; padding: 3px 0; font: inherit; font-size: 11px; font-weight: 700; cursor: pointer; text-align: center;
}
.chip small { font-size: 10px; font-weight: 400; opacity: .75; margin-left: 2px; }
.chip[aria-pressed=true] { border-color: currentColor; background: var(--panel-2); }
.roster-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; min-height: 0; }
.row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: 0; border-left: 3px solid transparent; border-radius: 6px;
  padding: 7px 8px; cursor: pointer; text-align: left; color: inherit; font: inherit;
}
.row:hover { background: var(--panel-2); }
.row[aria-current=true] { background: var(--panel-2); border-left-color: var(--cc); }
.avatar {
  flex: none; width: 36px; height: 36px; border-radius: 8px; object-fit: cover;
  background: var(--panel-2); border: 1px solid var(--line);
  display: grid; place-items: center; font: 700 16px var(--font); color: var(--cc, var(--accent));
}
.row-main { flex: 1; min-width: 0; }
.row-name, .row-sub { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-name { font-weight: 600; color: var(--cc, var(--text)); }
.row-sub { font-size: 12px; color: var(--muted); }
.row-level { flex: none; font: 700 18px var(--font); color: var(--accent); }
.empty { text-align: center; padding: 20px 0; margin: 0; }

/* ---- Armory panel ---- */
.armory {
  --cc: #8a8f8c;
  --band-1: color-mix(in srgb, var(--cc) 36%, #1a1c1b);
  --band-2: color-mix(in srgb, var(--cc) 27%, #161817);
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--cc) 35%, #2a2d2c); border-radius: var(--radius); overflow: hidden;
  background: color-mix(in srgb, var(--cc) 8%, #121413);
  box-shadow: 0 6px 24px #0004;
}
.band {
  background: linear-gradient(var(--band-1), var(--band-2));
  border-top: 6px solid var(--tan); border-bottom: 6px solid var(--tan);
  box-shadow: inset 0 2px 0 #0006, inset 0 -2px 0 #0006;
}
.armory > .band:first-child { border-top: 0; }

.char-head { display: flex; align-items: center; gap: 18px; padding: 22px 28px; flex-wrap: wrap; }
.char-head .avatar { width: 84px; height: 84px; border-radius: 16px; font-size: 36px; border: 2px solid #fff3; box-shadow: 0 4px 14px #0008; }
.char-id { flex: 1; min-width: 200px; }
.char-meta { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #dfe5e1; }
.char-meta .cls { color: var(--cc); }
.char-id h3 { font-size: clamp(30px, 4.6vw, 50px); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; overflow-wrap: anywhere; }
.char-guild { font-size: 14px; color: #dfe5e1; }
.badge { display: inline-block; margin-left: 4px; padding: 1px 7px; border: 1px solid #4fd1b5; border-radius: 4px; color: #7be8cf; font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; vertical-align: middle; }
.scores { display: flex; }
.score { padding: 0 22px; }
.score + .score { border-left: 1px solid #fff3; }
.score b { display: block; font-size: 40px; font-weight: 800; line-height: 1.1; }
.score span { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #dfe5e1; }

.stage {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px;
  padding: 32px clamp(16px, 8%, 110px) 20px;
  background: radial-gradient(ellipse 60% 55% at 50% 50%, color-mix(in srgb, var(--cc) 34%, #1c1e1d) 0%, color-mix(in srgb, var(--cc) 17%, #161817) 55%, color-mix(in srgb, var(--cc) 8%, #121413) 100%);
}
.slots { display: flex; flex-direction: column; gap: 8px; }
.slots-bottom { grid-column: 1 / -1; flex-direction: row; justify-content: center; margin-top: 8px; }
.figure { display: grid; place-items: center; min-height: 420px; position: relative; }
.figure::after { content: ''; position: absolute; bottom: 8%; left: 15%; right: 15%; height: 36px; border-radius: 50%; background: radial-gradient(color-mix(in srgb, var(--cc) 45%, transparent), transparent 70%); }
.render { max-width: 100%; max-height: 460px; object-fit: contain; position: relative; z-index: 1; }
.figure-placeholder { font: 900 180px var(--font); color: var(--cc); opacity: .25; line-height: 1; }

.slot {
  position: relative; width: 54px; height: 54px; padding: 0; flex: none;
  background: color-mix(in srgb, var(--cc) 8%, #17191a); border: 2px solid var(--q, color-mix(in srgb, var(--cc) 25%, #2a2d2c)); border-radius: 6px;
  box-shadow: 0 2px 6px #0008; color: var(--muted); font: inherit; cursor: default;
}
.slot.filled { cursor: pointer; }
.slot img { width: 100%; height: 100%; object-fit: cover; border-radius: 3px; display: block; }
.slot-abbr { display: block; overflow: hidden; font-size: 8.5px; text-transform: uppercase; opacity: .7; }
.slot-ilvl { position: absolute; right: 2px; bottom: 0; font-size: 11px; font-weight: 700; color: #fff; text-shadow: 0 0 3px #000, 0 0 3px #000; }
.tip {
  display: none; position: absolute; z-index: 5; top: 0; width: 290px;
  background: #0a0a0af5; border: 1px solid var(--q, var(--line)); border-radius: 6px;
  padding: 9px 11px; text-align: left; font-size: 12.5px; line-height: 1.45; color: #fff; font-weight: 400;
  box-shadow: 0 6px 20px #000a; pointer-events: none;
}
.slot:hover .tip, .slot:focus .tip { display: block; }
.slots-left .tip { left: calc(100% + 8px); }
.slots-right .tip { right: calc(100% + 8px); }
.slot.tip-up .tip { top: auto; bottom: 0; }
.slots-bottom .tip { top: auto; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); }
.tip-name { display: block; font-size: 14px; font-weight: 700; color: var(--q, #fff); }
.tip-line { display: block; white-space: pre-line; }
.tip-pair { display: flex; justify-content: space-between; gap: 12px; }
.tip-gold { color: #ffd100; }
.tip-green { color: #1eff00; }
.tip-pink { color: #ff80ff; }
.tip-muted { color: #9d9d9d; }

.vitals { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 28px; flex-wrap: wrap; }
.spec { background: #e6dcc8; color: #2a2114; border-radius: 6px; padding: 9px 16px; font-weight: 700; box-shadow: 0 2px 6px #0006; }
.spec small { font-weight: 500; opacity: .7; margin-left: 6px; }
.vital-list { display: flex; gap: 30px; flex-wrap: wrap; margin-left: auto; }
.vital { text-align: center; }
.vital b { display: block; font-size: 28px; font-weight: 800; line-height: 1.1; color: #f1e9d6; }
.vital b::after { content: ''; display: block; width: 18px; height: 3px; border-radius: 2px; margin: 6px auto 4px; background: var(--vc, var(--tan)); }
.vital span { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #dfe5e1; }

.sheet { padding: 36px 28px 32px; background: linear-gradient(#6d5a37, #57482c); color: #f1e9d6; }
.sheet-eyebrow { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #e4d6b5; }
.sheet h4 { margin: 2px 0 20px; font-size: 26px; font-weight: 800; letter-spacing: -.01em; }
.sheet dl { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 48px; }
.sheet dl div { display: flex; align-items: baseline; gap: 8px; }
.sheet dl div::before { content: ''; order: 1; flex: 1; border-bottom: 2px dotted #ffffff40; }
.sheet dt { order: 0; color: #e4d6b5; }
.sheet dd { order: 2; margin: 0; font-weight: 700; font-size: 16px; }
.sheet-foot { margin: 24px 0 0; font-size: 12px; color: #e4d6b5; }
.armory-empty { padding: 60px 24px; text-align: center; color: var(--muted); }

/* ---- Discord ---- */
.discord-card {
  display: grid; grid-template-columns: minmax(220px, 1fr) 2fr; gap: 24px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
}
.discord-info h3 { font: 700 22px var(--font); margin-bottom: 6px; }
.btn { display: inline-block; margin-top: 14px; padding: 10px 18px; border-radius: 8px; background: var(--discord); color: #fff; text-decoration: none; font-weight: 600; }
.btn:hover { filter: brightness(1.12); }
.discord-members { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; max-height: 340px; overflow-y: auto; }
.discord-members li { display: flex; align-items: center; gap: 10px; background: #0005; border-radius: 8px; padding: 7px 10px; min-width: 0; }
.dm-avatar { position: relative; flex: none; width: 32px; height: 32px; }
.dm-avatar img { width: 32px; height: 32px; border-radius: 50%; display: block; background: var(--panel-2); }
.dot { position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--panel); background: #80848e; }
.dot.online { background: #23a55a; } .dot.idle { background: #f0b232; } .dot.dnd { background: #f23f43; }
.dm-text { min-width: 0; }
.dm-text b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-text small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

footer { text-align: center; color: var(--ink-muted); font-size: 13px; padding: 56px 16px 32px; }

@media (max-width: 900px) {
  .roster-layout { grid-template-columns: 1fr; }
  .roster-side { position: static; max-height: 340px; }
  .discord-card { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .tagline { display: none; }
  .stats { margin-left: 0; width: 100%; order: 3; }
  .nav { margin-left: auto; }
  .char-head, .vitals, .sheet { padding-left: 16px; padding-right: 16px; }
  .stage { padding: 20px 10px 14px; gap: 8px; }
  .slot { width: 44px; height: 44px; }
  .slots { gap: 6px; }
  .figure { min-height: 300px; }
  .figure-placeholder { font-size: 110px; }
  .score { padding: 0 14px; }
  .score b { font-size: 30px; }
  .tip { width: 220px; }
  .sheet dl { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, :root { transition: none !important; scroll-behavior: auto !important; }
}
