/* Great Tiers — tier-list maker UI.
   Base tokens/reset from great-apps/framework.css via CDN. */

.header-actions { display: flex; align-items: center; gap: 8px; }

.board-title {
  max-width: 44vw;
  padding: 7px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.board-title:hover { border-color: var(--accent); }

/* ── Board body ─────────────────────────── */
.board-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

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

/* ── Tier row ───────────────────────────── */
.tier-row {
  display: flex;
  align-items: stretch;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 68px;
}
.tier-label {
  flex: 0 0 64px;
  width: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.25rem;
  color: #16161d;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
  white-space: nowrap;
  overflow: hidden;
  text-align: center;
  padding: 4px 3px;
  line-height: 1.05;
}

/* ── Item drop areas (tier + unranked) ──── */
.tier-items {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
  min-height: 68px;
  align-content: flex-start;
  transition: background 0.12s;
}
.tier-items.unranked {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-surface);
  min-height: 84px;
}
.tier-items.drop-hint {
  background: rgba(124, 111, 255, 0.14);
  box-shadow: inset 0 0 0 2px var(--accent);
  border-radius: 6px;
}

/* ── Items ──────────────────────────────── */
.titem {
  height: 56px;
  min-width: 56px;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-active);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.15;
  text-align: center;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.titem.text { width: auto; max-width: 132px; padding: 4px 8px; word-break: break-word; }
.titem.image { width: 56px; }
.titem img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; display: block; }
.titem.dragging { opacity: 0.32; }
.titem.ghost {
  position: fixed;
  left: 0; top: 0;
  z-index: 1000;
  pointer-events: none;
  cursor: grabbing;
  opacity: 0.96;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.5);
  transform: scale(1.06);
}

/* ── Add bar ────────────────────────────── */
.add-bar { display: flex; gap: 8px; align-items: center; }
.text-input {
  flex: 1;
  padding: 10px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.92rem;
  outline: none;
}
.text-input:focus { border-color: var(--accent); }
.text-input.full { width: 100%; }

.add-btn {
  padding: 10px 16px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.add-btn:hover { background: var(--accent-dim); }
.add-btn:active { transform: scale(0.97); }
.add-btn.ghost { background: var(--bg-surface); border: 1px solid var(--border); font-size: 1.05rem; padding: 8px 12px; }
.add-btn.ghost:hover { border-color: var(--accent); background: var(--bg-hover); }
.add-btn.full { width: 100%; margin-top: 10px; }

/* ── Unranked tray ──────────────────────── */
.tray-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 2px;
}
.tray-hint { text-transform: none; letter-spacing: 0; font-weight: 400; opacity: 0.7; }

/* ── Trash zone ─────────────────────────── */
.trash-zone {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  background: rgba(30, 20, 24, 0.94);
  border: 1px solid #d23c46;
  border-radius: 999px;
  color: #ff9ea4;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
.trash-zone.drop-hint { background: #d23c46; color: #fff; border-color: #ff9ea4; }

/* ── Settings drawer ────────────────────── */
.settings-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 50;
  display: flex;
  justify-content: flex-end;
}
.settings-panel {
  width: min(420px, 90vw);
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
}
.settings-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid var(--border);
}
.settings-head h2 { font-size: 1.1rem; font-weight: 600; }
.settings-scroll { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 24px; }
.setting-block h3 {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); margin-bottom: 10px; font-weight: 600;
}

/* Tier editor rows */
.tier-editor { display: flex; flex-direction: column; gap: 8px; }
.tier-edit-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px 8px;
}
.tier-edit-row input[type="color"] {
  width: 34px; height: 34px; flex: 0 0 34px;
  border: 1px solid var(--border); border-radius: 8px;
  background: none; padding: 0; cursor: pointer;
}
.tier-edit-row input[type="text"] {
  flex: 1; min-width: 0;
  padding: 8px 10px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 0.9rem; outline: none;
}
.tier-edit-row input[type="text"]:focus { border-color: var(--accent); }
.mini-btn {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text-muted);
  font-size: 1rem; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.mini-btn:hover:not(:disabled) { color: var(--text); border-color: var(--accent); }
.mini-btn:disabled { opacity: 0.3; cursor: default; }
.mini-btn.danger:hover { color: #ff9ea4; border-color: #d23c46; }

/* Boards list (switcher drawer) */
.boards-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.board-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px 8px;
}
.board-row.active { border-color: var(--accent); }
.board-pick {
  flex: 0 0 34px; width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 50%; color: var(--text-muted); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.board-pick:hover { border-color: var(--accent); }
.board-row.active .board-pick { background: var(--accent); border-color: var(--accent); color: #fff; }
.board-row input[type="text"] {
  flex: 1; min-width: 0;
  padding: 8px 10px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 0.9rem; outline: none;
}
.board-row input[type="text"]:focus { border-color: var(--accent); }

.ghost-btn {
  width: 100%; padding: 11px;
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-muted);
  font-size: 0.9rem; cursor: pointer; margin-bottom: 8px;
}
.ghost-btn:hover { color: var(--text); border-color: var(--accent); }
.ghost-btn.danger:hover { color: #ff9ea4; border-color: #d23c46; }

.settings-foot {
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
}
.foot-note { font-size: 0.78rem; color: var(--text-muted); }

/* ── Mobile ─────────────────────────────── */
@media (max-width: 420px) {
  .tier-label { flex-basis: 52px; width: 52px; font-size: 1.1rem; }
  .titem, .titem.image { height: 50px; min-width: 50px; }
  .titem.image { width: 50px; }
}
