/* Prevent iOS/iPadOS double-tap zoom on rapid game-control presses.
   "manipulation" keeps normal scrolling and pinch zoom available. */
button,
[role="button"],
a[href],
input[type="button"],
input[type="submit"],
input[type="reset"] {
  touch-action: manipulation;
}

button,
[role="button"] {
  -webkit-user-select: none;
  user-select: none;
}

: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; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; -webkit-user-drag: none; touch-action: none; }
.talk-button, .talk-button * { user-select: none; -webkit-user-select: none; -webkit-touch-callout: 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 {
  max-width: none;
  margin-bottom: 18px;
  align-items: flex-start;
}

.setup-hero-copy {
  max-width: 900px;
}

.setup-hero-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  margin-left: auto;
  padding-top: 2px;
}

.setup-hero-actions .compact {
  min-height: 34px;
  padding-inline: 12px;
  white-space: nowrap;
}

.setup-system-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 46px;
  margin-bottom: 14px;
  padding: 8px 10px 8px 14px;
  border: 1px solid #2c3944;
  border-left: 3px solid var(--accent-strong);
  background: #10171e;
}

.setup-system-strip-copy {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 12px;
}

.setup-system-strip-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .9rem;
}

.setup-system-strip > button {
  flex: 0 0 auto;
  min-height: 32px;
  padding-inline: 11px;
}

.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-system-strip {
    gap: 8px;
    min-height: 44px;
    padding: 7px 8px 7px 10px;
  }

  .setup-system-strip-copy {
    gap: 7px;
  }

  .setup-system-strip-copy .section-label {
    display: none;
  }

  .setup-system-strip-copy strong {
    font-size: .82rem;
  }

  .setup-system-strip > button {
    padding-inline: 9px;
    font-size: .72rem;
  }

  .setup-hero-actions {
    justify-content: flex-start;
    margin: 12px 0 0;
    padding-top: 0;
  }

  .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;
}


/* === Tabletop Voice identity pass: denser field-tool UI === */
:root {
  --bg: #090c10;
  --surface: #0e1319;
  --surface-2: #131a22;
  --surface-3: #18222c;
  --line: #303b48;
  --line-strong: #465665;
  --accent: #82d9ee;
  --accent-strong: #39b8d5;
  --text: #f0f3f5;
  --muted: #8996a3;
  --shadow: 0 12px 28px rgba(0,0,0,.28);
}

html,
body {
  background:
    linear-gradient(rgba(255,255,255,.014) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.012) 1px, transparent 1px),
    #090c10;
  background-size: 32px 32px;
}

.topbar {
  min-height: 64px;
  padding-block: 9px;
  border-bottom: 2px solid #26313b;
  background: rgba(8,11,15,.96);
  backdrop-filter: none;
}

.brand {
  gap: 10px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border: 0;
  border-left: 4px solid var(--accent-strong);
  border-radius: 0;
  background: #151d25;
  font-size: .9rem;
  letter-spacing: .02em;
}

.brand strong {
  font-size: .98rem;
  letter-spacing: .015em;
}

.brand small {
  color: #82909c;
  font-size: .58rem;
  font-weight: 800;
  letter-spacing: .15em;
}

.support-link {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid #3a4652;
  border-radius: 3px;
  background: #111820;
  color: #dce3e8;
  text-decoration: none;
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .045em;
  text-transform: uppercase;
}

.support-link:hover {
  border-color: var(--accent-strong);
  color: var(--accent);
  background: #16212a;
}

.app-nav {
  gap: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-bottom: 1px solid #313c47;
  background: #0d1218;
  backdrop-filter: none;
}

.app-nav-button {
  min-height: 48px;
  gap: 6px;
  border: 0;
  border-right: 1px solid #222c35;
  border-radius: 0;
  color: #8d99a4;
  font-size: .72rem;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.app-nav-button:first-child {
  border-left: 1px solid #222c35;
}

.app-nav-button:hover {
  background: #141c24;
}

.app-nav-button.active {
  border: 0;
  border-right: 1px solid #293641;
  box-shadow: inset 0 -3px 0 var(--accent-strong);
  background: #152029;
  color: #dff8ff;
}

.nav-icon {
  color: var(--accent);
  opacity: .88;
}

.nav-more-menu {
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: #0e141b;
  box-shadow: 0 12px 26px rgba(0,0,0,.45);
}

.nav-more-menu button,
.nav-more-link {
  border-radius: 0 !important;
}

.page-hero,
.page-heading {
  position: relative;
  max-width: 900px;
  padding-left: 16px;
  border-left: 3px solid var(--accent-strong);
}

.compact-hero h1,
.page-heading h1 {
  margin-top: 4px;
  font-size: clamp(1.9rem, 4vw, 3.25rem);
  letter-spacing: -.025em;
}

.eyebrow,
.section-label {
  color: #8cb9c5;
  font-size: .64rem;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.primary-button,
.ghost-button,
.icon-button {
  border-radius: 3px;
}

.primary-button {
  background: #75cfe3;
  color: #071116;
}

.primary-button:hover {
  background: #a5e6f4;
}

.ghost-button {
  background: #121920;
  border-color: #34414e;
}

.tool-card,
.dice-card,
.match-state-card,
.score-card,
.score-player-card,
.scoreboard-totals > div,
.reference-card,
.ability-card,
.data-summary-row,
.setup-step {
  border-radius: 3px;
  box-shadow: none;
}

.tool-card,
.dice-card,
.match-state-card,
.score-card,
.score-player-card,
.reference-card,
.ability-card {
  background: #10161d;
  border-color: #303b47;
}

.tool-card,
.dice-card,
.match-state-card {
  position: relative;
}

.tool-card::before,
.dice-card::before,
.match-state-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  width: 42px;
  height: 3px;
  background: var(--accent-strong);
}

.setup-import-grid,
.data-grid,
.setup-grid,
.score-player-grid,
.score-grid {
  gap: 9px;
}

.setup-import-card > p {
  color: #8f9ba7;
}

.data-summary-row {
  border-left: 3px solid #394957;
  background: #131a21;
}

.active-army-chip,
.active-army-more,
.active-army-empty,
.active-army-empty-button,
.roster-tab,
.section-count,
.weapon-quantity,
.reference-card-heading span {
  border-radius: 3px;
}

.roster-tab {
  padding-inline: 10px;
  text-transform: uppercase;
  font-size: .67rem;
  font-weight: 800;
  letter-spacing: .05em;
}

.roster-tab.active {
  color: #051217;
  background: var(--accent);
}

.datasheet-main-search input,
.dice-custom input,
.reference-search input,
.score-category label input {
  border-radius: 3px;
  background: #0b1015;
}

.datasheet-results-shell,
.datasheet-detail-panel .detail-card,
.weapon-table-wrap {
  border-radius: 3px;
  box-shadow: none;
}

.detail-heading {
  border-left: 4px solid var(--accent-strong);
  background: #10171e;
}

.detail-heading h2 {
  letter-spacing: -.015em;
}

.stat-grid {
  gap: 1px;
  padding: 0;
  background: #303b47;
}

.stat {
  border: 0;
  border-radius: 0;
  background: #111820;
  padding: 14px 16px;
}

.stat span {
  color: #8494a2;
}

.stat strong {
  color: #f5f7f8;
}

.weapon-table-wrap {
  border-color: #34414e;
}

.weapon-table th {
  background: #17212a;
  color: #9cabb7;
}

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

.ability-card,
.reference-card {
  border-left: 3px solid #394956;
  padding: 14px 16px;
}

.ability-card:hover,
.reference-card:hover {
  border-left-color: var(--accent-strong);
  background: #121b23;
}

.score-turn-tabs {
  gap: 2px;
}

.score-turn-tabs button,
.score-actions button,
.dice-presets button {
  border-radius: 2px;
}

.score-turn-tabs button.active {
  box-shadow: inset 0 -3px 0 var(--accent-strong);
  background: #16212a;
}

.die-result {
  border-radius: 2px;
}

.voice-dock {
  width: min(760px, calc(100% - 24px));
  gap: 12px;
  padding: 8px 8px 8px 14px;
  border: 1px solid #43515e;
  border-radius: 3px;
  background: #10161d;
  backdrop-filter: none;
  box-shadow: 0 12px 30px rgba(0,0,0,.42);
}

.talk-button {
  min-width: 210px;
  border-radius: 2px;
  background: var(--accent);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.talk-button.listening {
  background: #e46f78;
}

.first-run-card,
.beta-notice-card {
  border-radius: 3px !important;
}

.brevo-signup-frame {
  border-radius: 2px;
}

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

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

  .support-link {
    min-height: 34px;
    padding-inline: 9px;
    font-size: .66rem;
  }

  .app-nav {
    gap: 0;
    padding: 0;
  }

  .app-nav-button {
    min-height: 52px;
    border-right: 1px solid #232d36;
    border-radius: 0;
    font-size: .57rem;
    letter-spacing: .03em;
  }

  .nav-more-menu {
    top: 106px;
  }

  .page-hero,
  .page-heading {
    padding-left: 11px;
  }

  .tool-card,
  .dice-card,
  .match-state-card {
    border-radius: 2px;
  }

  .stat-grid {
    gap: 1px;
    background: #303b47;
  }

  .stat {
    border-radius: 0;
    padding-block: 10px;
  }

  .weapon-table .weapon-row {
    border-radius: 2px;
  }

  .voice-dock {
    border-radius: 2px;
    padding: 6px;
  }

  .talk-button {
    border-radius: 2px;
  }
}


/* === OnePageRules / Army Forge adapter === */
.opr-import-card {
  margin-top: 0;
}

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

.opr-import-controls {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.opr-import-controls input,
.opr-import-controls textarea {
  width: 100%;
  min-width: 0;
  min-height: 50px;
  padding: 12px;
  border: 1px solid #354350;
  border-radius: 3px;
  outline: 0;
  background: #0b1015;
  color: #edf3f6;
  font: inherit;
  font-size: 16px;
}

.opr-import-controls textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.4;
}

body.game-opr .opr-import-controls textarea {
  min-height: 118px;
}

.opr-import-controls input:focus,
.opr-import-controls textarea:focus {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 2px rgba(57,184,213,.12);
}

.opr-import-status {
  display: block;
  margin-top: 10px;
  color: #7f8e9a;
  line-height: 1.45;
}

.opr-weapon-table {
  min-width: 620px;
}

.opr-weapon-table th:nth-child(2),
.opr-weapon-table td:nth-child(2) {
  width: 110px;
}

.opr-weapon-table th:nth-child(3),
.opr-weapon-table td:nth-child(3) {
  width: 80px;
}

.opr-weapon-special {
  min-width: 220px;
  text-align: left !important;
  color: #c4d1d8 !important;
  line-height: 1.4;
}

@media (max-width: 760px) {
  .opr-import-controls .primary-button {
    width: 100%;
  }

  .opr-weapon-table {
    min-width: 0;
  }

  .opr-weapon-table .opr-weapon-special {
    grid-column: 1 / -1;
    min-width: 0;
    padding-top: 9px;
    border-top: 1px solid #25303f !important;
  }
}

.setup-loaded-lists {
  margin-top: 12px;
  padding: 12px 0 2px;
  border-top: 1px solid #26313b;
}

.setup-loaded-lists .data-roster-summary {
  margin-top: 8px;
  margin-bottom: 0;
}

@media (min-width: 761px) {
  .app-nav.opr-context {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}


/* === Game system chooser / settings === */
.game-system-modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4,7,11,.88);
  backdrop-filter: blur(12px);
}

