/* TAB Scoreboard & Tablist Designer (tab-scoreboard-generator.html). Loaded after tools.css. The preview keeps game-like dark colours in both themes; every shape is our own CSS. */

.td-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 12px; }
.td-bar .tf { flex: 1 1 200px; margin: 0; }
.td-bar .tbtn { min-height: 40px; }
.td-tabs { margin-bottom: 16px; }
.td-tabs button { padding: 7px 11px; font-size: 0.84rem; }
.td-panel > .tf, .td-panel > .trow, .td-panel > .td-sub { margin-bottom: 14px; }
.td-sub { margin: 18px 0 8px; padding-top: 14px; border-top: 1px solid var(--rule-paper); font-size: 0.95rem; font-weight: 800; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.td-sub:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.td-sub small { font-family: var(--mono); font-weight: 400; font-size: 0.74rem; color: var(--on-paper-soft); }
.td-checks { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 14px; }
.td-check { display: inline-flex; align-items: center; gap: 7px; font-size: 0.86rem; font-weight: 600; cursor: pointer; }
.td-check input { width: 17px; height: 17px; accent-color: var(--red-500); margin: 0; }

/* named items (scoreboards, designs, bars, conditions, animations) */
.td-items { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.td-items .chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-items .chip small { font-family: var(--mono); font-weight: 400; opacity: 0.75; }
.td-itembar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.td-itembar .tbtn { padding: 6px 10px; }
.td-box { padding: 12px; box-shadow: inset 0 0 0 1px var(--rule-paper); }
.td-box + .td-box { margin-top: 10px; }

/* line lists */
.td-lines { display: flex; flex-direction: column; gap: 5px; counter-reset: tdl; }
.td-line { display: flex; align-items: center; gap: 4px; min-width: 0; }
.td-line::before { counter-increment: tdl; content: counter(tdl); flex: none; width: 1.7em; text-align: right; font-family: var(--mono); font-size: 0.72rem; color: var(--on-paper-soft); }
.td-lines.nonum .td-line::before { display: none; }
.td-line.over::before { color: var(--red-500); font-weight: 700; }
.tool .td-line input[type="text"] { flex: 1 1 auto; min-width: 0; padding: 7px 9px; font-family: var(--mono); font-size: 0.82rem; }
.td-line .tbtn { flex: none; padding: 6px 8px; min-width: 30px; }
.tool input.code, .tool textarea.code { font-family: var(--mono); font-size: 0.82rem; }
.tool textarea.td-frames { min-height: 9em; white-space: pre; overflow: auto; }
.td-count { font-family: var(--mono); font-size: 0.74rem; color: var(--on-paper-soft); font-weight: 400; }
.td-count.over { color: var(--red-500); font-weight: 700; }

/* insert palette */
.td-ins { margin: 0 0 14px; padding: 8px 10px; background: var(--paper-2); }
.td-ins > span { display: block; margin-bottom: 6px; font-size: 0.76rem; font-weight: 700; color: var(--on-paper-soft); }
.td-ins .chips { gap: 4px; }
.td-ins .chip { padding: 4px 8px; font-family: var(--mono); font-size: 0.74rem; font-weight: 500; }

/* sample values */
.td-kv { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 5px 8px; align-items: center; }
.td-kv code { font-family: var(--mono); font-size: 0.76rem; overflow-wrap: anywhere; }
.tool .td-kv input[type="text"] { padding: 6px 8px; font-family: var(--mono); font-size: 0.8rem; }
.td-players { display: flex; flex-direction: column; gap: 5px; }
.td-prow { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) 70px auto; gap: 5px; align-items: center; }
.tool .td-prow input { padding: 6px 8px; font-size: 0.82rem; }
.td-glyphs { display: flex; flex-direction: column; gap: 8px; }
.td-grow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.td-grow code { font-family: var(--mono); font-size: 0.82rem; min-width: 64px; }
.td-grow img { height: 28px; image-rendering: pixelated; background: #2a2223; padding: 2px; }
.tool .td-grow input[type="number"] { width: 84px; padding: 6px 8px; }

/* preview controls */
.td-pv-bar { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin-bottom: 10px; }
.td-pv-bar .seg button { padding: 6px 9px; font-size: 0.8rem; }
.td-pv-bar .chips .chip { padding: 5px 9px; font-size: 0.78rem; }
.td-time { font-family: var(--mono); font-size: 0.74rem; color: var(--on-paper-soft); min-width: 5.5em; }
.td-conds { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.td-crow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px; font-size: 0.82rem; }
.td-crow > span { font-family: var(--mono); overflow-wrap: anywhere; min-width: 0; flex: 1 1 140px; }
.td-crow > span b { font-weight: 700; }
.td-crow .seg button { padding: 4px 9px; font-size: 0.76rem; }
.td-crow .is-true { color: #1d7a46; }
.td-crow .is-false { color: var(--red-500); }
@media (prefers-color-scheme: dark) { .td-crow .is-true { color: #5ccf8c; } }
.tool .td-crow select { width: auto; flex: 0 1 220px; padding: 5px 8px; font-size: 0.8rem; }

/* the preview screen */
.td-scale { position: relative; overflow: hidden; background: #0f1a24; }
.tgrid.td-grid { grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); }
@media (max-width: 900px) { .tgrid.td-grid { grid-template-columns: minmax(0, 1fr); } }
.td-scale.zoom { overflow-x: auto; }
.td-screen {
  --u: 2px;
  width: 720px; min-height: 400px; padding: 12px 12px 16px;
  transform-origin: 0 0;
  background:
    radial-gradient(ellipse at 30% 115%, rgba(40, 72, 36, 0.9) 0 28%, transparent 29%),
    radial-gradient(ellipse at 80% 120%, rgba(32, 60, 30, 0.9) 0 30%, transparent 31%),
    linear-gradient(#1f3550 0%, #36587a 55%, #4a6d8c 70%, #355c2f 70.2%, #24401f 100%);
  color: #fff;
  font-family: var(--mono); font-size: 14px; font-weight: 600; line-height: 17px;
  display: flex; flex-direction: column; gap: 10px;
}
.td-screen .sh, .td-screen .td-t { text-shadow: var(--u) var(--u) 0 rgba(0, 0, 0, 0.55); }
.td-t { white-space: pre; }
.td-t .b { font-weight: 800; }
.td-t .i { font-style: italic; }
.td-t .u { text-decoration: underline; }
.td-t .s { text-decoration: line-through; }
.td-t .u.s { text-decoration: underline line-through; }
.td-glyph { display: inline-block; vertical-align: -3px; }
.td-gbox { display: inline-flex; align-items: center; justify-content: center; min-width: 2.6em; height: 16px; padding: 0 2px; border: 1px dashed rgba(255, 255, 255, 0.7); font-size: 8px; line-height: 1; font-weight: 500; letter-spacing: 0; text-shadow: none; color: #fff; vertical-align: -2px; }
.td-gimg { image-rendering: pixelated; vertical-align: -3px; }
.td-obj { display: inline-block; width: 16px; height: 16px; vertical-align: -3px; background: linear-gradient(135deg, #8a6b4f 50%, #6e543d 50%); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.5); }
.td-empty { color: rgba(255, 255, 255, 0.85); font-weight: 500; font-size: 13px; text-align: center; padding: 6px 10px; background: rgba(0, 0, 0, 0.35); }

.td-bars { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.td-bossbar { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.td-track { position: relative; width: 364px; height: 10px; background: var(--bar-dim, #333); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.45); }
.td-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--bar, #eee); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.35), inset 0 -2px 0 rgba(0, 0, 0, 0.2); }
.td-notch { position: absolute; inset: 0; }

.td-tablist { align-self: center; max-width: 100%; padding: 4px 6px 6px; background: rgba(0, 0, 0, 0.5); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.td-hf { text-align: center; }
.td-hf .td-t { display: block; min-height: 17px; }
.td-entries { display: grid; grid-auto-flow: column; gap: 2px 4px; }
.td-entry { display: flex; align-items: center; gap: 4px; min-width: 0; padding-right: 3px; background: rgba(255, 255, 255, 0.13); height: 18px; }
.td-head { flex: none; width: 16px; height: 16px; display: grid; place-items: center; font-size: 10px; font-weight: 800; line-height: 1; color: rgba(255, 255, 255, 0.9); text-shadow: none; box-shadow: inset -2px -2px 0 rgba(0, 0, 0, 0.25); }
.td-ename { flex: 1 1 auto; overflow: hidden; }
.td-score { flex: none; margin-left: 10px; }
.td-yellow { color: #FFFF55; }
.td-hearts { color: #ff3a3a; font-size: 11px; letter-spacing: -1px; }
.td-ping { flex: none; display: flex; align-items: flex-end; gap: 1px; width: 15px; height: 12px; margin-left: 4px; }
.td-ping i { display: block; width: 2px; background: #2a2a2a; }
.td-ping i.on { background: #36d43c; }

.td-mid { display: flex; align-items: center; gap: 16px; flex: 1 1 auto; }
.td-world { flex: 1 1 auto; display: flex; justify-content: center; align-items: flex-end; gap: 70px; min-height: 230px; padding-bottom: 6px; }
.td-fig { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.td-plate { padding: 0 3px; background: rgba(0, 0, 0, 0.32); white-space: pre; font-size: 14px; }
.td-body { margin-top: 6px; display: flex; flex-direction: column; align-items: center; }
.td-body i { display: block; }
.td-body .hd { width: 30px; height: 30px; background: #6b4a35; box-shadow: inset 0 9px 0 #3b2a1f, inset -3px -3px 0 rgba(0, 0, 0, 0.2); }
.td-body .tr { width: 30px; height: 44px; background: #3d6d9e; box-shadow: inset -3px -3px 0 rgba(0, 0, 0, 0.2); }
.td-body .lg { width: 30px; height: 40px; background: linear-gradient(90deg, #39457a 0 48%, #2f3a69 48%); }
.td-side { flex: none; margin-left: auto; align-self: center; }
.td-sidebar { display: grid; grid-template-columns: max-content max-content; background: rgba(0, 0, 0, 0.3); }
.td-sidebar .ttl { grid-column: 1 / -1; text-align: center; padding: 0 3px; background: rgba(0, 0, 0, 0.4); }
.td-sidebar .l { padding: 0 3px 0 2px; }
.td-sidebar .r { padding: 0 2px 0 8px; text-align: right; }
.td-sidebar .red { color: #FF5555; }
.td-note-s { margin-top: 6px; font-size: 11px; font-weight: 500; line-height: 13px; color: #fff; text-shadow: 1px 1px 0 #000; max-width: 300px; }

/* warnings */
.td-warn .note { font-size: 0.84rem; }
.td-warn .note.info { box-shadow: inset 3px 0 0 #3a7bd5; }
.td-warn-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }

/* import / export */
.tgrid.td-io { margin-top: clamp(16px, 2.5vw, 32px); grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr); }
.td-io .out { margin-top: 10px; }
.td-io .out-head .tbtn + .tbtn { margin-left: 4px; }
.tool textarea.td-imp { min-height: 150px; white-space: pre; overflow: auto; tab-size: 2; font-family: var(--mono); font-size: 0.8rem; }
.td-steps { margin: 10px 0 0; padding-left: 1.3em; font-size: 0.88rem; line-height: 1.5; }
.td-steps code { font-family: var(--mono); font-size: 0.84em; padding: 1px 4px; background: var(--rule-paper); }
#td-imp-res .note + .note { margin-top: 6px; }

@media (max-width: 900px) { .tgrid.td-io { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) {
  .td-prow { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .td-kv { grid-template-columns: minmax(0, 1fr); }
  .td-kv code { margin-top: 4px; }
}
@media (prefers-reduced-motion: reduce) { .td-fill { transition: none; } }

/* code fields and the preview: no ligatures, so >= stays >= */
.tool input.code, .tool textarea.code, .tool .td-line input, .tool .td-kv input, .td-screen, .td-imp { font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
.td-sidebar > span { min-height: 17px; }
@media (max-width: 900px) { .tgrid.td-grid > .sticky { order: -1; } }
.td-io .out pre { font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
.td-box > .tf + .thint { margin: -8px 0 14px; }
.td-box > .tlabel + .thint { margin: 2px 0 8px; }
.td-kv .td-line::before { display: none; }
.td-panel > .thint + .tf, .td-panel > .thint + .td-checks { margin-top: 12px; }
