/* Mag-SuitBuilder web UI — palette and metrics lifted from the approved Pro-tool mockups */

/* Shadowgain scheme: tokens lifted from my.shadowgain.com / shadowgain.com
   (deep blue-slate ground, teal "arcane" accent #4fd6c6, gold #d8ac52, Palatino serif brand). */
:root {
  --bg: #090c12;
  --surface-1: #121b27;
  --surface-2: #16202e;
  --bar: #0f151f;
  --input: #0e1620;
  --border-1: rgba(120, 180, 190, 0.14);
  --border-2: rgba(120, 180, 190, 0.22);
  --border-3: rgba(120, 180, 190, 0.38);
  --text-1: #e7eef0;
  --text-2: #c9d3df;
  --text-3: #9aa6b6;
  --text-4: #7f8b9c;
  --text-5: #5c6878;
  --accent: #4fd6c6;
  --accent-ink: #06201d;
  --accent-soft: #8be7db;
  --accent-wash: rgba(79, 214, 198, 0.06);
  --accent-chip-bg: rgba(79, 214, 198, 0.12);
  --accent-chip-border: rgba(79, 214, 198, 0.45);
  --gold: #d8ac52;
  --lvl-legendary: #b45309;
  --lvl-epic: #15803d;
  --lvl-major: #be185d;
  --lvl-minor: #1d4ed8;
  --ok: #57d98a;
  --err: #e0645f;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --font-mono: 'IBM Plex Mono', Consolas, monospace;
  --radius-chip: 999px;
  --radius-card: 8px;
  --radius-btn: 6px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 640px at 50% -10%, rgba(216, 172, 82, 0.08), transparent 60%),
    radial-gradient(900px 600px at 85% 15%, rgba(79, 214, 198, 0.07), transparent 60%),
    linear-gradient(180deg, var(--bg), #0f151f);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: 13px;
  letter-spacing: 0.2px;
  overflow: hidden;
}

#app { height: 100dvh; display: flex; flex-direction: column; }

a { color: var(--accent); }
a:hover { color: var(--accent-soft); }

button { font: inherit; color: inherit; background: none; border: none; padding: 0; cursor: pointer; }
input, select { font: inherit; }

.mono { font-family: var(--font-mono); }
.label { font-size: 10px; font-weight: 600; letter-spacing: 0.1em; color: var(--text-4); }

/* ---------- Top bar ---------- */

.topbar {
  height: 52px; flex: 0 0 auto;
  display: flex; align-items: center; gap: 16px;
  padding: 0 16px;
  background: var(--bar);
  border-bottom: 1px solid var(--border-1);
}

.topbar__brand { display: flex; align-items: center; gap: 10px; }
.topbar__title { font-family: var(--font-serif); font-weight: 600; font-size: 16px; letter-spacing: 0.5px; }

/* Back-link to my.shadowgain.com — same header family as the portal's nav links */
.topbar__portal {
  font-size: 12.5px; color: var(--text-3);
  border-left: 1px solid var(--border-1);
  padding-left: 10px;
  white-space: nowrap;
}
.topbar__portal:hover { color: var(--accent); }
.topbar__spacer { flex: 1 1 auto; display: flex; justify-content: center; min-width: 0; }
.topbar__actions { display: flex; align-items: center; gap: 8px; }
.topbar__status { display: flex; align-items: center; gap: 7px; color: var(--text-4); font-size: 12px; white-space: nowrap; }

.status-dot { width: 7px; height: 7px; border-radius: 999px; background: var(--text-4); display: inline-block; }
.status-dot--ok { background: var(--ok); }
.status-dot--running { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.status-dot--err { background: var(--err); }

@keyframes pulse { 50% { opacity: 0.35; } }

.seg {
  display: flex; align-items: center; gap: 4px;
  background: var(--input);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-btn);
  padding: 3px;
}

.seg__btn { padding: 4px 12px; border-radius: 4px; color: var(--text-3); }
.seg__btn.active { background: var(--border-2); color: var(--gold); font-weight: 500; }