.game-system-card {
  position: relative;
  width: min(880px, 100%);
  padding: clamp(24px, 4vw, 38px);
  border: 1px solid #34414d;
  border-radius: 3px;
  background: #0f151c;
  box-shadow: 0 28px 90px rgba(0,0,0,.52);
}

.game-system-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border: 1px solid #35414c;
  border-radius: 2px;
  background: #111820;
  color: #aab6bf;
  font: inherit;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.game-system-close:hover {
  border-color: var(--accent-strong);
  color: var(--text);
}

.game-system-card h1 {
  margin: 6px 0 8px;
  font-size: clamp(2rem, 5vw, 3.6rem);
  letter-spacing: -.035em;
}

.game-system-intro {
  max-width: 680px;
  margin: 0;
  color: #9aa8b4;
  line-height: 1.55;
}

.game-system-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 10px;
  margin-top: 24px;
}

.game-system-option {
  position: relative;
  min-height: 142px;
  padding: 18px;
  text-align: left;
  border: 1px solid #34414d;
  border-radius: 3px;
  background: #121a22;
  color: var(--text);
}

button.game-system-option {
  cursor: pointer;
}

button.game-system-option:hover {
  border-color: var(--accent-strong);
  background: #16232c;
}

.game-system-option.selected {
  border-color: var(--accent-strong);
  box-shadow: inset 4px 0 0 var(--accent-strong);
  background: #15222b;
}

.game-system-option strong {
  display: block;
  margin-top: 20px;
  font-size: 1.12rem;
}

.game-system-option small {
  display: block;
  margin-top: 7px;
  color: #8f9eaa;
  line-height: 1.45;
}

.game-system-option.disabled {
  opacity: .48;
  background: #0d1217;
}

.game-system-status {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 3px 6px;
  border: 1px solid #3c4650;
  border-radius: 2px;
  color: #8996a1;
  font-size: .57rem;
  font-weight: 900;
  letter-spacing: .09em;
}

.game-system-status.live {
  border-color: #33778a;
  color: #86d9ea;
}

.settings-game-card {
  max-width: 900px;
}

.settings-current-game {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #29343e;
}

.settings-current-game strong {
  font-size: 1.04rem;
}

.settings-game-grid {
  margin-top: 14px;
}

@media (max-width: 680px) {
  .game-system-modal {
    align-items: end;
    padding: 8px;
  }

  .game-system-card {
    max-height: calc(100dvh - 16px);
    overflow-y: auto;
    padding: 20px 14px 14px;
  }

  .game-system-grid {
    grid-template-columns: 1fr;
    gap: 7px;
    margin-top: 18px;
  }

  .game-system-option {
    min-height: 112px;
    padding: 14px;
  }

  .game-system-option strong {
    margin-top: 16px;
  }
}


/* === Provider catalogue === */
.game-system-card {
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
}

.game-catalogue {
  margin-top: 22px;
}

.game-provider-tabs {
  display: flex;
  gap: 0;
  overflow-x: auto;
  border-bottom: 1px solid #35414c;
  scrollbar-width: thin;
}

.game-provider-tab {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 17px;
  border: 0;
  border-right: 1px solid #26313a;
  border-radius: 0;
  background: #0d1319;
  color: #83919d;
  font: inherit;
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
}

.game-provider-tab:hover {
  background: #151e26;
  color: #dce7ec;
}

.game-provider-tab.active {
  box-shadow: inset 0 -3px 0 var(--accent-strong);
  background: #17232c;
  color: #dff8ff;
}

.game-provider-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-top: 17px;
}

.game-provider-heading small {
  color: #72818d;
  font-size: .68rem;
}

