/* TW presentation only. Visibility, map geometry and game actions belong to existing scripts. */
#section-twv2 {
  --tw-edge: rgba(128, 174, 205, .23);
  --tw-surface: #101e2d;
  --tw-ink: #e2edf5;
  --tw-muted: #a3b6c8;
  --tw-blue: #86d9f5;
  color: var(--tw-ink);
}
#section-twv2 > .dash-section-title {
  margin: 0;
  padding: 28px 28px 12px;
  border: 1px solid var(--tw-edge);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  background: radial-gradient(ellipse at 95% 0, #23557580, transparent 65%), #101e2d;
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  letter-spacing: -.035em;
  line-height: 1.2;
  color: #f0f6fc;
}
#section-twv2 > .dash-section-subtitle {
  margin: 0 0 24px;
  padding: 0 28px 26px;
  border: 1px solid var(--tw-edge);
  border-top: 0;
  border-radius: 0 0 20px 20px;
  background: #101e2d;
  color: var(--tw-muted);
  font-size: .9rem;
  line-height: 1.75;
}
#section-twv2 .twmap-top {
  gap: 16px;
  padding: 17px 22px;
  background: linear-gradient(100deg, #142e40, #111d2a 50%, #30222e);
  border-color: var(--tw-edge);
  border-radius: 16px 16px 0 0;
  font-size: .69rem;
  font-weight: 750;
  line-height: 1.5;
  letter-spacing: .12em;
}
#section-twv2 .twmap-top .red { text-align: right; }
#section-twv2 .twmap-wrap { border-color: var(--tw-edge); }
#section-twv2 .twmap-bottom {
  padding: 14px 22px;
  margin-bottom: 18px;
  background: #101e2d;
  border-color: var(--tw-edge);
  border-radius: 0 0 16px 16px;
  color: var(--tw-muted);
}
#section-twv2 .twmap-ctrl { gap: 18px; flex-wrap: wrap; }
#section-twv2 .twmap-ctrl label { display: inline-flex; gap: 7px; align-items: center; min-height: 36px; }
#section-twv2 input[type="checkbox"] { accent-color: #57b8dc; }
#section-twv2 .twmap-ctrl button {
  min-height: 38px;
  background: #192e41;
  border-color: var(--tw-edge);
  border-radius: 9px;
  color: var(--tw-ink);
}
#section-twv2 .tw2-detail {
  padding: 22px 24px;
  background: linear-gradient(110deg, #142a3c, #101c2b 80%);
  border-color: var(--tw-edge);
  border-left: 3px solid #78c9e8;
  border-radius: 14px;
  box-shadow: 0 8px 26px #00000018;
}
#section-twv2 .tw2-detail > div { min-width: 0; }
#section-twv2 .tw2-detail h3 { font-size: 1.15rem; line-height: 1.4; }
#section-twv2 .tw2-detail p { line-height: 1.7; }
#section-twv2 .tw2-detail small { color: var(--tw-blue); font-weight: 700; letter-spacing: .14em; }
#section-twv2 .tw2-detail .tag {
  padding: 10px 14px;
  border: 1px solid var(--tw-edge);
  border-radius: 9px;
  background: #091624;
  color: var(--tw-blue);
  white-space: nowrap;
}
#section-twv2 .tw2-sub {
  gap: 6px;
  margin: 24px 0 20px;
  padding: 7px;
  border: 1px solid var(--tw-edge);
  border-radius: 14px;
  background: #0b1725;
}
#section-twv2 .tw2-sub button {
  flex: 1 1 auto;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--tw-muted);
  transition: background .16s, border-color .16s, color .16s;
}
#section-twv2 .tw2-sub button:hover { color: #fff; background: #1a2c3f; }
#section-twv2 .tw2-sub button.on {
  background: linear-gradient(135deg, #234c67, #19354e);
  border-color: #5890ac;
  color: #f1faff;
  box-shadow: inset 0 1px #b7e7ff18, 0 3px 10px #0003;
}
#section-twv2 .tw2-phases { gap: 8px; margin-bottom: 16px; }
#section-twv2 .tw2-step {
  padding: 9px 14px;
  border-radius: 9px;
  background: #101c2b;
  border-color: var(--tw-edge);
  color: var(--tw-muted);
  font-size: .8rem;
}
#section-twv2 .tw2-step.on { background: #21475e; border-color: #79bdd9; color: #e6f7ff; }
#section-twv2 .tw2-step.done { background: #102e2c; color: #b7e9d5; border-color: #337063; }
#section-twv2 #tw2-live-refresh { min-height: 38px; margin-bottom: 0; border-radius: 9px !important; }
#section-twv2 .tw2-live-info {
  padding: 18px 20px;
  background: #101e2d;
  border-color: var(--tw-edge);
  border-radius: 12px;
  line-height: 1.6;
}
#section-twv2 #tw2-tab-live > p {
  padding: 16px 18px;
  border-left: 2px solid #a58c5b;
  border-radius: 0 9px 9px 0;
  background: #cda65f09;
  line-height: 1.8;
}
#section-twv2 [id^="tw2-host-"] > [id^="tw-pane-"] {
  border-color: var(--tw-edge) !important;
  border-radius: 14px !important;
  box-shadow: 0 8px 28px #00000012;
  margin-top: 14px;
}
#section-twv2 .tw2-rsub { gap: 8px; }
#section-twv2 .tw2-rsub button { min-height: 38px; padding: 8px 14px; border-radius: 9px; }
#section-twv2 .tw2-rsub button.on { color: var(--tw-blue); border-color: #5790ac; background: #142b3d; }
#section-twv2 .two-tiles { gap: 12px; margin: 20px 0; }
#section-twv2 .two-tile { padding: 18px; border-color: var(--tw-edge); background: linear-gradient(135deg, #162b3d, #101c2b); border-radius: 12px; }
#section-twv2 .two-tile .v { font-size: 1.65rem; font-variant-numeric: tabular-nums; }
#section-twv2 .two-tile .l { margin-top: 8px; color: var(--tw-muted); line-height: 1.5; }
#section-twv2 .two-col h4 { margin: 8px 0 14px; }
#section-twv2 .two-card { padding: 13px; margin-bottom: 10px; border-color: var(--tw-edge); background: #101e2d; }
#section-twv2 .two-bar { margin-top: 8px; }
#section-twv2 :is(button, input, select, textarea, summary):focus-visible { outline: 2px solid #91dcf5; outline-offset: 3px; }
@media (max-width: 600px) {
  #section-twv2 > .dash-section-title { padding: 22px 18px 10px; }
  #section-twv2 > .dash-section-subtitle { padding: 0 18px 20px; font-size: .82rem; margin-bottom: 18px; }
  #section-twv2 .twmap-top { padding: 12px; font-size: .58rem; letter-spacing: .06em; gap: 10px; }
  #section-twv2 .twmap-bottom { padding: 12px; gap: 6px; }
  #section-twv2 .twmap-ctrl { gap: 10px; justify-content: space-between; width: 100%; }
  #section-twv2 .tw2-detail { grid-template-columns: minmax(0, 1fr); padding: 18px; gap: 12px; }
  #section-twv2 .tw2-detail .tag { justify-self: start; }
  #section-twv2 .tw2-sub { gap: 5px; padding: 6px; margin-top: 18px; }
  #section-twv2 .tw2-sub button { flex-basis: 29%; padding: 9px 6px; font-size: .76rem; }
  #section-twv2 .tw2-phases { gap: 5px; }
  #section-twv2 .tw2-step { padding: 8px; gap: 4px; font-size: .7rem; }
  #section-twv2 .tw2-arrow { font-size: .7rem; }
  #section-twv2 .tw2-live-info { padding: 14px; }
  #section-twv2 .two-tile { padding: 14px; min-width: 100px; }
}

