/* Конструктор тир-листов (/tiers). Префикс .tl-. */

.tl { color: var(--text); }

/* ---- панель действий ---- */
.tl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.tl-title {
  flex: 1 1 240px; min-width: 180px; padding: 9px 12px; border-radius: 8px; font: inherit; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
}
.tl-title:focus { outline: none; border-color: var(--accent); }
.tl-btn {
  padding: 9px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.tl-btn:hover { border-color: var(--border-strong); }
.tl-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.tl-btn.primary:hover { filter: brightness(1.05); }
.tl-btn:disabled { opacity: 0.5; cursor: default; }
.tl-share { flex-basis: 100%; display: none; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 8px; background: rgba(143, 209, 63, 0.1); border: 1px solid rgba(143, 209, 63, 0.35); font-size: 14px; }
.tl-share.show { display: flex; flex-wrap: wrap; }
.tl-share input { flex: 1 1 240px; padding: 6px 10px; border-radius: 6px; background: var(--bg-deep); border: 1px solid var(--border); color: var(--text); font: inherit; font-size: 13px; }
.tl-view-note { flex-basis: 100%; font-size: 13px; color: var(--text-dim); }

/* ---- ряды ---- */
.tl-rows { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; }
.tl-row { display: grid; grid-template-columns: 96px 1fr 28px; min-height: 76px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.tl-row.over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.tl-label {
  display: flex; align-items: center; justify-content: center; padding: 6px; font-weight: 800; font-size: 20px; color: #111;
  text-align: center; word-break: break-word; cursor: text; user-select: none;
}
.tl-label[contenteditable]:focus { outline: 2px solid #fff; outline-offset: -3px; }
.tl-cells { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; align-content: flex-start; min-height: 64px; }
.tl-cells:empty::after { content: 'перетащи сюда'; color: var(--text-faint); font-size: 13px; align-self: center; padding-left: 6px; }
.tl-row-tools { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: rgba(0, 0, 0, 0.2); }
.tl-row-tools button { width: 24px; height: 22px; border: 0; background: transparent; color: var(--text-faint); cursor: pointer; font-size: 12px; line-height: 1; padding: 0; }
.tl-row-tools button:hover { color: var(--text); }
.tl-add-row { align-self: flex-start; }

/* ---- фишка танка ---- */
.tl-chip {
  position: relative; display: flex; flex-direction: column; align-items: center; width: 84px; padding: 4px 2px 3px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; cursor: grab; user-select: none;
  transition: transform 0.1s, border-color 0.1s;
}
.tl-chip:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.tl-chip.dragging { opacity: 0.4; }
.tl-chip.picked { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.tl-chip img { width: 72px; height: 44px; object-fit: contain; pointer-events: none; }
.tl-chip .tl-chip-name { font-size: 11px; line-height: 1.15; text-align: center; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }
.tl-chip .tl-chip-tier { position: absolute; top: 2px; left: 4px; font-size: 10px; color: var(--text-faint); pointer-events: none; }
.tl-chip .tl-chip-prem { position: absolute; top: 2px; right: 4px; font-size: 10px; color: var(--amber); pointer-events: none; }

/* ---- запас техники ---- */
.tl-pool { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.tl-pool.over { outline: 2px dashed var(--text-faint); outline-offset: -2px; }
.tl-pool-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); }
.tl-pool-head h3 { margin: 0 8px 0 0; font-size: 14px; }
.tl-search { flex: 1 1 160px; min-width: 120px; padding: 6px 10px; border-radius: 6px; background: var(--bg-deep); border: 1px solid var(--border); color: var(--text); font: inherit; font-size: 13px; }
.tl-chips { display: flex; flex-wrap: wrap; gap: 3px; }
.tl-f { padding: 5px 8px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim); font: inherit; font-size: 12px; cursor: pointer; line-height: 1; }
.tl-f.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.tl-f img { width: 14px; height: 14px; vertical-align: -3px; }
.tl-f.active img { filter: brightness(0.2); }
.tl-select { padding: 5px 8px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); font: inherit; font-size: 12px; }
.tl-pool-count { margin-left: auto; font-size: 12px; color: var(--text-faint); }
.tl-pool-cells { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; max-height: 52vh; overflow: auto; }
.tl-pool-cells:empty::after { content: 'всё разложено'; color: var(--text-faint); font-size: 13px; padding: 6px; }

/* ---- выбор ряда на телефоне ---- */
/* Над нижней панелью вкладок сайта (body.has-bottom-tabs задаёт её высоту). */
.tl-sheet { position: fixed; left: 0; right: 0; bottom: var(--bottom-tabs-h, 0px); z-index: 60; background: var(--surface); border-top: 1px solid var(--border-strong); padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5); display: none; }
.tl-sheet.show { display: block; }
.tl-sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 14px; }
.tl-sheet-head img { width: 56px; height: 36px; object-fit: contain; }
.tl-sheet-head b { flex: 1; }
.tl-sheet-rows { display: flex; flex-wrap: wrap; gap: 6px; }
.tl-sheet-rows button { padding: 10px 14px; border-radius: 8px; border: 0; font: inherit; font-weight: 800; color: #111; cursor: pointer; min-width: 52px; }
.tl-sheet-rows button.pool { background: var(--surface-2); color: var(--text); font-weight: 600; }

.tl-foot { margin: 12px 2px 0; font-size: 12px; color: var(--text-faint); line-height: 1.5; }

@media (max-width: 700px) {
  .tl-row { grid-template-columns: 64px 1fr 24px; min-height: 64px; }
  .tl-label { font-size: 16px; }
  .tl-chip { width: 64px; }
  .tl-chip img { width: 56px; height: 34px; }
  .tl-chip .tl-chip-name { max-width: 60px; font-size: 10px; }
  .tl-pool-cells { max-height: 42vh; }
}
