:root {
  --paper: #090b0e;
  --panel: #12161b;
  --panel-raised: #181d23;
  --panel-soft: #0e1216;
  --ink: #f4f1eb;
  --muted: #9aa4ad;
  --quiet: #6f7982;
  --rule: rgba(255, 255, 255, 0.11);
  --rule-hard: rgba(255, 255, 255, 0.24);
  --accent: #ff4655;
  --accent-dark: #c72f3d;
  --go: #58d6a8;
  --duelist: #ff7772;
  --initiator: #f2c75c;
  --controller: #7aaaff;
  --sentinel: #68d9aa;
  --display: "Big Shoulders Display", Impact, sans-serif;
  --body: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --setup-column-width: 410px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  min-width: 320px;
  margin: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    radial-gradient(circle at 86% -10%, rgba(255, 70, 85, 0.16), transparent 34rem),
    var(--paper);
  background-size: 32px 32px, 32px 32px, auto, auto;
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button,
a,
summary {
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: default;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.app-shell {
  width: min(100% - 40px, 1480px);
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 88px;
  border-bottom: 1px solid var(--rule-hard);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 42px;
  place-items: center;
  background: var(--accent);
  color: #fff;
  clip-path: polygon(0 0, 78% 0, 100% 24%, 100% 100%, 20% 100%, 0 76%);
}

.brand-mark svg {
  width: 38px;
  height: 30px;
  fill: currentColor;
}

.brand-copy,
.brand-copy strong,
.brand-copy small {
  display: block;
}

.brand-copy strong {
  font-family: var(--display);
  font-size: 23px;
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.brand-copy small,
.eyebrow,
.section-status,
.match-label,
.field-label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.brand-copy small {
  margin-top: 3px;
  font-size: 8px;
  letter-spacing: 0.14em;
}

/* ─── NEXT AGENT BANNER ───────────────────────────────────────────────
   Sits above the grid, dismissible, and retires itself once the agent
   ships. Fluid rather than breakpointed: it reflows on narrow screens
   without needing a media query.
   ─────────────────────────────────────────────────────────────────── */
.upcoming {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(10px, 2vw, 20px);
  align-items: center;
  justify-content: space-between;
  margin-top: clamp(12px, 2vw, 18px);
  padding: clamp(12px, 2vw, 16px);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  background: var(--panel-soft);
}

.upcoming[data-state="arrived"] {
  border-left-color: var(--go, var(--accent));
}

.upcoming-body {
  display: grid;
  gap: 3px;
  flex: 1 1 min(100%, 34ch);
  min-width: 0;
}

.upcoming-body strong {
  font-family: var(--display);
  font-size: clamp(17px, 2.6vw, 22px);
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.upcoming-body span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.upcoming-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.upcoming-link {
  padding: 8px 12px;
  border: 1px solid var(--rule-hard);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}

.upcoming-link:hover {
  background: var(--ink);
  color: var(--paper, var(--panel-soft));
}

.command-grid {
  display: grid;
  grid-template-columns: clamp(380px, 29vw, 420px) minmax(0, 1fr);
  gap: 24px;
  padding: 24px 0 38px;
}

.column-resizer {
  display: none;
}

.setup-panel,
.draft-panel {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(14, 18, 22, 0.76);
  box-shadow: 0 20px 72px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(18px);
}

.setup-panel {
  padding: 22px;
}

.draft-panel {
  position: relative;
  align-self: start;
  padding: 22px;
  overflow: hidden;
}

.draft-panel::before {
  position: absolute;
  top: 0;
  right: 0;
  width: 110px;
  height: 4px;
  background: var(--accent);
  content: "";
}

.section-heading,
.draft-heading,
.context-heading,
.library-head,
.selector-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 6px;
}

.section-heading h1,
.draft-heading h2,
.context-heading h2,
.team-needs-head strong,
.library-head h2,
.player-editor h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.section-heading h1,
.draft-heading h2 {
  font-size: clamp(34px, 4vw, 52px);
}

.section-status {
  padding: 6px 8px;
  border: 1px solid var(--rule);
  color: var(--ink);
}

.squad-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.squad-empty {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 88px;
  padding: 15px;
  border: 1px dashed var(--rule-hard);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.018);
}

.squad-empty span,
.squad-empty strong,
.squad-empty small {
  display: block;
}

.squad-empty strong {
  color: var(--ink);
  font-size: 14px;
}

.squad-empty small {
  margin-top: 2px;
  font-size: 12px;
}

.empty-mark {
  display: grid !important;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--rule-hard);
  color: var(--accent);
  font-family: var(--display);
  font-size: 28px;
}

.squad-player {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--rule);
  background: var(--panel);
  transition: border-color 0.18s, background 0.18s;
}