.searchbox {
  display: flex; align-items: center; gap: 8px;
  width: 380px; max-width: 100%;
  background: var(--input);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-btn);
  padding: 5px 10px;
  color: var(--text-4);
}

.searchbox input {
  flex: 1 1 auto; min-width: 0;
  background: none; border: none; outline: none;
  color: var(--text-1);
}

.searchbox input::placeholder { color: var(--text-5); }

.searchbox kbd {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--text-5);
  border: 1px solid var(--border-2); border-radius: 4px;
  padding: 1px 5px;
}

/* ---------- Buttons & chips ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-btn);
  color: var(--text-2);
  white-space: nowrap;
}

.btn:hover { background: var(--surface-2); }

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  padding: 7px 14px;
}

.btn--primary:hover { background: var(--accent-soft); }
.btn:disabled { opacity: 0.45; cursor: default; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-chip);
  padding: 2px 9px;
  font-size: 11px;
  color: var(--text-2);
  white-space: nowrap;
}

.chip--input { background: var(--input); padding: 5px 10px; font-size: 13px; }
.chip--mono { font-family: var(--font-mono); }

.chip--tink {
  background: var(--accent-chip-bg);
  border-color: var(--accent-chip-border);
  color: var(--accent);
  font-weight: 500;
}

.chip--tink-dim {
  background: rgba(79, 214, 198, 0.08);
  border-color: rgba(79, 214, 198, 0.3);
  color: var(--accent-soft);
}

.dot { width: 8px; height: 8px; border-radius: 2px; flex: 0 0 auto; display: inline-block; }
.dot--legendary { background: var(--lvl-legendary); }
.dot--epic { background: var(--lvl-epic); }
.dot--major { background: var(--lvl-major); }
.dot--minor { background: var(--lvl-minor); }
.dot--off { background: none; border: 1.5px solid var(--border-3); }

.card {
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-card);
  padding: 14px;
  display: flex; flex-direction: column; gap: 12px;
}

.card--grow { flex: 1 1 auto; min-height: 0; overflow-y: auto; }

/* ---------- Layout ---------- */

.view { flex: 1 1 auto; display: flex; min-height: 0; }
.view[hidden] { display: none; }

.sidebar {
  width: 232px; flex: 0 0 auto;
  border-right: 1px solid var(--border-1);
  padding: 14px 12px;
  display: flex; flex-direction: column; gap: 18px;
  overflow-y: auto;
  contain: content;
}

.table-area { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.rightpanel {
  width: 312px; flex: 0 0 auto;
  border-left: 1px solid var(--border-1);
  padding: 14px;
  display: flex; flex-direction: column; gap: 14px;
  overflow: hidden;
  contain: content;
}

.rightpanel--results { width: 384px; }

/* ---------- Sidebar ---------- */

.side-section { display: flex; flex-direction: column; gap: 2px; }
.side-section > .label { padding: 0 6px 6px 6px; }

.side-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 6px;
  border-radius: 5px;
  cursor: pointer;
  color: var(--text-3);
}

.side-row.checked { background: var(--input); color: var(--text-1); }
.side-row:hover { background: var(--surface-2); }
.side-row__count { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--text-5); }
.side-row.checked .side-row__count { color: var(--text-4); }

.checkbox {
  width: 14px; height: 14px; flex: 0 0 auto;
  border-radius: 3px;
  border: 1.5px solid var(--border-3);
  display: flex; align-items: center; justify-content: center;
}

.checkbox.on { background: var(--accent); border-color: var(--accent); }
.checkbox svg { display: none; }
.checkbox.on svg { display: block; }
.checkbox.partial { border-color: var(--accent); }
.checkbox__dash { width: 8px; height: 2.5px; border-radius: 1px; background: var(--accent); }

.side-row--server { margin-bottom: 2px; }
.side-row--server:hover .label { color: var(--text-2); }

.al-range { display: flex; align-items: center; gap: 8px; padding: 0 6px; }

