.teams-app {
  --ct: #5aa0ff;
  --t: #f97316;
  --success: #0f3b2e;
  --success-b: #1a5a47;
  --error: #3b0f0f;
  --error-b: #6f1d1d;
  --auto-fontscale: 1;
}
.teams-app .header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.teams-app .brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.teams-app .badge {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: conic-gradient(from 210deg, var(--accent) 0 25%, #7c2d12 25% 50%, #fb923c 50% 75%, #2a2f3a 75% 100%);
  border: 1px solid var(--border);
}
.teams-app h1 {
  margin: 0;
  letter-spacing: 0.5px;
  font-weight: 800;
  text-transform: uppercase;
  font-size: clamp(1rem, 2.5vw, 1.15rem);
}
.teams-app h1 .hl { color: var(--accent); }
.teams-app .sub { color: var(--muted); font-size: 0.9rem; }
.teams-app .ctrls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.teams-app .toggle { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.teams-app .range { accent-color: var(--accent); min-width: 120px; }
.teams-app .grid { display: grid; grid-template-columns: 0.95fr 1.05fr; gap: 16px; }
@media (max-width: 1000px) { .teams-app .grid { grid-template-columns: 1fr; } }
.teams-app .section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.teams-app ul { list-style: none; padding: 0; margin: 0; }
.teams-app li { padding: 6px 0; }
.teams-app textarea,
.teams-app input[type="text"],
.teams-app select,
.teams-app #newName,
.teams-app #extra {
  width: 100%;
  max-width: none;
  background: #0f1115;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0;
  font: inherit;
}
.teams-app .btn { text-transform: uppercase; letter-spacing: 0.4px; }
.teams-app .btn.sm { padding: 0.45rem 0.7rem; font-size: 0.85rem; }
.teams-app .btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.teams-app .hint, .teams-app .small { color: var(--muted); font-size: 0.9rem; }
#playerList { overflow: auto; }
.plist { width: 100%; }
.plist .item {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) minmax(140px, 260px) auto auto;
  gap: 10px;
  align-items: center;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}
.plist .item:last-child { border-bottom: none; }
.plist .item .name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 600; }
.plist .item select { width: 100%; max-width: none; margin: 0; }
.ok {
  color: #dff6ed;
  background: linear-gradient(180deg, var(--success), var(--success-b));
  border: 1px solid #1f6c57;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  margin: 0.75rem 0;
}
.err {
  color: #ffd1d1;
  background: linear-gradient(180deg, var(--error), var(--error-b));
  border: 1px solid #7f1d1d;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  margin: 0.75rem 0;
}
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 12px; }
@media (max-width: 560px) { .teams { grid-template-columns: 1fr; } }
.team {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 120px;
}
.team h3 { margin: 0.25rem 0 0.5rem; font-size: 1.05rem; text-transform: uppercase; }
.team.ct h3 { color: #5aa0ff; }
.team.t h3 { color: var(--accent); }
.pill {
  display: inline-block;
  background: #0e1922;
  color: #a5f3fc;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.85rem;
  border: 1px solid #214356;
}
#modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: flex-start;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
  z-index: 9999;
  overflow: auto;
  padding: 12px;
}
#modal .box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0;
  width: min(1000px, 100% - 8px);
  max-height: 92vh;
  overflow: auto;
  box-shadow: var(--shadow);
}
.modalHead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  padding: 12px;
  border-radius: 16px 16px 0 0;
}
.modalBody { padding: 12px; }
#modalGrid { display: grid; grid-template-columns: 1fr 340px; gap: 16px; }
@media (max-width: 900px) { #modalGrid { grid-template-columns: 1fr; } }
#wheelWrap {
  background: #0a1218;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}
#wheelCanvas {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #081018;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: crosshair;
}
#side { display: flex; flex-direction: column; gap: 12px; }
.live {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #0a1118;
  border: 1px dashed var(--border);
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  min-height: 42px;
}
.closeX { background: #7f1d1d !important; color: #fff !important; }
.killfeed {
  background: #0a1118;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
}
.killfeed h3 { margin: 0.25rem 0 0.5rem; text-transform: uppercase; }
.feedlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.feeditem {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #0b131b;
  border: 1px solid var(--border);
}
.badgeCT, .badgeT {
  display: inline-block;
  min-width: 22px;
  text-align: center;
  padding: 0.15rem 0.35rem;
  border-radius: 6px;
  font-weight: 800;
}
.badgeCT { background: #0c2038; color: #5aa0ff; border: 1px solid #214a7a; }
.badgeT { background: #2b1c06; color: var(--accent); border: 1px solid #7c2d12; }
.feedname { font-weight: 600; }
.teamlists { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .teamlists { grid-template-columns: 1fr; } }
.hidden { display: none !important; }
.mobileOnly { display: none; }
@media (max-width: 900px) { .mobileOnly { display: inline-flex; } }

.tabs {
  display: flex;
  gap: 0.4rem;
  margin: 0 0 1.25rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.6rem;
}
.tabs button.tab {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
}
.tabs button.tab.active,
.tabs button.tab:hover {
  background: #24180f;
  color: var(--accent);
}
.tab-panel[hidden] { display: none !important; }