.settings-game-card {
  max-width: 1120px;
}

.settings-game-catalogue {
  margin-top: 14px;
}

.settings-game-catalogue .game-system-grid {
  grid-template-columns: repeat(3, minmax(0,1fr));
}

/* === Age of Sigmar warscroll presentation === */
.aos-weapon-table {
  min-width: 940px;
}

.aos-weapon-ability {
  min-width: 180px;
  text-align: left !important;
  color: #c4d1d8 !important;
  line-height: 1.35;
}

.aos-ability-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.aos-ability-heading h4 {
  margin: 0;
}

.aos-ability-heading > span {
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 1px solid #3b5360;
  border-radius: 2px;
  color: #8fd3e3;
  font-size: .61rem;
  font-weight: 850;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.aos-ability-fields {
  display: grid;
  gap: 0;
  border-top: 1px solid #27323c;
}

.aos-ability-field {
  display: grid;
  grid-template-columns: 135px minmax(0,1fr);
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid #27323c;
}

.aos-ability-field:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.aos-ability-field > strong {
  color: #81929f;
  font-size: .68rem;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.aos-ability-field .ability-text {
  max-width: none;
  font-size: .9rem;
  line-height: 1.5;
}

@media (max-width: 760px) {
  .game-system-modal {
    align-items: stretch;
  }

  .game-system-card {
    max-height: calc(100dvh - 16px);
  }

  .game-provider-tabs {
    margin-inline: -14px;
    padding-inline: 14px;
  }

  .game-provider-tab {
    min-height: 42px;
    padding-inline: 13px;
    font-size: .65rem;
  }

  .game-provider-heading {
    margin-top: 14px;
  }

  .settings-game-catalogue .game-system-grid {
    grid-template-columns: 1fr;
  }

  .aos-weapon-table {
    min-width: 0;
  }

  .aos-weapon-table .aos-weapon-ability {
    grid-column: 1 / -1;
    min-width: 0;
    padding-top: 9px !important;
    border-top: 1px solid #25303f !important;
    font-size: .75rem !important;
    line-height: 1.35 !important;
  }

  .aos-ability-heading {
    gap: 8px;
  }

  .aos-ability-field {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .aos-ability-field .ability-text {
    font-size: .84rem;
  }
}


/* === System-specific setup widths === */
body.game-aos .setup-import-grid {
  grid-template-columns: minmax(0, 830px);
}

body.game-aos .setup-import-card {
  width: 100%;
}

@media (max-width: 760px) {
  body.game-aos .setup-import-grid {
    grid-template-columns: 1fr;
  }
}


/* === Grimdark Future: Warfleets === */
.warfleets-weapon-table {
  min-width: 760px;
}

.warfleets-weapon-table th:nth-child(2),
.warfleets-weapon-table td:nth-child(2) {
  width: 82px;
}

.warfleets-weapon-table th:nth-child(3),
.warfleets-weapon-table td:nth-child(3) {
  width: 100px;
}

.warfleets-weapon-table th:nth-child(4),
.warfleets-weapon-table td:nth-child(4),
.warfleets-weapon-table th:nth-child(5),
.warfleets-weapon-table td:nth-child(5) {
  width: 70px;
}

.warfleet-facing {
  text-align: center !important;
  font-weight: 800;
  letter-spacing: .06em;
}

@media (max-width: 760px) {
  .warfleets-weapon-table {
    min-width: 0;
  }

  .warfleets-weapon-table .opr-weapon-special {
    grid-column: 1 / -1;
    min-width: 0;
    padding-top: 9px;
    border-top: 1px solid #25303f !important;
  }
}


/* === Horus Heresy 3rd Edition === */
body.game-heresy .setup-import-grid {
  grid-template-columns: minmax(0, 830px);
}

body.game-heresy .setup-import-card {
  width: 100%;
}

.heresy-weapon-table {
  min-width: 980px;
}

.heresy-weapon-table th:nth-last-child(-n+2),
.heresy-weapon-table td:nth-last-child(-n+2) {
  min-width: 190px;
  text-align: left;
}

.heresy-weapon-text {
  color: #c4d1d8 !important;
  line-height: 1.4;
}

@media (max-width: 760px) {
  body.game-heresy .setup-import-grid {
    grid-template-columns: 1fr;
  }

  .heresy-weapon-table {
    min-width: 0;
  }

  .heresy-weapon-table .heresy-weapon-text {
    grid-column: 1 / -1;
    min-width: 0;
    padding-top: 9px;
    border-top: 1px solid #25303f !important;
  }
}


.heresy-profile-table {
  min-width: 1180px;
}

.heresy-component-table {
  min-width: 820px;
}

.heresy-component-table th:not(:first-child),
.heresy-component-table td:not(:first-child) {
  min-width: 92px;
}

@media (max-width: 760px) {
  .heresy-profile-table,
  .heresy-component-table {
    min-width: 760px;
  }
}


/* === Kill Team 2024 === */
body.game-kill-team .setup-import-grid {
  grid-template-columns: minmax(0, 830px);
}

body.game-kill-team .setup-import-card {
  width: 100%;
}

.kill-team-weapon-table {
  min-width: 760px;
}

.kill-team-weapon-table th:nth-child(2),
.kill-team-weapon-table td:nth-child(2),
.kill-team-weapon-table th:nth-child(3),
.kill-team-weapon-table td:nth-child(3),
.kill-team-weapon-table th:nth-child(4),
.kill-team-weapon-table td:nth-child(4) {
  width: 90px;
}

.kill-team-weapon-table th:last-child,
.kill-team-weapon-table td:last-child {
  min-width: 300px;
  text-align: left;
}

.kill-team-weapon-rules {
  color: #c4d1d8 !important;
  line-height: 1.4;
}

body.game-kill-team .stat-grid {
  grid-template-columns: repeat(4, minmax(100px, 1fr));
}

@media (max-width: 760px) {
  body.game-kill-team .setup-import-grid {
    grid-template-columns: 1fr;
  }

  body.game-kill-team .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kill-team-weapon-table {
    min-width: 0;
  }

  .kill-team-weapon-table .kill-team-weapon-rules {
    grid-column: 1 / -1;
    min-width: 0;
    padding-top: 9px;
    border-top: 1px solid #25303f !important;
  }
}


/* === Legions Imperialis === */
body.game-legions-imperialis .setup-import-grid {
  grid-template-columns: minmax(0, 830px);
}

body.game-legions-imperialis .setup-import-card {
  width: 100%;
}

body.game-legions-imperialis .stat-grid {
  grid-template-columns: repeat(5, minmax(92px, 1fr));
}

.legions-imperialis-profile-table,
.legions-imperialis-weapon-table {
  min-width: 760px;
}

.legions-imperialis-profile-table th:not(:first-child),
.legions-imperialis-profile-table td:not(:first-child) {
  width: 100px;
}

.legions-imperialis-weapon-table th:nth-child(2),
.legions-imperialis-weapon-table td:nth-child(2),
.legions-imperialis-weapon-table th:nth-child(3),
.legions-imperialis-weapon-table td:nth-child(3),
.legions-imperialis-weapon-table th:nth-child(4),
.legions-imperialis-weapon-table td:nth-child(4),
.legions-imperialis-weapon-table th:nth-child(5),
.legions-imperialis-weapon-table td:nth-child(5) {
  width: 92px;
}

.legions-imperialis-weapon-table th:last-child,
.legions-imperialis-weapon-table td:last-child {
  min-width: 260px;
  text-align: left;
}

.legions-imperialis-traits {
  color: #c4d1d8 !important;
  line-height: 1.4;
}

@media (max-width: 760px) {
  body.game-legions-imperialis .setup-import-grid {
    grid-template-columns: 1fr;
  }

  body.game-legions-imperialis .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .legions-imperialis-profile-table,
  .legions-imperialis-weapon-table {
    min-width: 0;
  }

  .legions-imperialis-weapon-table .legions-imperialis-traits {
    grid-column: 1 / -1;
    min-width: 0;
    padding-top: 9px;
    border-top: 1px solid #25303f !important;
  }
}


/* === Legions Imperialis community imports === */
.li-community-import-controls {
  display: grid;
  gap: 10px;
}

.li-community-import-controls textarea {
  width: 100%;
  min-width: 0;
  min-height: 150px;
  padding: 12px;
  border: 1px solid #354350;
  border-radius: 3px;
  outline: 0;
  resize: vertical;
  background: #0b1015;
  color: #edf3f6;
  font: inherit;
  font-size: 15px;
  line-height: 1.4;
}

.li-community-import-controls textarea:focus {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 2px rgba(57,184,213,.12);
}

.li-community-import-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

@media (max-width: 620px) {
  .li-community-import-actions {
    grid-template-columns: 1fr;
  }
}


/* === Necromunda N26 === */
body.game-necromunda .setup-import-grid {
  grid-template-columns: minmax(0, 830px);
}

body.game-necromunda .setup-import-card {
  width: 100%;
}

.necromunda-import-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}

.necromunda-import-controls input {
  width: 100%;
  min-width: 0;
  min-height: 50px;
  padding: 0 12px;
  border: 1px solid #354350;
  border-radius: 3px;
  outline: 0;
  background: #0b1015;
  color: #edf3f6;
  font: inherit;
  font-size: 16px;
}

.necromunda-import-controls input:focus {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 2px rgba(57,184,213,.12);
}

body.game-necromunda .stat-grid {
  grid-template-columns: repeat(6, minmax(82px, 1fr));
}

body.game-necromunda .stat {
  padding: 11px;
}

.necromunda-campaign-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.necromunda-campaign-row {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  padding: 10px 12px;
}

.necromunda-campaign-row span {
  color: var(--muted);
  font-size: .76rem;
}

.necromunda-campaign-row strong {
  min-width: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

.necromunda-weapon-table {
  min-width: 860px;
}

.necromunda-weapon-table th:nth-child(2),
.necromunda-weapon-table td:nth-child(2),
.necromunda-weapon-table th:nth-child(3),
.necromunda-weapon-table td:nth-child(3),
.necromunda-weapon-table th:nth-child(4),
.necromunda-weapon-table td:nth-child(4),
.necromunda-weapon-table th:nth-child(5),
.necromunda-weapon-table td:nth-child(5),
.necromunda-weapon-table th:nth-child(6),
.necromunda-weapon-table td:nth-child(6) {
  width: 72px;
}

.necromunda-weapon-table th:last-child,
.necromunda-weapon-table td:last-child {
  min-width: 260px;
  text-align: left;
}

.necromunda-weapon-traits {
  color: #c4d1d8 !important;
  line-height: 1.4;
}

@media (max-width: 760px) {
  body.game-necromunda .setup-import-grid,
  .necromunda-import-controls {
    grid-template-columns: 1fr;
  }

  body.game-necromunda .stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
  }

  body.game-necromunda .stat {
    padding: 9px;
  }

  .necromunda-weapon-table {
    min-width: 0;
  }

  .necromunda-weapon-table .necromunda-weapon-traits {
    grid-column: 1 / -1;
    min-width: 0;
    padding-top: 9px;
    border-top: 1px solid #25303f !important;
  }
}

@media (max-width: 440px) {
  body.game-necromunda .stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}


.dnd-roll-modal {
  position: fixed;
  inset: 0;
  z-index: 160;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(3,6,10,.9);
  backdrop-filter: blur(14px);
}

.dnd-roll-card {
  position: relative;
  width: min(720px, 100%);
  min-height: min(620px, 78vh);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  padding: clamp(34px, 7vw, 72px);
  border: 1px solid #43606c;
  border-radius: 5px;
  background:
    radial-gradient(circle at 50% 35%, rgba(57,184,213,.12), transparent 42%),
    linear-gradient(180deg, #111a21, #0a0f14);
  box-shadow: 0 36px 120px rgba(0,0,0,.72);
  text-align: center;
  overflow: hidden;
}

.dnd-roll-card::before,
.dnd-roll-card::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(92,202,224,.12);
  pointer-events: none;
}

.dnd-roll-card::after {
  inset: 22px;
  border-color: rgba(255,255,255,.04);
}

.dnd-roll-modal.celebrate .dnd-roll-card {
  animation: dndRollReveal .32s cubic-bezier(.2,.9,.2,1);
}

@keyframes dndRollReveal {
  from {
    opacity: 0;
    transform: scale(.86);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.dnd-roll-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border: 1px solid #3b4c58;
  border-radius: 3px;
  background: #10171d;
  color: #a8b8c1;
  font: inherit;
  font-size: 1.45rem;
  cursor: pointer;
}

.dnd-roll-eyebrow {
  position: relative;
  z-index: 1;
  color: #70d3e7;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .18em;
}

.dnd-roll-card h2 {
  position: relative;
  z-index: 1;
  max-width: 580px;
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  line-height: 1.08;
}

.dnd-roll-total {
  position: relative;
  z-index: 1;
  margin: 4px 0;
  font-size: clamp(5.5rem, 18vw, 11rem);
  font-weight: 950;
  line-height: .85;
  letter-spacing: -.065em;
  color: #f5fdff;
  text-shadow:
    0 0 28px rgba(81,206,231,.2),
    0 5px 0 rgba(0,0,0,.34);
}

.dnd-roll-subtitle {
  position: relative;
  z-index: 1;
  color: #b8c9d1;
  font-size: clamp(.9rem, 2.5vw, 1.15rem);
  font-weight: 750;
}

.dnd-roll-breakdown {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 5px;
  max-width: 620px;
  color: #91a8b3;
  font-size: .84rem;
  line-height: 1.4;
}

.dnd-roll-done {
  position: relative;
  z-index: 1;
  min-width: 190px;
  margin-top: 8px;
}

@media (max-width: 760px) {
  .dnd-roll-card {
    min-height: min(560px, 82vh);
    padding: 34px 20px;
  }

  .dnd-roll-total {
    font-size: clamp(5rem, 30vw, 8.5rem);
  }
}

/* === D&D 5e / D&D Beyond === */
body.game-dnd .setup-import-grid {
  grid-template-columns: minmax(0, 830px);
}

body.game-dnd .setup-import-card {
  width: 100%;
}

.dnd-beyond-import-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.dnd-beyond-import-controls > input {
  grid-column: 1 / -1;
}

.dnd-beyond-import-controls input,
.dnd-inventory-add input {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid #354350;
  border-radius: 3px;
  outline: 0;
  background: #0b1015;
  color: #edf3f6;
  font: inherit;
  font-size: 16px;
}

.dnd-beyond-import-controls input:focus,
.dnd-inventory-add input:focus {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 2px rgba(57,184,213,.12);
}

body.game-dnd .stat-grid {
  grid-template-columns: repeat(6, minmax(90px, 1fr));
}

.dnd-rest-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 10px;
  padding: 9px 10px 9px 12px;
  border: 1px solid #303c46;
  border-left: 3px solid var(--accent-strong);
  border-radius: 3px;
  background: #0f171d;
}

.dnd-rest-bar > div:first-child {
  display: grid;
  gap: 1px;
}

.dnd-rest-bar > div:first-child span {
  color: #758894;
  font-size: .6rem;
  font-weight: 850;
  letter-spacing: .1em;
}

.dnd-rest-bar > div:first-child strong {
  font-size: .82rem;
}

.dnd-rest-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.dnd-action-controls {
  display: flex;
  align-items: flex-end;
  gap: 7px;
}

.dnd-cast-level {
  display: grid;
  gap: 3px;
}

.dnd-cast-level > span {
  color: #8295a2;
  font-size: .57rem;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.dnd-cast-level select {
  min-height: 32px;
  padding: 0 26px 0 8px;
  border: 1px solid #3a4a56;
  border-radius: 3px;
  background: #0d151b;
  color: #e2ebef;
  font: inherit;
  font-size: .72rem;
}

.dnd-list-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 9px;
  padding: 7px 8px 7px 10px;
  border: 1px solid #31414c;
  background: #111c23;
  color: #92a5b0;
  font-size: .72rem;
}

.dnd-list-filter strong {
  color: #d9eef3;
}

.dnd-mini-tabs {
  display: flex;
  gap: 6px;
  margin: 0 0 10px;
  padding: 5px;
  border: 1px solid #303c46;
  border-radius: 4px;
  background: #0c1217;
  overflow-x: auto;
  scrollbar-width: thin;
}

.dnd-mini-tab {
  flex: 0 0 auto;
  min-height: 35px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: #8e9da7;
  font: inherit;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .035em;
  cursor: pointer;
}

.dnd-mini-tab:hover {
  background: #131d24;
  color: #dbe6eb;
}

.dnd-mini-tab.active {
  border-color: #3d6672;
  background: #15242b;
  color: #dbf5fa;
  box-shadow: inset 0 -2px 0 var(--accent-strong);
}

.dnd-tab-panel.hidden {
  display: none;
}

.dnd-tab-panel {
  min-height: 120px;
}

.dnd-ability-section .section-heading-row,
.dnd-economy-section .section-heading-row,
.dnd-slot-section .section-heading-row,
.dnd-actions-section .section-heading-row,
.dnd-inventory-section .section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.dnd-ability-section .section-heading-row h3,
.dnd-economy-section .section-heading-row h3,
.dnd-slot-section .section-heading-row h3,
.dnd-actions-section .section-heading-row h3,
.dnd-inventory-section .section-heading-row h3 {
  margin: 0;
}

.dnd-actions-section .section-count,
.dnd-inventory-section .section-count {
  color: #80909b;
  font-size: .7rem;
  font-weight: 800;
}

.dnd-ability-grid,
.dnd-economy-grid,
.dnd-slot-grid {
  display: grid;
  gap: 8px;
}

.dnd-skills-section .section-heading-row small,
.dnd-ability-section .section-heading-row small {
  color: #7f919c;
  font-size: .68rem;
}

.dnd-skill-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.dnd-skill-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 52px;
  padding: 8px 10px;
  border: 1px solid #33414d;
  border-radius: 3px;
  background: #101820;
  color: #dbe5ea;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.dnd-skill-row:hover,
.dnd-ability:hover {
  border-color: #46606d;
  background: #14212a;
}

.dnd-skill-row > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.dnd-skill-row > div strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .78rem;
}

.dnd-skill-row > div small {
  color: #7e909c;
  font-size: .61rem;
  letter-spacing: .035em;
  text-transform: uppercase;
}

.dnd-skill-row > span {
  color: #cfeef4;
  font-size: .9rem;
  font-weight: 850;
}

.dnd-skill-row em,
.dnd-ability em {
  position: absolute;
  right: 5px;
  top: 4px;
  min-width: 21px;
  padding: 2px 4px;
  border-radius: 999px;
  background: var(--accent-strong);
  color: #071014;
  font-size: .6rem;
  font-style: normal;
  font-weight: 900;
  text-align: center;
}

.dnd-skill-row.rolled,
.dnd-ability.rolled {
  border-color: var(--accent-strong);
  box-shadow: inset 0 0 0 1px rgba(57,184,213,.12);
}

.dnd-check-result {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  padding: 8px 10px;
  border-left: 3px solid var(--accent-strong);
  background: #14222a;
}

.dnd-check-result small {
  color: #91a7b1;
}


.dnd-ability-grid {
  grid-template-columns: repeat(6, minmax(80px, 1fr));
}

.dnd-ability {
  position: relative;
  display: grid;
  place-items: center;
  gap: 2px;
  min-height: 82px;
  border: 1px solid #34414d;
  border-radius: 3px;
  background: #101820;
  color: #dbe5ea;
  padding: 10px;
  font: inherit;
  cursor: pointer;
}

.dnd-ability span,
.dnd-slot-card > span {
  color: #8494a2;
  font-size: .67rem;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.dnd-ability strong {
  font-size: 1.2rem;
}

.dnd-ability small {
  color: #9bc7d2;
  font-weight: 800;
}

.dnd-economy-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dnd-economy-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid #354350;
  border-radius: 3px;
  background: #111920;
  color: #dce5ea;
  font: inherit;
  cursor: pointer;
}

.dnd-economy-button strong {
  color: #78d2e5;
  font-size: .67rem;
  letter-spacing: .08em;
}

.dnd-economy-button.used {
  opacity: .62;
  background: #191518;
}

.dnd-economy-button.used strong {
  color: #e7959d;
}

.dnd-slot-grid {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.dnd-slot-card {
  display: grid;
  gap: 7px;
  border: 1px solid #34414d;
  background: #101820;
  padding: 10px 12px;
}

.dnd-slot-card > strong {
  font-size: 1.2rem;
}

.dnd-slot-card > div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.dnd-slot-card button,
.dnd-inventory-quantity button {
  min-height: 32px;
  border: 1px solid #394957;
  background: #131d25;
  color: #e7eef1;
  font: inherit;
  cursor: pointer;
}

.dnd-action-list,
.dnd-inventory-list {
  display: grid;
  gap: 8px;
}

.dnd-action-card {
  border: 1px solid #33414c;
  border-left: 3px solid #425564;
  background: #10171e;
  padding: 14px;
}

.dnd-action-card.focused {
  border-color: var(--accent-strong);
  border-left-width: 4px;
  box-shadow: 0 0 0 1px rgba(57,184,213,.12);
}

.dnd-action-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.dnd-action-heading span {
  color: #8295a2;
  font-size: .62rem;
  font-weight: 850;
  letter-spacing: .1em;
}

.dnd-action-heading h4 {
  margin: 3px 0 0;
  font-size: 1rem;
}

.dnd-action-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.dnd-action-meta span {
  padding: 4px 7px;
  border: 1px solid #354652;
  background: #14202a;
  color: #b9c8d0;
  font-size: .69rem;
}

.dnd-action-description {
  margin-top: 11px;
  color: #aebbc3;
  font-size: .86rem;
  line-height: 1.48;
}

.dnd-derived-note {
  display: block;
  margin-top: 8px;
  color: #788895;
}

.dnd-roll-result {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 12px;
  padding: 9px 10px;
  border-left: 3px solid var(--accent-strong);
  background: #14222a;
}

.dnd-roll-result strong {
  color: #e8f8fb;
}

.dnd-roll-result small {
  color: #9ab1bb;
}

.dnd-inventory-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 10px;
}

.dnd-inventory-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 48px;
  border-bottom: 1px solid #29343e;
  padding: 7px 0;
}