.al-range input {
  width: 100%; min-width: 0;
  background: var(--input);
  border: 1px solid var(--border-2);
  border-radius: 5px;
  padding: 5px 8px;
  font-family: var(--font-mono); font-size: 12px;
  color: var(--text-1);
  outline: none;
}

.al-range input:focus { border-color: var(--accent-chip-border); }

/* ---------- Inventory table ---------- */

.inv-grid { display: grid; grid-template-columns: 46px 1.5fr 110px 96px 118px 56px 2fr; align-items: center; }

.inv-header {
  height: 34px; flex: 0 0 auto;
  padding: 0 12px;
  border-bottom: 1px solid var(--border-1);
  background: var(--bar);
}

.inv-header .hcell {
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em;
  color: var(--text-4);
  text-align: left;
  display: flex; align-items: center; gap: 4px;
  height: 34px;
}

.inv-header .hcell:hover { color: var(--text-2); }
.inv-header .hcell.num { justify-content: flex-end; }
.inv-header .hcell.pad { padding-left: 16px; }

/* contain: content isolates the huge row list so unrelated DOM changes (panels, topbar)
   never force it to re-layout, and vice versa */
.inv-body { flex: 1 1 auto; overflow-y: auto; contain: content; }

.inv-row {
  height: 37px;
  padding: 0 12px;
  border-bottom: 1px solid var(--surface-1);
  content-visibility: auto;
  contain-intrinsic-size: auto 37px;
}

.inv-row:nth-child(even) { background: var(--surface-1); }
.inv-row:hover { background: var(--surface-2); }
.inv-row.excluded { opacity: 0.45; }
.inv-row.excluded .cell-name { text-decoration: line-through; }

.cell-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-muted { color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-al { text-align: right; font-family: var(--font-mono); }
.cell-spells { padding-left: 16px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-none { color: var(--text-5); }

.row-flags { display: flex; align-items: center; gap: 4px; }

.flag-btn {
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 4px;
  color: var(--text-5);
  opacity: 0;
}

.inv-row:hover .flag-btn, .flag-btn.on { opacity: 1; }
.flag-btn:hover { background: var(--border-2); color: var(--text-2); }
.flag-btn.on { color: var(--accent); }

.statusbar {
  height: 38px; flex: 0 0 auto;
  display: flex; align-items: center; gap: 14px;
  padding: 0 12px;
  border-top: 1px solid var(--border-1);
  background: var(--bar);
  color: var(--text-4); font-size: 12px;
}

.statusbar .accent { color: var(--accent); }
.statusbar .lit { color: var(--text-2); }
.statusbar .right { margin-left: auto; }

/* ---------- Build panel ---------- */

.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12px; color: var(--text-3); }

.select {
  width: 100%;
  appearance: none;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-btn);
  padding: 7px 10px;
  color: var(--text-1);
  font-weight: 500;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239c9ca6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.toggle-row { display: flex; align-items: flex-start; gap: 10px; padding-top: 2px; cursor: pointer; }

.toggle {
  width: 32px; height: 18px; flex: 0 0 auto;
  border-radius: 999px;
  background: var(--border-3);
  position: relative;
  transition: background 0.15s;
}

.toggle::after {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 999px;
  background: var(--bg);
  transition: left 0.15s;
}

.toggle.on { background: var(--accent); }
.toggle.on::after { left: 16px; background: var(--accent-ink); }

/* Instant pressed feedback, independent of any JS/render latency */
.toggle-row:active .toggle { filter: brightness(1.35); }

.toggle-row__text { display: flex; flex-direction: column; gap: 3px; }
.toggle-row__title { font-weight: 500; }
.toggle-row__sub { font-size: 11px; color: var(--text-4); line-height: 1.45; }

/* ---------- Cantrip panel & popover ---------- */

.cantrip-head { display: flex; align-items: center; justify-content: space-between; }
.cantrip-head .preset-link { font-size: 11px; color: var(--accent); cursor: pointer; }

.cantrip-list { display: flex; flex-direction: column; gap: 4px; }

.cantrip-row { display: flex; align-items: center; gap: 9px; padding: 4px 2px; border-radius: 4px; }
.cantrip-row:hover { background: var(--surface-2); }
.cantrip-row .dot { width: 10px; height: 10px; border-radius: 3px; }
.cantrip-row__name { flex: 1 1 auto; }
.cantrip-row__level { font-size: 11px; color: var(--text-3); }

.cantrip-row__remove { color: var(--text-5); visibility: hidden; width: 16px; }
.cantrip-row:hover .cantrip-row__remove { visibility: visible; }
.cantrip-row__remove:hover { color: var(--err); }

.cantrip-add { display: flex; align-items: center; gap: 8px; padding: 6px 2px; color: var(--text-4); cursor: pointer; }
.cantrip-add:hover { color: var(--text-2); }

.legend {
  display: flex; gap: 10px; align-items: center;
  margin-top: auto; padding-top: 8px;
  border-top: 1px solid var(--border-1);
}

.legend span { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-3); }

