/* ═══════════════════════════════════════════════════════════════
   TIER LIST MAKER (tierlist.php) — everything is tl-* scoped.
   Loaded after css/home.css (tokens, shared hm-* bits). The board's rows are built by js/tierlist.js: a coloured
   label, the zone that holds the ranked cards, and the row's tools. Cards are the same role-tile thumbnails as on
   the character list, smaller.
   ═══════════════════════════════════════════════════════════════ */

.tl-top { display: grid; gap: 4px; margin-top: 6px; }
.tl-title { margin: 0; font: 400 clamp(2.6rem, 8vw, 4.6rem)/0.9 var(--font-display); letter-spacing: 0.02em; text-transform: uppercase; transform: skewX(-6deg); transform-origin: left bottom; text-shadow: 4px 4px 0 var(--red), 7px 7px 0 var(--ink); }
.tl-lead { margin: 16px 0 0 !important; }
.tl-nojs { color: var(--dim); text-align: center; }

/* ── Tools ─────────────────────────────────────────────────────── */
.tl-tools { display: flex; flex-wrap: wrap; align-items: end; gap: 12px 16px; margin: -14px 0; padding: 12px 14px; border: 3px solid var(--ink); background: var(--panel); box-shadow: 4px 4px 0 var(--ink); }
.tl-tools[hidden], .tl-filters[hidden], .tl-card[hidden], .tl-hint[hidden], .tl-pool-note[hidden], .tl-btn[hidden] { display: none; }
.tl-name { display: grid; flex: 1 1 240px; gap: 4px; max-width: 420px; margin: 0; }
.tl-name span { color: var(--dim); font: 400 0.72rem/1 var(--font-head); letter-spacing: 0.1em; text-transform: uppercase; }
.tl-name input, .tl-search input { width: 100%; min-width: 0; padding: 7px 10px; border: 2px solid var(--ink); background: var(--bg); color: var(--text); font: inherit; font-size: 0.95rem; }
.tl-name input:focus, .tl-search input:focus { outline: 2px solid var(--yellow); outline-offset: 0; }
.tl-btns { display: flex; flex-wrap: wrap; gap: 8px 10px; }
.tl-btn { padding: 8px 16px; border: 3px solid var(--ink); background: var(--panel-2); color: var(--text); font: 400 0.98rem/1 var(--font-head); letter-spacing: 0.03em; text-transform: uppercase; transform: skewX(-9deg); box-shadow: 3px 3px 0 var(--ink); cursor: pointer; transition: transform 0.15s, box-shadow 0.15s, background 0.15s, color 0.15s; }
.tl-btn span { display: inline-block; transform: skewX(9deg); }
.tl-btn:hover { background: #fff; color: var(--ink); transform: skewX(-9deg) translate(-2px, -2px); box-shadow: 5px 5px 0 var(--ink); }
.tl-btn-hot { background: var(--yellow); color: var(--ink); }
.tl-btn-reset:hover { background: var(--red); color: #fff; }
.tl-btn.is-busy { opacity: 0.6; cursor: progress; }
.tl-status { flex-basis: 100%; min-height: 1.2em; margin: -4px 0 0 !important; color: var(--yellow); font-size: 0.86rem; }
.tl-status:empty { display: none; }

/* ── Board ─────────────────────────────────────────────────────── */
.tl-board { display: grid; gap: 8px; }
.tl-row { --tier: #dc3545; --tier-ink: #fff; display: grid; grid-template-columns: clamp(64px, 12vw, 132px) minmax(0, 1fr) auto; border: 3px solid var(--ink); background: var(--panel); box-shadow: 4px 4px 0 var(--line); }
.tl-label { display: grid; place-items: center; min-width: 0; padding: 6px; border-right: 3px solid var(--ink); background: var(--tier); color: var(--tier-ink); }
.tl-label-t { display: block; max-width: 100%; min-width: 1.2em; padding: 2px 4px; font: 400 clamp(1.15rem, 3.4vw, 2.2rem)/1.05 var(--font-head); text-align: center; overflow-wrap: anywhere; cursor: text; outline: none; }
.tl-label-t:focus { background: rgba(255, 255, 255, 0.22); box-shadow: 0 0 0 2px var(--tier-ink); }
.tl-zone { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 8px; min-width: 0; min-height: 104px; padding: 8px; transition: background 0.12s, box-shadow 0.12s; }
.tl-zone:focus-visible { outline: 3px solid var(--yellow); outline-offset: -3px; }
.tl-row .tl-zone.is-over, .tl-board.is-arming .tl-row:hover .tl-zone { background: rgba(255, 210, 1, 0.1); box-shadow: inset 0 0 0 2px var(--yellow); }
.tl-board.is-arming .tl-row { cursor: copy; }
.tl-row-tools { display: grid; grid-template-columns: repeat(2, 30px); align-content: center; gap: 4px; padding: 6px; border-left: 3px solid var(--ink); background: rgba(7, 8, 10, 0.4); }
.tl-row-tools button, .tl-color { display: grid; place-items: center; width: 30px; height: 30px; margin: 0; padding: 0; border: 2px solid var(--ink); background: var(--panel-2); color: var(--text); cursor: pointer; }
.tl-row-tools button:hover { background: var(--yellow); color: var(--ink); }
.tl-row-tools .tl-del:hover { background: var(--red); color: #fff; }
.tl-row-tools svg { width: 14px; height: 14px; fill: currentColor; }
.tl-color { position: relative; overflow: hidden; background: var(--tier); }
.tl-color input { position: absolute; inset: -6px; width: 200%; height: 200%; border: 0; padding: 0; opacity: 0; cursor: pointer; }
.tl-color:focus-within { outline: 3px solid var(--yellow); outline-offset: 1px; }

/* ── Cards ─────────────────────────────────────────────────────── */
.tl-card { --acc: var(--yellow); display: grid; grid-template-rows: auto 1fr; flex: none; width: 84px; margin: 0; padding: 0; border: 2px solid var(--ink); background: var(--ink); color: var(--text); text-align: center; cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation; transition: transform 0.12s, box-shadow 0.12s; }
.tl-card:hover { transform: translateY(-2px); box-shadow: 0 3px 0 var(--acc); }
.tl-card:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.tl-art { position: relative; display: block; overflow: hidden; aspect-ratio: 1; border-bottom: 3px solid var(--acc); background: var(--ink) var(--role-bg, none) repeat center / 60px; }
.tl-art img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.tl-soon { position: absolute; top: 0; left: 0; padding: 1px 8px 1px 4px; background: var(--blue); color: #fff; font: 400 0.52rem/1.4 var(--font-head); font-style: normal; letter-spacing: 0.04em; text-transform: uppercase; clip-path: polygon(0 0, 100% 0, calc(100% - 6px) 100%, 0 100%); }
.tl-nm { display: -webkit-box; align-self: center; overflow: hidden; margin: 3px 3px 4px; font: 400 0.68rem/1.15 var(--font-head); -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; }
.tl-card.is-picked { transform: translateY(-3px); box-shadow: 0 0 0 3px var(--yellow), 0 0 0 6px var(--ink); z-index: 1; }
.tl-card.is-ghost { opacity: 0.3; }
.tl-floating { position: fixed; z-index: 1000; margin: 0; pointer-events: none; opacity: 0.92; box-shadow: 6px 6px 0 rgba(7, 8, 10, 0.6); transition: none; cursor: grabbing; }
.tl-dragging, .tl-dragging * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }

/* ── Pool ──────────────────────────────────────────────────────── */
.tl-left { flex: none; color: var(--dim); font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.tl-left b { color: var(--text); font: 400 1.2rem/1 var(--font-head); }
.tl-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 14px; }
.tl-search { flex: 1 1 240px; max-width: 360px; margin: 0; }
.tl-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.tl-chip { position: relative; margin: 0; cursor: pointer; }
.tl-chip input { position: absolute; opacity: 0; pointer-events: none; }
.tl-chip span { display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border: 2px solid var(--ink); background: var(--panel-2); font: 400 0.88rem/1.2 var(--font-head); white-space: nowrap; transition: background 0.12s, color 0.12s; }
.tl-chip img { width: 20px; height: 20px; }
.tl-chip input:checked + span { background: var(--acc, var(--yellow)); color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.tl-chip input:focus-visible + span { outline: 3px solid var(--yellow); outline-offset: 2px; }
/* The cards share each row of the box evenly, so no strip is left empty at its right edge. */
.tl-pool { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); align-content: start; gap: 10px 8px; min-height: 130px; padding: 12px; border: 3px solid var(--ink); background: var(--panel); box-shadow: 4px 4px 0 var(--line); }
.tl-pool .tl-card { width: auto; }
.tl-pool.is-over { box-shadow: inset 0 0 0 2px var(--yellow), 4px 4px 0 var(--line); }
.tl-pool-note { margin-top: 12px !important; color: var(--dim); text-align: center; }

/* ── "Placing ..." bar while a card is picked up by a tap ──────── */
.tl-hint { position: fixed; left: 50%; bottom: 14px; z-index: 30; display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 24px); margin: 0 !important; padding: 8px 10px 8px 14px; border: 3px solid var(--ink); background: var(--yellow); color: var(--ink); font: 400 0.92rem/1.2 var(--font-head); box-shadow: 5px 5px 0 var(--ink); transform: translateX(-50%); }
.tl-hint button { flex: none; padding: 4px 10px; border: 2px solid var(--ink); background: var(--ink); color: #fff; font: inherit; cursor: pointer; }

@media (max-width: 620px) {
    .tl-card { width: 68px; }
    .tl-zone { gap: 6px; min-height: 88px; padding: 6px; }
    .tl-row-tools { grid-template-columns: 28px; padding: 4px; gap: 3px; }
    .tl-row-tools button, .tl-color { width: 28px; height: 24px; }
    .tl-btn { padding: 8px 12px; font-size: 0.9rem; }
    .tl-pool { grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 8px 6px; padding: 8px; }
}
@media (prefers-reduced-motion: reduce) { .tl-card:hover, .tl-btn:hover { transform: none; } .tl-btn:hover { transform: skewX(-9deg); } }