.dnd-inventory-row > div:first-child {
  display: grid;
  gap: 2px;
}

.dnd-inventory-row small {
  color: #82919c;
}

.dnd-inventory-quantity {
  display: grid;
  grid-template-columns: 34px 34px 34px;
  align-items: center;
  text-align: center;
}

@media (max-width: 760px) {
  body.game-dnd .setup-import-grid,
  .dnd-beyond-import-controls {
    grid-template-columns: 1fr;
  }

  body.game-dnd .stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dnd-ability-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .dnd-rest-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .dnd-rest-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dnd-rest-actions .ghost-button {
    padding-inline: 7px;
    font-size: .68rem;
  }

  .dnd-mini-tabs {
    margin-inline: -2px;
  }

  .dnd-mini-tab {
    min-height: 38px;
    padding-inline: 12px;
  }

  .dnd-economy-grid {
    grid-template-columns: 1fr;
  }

  .dnd-action-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .dnd-action-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .dnd-cast-level select,
  .dnd-action-heading .primary-button {
    width: 100%;
  }

  .dnd-roll-result,
  .dnd-inventory-row {
    align-items: stretch;
    flex-direction: column;
  }
}


/* Unit nickname editor */
.nickname-toggle.active {
  border-color: rgba(86, 214, 164, .72);
}