.squad-player:hover {
  border-color: var(--rule-hard);
  background: var(--panel-raised);
}

.squad-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.player-monogram,
.library-monogram {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--rule-hard);
  background: var(--panel-soft);
  color: var(--accent);
  font-family: var(--display);
  font-weight: 800;
}

.player-monogram {
  width: 38px;
  height: 38px;
  font-size: 19px;
}

.squad-copy {
  min-width: 0;
}

.squad-copy small,
.squad-copy strong,
.squad-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.squad-copy small,
.squad-copy span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.squad-copy strong {
  margin: 1px 0 2px;
  font-size: 14px;
}

.squad-copy > span {
  overflow: visible;
  line-height: 1.35;
  text-overflow: clip;
  white-space: normal;
}

.squad-controls {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.player-actions,
.library-footer,
.editor-actions,
.pool-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.player-actions {
  flex-wrap: wrap;
  margin-top: 12px;
}

.device-save-note {
  margin-left: auto;
  color: var(--quiet);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.button,
.discord-link,
.library-add,
.icon-btn,
.token,
.dialog-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--rule-hard);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.075em;
  text-decoration: none;
  text-transform: uppercase;
}

.button,
.discord-link,
.library-add {
  padding: 10px 14px;
}

.button--primary,
.library-add {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.button--primary:hover:not(:disabled),
.library-add:hover:not(:disabled) {
  border-color: #ff6673;
  background: #ff6673;
}

.button--secondary:hover:not(:disabled),
.icon-btn:hover:not(:disabled),
.token:hover:not(:disabled) {
  border-color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
}

.button:disabled,
.library-add:disabled,
.icon-btn:disabled,
.token:disabled {
  cursor: default;
  opacity: 0.38;
}

.icon-btn,
.token {
  min-height: 32px;
  padding: 6px 8px;
  color: var(--muted);
  font-size: 9px;
}

.icon-btn--quiet {
  border-color: transparent;
}

.text-button {
  min-height: 32px;
  padding: 4px 1px;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.text-button:hover:not(:disabled) {
  border-bottom-color: currentColor;
  color: var(--ink);
}

.text-button:disabled {
  opacity: 0.35;
}

.text-button.danger {
  color: #ff7a86;
}

.team-context {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
}

.context-heading h2,
.team-needs-head strong {
  font-size: 24px;
}

.context-heading > div,
.team-needs-head > span:first-child {
  display: grid;
  gap: 6px;
}

.context-heading .eyebrow,
.team-needs-head .eyebrow {
  margin: 0;
}

.context-heading > span,
#outsideCount {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.team-seats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  margin: 13px 0 12px;
}

.team-seat {
  min-width: 0;
  padding: 7px 4px;
  border: 1px solid var(--rule);
  background: rgba(255, 255, 255, 0.018);
  text-align: center;
}

.team-seat b,
.team-seat small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-seat b {
  font-size: 10px;
}

.team-seat small {
  margin-top: 2px;
  color: var(--quiet);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.team-seat.stack-seat {
  border-color: rgba(255, 70, 85, 0.42);
}

.team-seat.known-seat {
  border-color: var(--controller);
}

.team-seat.unknown-seat {
  border-style: dashed;
  color: var(--quiet);
}

.outside-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
}

.outside-copy h3 {
  margin: 0;
  font-size: 13px;
}

.outside-copy p {
  max-width: 34ch;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  text-align: right;
}

.player {
  border: 1px solid var(--rule);
  background: var(--panel);
}

.player-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 7px 9px;
}

.slot,
.count {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.slot {
  color: var(--controller);
}

.bar-title {
  flex: 1 1 auto;
  font-size: 12px;
  font-weight: 600;
}

.pool {
  display: none;
  padding: 12px;
  border-top: 1px solid var(--rule);
}

.player.open .pool {
  display: block;
}

.pool-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 11px;
}

