/* ==========================================================================
   Battle Forge – 40K 11th Edition Mobile WebApp Stylesheet
   ========================================================================== */

:root {
  --bg-app: #0d0f11;
  --bg-surface: #181b1e;
  --bg-header: #242628;
  --bg-card-dark: #1d2023;
  --bg-card-dark-2: #262a2e;
  --bg-card-light: #ffffff;
  --bg-muted: #e9ecef;

  --text-light: #f4f6f8;
  --text-muted-light: #a6afb8;
  --text-dark: #181b1e;
  --text-muted-dark: #545d66;

  --slate-blue: #416c84;
  --slate-blue-dark: #325569;
  --gold: #f0c200;
  --gold-dark: #5c4b11;
  --gold-border: #f5c400;
  --danger: #c62828;
  --danger-bg: #fce8e8;
  --success: #2e9e3f;
  --warning: #f5c400;

  --font-display: 'Barlow Condensed', 'Roboto Condensed', 'Arial Narrow', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --header-h: 58px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-card: 0 4px 14px rgba(0, 0, 0, 0.35);
  --shadow-float: 0 6px 18px rgba(0, 0, 0, 0.45);
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  background: #070809;
  color: var(--text-light);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button, input, select {
  font-family: inherit;
  font-size: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  padding: 0;
}

.hidden {
  display: none !important;
}

/* Mobile Shell centered on desktop */
.app-shell {
  width: 100%;
  max-width: 500px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg-app);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.75);
}

.app-shell.theme-light-bg {
  background: #f2f4f6;
  color: var(--text-dark);
}

/* Boot & Error */
.boot-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 32px;
  text-align: center;
  color: var(--text-muted-light);
}

.boot-spinner {
  width: 38px;
  height: 38px;
  border: 3px solid rgba(255,255,255,0.12);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   Top Header Bar
   ========================================================================== */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  min-height: var(--header-h);
  padding: 0 12px;
  background: var(--bg-header);
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: env(safe-area-inset-top, 0px);
}

.top-bar-title {
  flex: 1;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.1s ease;
}

.icon-btn:active {
  background: rgba(255, 255, 255, 0.14);
  transform: scale(0.94);
}

.icon-btn.bunker-btn {
  border: 2px solid rgba(255, 255, 255, 0.85);
  width: 36px;
  height: 36px;
}

.icon-btn.bunker-btn.active {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(240, 194, 0, 0.14);
}

/* Search Bar in Screen 9 */
.search-bar-wrap {
  background: #1c1f22;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-input {
  flex: 1;
  background: #ffffff;
  color: #111;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 15px;
  outline: none;
}

/* Scrollable Screen Body */
.screen-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px 96px;
  position: relative;
}

.screen-body.no-pad {
  padding: 0 0 96px;
}

.screen-body.with-bottom-cta {
  padding-bottom: 92px;
}

.screen-body.bg-dark-ornate {
  background:
    radial-gradient(circle at 50% 10%, rgba(65, 108, 132, 0.16), transparent 60%),
    linear-gradient(180deg, #131618 0%, #0b0c0e 100%);
}

/* ==========================================================================
   Screen 1: Listen-Übersicht (Battle Forge)
   ========================================================================== */
.sort-banner {
  background: rgba(240, 194, 0, 0.15);
  border: 1px solid rgba(240, 194, 0, 0.45);
  color: #ffe270;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}

.sort-done-btn {
  background: var(--gold);
  color: #111;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  flex-shrink: 0;
}

.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted-light);
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: rgba(65, 108, 132, 0.18);
  border: 1px solid rgba(65, 108, 132, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
}

.empty-state h2 {
  font-family: var(--font-display);
  font-size: 24px;
  margin: 0 0 8px;
  color: #fff;
  letter-spacing: 0.4px;
}

.empty-state p {
  margin: 0;
  font-size: 14px;
  max-width: 300px;
  margin-inline: auto;
}

/* Uniform height Roster Cards (accommodates up to 3 lines of detachments cleanly) */
.roster-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.roster-card {
  position: relative;
  height: 178px; /* Feste Standardhöhe für alle Karten */
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-card-dark);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow-card);
  display: flex;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease;
  user-select: none;
}

.roster-card:active {
  transform: scale(0.99);
}

.roster-card.dragging {
  opacity: 0.55;
  border-color: var(--gold);
}

/* Right artwork layer with smooth fade into dark card left side */
.card-art-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-size: cover;
  background-position: right center;
  background-repeat: no-repeat;
}

.card-art-bg img.art-right-panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: cover;
  object-position: right center;
  display: block;
}

.card-art-bg.fallback-AC {
  background: linear-gradient(125deg, #1d2023 35%, #2b3545 62%, #7d5b19 88%, #b38928 100%);
}
.card-art-bg.fallback-default {
  background: linear-gradient(125deg, #1d2023 40%, #2a3942 75%, #416c84 100%);
}

.card-art-scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    rgba(24, 27, 30, 0.98) 0%,
    rgba(24, 27, 30, 0.95) 54%,
    rgba(24, 27, 30, 0.52) 74%,
    rgba(24, 27, 30, 0.25) 100%
  );
}