.nickname-card {
  width: min(520px, calc(100vw - 28px));
}

.nickname-field {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.nickname-field > span {
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .72;
}

.nickname-field input {
  width: 100%;
  box-sizing: border-box;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-strong, var(--panel));
  color: inherit;
  padding: 0 14px;
  font: inherit;
  font-size: 1rem;
}

.nickname-field input:focus {
  outline: 2px solid rgba(105, 176, 255, .38);
  outline-offset: 1px;
}

.nickname-help {
  margin: 10px 0 0;
  opacity: .72;
  line-height: 1.45;
}

.nickname-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

@media (max-width: 620px) {
  .unit-top-statuses {
    flex-wrap: wrap;
  }

  .nickname-actions > button {
    flex: 1 1 150px;
  }
}


/* Warhammer: The Old World */
.old-world-unit-meta {
  margin-top: .25rem;
}

.old-world-weapon-table .old-world-weapon-text {
  min-width: 11rem;
  white-space: normal;
  line-height: 1.35;
}

.old-world-spell-card .dnd-action-meta {
  margin: .5rem 0 .75rem;
  flex-wrap: wrap;
}

@media (max-width: 720px) {
  .old-world-weapon-table .old-world-weapon-text {
    min-width: 0;
  }
}


/* Trench Crusade */
.trench-crusade-profile-table .trench-crusade-profile-text {
  min-width: 11rem;
  white-space: normal;
  line-height: 1.4;
}