.role-block {
  margin-bottom: 13px;
}

.role-block:last-child {
  margin-bottom: 0;
}

.role-label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.role-label::before {
  width: 16px;
  height: 2px;
  background: currentColor;
  content: "";
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.chip {
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10px;
}

.chip:hover:not(:disabled) {
  border-color: currentColor;
  color: var(--ink);
}

.chip[aria-pressed="true"] {
  border-color: var(--chip-accent);
  background: color-mix(in srgb, var(--chip-accent) 24%, var(--panel-raised));
  color: var(--ink);
  font-weight: 600;
}

.chip.fixed {
  border-color: var(--rule-hard);
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink);
  cursor: default;
}

.chip.gone {
  opacity: 0.3;
  text-decoration: line-through;
}

.team-needs {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}

.team-needs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 48px;
}

.needs-signal {
  max-width: 52%;
  padding: 5px 8px;
  border: 1px solid var(--rule);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-align: right;
  text-transform: uppercase;
}

.team-needs-body {
  padding: 6px 0 0;
}

.team-needs-body > p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.needs-summary {
  margin-bottom: 6px;
  padding: 9px 10px;
  border: 1px solid var(--rule);
  background: rgba(255, 255, 255, 0.018);
}

/* name carries the weight, role rides alongside as a tag — a flat
   "Raze · Duelist · KAY/O · Initiator" list is unreadable to a newcomer */
.agent-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  /* every other value in this table starts at the same left edge */
  justify-content: flex-start;
}

.agent-tag {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 8px;
  border: 1px solid var(--rule);
  background: var(--panel-soft);
}

.agent-tag strong {
  font-size: 12px;
}

.agent-tag-sep {
  color: var(--quiet);
  font-size: 11px;
}

.agent-tag-role {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--quiet);
}

.summary-row {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 9px;
  padding: 3px 0;
}

.summary-row span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.summary-row strong {
  font-size: 12px;
}

.need-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--rule);
}

.need-role {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.need-state strong,
.need-state span {
  display: block;
}

.need-state strong {
  font-size: 12px;
}

.need-state span {
  color: var(--muted);
  font-size: 11px;
}

.need-row.impossible .need-state strong {
  color: var(--accent);
}

.draft-heading {
  align-items: flex-start;
  padding-bottom: 17px;
  border-bottom: 1px solid var(--rule);
}

.match-index {
  display: grid;
  grid-template-columns: auto auto;
  align-items: end;
  column-gap: 8px;
  min-width: 84px;
  text-align: right;
}

.match-index span,
.match-index small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.match-index strong {
  grid-row: 1 / span 2;
  grid-column: 2;
  color: var(--accent);
  font-family: var(--display);
  font-size: 42px;
  line-height: 0.78;
}

/* ─── ROLL STYLE ──────────────────────────────────────────────────────
   Three named stops, not a continuous scale. step="1" over 0..2 makes the
   thumb snap, so it reads as a segmented control you can drag.
   ─────────────────────────────────────────────────────────────────── */
.mode-row {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.structure-control {
  display: grid;
  gap: 6px;
  padding: clamp(10px, 2vw, 14px);
  border: 1px solid var(--rule);
  background: var(--panel-soft);
}

.structure-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.structure-head label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--quiet);
}

.structure-range {
  --structure-fill: 50%;
  width: 100%;
  min-height: 44px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

/* one dot per stop, so the three landing points are visible on the track */
.structure-range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background:
    radial-gradient(circle at 2px 50%, var(--rule-hard) 2px, transparent 2px) left / 50% 100% no-repeat,
    radial-gradient(circle at 50% 50%, var(--rule-hard) 2px, transparent 2px) center / 100% 100% no-repeat,
    linear-gradient(to right, var(--accent) var(--structure-fill), var(--rule-hard) var(--structure-fill));
}

.structure-range::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--accent) var(--structure-fill), var(--rule-hard) var(--structure-fill));
}

.structure-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -8px;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: var(--ink);
}

.structure-range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: var(--ink);
}

.structure-scale {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--quiet);
}

.structure-scale span {
  flex: 1 1 0;
  transition: color 0.15s ease;
}