.roster-card-content {
  position: relative;
  z-index: 2;
  flex: 1;
  padding: 15px 46px 15px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.roster-card-top {
  min-width: 0;
}

.roster-card-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #ffffff;
  margin: 0 0 2px;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.roster-card-faction {
  font-size: 13px;
  font-weight: 600;
  color: #c7d0d8;
  margin: 0 0 4px;
}

.roster-card-detachments {
  font-size: 12.5px;
  color: #9ba5af;
  line-height: 1.3;
  margin: 0;
  max-width: 78%;
  /* Mehrzeilig bis 3 Zeilen, kein Kürzen */
  white-space: normal;
  word-break: break-word;
}

.roster-points-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  background: #ffffff;
  color: #16181a;
  font-weight: 700;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 5px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.roster-points-pill.over-limit {
  background: var(--danger);
  color: #ffffff;
}

.roster-card-menu-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 40px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
}

.roster-card-menu-btn:active {
  background: rgba(0, 0, 0, 0.65);
}

.sort-controls {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sort-move-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(24, 27, 30, 0.88);
  border: 1px solid rgba(255,255,255,0.22);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sort-move-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

/* Floating Action Button (+) */
.fab-add {
  position: fixed;
  right: max(18px, calc(50% - 250px + 18px));
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 35;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--gold);
  color: #111111;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
  transition: transform 0.12s ease;
}

.fab-add:active {
  transform: scale(0.93);
}

/* ==========================================================================
   Screen 2: Choose Faction
   ========================================================================== */
.faction-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.faction-card {
  position: relative;
  min-height: 70px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-card-dark);
  border: 1px solid rgba(255, 255, 255, 0.14);
  display: flex;
  align-items: center;
  padding: 12px 14px;
  text-align: left;
  width: 100%;
  transition: transform 0.1s ease, border-color 0.15s ease;
}

.faction-card:not(.disabled):active {
  transform: scale(0.985);
  border-color: var(--gold);
}

.faction-card.disabled {
  opacity: 0.45;
  filter: grayscale(0.8);
  cursor: not-allowed;
}

.faction-card.group-toggle {
  opacity: 0.82;
  cursor: pointer;
}

.faction-card-scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    rgba(24, 27, 30, 0.98) 0%,
    rgba(24, 27, 30, 0.94) 55%,
    rgba(24, 27, 30, 0.35) 78%,
    rgba(24, 27, 30, 0.15) 100%
  );
}

.faction-card-inner {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.faction-chevron {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.faction-chevron.open {
  transform: rotate(180deg);
}

.faction-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.faction-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #ffffff;
  line-height: 1.1;
}

.faction-subtitle {
  font-size: 12.5px;
  color: #b4bec7;
}

.faction-status-note {
  font-size: 11px;
  color: #cbd3da;
  font-style: italic;
}

.faction-children {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 20px;
  margin-top: -2px;
  margin-bottom: 4px;
}

/* ==========================================================================
   Screen 3: Choose Battle Size
   ========================================================================== */
.battle-size-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 6px;
}

.battle-size-btn {
  width: 100%;
  background: var(--slate-blue);
  color: #ffffff;
  border-radius: var(--radius-sm);
  padding: 20px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  transition: background 0.15s ease, transform 0.1s ease;
}

.battle-size-btn:active {
  background: var(--slate-blue-dark);
  transform: scale(0.985);
}

.battle-size-btn.selected {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.battle-size-name {
  font-size: 17px;
  font-weight: 600;
}

.battle-size-std {
  font-style: italic;
  font-weight: 400;
  opacity: 0.9;
  margin-left: 5px;
  font-size: 14px;
}

.battle-size-pts {
  font-size: 17px;
  font-weight: 700;
}

/* ==========================================================================
   Screen 4: Choose Detachments
   ========================================================================== */
.dp-status-bar {
  position: sticky;
  top: var(--header-h);
  z-index: 30;
  background: #ffffff;
  color: var(--text-dark);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #d5dbe0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.dp-status-label {
  font-size: 14.5px;
  font-weight: 700;
}

.dp-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--slate-blue);
  color: #ffffff;
  font-weight: 700;
  font-size: 13.5px;
  padding: 5px 12px;
  border-radius: 5px;
}

.dp-pill.invalid {
  background: var(--danger);
  color: #ffffff;
}

.dp-pill.clickable {
  cursor: pointer;
  box-shadow: 0 0 0 2px rgba(65, 108, 132, 0.25);
}

.detachment-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detachment-card {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.12);
  background: var(--bg-card-dark);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.detachment-card.selected {
  border-color: var(--gold-border);
  box-shadow: 0 0 0 1px var(--gold-border), 0 4px 16px rgba(245, 196, 0, 0.22);
}

