/* Team Generator: only what is specific to this tool. Shared look lives in ui.css. */

.tg .window-body { padding: var(--space-4); }
@media (min-width: 640px) { .tg .window-body { padding: var(--space-5); } }

.tg-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-6); }
@media (min-width: 960px) { .tg-grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: var(--space-6) var(--space-7); align-items: start; } }
.tg-people, .tg-setup { min-width: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.tg-setup > * { max-width: none; }
.tg-grow { flex: 1 1 auto; }
.tg-h { margin: 0; font: 700 0.9rem var(--font-mono); letter-spacing: 0.02em; color: var(--muted); }
.tg-h::before { content: "// "; content: "// " / ""; color: var(--teal); }
.tg-count, .tg-badge {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; margin-left: 6px; border-radius: 11px;
  font: 700 0.75rem var(--font-mono); color: var(--on-blue); background: var(--blue);
}
.tg-badge[hidden] { display: none; }
.tg .label-row { margin-bottom: 0; flex-wrap: wrap; }
.tg-note { margin: 0; font-size: 0.85rem; color: var(--muted); max-width: none; }
.tg-empty { margin: 0; padding: var(--space-5) var(--space-4); text-align: center; color: var(--muted); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); max-width: none; }
.tg-empty[hidden] { display: none; }
.btn-sm { min-height: 40px; padding: 0 var(--space-4); font-size: 0.92rem; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; box-shadow: none; filter: none; }

/* add a person */
.tg-add { display: flex; gap: var(--space-2); }
.tg-add input { flex: 1 1 auto; min-width: 0; }

/* participant rows */
.tg-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); max-height: 560px; overflow-y: auto; padding-right: 2px; }
.tg-list:empty { display: none; }
.tg-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0; max-width: none;
  padding: var(--space-2); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.tg-n { flex: none; width: 24px; text-align: center; font: 700 0.78rem var(--font-mono); color: var(--muted); }
.tg-name { flex: 1 1 140px; min-width: 0; width: auto; min-height: 42px; padding: 0 var(--space-3); font: inherit; color: var(--text); background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: 8px; }
.tg-name:focus-visible, .tg-skill:focus-visible, .tg-lock:focus-visible, .tg-team-name:focus-visible, .tg-rule select:focus-visible, #import-text:focus-visible {
  border-color: var(--focus); outline-offset: 0; box-shadow: 0 0 0 3px var(--glow-blue);
}
.tg-gender { display: inline-flex; flex: none; border: 1.5px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.tg-gbtn { min-width: 40px; min-height: 40px; padding: 0 var(--space-2); font: 700 0.85rem var(--font-mono); color: var(--text); background: var(--surface); border: 0; cursor: pointer; }
.tg-gbtn + .tg-gbtn { border-left: 1.5px solid var(--border-strong); }
.tg-gbtn:hover { background: var(--surface-2); }
.tg-gbtn[aria-pressed="true"] { background: var(--blue); color: var(--on-blue); }
.tg-gbtn:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.tg-skill, .tg-lock, .tg-team-name, .tg-rule select {
  min-height: 42px; width: auto; padding: 0 var(--space-2); font: inherit; font-size: 0.92rem; color: var(--text);
  background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: 8px;
}
.tg-skill { flex: none; width: 58px; }
.tg-lock { flex: 1 1 110px; min-width: 0; max-width: 170px; }
.tg-del { flex: none; margin-left: auto; width: 40px; height: 40px; }
.tg-row .tg-del { color: var(--muted); }
.tg-row .tg-del:hover { color: var(--danger); }
.tg.no-gender .tg-gender, .tg.no-skill .tg-skill, .tg.one-team .tg-lock { display: none; }
@media (min-width: 560px) {
  .tg-name { flex-basis: 160px; }
}
@media (max-width: 559px) {
  .tg-n { display: none; }
  .tg-name { flex: 1 1 calc(100% - 56px); order: 0; }
  .tg-del { order: 1; margin-left: 0; }
  .tg-gender, .tg-skill, .tg-lock { order: 2; }
  .tg-lock { max-width: none; }
}

.tg-import textarea {
  display: block; width: 100%; margin: var(--space-2) 0; padding: var(--space-3); font: 0.88rem/1.5 var(--font-mono); color: var(--text);
  background: var(--bg); border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm); resize: vertical;
}
.tg-import .tg-note { margin-bottom: var(--space-2); }