/* ── Scoreboard with sliding trophy (attack / review): our banners + a cup that slides toward
      whoever cleared more territory. Mirrors the GAC 3D scoreboard. ── */
#section-twv2 .tw2-sc{background:linear-gradient(180deg,#0c1622,#0a1017);border:1px solid var(--border);border-radius:14px;padding:12px 16px 10px}
#section-twv2 .tw2-sc-row{display:grid;grid-template-columns:1fr auto 1fr;gap:12px;align-items:center}
#section-twv2 .tw2-sc-team{display:flex;align-items:center;gap:10px;min-width:0}
#section-twv2 .tw2-sc-team.opp{flex-direction:row-reverse;text-align:right}
#section-twv2 .tw2-sc-crest{width:34px;height:34px;flex:none;display:flex;align-items:center;justify-content:center;border-radius:50%;font-size:1.05rem;background:#0b1420;border:1px solid var(--border)}
#section-twv2 .tw2-sc-team.me .tw2-sc-crest{color:#6cd6ff;border-color:#2a6b8a}
#section-twv2 .tw2-sc-team.opp .tw2-sc-crest{color:#ff8077;border-color:#8a3a35}
#section-twv2 .tw2-sc-tx{min-width:0}
#section-twv2 .tw2-sc-name{font-weight:700;font-size:0.9rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#section-twv2 .tw2-sc-sub{font-size:0.72rem;color:var(--text-secondary)}
#section-twv2 .tw2-sc-big{font-size:1.9rem;font-weight:900;line-height:1;font-variant-numeric:tabular-nums}
#section-twv2 .tw2-sc-team.me .tw2-sc-big{color:#6cd6ff}
#section-twv2 .tw2-sc-team.opp .tw2-sc-big{color:#ff8077}
#section-twv2 .tw2-sc-vs{text-align:center;color:var(--text-secondary);font-size:0.8rem;line-height:1.2}
#section-twv2 .tw2-sc-ban{margin-top:3px;font-size:0.82rem;font-weight:800;color:#f4d886;white-space:nowrap}
#section-twv2 .tw2-sc-track{position:relative;height:60px;margin:4px 8% 0}
#section-twv2 .tw2-sc-track::before{content:"";position:absolute;top:26px;left:0;right:0;height:1px;background:linear-gradient(90deg,transparent,#78d9ff55,#e9cb7b88,#ff8c7955,transparent)}
#section-twv2 .tw2-sc-trophy{position:absolute;top:0;left:50%;width:38px;height:46px;transform:translateX(-50%);transition:left 1.4s cubic-bezier(.22,.8,.25,1);filter:drop-shadow(0 4px 7px #0008) drop-shadow(0 0 7px #edc25255)}
#section-twv2 .tw2-sc-trophy img{display:block;width:100%;height:100%;object-fit:contain}
#section-twv2 .tw2-sc-track.settled[data-leader=me] .tw2-sc-trophy{left:15%}
#section-twv2 .tw2-sc-track.settled[data-leader=opp] .tw2-sc-trophy{left:85%}
#section-twv2 .tw2-sc-lead{position:absolute;bottom:2px;left:0;right:0;text-align:center;font-size:.72rem;color:#f4d886;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#section-twv2 .tw2-sc-prog{display:flex;height:7px;border-radius:5px;overflow:hidden;background:#0b1420;margin-top:6px}
#section-twv2 .tw2-sc-prog i{display:block;height:100%;transition:width .6s}
#section-twv2 .tw2-sc-prog i.me{background:linear-gradient(90deg,#3a7fb0,#6cd6ff)}
#section-twv2 .tw2-sc-prog i.opp{background:linear-gradient(90deg,#8a3a35,#ff8077)}
@media(max-width:560px){#section-twv2 .tw2-sc-big{font-size:1.4rem}#section-twv2 .tw2-sc-track{margin:4px 2% 0}#section-twv2 .tw2-sc-name{font-size:0.82rem}}
@media(prefers-reduced-motion:reduce){#section-twv2 .tw2-sc-trophy{transition:none}}

/* Collapsible Territory panel (click the header to hide/show the details). */
#section-twv2 #twv2-head{display:inline-flex;align-items:center;gap:6px;cursor:pointer;user-select:none}
#section-twv2 .tw2-det-arr{display:inline-block;color:var(--text-secondary);font-size:0.7rem;transition:transform .15s}
#section-twv2 .tw2-detail.collapsed{min-height:0;padding:11px 20px}
#section-twv2 .tw2-detail.collapsed #twv2-title,#section-twv2 .tw2-detail.collapsed #twv2-desc,#section-twv2 .tw2-detail.collapsed #twv2-code{display:none}

/* Per-field squad list in the territory panel (click a field → its squads + attack counts). */
#section-twv2 .t2f-sqs{display:flex;flex-wrap:wrap;gap:6px;max-height:280px;overflow-y:auto;padding:2px 0}
#section-twv2 .t2f-sq{display:flex;align-items:center;gap:1px;background:var(--bg-primary);border:1px solid var(--border);border-radius:8px;padding:3px 6px 3px 4px}
#section-twv2 .t2f-sq img{border-radius:50%;object-fit:cover;flex:none}
#section-twv2 .t2f-sq-b{font-size:0.68rem;font-weight:700;margin-left:3px;min-width:12px;text-align:center}

/* Attacker name on a cleared squad chip (who cleared it — from the attack feed). */
#section-twv2 .t2f-sq-by{font-size:0.6rem;font-weight:700;color:#93c5fd;margin-left:3px;max-width:62px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