.popover {
  position: fixed;
  z-index: 50;
  background: var(--surface-1);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-card);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  padding: 14px;
  display: flex; flex-direction: column; gap: 12px;
  width: 620px; max-width: calc(100vw - 24px);
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}

.cantrip-pop__presets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cantrip-pop__presets .label { margin-right: 4px; }

.preset-chip { cursor: pointer; }
.preset-chip:hover { border-color: var(--accent-chip-border); color: var(--text-1); }
.preset-chip.active { border-color: var(--accent); color: var(--accent); }

.cgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }

.cgrid-cell {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 5px;
  font-size: 11px;
  color: var(--text-4);
  text-align: left;
  min-height: 32px;
}

.cgrid-cell span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cgrid-cell:hover { border-color: var(--border-3); color: var(--text-2); }
.cgrid--mini { max-width: 760px; }
.cgrid--mini .cgrid-cell { padding: 4px 7px; min-height: 26px; font-size: 10px; cursor: default; }
.cgrid--mini .cgrid-cell:hover { border-color: var(--border-2); color: inherit; }
.cgrid--mini .cgrid-cell.cgrid-cell--dim { opacity: 0.45; }
.cgrid--mini .cgrid-cell.lvl-legendary:hover, .cgrid--mini .cgrid-cell.lvl-epic:hover,
.cgrid--mini .cgrid-cell.lvl-major:hover, .cgrid--mini .cgrid-cell.lvl-minor:hover { color: var(--text-1); }

.cgrid-cell.lvl-legendary { border-color: rgba(180, 83, 9, 0.55); background: rgba(180, 83, 9, 0.10); color: var(--text-1); }
.cgrid-cell.lvl-epic { border-color: rgba(21, 128, 61, 0.55); background: rgba(21, 128, 61, 0.10); color: var(--text-1); }
.cgrid-cell.lvl-major { border-color: rgba(190, 24, 93, 0.55); background: rgba(190, 24, 93, 0.10); color: var(--text-1); }
.cgrid-cell.lvl-minor { border-color: rgba(29, 78, 216, 0.55); background: rgba(29, 78, 216, 0.10); color: var(--text-1); }

/* ---------- Suit list ---------- */

.suitlist-col {
  width: 350px; flex: 0 0 auto;
  border-right: 1px solid var(--border-1);
  display: flex; flex-direction: column; min-height: 0;
  position: relative;
}

.suitlist-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-1);
  flex: 0 0 auto;
}

.suitlist-count { font-size: 12px; color: var(--text-3); }

.suitlist {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px;
  counter-reset: suit;
  outline: none;
  contain: content;
}

.suit-card {
  border: 1px solid var(--border-1);
  background: var(--surface-1);
  border-radius: var(--radius-card);
  padding: 11px 12px;
  display: flex; flex-direction: column; gap: 8px;
  cursor: pointer;
  counter-increment: suit;
  flex: 0 0 auto;
}

.suit-card:hover { border-color: var(--border-3); }
.suit-card.selected { border-color: var(--accent); background: var(--surface-2); }