.detachment-header {
  position: relative;
  min-height: 76px;
  display: flex;
  align-items: stretch;
  overflow: hidden;
}

.detachment-expand-btn {
  position: relative;
  z-index: 3;
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  flex-shrink: 0;
}

.detachment-expand-btn svg {
  transition: transform 0.2s ease;
}

.detachment-card.expanded .detachment-expand-btn svg {
  transform: rotate(180deg);
}

.detachment-select-area {
  position: relative;
  z-index: 3;
  flex: 1;
  padding: 12px 14px 12px 2px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  text-align: left;
  cursor: pointer;
}

.detachment-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #ffffff;
  line-height: 1.1;
}

.detachment-dp-badge {
  display: inline-flex;
  width: fit-content;
  background: var(--slate-blue);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 4px;
}

.detachment-body {
  background: #ffffff;
  color: var(--text-dark);
  padding: 14px 16px 16px;
  border-top: 1px solid #dde2e6;
}

.detachment-rule-block + .detachment-rule-block {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e3e7eb;
}

.detachment-rule-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  text-transform: uppercase;
  margin: 0 0 6px;
  color: #14171a;
}

.detachment-fd-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e3e7eb;
}

.detachment-fd-title {
  font-weight: 700;
  font-size: 14px;
  margin: 0 0 8px;
}

.detachment-fd-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.detachment-fd-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
}

/* Fixed Bottom CTA Button */
.bottom-cta-wrap {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 500px;
  z-index: 35;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgba(13,15,17,0) 0%, rgba(13,15,17,0.92) 32%, rgba(13,15,17,1) 100%);
  pointer-events: none;
}

.bottom-cta-btn {
  pointer-events: auto;
  width: 100%;
  padding: 15px 18px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  background: var(--gold);
  color: #111111;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  transition: opacity 0.15s ease, transform 0.1s ease, background 0.15s ease;
}

.bottom-cta-btn:active:not(:disabled) {
  transform: scale(0.985);
}

.bottom-cta-btn:disabled {
  background: var(--gold-dark);
  color: rgba(17, 17, 17, 0.65);
  cursor: not-allowed;
}

/* ==========================================================================
   Screen 5: Force Disposition
   ========================================================================== */
.fd-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 6px;
}

.fd-card {
  position: relative;
  width: 100%;
  min-height: 76px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, #1d2023 0%, #25292d 68%, #343b40 100%);
  border: 2px solid rgba(255, 255, 255, 0.15);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.fd-card.selected {
  border-color: var(--gold-border);
  box-shadow: 0 0 0 1px var(--gold-border), 0 4px 16px rgba(245, 196, 0, 0.25);
}

.fd-card-name {
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
}

.fd-icon-wrap {
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ==========================================================================
   Screen 6: Create List / Edit List
   ========================================================================== */
.form-section-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #ffffff;
  margin: 14px 0 10px;
}

.form-section-title:first-child {
  margin-top: 4px;
}

.name-input {
  width: 100%;
  background: #ffffff;
  color: #111111;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  padding: 14px 14px;
  font-size: 16px;
  font-weight: 500;
  outline: none;
}

.name-input:focus {
  border-color: var(--gold);
}

.name-input.error {
  border-color: var(--danger);
}

.form-error-msg {
  color: #ff6b6b;
  font-size: 12.5px;
  margin-top: 6px;
  font-weight: 500;
}

.army-config-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.army-faction-locked {
  position: relative;
  min-height: 68px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #1b1e21;
  display: flex;
  align-items: center;
  padding: 12px 16px;
  opacity: 0.78;
}

.army-faction-locked-name {
  position: relative;
  z-index: 2;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 800;
  text-transform: uppercase;
  color: #aeb6be;
}

.army-config-row {
  width: 100%;
  background: #2b2f33;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  padding: 16px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  transition: background 0.15s ease;
}

.army-config-row:active {
  background: #353a3f;
}

.army-config-row.invalid {
  border-color: var(--danger);
  background: rgba(198, 40, 40, 0.22);
}

.army-config-row-main {
  flex: 1;
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.35;
}

.army-config-row-right {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}

/* ==========================================================================
   Screen 7: Listbuilder
   ========================================================================== */
.faction-banner {
  position: relative;
  width: 100%;
  aspect-ratio: 780 / 208;
  min-height: 92px;
  max-height: 134px;
  overflow: hidden;
  background-color: #1c2430;
  background-size: cover;
  background-position: center;
}

.faction-banner.fallback-AC {
  background: linear-gradient(115deg, #10203a 0%, #203d66 48%, #7a5c1d 82%, #b58d2e 100%);
}

.faction-banner-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.12) 0%, rgba(0,0,0,0.5) 100%);
  display: flex;
  align-items: flex-end;
  padding: 10px 14px;
}

