/* ── Theme tokens ─────────────────────────────────────────────────────────── */
:root {
  --bg:          #0e0e12;
  --surface:     #16161e;
  --surface-hi:  #1e1e2a;
  --accent:      #888;
  --accent-dim:  #444;
  --accent-glow: rgba(100,100,100,0.15);
  --text:        #c8c8d4;
  --text-muted:  #66667a;
  --border:      #2a2a38;
  --stripe:      linear-gradient(90deg,#555,#333);
  --font-ui:     -apple-system,'Segoe UI',sans-serif;
  --font-mono:   'Courier New',monospace;
}

[data-theme="jinteki"] {
  --bg:          #130408;
  --surface:     #1c0810;
  --surface-hi:  #240c16;
  --accent:      #cc1133;
  --accent-dim:  #7a0018;
  --accent-glow: rgba(122,0,24,0.35);
  --text:        #f5e2e6;
  --text-muted:  #cc8899;
  --border:      #7a0018;
  --stripe:      linear-gradient(90deg,#cc1133,#7a0018);
  --font-ui:     'Cinzel',Georgia,serif;
  --font-mono:   'Courier New',monospace;
}

[data-theme="shaper"] {
  --bg:          #030e07;
  --surface:     #061808;
  --surface-hi:  #0b2410;
  --accent:      #22bb55;
  --accent-dim:  #186630;
  --accent-glow: rgba(24,102,48,0.3);
  --text:        #ccf0d8;
  --text-muted:  #66bb88;
  --border:      #186630;
  --stripe:      linear-gradient(90deg,#22bb55,#186630);
  --font-ui:     'Share Tech Mono','Courier New',monospace;
  --font-mono:   'Share Tech Mono','Courier New',monospace;
}

[data-theme="criminal"] {
  --bg:          #030b1c;
  --surface:     #051228;
  --surface-hi:  #081a36;
  --accent:      #1a78cc;
  --accent-dim:  #0a488a;
  --accent-glow: rgba(10,72,138,0.3);
  --text:        #ddf0ff;
  --text-muted:  #5599cc;
  --border:      #0a488a;
  --stripe:      linear-gradient(90deg,#1a78cc,#0a488a);
  --font-ui:     'Rajdhani',Arial,sans-serif;
  --font-mono:   'Courier New',monospace;
}

[data-theme="anarch"] {
  --bg:          #110500;
  --surface:     #1c0900;
  --surface-hi:  #260e00;
  --accent:      #dd4400;
  --accent-dim:  #882200;
  --accent-glow: rgba(136,34,0,0.3);
  --text:        #ffddc8;
  --text-muted:  #cc6633;
  --border:      #882200;
  --stripe:      linear-gradient(90deg,#dd4400,#882200);
  --font-ui:     'Bebas Neue','Arial Black',sans-serif;
  --font-mono:   'Courier New',monospace;
}

[data-theme="hb"] {
  --bg:          #0b0618;
  --surface:     #130a28;
  --surface-hi:  #1c1038;
  --accent:      #9944cc;
  --accent-dim:  #582888;
  --accent-glow: rgba(88,40,136,0.35);
  --text:        #ecdeff;
  --text-muted:  #aa77dd;
  --border:      #582888;
  --stripe:      linear-gradient(90deg,#9944cc,#582888);
  --font-ui:     'Orbitron','Trebuchet MS',sans-serif;
  --font-mono:   'Courier New',monospace;
}

/* ── Reset ────────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }

/* ── Base ─────────────────────────────────────────────────────────────────── */
body {
  margin: 0;
  font-family: -apple-system,'Segoe UI',Roboto,sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 1.5rem 1rem;
  background: var(--surface);
  border-bottom: 2px solid var(--accent-dim);
  box-shadow: 0 2px 20px var(--accent-glow);
  position: relative;
}
header::after {
  content: '';
  position: absolute;
  inset: auto 0 -2px;
  height: 2px;
  background: var(--stripe);
}
.header-left { flex: 1; min-width: 0; }
header h1 {
  margin: 0 0 0.2rem;
  font-size: 1.6rem;
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
header h1 a { color: var(--text); text-decoration: none; }
.tagline { margin: 0; color: var(--text-muted); font-size: 0.88rem; }

/* ── Nav ──────────────────────────────────────────────────────────────────── */
nav.crumbs { margin-top: 0.4rem; color: var(--text-muted); font-size: 0.88rem; }
nav.crumbs a { color: var(--accent); text-decoration: none; }
nav.crumbs .current { color: var(--text); }

/* ── Theme switcher ───────────────────────────────────────────────────────── */
.theme-switcher {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.theme-switcher .theme-label:not(:first-child) { margin-left: 0.75rem; }
.theme-label {
  font-size: 0.78rem;
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  white-space: nowrap;
}
.theme-switcher select {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  padding: 0.3rem 0.6rem;
  background: var(--surface-hi);
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  border-radius: 4px;
  cursor: pointer;
  outline: none;
  box-shadow: 0 0 6px var(--accent-glow);
}
.theme-switcher select:focus { border-color: var(--accent); }

/* ── Main ─────────────────────────────────────────────────────────────────── */
main { padding: 1.5rem; max-width: 720px; margin: 0 auto; }

/* ── Tiles ────────────────────────────────────────────────────────────────── */
.tiles { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.tile {
  display: block;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.tile:not(.disabled):hover {
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}
.tile h2 {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
  font-family: var(--font-ui);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.tile p { margin: 0; color: var(--text-muted); }
.tile.disabled { opacity: 0.5; cursor: not-allowed; }
.badge {
  font-size: 0.7rem;
  font-weight: normal;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.1rem 0.5rem;
  margin-left: 0.5rem;
  text-transform: none;
  letter-spacing: 0;
  font-family: -apple-system,'Segoe UI',sans-serif;
}

/* ── Scanner layout ───────────────────────────────────────────────────────── */
.scanner section { margin-bottom: 1.5rem; }
main.scanner { max-width: 1400px; }

.scanner-top {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.5rem;
  align-items: start;
  margin-bottom: 1.5rem;
}

.camera-col { min-width: 0; }

.camera-stage {
  position: relative;
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 0 24px var(--accent-glow);
}
.camera-stage video {
  display: block;
  width: 100%;
  max-width: none;
}
.camera-stage::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 3px,
    rgba(0,0,0,0.055) 3px,
    rgba(0,0,0,0.055) 4px
  );
  pointer-events: none;
  z-index: 1;
}
.camera-stage canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 2;
}

.scanner-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.75rem;
}
.scanner-controls .status { margin: 0; }

.view-btn {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0.6rem;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
}
.view-btn:hover { color: var(--text); border-color: var(--accent-dim); }
.view-btn.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}

.detected-col { min-width: 0; }
.detected-col h2,
.decklist h2 {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  font-family: var(--font-ui);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* ── Detected list ────────────────────────────────────────────────────────── */
.detected-list { list-style: none; padding: 0; margin: 0; }
.detected-list li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.detected-list li.conf-high { border-left: 3px solid #27ae60; }
.detected-list li.conf-low  { border-left: 3px solid #e67e22; }
.detected-list .card-name   { flex: 1; font-size: 0.9rem; min-width: 0; color: var(--text); }
.detected-list .cands       { display: flex; gap: 0.4rem; flex-wrap: wrap; width: 100%; margin-top: 0.3rem; }
.detected-list .add-btn     { padding: 0.2rem 0.7rem; font-size: 0.85rem; }
.detected-list .dismiss-btn { padding: 0.2rem 0.5rem; font-size: 0.85rem; background: var(--surface-hi); color: var(--text-muted); border-color: var(--border); }
.detected-list .cand-btn    { padding: 0.2rem 0.5rem; font-size: 0.8rem; background: var(--surface-hi); color: var(--text); border-color: var(--border); text-align: left; }
.detected-list .detected-empty { color: var(--text-muted); font-size: 0.9rem; padding: 0.5rem 0; list-style: none; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
video { width: 100%; max-width: 480px; border-radius: 6px; background: #000; }
.controls { margin-top: 0.75rem; display: flex; gap: 0.5rem; align-items: center; }

button {
  font: inherit;
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.5rem 1rem;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.15s;
}
button:hover { opacity: 0.85; }
button.remove {
  padding: 0.2rem 0.6rem;
  background: var(--surface-hi);
  color: var(--accent);
  border-color: var(--border);
  text-transform: none;
  letter-spacing: 0;
}
button.secondary,
label.btn-secondary {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent-dim);
}
button.secondary:hover,
label.btn-secondary:hover { background: var(--accent-glow); border-color: var(--accent); opacity: 1; }
label.btn-secondary {
  display: inline-flex;
  align-items: center;
  font: inherit;
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.5rem 1rem;
  border: 1px solid var(--accent-dim);
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s, border-color 0.15s;
}
.deck-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}
.deck-actions #clear-deck { margin-left: auto; }

select {
  font: inherit;
  font-family: var(--font-ui);
  padding: 0.4rem 0.6rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  outline: none;
}
select:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
option { background: var(--surface); color: var(--text); }

.status { color: var(--text-muted); min-height: 1.2em; }

/* ── Table ────────────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--accent-dim);
  color: var(--accent);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: var(--font-ui);
}
td { text-align: left; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--border); }

#candidate-list { list-style: none; padding: 0; }
#candidate-list li { margin-bottom: 0.4rem; }
#candidate-list button { width: 100%; text-align: left; background: var(--surface); color: var(--text); border-color: var(--border); }

/* ── Header right + user panel ────────────────────────────────────────────── */
.header-right { display: flex; align-items: center; flex-shrink: 0; }
.user-panel { position: relative; }
.user-trigger {
  display: inline-flex; align-items: center; gap: 0.5rem;
  cursor: pointer; list-style: none; user-select: none;
  color: var(--text);
}
.user-trigger::-webkit-details-marker { display: none; }
.user-trigger::marker { content: none; }
.user-name { font-family: var(--font-ui); font-size: 0.9rem; letter-spacing: 0.03em; }
.panel-chevron { font-size: 0.7rem; color: var(--text-muted); transition: transform 0.15s; }
.user-panel[open] .panel-chevron { transform: rotate(180deg); }
.panel-content {
  position: absolute; right: 0; top: calc(100% + 0.5rem);
  background: var(--surface-hi); border: 1px solid var(--border);
  border-radius: 6px; padding: 0.4rem 0; min-width: 170px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5); z-index: 200;
}
.panel-item {
  display: block; width: 100%; text-align: left;
  padding: 0.45rem 1rem;
  font-family: var(--font-ui); font-size: 0.85rem;
  color: var(--text); text-decoration: none;
  background: none; border: none; cursor: pointer;
}
.panel-item:hover { color: var(--accent); background: var(--surface); }
.panel-form { display: block; margin: 0; }
.panel-divider { height: 1px; background: var(--border); margin: 0.4rem 0; }
.panel-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.35rem 1rem; }
.panel-label { font-size: 0.75rem; color: var(--text-muted); font-family: var(--font-ui); text-transform: uppercase; letter-spacing: 0.1em; white-space: nowrap; }
.panel-content select {
  font-family: var(--font-ui); font-size: 0.8rem; padding: 0.2rem 0.4rem;
  background: var(--surface); color: var(--accent);
  border: 1px solid var(--accent-dim); border-radius: 4px; cursor: pointer; outline: none;
}

/* ── Avatars ──────────────────────────────────────────────────────────────── */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; object-fit: cover; flex-shrink: 0;
  background: var(--surface-hi); border: 1px solid var(--accent-dim);
  width: 32px; height: 32px;
}
.avatar-initials { color: var(--accent); font-family: var(--font-ui); font-weight: 700; text-transform: uppercase; }
.avatar-xs { width: 22px; height: 22px; font-size: 0.7rem; }
.avatar-sm { width: 30px; height: 30px; font-size: 0.85rem; }
.avatar-lg { width: 72px; height: 72px; font-size: 1.8rem; }

/* ── Text inputs / textarea (shared by auth, profile) ─────────────────────── */
input[type="text"], input[type="password"], input[type="number"], textarea {
  font: inherit; font-family: var(--font-ui);
  width: 100%; box-sizing: border-box;
  padding: 0.5rem 0.6rem;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px; outline: none;
}
input[type="text"]:focus, input[type="password"]:focus, input[type="number"]:focus, textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent);
}
textarea { resize: vertical; }

/* ── Auth pages ───────────────────────────────────────────────────────────── */
main.auth { max-width: 420px; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 1.5rem; }
.auth-card h2 {
  margin: 0 0 1rem; font-family: var(--font-ui); color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.06em; font-size: 1.2rem;
}
.auth-card form { display: flex; flex-direction: column; gap: 0.35rem; }
.auth-card label, .profile-form label {
  font-family: var(--font-ui); font-size: 0.78rem; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted); margin-top: 0.5rem;
}
.auth-card button { margin-top: 1rem; }
.auth-alt { margin: 1rem 0 0; color: var(--text-muted); font-size: 0.9rem; }
.auth-alt a { color: var(--accent); text-decoration: none; }
.auth-error {
  margin: 0 0 0.6rem; padding: 0.5rem 0.7rem; border-radius: 4px;
  background: rgba(204,17,51,0.12); border: 1px solid #cc1133; color: #ffb3c0; font-size: 0.9rem;
}
.auth-note {
  margin: 0 0 0.8rem; padding: 0.6rem 0.8rem; border-radius: 4px;
  background: var(--accent-glow); border: 1px solid var(--accent-dim); color: var(--text); font-size: 0.92rem;
}
.field-hint { margin: 0.2rem 0 0; color: var(--text-muted); font-size: 0.8rem; }

/* ── Profile ──────────────────────────────────────────────────────────────── */
main.profile { max-width: 560px; }
main.profile h2 { font-family: var(--font-ui); color: var(--accent); text-transform: uppercase; letter-spacing: 0.06em; }
.profile-head { display: flex; align-items: center; gap: 1rem; margin: 1rem 0 1.5rem; }
.profile-username { margin: 0; font-family: var(--font-ui); font-size: 1.15rem; }
.profile-role { margin: 0.2rem 0 0; color: var(--text-muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; }
.profile-form {
  display: flex; flex-direction: column; gap: 0.35rem;
  padding: 1.25rem; margin-bottom: 1.5rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
}
.profile-form h3 { margin: 0 0 0.5rem; font-family: var(--font-ui); color: var(--accent); font-size: 1rem; text-transform: uppercase; letter-spacing: 0.05em; }
.profile-form select { align-self: flex-start; min-width: 160px; }
.profile-form button { margin-top: 1rem; align-self: flex-start; }

/* ── Admin ────────────────────────────────────────────────────────────────── */
main.admin { max-width: 900px; }
main.admin h2 { font-family: var(--font-ui); color: var(--accent); text-transform: uppercase; letter-spacing: 0.06em; }
.user-table td { vertical-align: middle; }
.user-table td:first-child { display: flex; align-items: center; gap: 0.5rem; }
.row-actions { white-space: nowrap; }
.you { color: var(--text-muted); font-size: 0.8rem; }
button.mini { padding: 0.25rem 0.6rem; font-size: 0.72rem; }
button.mini.ok { background: transparent; color: #22bb55; border-color: #186630; }
button.mini.ok:hover { background: rgba(34,187,85,0.12); opacity: 1; }
button.mini.danger { background: transparent; color: #cc4444; border-color: #7a2020; }
button.mini.danger:hover { background: rgba(204,68,68,0.12); opacity: 1; }
.status-pending   { color: #e0a000; }
.status-approved  { color: #22bb55; }
.status-suspended { color: #cc4444; }
.temp-pass { font-family: var(--font-mono); background: var(--surface-hi); padding: 0.15rem 0.4rem; border-radius: 3px; color: var(--accent); }

/* ── Card browser ─────────────────────────────────────────────────────────── */
main.cards, main.card-detail { max-width: 1200px; }
.card-filters { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.card-filters input[type="text"] { width: auto; flex: 1 1 220px; }
.card-filters .cost-input { width: 90px; }
.result-count { color: var(--text-muted); font-size: 0.85rem; margin: 0 0 1rem; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; }
.card-cell {
  display: flex; flex-direction: column; gap: 0.4rem; text-decoration: none; color: var(--text);
  padding: 0.5rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.card-cell:hover { border-color: var(--accent); box-shadow: 0 0 14px var(--accent-glow); }
.card-cell img { width: 100%; border-radius: 4px; display: block; background: #000; aspect-ratio: 5/7; object-fit: cover; }
.card-cell-title { font-size: 0.82rem; line-height: 1.2; }
/* placeholder slot under each cell — card type for now, richer content later */
.card-slot { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 0.1rem 0.4rem; border-radius: 3px; align-self: flex-start; border: 1px solid var(--border); color: var(--text-muted); }
.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; margin-top: 1.5rem; }
.pager a { color: var(--accent); text-decoration: none; }
.pager-at { color: var(--text-muted); font-size: 0.85rem; }

/* card detail */
.back-link { display: inline-block; margin-bottom: 1rem; color: var(--accent); text-decoration: none; }
.card-detail-grid { display: grid; grid-template-columns: 320px 1fr; gap: 2rem; align-items: start; }
.card-full { width: 100%; border-radius: 8px; background: #000; }
.card-meta h2 { margin: 0 0 0.3rem; font-family: var(--font-ui); color: var(--accent); text-transform: uppercase; letter-spacing: 0.04em; }
.card-sub { color: var(--text-muted); margin: 0 0 0.8rem; }
.card-sub .unit { font-size: 0.7em; margin-left: 1px; }
.faction-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0.45rem 0 0.9rem;
  padding: 0.38rem 0.65rem 0.38rem 0.5rem;
  border: 1px solid var(--fac, #888);
  border-left: 3px solid var(--fac, #888);
  border-radius: 2px;
  background: color-mix(in srgb, var(--fac, #888) 40%, var(--surface-hi));
  font-family: var(--font-mono);
}
.fac-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--fac, #888);
  overflow: visible;
}
.fac-name {
  flex: 1;
  color: var(--fac, #888);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.pip-track {
  display: flex;
  gap: 4px;
  padding: 4px 8px;
  border: 1px solid color-mix(in srgb, var(--fac, #888) 35%, transparent);
  border-radius: 20px;
  background: color-mix(in srgb, var(--fac, #888) 6%, var(--bg));
}
.pip {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--fac, #888) 50%, transparent);
}
.pip.on {
  background: var(--fac, #888);
  border-color: var(--fac, #888);
  box-shadow: 0 0 5px var(--fac, #888);
}
.card-sets { margin: 0 0 0.8rem; font-size: 0.9rem; color: var(--text-muted); }
.card-sets-label { opacity: 0.7; margin-right: 0.3rem; }
.card-sets .set-name { color: var(--text); }
.card-text { line-height: 1.5; margin: 1rem 0; }
.rulings { padding-left: 1.1rem; color: var(--text-muted); font-size: 0.9rem; }
.rulings li { margin-bottom: 0.5rem; }
.ruling-date { opacity: 0.7; }

/* inline card-text symbols (NSG game glyphs, tinted to text colour) */
.ci { height: 1em; width: 1em; fill: currentColor; vertical-align: -0.14em; margin: 0 0.05em; }
/* faction pips as colour-coded chips (glyphs too heavy to inline) */
.fac { display: inline-block; font-size: 0.8em; line-height: 1.35; padding: 0 0.35em; border: 1px solid var(--fac); color: var(--fac); border-radius: 3px; white-space: nowrap; vertical-align: 0.06em; }
/* wider gap between newline-separated ability lines */
.card-text br.ct-br, .rulings br.ct-br { display: block; content: ""; margin-top: 1.1em; }

/* glossary term underlines */
.gloss-term {
  border-bottom: 1px dotted var(--text-muted);
  cursor: help;
  color: inherit;
  text-decoration: none;
}
.gloss-term[data-active] {
  border-bottom-color: var(--accent);
  color: var(--accent);
}

/* glossary tooltip popup */
.gloss-tip {
  position: fixed;
  z-index: 200;
  max-width: 280px;
  background: var(--surface-hi);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 3px;
  padding: 0.55rem 0.75rem;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text);
  box-shadow: 0 4px 24px rgba(0,0,0,0.55);
  pointer-events: none;
}
.gloss-tip[hidden] { display: none; }
.attribution { margin-top: 1.5rem; font-size: 0.72rem; color: var(--text-muted); }
@media (max-width: 640px) { .card-detail-grid { grid-template-columns: 1fr; } }
