:root {
  --bg: #14161b;
  --panel: #1d212b;
  --panel2: #262b38;
  --line: #333a49;
  --text: #e8ebf2;
  --muted: #9aa3b5;
  --accent: #d4a017;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
header {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.15rem; }
.header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.board-name { color: var(--muted); font-weight: 600; margin-right: 4px; }
main { padding: 18px; max-width: 1100px; margin: 0 auto; }
.subtitle { color: var(--muted); }
.muted { color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 12px; font-size: .9rem; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #1a1300; border-color: var(--accent); font-weight: 700; }
.status { color: var(--muted); font-size: .85rem; min-width: 60px; }

/* ---- index / board list ---- */
.new-board { display: flex; gap: 8px; margin: 14px 0 6px; }
.new-board input { flex: 1; max-width: 360px; }
input[type=text] {
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: .95rem;
}
.board-list { list-style: none; padding: 0; display: grid; gap: 10px; margin-top: 14px; }
.board-list li {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
}
.board-list a.title { color: var(--text); text-decoration: none; font-weight: 600; font-size: 1.05rem; }
.board-list .meta { color: var(--muted); font-size: .85rem; }
.board-list .spacer { margin-left: auto; }

/* ---- tier maker ---- */
.tiers { display: flex; flex-direction: column; gap: 6px; }
.tier { display: flex; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.tier-head {
  flex: 0 0 90px; display: flex; flex-direction: column; align-items: stretch; justify-content: center;
  padding: 6px; gap: 4px; color: #1a1300;
}
.tier-label {
  width: 100%; border: none; background: transparent; text-align: center;
  font-size: 1.3rem; font-weight: 800; color: #1a1300; min-width: 0;
}
.tier-label:focus { outline: 1px dashed rgba(0,0,0,.4); }
.tier-ctl { display: flex; gap: 2px; justify-content: center; }
.tier-ctl button, .tier-ctl input[type=color] {
  width: 22px; height: 22px; padding: 0; border: none; border-radius: 4px;
  background: rgba(0,0,0,.18); color: #1a1300; cursor: pointer; font-size: .8rem; line-height: 1;
}
.tier-items { flex: 1; display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; min-height: 72px; align-content: flex-start; }
.pool-title { margin: 18px 0 6px; font-size: 1rem; color: var(--muted); }
.pool { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; background: var(--panel); border: 1px dashed var(--line); border-radius: 8px; min-height: 80px; }

.item {
  width: 64px; height: 64px; border-radius: 6px; overflow: hidden; position: relative;
  cursor: grab; background: var(--panel2); border: 1px solid var(--line); flex: 0 0 auto;
}
.item img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.item .lbl {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: .65rem; text-align: center; padding: 2px; color: var(--text);
}
.item .rm {
  position: absolute; top: 1px; right: 1px; width: 16px; height: 16px; border-radius: 50%;
  background: rgba(0,0,0,.6); color: #fff; border: none; font-size: .7rem; line-height: 16px;
  cursor: pointer; display: none; padding: 0;
}
.item:hover .rm { display: block; }
.item.dragging { opacity: .4; }
.dropzone.over { outline: 2px dashed var(--accent); outline-offset: -2px; }

/* ---- pairwise ---- */
.duel { display: flex; align-items: center; justify-content: center; gap: 24px; margin-top: 30px; }
.vs { font-weight: 800; color: var(--muted); }
.contender {
  width: 240px; height: 240px; border-radius: 12px; overflow: hidden;
  background: var(--panel); border: 2px solid var(--line); cursor: pointer; padding: 0;
  display: flex; flex-direction: column;
}
.contender:hover { border-color: var(--accent); }
.contender img { width: 100%; flex: 1; object-fit: cover; min-height: 0; }
.contender .name { padding: 8px; color: var(--text); font-weight: 600; }
.done { text-align: center; margin-top: 30px; }
@media (max-width: 560px) {
  .contender { width: 42vw; height: 42vw; }
  .duel { gap: 10px; }
}
