/* tier-list-maker 专用，依赖 /home.css 变量与 /tool.css */
/* 行色是本页专用色（DESIGN.md §1 的例外）：浅色深色同一组值，和导出图一致；app.js 读这些变量画导出图 */
:root {
  --tl-1: #ff7f7f;
  --tl-2: #ffbf7f;
  --tl-3: #ffdf7f;
  --tl-4: #bfff7f;
  --tl-5: #7fbfff;
  --tl-6: #bf9fff;
  --tl-7: #ff9fdf;
  --tl-8: #7fe5e5;
  --tl-9: #c8c8c8;
  --tl-10: #3d3d3d;
}

.lbl { font: 500 12px/1 var(--mono); color: var(--ink-2); }
.tl-titlewrap { display: inline-flex; align-items: center; gap: 8px; flex: 1 1 260px; min-width: 0; }
.tl-title { flex: 1; min-width: 0; font-family: var(--sans); }
#export { min-width: 8em; }
#reset.armed { color: var(--accent); text-decoration-color: currentColor; }

.tl-area { margin-top: 16px; }
.tl-board { border-top: 1px solid var(--ink); }
.tl-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; min-height: 82px; border-bottom: 1px solid var(--ink); }
.tl-label { display: flex; align-items: center; justify-content: center; padding: 4px; }
.tl-name {
  width: 100%; resize: none; overflow: hidden;
  border: 0; background: transparent; color: inherit;
  font: 600 22px/1.2 var(--sans); text-align: center;
  outline: none; field-sizing: content; max-height: 100%;
}
.tl-name:focus-visible { outline: 2px solid currentColor; outline-offset: -2px; }
.tl-items { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 4px; padding: 4px; min-width: 0; }
.tl-tools { display: grid; grid-template-columns: repeat(2, 28px); align-content: center; gap: 2px; padding: 4px; border-left: 1px solid var(--rule); }
.tl-tool {
  width: 28px; height: 22px; border: 0; padding: 0; background: transparent; cursor: pointer;
  color: var(--ink); font: 13px/22px var(--mono);
  transition: color .15s var(--ease), background-color .15s var(--ease);
}
.tl-tool:not(:disabled):hover { background: var(--hover); color: var(--accent); }
.tl-tool:disabled { opacity: .3; cursor: default; }
.tl-tool:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tl-addrow { margin: 12px 0 0; }

.tl-poolwrap { margin-top: 20px; }
.tl-pool { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 4px; min-height: 82px; padding: 4px; border: 1px dashed var(--field-line); }
.tl-hint { margin: 8px 0 0; font: 14px/1.6 var(--sans); color: var(--ink-2); }
.tl-hint .btn { margin-left: 8px; }

/* 项目：文字或图片一格。触摸时允许上下滚动，长按后由 app.js 拦住滚动 */
.tl-item {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 72px; height: 72px; padding: 4px;
  border: 1px solid var(--rule); background: var(--hover); color: var(--ink);
  font: 600 13px/1.2 var(--sans); text-align: center; overflow: hidden;
  overflow-wrap: anywhere; cursor: grab;
  touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.tl-item.img { padding: 0; }
.tl-item canvas { display: block; width: 100%; height: 100%; pointer-events: none; }
.tl-item span { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; pointer-events: none; }
.tl-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tl-item.dragging { opacity: .3; }
.tl-ghost { position: fixed; left: 0; top: 0; z-index: 50; margin: 0; pointer-events: none; opacity: .9; box-shadow: 0 6px 18px rgb(0 0 0 / .25); cursor: grabbing; }
body.tl-dragging, body.tl-dragging * { cursor: grabbing; user-select: none; }
.tl-ind { position: absolute; left: 0; top: 0; z-index: 40; width: 3px; background: var(--accent); pointer-events: none; }

.tl-add { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-top: 16px; align-items: start; }
.tl-textadd { display: flex; gap: 8px; min-width: 0; }
.tl-textadd .field { flex: 1; min-width: 0; font-family: var(--sans); }
.tl-add .drop { margin: 0; }
.tl-tip { max-width: 76ch; margin: 4px 0 0; font: 13px/1.7 var(--sans); color: var(--ink-2); }

/* 点选菜单和调色板 */
.tl-menu, .tl-palette {
  position: absolute; z-index: 60; min-width: 160px; padding: 4px 0;
  border: 1px solid var(--ink); background: var(--paper); box-shadow: 0 6px 18px rgb(0 0 0 / .18);
}
.tl-menu button {
  display: block; width: 100%; padding: 8px 14px; border: 0; background: transparent; cursor: pointer;
  color: var(--ink); font: 14px/1.3 var(--sans); text-align: left;
}
.tl-menu button:not(:disabled):hover, .tl-menu button:focus-visible { background: var(--hover); outline: none; }
.tl-menu button:disabled { color: var(--ink-2); cursor: default; }
.tl-menu button.del { border-top: 1px solid var(--rule); color: var(--accent); }
.tl-palette { padding: 10px; }
.tl-swatches { display: grid; grid-template-columns: repeat(5, 28px); gap: 6px; margin-bottom: 10px; }
.tl-swatch { width: 28px; height: 28px; border: 1px solid var(--rule); cursor: pointer; padding: 0; }
.tl-swatch:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tl-palette input[type=color] { width: 40px; height: 26px; padding: 0; border: 1px solid var(--field-line); background: var(--paper); }
.tl-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.guide { max-width: 76ch; margin-top: clamp(48px, 8vh, 72px); padding-top: 8px; border-top: 2px solid var(--ink); }
.guide h2 { margin: 28px 0 10px; font: 600 15px/1.4 var(--mono); }
.guide p { margin: 0 0 10px; font: 14px/1.75 var(--sans); color: var(--ink); overflow-wrap: anywhere; }

@media (max-width: 640px) {
  .tl-row { grid-template-columns: 64px minmax(0, 1fr) auto; min-height: 66px; }
  .tl-name { font-size: 17px; }
  .tl-item { width: 56px; height: 56px; font-size: 11px; }
  .tl-pool { min-height: 66px; }
  .tl-add { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .tl-tool { transition: none; }
}
