:root {
  --bg: #111113;
  --bg-row: #1a1a1d;
  --bg-pool: #161618;
  --border: #2a2a2e;
  --text: #f2f2f2;
  --muted: #9a9aa0;
  --s: #ff7f7f;
  --a: #ffbf7f;
  --b: #ffffbf;
  --c: #ffff7f;
  --d: #bfff7f;
  --f: #7fffbf;
  --tile: #0e0e10;
  --tile-hover: #222226;
  --radius: 10px;
  --label-w: 72px;
  --icon: 56px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  min-height: 100%;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.header h1 {
  margin: 0 0 4px;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.actions {
  display: flex;
  gap: 8px;
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: #1e1e22;
  color: var(--text);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.btn:hover { background: #2a2a30; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: #2b5cff;
  border-color: #2b5cff;
}
.btn-primary:hover { background: #3d6bff; }

.board {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tier-row {
  display: grid;
  grid-template-columns: var(--label-w) 1fr;
  min-height: 96px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-row);
  border: 1px solid var(--border);
}

.tier-label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  color: #111;
  user-select: none;
}

.tier-label[data-tier="S"] { background: var(--s); }
.tier-label[data-tier="A"] { background: var(--a); }
.tier-label[data-tier="B"] { background: var(--b); }
.tier-label[data-tier="C"] { background: var(--c); }
.tier-label[data-tier="D"] { background: var(--d); }
.tier-label[data-tier="F"] { background: var(--f); }

.tier-drop {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  padding: 10px;
  min-height: 96px;
}

.tier-drop.sortable-ghost,
.tool-tile.sortable-ghost {
  opacity: 0.45;
}

.tier-drop.drag-over {
  outline: 2px dashed #4a7dff;
  outline-offset: -4px;
}

.tool-tile {
  width: 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 6px 8px;
  border-radius: 10px;
  background: var(--tile);
  border: 1px solid transparent;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.tool-tile:hover {
  background: var(--tile-hover);
  border-color: #333;
}

.tool-tile:active { cursor: grabbing; }

.tool-tile img {
  width: var(--icon);
  height: var(--icon);
  object-fit: contain;
  border-radius: 10px;
  background: #0a0a0a;
  pointer-events: none;
}

.tool-tile .label {
  font-size: 0.72rem;
  line-height: 1.15;
  text-align: center;
  color: var(--text);
  word-break: break-word;
  max-width: 100%;
}

.pool-section {
  margin-top: 22px;
}

.pool-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.pool-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.pool-hint {
  color: var(--muted);
  font-size: 0.85rem;
}

.pool-row {
  grid-template-columns: 1fr;
  background: var(--bg-pool);
  min-height: 120px;
}

.pool {
  min-height: 120px;
}

@media (max-width: 640px) {
  :root {
    --label-w: 52px;
    --icon: 48px;
  }
  .app { padding: 16px 12px 40px; }
  .header h1 { font-size: 1.3rem; }
  .tool-tile { width: 72px; padding: 6px 4px; }
  .tier-label { font-size: 1.5rem; }
}