.trench-crusade-cost-grid {
  margin-top: .25rem;
}

body.game-trench-crusade .roster-unit-points {
  white-space: nowrap;
}

@media (max-width: 720px) {
  .trench-crusade-profile-table .trench-crusade-profile-text {
    min-width: 0;
  }
}


/* OPR compact list tabs + quick rule lookup */
body.game-opr .roster-mini-tabs .roster-tab {
  max-width: 180px;
}

body.game-opr .roster-mini-tabs .roster-tab strong,
body.game-opr .roster-mini-tabs .roster-tab small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.opr-rule-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 0 2px;
}

.opr-unit-rule-chip,
.opr-weapon-rule-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid #365060;
  border-radius: 999px;
  background: #101923;
  color: #d8e7ef;
  font: inherit;
  font-size: .7rem;
  font-weight: 800;
  line-height: 1.1;
}

button.opr-weapon-rule-chip {
  cursor: pointer;
}

button.opr-weapon-rule-chip:hover,
button.opr-weapon-rule-chip.active {
  border-color: var(--accent-strong);
  background: rgba(56,189,248,.12);
  color: #eefbff;
}

.opr-weapon-rule-chip.static {
  cursor: default;
  opacity: .9;
}

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

.opr-weapon-rule-detail {
  margin-top: 8px;
  padding: 9px 10px;
  border: 1px solid #304252;
  border-radius: 8px;
  background: #0d151d;
  color: #c9d5dc;
  font-size: .72rem;
  line-height: 1.45;
}

.opr-weapon-rule-detail > strong {
  display: block;
  margin-bottom: 4px;
  color: #eef7fb;
}

@media (max-width: 760px) {
  body.game-opr .roster-mini-tabs .roster-tab {
    max-width: 150px;
    min-width: 132px;
  }

  .opr-rule-summary {
    padding-top: 8px;
  }

  .opr-unit-rule-chip,
  .opr-weapon-rule-chip {
    min-height: 28px;
    padding: 4px 8px;
    font-size: .66rem;
  }
}


/* OPR rule popup */
.opr-rule-summary {
  display: grid;
  gap: 7px;
  padding: 12px 0 4px;
}

