:root {
  color-scheme: dark;
  --bg: #0b0d11;
  --surface: #11151b;
  --surface-2: #171c24;
  --surface-3: #202733;
  --text: #f3f5f7;
  --muted: #9aa4b2;
  --line: #283140;
  --accent: #8ee3ff;
  --accent-strong: #38bdf8;
  --danger: #ff6b78;
  --shadow: 0 18px 60px rgba(0,0,0,.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: radial-gradient(circle at top, #141b24 0, var(--bg) 40%); color: var(--text); }
body { min-height: 100svh; }
button, input { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100svh; padding-bottom: 110px; }
.topbar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px clamp(16px, 3vw, 40px); border-bottom: 1px solid rgba(255,255,255,.06); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(16px); background: rgba(11,13,17,.78); }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; font-weight: 900; letter-spacing: -.04em; }
.brand strong, .brand small { display: block; }
.brand small { color: var(--accent); font-size: .68rem; letter-spacing: .12em; margin-top: 2px; }
.top-actions, .welcome-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.primary-button, .ghost-button, .icon-button { border-radius: 12px; border: 1px solid var(--line); padding: 10px 14px; color: var(--text); background: var(--surface-2); }
.primary-button { color: #03151c; background: var(--accent); border-color: transparent; font-weight: 800; }
.ghost-button:hover, .icon-button:hover { border-color: #445064; background: var(--surface-3); }
.primary-button:hover { background: #b9efff; }
.large { padding: 14px 18px; font-size: 1rem; }
.compact { padding: 8px 12px; }
.icon-button { width: 38px; height: 38px; padding: 0; font-size: 1.5rem; }
main { width: min(1500px, 100%); margin: 0 auto; padding: clamp(18px, 3vw, 42px); }
.welcome-card { min-height: calc(100svh - 170px); display: flex; flex-direction: column; justify-content: center; align-items: flex-start; max-width: 820px; }
.eyebrow, .section-label { color: var(--accent); font-weight: 800; letter-spacing: .12em; font-size: .72rem; }
.welcome-card h1 { font-size: clamp(3rem, 9vw, 7rem); line-height: .88; letter-spacing: -.06em; margin: 10px 0 24px; }
.lede { color: #c0c7d1; max-width: 680px; line-height: 1.65; font-size: clamp(1rem, 2vw, 1.22rem); }
.fine-print { color: var(--muted); font-size: .82rem; margin-top: 24px; }
.hidden { display: none !important; }
.workspace { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); min-height: calc(100svh - 170px); gap: 18px; }
.roster-panel, .detail-panel { border: 1px solid var(--line); background: rgba(17,21,27,.92); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; }
.roster-panel { display: flex; flex-direction: column; min-height: 680px; }
.detail-panel { min-height: 680px; }
.panel-heading, .detail-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 22px; border-bottom: 1px solid var(--line); }
.panel-heading h2, .detail-heading h2 { margin: 5px 0 0; font-size: 1.4rem; }
.roster-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px 0; }
.roster-tab { white-space: nowrap; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: transparent; padding: 7px 11px; }
.roster-tab.active { color: #06151a; background: var(--accent); border-color: transparent; }
.search-wrap { padding: 16px; border-bottom: 1px solid var(--line); }
.search-wrap span { display: block; color: var(--muted); font-size: .76rem; margin: 0 0 8px; }
.search-wrap input { width: 100%; background: #0d1117; color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; outline: none; }
.search-wrap input:focus { border-color: var(--accent-strong); box-shadow: 0 0 0 3px rgba(56,189,248,.12); }
.result-list { overflow: auto; padding: 8px; }
.result-item { width: 100%; text-align: left; background: transparent; color: var(--text); border: 1px solid transparent; border-radius: 12px; padding: 13px; }
.result-item:hover, .result-item.active { background: var(--surface-2); border-color: var(--line); }
.result-item small { display: block; color: var(--muted); margin-top: 5px; }
.empty-detail { min-height: 680px; display: grid; place-content: center; text-align: center; padding: 40px; }
.empty-detail h2 { margin: 16px 0 8px; }
.empty-detail p { margin: 0; color: var(--muted); }
.mic-orb { border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #d6f7ff, var(--accent-strong)); box-shadow: 0 18px 55px rgba(56,189,248,.2); color: #04212c; }
.mic-orb.small { width: 76px; height: 76px; margin: auto; font-size: 2rem; }
.detail-card { min-height: 100%; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(100px,1fr)); gap: 10px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.stat { border: 1px solid var(--line); background: var(--surface-2); border-radius: 14px; padding: 14px; }
.stat span { display: block; color: var(--muted); font-size: .72rem; }
.stat strong { display: block; font-size: 1.35rem; margin-top: 5px; }
.detail-sections { padding: 4px 22px 28px; }
.detail-section { padding: 18px 0; border-bottom: 1px solid var(--line); }
.detail-section:last-child { border-bottom: 0; }
.detail-section h3 { margin: 0 0 12px; font-size: 1rem; }
.profile-row { display: grid; grid-template-columns: minmax(140px,1.4fr) repeat(5,minmax(54px,.6fr)); gap: 8px; align-items: center; padding: 10px 0; color: #dce2e8; }
.profile-row span:not(:first-child) { text-align: center; }
.rule-text { color: #c5ccd5; line-height: 1.55; margin: 8px 0 0; }
.voice-dock { position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(720px, calc(100% - 28px)); display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 14px; padding: 12px 12px 12px 18px; background: rgba(17,21,27,.92); border: 1px solid #354052; border-radius: 22px; backdrop-filter: blur(18px); box-shadow: 0 20px 70px rgba(0,0,0,.4); z-index: 30; }
.voice-status strong, .voice-status span { display: block; }
.voice-status span { color: var(--muted); font-size: .78rem; margin-top: 3px; max-width: 230px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.talk-button { border: 0; border-radius: 16px; padding: 15px 20px; min-width: 190px; background: var(--accent); color: #03212b; font-weight: 900; letter-spacing: .04em; user-select: none; touch-action: none; }
.talk-button.listening { background: #ff7a88; color: #25050a; transform: scale(.98); }
.toast { position: fixed; top: 88px; left: 50%; transform: translate(-50%, -12px); padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: #171c24; opacity: 0; pointer-events: none; transition: .2s ease; z-index: 50; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

body.table-mode .workspace { grid-template-columns: minmax(320px, 430px) minmax(0, 1fr); }
body.table-mode .detail-heading h2 { font-size: clamp(2rem, 3vw, 4rem); }
body.table-mode .stat strong { font-size: 2rem; }
body.table-mode .profile-row { font-size: 1.08rem; }

@media (max-width: 760px) {
  .app-shell { padding-bottom: 122px; }
  .topbar { padding: 10px 12px; }
  .brand small { display: none; }
  .top-actions .ghost-button { display: none; }
  .top-actions .primary-button { padding: 9px 11px; }
  main { padding: 14px; }
  .welcome-card { min-height: calc(100svh - 140px); }
  .welcome-card h1 { font-size: clamp(3.5rem, 18vw, 5.5rem); }
  .workspace { display: block; min-height: auto; }
  .roster-panel { min-height: auto; max-height: 42svh; border-radius: 16px 16px 0 0; }
  .detail-panel { min-height: 42svh; border-radius: 0 0 16px 16px; border-top: 0; }
  .empty-detail { min-height: 42svh; }
  .panel-heading { padding: 15px; }
  .detail-heading { padding: 18px; }
  .search-wrap { padding: 12px; }
  .stat-grid { padding: 14px 16px; grid-template-columns: repeat(3,1fr); }
  .detail-sections { padding: 0 16px 22px; overflow-x: auto; }
  .profile-row { min-width: 610px; }
  .voice-dock { grid-template-columns: 1fr; padding: 9px; }
  .voice-status { display: none; }
  .talk-button { width: 100%; min-width: 0; font-size: .95rem; padding: 18px; }
}


/* Datacard readability refresh */
.detail-card {
  min-height: 100%;
  max-width: 1180px;
  margin: 0 auto;
}

.detail-heading {
  padding: 26px 28px;
}

.detail-heading h2 {
  font-size: clamp(1.8rem, 2.4vw, 3rem);
  line-height: 1.05;
  letter-spacing: -.025em;
}

.stat-grid {
  gap: 12px;
  padding: 20px 28px 22px;
}

.stat {
  min-width: 0;
  padding: 16px 18px;
  border-radius: 16px;
  background: #141b24;
  border-color: #2a3546;
}

.stat span {
  font-size: .72rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: #9fb0c4;
}

.stat strong {
  font-size: 1.65rem;
  line-height: 1.05;
  margin-top: 8px;
}

.detail-sections {
  padding: 0 28px 34px;
}

.detail-section {
  padding: 26px 0;
}

.section-heading-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.section-heading-row h3 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: -.01em;
}

.section-count {
  display: inline-grid;
  place-items: center;
  min-width: 25px;
  height: 25px;
  padding: 0 8px;
  border-radius: 999px;
  background: #1c2633;
  border: 1px solid #2c394b;
  color: #9fb0c4;
  font-size: .72rem;
  font-weight: 800;
}

.weapon-table-wrap {
  overflow-x: auto;
  border: 1px solid #293444;
  border-radius: 16px;
  background: #111720;
}

.weapon-table {
  width: 100%;
  min-width: 830px;
  border-collapse: separate;
  border-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.weapon-table th,
.weapon-table td {
  padding: 13px 14px;
  text-align: center;
  border-bottom: 1px solid #25303f;
}

.weapon-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #17202b;
  color: #9fb0c4;
  font-size: .7rem;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 800;
}

.weapon-table th:first-child,
.weapon-table td:first-child {
  text-align: left;
}

.weapon-table tbody tr:last-child td {
  border-bottom: 0;
}

.weapon-table tbody tr:nth-child(even) td {
  background: rgba(255,255,255,.018);
}

.weapon-table tbody tr:hover td {
  background: rgba(142,227,255,.045);
}

.weapon-name-column {
  min-width: 230px;
}

.weapon-name {
  min-width: 230px;
}

.weapon-name strong {
  display: block;
  color: #f4f7fa;
  font-size: .98rem;
  line-height: 1.25;
}

.weapon-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.weapon-quantity {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 24px;
  padding: 0 7px;
  border: 1px solid #3a7187;
  border-radius: 999px;
  background: rgba(56,189,248,.08);
  color: var(--accent);
  font-size: .72rem;
  font-weight: 900;
}

.weapon-name small {
  display: block;
  color: #75869a;
  font-size: .68rem;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: .07em;
}

.weapon-table td {
  color: #e2e8ef;
  font-size: .95rem;
}

.weapon-keywords {
  min-width: 180px;
  max-width: 270px;
  color: #b8c6d6 !important;
  text-align: left !important;
  line-height: 1.45;
}

.ability-list {
  display: grid;
  gap: 12px;
  max-width: 980px;
}

.ability-card {
  padding: 17px 19px 18px;
  border: 1px solid #293444;
  border-radius: 15px;
  background: #131a23;
}

.ability-card h4 {
  margin: 0 0 8px;
  color: #f3f6f9;
  font-size: 1rem;
  line-height: 1.25;
  letter-spacing: -.01em;
}

.ability-text {
  color: #c7d1dc;
  font-size: .94rem;
  line-height: 1.65;
  max-width: 900px;
}

.ability-text p {
  margin: 0 0 10px;
}

.ability-text p:last-child {
  margin-bottom: 0;
}

.ability-text ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.ability-text li + li {
  margin-top: 6px;
}

.empty-section {
  color: var(--muted);
  border: 1px dashed #2b3645;
  border-radius: 14px;
  padding: 18px;
}

@media (max-width: 760px) {
  .detail-heading {
    padding: 16px 14px;
    gap: 12px;
    align-items: flex-start;
  }

  .detail-heading h2 {
    font-size: 1.55rem;
    line-height: 1.08;
  }

  .detail-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding: 10px 12px 14px;
  }

  .stat {
    padding: 9px 5px;
    border-radius: 11px;
    text-align: center;
  }

  .stat span {
    font-size: .58rem;
    letter-spacing: .035em;
    line-height: 1.2;
    overflow-wrap: anywhere;
  }

  .stat strong {
    font-size: 1.18rem;
    margin-top: 5px;
  }

  .detail-sections {
    padding: 0 12px 22px;
    overflow: visible;
  }

  .detail-section {
    padding: 18px 0;
  }

  .section-heading-row {
    margin-bottom: 10px;
  }

  .section-heading-row h3 {
    font-size: 1.08rem;
  }

  .weapon-table-wrap {
    overflow: visible;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .weapon-table {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .weapon-table thead {
    display: none;
  }

  .weapon-table tbody {
    display: grid;
    gap: 10px;
  }

  .weapon-table .weapon-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border: 1px solid #293444;
    border-radius: 14px;
    overflow: hidden;
    background: #111720;
    padding: 11px;
  }

  .weapon-table .weapon-row td {
    min-width: 0;
    max-width: none;
    border: 0;
    background: transparent !important;
    padding: 7px 6px;
    text-align: left;
    font-size: .88rem;
  }

  .weapon-table .weapon-name {
    grid-column: 1 / -1;
    min-width: 0;
    padding: 0 0 10px;
    margin-bottom: 3px;
    border-bottom: 1px solid #25303f;
  }

  .weapon-title-line {
    gap: 7px;
  }

  .weapon-name strong {
    font-size: .96rem;
    line-height: 1.25;
  }

  .weapon-quantity {
    min-width: 28px;
    height: 22px;
    padding: 0 6px;
    font-size: .68rem;
  }

  .weapon-table .weapon-row td:not(.weapon-name)::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    color: #7f8da0;
    font-size: .58rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
  }

  .weapon-table .weapon-keywords {
    grid-column: 1 / -1;
    min-width: 0;
    max-width: none;
    padding-top: 9px;
    border-top: 1px solid #25303f;
    color: #b8c6d6 !important;
    line-height: 1.4;
  }

  .ability-list {
    gap: 10px;
  }

  .ability-card {
    padding: 14px;
  }

  .ability-text {
    font-size: .9rem;
    line-height: 1.55;
  }
}


.compact-rule {
  display: grid;
  grid-template-columns: minmax(170px, 260px) minmax(0, 1fr);
  align-items: start;
  gap: 18px;
  padding: 15px 17px;
}

.compact-rule h4 {
  margin: 0;
}

.ability-summary {
  margin: 0;
  color: #cbd5df;
  line-height: 1.5;
  font-size: .94rem;
}

@media (max-width: 760px) {
  .compact-rule {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}


/* Gameplay tools */
.detail-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ghost-button.active {
  border-color: var(--accent-strong);
  background: rgba(56,189,248,.12);
  color: var(--accent);
}

.quick-lists {
  padding: 10px 14px 4px;
  display: grid;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

.quick-lists:empty {
  display: none;
}

.quick-group {
  min-width: 0;
}

.quick-label {
  display: block;
  margin-bottom: 6px;
  color: #8290a2;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.quick-chips {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.quick-chip {
  flex: 0 0 auto;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid #2a3546;
  background: #131a23;
  color: #dce5ee;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: .77rem;
}

.quick-chip:hover {
  border-color: var(--accent-strong);
  color: var(--accent);
}

body.focus-mode .roster-panel,
body.focus-mode .topbar {
  display: none;
}

body.focus-mode main {
  width: min(1500px, 100%);
  padding-top: 18px;
}

body.focus-mode .workspace {
  display: block;
}

body.focus-mode .detail-panel {
  max-width: 1180px;
  margin: 0 auto;
}

@media (max-width: 760px) {
  .quick-lists {
    padding: 8px 12px 2px;
  }

  .quick-chip {
    max-width: 160px;
  }

  .detail-actions {
    gap: 6px;
  }

  .detail-actions .ghost-button {
    padding: 8px 10px;
  }

  .wound-controls {
    gap: 8px;
  }

  .wound-button {
    width: 44px;
    height: 44px;
  }

  .wound-value {
    min-width: 92px;
  }
}


/* First-run beta onboarding */
.first-run-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4,7,11,.82);
  backdrop-filter: blur(14px);
}

.first-run-card {
  width: min(760px, 100%);
  border: 1px solid #314055;
  border-radius: 24px;
  background: #111720;
  box-shadow: 0 30px 100px rgba(0,0,0,.5);
  padding: clamp(22px, 4vw, 36px);
}

.first-run-card h2 {
  margin: 8px 0 12px;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  line-height: 1.05;
  letter-spacing: -.025em;
}

.first-run-intro,
.first-run-note {
  color: #b8c4d2;
  line-height: 1.6;
}

.first-run-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 24px 0 18px;
}

.first-run-option {
  text-align: left;
  min-height: 170px;
  border: 1px solid #2f3c4f;
  border-radius: 18px;
  background: #151d28;
  color: var(--text);
  padding: 20px;
}

.first-run-option:hover {
  border-color: var(--accent-strong);
  background: #192432;
}

.first-run-option.primary-choice {
  border-color: #3c7e97;
  background: rgba(56,189,248,.08);
}

.first-run-option strong {
  display: block;
  margin-bottom: 10px;
  font-size: 1.08rem;
}

.first-run-option span {
  display: block;
  color: #aebac8;
  line-height: 1.55;
  font-size: .92rem;
}

.first-run-note {
  margin: 0;
  font-size: .82rem;
  color: #8493a5;
}

@media (max-width: 680px) {
  .first-run-modal {
    align-items: end;
    padding: 10px;
  }

  .first-run-card {
    border-radius: 22px 22px 14px 14px;
    padding: 22px 18px 18px;
  }

  .first-run-options {
    grid-template-columns: 1fr;
  }

  .first-run-option {
    min-height: 0;
  }
}


/* Active army search selector */
.active-armies-wrap {
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(9,13,18,.35);
}

.active-armies-heading {
  margin-bottom: 9px;
}

.active-armies-heading span {
  display: block;
  color: var(--accent);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .1em;
}

.active-armies-heading small {
  display: block;
  color: #7f8da0;
  font-size: .72rem;
  margin-top: 3px;
}

.active-army-selector {
  display: grid;
  gap: 7px;
}

.active-army-toggle {
  width: 100%;
  display: grid;
  grid-template-columns: 28px minmax(0,1fr);
  gap: 9px;
  align-items: center;
  text-align: left;
  border: 1px solid #2a3546;
  background: #121922;
  color: #dce5ee;
  border-radius: 12px;
  padding: 9px 10px;
}

.active-army-toggle:hover {
  border-color: #3b4b61;
}

.active-army-toggle.active {
  border-color: #3a7187;
  background: rgba(56,189,248,.07);
}

.active-army-toggle.current {
  box-shadow: inset 3px 0 0 var(--accent);
}

.active-army-check {
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  border: 1px solid #3a475a;
  border-radius: 7px;
  color: #03151c;
  background: #0e141c;
  font-size: .8rem;
  font-weight: 900;
}

.active-army-toggle.active .active-army-check {
  background: var(--accent);
  border-color: var(--accent);
}

.active-army-copy {
  min-width: 0;
}

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

.active-army-copy strong {
  font-size: .84rem;
}

.active-army-copy small {
  margin-top: 2px;
  color: #7f8da0;
  font-size: .68rem;
}

.result-roster {
  color: var(--accent);
}

@media (max-width: 760px) {
  .active-armies-wrap {
    padding: 10px 12px 8px;
  }

  .active-army-selector {
    display: flex;
    overflow-x: auto;
    gap: 8px;
  }

  .active-army-toggle {
    min-width: 190px;
    width: auto;
    flex: 0 0 auto;
  }
}


/* Match tracker */
.match-tools {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(10,14,20,.5);
}

.match-tool {
  min-width: 0;
}

.match-tool > span {
  display: block;
  margin-bottom: 5px;
  color: #7f8da0;
  font-size: .64rem;
  font-weight: 800;
  letter-spacing: .08em;
}

.stepper {
  display: grid;
  grid-template-columns: 30px minmax(34px,1fr) 30px;
  align-items: center;
  border: 1px solid #2b3748;
  border-radius: 10px;
  overflow: hidden;
  background: #121922;
}

.stepper button {
  height: 32px;
  border: 0;
  background: #18212c;
  color: #dbe6ef;
  font-size: 1rem;
}

.stepper strong {
  text-align: center;
  font-size: .9rem;
}

.turn-toggle {
  align-self: end;
  min-height: 34px;
  border: 1px solid #35778e;
  background: rgba(56,189,248,.10);
  color: var(--accent);
  border-radius: 10px;
  padding: 0 10px;
  font-size: .76rem;
  font-weight: 800;
}

.turn-toggle.opponent {
  border-color: #704552;
  background: rgba(255,107,120,.08);
  color: #ff9eaa;
}

.ghost-button.danger-active {
  border-color: #8a3f4c;
  background: rgba(255,107,120,.10);
  color: #ff9eaa;
}

.result-item.destroyed {
  opacity: .48;
}

.result-item.destroyed strong {
  text-decoration: line-through;
}

@media (max-width: 760px) {
  .match-tools {
    grid-template-columns: 1fr 1fr;
  }

  .turn-toggle {
    grid-column: 1 / -1;
    min-height: 36px;
  }
}


/* Phase filters and unit statuses */
.status-tags,
.phase-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-tag,
.phase-button {
  border: 1px solid #2d394a;
  background: #121922;
  color: #aeb9c6;
  border-radius: 999px;
  padding: 8px 11px;
  font-size: .78rem;
}

.status-tag.active,
.phase-button.active {
  border-color: var(--accent-strong);
  background: rgba(56,189,248,.11);
  color: var(--accent);
}

.phase-button span {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-left: 3px;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  font-size: .65rem;
}

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

  .status-tags,
  .phase-filter {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 3px;
  }

  .status-tag,
  .phase-button {
    flex: 0 0 auto;
  }
}


/* Voice recognition shortlist */
.voice-shortlist-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3,6,10,.82);
  backdrop-filter: blur(14px);
}

.voice-shortlist-card {
  width: min(720px, 100%);
  max-height: min(760px, calc(100svh - 40px));
  overflow: auto;
  border: 1px solid #34455a;
  border-radius: 24px;
  background: #101720;
  box-shadow: 0 30px 100px rgba(0,0,0,.55);
  padding: 24px;
}

.voice-shortlist-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.voice-shortlist-heading h2 {
  margin: 6px 0 8px;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  letter-spacing: -.025em;
}

.voice-heard {
  margin: 0;
  color: #9fb0c4;
  font-size: .94rem;
}

.voice-shortlist-results {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.voice-shortlist-item {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 8px;
}

.voice-choice {
  display: grid;
  grid-template-columns: 34px minmax(0,1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  text-align: left;
  border: 1px solid #2c394b;
  border-radius: 15px;
  background: #141c26;
  color: var(--text);
  padding: 13px 14px;
}

.voice-choice:hover,
.voice-choice:focus {
  outline: none;
  border-color: var(--accent-strong);
  background: #182431;
}

.voice-rank {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #1d2a38;
  color: var(--accent);
  font-size: .78rem;
  font-weight: 900;
}

.voice-choice-copy {
  min-width: 0;
}

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

.voice-choice-copy small {
  margin-top: 3px;
  color: #8190a2;
  font-size: .72rem;
}

.voice-match-score {
  color: #8190a2;
  font-size: .72rem;
  font-variant-numeric: tabular-nums;
}

.voice-teach {
  border: 1px solid #365063;
  border-radius: 12px;
  background: rgba(56,189,248,.07);
  color: var(--accent);
  padding: 0 12px;
  font-size: .75rem;
  font-weight: 800;
}

.voice-teach:hover {
  background: rgba(56,189,248,.13);
}

.voice-shortlist-help {
  margin: 18px 0 0;
  color: #7f8da0;
  font-size: .78rem;
  line-height: 1.55;
}

@media (max-width: 680px) {
  .voice-shortlist-modal {
    align-items: end;
    padding: 10px;
  }

  .voice-shortlist-card {
    max-height: 86svh;
    border-radius: 22px 22px 14px 14px;
    padding: 18px 14px 14px;
  }

  .voice-choice {
    grid-template-columns: 30px minmax(0,1fr);
  }

  .voice-match-score {
    grid-column: 2;
  }

  .voice-shortlist-item {
    grid-template-columns: minmax(0,1fr) 64px;
  }
}


/* Army picker */
.army-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 115;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3,6,10,.82);
  backdrop-filter: blur(14px);
}

.army-picker-card {
  width: min(680px,100%);
  max-height: min(760px,calc(100svh - 40px));
  overflow: auto;
  border: 1px solid #34455a;
  border-radius: 24px;
  background: #101720;
  box-shadow: 0 30px 100px rgba(0,0,0,.55);
  padding: 24px;
}

.army-picker-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.army-picker-heading h2 {
  margin: 6px 0 8px;
  font-size: clamp(1.5rem,4vw,2.2rem);
  letter-spacing: -.025em;
}

.army-picker-heading p:last-child {
  margin: 0;
  color: #9fb0c4;
  line-height: 1.5;
}

.army-picker-actions {
  display: flex;
  gap: 8px;
  margin: 18px 0 14px;
}

.army-picker-list {
  display: grid;
  gap: 9px;
}

.army-picker-row {
  display: grid;
  grid-template-columns: 26px 34px minmax(0,1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid #2c394b;
  border-radius: 15px;
  background: #141c26;
  padding: 13px 14px;
  cursor: pointer;
}

.army-picker-row:hover {
  border-color: #3d5168;
}

.army-picker-row.active {
  border-color: var(--accent-strong);
  background: rgba(56,189,248,.07);
}

.army-picker-row.current {
  box-shadow: inset 3px 0 0 var(--accent);
}

.army-picker-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.army-picker-box {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid #3a475a;
  border-radius: 8px;
  background: #0e141c;
  color: #03151c;
  font-weight: 900;
}

.army-picker-row.active .army-picker-box {
  background: var(--accent);
  border-color: var(--accent);
}

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

.army-picker-copy small {
  margin-top: 3px;
  color: #8190a2;
}

.army-picker-empty {
  color: #8190a2;
}

@media (max-width:680px) {
  .army-picker-modal {
    align-items: end;
    padding: 10px;
  }

  .army-picker-card {
    max-height: 86svh;
    border-radius: 22px 22px 14px 14px;
    padding: 18px 14px 14px;
  }
}


/* Army selector clarity refresh */
.active-armies-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.active-armies-heading > div {
  min-width: 0;
}

.active-armies-heading .ghost-button {
  flex: 0 0 auto;
}

.active-army-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.active-army-chip,
.active-army-more,
.active-army-empty,
.active-army-empty-button {
  border-radius: 999px;
  font-size: .74rem;
}

.active-army-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid #3a7187;
  background: rgba(56,189,248,.08);
  color: #c8eef9;
}

.active-army-more,
.active-army-empty-button {
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid #334155;
  background: #121922;
  color: #aeb9c6;
}

.active-army-more:hover,
.active-army-empty-button:hover {
  border-color: var(--accent-strong);
  color: var(--accent);
}

.active-army-empty {
  color: #7f8da0;
}

.army-picker-row {
  grid-template-columns: 34px minmax(0,1fr);
}

@media (max-width:760px) {
  .active-armies-heading {
    align-items: flex-start;
  }

  .active-armies-heading .ghost-button {
    padding: 7px 9px;
    font-size: .72rem;
  }

  .active-army-selector {
    overflow: visible;
  }
}


/* Multi-mode game companion */
.app-nav {
  position: sticky;
  top: 0;
  z-index: 45;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  padding: 8px max(12px, calc((100vw - 1500px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(10,14,20,.94);
  backdrop-filter: blur(14px);
}

.app-nav-button {
  min-width: 0;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: #8f9dae;
  font-size: .8rem;
  font-weight: 800;
}

.app-nav-button:hover {
  background: #141c26;
  color: #dce5ee;
}

.app-nav-button.active {
  border-color: #31596c;
  background: rgba(56,189,248,.09);
  color: var(--accent);
}

.nav-icon {
  font-size: 1rem;
  line-height: 1;
}

.nav-more {
  display: none;
  position: relative;
}

.nav-more-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(240px, calc(100vw - 24px));
  padding: 7px;
  border: 1px solid #34455a;
  border-radius: 14px;
  background: #101720;
  box-shadow: 0 18px 50px rgba(0,0,0,.45);
}

.nav-more-menu button {
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #dce5ee;
  padding: 12px;
  text-align: left;
  font-weight: 750;
}

.nav-more-menu button:hover,
.nav-more-menu button.active {
  background: rgba(56,189,248,.08);
  color: var(--accent);
}

.app-main {
  width: min(1500px, 100%);
  margin: 0 auto;
}

.app-page {
  min-height: calc(100svh - 210px);
}

.data-page,
.utility-page {
  padding: clamp(16px, 3vw, 34px);
}

.page-hero,
.page-heading {
  max-width: 980px;
}

.compact-hero {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  align-items: end;
  margin-bottom: 24px;
}

.compact-hero h1,
.page-heading h1 {
  margin: 5px 0 10px;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: .98;
  letter-spacing: -.035em;
}

.compact-hero .lede,
.page-heading p {
  color: #9eacbd;
  line-height: 1.55;
}

.data-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.data-grid,
.setup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 14px;
}

.tool-card,
.dice-card,
.match-state-card {
  border: 1px solid #293444;
  border-radius: 18px;
  background: #111720;
  padding: 20px;
}

.tool-card h2 {
  margin: 6px 0 4px;
}

.data-roster-summary {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.data-summary-row {
  padding: 11px 12px;
  border: 1px solid #273343;
  border-radius: 12px;
  background: #141b24;
}

.data-summary-row strong,
.data-summary-row small {
  display: block;
}

.data-summary-row small {
  margin-top: 3px;
  color: #8190a2;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 14px;
  margin-top: 20px;
}

.score-card {
  border: 1px solid #293444;
  border-radius: 20px;
  background: #111720;
  padding: 22px;
}

.score-card > span {
  color: #8fa0b3;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .1em;
}

.score-card > strong {
  display: block;
  margin: 12px 0 18px;
  font-size: clamp(3.2rem, 10vw, 6.5rem);
  line-height: .9;
}

.score-actions {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 7px;
}

.score-actions button,
.dice-presets button {
  min-height: 44px;
  border: 1px solid #304054;
  border-radius: 11px;
  background: #17202b;
  color: #e4ebf2;
  font-weight: 850;
}

.match-state-card {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 14px;
  margin-top: 14px;
  align-items: end;
}

.large-match-tool .stepper {
  min-height: 48px;
}

.large-match-tool .stepper button {
  height: 46px;
}

.score-turn-toggle {
  min-height: 48px;
  padding: 0 18px;
}

.dice-card {
  margin-top: 20px;
  max-width: 850px;
}

.dice-presets {
  display: grid;
  grid-template-columns: repeat(5,1fr);
  gap: 8px;
}

.dice-custom {
  display: grid;
  grid-template-columns: auto 100px 1fr;
  align-items: end;
  gap: 10px;
  margin-top: 14px;
}

.dice-custom label {
  align-self: center;
  color: #93a2b4;
  font-size: .78rem;
  font-weight: 800;
}

.dice-custom input,
.reference-search input {
  width: 100%;
  border: 1px solid #304054;
  border-radius: 12px;
  background: #0f151d;
  color: #f2f6fa;
  padding: 12px 13px;
  font: inherit;
}

.dice-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: baseline;
  margin: 20px 0 12px;
  color: #98a8ba;
}

.dice-summary strong {
  color: #f3f7fb;
  font-size: 1.5rem;
}

.dice-results {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.die-result {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid #34455a;
  border-radius: 11px;
  background: #151e29;
  color: #f4f7fa;
  font-size: 1.05rem;
  font-weight: 900;
}

.die-6 {
  border-color: #3a7187;
  color: var(--accent);
}

.die-1 {
  border-color: #6d3b47;
  color: #ff9eaa;
}

.core-rule-import-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px 12px;
  margin: 14px 0 16px;
}

.core-rule-import-row small {
  color: #8fa0b3;
  line-height: 1.45;
}

.reference-search {
  display: block;
  max-width: 760px;
  margin: 20px 0 14px;
}

.reference-search span {
  display: block;
  margin-bottom: 7px;
  color: #91a0b2;
  font-size: .76rem;
  font-weight: 800;
}

.reference-results {
  display: grid;
  gap: 10px;
  max-width: 1000px;
}

.reference-card {
  border: 1px solid #293444;
  border-radius: 15px;
  background: #111720;
  padding: 16px 18px;
}

.reference-card-heading {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.reference-card-heading h3 {
  margin: 0;
  font-size: 1rem;
}

.reference-card-heading span {
  flex: 0 0 auto;
  border: 1px solid #304054;
  border-radius: 999px;
  color: #8fa0b3;
  padding: 4px 8px;
  font-size: .66rem;
}

.reference-card-text {
  margin-top: 9px;
  color: #c4ced9;
  line-height: 1.55;
  font-size: .9rem;
}

.reference-card-text p {
  margin: 0 0 8px;
}

.reference-card-text p:last-child {
  margin-bottom: 0;
}

.setup-step {
  position: relative;
  min-height: 130px;
  display: grid;
  grid-template-columns: 38px 1fr;
  grid-template-rows: auto auto;
  gap: 3px 10px;
  align-content: center;
  border: 1px solid #293444;
  border-radius: 17px;
  background: #111720;
  color: #edf3f8;
  padding: 18px;
  text-align: left;
}

.setup-step > span {
  grid-row: 1 / 3;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(56,189,248,.09);
  color: var(--accent);
  font-weight: 900;
}

.setup-step strong {
  align-self: end;
}

.setup-step small {
  color: #8493a5;
  line-height: 1.4;
}

.checklist-step input {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 20px;
  height: 20px;
}

.checklist-step:has(input:checked) {
  border-color: #3a7187;
  background: rgba(56,189,248,.05);
}

.reset-match-button {
  margin-top: 16px;
}

@media (max-width: 760px) {
  .topbar {
    min-height: 54px;
  }

  .app-nav {
    top: 0;
    grid-template-columns: repeat(5, minmax(0,1fr));
    gap: 3px;
    padding: 6px 8px;
  }

  .app-nav-button {
    min-height: 50px;
    flex-direction: column;
    gap: 3px;
    border-radius: 10px;
    font-size: .64rem;
  }

  .nav-icon {
    font-size: 1.05rem;
  }

  .app-nav .extra-nav {
    display: none;
  }

  .nav-more {
    display: block;
  }

  .nav-more > .app-nav-button {
    width: 100%;
  }

  .nav-more-menu {
    position: fixed;
    top: 116px;
    right: 8px;
  }

  .app-main {
    padding-bottom: 4px;
  }

  .app-page {
    min-height: calc(100svh - 220px);
  }

  .data-page,
  .utility-page {
    padding: 14px 12px 22px;
  }

  .compact-hero {
    display: block;
    margin-bottom: 14px;
  }

  .compact-hero h1,
  .page-heading h1 {
    font-size: 2rem;
    line-height: 1.02;
  }

  .compact-hero .lede,
  .page-heading p {
    font-size: .88rem;
  }

  .data-actions {
    display: grid;
    grid-template-columns: 1fr;
    margin-top: 14px;
  }

  .data-actions .large {
    width: 100%;
    min-height: 46px;
  }

  .data-grid,
  .setup-grid,
  .score-grid {
    grid-template-columns: 1fr;
  }

  .tool-card,
  .dice-card,
  .match-state-card {
    padding: 14px;
    border-radius: 15px;
  }

  .workspace {
    display: block;
    min-height: auto;
  }

  .roster-panel {
    max-height: 38svh;
    border-radius: 0;
  }

  .detail-panel {
    border-radius: 0;
  }

  .score-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .score-card {
    padding: 14px 10px;
    border-radius: 15px;
  }

  .score-card > strong {
    margin: 9px 0 13px;
    font-size: 3.6rem;
  }

  .score-actions {
    grid-template-columns: repeat(2,1fr);
    gap: 5px;
  }

  .score-actions button {
    min-height: 40px;
  }

  .match-state-card {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .score-turn-toggle {
    grid-column: 1 / -1;
  }

  .dice-presets {
    grid-template-columns: repeat(5,1fr);
    gap: 5px;
  }

  .dice-presets button {
    min-height: 40px;
  }

  .dice-custom {
    grid-template-columns: 70px 1fr;
  }

  .dice-custom label {
    display: none;
  }

  .dice-custom .primary-button {
    grid-column: 2;
  }

  .die-result {
    width: 38px;
    height: 38px;
    border-radius: 9px;
  }

  .reference-card {
    padding: 14px;
  }

  .reference-card-heading {
    align-items: flex-start;
  }

  .reference-card-heading h3 {
    font-size: .95rem;
  }

  .setup-step {
    min-height: 102px;
  }
}


/* === Companion UX refinement: Setup / Sheets / Score / Dice === */
.beta-notice-card .primary-button {
  width: 100%;
  margin-top: 18px;
}

.setup-hero {
  margin-bottom: 18px;
}

.setup-import-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.setup-import-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.setup-import-card > p {
  color: #94a3b5;
  line-height: 1.5;
  min-height: 46px;
  margin: 8px 0 16px;
}

.setup-main-action {
  width: 100%;
  min-height: 50px;
}

.full-data-army-section {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 14px 18px;
  align-items: center;
}

.full-data-army-section.hidden {
  display: none;
}

.army-section-copy h2 {
  margin: 5px 0 4px;
}

.army-section-copy small {
  color: #8796a8;
}

.choose-armies-button {
  min-width: 190px;
  min-height: 54px;
  padding: 0 24px;
  font-size: .98rem;
  font-weight: 900;
  box-shadow: 0 0 0 1px rgba(56,189,248,.18), 0 10px 30px rgba(0,0,0,.25);
}

.full-data-army-section .active-army-selector {
  grid-column: 1 / -1;
  margin-top: 2px;
}

.setup-footer-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

/* Datasheets are intentionally search-first */
.datasheet-page {
  padding: clamp(14px, 2.5vw, 26px);
}

.datasheet-search-top {
  width: min(900px, 100%);
  margin: 0 auto 12px;
}

.datasheet-main-search {
  display: block;
  margin: 0;
  padding: 0;
}

.datasheet-main-search span {
  display: block;
  margin-bottom: 7px;
  color: #8291a3;
  font-size: .72rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.datasheet-main-search input {
  width: 100%;
  min-height: 52px;
  border: 1px solid #324156;
  border-radius: 15px;
  background: #101720;
  color: #f4f7fa;
  padding: 0 16px;
  font: inherit;
  font-size: 1rem;
}

.datasheet-main-search input:focus {
  outline: none;
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(56,189,248,.08);
}

.datasheet-results-shell {
  width: min(900px, 100%);
  margin: 0 auto 14px;
  border: 1px solid #293444;
  border-radius: 14px;
  background: #101720;
  overflow: hidden;
}

.datasheet-result-list {
  max-height: 280px;
  overflow-y: auto;
}

.datasheet-detail-panel {
  width: min(1180px, 100%);
  margin: 0 auto;
  border: 0;
  background: transparent;
}

.datasheet-detail-panel .detail-card {
  border: 1px solid #293444;
  border-radius: 18px;
  overflow: hidden;
  background: #0f151d;
}

/* Scoring */
.score-turn-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  max-width: 680px;
  margin: 18px 0 14px;
}

.score-turn-tabs button {
  min-height: 44px;
  border: 1px solid #2d3a4b;
  border-radius: 11px;
  background: #131a23;
  color: #94a4b6;
  font-weight: 900;
}

.score-turn-tabs button.active {
  border-color: var(--accent-strong);
  background: rgba(56,189,248,.10);
  color: var(--accent);
}

.scoreboard-totals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 10px;
  max-width: 680px;
  margin-bottom: 14px;
}

.scoreboard-totals > div {
  border: 1px solid #293444;
  border-radius: 14px;
  background: #111720;
  padding: 13px 16px;
}

.scoreboard-totals span {
  display: block;
  color: #8291a3;
  font-size: .66rem;
  font-weight: 900;
  letter-spacing: .08em;
}

.scoreboard-totals strong {
  display: block;
  margin-top: 4px;
  font-size: 2rem;
}

.score-player-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 12px;
}

.score-player-card {
  border: 1px solid #293444;
  border-radius: 18px;
  background: #111720;
  padding: 16px;
}

.score-player-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.score-player-heading h2 {
  margin: 0;
  font-size: 1.15rem;
}

.score-player-heading span {
  color: var(--accent);
  font-size: .74rem;
  font-weight: 850;
}

.score-category {
  border-top: 1px solid #263241;
  padding: 13px 0 0;
  margin-top: 13px;
}

.score-category:first-of-type {
  margin-top: 0;
}

.score-category > div:first-child {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.score-category label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #8291a3;
  font-size: .68rem;
  font-weight: 800;
}

.score-category label input {
  width: 52px;
  border: 1px solid #304054;
  border-radius: 8px;
  background: #0d141c;
  color: #eef4f8;
  padding: 5px 6px;
  text-align: center;
}

.score-value-row {
  display: grid;
  grid-template-columns: 42px 42px minmax(54px,1fr) 42px 42px;
  gap: 6px;
  align-items: center;
}

.score-value-row button {
  min-height: 40px;
  border: 1px solid #304054;
  border-radius: 9px;
  background: #17202b;
  color: #eef4f8;
  font-weight: 900;
}

.score-value-row > strong {
  text-align: center;
  font-size: 1.75rem;
}

.score-category > small {
  display: block;
  margin-top: 7px;
  color: #8291a3;
  text-align: right;
}

.compact-match-state {
  grid-template-columns: minmax(160px, 250px) auto;
  justify-content: start;
  max-width: 520px;
}

/* Advanced dice */
.advanced-dice-custom {
  grid-template-columns: minmax(90px, 130px) minmax(110px, 160px) 1fr;
}

.advanced-dice-custom select {
  min-height: 44px;
  border: 1px solid #304054;
  border-radius: 12px;
  background: #0f151d;
  color: #f2f6fa;
  padding: 0 12px;
  font: inherit;
}

.dice-grouped-results {
  display: grid;
  grid-template-columns: repeat(6, minmax(0,1fr));
  gap: 8px;
}

.die-count-card {
  min-width: 0;
  display: grid;
  place-items: center;
  gap: 3px;
  border: 1px solid #34455a;
  border-radius: 12px;
  background: #141d27;
  padding: 10px 5px;
}

.die-count-card .die-face {
  font-size: 1.2rem;
  font-weight: 900;
}

.die-count-card strong {
  color: #9eacbd;
  font-size: .76rem;
}

.die-count-card.die-6 {
  border-color: #3a7187;
}

.die-count-card.die-1 {
  border-color: #6d3b47;
}

.dice-reroll-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.dice-order {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #263241;
}

/* Compact mobile datasheets: one-row profile + one-row weapons */
@media (max-width: 760px) {
  .setup-import-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .setup-import-card > p {
    min-height: 0;
    margin-bottom: 12px;
  }

  .full-data-army-section {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .choose-armies-button {
    width: 100%;
    min-width: 0;
    min-height: 52px;
  }

  .full-data-army-section .active-army-selector {
    grid-column: 1;
  }

  .datasheet-page {
    padding: 10px 8px 18px;
  }

  .datasheet-main-search input {
    min-height: 46px;
    border-radius: 12px;
  }

  .datasheet-results-shell {
    border-radius: 11px;
    margin-bottom: 8px;
  }

  .datasheet-result-list {
    max-height: 220px;
  }

  .datasheet-detail-panel .detail-card {
    border-radius: 12px;
  }

  .detail-heading {
    padding: 10px 9px 8px;
  }

  .detail-heading h2 {
    font-size: 1.2rem;
    line-height: 1.05;
  }

  .detail-actions .ghost-button {
    padding: 6px 8px;
    font-size: .68rem;
  }

  .stat-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0,1fr)) !important;
    gap: 2px !important;
    padding: 5px 8px 7px !important;
  }

  .stat {
    min-width: 0;
    padding: 5px 1px !important;
    border-radius: 7px !important;
    text-align: center;
  }

  .stat span {
    font-size: .46rem !important;
    line-height: 1 !important;
    letter-spacing: 0 !important;
    white-space: nowrap;
  }

  .stat strong {
    font-size: .88rem !important;
    line-height: 1 !important;
    margin-top: 4px !important;
    white-space: nowrap;
  }

  .detail-sections {
    padding: 0 8px 16px !important;
  }

  .detail-section {
    padding: 12px 0 !important;
  }

  .section-heading-row {
    margin-bottom: 6px !important;
  }

  .section-heading-row h3 {
    font-size: .96rem !important;
  }

  .section-count {
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    font-size: .58rem;
  }

  .weapon-table-wrap {
    overflow: visible !important;
    margin: 0 !important;
    border: 1px solid #293444 !important;
    border-radius: 9px !important;
    background: #111720 !important;
  }

  .weapon-table {
    display: table !important;
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed;
    border-collapse: collapse;
  }

  .weapon-table thead {
    display: table-header-group !important;
  }

  .weapon-table tbody {
    display: table-row-group !important;
  }

  .weapon-table .weapon-row {
    display: table-row !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
  }

  .weapon-table th,
  .weapon-table .weapon-row td {
    display: table-cell !important;
    min-width: 0 !important;
    max-width: none !important;
    padding: 4px 2px !important;
    border-bottom: 1px solid #25303f !important;
    background: transparent !important;
    text-align: center !important;
    vertical-align: middle;
    font-size: .60rem !important;
    line-height: 1.12;
    overflow-wrap: anywhere;
  }

  .weapon-table th {
    position: static !important;
    color: #7f8da0;
    font-size: .46rem !important;
    letter-spacing: 0 !important;
    white-space: nowrap;
    background: #17202b !important;
  }

  .weapon-table th:nth-child(1),
  .weapon-table td:nth-child(1) { width: 27%; text-align: left !important; }
  .weapon-table th:nth-child(2),
  .weapon-table td:nth-child(2) { width: 9%; }
  .weapon-table th:nth-child(3),
  .weapon-table td:nth-child(3) { width: 6%; }
  .weapon-table th:nth-child(4),
  .weapon-table td:nth-child(4) { width: 9%; }
  .weapon-table th:nth-child(5),
  .weapon-table td:nth-child(5) { width: 6%; }
  .weapon-table th:nth-child(6),
  .weapon-table td:nth-child(6) { width: 8%; }
  .weapon-table th:nth-child(7),
  .weapon-table td:nth-child(7) { width: 7%; }
  .weapon-table th:nth-child(8),
  .weapon-table td:nth-child(8) { width: 28%; }

  .weapon-table .weapon-name {
    grid-column: auto !important;
    margin: 0 !important;
    border-bottom: 1px solid #25303f !important;
  }

  .weapon-title-line {
    gap: 3px !important;
    align-items: center;
  }

  .weapon-name strong {
    font-size: .62rem !important;
    line-height: 1.08 !important;
  }

  .weapon-quantity {
    min-width: 18px !important;
    height: 17px !important;
    padding: 0 3px !important;
    font-size: .48rem !important;
  }

  .weapon-table .weapon-row td:not(.weapon-name)::before {
    display: none !important;
    content: none !important;
  }

  .weapon-table .weapon-keywords {
    grid-column: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    padding: 4px 2px !important;
    border-top: 0 !important;
    color: #aebdca !important;
    text-align: left !important;
    font-size: .53rem !important;
    line-height: 1.12 !important;
  }

  .score-turn-tabs {
    gap: 4px;
    margin-top: 12px;
  }

  .score-turn-tabs button {
    min-height: 40px;
    border-radius: 9px;
  }

  .scoreboard-totals {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .scoreboard-totals > div {
    padding: 10px 12px;
  }

  .scoreboard-totals strong {
    font-size: 1.65rem;
  }

  .score-player-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .score-player-card {
    padding: 12px;
    border-radius: 14px;
  }

  .score-category {
    padding-top: 10px;
    margin-top: 10px;
  }

  .score-value-row {
    grid-template-columns: 38px 38px minmax(48px,1fr) 38px 38px;
    gap: 4px;
  }

  .score-value-row button {
    min-height: 36px;
  }

  .compact-match-state {
    grid-template-columns: 1fr auto !important;
    padding: 10px !important;
  }

  .dice-card {
    padding: 12px !important;
  }

  .advanced-dice-custom {
    grid-template-columns: 1fr 1fr;
    gap: 7px;
  }

  .advanced-dice-custom .primary-button {
    grid-column: 1 / -1 !important;
    min-height: 42px;
  }

  .dice-grouped-results {
    grid-template-columns: repeat(6, minmax(0,1fr));
    gap: 4px;
  }

  .die-count-card {
    padding: 7px 2px;
    border-radius: 9px;
  }

  .die-count-card .die-face {
    font-size: 1rem;
  }

  .die-count-card strong {
    font-size: .62rem;
  }

  .dice-reroll-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .dice-reroll-actions #toggleDiceOrderButton {
    grid-column: 1 / -1;
  }

  .dice-order .die-result {
    width: 32px;
    height: 32px;
    font-size: .85rem;
  }
}


@media (max-width: 760px) {
  .stat-grid {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: stretch;
  }

  .stat-grid .stat {
    flex: 1 1 0;
  }
}


/* Roster browser + anchored voice search */
.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;
}

.roster-browser {
  width: min(1180px, 100%);
  margin: 0 auto 14px;
}

.roster-browser-heading {
  padding: 8px 2px 4px;
}

.roster-browser-heading h1 {
  margin: 3px 0 10px;
  font-size: clamp(1.6rem, 4vw, 2.5rem);
  letter-spacing: -.035em;
}

.roster-mini-tabs {
  padding: 0 0 12px;
  gap: 7px;
  scrollbar-width: none;
}

.roster-mini-tabs::-webkit-scrollbar {
  display: none;
}

.roster-mini-tabs .roster-tab {
  display: inline-grid;
  gap: 2px;
  min-width: max-content;
  padding: 8px 12px;
  text-align: left;
}

.roster-mini-tabs .roster-tab strong {
  font-size: .8rem;
}

.roster-mini-tabs .roster-tab small {
  font-size: .62rem;
  opacity: .75;
}

.roster-unit-groups {
  display: grid;
  gap: 12px;
}

.roster-unit-group {
  border: 1px solid #293444;
  border-radius: 15px;
  background: #101720;
  padding: 12px;
}

.roster-unit-group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.roster-unit-group-heading h3 {
  margin: 0;
  font-size: .85rem;
  letter-spacing: .01em;
}

.roster-unit-group-heading span {
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  border: 1px solid #304054;
  border-radius: 999px;
  color: #8fa0b3;
  font-size: .64rem;
  font-weight: 850;
}

.roster-unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 6px;
}

.roster-unit-button {
  min-width: 0;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid #263343;
  border-radius: 10px;
  background: #141c26;
  color: #edf3f8;
  padding: 9px 10px;
  text-align: left;
}

.roster-unit-button:hover {
  border-color: #3a7187;
  background: rgba(56,189,248,.05);
}

.roster-unit-button strong {
  min-width: 0;
  font-size: .82rem;
  line-height: 1.2;
}

.roster-unit-button small {
  flex: 0 0 auto;
  color: #8190a2;
  font-size: .64rem;
}

.back-to-roster {
  flex: 0 0 auto;
  align-self: center;
}

.detail-title-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.voice-dock {
  display: block;
  padding: 9px;
}

.voice-dock-search {
  display: block;
  width: 100%;
  margin: 0 0 7px;
}

.voice-dock-search input {
  width: 100%;
  min-height: 42px;
  border: 1px solid #34465a;
  border-radius: 12px;
  background: #0d141c;
  color: #f2f6fa;
  padding: 0 12px;
  outline: none;
  font: inherit;
  font-size: .9rem;
}

.voice-dock-search input:focus {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(56,189,248,.08);
}

.voice-dock-row {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
  gap: 10px;
}

.voice-example {
  margin: 9px 0 0 !important;
  color: #74cfee !important;
  font-size: .78rem !important;
  line-height: 1.4 !important;
}

.score-cap {
  color: #8fa0b3;
  font-size: .66rem;
  font-weight: 800;
  white-space: nowrap;
}

/* Slightly larger mobile datasheet type while keeping the one-row layout */
@media (max-width: 760px) {
  .app-shell {
    padding-bottom: 168px;
  }

  .roster-browser {
    margin-bottom: 8px;
  }

  .roster-browser-heading {
    padding: 3px 2px 1px;
  }

  .roster-browser-heading h1 {
    margin-bottom: 7px;
    font-size: 1.55rem;
  }

  .roster-mini-tabs {
    padding-bottom: 8px;
  }

  .roster-mini-tabs .roster-tab {
    padding: 7px 10px;
  }

  .roster-unit-groups {
    gap: 8px;
  }

  .roster-unit-group {
    padding: 9px;
    border-radius: 12px;
  }

  .roster-unit-group-heading {
    margin-bottom: 6px;
  }

  .roster-unit-grid {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .roster-unit-button {
    min-height: 43px;
    padding: 7px 9px;
    border-radius: 9px;
  }

  .roster-unit-button strong {
    font-size: .86rem;
  }

  .voice-dock {
    width: calc(100% - 14px);
    bottom: max(7px, env(safe-area-inset-bottom));
    border-radius: 17px;
    padding: 7px;
  }

  .voice-dock-search {
    margin-bottom: 6px;
  }

  .voice-dock-search input {
    min-height: 39px;
    border-radius: 10px;
    font-size: .86rem;
  }

  .voice-dock-row {
    gap: 7px;
  }

  .voice-status {
    min-width: 0;
  }

  .voice-status strong {
    font-size: .72rem;
  }

  .voice-status span {
    max-width: none;
    font-size: .67rem;
  }

  .talk-button {
    min-width: 142px;
    padding: 12px 13px;
    border-radius: 12px;
    font-size: .72rem;
  }

  .detail-heading {
    gap: 6px;
  }

  .back-to-roster {
    padding: 6px 7px !important;
  }

  .detail-heading h2 {
    font-size: 1.27rem !important;
  }

  .stat span {
    font-size: .50rem !important;
  }

  .stat strong {
    font-size: .98rem !important;
  }

  .weapon-table th,
  .weapon-table .weapon-row td {
    font-size: .65rem !important;
  }

  .weapon-table th {
    font-size: .49rem !important;
  }

  .weapon-name strong {
    font-size: .68rem !important;
  }

  .weapon-table .weapon-keywords {
    font-size: .58rem !important;
  }

  .weapon-quantity {
    font-size: .52rem !important;
  }

  .score-cap {
    font-size: .62rem;
  }
}


.roster-refresh-note {
  border: 1px solid #5a4b2a;
  border-radius: 11px;
  background: rgba(197,151,48,.06);
  color: #d4bd83;
  padding: 10px 12px;
  font-size: .75rem;
  line-height: 1.4;
}


/* Units readability: larger numbers, keep labels/keywords compact */
@media (max-width: 760px) {
  .stat strong {
    font-size: 1.12rem !important;
  }

  .weapon-table .weapon-row td:nth-child(3),
  .weapon-table .weapon-row td:nth-child(4),
  .weapon-table .weapon-row td:nth-child(5),
  .weapon-table .weapon-row td:nth-child(6),
  .weapon-table .weapon-row td:nth-child(7) {
    font-size: .72rem !important;
    font-weight: 850;
  }

  .weapon-table .weapon-row td:nth-child(2),
  .weapon-table .weapon-keywords {
    font-size: .58rem !important;
    font-weight: 500;
  }
}


/* Top reference shortcuts + unit status context */
.app-nav {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.top-reference-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.top-reference-button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid #304054;
  border-radius: 10px;
  background: #131b25;
  color: #b9c7d4;
  padding: 0 10px;
  font-size: .72rem;
  font-weight: 850;
}

.top-reference-button:hover,
.top-reference-button.active {
  border-color: #3a7187;
  background: rgba(56,189,248,.09);
  color: var(--accent);
}

.unit-context-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid #293444;
  background: #0d141c;
}

.unit-top-statuses {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.unit-status-toggle {
  min-height: 32px;
  border: 1px solid #344356;
  border-radius: 999px;
  background: #151d27;
  color: #a8b5c4;
  padding: 0 10px;
  font-size: .68rem;
  font-weight: 850;
}

.unit-status-toggle.active {
  border-color: #39758f;
  background: rgba(56,189,248,.10);
  color: var(--accent);
}

.battle-shock-toggle.active {
  border-color: #a73e4d;
  background: rgba(220,54,73,.18);
  color: #ff9ba7;
  box-shadow: 0 0 0 1px rgba(220,54,73,.08);
}

.detachment-summary {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #2a394b;
  border-radius: 14px;
  background: #101720;
}

.detachment-summary-label {
  display: block;
  margin-bottom: 8px;
  color: #7f90a3;
  font-size: .62rem;
  font-weight: 900;
  letter-spacing: .09em;
}

.detachment-summary-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.detachment-summary-chip {
  display: inline-grid;
  gap: 1px;
  border: 1px solid #365267;
  border-radius: 999px;
  background: rgba(56,189,248,.06);
  padding: 6px 10px;
}

.detachment-summary-chip strong {
  color: #dce8ef;
  font-size: .72rem;
}

.detachment-summary-chip small {
  color: #7f91a3;
  font-size: .58rem;
}

.detachment-loading {
  display: block;
  margin-top: 8px;
  color: var(--accent);
  font-size: .68rem;
}

@media (max-width: 760px) {
  .topbar {
    gap: 7px;
  }

  .top-reference-actions {
    gap: 4px;
  }

  .top-reference-button {
    min-height: 34px;
    padding: 0 8px;
    font-size: .65rem;
  }

  .top-reference-button span {
    display: none;
  }

  .unit-context-bar {
    align-items: flex-start;
    padding: 7px 8px;
  }

  .unit-top-statuses {
    gap: 5px;
  }

  .unit-status-toggle {
    min-height: 29px;
    padding: 0 8px;
    font-size: .61rem;
  }
}


/* Unit context controls */
.unit-status-toggle {
  border-radius: 10px !important;
  background: transparent !important;
  color: #b8c5d2 !important;
  box-shadow: none !important;
}

.unit-status-toggle:hover {
  background: #17202b !important;
  color: #eef4f8 !important;
}

.unit-status-toggle.active {
  border-color: #3a7187 !important;
  background: rgba(56,189,248,.10) !important;
  color: var(--accent) !important;
}

.battle-shock-toggle.active {
  border-color: #a84050 !important;
  background: rgba(220,54,73,.18) !important;
  color: #ff9aa6 !important;
}

.unit-context-bar {
  align-items: center !important;
}

.unit-top-statuses {
  flex-wrap: nowrap;
}

/* Units browser references */
.unit-browser-references {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

.browser-reference-loading,
.browser-reference-empty {
  border: 1px solid #293444;
  border-radius: 12px;
  background: #101720;
  color: #8797a9;
  padding: 12px;
  font-size: .76rem;
}

.browser-reference-section {
  border: 1px solid #293444;
  border-radius: 14px;
  background: #101720;
  overflow: hidden;
}

.browser-reference-section > summary {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  padding: 0 14px;
  color: #eef4f8;
  font-size: .9rem;
  font-weight: 850;
}

.browser-reference-section > summary::-webkit-details-marker {
  display: none;
}

.browser-reference-section > summary::after {
  content: "⌄";
  color: #8090a2;
  margin-left: auto;
  transition: transform .16s ease;
}

.browser-reference-section[open] > summary::after {
  transform: rotate(180deg);
}

.browser-reference-section > summary strong {
  min-width: 25px;
  height: 23px;
  display: grid;
  place-items: center;
  border: 1px solid #304054;
  border-radius: 999px;
  color: #8fa0b3;
  font-size: .64rem;
}

.browser-reference-list {
  display: grid;
  gap: 7px;
  padding: 0 10px 10px;
}

.browser-reference-card {
  border: 1px solid #273444;
  border-radius: 11px;
  background: #141c26;
  padding: 11px 12px;
}

.browser-reference-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 9px;
}

.browser-reference-card-heading h4 {
  margin: 0;
  font-size: .82rem;
}

.browser-reference-card-heading span {
  flex: 0 0 auto;
  max-width: 55%;
  color: #8da0b3;
  font-size: .58rem;
  text-align: right;
}

.browser-reference-card-text {
  margin-top: 7px;
  color: #bbc7d3;
  font-size: .76rem;
  line-height: 1.48;
}

.browser-reference-card-text p {
  margin: 0 0 7px;
}

.browser-reference-card-text p:last-child {
  margin-bottom: 0;
}

/* Denser weapon layout with larger numbers */
.weapon-table {
  table-layout: fixed;
}

.weapon-table th,
.weapon-table td {
  padding-top: 12px;
  padding-bottom: 12px;
}

.weapon-table th:nth-child(1),
.weapon-table td:nth-child(1) { width: 34%; }
.weapon-table th:nth-child(2),
.weapon-table td:nth-child(2) { width: 9%; }
.weapon-table th:nth-child(3),
.weapon-table td:nth-child(3) { width: 6%; }
.weapon-table th:nth-child(4),
.weapon-table td:nth-child(4) { width: 8%; }
.weapon-table th:nth-child(5),
.weapon-table td:nth-child(5) { width: 6%; }
.weapon-table th:nth-child(6),
.weapon-table td:nth-child(6) { width: 6%; }
.weapon-table th:nth-child(7),
.weapon-table td:nth-child(7) { width: 6%; }
.weapon-table th:nth-child(8),
.weapon-table td:nth-child(8) { width: 25%; }

.weapon-table tbody td:nth-child(3),
.weapon-table tbody td:nth-child(4),
.weapon-table tbody td:nth-child(5),
.weapon-table tbody td:nth-child(6),
.weapon-table tbody td:nth-child(7) {
  font-size: 1.16rem;
  font-weight: 850;
  line-height: 1;
}

.weapon-table tbody td:nth-child(2),
.weapon-table tbody td:nth-child(8) {
  font-size: .92rem;
  font-weight: 500;
}

@media (max-width: 760px) {
  .unit-context-bar {
    min-height: 42px;
    padding: 6px 8px !important;
  }

  .unit-top-statuses {
    gap: 4px;
  }

  .unit-status-toggle {
    min-height: 30px !important;
    padding: 0 7px !important;
    font-size: .59rem !important;
  }

  .back-to-roster {
    min-height: 30px;
  }

  .weapon-table th,
  .weapon-table .weapon-row td {
    padding: 7px 2px !important;
  }

  .weapon-table tbody td:nth-child(3),
  .weapon-table tbody td:nth-child(4),
  .weapon-table tbody td:nth-child(5),
  .weapon-table tbody td:nth-child(6),
  .weapon-table tbody td:nth-child(7) {
    font-size: 1rem !important;
    font-weight: 900 !important;
    line-height: 1 !important;
  }

  .weapon-table tbody td:nth-child(2),
  .weapon-table tbody td:nth-child(8),
  .weapon-table .weapon-keywords {
    font-size: .58rem !important;
    font-weight: 500 !important;
    line-height: 1.15 !important;
  }

  .weapon-name strong {
    font-size: .72rem !important;
    line-height: 1.12 !important;
  }

  .browser-reference-section > summary {
    min-height: 46px;
    padding: 0 11px;
    font-size: .82rem;
  }

  .browser-reference-card {
    padding: 9px 10px;
  }

  .browser-reference-card-heading h4 {
    font-size: .78rem;
  }

  .browser-reference-card-text {
    font-size: .72rem;
  }
}


/* Weapon value emphasis: numbers up, rule words stay compact */
.weapon-table tbody td.weapon-number,
.weapon-table tbody td.weapon-range-number {
  font-size: 1.16rem;
  font-weight: 850;
  line-height: 1;
}

.weapon-table tbody td.weapon-range-text,
.weapon-table tbody td.weapon-keywords {
  font-size: .92rem;
  font-weight: 500;
  line-height: 1.2;
}

@media (max-width: 760px) {
  .weapon-table tbody td.weapon-number,
  .weapon-table tbody td.weapon-range-number {
    font-size: 1rem !important;
    font-weight: 900 !important;
    line-height: 1 !important;
  }

  .weapon-table tbody td.weapon-range-text,
  .weapon-table tbody td.weapon-keywords {
    font-size: .58rem !important;
    font-weight: 500 !important;
    line-height: 1.15 !important;
  }
}


/* Final weapon readability bump */
.weapon-table tbody td.weapon-number,
.weapon-table tbody td.weapon-range-number {
  font-size: 1.35rem;
}

.weapon-table th,
.weapon-table td {
  padding-top: 15px;
  padding-bottom: 15px;
}

@media (max-width: 760px) {
  .weapon-table tbody td.weapon-number,
  .weapon-table tbody td.weapon-range-number {
    font-size: 1.12rem !important;
  }

  .weapon-table th,
  .weapon-table .weapon-row td {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
  }
}


/* Inline army references now match normal unit rule styling */
.unit-browser-references {
  display: grid;
  gap: 12px;
  margin-top: 2px;
}

.browser-reference-unit-group {
  padding: 12px;
}

.browser-reference-list {
  display: grid;
  gap: 8px;
  max-width: none;
  padding: 0;
}

.browser-inline-rule {
  padding: 12px 13px;
  border-radius: 11px;
  background: #141c26;
}

.browser-inline-rule-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

.browser-inline-rule-heading h4 {
  margin: 0;
  font-size: .86rem;
}

.browser-inline-rule-heading span {
  flex: 0 0 auto;
  max-width: 52%;
  color: #8494a7;
  font-size: .62rem;
  line-height: 1.25;
  text-align: right;
}

.reference-detachment-heading {
  margin: 5px 2px 0;
  color: var(--accent);
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.browser-inline-rule .ability-text {
  max-width: none;
  font-size: .84rem;
  line-height: 1.52;
}

@media (max-width: 760px) {
  .browser-reference-unit-group {
    padding: 9px;
  }

  .browser-reference-list {
    gap: 6px;
  }

  .browser-inline-rule {
    padding: 9px 10px;
  }

  .browser-inline-rule-heading {
    gap: 7px;
    margin-bottom: 5px;
  }

  .browser-inline-rule-heading h4 {
    font-size: .79rem;
  }

  .browser-inline-rule-heading span {
    font-size: .56rem;
  }

  .browser-inline-rule .ability-text {
    font-size: .75rem;
    line-height: 1.45;
  }

  .reference-detachment-heading {
    font-size: .62rem;
  }
}


/* CP in Units browser header */
.roster-browser-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.unit-browser-cp {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto 30px 34px 30px;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  padding: 6px 7px;
  border: 1px solid #2d3b4d;
  border-radius: 11px;
  background: #101720;
}

.unit-browser-cp > span {
  color: #8798aa;
  font-size: .62rem;
  font-weight: 900;
  letter-spacing: .08em;
}

.unit-browser-cp button {
  width: 30px;
  height: 30px;
  border: 1px solid #304054;
  border-radius: 8px;
  background: #17202b;
  color: #edf3f8;
  padding: 0;
  font-weight: 900;
}

.unit-browser-cp strong {
  text-align: center;
  font-size: 1.05rem;
}

.score-turn-row {
  margin-top: 12px;
}

/* Collapsed army-rule / stratagem datasheets */
.browser-reference-unit-group {
  padding: 0;
  overflow: hidden;
}

.browser-reference-unit-group > summary {
  list-style: none;
}

.browser-reference-unit-group > summary::-webkit-details-marker {
  display: none;
}

.browser-reference-section-summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  cursor: pointer;
  font-size: .86rem;
  font-weight: 850;
}

.browser-reference-section-summary::after {
  content: "⌄";
  margin-left: 8px;
  color: #7f91a4;
  transition: transform .15s ease;
}

.browser-reference-unit-group[open] > .browser-reference-section-summary::after {
  transform: rotate(180deg);
}

.browser-reference-section-summary > strong {
  min-width: 24px;
  height: 22px;
  display: grid;
  place-items: center;
  margin-left: auto;
  border: 1px solid #304054;
  border-radius: 999px;
  color: #8fa0b3;
  font-size: .62rem;
}

.browser-reference-section-body {
  padding: 0 9px 9px;
}

.strat-phase-tabs {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding: 2px 0 8px;
  scrollbar-width: none;
}

.strat-phase-tabs::-webkit-scrollbar {
  display: none;
}

.strat-phase-tabs button {
  flex: 0 0 auto;
  min-height: 31px;
  border: 1px solid #304054;
  border-radius: 999px;
  background: #141c26;
  color: #90a0b2;
  padding: 0 10px;
  font-size: .64rem;
  font-weight: 850;
}

.strat-phase-tabs button.active {
  border-color: #3b7187;
  background: rgba(56,189,248,.10);
  color: var(--accent);
}

.phase-hidden {
  display: none !important;
}

.browser-inline-rule-details {
  border: 1px solid #293444;
  border-radius: 11px;
  background: #131a23;
  overflow: hidden;
}

.browser-inline-rule-details > summary {
  list-style: none;
}

.browser-inline-rule-details > summary::-webkit-details-marker {
  display: none;
}

.browser-inline-rule-summary {
  min-height: 45px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  cursor: pointer;
}

.browser-inline-rule-title {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.browser-inline-rule-title strong {
  color: #f1f5f8;
  font-size: .82rem;
  line-height: 1.2;
}

.browser-inline-rule-title small {
  color: #8394a7;
  font-size: .59rem;
}

.browser-inline-rule-open {
  margin-left: auto;
  color: #8293a6;
  font-size: .9rem;
  transition: transform .15s ease;
}

.browser-inline-rule-details[open] .browser-inline-rule-open {
  transform: rotate(45deg);
}

.browser-inline-rule-details .browser-inline-rule {
  margin: 0;
  border: 0;
  border-top: 1px solid #293444;
  border-radius: 0;
  background: #101720;
}

.reference-detachment-heading {
  margin: 8px 2px 1px;
}

/* Weapon keywords now live below the stat row */
.compact-weapon-table th:nth-child(1),
.compact-weapon-table td:nth-child(1) { width: 39% !important; }
.compact-weapon-table th:nth-child(2),
.compact-weapon-table td:nth-child(2) { width: 12% !important; }
.compact-weapon-table th:nth-child(3),
.compact-weapon-table td:nth-child(3) { width: 9% !important; }
.compact-weapon-table th:nth-child(4),
.compact-weapon-table td:nth-child(4) { width: 12% !important; }
.compact-weapon-table th:nth-child(5),
.compact-weapon-table td:nth-child(5) { width: 9% !important; }
.compact-weapon-table th:nth-child(6),
.compact-weapon-table td:nth-child(6) { width: 9% !important; }
.compact-weapon-table th:nth-child(7),
.compact-weapon-table td:nth-child(7) { width: 10% !important; }

.compact-weapon-table .weapon-stat-row > td {
  padding-top: 14px !important;
  padding-bottom: 10px !important;
}

.compact-weapon-table .weapon-number,
.compact-weapon-table .weapon-range-number {
  font-size: 1.48rem !important;
  font-weight: 900 !important;
  line-height: 1 !important;
}

.compact-weapon-table .weapon-range-text {
  font-size: .86rem !important;
  font-weight: 600 !important;
}

.weapon-keyword-row td {
  width: auto !important;
  padding: 6px 12px 10px !important;
  border-bottom: 1px solid #293444;
  background: #101720;
  text-align: left !important;
}

.weapon-keyword-row td > span {
  margin-right: 8px;
  color: #708196;
  font-size: .55rem;
  font-weight: 900;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.weapon-keyword-row td > strong {
  color: #aebdca;
  font-size: .72rem;
  font-weight: 550;
}

@media (max-width: 760px) {
  .roster-browser-heading {
    align-items: flex-start;
  }

  .unit-browser-cp {
    grid-template-columns: auto 28px 30px 28px;
    gap: 3px;
    padding: 4px 5px;
  }

  .unit-browser-cp button {
    width: 28px;
    height: 28px;
  }

  .unit-browser-cp strong {
    font-size: .98rem;
  }

  .browser-reference-section-summary {
    min-height: 43px;
    padding: 0 9px;
    font-size: .8rem;
  }

  .browser-reference-section-body {
    padding: 0 7px 7px;
  }

  .strat-phase-tabs {
    gap: 4px;
    padding-bottom: 6px;
  }

  .strat-phase-tabs button {
    min-height: 29px;
    padding: 0 8px;
    font-size: .59rem;
  }

  .browser-inline-rule-summary {
    min-height: 42px;
    padding: 7px 8px;
  }

  .browser-inline-rule-title strong {
    font-size: .78rem;
  }

  .browser-inline-rule-title small {
    font-size: .55rem;
  }

  .compact-weapon-table .weapon-stat-row > td {
    padding-top: 10px !important;
    padding-bottom: 8px !important;
  }

  .compact-weapon-table .weapon-number,
  .compact-weapon-table .weapon-range-number {
    font-size: 1.28rem !important;
  }

  .compact-weapon-table .weapon-range-text {
    font-size: .66rem !important;
  }

  .weapon-keyword-row td {
    display: table-cell !important;
    padding: 5px 7px 7px !important;
  }

  .weapon-keyword-row td > span {
    font-size: .48rem;
  }

  .weapon-keyword-row td > strong {
    font-size: .62rem;
  }
}


/* Extra mobile weapon readability */
@media (max-width: 760px) {
  .compact-weapon-table .weapon-number,
  .compact-weapon-table .weapon-range-number {
    font-size: 1.42rem !important;
  }

  .compact-weapon-table .weapon-stat-row > td {
    padding-top: 12px !important;
    padding-bottom: 10px !important;
  }
}


/* Lightweight TXT roster imports */
.text-loadout-list {
  display: grid;
  gap: 5px;
}

.text-loadout-list > div {
  border: 1px solid #283546;
  border-radius: 9px;
  background: #131b24;
  color: #b8c5d1;
  padding: 8px 10px;
  font-size: .78rem;
  line-height: 1.35;
}

.text-import-notice {
  padding-top: 8px !important;
}

@media (max-width: 760px) {
  .text-loadout-list > div {
    padding: 7px 8px;
    font-size: .72rem;
  }
}


/* Removable imported lists */
.removable-roster-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.removable-roster-row > div {
  min-width: 0;
}

.remove-roster-button {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid #39485a;
  border-radius: 9px;
  background: #151d27;
  color: #8e9daf;
  padding: 0;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
}

.remove-roster-button:hover {
  border-color: #8b3e49;
  background: rgba(220,54,73,.09);
  color: #ff9aa6;
}

@media (max-width: 760px) {
  .remove-roster-button {
    width: 32px;
    height: 32px;
  }
}


/* === Top army reference tabs / sharing / readability === */
.app-nav {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.nav-more-link {
  width: 100%;
  display: block;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #dce5ee;
  padding: 12px;
  text-align: left;
  text-decoration: none;
  font-weight: 750;
}

.nav-more-link:hover {
  background: rgba(56,189,248,.08);
  color: var(--accent);
}

.compact-reference-heading {
  margin-bottom: 14px;
}

.reference-source-tabs {
  margin-bottom: 14px;
}

.source-reference-content {
  display: grid;
  gap: 10px;
  max-width: 1050px;
}

.dedicated-reference-list {
  gap: 8px;
}

/* Datasheet statline: much easier to read */
.stat {
  padding-top: 16px;
  padding-bottom: 16px;
}

.stat strong {
  font-size: 1.7rem;
  line-height: 1;
  font-weight: 900;
}

.unit-keywords-section {
  padding-bottom: 2px;
}

.unit-keyword-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.unit-keyword-chips span {
  border: 1px solid #304054;
  border-radius: 999px;
  background: #141c26;
  color: #aebdca;
  padding: 5px 9px;
  font-size: .66rem;
  font-weight: 750;
}

/* App-to-app roster sharing */
.share-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 14px;
  margin-top: 18px;
}

.share-tool-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.share-tool-card h2 {
  margin: 3px 0 5px;
}

.share-select-label,
.share-link-fallback label {
  color: #8fa0b3;
  font-size: .72rem;
  font-weight: 800;
}

.share-tool-card select,
.share-link-fallback input {
  width: 100%;
  min-height: 44px;
  border: 1px solid #304054;
  border-radius: 11px;
  background: #0f151d;
  color: #eef4f8;
  padding: 0 11px;
  font: inherit;
}

.share-roster-picker {
  display: grid;
  grid-template-columns: minmax(0,1fr) 44px;
  gap: 7px;
  align-items: center;
}

.share-remove-list-button {
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  font-size: 1.35rem;
  line-height: 1;
}

.share-receive-actions {
  display: grid;
  gap: 7px;
  border: 1px solid #397454;
  border-radius: 12px;
  background: rgba(74,190,120,.08);
  padding: 12px;
}

.share-receive-actions > strong {
  color: #a5efbf;
  font-size: .9rem;
}

.share-receive-actions > small {
  color: #9db0a5;
  line-height: 1.4;
}

.share-receive-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 2px;
}

.share-receive-action-buttons button {
  min-height: 40px;
}

.app-share-qr-panel {
  display: grid;
  justify-items: center;
  gap: 7px;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid #293444;
  text-align: center;
}

.app-share-qr-code {
  width: min(270px, 100%);
  display: grid;
  place-items: center;
  padding: 12px;
  border-radius: 15px;
  background: #fff;
}

.app-share-qr-code img,
.app-share-qr-code canvas {
  max-width: 100%;
  height: auto !important;
}

.app-share-qr-panel small {
  color: #7f90a3;
  line-height: 1.4;
}

.opponent-qr-scanner {
  width: 100%;
  overflow: hidden;
  border: 1px solid #304054;
  border-radius: 13px;
  background: #0d141c;
}

.share-link-fallback {
  display: grid;
  gap: 6px;
  margin-top: 4px;
}

.share-receive-status {
  border: 1px solid #34465a;
  border-radius: 11px;
  background: #131b25;
  color: #b9c7d4;
  padding: 10px 12px;
  font-size: .8rem;
}

.share-receive-status.good {
  border-color: #397454;
  background: rgba(74,190,120,.08);
  color: #8fe0ad;
}

.share-receive-status.bad {
  border-color: #7f3c49;
  background: rgba(220,54,73,.08);
  color: #ff9da8;
}

@media (max-width: 760px) {
  .app-nav {
    grid-template-columns: repeat(7, minmax(0,1fr)) !important;
    gap: 2px !important;
    padding: 5px 4px !important;
  }

  .app-nav-button {
    min-height: 48px !important;
    padding: 4px 1px !important;
    gap: 2px !important;
    font-size: .54rem !important;
    border-radius: 8px !important;
  }

  .nav-icon {
    font-size: .95rem !important;
  }

  .nav-more-menu {
    top: 108px !important;
  }

  .stat-grid {
    gap: 3px !important;
    padding: 7px 8px 9px !important;
  }

  .stat {
    padding: 8px 1px 9px !important;
  }

  .stat span {
    font-size: .49rem !important;
  }

  .stat strong {
    font-size: 1.38rem !important;
    margin-top: 5px !important;
  }

  .unit-keyword-chips {
    gap: 4px;
  }

  .unit-keyword-chips span {
    padding: 4px 7px;
    font-size: .59rem;
  }

  .share-grid {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .share-tool-card {
    padding: 13px;
  }

  .app-share-qr-code {
    width: min(250px, 100%);
  }

  .source-reference-page {
    padding: 12px 8px 22px !important;
  }

  .reference-source-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }

  .reference-source-tabs::-webkit-scrollbar {
    display: none;
  }

  .reference-source-tabs .roster-tab {
    flex: 0 0 auto;
  }
}


/* Final nav/share/statline polish */
.nav-more {
  display: block !important;
}

.stat strong {
  font-size: 1.82rem;
}

@media (max-width: 760px) {
  .stat strong {
    font-size: 1.48rem !important;
  }
}


.share-link-fallback .copy-row {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 7px;
}

.share-link-fallback .copy-row .ghost-button {
  min-height: 44px;
}


/* Privacy / about */
.privacy-shell {
  width: min(920px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 42px;
}

.privacy-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.privacy-brand {
  text-decoration: none;
}

.privacy-back {
  text-decoration: none;
  white-space: nowrap;
}

.privacy-card {
  border: 1px solid #293444;
  border-radius: 18px;
  background: #101720;
  padding: clamp(20px, 4vw, 34px);
  box-shadow: 0 20px 60px rgba(0,0,0,.24);
}

.privacy-card h1 {
  margin: 5px 0 8px;
}

.privacy-lede {
  color: #b7c4d1;
  line-height: 1.65;
  font-size: 1rem;
  margin: 0 0 24px;
}

.privacy-card section {
  padding: 18px 0;
  border-top: 1px solid #293444;
}

.privacy-card section h2 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.privacy-card section p {
  color: #aebdca;
  line-height: 1.65;
  margin: 8px 0 0;
}

.privacy-updated {
  color: #708195;
  font-size: .78rem;
  margin: 22px 0 0;
}

@media (max-width: 600px) {
  .privacy-shell {
    width: min(100% - 18px, 920px);
    padding-top: 9px;
  }

  .privacy-header {
    align-items: flex-start;
  }

  .privacy-header .brand small {
    display: block;
  }

  .privacy-back {
    padding-inline: 10px;
  }
}


/* Header support button */
.buy-coffee-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.buy-coffee-header .bmc-btn {
  min-width: 0 !important;
  height: 42px !important;
  padding: 0 14px !important;
  border-radius: 10px !important;
  box-shadow: none !important;
}

.buy-coffee-header .bmc-btn-text {
  font-size: 19px !important;
}

@media (max-width: 600px) {
  .buy-coffee-header .bmc-btn {
    height: 38px !important;
    padding: 0 10px !important;
  }

  .buy-coffee-header .bmc-btn-text {
    font-size: 16px !important;
  }
}


/* Updates signup */
.updates-card {
  max-width: 720px;
}

.brevo-embed-card {
  overflow: hidden;
}

.brevo-signup-frame {
  display: block;
  width: 100%;
  max-width: 540px;
  min-height: 305px;
  margin: 0 auto;
  border: 0;
  border-radius: 12px;
  background: transparent;
}

.updates-note {
  display: block;
  margin-top: 13px;
  color: #7f90a3;
  line-height: 1.55;
  text-align: center;
}

.updates-note a {
  color: #a7c7de;
}