.suit-card__top { display: flex; align-items: baseline; gap: 8px; }
.suit-card__top::before { content: "#" counter(suit); font-family: var(--font-mono); font-size: 11px; color: var(--text-4); }
.suit-card.selected .suit-card__top::before { color: var(--accent); }
.suit-card__pieces { font-weight: 600; }
.suit-card__al { margin-left: auto; font-family: var(--font-mono); }
.suit-card.selected .suit-card__al { font-weight: 600; }
.suit-card__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.suit-card__chips .chip { background: var(--surface-2); color: var(--text-3); }
.suit-card.selected .suit-card__chips .chip { background: var(--surface-1); color: var(--text-2); }
.suit-card__chips .chip--tink, .suit-card.selected .suit-card__chips .chip--tink { background: var(--accent-chip-bg); color: var(--accent); }
.suit-card__notink { font-size: 11px; color: var(--text-5); padding: 2px 0; }

.new-pill {
  position: absolute; top: 52px; left: 50%; transform: translateX(-50%);
  z-index: 5;
  background: var(--surface-2);
  border: 1px solid var(--accent-chip-border);
  color: var(--accent);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}

/* ---------- Suit detail ---------- */

.detail-col {
  flex: 1 1 auto; min-width: 0;
  display: flex; flex-direction: column; gap: 14px;
  padding: 16px 20px;
  overflow-y: auto;
  contain: content;
}

.detail-head { display: flex; align-items: baseline; gap: 12px; }
.detail-head__title { font-size: 16px; font-weight: 600; }
.detail-head__sub { color: var(--text-3); }

.slot-rows { display: flex; flex-direction: column; gap: 3px; }
.slot-rows .label { padding: 4px 0; }

.slot-row {
  display: flex; align-items: center; gap: 12px;
  min-height: 38px;
  padding: 4px 10px;
  border-radius: 6px;
}

.slot-row:nth-child(even of .slot-row) { background: var(--surface-1); }
.slot-row.tinked { background: var(--accent-wash); }

