/* 效率工具：九宫格切图 / 长图拼接 / 话题标签 / 发布清单 */

.tb-tabs .tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tb-tabs .tab svg {
  width: 15px;
  height: 15px;
}

.tb-panel[hidden] {
  display: none;
}

.tb-split {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.tb-split > .stack {
  min-width: 0;
}

/* ---------------------------------------------------------------- 上传区 */
.tb-drop {
  position: relative;
  border: 1.5px dashed var(--line-2);
  border-radius: var(--r-m);
  background: #fafafb;
  padding: 18px;
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tb-drop:hover,
.tb-drop.is-drag {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.tb-drop-sm {
  min-height: 120px;
  padding: 14px;
}

.tb-drop-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  color: var(--sub);
  pointer-events: none;
}

.tb-drop-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--brand);
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}

.tb-drop-icon svg {
  width: 18px;
  height: 18px;
}

.tb-drop-empty b {
  font-size: 13.5px;
  color: var(--ink);
  font-weight: 600;
}

.tb-drop-empty span:last-child {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.6;
  max-width: 260px;
}

/* 九宫格预览 */
.tb-grid-preview {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.tb-grid-frame {
  position: relative;
  width: min(100%, 300px);
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  background: #eee;
  box-shadow: var(--sh-s);
}

.tb-grid-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tb-grid-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.tb-line {
  position: absolute;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
}

.tb-line-v {
  top: 0;
  bottom: 0;
  width: 1px;
}

.tb-line-h {
  left: 0;
  right: 0;
  height: 1px;
}

.tb-grid-meta {
  font-size: 11.5px;
  color: var(--sub);
  text-align: center;
  word-break: break-all;
}

/* 结果区 */
.tb-result {
  min-height: 320px;
  display: flex;
  flex-direction: column;
}

.tb-result-empty {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  padding: 36px 16px;
  color: var(--sub);
}

.tb-result-empty > span {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: #f3f3f5;
  color: var(--muted);
  display: grid;
  place-items: center;
  margin-bottom: 2px;
}

.tb-result-empty svg {
  width: 22px;
  height: 22px;
}

.tb-result-empty b {
  font-size: 13.5px;
  color: var(--ink);
}

.tb-result-empty p {
  font-size: 12px;
  color: var(--muted);
  max-width: 300px;
  line-height: 1.7;
}

.tb-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  flex: 1 1 auto;
  align-content: start;
}

.tb-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}

.tb-tile:hover {
  border-color: var(--brand-line);
  box-shadow: var(--sh-m);
  transform: translateY(-1px);
}

.tb-tile-img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  background: #f2f2f4 center/cover no-repeat;
}

.tb-tile-idx {
  position: absolute;
  top: 9px;
  left: 9px;
  background: rgba(31, 32, 35, 0.82);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 99px;
  letter-spacing: 0.02em;
}

.tb-tile-meta {
  font-size: 10.5px;
  color: var(--muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- 长图拼接 */
.tb-stitch-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  max-height: 420px;
  overflow-y: auto;
}

.tb-stitch-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 8px;
  background: #fff;
}

.tb-stitch-thumb {
  width: 46px;
  height: 46px;
  border-radius: 7px;
  background: #f2f2f4 center/cover no-repeat;
  flex: 0 0 auto;
}

.tb-stitch-info {
  min-width: 0;
  flex: 1 1 auto;
}

.tb-stitch-info b {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tb-stitch-info span {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.tb-stitch-actions {
  display: flex;
  gap: 2px;
  flex: 0 0 auto;
}

.tb-stitch-actions .btn-icon {
  width: 26px;
  min-height: 26px;
}

.tb-stitch-actions .btn-icon svg {
  width: 13px;
  height: 13px;
}

.tb-stitch-actions [data-dir="-1"] svg {
  transform: rotate(-90deg);
}

.tb-stitch-actions [data-dir="1"] svg {
  transform: rotate(90deg);
}

.tb-swatches {
  display: flex;
  gap: 8px;
}

.tb-swatch {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1.5px solid var(--line-2);
  padding: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tb-swatch.is-on {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px rgba(31, 32, 35, 0.12);
}

.tb-stitch-preview {
  border-radius: 10px;
  min-height: 160px;
  padding: 0;
  text-align: center;
}

.tb-stitch-scroll {
  max-height: 460px;
  overflow: auto;
  border-radius: 10px;
  background: repeating-conic-gradient(#f7f7f8 0% 25%, #efeff1 0% 50%) 50% / 16px 16px;
  padding: 10px;
}

.tb-stitch-canvas {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 4px;
  box-shadow: var(--sh-m);
}

.tb-stitch-meta {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  margin-top: 8px;
  width: 100%;
}

/* ---------------------------------------------------------------- 话题标签 */
.tb-tag-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin: 16px 0;
}

.tb-tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tb-tag {
  border: 1px solid var(--line-2);
  background: #fff;
  color: var(--ink-2);
  border-radius: 99px;
  padding: 5px 12px;
  font-size: 12.5px;
  line-height: 1.5;
  transition: all 0.14s;
}

.tb-tag:hover {
  border-color: #c2c5ca;
  background: #fafafb;
}

.tb-tag.is-on {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-700);
  font-weight: 600;
}

.tb-tag-output {
  min-height: 62px;
  border: 1px dashed var(--line-2);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--ink-2);
  word-break: break-word;
  background: #fafafb;
}

.tb-tag-output.is-empty {
  color: var(--muted);
}

/* ---------------------------------------------------------------- 发布清单 */
.tb-check-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 24px;
}

.tb-check-group-title {
  font-size: 12px;
  font-weight: 650;
  color: var(--brand-700);
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.tb-check-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  line-height: 1.6;
}

.tb-check-item input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--brand);
  flex: 0 0 auto;
  cursor: pointer;
}

.tb-check-item input:checked + span {
  color: var(--muted);
  text-decoration: line-through;
}

/* ---------------------------------------------------------------- 响应式 */
@media (max-width: 1080px) {
  .tb-split {
    grid-template-columns: minmax(0, 1fr);
  }

  .tb-check-groups {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .tb-tabs .tab {
    padding: 6px 10px;
  }

  .tb-tabs .tab svg {
    display: none;
  }

  .tb-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tb-tag-columns {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .tb-drop {
    min-height: 150px;
  }
}
