/* ── panels & headings ───────────────────────────────────── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.25rem; }
.panel-tight { padding: 0.875rem 1rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; margin-bottom: 0.875rem; }
.panel-title { font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.01em; }
.panel-link { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.75rem; color: var(--text-2); background: none; border: 0; padding: 0; }
.panel-link:hover { color: var(--text); }
.eyebrow { font-size: 0.6875rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.sec { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin: 1.75rem 0 0.875rem; }
.sec:first-child { margin-top: 0; }
.sec h2 { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.01em; }
.sec span { font-size: 0.75rem; color: var(--text-3); text-align: right; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.cols-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(17.5rem, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.lead { color: var(--text-2); font-size: 0.875rem; }
.fine { color: var(--text-3); font-size: 0.75rem; line-height: 1.5; }
.fine + .fine { margin-top: 0.35rem; }

/* ── buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  height: 2.25rem;
  padding: 0 1rem;
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 500;
  font-size: 0.8125rem;
  white-space: nowrap;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.btn:hover { background: var(--surface-3); border-color: rgba(255, 255, 255, 0.22); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.42; cursor: not-allowed; transform: none; }
.btn .ic { width: 1rem; height: 1rem; }
.btn-primary { background: #eceff4; color: var(--on-light); border-color: transparent; font-weight: 600; }
.btn-primary:hover { background: #ffffff; border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface); color: var(--text); border-color: transparent; }
.btn-danger { color: #ffb3b6; }
.btn-danger:hover { background: var(--ruby-soft); border-color: rgba(226, 71, 77, 0.4); }
.btn-sm { height: 1.875rem; padding: 0 0.75rem; font-size: 0.75rem; }
.btn-icon { width: 2.25rem; padding: 0; }
.btn-icon.btn-sm { width: 1.875rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.actions-end { justify-content: flex-end; }

/* ── badges & tags ───────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 1.5rem;
  padding: 0 0.6rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-2);
  white-space: nowrap;
}
.badge .ic { width: 0.75rem; height: 0.75rem; }
.badge-mint { color: var(--mint); background: var(--mint-soft); border-color: rgba(75, 214, 156, 0.28); }
.badge-gold { color: var(--gold); background: var(--gold-soft); border-color: rgba(233, 180, 76, 0.3); }
.badge-ruby { color: #ff9a9e; background: var(--ruby-soft); border-color: rgba(226, 71, 77, 0.32); }
.badge-sky { color: var(--sky); background: var(--sky-soft); border-color: rgba(116, 184, 255, 0.3); }
.badge-amber { color: var(--amber); background: var(--amber-soft); border-color: rgba(240, 169, 74, 0.3); }
.badge-light { color: var(--on-light); background: #e8ebf0; border-color: transparent; }

/* ── lists ───────────────────────────────────────────────── */
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 0.875rem; padding: 0.75rem 0; border-top: 1px solid var(--line); min-width: 0; }
.rows > .row:first-child { border-top: 0; padding-top: 0.25rem; }
.rows > .row:last-child { padding-bottom: 0.25rem; }
.row-icon { width: 2.125rem; height: 2.125rem; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex: none; }
.row-icon.mint { color: var(--mint); background: var(--mint-soft); }
.row-icon.ruby { color: #ff9a9e; background: var(--ruby-soft); }
.row-icon.gold { color: var(--gold); background: var(--gold-soft); }
.row-icon.sky { color: var(--sky); background: var(--sky-soft); }
.row-icon.amber { color: var(--amber); background: var(--amber-soft); }
.row-body { flex: 1; min-width: 0; }
.row-title { font-weight: 500; font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 0.75rem; color: var(--text-3); margin-top: 0.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-end { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 0.875rem; flex: none; }
.row-end small { display: block; font-weight: 400; color: var(--text-3); font-size: 0.6875rem; margin-top: 0.1rem; }
.row .actions { flex: none; }

/* ── stats ───────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 0.75rem; }
.stat { padding: 0.875rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); min-width: 0; }
.stat-label { font-size: 0.75rem; color: var(--text-3); display: flex; align-items: center; gap: 0.4rem; }
.stat-label .ic { width: 0.875rem; height: 0.875rem; }
.stat-value { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 0.3rem; line-height: 1.1; }
.stat-value small { font-size: 0.75rem; font-weight: 500; color: var(--text-3); margin-left: 0.25rem; letter-spacing: 0; }
.stat-foot { font-size: 0.6875rem; color: var(--text-4); margin-top: 0.3rem; }

/* ── meters ──────────────────────────────────────────────── */
.bar { height: 0.375rem; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--lvl-a), var(--lvl-b)); transition: width 0.7s var(--ease); }
.bar.neutral > i { background: rgba(255, 255, 255, 0.55); }
.bar.mint > i { background: var(--mint); }
.bar.ruby > i { background: var(--ruby); }
.bar.amber > i { background: var(--amber); }
.bar.sky > i { background: var(--sky); }
.bar-line { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.75rem; color: var(--text-3); margin-top: 0.4rem; font-variant-numeric: tabular-nums; }
.bar-line b { color: var(--text-2); font-weight: 500; }
.ring { position: relative; width: 6.5rem; height: 6.5rem; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 5; }
.ring .track { stroke: var(--surface-2); }
.ring .fill { stroke: url(#lvl); stroke-linecap: round; transition: stroke-dashoffset 0.9s var(--ease); }
.ring-center { position: absolute; inset: 0.55rem; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); text-align: center; }
.ring-center b { font-size: 1.75rem; font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.ring-center small { display: block; font-size: 0.5625rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); margin-top: 0.15rem; font-weight: 600; }

/* ── tabs & search ───────────────────────────────────────── */
.toolbar { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.tabs { display: inline-flex; gap: 0.2rem; padding: 0.2rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.tab { height: 1.875rem; padding: 0 0.875rem; border-radius: var(--r-sm); font-size: 0.8125rem; font-weight: 500; color: var(--text-2); border: 0; background: transparent; display: inline-flex; align-items: center; gap: 0.4rem; transition: background var(--t-fast), color var(--t-fast); }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset; }
.tab .n { font-size: 0.6875rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
.search { display: flex; align-items: center; gap: 0.5rem; height: 2.25rem; padding: 0 0.875rem; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); min-width: 16rem; color: var(--text-3); transition: border-color var(--t-fast); }
.search:focus-within { border-color: var(--line-2); color: var(--text-2); }
.search input { background: none; border: 0; outline: 0; width: 100%; color: var(--text); }
.search input::placeholder { color: var(--text-3); }
.pager { display: flex; align-items: center; justify-content: center; gap: 0.75rem; margin-top: 1.5rem; font-size: 0.75rem; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ── definition lists ────────────────────────────────────── */
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.4rem 1rem; font-size: 0.8125rem; }
.kv dt { color: var(--text-3); }
.kv dd { color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.kv dd.mint { color: var(--mint); font-weight: 600; }
.kv-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: 0.75rem 1rem; }
.kv-strip > div span { display: block; font-size: 0.6875rem; color: var(--text-3); }
.kv-strip > div b { display: block; font-size: 1.0625rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; margin-top: 0.15rem; }

/* ── empty, skeleton ─────────────────────────────────────── */
.empty { padding: 2.25rem 1.5rem; text-align: center; border: 1px dashed var(--line-2); border-radius: var(--r-lg); color: var(--text-2); }
.empty .ic { margin: 0 auto; color: var(--text-3); }
.empty h3 { margin: 0.75rem 0 0.35rem; color: var(--text); font-size: 0.9375rem; font-weight: 600; }
.empty p { font-size: 0.8125rem; max-width: 30rem; margin: 0 auto; }
.empty .btn { margin-top: 1rem; }
.skeleton { display: grid; gap: 1rem; }
.skeleton i { display: block; border-radius: var(--r-lg); height: 7rem; background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.6s linear infinite; }
.skeleton i:first-child { height: 3rem; width: 40%; }

/* ── modal ───────────────────────────────────────────────── */
dialog {
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  background: var(--glass-strong);
  color: var(--text);
  padding: 0;
  width: min(31rem, 92vw);
  max-height: 88vh;
  box-shadow: var(--shadow-pop);
  font-size: 0.875rem;
}
dialog[open] { animation: rise 0.25s var(--ease) both; }
/* No live blur behind the modal: a full-screen backdrop-filter repaints the whole window on every frame in the game. */
dialog::backdrop { background: rgba(4, 6, 10, 0.66); }
.modal-form { display: flex; flex-direction: column; max-height: 88vh; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.375rem 1.5rem 0; }
.modal-head h2 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.modal-desc { padding: 0.5rem 1.5rem 0; color: var(--text-2); font-size: 0.8438rem; line-height: 1.5; }
.modal-body { padding: 1rem 1.5rem 0; overflow-y: auto; display: flex; flex-direction: column; gap: 0.875rem; }
.modal-body .kv { padding: 0.875rem 1rem; background: var(--surface); border-radius: var(--r-md); border: 1px solid var(--line); }
.modal-body h3 { font-size: 0.9375rem; font-weight: 600; }
.modal-error { padding: 0 1.5rem; color: #ff9a9e; font-size: 0.8125rem; min-height: 0; }
.modal-error:not(:empty) { padding-top: 0.75rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; padding: 1.25rem 1.5rem 1.5rem; }
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field label { font-size: 0.75rem; color: var(--text-2); font-weight: 500; }
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.5rem 0.875rem;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line-2);
  color: var(--text);
  outline: 0;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.field textarea { resize: vertical; line-height: 1.45; }
.field select option { background: #14181f; color: var(--text); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: rgba(255, 255, 255, 0.4); background: var(--surface-2); }
details.variant { font-size: 0.75rem; color: var(--text-3); }
details.variant summary { cursor: pointer; color: var(--text-2); }
details.variant code { display: block; margin-top: 0.4rem; word-break: break-all; color: var(--text-2); }

/* ── toast ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 2.5rem;
  transform: translate(-50%, 1rem);
  opacity: 0;
  z-index: 50;
  max-width: min(36rem, 90vw);
  padding: 0.75rem 1.125rem;
  border-radius: var(--r-md);
  background: var(--glass-strong);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow-pop);
  font-size: 0.8125rem;
  pointer-events: none;
  transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── misc ────────────────────────────────────────────────── */
.dot-live { display: inline-block; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 0.2rem var(--mint-soft); }
.hr { height: 1px; background: var(--line); margin: 1rem 0; }
.note { padding: 0.75rem 0.875rem; border-radius: var(--r-md); background: var(--amber-soft); border: 1px solid rgba(240, 169, 74, 0.3); font-size: 0.8125rem; color: var(--text); display: flex; gap: 0.6rem; align-items: flex-start; }
.note .ic { color: var(--amber); margin-top: 0.05rem; }
.note.sky { background: var(--sky-soft); border-color: rgba(116, 184, 255, 0.3); }
.note.sky .ic { color: var(--sky); }
.note.ruby { background: var(--ruby-soft); border-color: rgba(226, 71, 77, 0.35); }
.note.ruby .ic { color: #ff9a9e; }
.coin { display: inline-flex; width: 0.9em; height: 0.9em; vertical-align: -0.1em; }