.slot-row__slot { width: 82px; flex: 0 0 auto; font-size: 11px; color: var(--text-4); }
.slot-row__name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-row__consumes { font-size: 11px; color: var(--accent-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-row__info { font-size: 11px; color: var(--text-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-row__owner { font-size: 12px; color: var(--text-4); flex: 0 0 auto; }
.slot-row__al { width: 44px; flex: 0 0 auto; text-align: right; font-family: var(--font-mono); margin-left: 0; }
.slot-row__spacer { flex: 1 1 auto; }
.slot-row__stack { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1 1 auto; }

.group-toggle {
  display: flex; align-items: center; gap: 8px;
  height: 34px;
  padding: 0 10px; margin-top: 4px;
  border-top: 1px solid var(--surface-1);
  color: var(--text-4);
  cursor: pointer;
  width: 100%;
}

.group-toggle:hover { color: var(--text-2); }
.group-toggle svg { transition: transform 0.15s; }
.group-toggle.open svg { transform: rotate(90deg); }
.group-toggle .count { margin-left: auto; font-size: 12px; }

.cantrip-cloud { display: flex; flex-wrap: wrap; gap: 6px; }

.cloud-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px;
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: 999px;
  padding: 3px 10px;
}

.cloud-chip .dot { width: 7px; height: 7px; }
.cloud-more { font-size: 12px; color: var(--text-4); padding: 3px 4px; cursor: pointer; }
.cloud-more:hover { color: var(--text-2); }

.empty-state {
  flex: 1 1 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  color: var(--text-4);
}

/* ---------- Set bonuses & tinker plan ---------- */

.setbonus { display: flex; flex-direction: column; gap: 4px; }
.setbonus__head { display: flex; align-items: center; gap: 8px; }
.setbonus__name { font-weight: 600; }
.setbonus__pips { display: flex; gap: 3px; margin-left: auto; }
.pip { width: 14px; height: 5px; border-radius: 2px; background: var(--border-2); }
.pip.fill { background: var(--text-3); }
.pip.fill--accent { background: var(--accent); }
.setbonus__n { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }
.setbonus__desc { font-size: 11px; color: var(--text-4); }

.plan-head { display: flex; align-items: center; justify-content: space-between; }
.plan-head .n { font-size: 11px; color: var(--accent); }

.plan-step { display: flex; gap: 10px; }

.plan-step__num {
  width: 20px; height: 20px; flex: 0 0 auto;
  border-radius: 999px;
  background: var(--accent-chip-bg);
  border: 1px solid var(--accent-chip-border);
  color: var(--accent);
  font-size: 11px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}

.plan-step__body { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.plan-step__title { display: flex; align-items: center; gap: 7px; font-weight: 500; flex-wrap: wrap; }
.plan-step__sets { font-size: 11px; color: var(--text-4); }
.plan-step__to { font-size: 11px; color: var(--accent); }
.plan-step__text { font-size: 11px; color: var(--text-3); line-height: 1.5; }

.plan-empty { font-size: 12px; color: var(--text-4); }

.copy-btn {
  margin-top: auto;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-btn);
  padding: 8px;
  color: var(--text-2);
}

.copy-btn:hover { background: var(--surface-2); }

/* ---------- Toast ---------- */

.toast-root {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  z-index: 100;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
}

.toast {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-btn);
  padding: 8px 16px;
  font-size: 12px;
  color: var(--text-1);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.15s ease-out;
}

.toast--err { border-color: rgba(248, 113, 113, 0.5); }

@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- Browser build: file drop + credits ---------- */

.drop-overlay {
  position: fixed; inset: 0;
  z-index: 200;
  background: rgba(24, 24, 27, 0.85);
  display: flex; align-items: center; justify-content: center;
}

.drop-overlay[hidden] { display: none; }

.drop-overlay__box {
  border: 2px dashed var(--accent);
  border-radius: 12px;
  padding: 48px 64px;
  text-align: center;
  font-size: 18px;
  color: var(--text-1);
  background: var(--surface-1);
}

.drop-overlay__box span { font-size: 13px; color: var(--text-3); }

.credits {
  position: fixed; right: 12px; bottom: 8px;
  z-index: 20;
  font-size: 10px;
  color: var(--text-5);
  background: rgba(24, 24, 27, 0.75);
  padding: 2px 8px;
  border-radius: 4px;
}

.credits a { color: var(--text-4); }
.credits a:hover { color: var(--accent); }

/* ---------- Scrollbars ---------- */

* { scrollbar-width: thin; scrollbar-color: var(--border-3) transparent; }

/* ---------- Mobile: stack the columns into one scrolling page ----------
   Below 760px the three-column workbench can't fit, so the page becomes a
   vertical document: build target + cantrips first, filters, then the item
   table, which keeps its full grid and pans sideways inside its own scroll. */
@media (max-width: 760px) {
  body { overflow: auto; }
  #app { height: auto; min-height: 100dvh; }

  .topbar { height: auto; flex-wrap: wrap; padding: 10px 12px; gap: 10px 12px; }
  .topbar__status { order: 9; flex-basis: 100%; }
  .topbar__spacer { order: 10; flex-basis: 100%; }
  .searchbox { width: 100%; }

  .view { flex-direction: column; height: auto; }

  .sidebar, .rightpanel, .rightpanel--results, .suitlist-col {
    width: auto; flex: 0 0 auto;
    border-right: none; border-left: none;
    border-bottom: 1px solid var(--border-1);
  }

  .view--build .rightpanel { order: -1; overflow: visible; }
  .card--grow { min-height: auto; overflow-y: visible; }

  .table-area { overflow-x: auto; }
  .inv-header, .inv-body, .statusbar { min-width: 640px; }
  .inv-body { max-height: 60vh; }
  .statusbar { height: auto; flex-wrap: wrap; padding: 8px 12px; gap: 4px 14px; }

  .suitlist { max-height: 45vh; }
  .detail-col { padding: 14px 12px; overflow-y: visible; }

  .credits { position: static; text-align: center; padding: 10px 12px 14px; }
}