.structure-scale span:nth-child(2) {
  text-align: center;
}

.structure-scale span:last-child {
  text-align: right;
}

.structure-scale span.is-active {
  color: var(--ink);
}

/* ─── STATUS BADGE ────────────────────────────────────────────────────
   Colour tracks real feasibility, not just whether a draft exists.
   ─────────────────────────────────────────────────────────────────── */
#spinHint::before {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

#spinHint[data-tone="idle"] { color: var(--quiet); }
#spinHint[data-tone="bad"] { color: var(--accent); }
#spinHint[data-tone="ready"],
#spinHint[data-tone="locked"] { color: var(--go); }

.mode-description {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.map-panel {
  display: grid;
  grid-template-columns: minmax(190px, 0.7fr) minmax(260px, 1.3fr);
  gap: 12px;
  margin-top: 12px;
  padding: 12px;
  background: rgba(122, 170, 255, 0.055);
}

.map-panel label,
.map-panel label span {
  display: block;
}

.map-panel select {
  width: 100%;
  min-height: 44px;
  padding: 8px 34px 8px 11px;
  border: 1px solid var(--rule-hard);
  border-radius: 0;
  background: var(--panel-soft);
  color: var(--ink);
}

.map-intel {
  align-self: start;
  border-left: 1px solid var(--rule);
  padding-left: 12px;
}

.map-intel summary {
  min-height: 28px;
  color: var(--controller);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.map-intel p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.map-intel-label {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.map-ranking {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 18px;
  margin: 5px 0 14px;
  padding: 0;
  counter-reset: map-rank;
  list-style: none;
}

.map-ranking li {
  display: inline-flex;
  gap: 5px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  counter-increment: map-rank;
}

.map-ranking li::before {
  color: var(--accent);
  content: counter(map-rank) ".";
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
}

.map-intel .map-note {
  margin-bottom: 11px;
}

.map-influence {
  padding-top: 10px;
  border-top: 1px solid var(--rule);
}

.map-intel .map-source {
  color: var(--quiet);
  font-family: var(--mono);
  font-size: 9px;
}

.map-source a {
  color: var(--ink);
}

.status {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  margin: 14px 0;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  background: rgba(88, 214, 168, 0.04);
}

.status.bad {
  background: rgba(255, 70, 85, 0.04);
}

.status.status--quiet {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.status-dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--go);
  box-shadow: 0 0 0 4px rgba(88, 214, 168, 0.09);
}

.status.bad .status-dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(255, 70, 85, 0.09);
}

.status-txt b,
.status-txt span {
  display: block;
}

.status-txt b {
  font-size: 12px;
}

.status-txt span {
  color: var(--muted);
  font-size: 12px;
}

.results {
  min-height: 300px;
  margin-bottom: 14px;
}

.lobby-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.lobby-tag {
  padding: 3px 6px;
  border: 1px solid rgba(122, 170, 255, 0.45);
  color: var(--controller);
}

.draft-empty {
  display: grid;
  min-height: 290px;
  place-content: center;
  justify-items: center;
  border: 1px dashed var(--rule-hard);
  background:
    linear-gradient(45deg, transparent 49.6%, rgba(255, 255, 255, 0.025) 50%, transparent 50.4%),
    linear-gradient(-45deg, transparent 49.6%, rgba(255, 255, 255, 0.025) 50%, transparent 50.4%);
  color: var(--muted);
  text-align: center;
}

.draft-empty strong,
.draft-empty span {
  display: block;
}

.draft-empty strong {
  margin-top: 12px;
  color: var(--ink);
  font-family: var(--display);
  font-size: 25px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.draft-empty > span:last-child {
  margin-top: 3px;
  font-size: 11px;
}

.draft-reticle {
  display: grid !important;
  width: 68px;
  height: 68px;
  place-items: center;
  border: 1px solid var(--rule-hard);
  border-radius: 50%;
  color: var(--accent);
  font-family: var(--display);
  font-size: 34px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
  gap: 10px;
}

.reveal-card {
  --role-color: var(--muted);
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 304px;
  flex-direction: column;
  padding: 13px;
  border: 1px solid var(--rule);
  background: rgba(18, 22, 27, 0.84);
  overflow: hidden;
  isolation: isolate;
}

.reveal-card::before {
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
  width: 4px;
  height: 0;
  background: var(--role-color);
  content: "";
  transition: height 0.3s ease;
}

.reveal-card::after {
  position: absolute;
  right: -34px;
  bottom: -50px;
  z-index: -1;
  width: 140px;
  height: 140px;
  border: 1px solid var(--role-color);
  content: "";
  opacity: 0.13;
  transform: rotate(38deg);
}

.reveal-card.revealed::before {
  height: 100%;
}

.reveal-card.revealed {
  animation: card-reveal 0.34s ease both;
}

.reveal-card.pinned {
  border-color: var(--role-color);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.reveal-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 9px;
}

.res-slot {
  color: var(--quiet);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.res-who {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-visual {
  position: relative;
  display: grid;
  min-height: 152px;
  margin: 13px 0 11px;
  place-items: end center;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.03), transparent 54%),
    color-mix(in srgb, var(--role-color) 8%, var(--panel-soft));
  color: var(--role-color);
  overflow: hidden;
}

.agent-visual::before,
.agent-visual::after {
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: currentColor;
  content: "";
  opacity: 0.5;
}

.agent-visual::before {
  top: 8px;
  left: 8px;
  border-top: 1px solid;
  border-left: 1px solid;
}

.agent-visual::after {
  right: 8px;
  bottom: 8px;
  border-right: 1px solid;
  border-bottom: 1px solid;
}

.agent-portrait {
  display: block;
  width: 100%;
  height: 150px;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 14px 24px rgba(0, 0, 0, 0.5));
  transform: scale(1.08);
}

.agent-fallback {
  align-self: center;
  padding: 12px;
  color: var(--ink);
  font-family: var(--display);
  font-size: 27px;
  font-weight: 800;
  line-height: 0.95;
  text-align: center;
  text-transform: uppercase;
}

.res-main {
  min-width: 0;
}

.res-agent,
.res-role {
  display: block;
}

.res-agent {
  overflow: hidden;
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(28px, 3.2vw, 40px);
  font-weight: 900;
  line-height: 0.88;
  letter-spacing: 0.01em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.res-role {
  margin-top: 5px;
  color: var(--role-color);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.res-acts {
  display: flex;
  gap: 5px;
  margin-top: auto;
  padding-top: 12px;
}

.token {
  flex: 1 1 0;
}

.token[aria-pressed="true"] {
  border-color: var(--role-color);
  background: var(--role-color);
  color: var(--paper);
  opacity: 1;
}

.reveal-card.scrambling .agent-portrait,
.reveal-card.scrambling .res-agent {
  color: var(--muted);
  filter: blur(0.5px);
}

.reveal-card.scrambling .agent-visual {
  animation: scan-pulse 0.12s steps(2, end) infinite;
}

.reveal-card--waiting {
  min-height: 132px;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.reveal-card--waiting::after {
  display: none;
}

.reveal-card--waiting .agent-visual {
  flex: 0 0 auto;
  width: 58px;
  min-height: 72px;
  margin: 0;
  color: var(--quiet);
  font-family: var(--display);
  font-size: 34px;
}

.composition-summary {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.035);
}

.notes-label {
  display: block;
  margin-bottom: 4px;
}

.lineup-notes {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
}

.waiting-copy,
.waiting-copy strong,
.waiting-copy small {
  display: block;
}

.waiting-copy strong {
  color: var(--ink);
  font-size: 13px;
}

.waiting-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.draft-actions {
  display: grid;
  grid-template-columns: minmax(160px, 1.1fr) minmax(180px, 1fr) auto;
  align-items: stretch;
  gap: 9px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}

.lock-button {
  position: relative;
  display: grid;
  min-height: 68px;
  padding: 10px 24px;
  place-content: center;
  border: 0;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 13px) 0, 100% 13px, 100% 100%, 13px 100%, 0 calc(100% - 13px));
  text-align: center;
  transition: transform 0.12s, background 0.15s;
}

.lock-button span,
.lock-button small {
  display: block;
}

.lock-button span {
  font-family: var(--display);
  font-size: 27px;
  font-weight: 900;
  line-height: 0.92;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.lock-button small {
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lock-button:hover:not(:disabled) {
  background: #ff6270;
  transform: translateY(-1px);
}

.lock-button:active:not(:disabled) {
  transform: translateY(1px);
}

.lock-button:disabled {
  background: #343a41;
  color: #8a949c;
  cursor: default;
}

.reroll-control {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  background: var(--panel);
}

.reroll-readout {
  min-width: 68px;
}

.match-label {
  display: block;
  font-size: 9px;
}

.reroll-dots {
  display: flex;
  gap: 6px;
  margin-top: 7px;
}

.reroll-dot {
  width: 10px;
  height: 10px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 70, 85, 0.08);
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.reroll-dot.spent {
  border-color: var(--quiet);
  background: transparent;
  box-shadow: none;
  transform: scale(0.92);
}

.new-match {
  align-self: center;
  white-space: nowrap;
}

.share-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}

.share-label {
  margin-right: auto;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.discord-link {
  border-color: transparent;
  color: #aebaf0;
}

.note {
  display: none;
  margin-top: 12px;
  padding: 11px 12px;
  border-left: 3px solid var(--accent);
  background: var(--panel);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.note.show {
  display: block;
}

.note.ok {
  border-left-color: var(--go);
}

.note b,
.note span,
.note code {
  display: block;
}

.note span {
  color: var(--muted);
}

.note code {
  margin-top: 9px;
  padding: 9px;
  background: var(--panel-soft);
  font-family: var(--mono);
  font-size: 9px;
  white-space: pre-wrap;
}

.player-library {
  width: min(760px, calc(100% - 28px));
  max-height: min(88dvh, 840px);
  padding: 0;
  border: 1px solid var(--rule-hard);
  background: var(--panel-raised);
  color: var(--ink);
  box-shadow: 0 28px 100px rgba(0, 0, 0, 0.7);
  overflow: auto;
}

.player-library::backdrop {
  background: rgba(3, 4, 6, 0.78);
  backdrop-filter: blur(5px);
}

.library-head {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--rule);
  background: rgba(24, 29, 35, 0.97);
}

.library-head h2 {
  font-size: 34px;
}

.dialog-close {
  width: 40px;
  padding: 0;
  border-color: var(--rule);
  color: transparent;
  font-size: 0;
}

.dialog-close::before {
  color: var(--ink);
  content: "×";
  font-family: var(--body);
  font-size: 22px;
  font-weight: 400;
}

.library-intro {
  margin: 0;
  padding: 16px 22px 9px;
  color: var(--muted);
  font-size: 12px;
}

.library-list {
  display: grid;
  gap: 7px;
  padding: 5px 22px 18px;
}

.library-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--rule);
  background: var(--panel);
}

.library-monogram {
  width: 40px;
  height: 40px;
  font-size: 20px;
}

.library-identity,
.library-identity strong,
.library-identity span {
  display: block;
  min-width: 0;
}

.library-identity strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-identity span {
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.library-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.library-footer {
  justify-content: space-between;
  padding: 16px 22px 22px;
  border-top: 1px solid var(--rule);
}

.player-editor {
  padding: 20px 22px 24px;
}

.editor-heading h3 {
  font-size: 31px;
}

.editor-heading > p:last-child {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.editor-name {
  display: block;
  margin-top: 20px;
}

.editor-name input {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 6px;
  padding: 9px 11px;
  border: 1px solid var(--rule-hard);
  background: var(--panel-soft);
  color: var(--ink);
  font-size: 16px;
}

.editor-name input[aria-invalid="true"] {
  border-color: var(--accent);
}

.selector-head {
  align-items: end;
  margin-top: 20px;
}

.agent-count {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.agent-selector {
  max-height: 44dvh;
  padding: 13px;
  border: 1px solid var(--rule);
  background: var(--panel-soft);
  overflow: auto;
}

.editor-actions {
  justify-content: flex-end;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}

footer {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  padding: 19px 0 34px;
  border-top: 1px solid var(--rule-hard);
  color: var(--quiet);
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.65;
}

footer p {
  margin: 0;
}

footer .feedback-link {
  grid-column: 1 / -1;
}

.feedback-link a {
  display: inline-block;
  padding: 10px 0;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 2px solid #ff7a86;
  outline-offset: 3px;
}

@keyframes card-reveal {
  from {
    opacity: 0.55;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scan-pulse {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

@media (min-width: 1100px) {
  .command-grid {
    grid-template-columns: var(--setup-column-width) 24px minmax(0, 1fr);
    gap: 0;
  }

  .column-resizer {
    position: relative;
    display: grid;
    align-self: stretch;
    place-items: center;
    cursor: col-resize;
    touch-action: none;
    user-select: none;
  }

  .column-resizer::before,
  .column-resizer::after {
    position: absolute;
    content: "";
  }

  .column-resizer::before {
    width: 1px;
    height: 100%;
    background: var(--rule);
  }

  .column-resizer::after {
    width: 3px;
    height: 46px;
    background: var(--rule-hard);
    transition: background 140ms ease, height 140ms ease;
  }

  .column-resizer:hover::after,
  .column-resizer:focus-visible::after {
    height: 58px;
    background: var(--accent);
  }

  .column-resizer:focus-visible {
    outline: none;
  }
}

@media (max-width: 1060px) {
  .command-grid {
    grid-template-columns: 1fr;
  }

  .result-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .reveal-card {
    min-height: 250px;
  }

  footer {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .button,
  .discord-link,
  .library-add,
  .icon-btn,
  .token,
  .text-button,
  .structure-range,
  .chip,
  .dialog-close {
    min-height: 44px;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 24px, 1480px);
  }

  .topbar {
    min-height: 74px;
  }

  .command-grid {
    gap: 12px;
    padding-top: 12px;
  }

  .setup-panel,
  .draft-panel {
    padding: 16px;
  }

  .section-heading h1,
  .draft-heading h2 {
    font-size: 38px;
  }

  .map-panel {
    grid-template-columns: 1fr;
  }

  .map-intel {
    border-top: 1px solid var(--rule);
    border-left: 0;
    padding-top: 10px;
    padding-left: 0;
  }

  .result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .reveal-card {
    min-height: 238px;
  }

  .agent-portrait {
    height: 135px;
  }

  .draft-actions {
    grid-template-columns: 1fr;
  }

  .reroll-control {
    grid-template-columns: auto 1fr;
  }

  .new-match {
    justify-self: start;
  }

  footer {
    grid-template-columns: 1fr;
    gap: 7px;
  }
}

@media (max-width: 470px) {
  .app-shell {
    width: min(100% - 20px, 1480px);
  }

  .brand-copy small {
    display: none;
  }

  .brand-mark {
    width: 42px;
    height: 38px;
  }

  .brand-mark svg {
    width: 34px;
    height: 27px;
  }

  .section-heading,
  .draft-heading {
    align-items: flex-start;
  }

  .section-status {
    font-size: 8px;
  }

  .squad-grid {
    grid-template-columns: 1fr;
  }

  .outside-copy {
    align-items: flex-start;
    flex-direction: column;
  }

  .outside-copy p {
    text-align: left;
  }

  .team-seat small {
    display: none;
  }

  .team-seat {
    min-height: 37px;
    display: grid;
    place-items: center;
  }

  .result-grid {
    grid-template-columns: 1fr;
  }

  .reveal-card {
    min-height: 246px;
  }

  .reveal-card--waiting {
    min-height: 112px;
  }

  .share-actions > .button,
  .share-actions > .discord-link {
    flex: 1 1 100%;
  }

  .share-label {
    flex: 1 1 100%;
  }

  .player-library {
    width: 100%;
    max-width: none;
    max-height: 92dvh;
    margin: auto 0 0;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
  }

  .library-head,
  .player-editor {
    padding-right: 16px;
    padding-left: 16px;
  }

  .library-intro {
    padding-right: 16px;
    padding-left: 16px;
  }

  .library-list {
    padding-right: 16px;
    padding-left: 16px;
  }

  .library-footer {
    align-items: stretch;
    flex-direction: column;
    padding-right: 16px;
    padding-left: 16px;
  }

  .library-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .library-card > .library-add,
  .library-controls {
    grid-column: 1 / -1;
  }

  .library-card > .library-add {
    width: 100%;
  }

  .library-controls {
    justify-content: flex-end;
  }

  .selector-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .agent-selector {
    max-height: 42dvh;
  }

  .editor-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}