/* setup */
.tg-field { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.tg-stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg); }
.tg-stepper .icon-btn { width: 44px; height: 44px; font: 700 1.3rem var(--font-mono); border-radius: 9px; }
.tg-stepper output { min-width: 44px; text-align: center; font: 700 1.2rem var(--font-mono); }

.tg-switch { display: flex; align-items: center; gap: var(--space-3); min-height: 52px; padding: var(--space-2) 0; cursor: pointer; margin: 0; }
.tg-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tg-track { position: relative; flex: none; width: 46px; height: 26px; border-radius: 13px; background: var(--surface-2); border: 1.5px solid var(--border-strong); transition: background 0.15s; }
.tg-knob { position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%; background: var(--muted); transition: transform 0.15s, background 0.15s; }
.tg-switch input:checked + .tg-track { background: var(--blue); border-color: var(--blue); }
.tg-switch input:checked + .tg-track .tg-knob { transform: translateX(20px); background: var(--on-blue); }
.tg-switch input:focus-visible + .tg-track { outline: 3px solid var(--focus); outline-offset: 2px; }
.tg-sw-text { display: flex; flex-direction: column; line-height: 1.3; }
.tg-sw-text b { font-weight: 700; }
.tg-sw-text small { color: var(--muted); font-size: 0.82rem; }

.tg-names { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--space-2); margin-top: var(--space-2); }
.tg-team-name { width: 100%; }
.tg-rules { list-style: none; margin: var(--space-2) 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.tg-rule { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0; max-width: none; padding: var(--space-2); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.tg-rule select { flex: 1 1 120px; min-width: 0; }
.tg-rule.is-bad { border-color: var(--danger); }
.tg-rule.is-bad::after { content: "Choose two different people."; flex: 1 1 100%; color: var(--danger); font-size: 0.82rem; }
.tg-go { margin-top: var(--space-2); min-height: 52px; font-size: 1.05rem; }
.tg-msg { min-height: 1.4em; font-size: 0.92rem; color: var(--muted); max-width: none; }
.tg-msg.bad { color: var(--danger); font-weight: 600; }
.tg-msg:empty { display: none; }

/* results */
.tg-results { margin-top: var(--space-6); }
.tg-results[hidden] { display: none; }
.tg-res-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-bottom: var(--space-2); }
.tg-res-head .tg-h:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
.tg-summary { margin: 0 0 var(--space-4); font: 0.85rem var(--font-mono); color: var(--muted); max-width: none; }
.tg-warn { margin: var(--space-2) 0 0; padding-left: 1.2rem; color: var(--danger); font-family: var(--font-sans); font-size: 0.9rem; }
.tg-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: var(--space-4); }
.tg-card {
  background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--tc, var(--blue)); border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4) var(--space-4); box-shadow: var(--shadow);
}
.tg-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2); }
.tg-card-head h3 { margin: 0; font: 700 1.05rem var(--font-brand); overflow-wrap: anywhere; }
.tg-card-size { font: 0.78rem var(--font-mono); color: var(--muted); white-space: nowrap; }
.tg-card-meta { margin: var(--space-1) 0 var(--space-2); font: 0.78rem var(--font-mono); color: var(--muted); max-width: none; }
.tg-members { list-style: none; margin: var(--space-2) 0 0; padding: 0; }
.tg-member { display: flex; align-items: center; gap: var(--space-2); margin: 0; max-width: none; padding: 6px 0; border-top: 1px solid var(--border); }
.tg-member-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.tg-pill { flex: none; display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 6px; font: 700 0.72rem var(--font-mono); }
.tg-pill.M { color: var(--blue); border: 1.5px solid var(--blue); }
.tg-pill.F { color: var(--violet); border: 1.5px solid var(--violet); }
.tg-dots { flex: none; display: inline-flex; gap: 3px; }
.tg-dots i { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--border-strong); }
.tg-dots i.on { background: var(--teal); border-color: var(--teal); }
.tg-lockmark { flex: none; font: 0.68rem var(--font-mono); color: var(--muted); border: 1px solid var(--border-strong); border-radius: 4px; padding: 0 4px; }

.learn { margin-top: var(--space-7); max-width: 860px; }
.learn-title { font: 700 0.85rem var(--font-mono); letter-spacing: 0.02em; color: var(--muted); margin: 0 0 var(--space-2); }
.learn-title::before { content: "// "; color: var(--teal); }
.noscript { color: var(--muted); }