.opr-rule-summary-label {
  color: #93a6b3;
  font-size: .62rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.opr-rule-summary-chips,
.opr-weapon-rule-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.opr-unit-rule-chip {
  min-height: 34px;
  padding: 6px 11px;
  border-color: #4f788c;
  background: rgba(56,189,248,.13);
  color: #f2fbff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.025);
}

button.opr-unit-rule-chip,
button.opr-weapon-rule-chip {
  cursor: pointer;
}

button.opr-unit-rule-chip:hover,
button.opr-unit-rule-chip:focus-visible,
button.opr-weapon-rule-chip:hover,
button.opr-weapon-rule-chip:focus-visible {
  border-color: var(--accent-strong);
  background: rgba(56,189,248,.22);
  outline: none;
}

.opr-unit-rule-chip.static,
.opr-weapon-rule-chip.static {
  cursor: default;
}

.opr-rule-modal {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(3,7,11,.82);
  backdrop-filter: blur(8px);
}

.opr-rule-modal-card {
  width: min(620px, 100%);
  max-height: min(78vh, 680px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #3a5061;
  border-radius: 18px;
  background: #111922;
  box-shadow: 0 24px 80px rgba(0,0,0,.48);
}

.opr-rule-modal-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid #2c3947;
}

.opr-rule-modal-heading h2 {
  margin: 3px 0 0;
  font-size: 1.35rem;
  line-height: 1.15;
}

.opr-rule-modal-close {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
}

.opr-rule-modal-text {
  overflow-y: auto;
  padding: 18px;
  color: #d5dfe6;
  font-size: .94rem;
  line-height: 1.6;
}

.opr-rule-modal-text p {
  margin: 0 0 12px;
}

.opr-rule-modal-text p:last-child,
.opr-rule-modal-text ul:last-child {
  margin-bottom: 0;
}

.opr-rule-modal-done {
  margin: 0 18px 18px;
  min-height: 46px;
}

body.rule-modal-open {
  overflow: hidden;
}

@media (max-width: 760px) {
  .opr-rule-modal {
    align-items: center;
    justify-items: center;
    padding: 14px;
  }

  .opr-rule-modal-card {
    width: 100%;
    max-height: 76vh;
    border-radius: 18px;
  }

  .opr-rule-modal-heading {
    padding: 16px 16px 12px;
  }

  .opr-rule-modal-heading h2 {
    font-size: 1.25rem;
  }

  .opr-rule-modal-text {
    padding: 16px;
    font-size: .94rem;
    line-height: 1.55;
  }

  .opr-rule-modal-done {
    margin: 0 16px 16px;
    width: calc(100% - 32px);
  }

  .opr-unit-rule-chip {
    min-height: 32px;
    padding: 6px 10px;
    font-size: .69rem;
  }
}


/* Compact All data tab + universal unit tracker */
@media (max-width: 760px) {
  .roster-mini-tabs {
    width: 100%;
  }

  .roster-mini-tabs .roster-tab {
    flex: 1 0 36%;
    min-width: 118px;
    max-width: none;
  }

  .roster-mini-tabs .roster-tab-all-data {
    flex: 0 0 24%;
    min-width: 72px;
    max-width: 92px;
    align-content: center;
    justify-items: center;
    text-align: center;
  }

  body.game-opr .roster-mini-tabs .roster-tab {
    max-width: none;
    min-width: 118px;
  }

  body.game-opr .roster-mini-tabs .roster-tab-all-data {
    min-width: 72px;
    max-width: 92px;
  }
}

.unit-health-tracker {
  border: 1px solid #344452;
  border-left: 4px solid var(--accent-strong);
  border-radius: 4px;
  background: #111922;
  overflow: hidden;
}

.unit-health-tracker.is-zero {
  border-left-color: #7b8790;
  opacity: .82;
}

.unit-tracker-heading {
  margin: 0;
  padding: 11px 12px;
  border-bottom: 1px solid #2e3b47;
}

.unit-tracker-heading > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.unit-tracker-heading h3 {
  margin: 0;
  font-size: .82rem;
  letter-spacing: .02em;
}

.unit-tracker-heading small {
  color: #7f909e;
  font-size: .62rem;
  line-height: 1.25;
}

.unit-tracker-reset {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid #3b4c59;
  border-radius: 4px;
  background: #17212a;
  color: #97a9b5;
  font: inherit;
  font-size: .66rem;
  font-weight: 850;
  cursor: pointer;
}

.unit-tracker-body {
  display: grid;
}

.unit-tracker-row {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
}

.unit-tracker-row + .unit-tracker-row {
  border-top: 1px solid #293743;
}

.unit-tracker-row-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.unit-tracker-row-copy strong {
  color: #edf5f8;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.unit-tracker-row-copy small {
  color: #7f909e;
  font-size: .61rem;
  line-height: 1.2;
}

.unit-tracker-controls {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 38px minmax(72px, auto) 38px;
  align-items: stretch;
  gap: 5px;
}

.unit-tracker-step {
  min-height: 40px;
  border: 1px solid #3b4c59;
  border-radius: 4px;
  background: #17212a;
  color: #edf4f7;
  font: inherit;
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.unit-tracker-step:hover,
.unit-tracker-step:focus-visible,
.unit-tracker-reset:hover,
.unit-tracker-reset:focus-visible {
  border-color: var(--accent-strong);
  outline: none;
}

.unit-tracker-value {
  min-width: 72px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 3px 8px;
  border: 1px solid #4b6170;
  border-radius: 4px;
  background: #0c1319;
}

.unit-tracker-value input {
  width: 44px;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #f7fbfd;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 900;
  text-align: right;
  -moz-appearance: textfield;
}

.unit-tracker-value input::-webkit-outer-spin-button,
.unit-tracker-value input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.unit-tracker-value small {
  color: #78909e;
  font-size: .67rem;
  font-weight: 800;
  white-space: nowrap;
}

@media (max-width: 520px) {
  .unit-tracker-heading {
    padding: 9px 10px;
  }

  .unit-tracker-row {
    gap: 8px;
    padding: 9px 10px;
  }

  .unit-tracker-row-copy strong {
    font-size: .66rem;
  }

  .unit-tracker-row-copy small {
    font-size: .56rem;
  }

  .unit-tracker-controls {
    grid-template-columns: 34px minmax(62px, auto) 34px;
    gap: 4px;
  }

  .unit-tracker-step,
  .unit-tracker-value {
    min-height: 38px;
  }

  .unit-tracker-value {
    min-width: 62px;
    padding-inline: 5px;
  }

  .unit-tracker-value input {
    width: 36px;
    font-size: 1rem;
  }
}


/* Keep roster tab titles inside their cards */
.roster-mini-tabs .roster-tab {
  min-width: 0;
  max-width: 220px;
}

.roster-mini-tabs .roster-tab strong {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .roster-mini-tabs .roster-tab {
    max-width: none;
  }

  .roster-mini-tabs .roster-tab strong {
    width: 100%;
  }
}


/* OPR in-game state + mission tracking */
.roster-browser-tools {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.opr-round-control {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto 30px auto;
  align-items: center;
  gap: 5px;
  padding: 6px 7px;
  border: 1px solid #2d3b4d;
  border-radius: 11px;
  background: #101720;
}

.opr-round-control > span {
  color: #8798aa;
  font-size: .62rem;
  font-weight: 900;
  letter-spacing: .08em;
}

.opr-round-control > strong {
  min-width: 26px;
  text-align: center;
  font-size: 1.05rem;
}

.opr-round-control > button {
  min-height: 30px;
  border: 1px solid #3a7187;
  border-radius: 8px;
  background: rgba(56,189,248,.10);
  color: var(--accent);
  padding: 0 9px;
  font-size: .68rem;
  font-weight: 850;
}

.opr-unit-state-controls {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.unit-state-toggle {
  min-height: 38px;
  border: 1px solid #3b4c59;
  border-radius: 6px;
  background: #17212a;
  color: #9aabb8;
  padding: 0 10px;
  font-size: .68rem;
  font-weight: 900;
}

.unit-state-toggle.activated.active {
  border-color: #56849a;
  background: rgba(56,189,248,.14);
  color: #bcefff;
}

.unit-state-toggle.shaken.active {
  border-color: #a66b50;
  background: rgba(255,143,92,.13);
  color: #ffc6a8;
}

.unit-state-toggle.new-round {
  border-color: #3b5867;
  color: #bdd3de;
}

.roster-unit-side {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  flex-wrap: wrap;
}

.opr-state-badge {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 6px;
  border: 1px solid #40505f;
  border-radius: 999px;
  font-size: .52rem !important;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.opr-state-badge.activated {
  border-color: #46545f;
  color: #8796a3;
  background: #1a2128;
}

.opr-state-badge.shaken {
  border-color: #825641;
  color: #ffc2a1;
  background: rgba(255,143,92,.08);
}

.roster-unit-button.opr-ready {
  border-color: #31536a;
  background: #14212c;
}

.roster-unit-button.opr-activated,
.result-item.opr-activated {
  border-color: #323b45;
  background: #15191e;
  color: #8997a5;
}

.roster-unit-button.opr-activated .roster-unit-copy,
.result-item.opr-activated > strong {
  opacity: .66;
}

.roster-unit-button.opr-shaken,
.result-item.opr-shaken {
  border-color: #754d3c;
  box-shadow: inset 3px 0 0 rgba(255,143,92,.55);
}

.opr-mission-toolbar {
  display: flex;
  align-items: stretch;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 14px;
}

.opr-mission-round,
.opr-objective-count {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 9px 12px;
}

.opr-mission-round > span,
.opr-objective-count > span {
  color: #8798aa;
  font-size: .64rem;
  font-weight: 900;
  letter-spacing: .08em;
}

.opr-mission-round > strong {
  min-width: 28px;
  text-align: center;
  font-size: 1.3rem;
}

.opr-objective-count select {
  min-height: 35px;
  border: 1px solid #35465a;
  border-radius: 8px;
  background: #0d141c;
  color: var(--text);
  padding: 0 30px 0 10px;
}

.opr-mission-card,
.opr-bonus-card {
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(17,21,27,.92);
  padding: 16px;
}

.opr-mission-card-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.opr-mission-card-heading h2,
.opr-bonus-card h2 {
  margin: 4px 0 0;
  font-size: 1.1rem;
}

.opr-mission-card-heading small,
.opr-bonus-card p,
.opr-mission-note {
  color: #8999aa;
  font-size: .72rem;
  line-height: 1.45;
}

.opr-objective-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(145px,1fr));
  gap: 8px;
}

.opr-objective {
  min-height: 94px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  border: 1px solid #344253;
  border-radius: 13px;
  background: #121922;
  color: var(--text);
}

.opr-objective span,
.opr-objective small {
  color: #7f90a2;
  font-size: .58rem;
  font-weight: 800;
  letter-spacing: .06em;
}

.opr-objective strong {
  font-size: 1rem;
}

.opr-objective.owner-1 {
  border-color: #3f7690;
  background: rgba(56,189,248,.09);
}

.opr-objective.owner-2 {
  border-color: #8b5967;
  background: rgba(255,107,120,.08);
}

.opr-objective-totals {
  margin-top: 14px;
}

.opr-objective-totals > div {
  display: grid;
  justify-items: center;
}

.opr-objective-totals small {
  color: #8797a8;
  font-size: .65rem;
}

.opr-mission-result {
  margin: 9px 0 14px;
  text-align: center;
  color: #b8c6d2;
  font-size: .8rem;
  font-weight: 800;
}

.opr-bonus-card {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(260px,.8fr);
  gap: 18px;
  align-items: center;
}

.opr-bonus-card p {
  margin: 6px 0 0;
}

.opr-bonus-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.opr-bonus-player {
  display: grid;
  gap: 7px;
  justify-items: center;
  border: 1px solid #2e3b4b;
  border-radius: 12px;
  background: #111820;
  padding: 10px;
}

.opr-bonus-player > span {
  color: #8495a8;
  font-size: .6rem;
  font-weight: 900;
  letter-spacing: .07em;
}

.opr-bonus-player > div {
  display: grid;
  grid-template-columns: 34px 42px 34px;
  align-items: center;
  gap: 5px;
}

.opr-bonus-player button {
  width: 34px;
  height: 34px;
  border: 1px solid #35475a;
  border-radius: 8px;
  background: #18212b;
  color: var(--text);
  font-weight: 900;
}

.opr-bonus-player strong {
  text-align: center;
  font-size: 1.15rem;
}

.opr-mission-note {
  margin: 12px 2px 0;
}

@media (max-width: 760px) {
  .roster-browser-tools {
    width: 100%;
    justify-content: flex-start;
  }

  .opr-round-control {
    width: 100%;
    grid-template-columns: auto 36px 1fr;
  }

  .opr-round-control > button {
    justify-self: stretch;
  }

  .opr-unit-state-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .opr-unit-state-controls {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
  }

  .opr-unit-state-controls .unit-state-toggle {
    min-width: 0;
    padding: 0 6px;
  }

  .roster-unit-side {
    max-width: 48%;
  }

  .opr-mission-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .opr-mission-toolbar > .ghost-button {
    grid-column: 1 / -1;
  }

  .opr-mission-card-heading {
    display: grid;
    gap: 5px;
  }

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

  .opr-bonus-card {
    grid-template-columns: 1fr;
  }
}



/* === Tabletop Voice identity refresh === */
:root {
  --accent: #54ead7;
  --accent-strong: #22c7b3;
  --voice-glow: rgba(84,234,215,.22);
  --voice-line: rgba(84,234,215,.34);
  --voice-blue: #5ac8ff;
  --warning: #ff9b63;
}

html,
body {
  background:
    linear-gradient(rgba(84,234,215,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(84,234,215,.015) 1px, transparent 1px),
    radial-gradient(circle at 50% -20%, rgba(34,199,179,.10), transparent 34%),
    #080c10;
  background-size: 30px 30px, 30px 30px, auto, auto;
}

.brand-mark {
  border-left-color: var(--accent);
  color: var(--accent);
  box-shadow: inset 0 0 18px rgba(84,234,215,.04);
}

.eyebrow,
.section-label,
.detachment-loading {
  color: var(--accent);
}

.primary-button {
  background: var(--accent);
  color: #031513;
}

.primary-button:hover {
  background: #84f3e4;
}

.voice-dock {
  position: fixed;
  overflow: hidden;
  border-color: var(--voice-line);
  background:
    linear-gradient(180deg, rgba(13,22,27,.98), rgba(8,14,18,.985));
  box-shadow:
    0 14px 36px rgba(0,0,0,.50),
    0 0 0 1px rgba(84,234,215,.035),
    0 0 34px rgba(84,234,215,.06);
}

.voice-dock::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--voice-blue));
}

.voice-dock::after {
  content: "";
  position: absolute;
  top: 0;
  left: 16px;
  right: 16px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(84,234,215,.45), transparent);
  pointer-events: none;
}

