:root {
  --bg: #0e0e10;
  --panel: #151518;
  --card: #1c1c20;
  --card-2: #232328;
  --line: #2c2c33;
  --text: #ececf1;
  --muted: #8b8b96;
  --accent: #e8ff59;
  --danger: #ff5c5c;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
}

button, input { font: inherit; color: inherit; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  flex-wrap: wrap;
}
.brandmark { display: flex; align-items: center; gap: 12px; }
.logo { font-weight: 700; letter-spacing: 0.32em; font-size: 15px; }
.divider { width: 1px; height: 18px; background: var(--line); }
.product { color: var(--muted); font-size: 13px; }
.project-title {
  flex: 1;
  min-width: 180px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 16px;
  font-weight: 600;
}
.project-title:hover { border-color: var(--line); }
.project-title:focus { outline: none; border-color: var(--accent); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 13px;
  transition: border-color .15s, background .15s;
}
.btn:hover { border-color: var(--muted); }
.btn.ghost { background: transparent; }
.btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.btn.add {
  width: 100%;
  justify-content: center;
  border-style: dashed;
  background: transparent;
  color: var(--muted);
  margin-top: 10px;
}
.btn.add:hover { color: var(--text); border-color: var(--accent); }
.icon-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 15px;
  line-height: 1;
}
.icon-btn:hover { color: var(--danger); background: var(--card-2); }

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(340px, 420px) 1fr;
  height: calc(100vh - 63px);
}
.panel {
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 8px 20px 40px;
}
.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: auto;
  min-width: 0;
}
.chart-wrap { width: 100%; max-width: 760px; }
#radar { width: 100%; height: auto; display: block; }

/* ---------- Blocks ---------- */
.block { padding: 18px 0; border-bottom: 1px solid var(--line); }
.block:last-child { border-bottom: none; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.block-head h2 { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: 0.14em; }
.hint { color: var(--muted); font-size: 12px; text-align: right; }

.field {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}
.field:focus { outline: none; border-color: var(--accent); }

/* Attributes */
.attributes { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; counter-reset: attr; }
.attributes li { display: flex; align-items: center; gap: 8px; counter-increment: attr; }
.attributes li::before {
  content: counter(attr);
  width: 22px; height: 22px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--card-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

/* Tags / powers */
.base-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; color: var(--muted); }
.base-row input { width: 72px; text-align: center; }
.tags { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tags li { display: grid; grid-template-columns: 1fr 76px auto; gap: 6px; align-items: center; }
.bonus-input { text-align: center; }

/* Brands */
.brands { display: grid; gap: 10px; }
.brand-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  border-left: 4px solid var(--brand-color);
}
.brand-card.hidden-brand { opacity: .55; }
.brand-top { display: flex; align-items: center; gap: 8px; }
.brand-top .field { background: transparent; border-color: transparent; font-weight: 600; padding: 6px 8px; }
.brand-top .field:hover { border-color: var(--line); }
.brand-top .field:focus { border-color: var(--accent); }
.color-input {
  width: 26px; height: 26px; flex: none;
  padding: 0; border: none; border-radius: 50%;
  background: none; cursor: pointer; overflow: hidden;
}
.color-input::-webkit-color-swatch-wrapper { padding: 0; }
.color-input::-webkit-color-swatch { border: none; border-radius: 50%; }
.color-input::-moz-color-swatch { border: none; border-radius: 50%; }
.eye-btn { color: var(--muted); }
.eye-btn:hover { color: var(--text); }
.collapse-btn:hover { color: var(--text); }

.brand-body { margin-top: 10px; display: grid; gap: 12px; }
.brand-card.collapsed .brand-body { display: none; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  color: var(--muted);
}
.chip:hover { color: var(--text); border-color: var(--muted); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #111; font-weight: 600; }
.chips-empty { color: var(--muted); font-size: 12px; }

.budget { display: grid; gap: 6px; }
.budget-text { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.budget-text strong { color: var(--text); }
.budget.over .budget-text strong { color: var(--danger); }
.budget.done .budget-text strong { color: var(--accent); }
.bar { height: 4px; background: var(--card-2); border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brand-color); transition: width .2s; }
.budget.over .bar > span { background: var(--danger); }

.scores { display: grid; gap: 6px; }
.score-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; }
.score-label { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dots { display: flex; gap: 4px; }
.dot {
  width: 26px; height: 26px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--card-2);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}
.dot.filled { background: var(--brand-color); border-color: var(--brand-color); color: #111; }
.dot:disabled { opacity: .25; cursor: not-allowed; }
.dot:not(:disabled):hover { border-color: var(--text); }

.brand-footer { display: flex; justify-content: space-between; align-items: center; }
.link-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 2px 0; }
.link-btn:hover { color: var(--text); }
.link-btn.danger:hover { color: var(--danger); }

/* Legend */
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; max-width: 760px; }
.legend-item {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  font-weight: 500;
  transition: opacity .15s, border-color .15s;
}
.legend-item:hover { border-color: var(--muted); }
.legend-item .swatch { width: 10px; height: 10px; border-radius: 50%; background: var(--brand-color); }
.legend-item.off { opacity: .4; }
.legend-item.off .swatch { background: transparent; border: 2px solid var(--brand-color); }
.legend-item .tag-mini { color: var(--muted); font-size: 11px; }

.empty-stage { color: var(--muted); text-align: center; margin-top: 12px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .panel { border-right: none; border-bottom: 1px solid var(--line); padding: 8px 16px 24px; }
  .stage { order: -1; padding: 16px; }
  .topbar { padding: 12px 16px; }
}