.faction-banner-meta {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  font-weight: 600;
}

.category-block {
  background: #ffffff;
}

.category-header {
  background: #2b2d30;
  color: #ffffff;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid rgba(255,255,255,0.08);
  border-bottom: 1px solid rgba(0,0,0,0.4);
}

.category-header.disabled-cat {
  background: #222427;
  color: #828b94;
}

.category-title-wrap {
  display: flex;
  flex-direction: column;
}

.category-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.category-note {
  font-size: 11px;
  color: #8f98a1;
  font-style: italic;
}

.category-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.category-pts {
  font-size: 13.5px;
  font-weight: 600;
  color: #d6dde3;
}

.cat-add-btn {
  width: 38px;
  height: 38px;
  border-radius: 5px;
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
}

.cat-add-btn:active:not(:disabled) {
  background: rgba(255, 255, 255, 0.18);
}

.cat-add-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Unit Card in Listbuilder */
.unit-row-card {
  background: #ffffff;
  color: var(--text-dark);
  padding: 12px 8px 12px 12px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-bottom: 1px solid #dfe4e8;
  cursor: pointer;
}

.unit-row-card:active {
  background: #f5f7f9;
}

.unit-thumb {
  width: 58px;
  height: 76px;
  border-radius: 6px;
  border: 1px solid #d2d8de;
  background: linear-gradient(145deg, #27323c 0%, #3f5568 65%, #755b22 100%);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.unit-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.unit-thumb-initials {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: rgba(255,255,255,0.88);
  letter-spacing: 0.5px;
}

.unit-row-center {
  flex: 1;
  min-width: 0;
}

.unit-row-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.unit-row-title-block {
  min-width: 0;
}

.warlord-pill {
  display: inline-block;
  background: var(--slate-blue);
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 4px;
}

.unit-row-name {
  font-size: 15.5px;
  font-weight: 700;
  color: #14171a;
  line-height: 1.25;
  margin: 0;
}

.unit-badges-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

.badge-legends {
  display: inline-block;
  background: #22262a;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}

.badge-fw {
  display: inline-block;
  background: #22262a;
  color: #f3d266;
  border: 1px solid #b58d2e;
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 4px;
}

.unit-gear-list {
  list-style: none;
  margin: 5px 0 0;
  padding: 0 0 0 4px;
  font-size: 12.5px;
  color: #363e46;
  line-height: 1.4;
}

.unit-gear-list li.indent {
  padding-left: 12px;
}

.unit-gear-list li.enh-line {
  font-weight: 600;
  color: #274c61;
}

.attach-pill {
  display: inline-block;
  background: #2a2e32;
  color: #ffffff;
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 4px;
  margin-top: 7px;
  margin-right: 5px;
}

.attach-pill strong {
  font-weight: 700;
}

.unit-row-right {
  display: flex;
  align-items: flex-start;
  gap: 2px;
  flex-shrink: 0;
}

.pts-badge {
  background: var(--slate-blue);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 4px;
  white-space: nowrap;
}

.unit-menu-btn {
  width: 34px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2c333a;
  border-radius: 6px;
}

.unit-menu-btn:active {
  background: #e9edf0;
}

/* Floating Points & Validation Widget (Bottom-Left) */
.floating-status-widget {
  position: fixed;
  left: max(14px, calc(50% - 250px + 14px));
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 35;
  display: inline-flex;
  align-items: stretch;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: var(--shadow-float);
  cursor: pointer;
}

.fsw-icon-box {
  width: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.fsw-icon-box.warn {
  background: var(--warning);
  color: #111111;
}

.fsw-icon-box.ok {
  background: var(--success);
  color: #ffffff;
}

.fsw-pts-box {
  background: var(--slate-blue);
  color: #ffffff;
  padding: 7px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  line-height: 1.15;
}

.fsw-pts-box.over {
  background: var(--danger);
}

.fsw-pts-num {
  font-size: 14px;
  font-weight: 800;
}

.fsw-pts-label {
  font-size: 10.5px;
  letter-spacing: 0.6px;
  font-weight: 600;
  opacity: 0.92;
}

/* ==========================================================================
   Screen 8: Einheiten-Konfiguration
   ========================================================================== */
.config-top-bar {
  background: #ffffff;
  color: var(--text-dark);
  padding: 14px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid #d8dee4;
}

.config-unit-name {
  font-size: 16.5px;
  font-weight: 700;
  flex: 1;
}

.config-top-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.datasheet-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  color: var(--slate-blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid rgba(65, 108, 132, 0.35);
  background: rgba(65, 108, 132, 0.08);
}

.datasheet-icon-btn:active {
  background: rgba(65, 108, 132, 0.2);
}

.model-count-bar {
  background: var(--slate-blue);
  color: #ffffff;
  padding: 14px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.model-count-name {
  font-size: 16px;
  font-weight: 600;
}

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.stepper-btn {
  width: 38px;
  height: 38px;
  border-radius: 5px;
  border: 1.5px solid rgba(255, 255, 255, 0.75);
  color: #ffffff;
  font-size: 20px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.stepper-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.stepper-val {
  font-size: 17px;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}

.config-sections-wrap {
  padding: 14px 14px 96px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.warlord-card {
  background: #ffffff;
  color: var(--text-dark);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.warlord-card-info {
  display: flex;
  flex-direction: column;
}

.warlord-card-title {
  font-weight: 700;
  font-size: 15px;
}

.warlord-card-sub {
  font-size: 12px;
  color: var(--text-muted-dark);
}

.config-accordion-btn {
  width: 100%;
  background: #cfd5da;
  color: #16181a;
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.config-accordion-btn svg {
  transition: transform 0.2s ease;
}

.config-accordion-btn.open svg {
  transform: rotate(180deg);
}

.config-group-header {
  background: #5b6168;
  color: #ffffff;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.2);
}

.wargear-item-card {
  background: #ffffff;
  color: var(--text-dark);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.wargear-item-top {
  padding: 12px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.wargear-expand-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  text-align: left;
  font-weight: 600;
  font-size: 14.5px;
  color: #14171a;
}

.wargear-expand-toggle svg {
  flex-shrink: 0;
  transition: transform 0.2s ease;
  color: #416c84;
}

.wargear-item-card.open .wargear-expand-toggle svg {
  transform: rotate(180deg);
}

.wargear-cost-tag {
  font-size: 12px;
  font-weight: 700;
  color: var(--slate-blue);
  margin-left: 4px;
}

.wargear-count-pill {
  background: #eef2f5;
  color: #1e2328;
  font-weight: 700;
  font-size: 13.5px;
  padding: 5px 11px;
  border-radius: 5px;
  border: 1px solid #d0d7dd;
}

.wargear-details {
  padding: 10px 12px 12px;
  border-top: 1px solid #e6eaee;
  background: #f8fafb;
  font-size: 13px;
}

.config-group-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.wargear-limit-pill {
  background: rgba(0, 0, 0, 0.28);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.wargear-limit-pill.over {
  background: #b91c1c;
  color: #ffffff;
}

.stepper.stepper-sm {
  gap: 4px;
  flex-shrink: 0;
}

.stepper.stepper-sm .stepper-btn {
  width: 30px;
  height: 30px;
  font-size: 17px;
  background: #eef2f5;
  color: #14171a;
  border: 1px solid #cfd7de;
}

.stepper.stepper-sm .stepper-val {
  min-width: 24px;
  font-size: 14px;
  color: #14171a;
}

.wargear-note-card {
  background: #f4f6f8;
  color: #36404a;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-line;
  border: 1px solid #d7dfe6;
}

/* Custom Checkbox / Radio Box */
.check-box-btn {
  width: 30px;
  height: 30px;
  border-radius: 5px;
  border: 2px solid #59636e;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #ffffff;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.check-box-btn.checked {
  background: var(--slate-blue);
  border-color: var(--slate-blue);
}

.check-box-btn.radio {
  border-radius: 50%;
}

.check-box-btn.disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.enh-select-card {
  background: #ffffff;
  color: var(--text-dark);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.enh-select-card.taken {
  opacity: 0.55;
}

.enh-select-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.enh-select-title {
  font-weight: 700;
  font-size: 15px;
}

.enh-select-meta {
  font-size: 12px;
  color: var(--text-muted-dark);
}

.enh-select-desc {
  font-size: 13px;
  color: #363e46;
  line-height: 1.45;
}

/* ==========================================================================
   Screen 9: Einheit hinzufügen (<CATEGORY> DATASHEETS)
   ========================================================================== */
.add-unit-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.add-unit-card {
  background: #ffffff;
  color: var(--text-dark);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

.add-unit-card:active {
  background: #f4f6f8;
}

.add-unit-center {
  flex: 1;
  min-width: 0;
}

.add-unit-name {
  font-size: 15.5px;
  font-weight: 700;
  color: #14171a;
  line-height: 1.25;
}

.add-unit-in-army {
  font-size: 12.5px;
  color: #48525c;
  margin-top: 3px;
  font-weight: 500;
}

.add-unit-fw-note {
  font-size: 11px;
  color: #5b6570;
  margin-top: 2px;
}

.add-unit-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.add-unit-plus-btn {
  width: 44px;
  height: 40px;
  border-radius: 5px;
  border: 1.5px solid #2b3137;
  color: #14171a;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.add-unit-plus-btn:active {
  background: #e6ecf0;
  transform: scale(0.94);
}

/* ==========================================================================
   Screen 10: Attach Unit
   ========================================================================== */
.attach-group-header {
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #ffffff;
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 12px;
  background: #171a1d;
}

.attach-unit-card {
  background: #ffffff;
  color: var(--text-dark);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  border: 2px solid transparent;
}

.attach-unit-card.occupied {
  opacity: 0.56;
  filter: grayscale(0.35);
}

.attach-unit-card.current {
  border-color: var(--gold);
}

/* ==========================================================================
   Screen 11: Command Bunker (Spielmodus)
   ========================================================================== */
.bunker-accordion-bar {
  width: 100%;
  background: var(--slate-blue);
  color: #ffffff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.bunker-accordion-bar svg {
  transition: transform 0.2s ease;
}

.bunker-accordion-bar.open svg {
  transform: rotate(180deg);
}

.bunker-section-body {
  background: #ffffff;
  color: var(--text-dark);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bunker-ds-card {
  width: 100%;
  background: #ffffff;
  border: 1px solid #d5dce2;
  border-radius: var(--radius-md);
  padding: 10px 14px 10px 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.bunker-ds-card:active {
  background: #f2f5f8;
}

.bunker-ds-name {
  flex: 1;
  font-size: 15.5px;
  font-weight: 700;
  color: #16181a;
}

.bunker-ds-count {
  color: var(--slate-blue);
  font-weight: 800;
  margin-left: 4px;
}

/* Rule Cards inside Command Bunker (Enhancements, Detachment Rules, Army Rules) */
.bunker-rule-card {
  border: 1px solid #cfd6dc;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #ffffff;
}

.bunker-rule-head {
  width: 100%;
  background: #33373b;
  color: #ffffff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
}

.bunker-rule-head-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bunker-rule-title {
  font-weight: 700;
  font-size: 15px;
}

.bunker-rule-bearer {
  font-size: 12px;
  color: #c8d2dc;
  font-weight: 500;
}

.bunker-rule-head svg {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.bunker-rule-card.open .bunker-rule-head svg {
  transform: rotate(180deg);
}

.bunker-rule-content {
  padding: 13px 14px;
  font-size: 13.5px;
  line-height: 1.5;
  color: #1c2024;
}

/* Stratagem Sections & Color-Coded Bars */
.strat-group-bar {
  width: 100%;
  background: #cfd5da;
  color: #16181a;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 14.5px;
}

.strat-group-bar svg {
  transition: transform 0.2s ease;
}

.strat-group-bar.open svg {
  transform: rotate(180deg);
}

.strat-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.strat-card {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: #ffffff;
}

.strat-bar {
  width: 100%;
  color: #ffffff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
}

.strat-bar-left {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.strat-bar-name {
  font-weight: 700;
  font-size: 14.5px;
  line-height: 1.2;
}

.strat-bar-det {
  font-size: 11px;
  opacity: 0.85;
}

.strat-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 13.5px;
  flex-shrink: 0;
}

.strat-bar-right svg {
  transition: transform 0.2s ease;
}

.strat-card.open .strat-bar-right svg {
  transform: rotate(180deg);
}

.strat-body {
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.48;
  color: #1d2125;
  background: #ffffff;
}

.strat-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.strat-meta-chip {
  font-size: 11px;
  font-weight: 700;
  background: #eef2f5;
  color: #36404a;
  padding: 2px 7px;
  border-radius: 4px;
}

/* ==========================================================================
   Screen 12: Datasheet Detail View
   ========================================================================== */
.ds-hero {
  position: relative;
  width: 100%;
  aspect-ratio: 1024 / 500;
  min-height: 165px;
  max-height: 244px;
  background: linear-gradient(135deg, #25303b 0%, #3d5669 55%, #7a5c1d 100%);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ds-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ds-hero-placeholder {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.28);
  text-align: center;
  padding: 0 20px;
}

.ds-source-strip {
  background: #1c1f22;
  color: #e4e8ec;
  padding: 7px 14px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.ds-stats-panel {
  background: #232629;
  color: #ffffff;
  padding: 12px 12px 16px;
}

.ds-model-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #b7c2cc;
  margin-bottom: 6px;
  text-align: center;
}

.ds-stat-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
}

.ds-stat-grid + .ds-model-label {
  margin-top: 12px;
}

.ds-stat-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.ds-stat-hdr {
  font-size: 11px;
  font-weight: 800;
  color: #cfd6dd;
  letter-spacing: 0.5px;
}

.ds-stat-val {
  width: 100%;
  aspect-ratio: 1 / 0.92;
  background: #ffffff;
  color: #14171a;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.ds-invuln-bar {
  background: var(--slate-blue);
  color: #ffffff;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(255,255,255,0.16);
  border-bottom: 1px solid rgba(255,255,255,0.16);
}

.ds-invuln-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.ds-invuln-shield {
  position: relative;
  width: 38px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ds-invuln-shield span {
  position: relative;
  z-index: 2;
  color: var(--slate-blue-dark);
  font-weight: 800;
  font-size: 14px;
  margin-top: -2px;
}

.ds-section-bar {
  width: 100%;
  background: var(--slate-blue);
  color: #ffffff;
  padding: 11px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  border-top: 1px solid rgba(255,255,255,0.16);
}

.ds-section-bar svg {
  transition: transform 0.2s ease;
}

.ds-section-bar.open svg {
  transform: rotate(180deg);
}

.ds-weapon-table-head {
  background: #d2d7dc;
  color: #181b1e;
  display: grid;
  grid-template-columns: 1.2fr 0.7fr 0.85fr 0.7fr 0.75fr 0.9fr;
  padding: 8px 12px;
  font-size: 11.5px;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.4px;
}

.ds-white-panel {
  background: #ffffff;
  color: var(--text-dark);
  padding: 12px 14px 16px;
}

.ds-weapon-block {
  margin-bottom: 12px;
}

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

.ds-weapon-name-bar {
  background: #303438;
  color: #ffffff;
  padding: 8px 12px;
  border-radius: 5px;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ds-weapon-enh-tag {
  margin-left: auto;
  background: var(--gold);
  color: #111;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
}

.ds-weapon-stats-row {
  display: grid;
  grid-template-columns: 1.2fr 0.7fr 0.85fr 0.7fr 0.75fr 0.9fr;
  padding: 9px 2px 6px;
  text-align: center;
  font-weight: 800;
  font-size: 14.5px;
  color: #14171a;
}

.ds-kw-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.kw-dashed-badge {
  display: inline-flex;
  align-items: center;
  border: 1.5px dashed #39424b;
  border-radius: 4px;
  padding: 3px 8px;
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: #14171a;
  background: #f8fafb;
  cursor: pointer;
}

.kw-dashed-badge:active {
  background: #e1ecf2;
  border-color: var(--slate-blue);
}

.ds-multi-note {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #c8d0d8;
  font-size: 12.5px;
  font-style: italic;
  color: #3f4852;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ds-ability-group {
  padding: 10px 0;
  border-bottom: 1px dashed #cfd6dc;
}

.ds-ability-group:first-child {
  padding-top: 2px;
}

.ds-ability-group:last-child {
  border-bottom: none;
  padding-bottom: 2px;
}

.ds-ability-sublabel {
  font-size: 13px;
  color: #4b5560;
  margin-bottom: 7px;
  font-weight: 600;
}

.ds-ability-pill {
  display: inline-block;
  background: #14171a;
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 4px;
  margin-bottom: 6px;
  margin-top: 10px;
}

.ds-ability-pill:first-child {
  margin-top: 0;
}

.ds-ability-text {
  font-size: 13.5px;
  line-height: 1.5;
  color: #1f2429;
}

.ds-keywords-box {
  border: 1.5px solid #8c96a0;
  border-radius: 6px;
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.45;
  color: #14171a;
  margin-bottom: 10px;
}

.ds-faction-kw-bar {
  background: var(--slate-blue);
  color: #ffffff;
  border-radius: 6px;
  padding: 11px 14px;
  font-size: 13.5px;
  font-weight: 500;
}

/* Cleaned Wahapedia HTML Elements inside Rule Boxes */
.rich-html ul, .rich-html ol {
  margin: 6px 0 8px 18px;
  padding: 0;
}

.rich-html li {
  margin-bottom: 4px;
}

.rich-html .rule-card {
  border: 1px solid #c5cdd4;
  border-radius: 8px;
  overflow: hidden;
  margin: 10px 0;
  background: #f9fbfc;
}

.rich-html .rule-card-title {
  background: #2b3a44;
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  padding: 7px 12px;
  letter-spacing: 0.5px;
}

.rich-html .rule-card > div:not(:first-child) {
  padding: 8px 12px;
}

.rich-html .rule-sep {
  border: none;
  border-top: 1px solid #d7dfe6;
  margin: 6px 0;
}

.rich-html .rule-box {
  background: #eef4f8;
  border-left: 3px solid var(--slate-blue);
  padding: 9px 11px;
  border-radius: 4px;
  margin: 8px 0;
}

.rich-html .rule-example {
  background: #f7f2e8;
  border-left: 3px solid #b58d2e;
  padding: 8px 10px;
  border-radius: 4px;
  margin: 6px 0;
  font-size: 12.5px;
}

/* ==========================================================================
   Context Menu (3-Dot Popup) & Modals & Toast
   ========================================================================== */
.menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.35);
}

.context-menu {
  position: fixed;
  min-width: 215px;
  max-width: 260px;
  background: #262a2e;
  color: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  padding: 5px 0;
}

.context-menu-item {
  width: 100%;
  padding: 12px 16px;
  text-align: left;
  font-size: 14.5px;
  font-weight: 500;
  color: #f2f4f6;
  display: flex;
  align-items: center;
  gap: 10px;
}

.context-menu-item:active {
  background: rgba(255, 255, 255, 0.1);
}

.context-menu-item.danger {
  color: #ff7b7b;
}

.context-menu-sep {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 4px 0;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.68);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-box {
  width: 100%;
  max-width: 420px;
  max-height: 82dvh;
  background: #23262a;
  color: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 15px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin: 0;
}

.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  font-size: 14.5px;
  line-height: 1.5;
  color: #dde3e9;
}

.modal-body.rich-light {
  background: #ffffff;
  color: #1a1e22;
}

.modal-footer {
  padding: 12px 18px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-btn {
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
}

.modal-btn.secondary {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.modal-btn.primary {
  background: var(--gold);
  color: #111111;
}

.modal-btn.danger {
  background: var(--danger);
  color: #ffffff;
}

.modal-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.validation-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(245, 196, 0, 0.12);
  border: 1px solid rgba(245, 196, 0, 0.35);
  margin-bottom: 8px;
  font-size: 13.5px;
  color: #fff3c4;
}

.validation-ok-box {
  padding: 14px;
  border-radius: 8px;
  background: rgba(46, 158, 63, 0.16);
  border: 1px solid rgba(46, 158, 63, 0.5);
  color: #c9f7d0;
  text-align: center;
  font-weight: 600;
}

.dp-option-btn {
  width: 100%;
  padding: 14px 16px;
  border-radius: 8px;
  background: #2f3439;
  color: #ffffff;
  border: 2px solid transparent;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
}

.dp-option-btn.active {
  border-color: var(--gold);
  background: rgba(240, 194, 0, 0.14);
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 100;
  background: #22262a;
  color: #ffffff;
  border: 1px solid rgba(240, 194, 0, 0.5);
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  max-width: 90vw;
  text-align: center;
}

/* ==========================================================================
   Allied Units & Cloud-Sync UI
   ========================================================================== */
.badge-allied {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 4px;
  background: #1d5575;
  color: #ffffff;
}

.allied-rule-banner {
  background: linear-gradient(135deg, #21303b, #1a242c);
  border: 1px solid rgba(65, 108, 132, 0.65);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 12px 0 6px;
}

.allied-rule-banner:first-child {
  margin-top: 2px;
}

.allied-rule-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--gold);
}

.allied-rule-summary {
  font-size: 12.5px;
  color: #d4dde6;
  margin-top: 2px;
}

.sync-header-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e6ecf2;
  font-size: 12px;
  font-weight: 600;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-header-pill:active {
  background: rgba(255, 255, 255, 0.16);
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sync-dot.ok { background: #36c252; }
.sync-dot.busy { background: var(--gold); animation: spin 0.9s linear infinite; }
.sync-dot.err { background: #ef5350; }
.sync-dot.off { background: #7f8a96; }

.sync-account-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.sync-account-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: var(--gold);
  margin-bottom: 4px;
}

.sync-account-meta {
  font-size: 13px;
  color: #cfd7df;
  margin-top: 2px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 14px;
}

.auth-tab {
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.07);
  color: #cfd7df;
  font-weight: 700;
  font-size: 13.5px;
  text-align: center;
  border: 1px solid transparent;
}

.auth-tab.active {
  background: rgba(65, 108, 132, 0.35);
  border-color: var(--gold);
  color: #ffffff;
}

.auth-form-group {
  margin-bottom: 10px;
}

.auth-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #aeb6be;
  margin-bottom: 4px;
}

/* Play-Mode Weapon Quantity Pill & Command Bunker Loadout Subtitle */
.ds-weapon-qty-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  padding: 1px 7px;
  border-radius: 4px;
  background: var(--gold);
  color: #14171a;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  margin-right: 2px;
  flex-shrink: 0;
}

.bunker-ds-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}

.bunker-ds-sub {
  font-size: 12px;
  color: #5a646e;
  font-weight: 500;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.bunker-ds-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

.bunker-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1.3;
}

.bunker-pill-warlord {
  background: var(--gold);
  color: #14171a;
  text-transform: uppercase;
}

.bunker-pill-enh {
  background: #e6f0f5;
  color: #1d4e6b;
  border: 1px solid #b8d2e0;
}

.bunker-pill-leader {
  background: #242a30;
  color: #ffffff;
  text-transform: uppercase;
}

.bunker-pill-bodyguard {
  background: #eef2f5;
  color: #3c4a57;
  border: 1px solid #cbd5df;
  text-transform: uppercase;
}

.bunker-attached-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
}

.bunker-attached-group > .bunker-ds-card {
  margin-bottom: 0;
  border-left: 3px solid var(--slate-blue);
}

.bunker-attached-child {
  display: flex;
  align-items: flex-start;
  padding-left: 10px;
  margin-top: 4px;
}

.bunker-attach-arrow {
  flex-shrink: 0;
  margin-top: -4px;
  margin-right: 4px;
}

.bunker-attached-child-card {
  flex: 1;
  min-width: 0;
}

.bunker-attached-child-card > .bunker-ds-card {
  margin-bottom: 0;
  background: #f8fafc;
  border-color: #c5d4df;
  border-left: 3px solid var(--slate-blue);
}