.voice-dock-row,
.voice-dock-search {
  position: relative;
  z-index: 1;
}

.voice-status strong {
  color: #eafcf9;
  font-size: .73rem;
  font-weight: 900;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.voice-status span {
  color: #8ca8aa;
}

.voice-dock-search input {
  border-color: #29454a;
  background: #091216;
}

.voice-dock-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(84,234,215,.08);
}

.talk-button {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(132,243,228,.34);
  background:
    linear-gradient(135deg, #54ead7 0%, #35d7cf 54%, #5ac8ff 100%);
  color: #031514;
  box-shadow:
    inset 0 1px rgba(255,255,255,.22),
    0 8px 22px rgba(34,199,179,.13);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}

.talk-button::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 20%, rgba(255,255,255,.18) 48%, transparent 72%);
  transform: translateX(-120%);
  transition: transform .35s ease;
  pointer-events: none;
}

.talk-button:hover::before {
  transform: translateX(120%);
}

.talk-button:hover {
  filter: brightness(1.035);
  box-shadow:
    inset 0 1px rgba(255,255,255,.25),
    0 10px 28px rgba(34,199,179,.18);
}

.talk-button.listening {
  background: linear-gradient(135deg, #ff7d8a, #ff596f);
  color: #25070c;
  box-shadow:
    0 0 0 4px rgba(255,105,124,.10),
    0 0 28px rgba(255,105,124,.22);
}

.talk-button .mic-icon {
  display: inline-block;
  margin-right: 7px;
  filter: saturate(.7);
}

.tool-card,
.dice-card,
.match-state-card,
.opr-mission-card,
.opr-bonus-card,
.roster-unit-group {
  border-color: #283944;
  background:
    linear-gradient(180deg, rgba(17,25,32,.98), rgba(12,18,24,.98));
}

.roster-unit-button {
  border-left: 3px solid #273b45;
}

.roster-unit-button:hover {
  border-color: #356d72;
  border-left-color: var(--accent);
  background: rgba(84,234,215,.045);
}

.roster-unit-button.opr-ready {
  border-color: #31536a;
  border-left-color: var(--accent);
  background: #102129;
}

.roster-unit-button.opr-activated,
.result-item.opr-activated {
  border-left-color: #49545e;
}

.roster-unit-button.opr-shaken,
.result-item.opr-shaken {
  border-left-color: var(--warning);
  box-shadow: inset 3px 0 0 rgba(255,155,99,.45);
}

.opr-state-badge.shaken {
  border-color: #8e5e45;
  color: #ffd0b7;
  background: rgba(255,155,99,.09);
}

.unit-state-toggle.shaken.active {
  border-color: #b37352;
  background: rgba(255,155,99,.13);
  color: #ffd0b7;
}

.unit-health-tracker {
  border-left-color: var(--accent);
}

@media (max-width: 760px) {
  .voice-dock {
    border-color: rgba(84,234,215,.30);
  }

  .talk-button {
    min-width: 148px;
  }

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

.opr-import-actions {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  gap: 8px;
}

@media (max-width: 620px) {
  .opr-import-actions {
    grid-template-columns: 1fr;
  }
}
