/* ==========================================================================
   Tier Guild — tier list editor (Workbench)
   The S/A/B/C/D/F board is the product. Warm paper board, bold Bricolage
   rails, raised chips, a quiet toolbar, violet drag cue.
   ========================================================================== */

.editor {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-lg);
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-wrap: wrap;
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--space-md);
}

.editor-input {
  flex: 1 1 200px;
  min-width: 150px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--bg);
  color: var(--ink);
}

.editor-input::placeholder {
  color: var(--ink-3);
}

.editor-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.tier-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.tier-row {
  display: grid;
  grid-template-columns: 68px 1fr auto;
  align-items: stretch;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 68px;
}

.tier-label {
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  user-select: none;
}

/* Light tier colours read better with dark ink on the letter */
.tier-row[data-tier='B'] .tier-label,
.tier-row[data-tier='C'] .tier-label {
  color: #241a02;
  text-shadow: none;
}

.tier-row.unranked .tier-label {
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.tier-items {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  padding: var(--space-sm);
  align-content: flex-start;
  min-height: 68px;
  transition: background var(--dur-fast) var(--ease-out);
}

.tier-items.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: -7px;
  background: var(--accent-soft);
}

.item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 6px 12px 6px 10px;
  cursor: grab;
  max-width: 100%;
  user-select: none;
  transition: border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}

.item:hover {
  border-color: var(--accent);
}

.item:active {
  cursor: grabbing;
}

.item.dragging {
  opacity: 0.4;
}

.item.insert-before::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 4px;
  bottom: 4px;
  width: 3px;
  border-radius: 2px;
  background: var(--accent);
}

.item.selected {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.item-img {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  object-fit: cover;
  flex: none;
  border: 1px solid var(--line);
}

.item-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink);
  word-break: break-word;
}

.item-name[contenteditable='true'] {
  outline: 1px dashed var(--accent);
  border-radius: 5px;
  padding: 0 4px;
  background: var(--bg);
  cursor: text;
}

.item-del,
.tier-rename,
.tier-del {
  border: none;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  border-radius: 6px;
  line-height: 1;
  padding: 4px;
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}

.item-del {
  font-size: 1rem;
  margin-left: 2px;
}

.item-del:hover,
.tier-rename:hover,
.tier-del:hover {
  color: #d33;
  background: var(--surface-2);
}

.tier-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 0 8px;
  background: var(--surface);
  border-left: 1px solid var(--line);
}

.tier-side .tier-rename,
.tier-side .tier-del {
  font-size: 0.88rem;
}

.editor-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--ink);
  color: var(--bg);
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
  z-index: var(--z-toast);
}

.editor-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
