:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --panel-soft: #fbfcfd;
  --field: #fbfcfd;
  --ink: #172026;
  --muted: #60717c;
  --line: #d9e0e4;
  --accent: #1f7a8c;
  --accent-dark: #145461;
  --win: #19734d;
  --lose: #8a4b20;
  --danger: #b3261e;
  --danger-dark: #861c17;
  --locked-bg: #fffaf0;
  --match-red-bg: #fff7f6;
  --match-blue-bg: #f3f9fd;
  --match-empty-bg: #f4f6f7;
  --vs-blue-alert-bg: #d9edf8;
  --vs-blue-alert-flash-bg: #9dd4ee;
  --vs-blue-alert-line: #2f87b9;
  --vs-red-alert-bg: #fde5e1;
  --vs-red-alert-flash-bg: #f4aaa1;
  --vs-red-alert-line: #d05245;
  --review-bg: #fff8df;
  --pick-hover: #f2fafb;
  --pick-disabled: #f7f1de;
  --pick-selected-bg: #edf8f2;
  --pick-selected-ink: #0e4f33;
  --edit-bg: #edf3f5;
  --rank-bg: #f1eadf;
  --seed-bg: #e7f0f2;
  --bookmark-bg: #fff4c7;
  --bookmark-line: #c58b00;
  --bookmark-ink: #7a4f00;
  --ghost-favourite-bg: #fff7db;
  --ghost-favourite-coords: #9a6400;
  --ghost-reward-bg: #ddf7ee;
  --ghost-reward-flash-bg: #9be6cf;
  --ghost-reward-line: #208264;
  --resource-purple-bg: rgba(111, 66, 193, 0.11);
  --resource-purple-line: rgba(111, 66, 193, 0.24);
  --resource-gold-bg: rgba(191, 134, 0, 0.15);
  --resource-gold-line: rgba(191, 134, 0, 0.28);
  --shadow: 0 10px 28px rgba(22, 31, 38, 0.08);
}

.theme-dark {
  color-scheme: dark;
  --bg: #10161a;
  --panel: #182126;
  --panel-soft: #1d282e;
  --field: #121a1f;
  --ink: #edf4f6;
  --muted: #9eb0b8;
  --line: #314149;
  --accent: #45a9ba;
  --accent-dark: #77c7d5;
  --win: #5dcc91;
  --lose: #e0a052;
  --danger: #c73f38;
  --danger-dark: #e05b54;
  --locked-bg: #2a2619;
  --match-red-bg: #291e1e;
  --match-blue-bg: #172330;
  --match-empty-bg: #20272b;
  --vs-blue-alert-bg: #183b54;
  --vs-blue-alert-flash-bg: #245f84;
  --vs-blue-alert-line: #64b8e0;
  --vs-red-alert-bg: #4b2222;
  --vs-red-alert-flash-bg: #743333;
  --vs-red-alert-line: #ef8278;
  --review-bg: #2b2715;
  --pick-hover: #20333a;
  --pick-disabled: #2b281d;
  --pick-selected-bg: #143526;
  --pick-selected-ink: #aef0c9;
  --edit-bg: #213139;
  --rank-bg: #30271d;
  --seed-bg: #20353b;
  --bookmark-bg: #332b15;
  --bookmark-line: #d8a520;
  --bookmark-ink: #ffd978;
  --ghost-favourite-bg: #2d2819;
  --ghost-favourite-coords: #ffd978;
  --ghost-reward-bg: #17382f;
  --ghost-reward-flash-bg: #225d4d;
  --ghost-reward-line: #65d7b5;
  --resource-purple-bg: rgba(170, 130, 255, 0.16);
  --resource-purple-line: rgba(170, 130, 255, 0.3);
  --resource-gold-bg: rgba(255, 204, 86, 0.17);
  --resource-gold-line: rgba(255, 204, 86, 0.32);
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.4;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  min-height: 40px;
  padding: 0 14px;
  font-weight: 700;
}

button:hover {
  background: var(--accent-dark);
}

select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  padding: 0 12px;
  font: inherit;
  font-weight: 700;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.ghost,
.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  padding: 0 14px;
  font-weight: 700;
  cursor: pointer;
}

.ghost:hover,
.file-button:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.danger {
  background: var(--danger);
}

.danger:hover {
  background: var(--danger-dark);
}

.file-button input {
  display: none;
}

.app-header,
main,
.app-footer {
  width: min(1540px, calc(100vw - 40px));
  margin: 0 auto;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--bg);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 65%, transparent);
  padding: 28px 0 18px;
  transition: transform 180ms ease;
  will-change: transform;
}

.app-header.app-header-hidden {
  transform: translateY(-100%);
}

.header-title {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.local-clock {
  margin-left: auto;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 18px;
  font-weight: 850;
  white-space: nowrap;
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

.battery-badge {
  --scan-progress: 0%;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 104px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
}

.battery-badge::before {
  content: "";
  position: absolute;
  inset: 0;
  width: var(--scan-progress);
  background: color-mix(in srgb, var(--win) 22%, transparent);
  opacity: 0;
  transition: width 0.25s ease, opacity 0.2s ease;
}

.battery-badge.has-scan-progress::before {
  opacity: 1;
}

.battery-badge.is-scan-active::before {
  background: color-mix(in srgb, var(--accent) 26%, transparent);
}

.battery-badge > span {
  position: relative;
  z-index: 1;
}

.battery-label {
  display: none;
}

.battery-icon {
  width: 14px;
  height: 20px;
  border: 2px solid currentColor;
  border-radius: 4px 4px 5px 5px;
}

.battery-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -5px;
  width: 7px;
  height: 4px;
  border-radius: 3px 3px 0 0;
  background: currentColor;
  transform: translateX(-50%);
}

.battery-count {
  font-variant-numeric: tabular-nums;
}

.battery-scan {
  margin-left: 4px;
  padding-left: 7px;
  border-left: 1px solid color-mix(in srgb, var(--muted) 35%, transparent);
  color: var(--muted);
  font-size: 12px;
}

.icon-button.scan-launch-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  min-width: 42px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--accent) 36%, var(--line));
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--accent) 18%, transparent) 0 42%, transparent 43%),
    var(--panel);
  color: var(--accent-dark);
}

.icon-button.scan-launch-button:hover {
  border-color: var(--accent);
  background:
    radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--accent) 26%, transparent) 0 42%, transparent 43%),
    var(--panel-soft);
}

.scan-launch-icon {
  position: relative;
  width: 22px;
  height: 22px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.scan-launch-icon::before,
.scan-launch-icon::after {
  content: "";
  position: absolute;
  background: currentColor;
}

.scan-launch-icon::before {
  left: 50%;
  top: -4px;
  width: 2px;
  height: 28px;
  transform: translateX(-50%);
  opacity: 0.45;
}

.scan-launch-icon::after {
  left: -4px;
  top: 50%;
  width: 28px;
  height: 2px;
  transform: translateY(-50%);
  opacity: 0.45;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  font-size: 22px;
  letter-spacing: 0;
}

.eyebrow {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bulk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.app-menu-wrap {
  position: relative;
  display: inline-flex;
}

.menu-toggle {
  width: 44px;
  min-width: 44px;
  padding: 0;
  gap: 10px;
  flex-direction: column;
}

.menu-toggle span {
  display: block;
  width: 20px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
}

.app-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 30;
  display: grid;
  width: 260px;
  min-height: 320px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  max-height: calc(100vh - 82px);
  overflow-x: hidden;
  overflow-y: auto;
}

.app-menu[hidden] {
  display: none;
}

.menu-user {
  display: flex;
  align-items: center;
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
  padding: 10px 14px;
}

.tool-tab.menu-tool-tab {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  min-height: 72px;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel);
  color: var(--ink);
  padding: 0 18px;
  text-align: left;
  font-size: 18px;
  font-weight: 900;
}

.tool-tab.menu-tool-tab:hover {
  background: var(--panel-soft);
  color: var(--accent-dark);
}

.tool-tab.menu-tool-tab.active {
  border-left: 5px solid var(--accent);
  background: var(--pick-selected-bg);
  color: var(--pick-selected-ink);
  padding-left: 13px;
}

.admin-menu-link {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  min-height: 72px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 0 18px;
  text-align: left;
  text-decoration: none;
  font-size: 18px;
  font-weight: 900;
}

.admin-menu-link:hover {
  background: var(--panel-soft);
  color: var(--accent-dark);
}

.menu-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  font-size: 22px;
}

.menu-logout {
  display: flex;
  align-items: center;
  min-height: 54px;
  margin-top: auto;
  border-top: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--danger);
  padding: 0 18px;
  font-weight: 900;
  text-decoration: none;
}

.menu-logout:hover {
  color: var(--danger-dark);
}

.menu-action {
  justify-content: flex-start;
  min-height: 54px;
  border-radius: 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 0 18px;
  text-align: left;
  font-weight: 900;
}

.menu-action:hover {
  background: var(--panel-soft);
  color: var(--accent-dark);
}

.user-badge {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.menu-user .user-badge {
  width: 100%;
  justify-content: center;
  background: var(--panel);
  color: var(--ink);
}

.league-select {
  min-width: 190px;
}

.logic-select-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.logic-select {
  min-width: 150px;
}

.tool-screen {
  display: none;
}

.tool-screen.active {
  display: block;
}

.train-planner-shell { padding-bottom: 32px; }
.train-planner-panel { max-width: 1000px; margin: 0 auto; }
.train-planner-header { margin-bottom: 12px; }
.train-week-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.train-suggestion-source { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 800; }
.train-suggestion-source select { min-height: 34px; }
.train-tabs { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin: 0 0 12px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.train-filter-controls { display: flex; gap: 10px; margin: 10px 0; }
.train-filter-controls label, .train-filter-source-label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; font-weight: 800; }
.train-filter-controls input, .train-filter-source-label textarea, .train-filter-output { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 6px; background: var(--field); color: var(--ink); padding: 8px; font: inherit; }
.train-filter-source-label textarea, .train-filter-output { resize: vertical; min-height: 120px; margin: 4px 0 12px; }
.train-filter-results { margin: 10px 0; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 8px 10px; }
.train-filter-results h4 { margin: 0 0 6px; }
.train-filter-results ul { margin: 0; padding-left: 20px; }
.train-filter-correction-dialog { width: min(680px, calc(100vw - 24px)); max-height: min(90vh, 720px); overflow: auto; padding: 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink); box-shadow: 0 18px 60px rgba(0,0,0,.45); }
.train-filter-correction-dialog::backdrop { background: rgb(0 0 0 / 65%); }
.train-filter-correction-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.train-filter-correction-header h2 { margin: 0; }
.train-filter-correction-list { display: grid; gap: 10px; margin: 16px 0; }
.train-filter-correction-row { display: grid; grid-template-columns: minmax(150px, .8fr) minmax(220px, 1.2fr); align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); }
.train-filter-correction-row span { display: grid; gap: 3px; min-width: 0; }
.train-filter-correction-row small { color: var(--muted); font-size: 11px; }
.train-filter-correction-row select { min-width: 0; width: 100%; }
@media (max-width: 600px) {
  .train-filter-correction-dialog { padding: 16px; }
  .train-filter-correction-row { grid-template-columns: 1fr; gap: 7px; }
}
.train-tab { min-height: 40px; border: 1px solid transparent; background: transparent; color: var(--muted); }
.train-tab:hover, .train-tab.active { border-color: var(--accent); background: var(--pick-selected-bg); color: var(--pick-selected-ink); }
.train-status { min-height: 22px; color: var(--win); font-size: 13px; font-weight: 750; }
.train-section-title, .train-run-head, .train-run-foot, .train-history-row, .train-ranking-card > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.train-section-title { margin: 8px 0; }
#trainPlannerPanel > .train-section-title { padding: 0 10px; }
.train-section-title h3 { margin: 0; font-size: 18px; }
.train-section-title span, .train-day small, .train-ranking-card small { color: var(--muted); font-size: 12px; }
.train-day, .train-run, .train-ranking-card { margin: 6px 0; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 7px 10px; box-shadow: var(--shadow); }
.train-day > div:first-child { display: flex; justify-content: space-between; align-items: center; }
.train-day-meta { display: inline-flex; align-items: center; justify-content: flex-end; gap: 7px; white-space: nowrap; }
.train-day small, .train-ranking-card small { display: block; }
.train-run { box-shadow: none; background: var(--panel-soft); }
.train-run { border: 0; padding: 0; background: transparent; }
.train-badge { border-radius: 999px; padding: 2px 7px; background: var(--edit-bg); color: var(--muted); font-size: 11px; font-weight: 800; text-transform: capitalize; }
.train-confirmed { background: var(--ghost-reward-bg); color: var(--win); }
.train-run-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin: 2px 0 0; }
.train-role { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px; min-width: 0; padding: 2px 8px 0; text-align: center; }
.train-role + .train-role { border-left: 1px solid var(--line); }
.train-role-label { color: var(--muted); font-size: 11px; font-weight: 800; }
.train-role small { color: var(--muted); font-size: 10px; line-height: 1.25; }
.train-run-grid label, .train-schema label { display: grid; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 800; }
.train-run-grid select { min-width: 0; min-height: 34px; padding: 0 5px; font-size: 12px; }
.train-player-picker { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 3px; width: 96px; min-width: 96px; min-height: 86px; padding: 1px 2px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ink); text-align: center; font-size: 12px; }
.train-player-picker:hover, .train-player-picker:focus-visible { border-color: var(--accent); background: var(--pick-selected-bg); }
.train-player-picker.is-empty { width: 96px; min-height: 86px; padding: 1px 2px; }
.train-player-picker.is-empty .train-player-picker-name { display: none; }
.train-player-picker-name { display: block; width: 100%; min-height: 1.15em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.15; }
.train-player-avatar { position: relative; display: inline-flex; flex: 0 0 68px; align-items: center; justify-content: center; width: 68px; height: 68px; border-radius: 10px; background: var(--accent); color: var(--accent-contrast, #fff); font-size: 24px; font-weight: 800; }
.train-player-avatar-image { display: block; width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.train-player-avatar-fallback { align-items: center; justify-content: center; width: 100%; height: 100%; }
.train-player-avatar-fallback:not([hidden]) { display: inline-flex; }
.train-player-picker.is-empty .train-player-avatar { border-radius: 10px; border: 1px solid var(--line); background: var(--field); color: var(--accent); font-size: 30px; }
.train-player-cooldown-dot { position: absolute; right: -3px; bottom: -3px; width: 16px; height: 16px; border: 3px solid var(--panel-soft); border-radius: 50%; box-shadow: 0 0 0 1px rgb(0 0 0 / 28%); }
.train-player-cooldown-dot.is-ready { background: #22c55e; }
.train-player-cooldown-dot.is-cooldown { background: #facc15; }
.train-player-rank { position: absolute; left: -3px; top: -3px; min-width: 24px; height: 20px; padding: 0 4px; border: 2px solid var(--panel-soft); border-radius: 999px; background: var(--field); color: var(--ink); font-size: 10px; line-height: 16px; font-weight: 900; text-align: center; box-shadow: 0 0 0 1px rgb(0 0 0 / 22%); }
.train-player-picker-modal { width: min(460px, calc(100vw - 24px)); }
.train-player-search { display: flex; align-items: center; gap: 4px; margin: 0 0 8px; }
.train-player-search input { width: 100%; min-width: 0; min-height: 34px; padding: 5px 9px; }
.train-player-search button { flex: 0 0 30px; width: 30px; min-height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--field); color: var(--muted); font-size: 18px; line-height: 1; }
.train-player-search button:hover, .train-player-search button:focus-visible { border-color: var(--accent); color: var(--ink); }
.train-player-picker-list { max-height: 60vh; overflow: auto; }
.train-player-table { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; min-width: 0; }
.train-player-choice { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px; width: 100%; min-height: 106px; padding: 8px 5px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); color: var(--ink); text-align: center; }
.train-player-choice-name { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.train-player-choice-warning { display: block; max-width: 100%; color: #dc2626; font-size: 10px; font-weight: 800; line-height: 1.15; white-space: normal; }
.train-player-choice:hover, .train-player-choice.is-selected { border-color: var(--accent); background: var(--pick-selected-bg); color: var(--pick-selected-ink); }
.train-player-choice.is-suggested { outline: 2px solid #facc15; outline-offset: 2px; }
.train-player-clear { width: auto; min-height: 30px; margin: 0 0 7px; padding: 4px 9px; border-color: #b4535a; border-radius: 6px; background: rgb(127 29 29 / 18%); color: #fca5a5; font-size: 11px; font-weight: 800; }
.train-player-clear:hover, .train-player-clear:focus-visible { border-color: #ef4444; background: rgb(127 29 29 / 32%); color: #fecaca; }
.train-player-separator { grid-column: 1 / -1; margin: 7px 0 1px; padding: 5px 2px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 800; }
.train-run-confirm { position: absolute; right: 0; bottom: 0; display: inline-flex; align-items: center; justify-content: center; width: 32px; min-width: 32px; height: 32px; min-height: 32px; margin-top: 0; padding: 0; border: 1px solid #15803d; border-radius: 50%; background: #16a34a; color: #fff; font-size: 20px; font-weight: 900; line-height: 1; }
.train-run-confirm.is-dirty { border-color: #ca8a04; background: #facc15; color: #713f12; }
.train-run-confirm:hover, .train-run-confirm:focus-visible { filter: brightness(.94); }
.train-history-row { border-bottom: 1px solid var(--line); padding: 10px 2px; font-size: 13px; }
.train-history-card { margin: 8px 0; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 8px 10px; }
.train-history-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.train-history-card-head > div { display: grid; gap: 3px; }
.train-history-card-head small, .train-history-week small { color: var(--muted); font-size: 11px; }
.train-history-week { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 10px 0 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-soft); }
.train-history-rule { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 9px 0 4px; color: var(--muted); font-size: 11px; }
.train-history-rule strong { color: var(--ink); font-size: 12px; text-align: right; }
.train-history-assignees { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 10px; }
.train-history-assignee { display: grid; justify-items: center; gap: 5px; min-width: 0; text-align: center; }
.train-history-assignee .train-player-avatar { width: 84px; height: 84px; flex-basis: 84px; border-radius: 12px; font-size: 30px; }
.train-history-role { width: 100%; color: var(--muted); font-size: 11px; font-weight: 800; text-align: left; }
.train-history-assignee strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.train-history-empty-avatar { display: inline-flex; align-items: center; justify-content: center; width: 84px; height: 84px; border: 1px solid var(--line); border-radius: 12px; background: var(--field); color: var(--muted); font-size: 26px; }
.train-history-pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 0 18px; }
.train-history-pager span { color: var(--muted); font-size: 12px; text-align: center; }
.train-history-card .train-history-row { padding: 0 0 7px; }
.train-history-assignment { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 7px; font-size: 12px; }
.train-history-assignment small { color: var(--muted); }
.train-history-row time { color: var(--muted); font-size: 11px; }
.train-ranking-card ol { margin: 8px 0 0; padding-left: 28px; }
.train-ranking-card li { display: flex; gap: 8px; align-items: center; margin: 4px 0; }
.train-ranking-preview { width: 100%; margin-top: 8px; border-collapse: collapse; table-layout: fixed; }
.train-ranking-preview th, .train-ranking-preview td { padding: 5px 6px; border-top: 1px solid var(--line); text-align: left; }
.train-ranking-preview th { color: var(--muted); font-size: 11px; font-weight: 600; }
.train-ranking-preview th:first-child, .train-ranking-preview td:first-child { width: 34px; text-align: right; }
.train-ranking-preview th:last-child, .train-ranking-preview td:last-child { width: 105px; text-align: right; font-variant-numeric: tabular-nums; }
.train-ranking-preview td:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.train-ranking-card input, .train-schema input { width: 100%; min-height: 32px; border: 1px solid var(--line); border-radius: 5px; background: var(--field); color: var(--ink); padding: 4px 7px; }
.train-ranking-card li input { max-width: 220px; }
.train-ranking-card li span { color: var(--muted); font-size: 11px; }
.train-ranking-card > div > span { min-width: 0; }
.train-ranking-entry-name { color: var(--ink) !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.train-ranking-actions { display: flex; align-items: center; gap: 6px; }
.train-subtabs { display: flex; gap: 6px; margin: 8px 0 12px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.train-subtabs button { min-height: 32px; }
.train-subtabs button.active { background: var(--accent); color: var(--accent-contrast, #fff); }
.train-ranking-pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 12px 0 4px; color: var(--muted); font-size: 12px; }
.train-shiny-calendar-card { overflow: hidden; }
.train-ranking-card .train-shiny-controls { display: grid; }
.train-ranking-card .train-shiny-export-target { display: block; }
.train-shiny-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.train-shiny-header > span { display: grid; gap: 3px; }
.train-shiny-header small { color: var(--muted); font-size: 11px; }
.train-shiny-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px 12px; margin: 12px 0 6px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-soft); }
.train-shiny-controls label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; font-weight: 750; }
.train-shiny-controls input { width: 100%; min-height: 32px; border: 1px solid var(--line); border-radius: 5px; background: var(--field); color: var(--ink); padding: 5px 7px; font: inherit; font-size: 13px; }
.train-shiny-controls button { align-self: end; min-height: 32px; }
.train-shiny-note { margin: 6px 0 10px; font-size: 11px; }
.train-shiny-export-target { padding: 8px; border: 1px solid #e3d9c4; border-radius: 10px; background: #fffdf8; color: #3e3a34; }
.train-shiny-export-title { margin: 0 0 8px; color: #443f37; font-size: 20px; text-align: center; }
.train-shiny-weekdays, .train-shiny-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.train-shiny-weekdays { margin-bottom: 3px; color: #81796e; font-size: clamp(12px, 3.5vw, 16px); font-weight: 800; text-align: center; }
.train-shiny-day { display: flex; min-width: 0; aspect-ratio: 1.35 / 1; align-items: flex-start; justify-content: flex-start; padding: 5px; border: 1px solid rgb(126 111 88 / 14%); border-radius: 6px; }
.train-shiny-day strong { font-size: 18px; line-height: 1; }
.train-shiny-empty { border-color: transparent; background: transparent; }
.train-shiny-phase-0 { background: #f8dedf; }
.train-shiny-phase-1 { background: #dff0e5; }
.train-shiny-phase-2 { background: #dfeafb; }
.train-shiny-group-divider { border-top: 1px solid rgb(126 111 88 / 28%); margin: 12px 0 7px; }
.train-shiny-group-label { margin-bottom: 7px; color: #81796e; font-size: 14px; font-weight: 850; letter-spacing: .04em; text-align: center; }
.train-shiny-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; justify-content: center; gap: 8px; margin-top: 7px; }
.train-shiny-group { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-content: start; gap: 4px 3px; min-width: 0; padding: 7px 6px; border: 1px solid rgb(126 111 88 / 18%); border-radius: 7px; color: #4d473f; }
.train-shiny-group span { display: flex; width: min(100%, 48px); min-width: 0; aspect-ratio: 1; align-items: center; justify-content: center; min-height: 0; padding: 2px; border: 1px solid rgb(126 111 88 / 18%); border-radius: 4px; background: rgb(255 255 255 / 48%); font-size: clamp(12px, 3.6vw, 14px); font-weight: 850; line-height: 1.1; }
.train-lottery-summary { margin: 8px 0; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-soft); font-weight: 800; font-variant-numeric: tabular-nums; }
.train-lottery-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin: 12px 0 16px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--line); }
.train-lottery-cell { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; min-height: 44px; padding: 7px 9px; background: var(--panel); }
.train-lottery-cell span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 750; }
.train-lottery-cell code { flex: 0 0 auto; padding: 3px 7px; border: 1px solid #c9aa4d; border-radius: 6px; background: #fffbe6; color: #4b3a0b; font-size: 12px; font-weight: 900; white-space: nowrap; }
.train-lottery-check { margin: 10px 0 16px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.train-lottery-check summary { cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 800; }
.train-lottery-table-wrap { overflow-x: auto; margin: 8px 0 16px; }
.train-lottery-table { width: 100%; border-collapse: collapse; min-width: 540px; }
.train-lottery-table th, .train-lottery-table td { padding: 7px 8px; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
.train-lottery-table th { color: var(--muted); font-size: 11px; }
.train-lottery-table td:first-child { width: 54px; font-variant-numeric: tabular-nums; }
.train-lottery-table code { white-space: nowrap; }

/* Printed-ticket inspired lottery board: intentionally stays light in dark mode. */
.train-lottery-board { overflow: hidden; padding: 18px; border: 1px solid #c8d99c; border-radius: 14px; background: linear-gradient(145deg, #f7ffe9 0%, #fffdf2 48%, #effbdc 100%); color: #27351e; }
.train-lottery-board .muted { color: #667154; }
.train-lottery-board .train-lottery-summary { border-color: #d9c58b; background: #fff3b8; color: #4b3a0b; }
.train-lottery-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; margin: 12px 0 16px; padding: 14px; border: 1px solid #d9c58b; border-radius: 12px; background: #fffdf5; color: #332d1d; }
.train-lottery-controls label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.train-lottery-controls label span { color: #766b4f; font-size: 12px; }
.train-lottery-controls textarea { grid-column: 1 / -1; width: 100%; min-height: 78px; resize: vertical; border: 1px solid #d9c58b; border-radius: 8px; padding: 9px; background: #fff; color: #332d1d; font: inherit; }
.train-lottery-controls button { align-self: end; white-space: nowrap; }
.train-lottery-tickets { display: grid; grid-template-columns: repeat(3, minmax(250px, 1fr)); gap: 14px; margin: 16px 0; }
.train-lottery-ticket { position: relative; display: flex; flex-direction: column; justify-content: flex-start; aspect-ratio: 16 / 9; min-width: 0; overflow: hidden; padding: 12px 10px; border: 1px solid #dccb9b; border-radius: 12px; background: #fffdf7; color: #332d1d; box-shadow: 0 4px 12px rgb(88 65 16 / 10%); }
.train-lottery-ticket::before, .train-lottery-ticket::after { position: absolute; top: 50%; width: 18px; height: 18px; border: 0; border-radius: 50%; background: #f7ffe9; content: ""; transform: translateY(-50%); }
.train-lottery-ticket::before { left: -10px; } .train-lottery-ticket::after { right: -10px; }
.train-ticket-head { display: flex; flex-direction: column; align-items: center; gap: 1px; padding-bottom: 0; text-align: center; }
.train-ticket-head strong { overflow-wrap: anywhere; font-size: 18px; }
.train-ticket-head .train-ticket-range-value { color: #7d5c0a; font-size: 20px; font-variant-numeric: tabular-nums; }
.train-ticket-range { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 10px 0; }
.train-ticket-range strong { color: #7d5c0a; font-size: 20px; font-variant-numeric: tabular-nums; }
.train-ticket-combos { display: flex; align-items: flex-end; justify-content: space-around; flex: 1 1 auto; width: 100%; min-width: 0; gap: 0; margin-top: 5px; }
.train-combination { display: inline-flex; flex: 0 1 auto; align-items: center; padding: 4px 7px; border: 1px solid #e0d29e; border-radius: 7px; background: #fff; }
.train-combination-spacer { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; color: #7d5c0a; font-size: 22px; font-weight: 900; line-height: 1; }
.train-dice { display: inline-flex; gap: 8px; }
.train-die-stack { display: flex; flex-direction: column; align-items: center; gap: 3px; color: #5a4610; font-size: 12px; font-weight: 900; line-height: 1; }
.train-die-face { display: grid; grid-template: repeat(3, 6px) / repeat(3, 6px); gap: 2px; width: 34px; height: 34px; padding: 5px; border: 1px solid #c8aa55; border-radius: 5px; background: #fff8d9; }
.train-die-face i { display: block; width: 5px; height: 5px; border-radius: 50%; } .train-die-face i.pip { background: #765609; }
.train-lottery-excluded { opacity: .68; filter: grayscale(.2); }
.train-lottery-excluded .train-ticket-head strong, .train-lottery-excluded .train-ticket-range strong { text-decoration: line-through; }
.train-lottery-excluded .train-ticket-combos { text-decoration: line-through; }
.train-ticket-cross { position: absolute; z-index: 2; inset: 32% 8% 20%; pointer-events: none; opacity: .7; background: linear-gradient(24deg, transparent 46%, #df3c32 47%, #df3c32 53%, transparent 54%), linear-gradient(-24deg, transparent 46%, #df3c32 47%, #df3c32 53%, transparent 54%); }
@media (max-width: 900px) { .train-lottery-tickets { grid-template-columns: repeat(2, minmax(240px, 1fr)); } }
@media (max-width: 600px) { .train-shiny-controls { grid-template-columns: 1fr 1fr; } .train-shiny-controls label:nth-child(n+3) { grid-column: 1 / -1; } .train-shiny-controls button { grid-column: 1 / -1; } .train-shiny-day { padding: 4px; } .train-shiny-day strong { font-size: 16px; } }
@media (max-width: 340px) { .train-shiny-groups { grid-template-columns: 1fr; gap: 6px; } .train-shiny-group { grid-template-columns: repeat(3, 46px); justify-content: center; } .train-shiny-group span { width: 46px; font-size: 14px; } }
@media (min-width: 601px) {
  .train-ranking-card .train-shiny-export-target { display: block; width: fit-content; max-width: 100%; margin-inline: auto; }
  .train-ranking-card .train-shiny-calendar-column { min-width: 0; }
  .train-ranking-card .train-shiny-groups { grid-template-columns: repeat(3, max-content); gap: 6px; margin-top: 7px; }
  .train-ranking-card .train-shiny-group { grid-template-columns: repeat(3, 40px); width: fit-content; justify-self: center; gap: 3px 2px; }
  .train-ranking-card .train-shiny-group span { width: 40px; font-size: 13px; }
  .train-ranking-card .train-shiny-weekdays { font-size: 14px; letter-spacing: 0; }
  .train-ranking-card .train-shiny-day strong { font-size: 14px; }
}
@media (max-width: 600px) { .train-lottery-board { padding: 12px; border-radius: 10px; } .train-lottery-tickets { grid-template-columns: 1fr; } }
.train-ranking-types { box-shadow: none; background: var(--panel-soft); }
.train-ranking-type-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); padding: 7px 0; }
.train-ranking-type-row span { min-width: 0; }
.train-ranking-type-row strong, .train-ranking-type-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.train-ranking-type-row small, .train-type-period-hint { color: var(--muted); font-size: 11px; }
.train-ranking-type-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.train-ranking-type-actions .danger { color: var(--danger, #f87171); }
.train-schema-value { color: var(--ink); font-size: 12px; font-weight: 700; text-transform: capitalize; }
.train-player-settings { margin: 12px 0; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-soft); padding: 10px; }
.train-player-filter { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 8px 0; }
.train-player-filter label, .train-editor-form label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; font-weight: 800; }
.train-player-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); padding: 8px 0; }
.train-player-row span:first-child { min-width: 0; }
.train-player-row strong, .train-player-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.train-player-row small { color: var(--muted); font-size: 11px; }
.train-editor-modal { width: min(560px, calc(100vw - 24px)); max-height: 90vh; overflow: auto; padding: 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink); box-shadow: 0 18px 60px rgba(0,0,0,.45); }
.train-editor-form { display: grid; gap: 12px; }
.train-editor-inline-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.train-editor-form input, .train-editor-form select, .train-editor-form textarea, .train-player-filter input { width: 100%; min-height: 34px; border: 1px solid var(--line); border-radius: 5px; background: var(--field); color: var(--ink); padding: 6px 8px; }
.train-editor-form textarea { min-height: 220px; resize: vertical; font: inherit; line-height: 1.45; }
.train-editor-actions { display: flex; justify-content: flex-end; gap: 8px; }
.train-editor-modal::backdrop { background: rgb(0 0 0 / 65%); }
.train-schema { margin-top: 12px; border: 1px solid var(--line); border-radius: 8px; padding: 9px; }
.train-schema label { grid-template-columns: 110px 1fr; align-items: center; margin: 6px 0; }
.train-schema-group + .train-schema-group { margin-top: 16px; }
.train-schema-group h4 { margin: 0 0 6px; color: var(--ink); font-size: 14px; text-transform: capitalize; }
.train-schema-header, .train-schema-row { display: grid; grid-template-columns: minmax(88px, .8fr) minmax(150px, 1.5fr) minmax(80px, .7fr) minmax(100px, .9fr) minmax(80px, .7fr) minmax(80px, .7fr); gap: 8px; align-items: center; }
.train-schema-header { padding: 0 8px; color: var(--muted); font-size: 11px; font-weight: 800; }
.train-schema-row { margin: 4px 0; padding: 4px 8px; border-radius: 6px; }
.train-schema-row:nth-child(even) { background: var(--panel-soft); }
.train-schema-row > .train-schema-control { display: contents; }
.train-schema-row > .train-schema-control > span { display: none; }

@media (max-width: 600px) {
  .train-planner-header { align-items: flex-start; flex-direction: column; }
  .train-week-actions { width: 100%; }
  .train-week-actions select, .train-week-actions button { flex: 1; min-width: 0; }
  .train-run-grid { grid-template-columns: repeat(2, 1fr); }
  .train-role { padding: 8px 4px; }
  .train-run-foot { align-items: flex-start; flex-wrap: wrap; }
  .train-run-foot span { width: 100%; }
  .train-history-row { align-items: flex-start; flex-wrap: wrap; }
  .train-history-row time { width: 100%; }
  .train-history-rule { align-items: flex-start; flex-direction: column; gap: 3px; }
  .train-history-rule strong { text-align: left; }
  .train-history-week { align-items: flex-start; flex-direction: column; gap: 3px; }
  .train-player-filter { grid-template-columns: 1fr; }
  .train-player-row { align-items: flex-start; flex-direction: column; }
  .train-player-row > span:last-child { width: 100%; }
  .train-player-row button { min-width: 0; }
  .train-editor-modal { padding: 16px; }
  .train-editor-inline-fields { grid-template-columns: 1fr; }
  .train-schema label { grid-template-columns: 1fr; }
  .train-schema-header { display: none; }
  .train-schema-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; padding: 8px; }
  .train-schema-row strong { grid-column: 1 / -1; }
  .train-schema-row > .train-schema-control { display: grid; grid-template-columns: 1fr; gap: 3px; align-items: stretch; margin: 0; }
  .train-schema-row > .train-schema-control > span { display: block; color: var(--muted); font-size: 10px; font-weight: 800; }
}

.desert-storm-shell {
  padding-bottom: 32px;
}

.desert-storm-panel {
  max-width: 1500px;
  margin: 0 auto;
}

.desert-storm-results {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, .5fr);
  gap: 14px;
}
.desert-storm-roster-columns {
  display: grid;
  grid-column: 1 / span 2;
  grid-row: 1;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: auto auto auto;
  align-content: start;
  gap: 14px;
}

.ds-legend { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 0; font-size: 11px; }
.ds-legend-target { color: #5a9f68; }
.ds-legend-reserve-target { color: #e5b84b; }
.ds-legend-reserve { color: #b68b63; }
.ds-legend-added { color: #4f85bd; }
.desert-storm-roster-columns > .ds-group-a-main { grid-column: 1; grid-row: 1; }
.desert-storm-roster-columns > .ds-group-b-main { grid-column: 2; grid-row: 1; }
.ds-vote-hover { grid-column: 1 / span 2; grid-row: 2; align-self: start; width: 100%; min-height: 0; height: auto; margin: 0; padding: 3px 8px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); background: var(--panel-soft); font-size: 11px; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.desert-storm-roster-columns > .ds-group-a-reserves { grid-column: 1; grid-row: 3; }
.desert-storm-roster-columns > .ds-group-b-reserves { grid-column: 2; grid-row: 3; }
.desert-storm-unused-card { grid-column: 3; grid-row: 1; align-self: start; min-height: 0; }
.ds-vote-hover.is-active { border-color: var(--accent); color: var(--ink); }

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

.desert-storm-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.desert-storm-vote {
  min-height: 140px;
  resize: vertical;
}

.desert-storm-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.ds-file-button { display: inline-flex !important; position: relative; align-items: center; justify-content: center; min-height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-soft); color: var(--ink) !important; cursor: pointer; font-size: 12px !important; font-weight: 700 !important; }
.ds-file-button:hover { border-color: var(--accent); background: var(--pick-hover); }
.ds-file-button input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }

.desert-storm-results {
  margin-top: 14px;
}

.desert-storm-result-card {
  padding: 14px;
  box-shadow: none;
}

.ds-table {
  width: 100%;
  border-collapse: collapse;
}

.ds-table td,
.ds-table th {
  padding: 5px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.ds-building-name, .ds-building-code { display: block; }
.ds-building-code { margin-top: 2px; color: var(--muted); font-size: 10px; font-weight: 500; }
.ds-building-detail, .ds-building-move { display: block; color: var(--muted); font-size: 10px; font-weight: 500; line-height: 1.2; }
.ds-building-move { margin-top: 3px; color: var(--accent); }

.ds-table td { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }

.ds-group-section + .ds-group-section { margin-top: 18px; }
.ds-reserves { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.ds-player-button { display: grid; grid-template-columns: minmax(0, 1fr) 3.8em 4.5em; align-items: center; width: 100%; min-width: 0; margin: 1px 0; padding: 3px 5px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-soft); color: var(--ink); cursor: pointer; text-align: left; font-size: 12px; line-height: 1.2; }
.ds-player-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-player-name.ds-no-vote-name { color: var(--muted); }
.ds-player-kills-badge { display: inline-block; justify-self: end; min-width: 3.2em; margin-left: 2px; padding: 0 3px; border: 1px solid hsl(var(--ds-kill-hue, 120) 62% 42% / 0.75); border-radius: 3px; color: hsl(var(--ds-kill-hue, 120) 72% 32%); font-size: 10px; font-weight: 700; line-height: 1.3; text-align: center; }
.theme-dark .ds-player-kills-badge { border-color: hsl(var(--ds-kill-hue, 120) 70% 58% / 0.85); color: hsl(var(--ds-kill-hue, 120) 75% 70%); }
.ds-group-mismatch { color: var(--muted); font-size: 0.9em; font-weight: 700; }
.ds-player-power { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ds-player-button.ds-vote-target { color: #5a9f68; }
.ds-player-button.ds-vote-reserve-target { color: #e5b84b; }
.ds-player-button.ds-vote-reserve { color: #b68b63; }
.ds-player-button.ds-vote-cant-play { color: #d05a5a; }
.ds-player-name.ds-cant-play-name { color: #f04444 !important; font-weight: 700; }
.ds-player-button.ds-manual-added { color: #4f85bd; }
.ds-player-button.ds-lowest-power { border-color: color-mix(in srgb, var(--line) 75%, #e5b84b); }
.ds-player-button:hover, .ds-player-button:focus-visible { border-color: var(--accent); background: var(--pick-hover); }
.ds-player-button.ds-selected { border-color: var(--accent); background: var(--pick-selected-bg); color: var(--pick-selected-ink); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }

.ds-venn-modal { position: relative; width: min(1200px, calc(100vw - 28px)); max-height: calc(100vh - 28px); overflow: auto; padding: 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink); box-shadow: 0 24px 80px rgba(0,0,0,.42); }
.ds-venn-modal .export-modal-header { margin-bottom: 8px; }
.ds-venn-modal .export-modal-header p:last-child { color: var(--muted); }
.ds-venn-graphic { position: relative; max-width: 100%; margin: 8px auto 18px; overflow: hidden; }
.ds-venn-circle { position: absolute; display: grid; place-items: start center; padding-top: 1.3%; border: 2px solid; border-radius: 50%; font-size: clamp(10px, 1.05vw, 14px); font-weight: 800; pointer-events: none; }
.ds-venn-circle-1 { left: 8.96%; border-color: #df8d62; background: rgba(223,141,98,.13); }
.ds-venn-circle-2 { left: 47.64%; border-color: #6aa7d8; background: rgba(106,167,216,.13); }
.ds-venn-circle-3 { left: 28.3%; top: 25%; border-color: #8fbd72; background: rgba(143,189,114,.13); }
.ds-venn-graphic-region { position: absolute; z-index: 2; color: var(--ink); font-size: 9px; font-weight: 700; line-height: 1.15; text-align: center; pointer-events: none; }
.ds-venn-name { position: absolute; display: block; min-width: 0; padding: 2px 1px; overflow: hidden; white-space: nowrap; text-overflow: clip; }
.ds-venn-name-reserve { color: #e5b84b !important; font-weight: 800; }
.ds-venn-name:hover { color: var(--accent); }
.ds-venn-region-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ds-venn-region { min-width: 0; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel-soft); }
.ds-venn-region h3, .ds-venn-no-hour h3 { margin: 0 0 4px; font-size: 13px; }
.ds-venn-region p { margin: 0; color: var(--muted); overflow-wrap: anywhere; font-size: 12px; line-height: 1.45; }
.ds-venn-no-hour { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.ds-venn-no-hour ul { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; padding-left: 20px; color: var(--muted); font-size: 12px; }
@media (max-width: 560px) {
  .ds-venn-modal { padding: 18px; }
  .ds-venn-graphic { max-width: none; transform: scale(var(--ds-venn-scale, .42)); transform-origin: top left; }
  .ds-venn-region-list { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  .desert-storm-input-grid,
  .desert-storm-results {
    grid-template-columns: 1fr;
  }
  .desert-storm-roster-columns {
    grid-column: auto;
    grid-row: auto;
    grid-template-columns: 1fr;
  }
  .ds-vote-hover,
  .desert-storm-unused-card,
  .desert-storm-roster-columns > .ds-group-a-main,
  .desert-storm-roster-columns > .ds-group-b-main,
  .desert-storm-roster-columns > .ds-group-a-reserves,
  .desert-storm-roster-columns > .ds-group-b-reserves { grid-column: auto; grid-row: auto; }
}

.league-shell {
  grid-template-columns: minmax(330px, 440px) 1fr;
  gap: 18px;
  padding-bottom: 32px;
}

.league-shell.active {
  display: grid;
}

.tool-local-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}

.league-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.setup-panel,
.bracket-panel,
.standings-panel,
.player-panel,
.report-panel,
.task-panel,
.healing-panel {
  padding: 18px;
}

.player-panel,
.report-panel,
.task-panel,
.healing-panel {
  width: 100%;
}

.setup-panel {
  grid-row: span 2;
}

.app-setup-collapsed .league-shell {
  grid-template-columns: 92px minmax(880px, 1fr) minmax(270px, 310px);
  align-items: start;
  gap: 16px;
}

.app-setup-collapsed .setup-panel {
  grid-row: auto;
  min-height: 100%;
  padding: 12px;
}

.app-setup-collapsed .setup-panel .section-title {
  display: grid;
  gap: 12px;
  margin-bottom: 0;
}

.app-setup-collapsed .setup-panel .eyebrow,
.app-setup-collapsed .setup-panel h2,
.app-setup-collapsed .save-state {
  display: none;
}

.app-setup-collapsed .setup-actions {
  justify-content: center;
}

.app-setup-collapsed .setup-actions .compact {
  writing-mode: vertical-rl;
  min-height: 96px;
  padding: 10px 8px;
}

.app-setup-collapsed .bracket-panel {
  grid-column: 2;
  grid-row: 2;
}

.app-setup-collapsed .standings-panel {
  grid-column: 3;
  grid-row: 2;
  align-self: stretch;
  border-color: var(--line);
  background: var(--panel-soft);
  box-shadow: none;
  padding: 14px;
}

.app-setup-collapsed .rounds {
  grid-template-columns: repeat(4, minmax(250px, 1fr));
  gap: 14px;
}

.app-setup-collapsed .standings-panel .section-title {
  align-items: center;
  min-height: 34px;
  margin-bottom: 8px;
}

.app-setup-collapsed .standings-panel .eyebrow {
  display: none;
}

.app-setup-collapsed .standings-panel h2 {
  font-size: 16px;
}

.app-setup-collapsed .standings {
  grid-template-columns: 1fr;
  gap: 5px;
  margin-top: 44px;
}

.app-setup-collapsed .standing-row {
  grid-template-columns: 24px 1fr;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  gap: 8px;
  padding: 5px 7px;
}

.app-setup-collapsed .standing-row:nth-child(odd) {
  border-bottom-width: 1px;
  border-radius: 6px;
  margin-top: 0;
}

.app-setup-collapsed .standing-row:nth-child(even) {
  border-top-width: 1px;
  border-radius: 6px;
  margin-bottom: 0;
}

.app-setup-collapsed .standing-row.standing-alt {
  border-color: var(--line);
  background: var(--panel);
}

.app-setup-collapsed .standing-row .team-meta {
  font-size: 11px;
  line-height: 1.05;
}

.app-setup-collapsed .standing-rank {
  width: 24px;
  height: 24px;
  font-size: 11px;
}

.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.player-shell,
.report-shell,
.vs-shell,
.task-shell,
.ghost-task-shell,
.mine-shell {
  padding-bottom: 32px;
}

.app-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  padding: 12px 0 22px;
}

.save-state,
.summary {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.setup-actions,
.prediction-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.prediction-actions {
  align-items: center;
}

.compact {
  min-height: 34px;
  padding: 0 10px;
}

.setup-grid {
  display: grid;
  gap: 14px;
}

.team-form {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 10px;
}

.team-form label,
.bulk-box label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.team-form label:nth-child(2),
.team-form button {
  grid-column: span 1;
}

.team-form label:nth-child(3),
.team-form label:nth-child(4) {
  grid-column: span 1;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  color: var(--ink);
  padding: 10px 11px;
}

textarea {
  min-height: 130px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 122, 140, 0.14);
  outline: none;
}

.bulk-box {
  display: grid;
  gap: 10px;
}

.team-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.team-row,
.standing-row {
  display: grid;
  grid-template-columns: 38px 1fr auto auto;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  padding: 8px;
}

.team-row.bookmarked,
.standing-row.bookmarked,
.team-pick.bookmarked {
  border-color: var(--bookmark-line);
  background: var(--bookmark-bg);
}

.bookmarked .team-name,
.team-pick.bookmarked .team-pick-name {
  color: var(--bookmark-ink);
}

.seed,
.standing-rank {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--seed-bg);
  color: var(--accent-dark);
  font-weight: 900;
}

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

.team-name {
  display: block;
  overflow-wrap: anywhere;
}

.team-meta {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.bookmark-team,
.edit-team {
  min-height: 34px;
  padding: 0 10px;
  background: var(--edit-bg);
  color: var(--accent-dark);
}

.bookmark-team {
  min-width: 38px;
  color: var(--bookmark-ink);
  font-size: 18px;
}

.rounds {
  display: grid;
  grid-template-columns: repeat(4, minmax(250px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.round {
  min-width: 250px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 14px;
}

.round.unavailable {
  filter: grayscale(0.75);
  opacity: 0.44;
}

.round.user-locked {
  border-color: #9a7a22;
  background: var(--locked-bg);
}

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

.round-mode {
  min-height: 28px;
  min-width: 68px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  color: var(--ink);
  padding: 3px 5px;
  font-size: 12px;
  font-weight: 700;
}

.round h3 {
  margin: 0;
  font-size: 16px;
}

.round-lock {
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

.match {
  display: grid;
  gap: 3px;
  margin-bottom: 9px;
  border: 2px solid #d3665b;
  border-radius: 7px;
  background: var(--match-red-bg);
  padding: 5px;
}

.match.match-alt {
  border-color: #3b82b7;
  background: var(--match-blue-bg);
}

.match.needs-pick {
  border-style: dashed;
  background: var(--match-empty-bg);
}

.match.needs-review {
  border-color: #c68600;
  background: var(--review-bg);
  box-shadow: 0 0 0 3px rgba(198, 134, 0, 0.22);
}

.match:last-child {
  margin-bottom: 0;
}

.team-pick {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  padding: 5px 7px;
  text-align: left;
}

.team-pick > span {
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
}

.team-pick:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--pick-hover);
}

.team-pick:disabled {
  background: var(--pick-disabled);
}

.team-pick.selected {
  border-color: var(--win);
  background: var(--pick-selected-bg);
  color: var(--pick-selected-ink);
}

.team-pick-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13.5px;
  font-weight: 800;
  line-height: 1.12;
}

.team-pick-meta {
  display: inline;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.vs {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 800;
  line-height: 1;
  padding: 0;
  text-align: center;
  text-transform: uppercase;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 18px;
  text-align: center;
}

.standings {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 8px 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.player-search-form,
.report-search-form,
.vs-search-form,
.task-search-form,
.ghost-task-search-form,
.mine-search-form,
.healing-form {
  display: grid;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.player-search-form,
.report-search-form,
.task-search-form,
.ghost-task-search-form,
.mine-search-form,
.healing-form {
  grid-template-columns: minmax(220px, 1.4fr) repeat(4, minmax(120px, 0.7fr)) auto auto;
}

.player-search-form label,
.report-search-form label,
.vs-search-form label,
.task-search-form label,
.ghost-task-search-form label,
.healing-form label,
.login-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.player-search-form input,
.report-search-form input,
.report-search-form select,
.vs-search-form input,
.task-search-form input,
.task-search-form select,
.ghost-task-search-form input,
.ghost-task-search-form select,
.healing-form input,
.login-card input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  color: var(--ink);
  padding: 0 10px;
}

.inline-clear-field {
  position: relative;
  display: block;
}

.inline-clear-field input {
  width: 100%;
  padding-right: 36px;
}

.field-clear-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  width: 26px;
  height: 26px;
  min-height: 26px;
  padding: 0;
  transform: translateY(-50%);
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.field-clear-btn:hover {
  border-color: var(--line);
  background: var(--panel-soft);
  color: var(--ink);
}

.checkbox-label {
  display: flex !important;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: var(--panel-soft);
  color: var(--ink) !important;
}

.checkbox-label input {
  min-height: auto;
  width: 16px;
  height: 16px;
}

.report-search-form {
  grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(84px, 0.55fr)) repeat(2, minmax(170px, 0.9fr)) repeat(2, minmax(140px, 0.75fr));
}

.task-search-form {
  grid-template-columns: minmax(140px, 0.8fr) minmax(120px, 0.7fr) minmax(100px, 0.5fr) auto auto auto;
}

.task-coordinate-filter {
  position: relative;
}

.task-coordinate-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(3, minmax(74px, 1fr));
  gap: 10px;
  width: min(320px, calc(100vw - 32px));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.task-coordinate-close {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 24px;
  min-height: 24px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
}

.task-coordinate-close:hover {
  border-color: var(--line);
  background: var(--panel-soft);
  color: var(--ink);
}

.task-coordinate-popover[hidden] {
  display: none;
}

.task-coordinate-popover label {
  min-width: 0;
}

.healing-form {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  align-items: stretch;
}

.healing-input-section {
  display: grid;
  gap: 10px;
  align-content: start;
}

.healing-guide-shot {
  aspect-ratio: 0.9;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-image: url("./assets/healing/source-screens.png");
  background-repeat: no-repeat;
  background-size: 380% auto;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.healing-guide-alliance {
  background-position: 67% 10%;
}

.healing-guide-support {
  background-position: 99% 77%;
}

.healing-guide-hospital {
  background-position: 67% 77%;
}

.healing-single-field,
.healing-time-field {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--muted);
  padding: 0 10px;
}

.healing-single-field input,
.healing-time-field input {
  min-height: 40px;
  min-width: 0;
  flex: 1;
  border: 0;
  background: transparent;
  padding: 0;
}

.healing-time-field input {
  text-align: center;
}

.healing-single-field span,
.healing-time-field span {
  font-size: 16px;
  font-weight: 850;
}

.player-actions,
.report-actions,
.vs-actions,
.task-actions,
.healing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.healing-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
  margin: 4px 0 14px;
}

.healing-summary-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 12px;
}

.healing-summary-item span,
.healing-summary-item strong {
  display: block;
}

.healing-summary-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.healing-summary-item strong {
  margin-top: 4px;
  font-size: 20px;
}

.task-sound-muted {
  color: var(--muted);
}

.player-result-bar,
.report-result-bar,
.vs-result-bar,
.task-result-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.player-status,
.report-status,
.vs-status,
.task-status {
  min-height: 24px;
  color: var(--muted);
  font-weight: 750;
}

.player-pagination,
.report-pagination,
.vs-pagination,
.task-pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.player-table-wrap,
.report-table-wrap,
.vs-table-wrap,
.task-table-wrap,
.healing-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

/* Tables occupy the full section width; keeping the section padding around
   controls and headings avoids wasting the same space a second time around
   the table itself. */
.player-table-wrap,
.report-table-wrap,
.vs-table-wrap,
.task-table-wrap,
.healing-table-wrap,
.scan-table-wrap {
  width: calc(100% + 36px);
  margin-inline: -18px;
  border-left: 0;
  border-right: 0;
  border-radius: 0;
}

/* VS keeps the same table content styling, but stays inside its filter card. */
.vs-table-wrap {
  width: 100%;
  margin-inline: 0;
}

.player-table,
.report-table,
.vs-table,
.task-table,
.healing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.player-table,
.task-table {
  min-width: 880px;
}

.vs-table {
  min-width: 0;
  table-layout: fixed;
}

.player-table {
  min-width: 760px;
}

.player-mobile-table {
  display: none;
}

.report-table {
  min-width: 1200px;
}

.task-table {
  min-width: 940px;
}

.party-table {
  min-width: 0;
  table-layout: fixed;
}

.secret-task-table {
  min-width: 0;
  table-layout: fixed;
}

.secret-task-table th,
.secret-task-table td {
  padding: 7px 4px;
}

.secret-task-table td {
  vertical-align: middle;
}

.secret-task-table .secret-task-tier-cell,
.secret-task-table .secret-task-coords-cell {
  white-space: nowrap;
}

/* Keep the compact tier as a real table cell; task-tier-cell is flex for Ghost Tasks. */
.secret-task-table .secret-task-tier-cell {
  display: table-cell;
  padding-left: 0;
  padding-right: 0;
}

.secret-task-table .secret-task-coords-cell {
  vertical-align: middle;
}

.secret-task-table th:nth-child(1),
.secret-task-table td:nth-child(1) { width: 22%; }
.secret-task-table th:nth-child(2),
.secret-task-table td:nth-child(2) { width: 24%; }
.secret-task-table th:nth-child(3),
.secret-task-table td:nth-child(3) { width: 54%; }

.secret-task-table th:last-child,
.secret-task-table td:last-child {
  padding-right: 12px;
}

.secret-task-dual-header {
  padding: 4px 6px !important;
}

.secret-task-dual-header,
.secret-task-alliance-player-cell,
.secret-task-tier-time-cell {
  white-space: nowrap;
}

.secret-task-dual-header .sort-header {
  display: inline-block;
  width: auto;
}

.secret-task-column-separator,
.player-column-separator {
  display: inline-block;
  padding: 0 2px;
  color: inherit;
  white-space: pre;
}

.secret-task-identity-header {
  display: flex;
  gap: 4px;
}

.secret-task-updated-header {
  margin-top: 2px;
  text-align: right;
}

.secret-task-updated-header .sort-header {
  text-align: right;
}

.secret-task-sort-button {
  min-height: 24px;
  padding: 2px 4px;
  font-size: 11px;
  line-height: 1.2;
}

.secret-task-tier-time-cell {
  display: table-cell;
}

.secret-task-tier-time-cell .task-tier-badge,
.secret-task-tier-timer,
.secret-task-alliance-line,
.secret-task-player-line {
  display: block;
}

.secret-task-tier-time-cell .task-tier-badge {
  display: inline-flex;
}

.secret-task-tier-time-box {
  width: 60px;
  min-height: 42px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin: 0 0 0 4px;
  padding: 3px 0;
  border-radius: 7px;
  text-align: center;
}

.secret-task-tier-time-box .secret-task-tier-timer {
  margin-top: 0;
}

.secret-task-tier-timer,
.secret-task-updated-line {
  margin-top: 2px;
  font-size: 11px;
}

.secret-task-identity-line {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 4px;
  overflow: hidden;
  white-space: nowrap;
}

.secret-task-alliance-line {
  flex: 0 0 auto;
  min-width: max-content;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
  font-size: inherit;
  font-weight: inherit;
}

.secret-task-player-line {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: inherit;
  font-weight: inherit;
}

.secret-task-identity-line {
  position: relative;
  top: 2px;
}

.secret-task-updated-line {
  text-align: right;
}

.secret-task-table tr.task-completed-row {
  opacity: 1;
}

.healing-table {
  min-width: 640px;
}

.player-table th,
.player-table td,
.report-table th,
.report-table td,
.vs-table th,
.vs-table td,
.task-table th,
.task-table td,
.healing-table th,
.healing-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
}

.player-table td {
  vertical-align: middle;
}

.player-table th,
.report-table th,
.vs-table th,
.task-table th,
.healing-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.table-sort-button {
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  font-weight: inherit;
  text-align: left;
  cursor: pointer;
}

.table-sort-button:hover,
.table-sort-button:focus-visible {
  color: var(--accent, #8ed7ec);
  text-decoration: underline;
}

.player-table tbody tr:nth-child(even):not(.player-history-row),
.report-table tbody tr:nth-child(even),
.task-table tbody tr:nth-child(even),
.healing-table tbody tr:nth-child(even) {
  background: var(--panel-soft);
}

.task-completed-row {
  opacity: 0.72;
}

.ghost-task-favourite-row,
.task-table tbody tr.ghost-task-favourite-row:nth-child(even) {
  background: var(--ghost-favourite-bg);
  box-shadow: inset 4px 0 0 var(--bookmark-line);
}

.ghost-task-favourite-row .ghost-task-coords-cell {
  color: var(--ghost-favourite-coords);
  font-weight: 900;
}

.ghost-task-marks-cell {
  min-width: 124px;
}

.mine-marks-cell {
  min-width: 78px;
}

.ghost-task-mark {
  align-items: center;
  display: inline-flex;
  gap: 5px;
  margin-right: 10px;
  white-space: nowrap;
}

.ghost-task-mark input {
  accent-color: var(--accent);
}

.task-alarm-row,
.task-table tbody tr.task-alarm-row:nth-child(even) {
  background: var(--bookmark-bg);
  box-shadow: inset 4px 0 0 var(--bookmark-line);
  opacity: 1;
}

.alarm-blink {
  animation: alert-blink 0.8s ease-in-out infinite;
}

.ghost-task-reward-row,
.task-table tbody tr.ghost-task-reward-row:nth-child(even) {
  background: var(--ghost-reward-bg);
  box-shadow: inset 4px 0 0 var(--ghost-reward-line);
  opacity: 1;
}

.reward-blink {
  animation: reward-alert-blink 0.8s ease-in-out infinite;
}

@keyframes alert-blink {
  0%, 100% {
    background-color: var(--bookmark-bg);
    box-shadow: inset 4px 0 0 var(--bookmark-line);
  }
  50% {
    background-color: rgba(255, 220, 130, 0.35);
    box-shadow: inset 4px 0 0 var(--bookmark-line);
  }
}

@keyframes reward-alert-blink {
  0%, 100% {
    background-color: var(--ghost-reward-bg);
    box-shadow: inset 4px 0 0 var(--ghost-reward-line);
  }
  50% {
    background-color: var(--ghost-reward-flash-bg);
    box-shadow: inset 4px 0 0 var(--ghost-reward-line);
  }
}

.task-timer-cell {
  font-variant-numeric: tabular-nums;
  font-weight: 850;
}

.secret-task-table .secret-task-tier-timer {
  font-size: inherit;
  font-weight: 400;
}

.party-ready-cell .secret-task-tier-time-box {
  align-items: flex-start;
}

.party-ready-label,
.party-expiry-line {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.party-ready-label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.1;
}

.party-ready-cell .party-ready-timer-cell {
  color: var(--ink);
  font-size: 1.15em;
  font-weight: 900;
}

.party-ready-cell.party-ready-active .party-ready-label,
.party-ready-cell.party-ready-active .party-ready-timer-cell {
  color: var(--win);
}

.party-expiry-line {
  display: block;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.party-expiry-timer-cell {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  white-space: nowrap;
}

.vs-row.blue,
.vs-table tbody tr.blue {
  background: var(--match-blue-bg);
}
.vs-row.red,
.vs-table tbody tr.red {
  background: var(--match-red-bg);
}
.vs-mobile-table tbody tr.blue {
  background: var(--match-blue-bg);
}
.vs-mobile-table tbody tr.red {
  background: var(--match-red-bg);
}
.vs-alarm-row,
.vs-table tbody tr.vs-alarm-row.blue,
.vs-table tbody tr.vs-alarm-row.red,
.vs-table tbody tr.vs-alarm-row:nth-child(even) {
  background: var(--bookmark-bg);
  box-shadow: inset 4px 0 0 var(--bookmark-line);
  opacity: 1;
}

.vs-table tbody tr.vs-alarm-row.blue {
  background: var(--vs-blue-alert-bg);
  box-shadow: inset 4px 0 0 var(--vs-blue-alert-line);
}

.vs-table tbody tr.vs-alarm-row.red {
  background: var(--vs-red-alert-bg);
  box-shadow: inset 4px 0 0 var(--vs-red-alert-line);
}

.vs-table tbody tr.vs-alarm-row.blue.alarm-blink {
  animation-name: vs-blue-alert-blink;
}

.vs-table tbody tr.vs-alarm-row.red.alarm-blink {
  animation-name: vs-red-alert-blink;
}

@keyframes vs-blue-alert-blink {
  0%, 100% {
    background-color: var(--vs-blue-alert-bg);
    box-shadow: inset 4px 0 0 var(--vs-blue-alert-line);
  }
  50% {
    background-color: var(--vs-blue-alert-flash-bg);
    box-shadow: inset 4px 0 0 var(--vs-blue-alert-line);
  }
}

@keyframes vs-red-alert-blink {
  0%, 100% {
    background-color: var(--vs-red-alert-bg);
    box-shadow: inset 4px 0 0 var(--vs-red-alert-line);
  }
  50% {
    background-color: var(--vs-red-alert-flash-bg);
    box-shadow: inset 4px 0 0 var(--vs-red-alert-line);
  }
}

.vs-shield-cell {
  font-variant-numeric: tabular-nums;
  font-weight: 850;
}

.vs-table th,
.vs-table td {
  padding: 6px 7px;
  vertical-align: middle;
}

.vs-table tbody tr {
  border-bottom: 1px solid var(--line);
}

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

.vs-table tbody td {
  border-bottom: 0;
}

.vs-table th:last-child,
.vs-table td:last-child,
.player-table .player-seen-cell {
  text-align: right;
}

.vs-table td.vs-coords-cell {
  vertical-align: top;
}

.vs-table th {
  white-space: nowrap;
}

.vs-table th:nth-child(1),
.vs-table td:nth-child(1) { width: 30%; }
.vs-table th:nth-child(2),
.vs-table td:nth-child(2) { width: 24%; white-space: nowrap; }
.vs-table th:nth-child(3),
.vs-table td:nth-child(3) { width: 8%; white-space: nowrap; }
.vs-table th:nth-child(4),
.vs-table td:nth-child(4) { width: 24%; white-space: nowrap; }
.vs-table th:nth-child(5),
.vs-table td:nth-child(5) { width: 14%; white-space: nowrap; }

.vs-table .player-name-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vs-power-cell,
.vs-seen-cell,
.vs-coords-cell,
.vs-expiry-cell,
.vs-shield-cell {
  font-variant-numeric: tabular-nums;
}

.vs-coords-cell {
  white-space: nowrap;
}

.task-coordinate-x {
  color: var(--accent-dark);
}

.task-coordinate-y {
  color: var(--lose);
}

.vs-coords-age {
  display: inline-block;
  margin-left: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.vs-coords-server {
  display: block;
  width: max-content;
  margin-top: 3px;
  padding: 1px 5px;
  border: 1px solid currentColor;
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  line-height: 1.15;
}

.vs-coords-server-other {
  color: var(--muted);
  background: var(--panel-soft);
}

.vs-coords-server-0 { color: #62c7ee; background: rgba(54, 154, 202, 0.16); }
.vs-coords-server-1 { color: #f0bd63; background: rgba(202, 142, 45, 0.16); }
.vs-coords-server-2 { color: #7ddc95; background: rgba(62, 164, 87, 0.16); }
.vs-coords-server-3 { color: #c49bff; background: rgba(131, 79, 202, 0.16); }
.vs-coords-server-4 { color: #ff9b7a; background: rgba(202, 83, 50, 0.16); }
.vs-coords-server-5 { color: #82aaff; background: rgba(74, 111, 202, 0.16); }
.vs-coords-server-6 { color: #f58bc2; background: rgba(202, 77, 139, 0.16); }
.vs-coords-server-7 { color: #b5df69; background: rgba(111, 157, 43, 0.16); }
.vs-coords-server-8 { color: #ffbd79; background: rgba(202, 119, 45, 0.16); }
.vs-coords-server-9 { color: #a99cff; background: rgba(94, 79, 202, 0.16); }
.vs-coords-server-10 { color: #62d5c6; background: rgba(48, 156, 143, 0.16); }
.vs-coords-server-11 { color: #e6d26c; background: rgba(174, 153, 42, 0.16); }
.vs-coords-server-12 { color: #ff8282; background: rgba(202, 63, 63, 0.16); }
.vs-coords-server-13 { color: #d4a7ff; background: rgba(154, 83, 202, 0.16); }
.vs-coords-server-14 { color: #6ed9e8; background: rgba(44, 157, 174, 0.16); }
.vs-coords-server-15 { color: #ff91a8; background: rgba(202, 73, 98, 0.16); }

.vs-coords-age-warn { color: #9a6500; }
.vs-coords-age-stale { color: #a23838; }

@media (max-width: 600px) {
  .player-table {
    min-width: 0;
  }

  .player-table.player-desktop-table {
    display: none;
  }

  .player-table.player-mobile-table {
    display: table;
    width: 100%;
    table-layout: fixed;
  }

  .player-mobile-table th,
  .player-mobile-table td {
    padding: 6px 7px;
  }

  .player-mobile-table th {
    text-transform: none;
  }

  .player-mobile-header-top,
  .player-mobile-header-bottom,
  .player-mobile-row-top,
  .player-mobile-row-bottom {
    display: grid;
    align-items: center;
    gap: 5px;
    min-width: 0;
  }

  .player-mobile-header-top,
  .player-mobile-row-top {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .player-mobile-header-bottom,
  .player-mobile-row-bottom {
    grid-template-columns: minmax(0, 1.25fr) minmax(34px, .55fr) minmax(0, 1.2fr) auto;
    margin-top: 4px;
  }

  .player-mobile-sort {
    min-width: 0;
    min-height: 22px;
    padding: 1px 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
    line-height: 1.2;
  }

  .player-mobile-row-top > *,
  .player-mobile-row-bottom > * {
    min-width: 0;
  }

  .player-mobile-row-top .player-identity-lines {
    min-width: 0;
    font-weight: 400;
  }

  .player-mobile-row-top .player-alliance-line,
  .player-mobile-row-top .player-name-line,
  .player-mobile-row-top .player-name-text,
  .player-mobile-row-top .roster-open-btn {
    font-weight: 400;
  }

  .player-mobile-row-bottom .player-coords-seen-cell,
  .player-mobile-row-bottom .player-mobile-squad-cell {
    white-space: normal;
    overflow: hidden;
  }

  .player-mobile-row-bottom .player-nation-cell {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .player-mobile-power-cell,
  .player-mobile-squad-cell {
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  .player-mobile-row-top .player-mobile-power-cell {
    text-align: right;
  }

  .player-mobile-power-nation-header,
  .player-mobile-power-nation-cell {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 4px;
  }

  .player-mobile-power-nation-header .player-mobile-sort,
  .player-mobile-power-nation-cell > * {
    min-width: 0;
    flex: 1 1 0;
  }

  .player-mobile-power-nation-cell {
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
  }

  .player-mobile-row-bottom .player-coords-seen-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .player-mobile-row-bottom .player-coords-seen-cell .vs-coords-server {
    display: block;
    margin: 0;
  }

  .player-mobile-squad-cell {
    display: flex;
    flex-direction: column;
    gap: 1px;
  }

  .player-mobile-squad-header {
    display: flex;
    align-items: center;
    min-width: 0;
    overflow: hidden;
  }

  .player-mobile-squad-header .player-mobile-sort {
    flex: 1 1 0;
  }

  .player-mobile-header-separator {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 10px;
    white-space: pre;
  }

  .player-mobile-shield-cell {
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--muted);
    font-size: 11px;
  }

  .player-mobile-updated-cell {
    justify-self: end;
    text-align: right;
    white-space: nowrap;
    color: var(--muted);
    font-size: 11px;
  }

  .player-mobile-simulated {
    color: var(--muted);
    font-size: 10px;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .player-table th,
  .player-table td {
    padding: 7px 6px;
  }

  .player-table .player-nation-header,
  .player-table .player-nation-cell {
    display: none;
  }

  .player-mobile-table .player-nation-cell {
    display: block;
  }

  .vs-table {
    min-width: 680px;
    width: 680px;
    table-layout: fixed;
  }

  .vs-table {
    display: none !important;
  }

  .vs-table-wrap {
    width: 100%;
    margin-inline: 0;
    overflow-x: hidden;
  }

  .vs-mobile-table {
    display: table !important;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    table-layout: fixed;
  }

  .vs-mobile-table .player-mobile-header-bottom,
  .vs-mobile-table .player-mobile-row-bottom {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, .9fr) minmax(0, 1.2fr) auto;
  }

  .vs-table th,
  .vs-table td {
    padding: 8px 10px;
  }

  .vs-table th {
    font-size: 10px;
  }

  .vs-table th:nth-child(1),
  .vs-table td:nth-child(1) { width: 210px; }
  .vs-table th:nth-child(2),
  .vs-table td:nth-child(2) { width: 60px; }
  .vs-table th:nth-child(3),
  .vs-table td:nth-child(3) { width: 135px; }
  .vs-table th:nth-child(4),
  .vs-table td:nth-child(4) { width: 140px; }
  .vs-table th:nth-child(5),
  .vs-table td:nth-child(5) {
    display: none;
  }
  .vs-table th:nth-child(6),
  .vs-table td:nth-child(6) { width: 150px; }

}

/* Desert Storm simulator prototype */
.simulator-shell { padding: 18px; }
.simulator-panel { max-width: 1700px; margin: 0 auto; }
.simulator-heading { align-items: flex-start; gap: 18px; }
.simulator-subtitle { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.simulator-toolbar { display: flex; flex-wrap: wrap; align-items: end; justify-content: flex-end; gap: 8px; }
.simulator-toolbar label, .simulator-actions label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; font-weight: 800; }
.simulator-toolbar input, .simulator-toolbar select, .simulator-actions select, .simulator-actions input { min-height: 34px; border: 1px solid var(--line); border-radius: 6px; background: var(--field); color: var(--text); padding: 6px 8px; }
.simulator-layout { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 12px; min-height: 850px; }
.simulator-stage { position: relative; isolation: isolate; min-height: 850px; overflow: hidden; border: 1px solid #264c50; border-radius: 10px; background: #0a1218; touch-action: none; }
.simulator-stage canvas { position: relative; z-index: 0; display: block; width: 100%; height: 100%; cursor: grab; }
.simulator-stage canvas:active { cursor: grabbing; }
.simulator-fullscreen-btn { display: none; position: absolute; top: 10px; right: 10px; z-index: 8; align-items: center; justify-content: center; min-height: 36px; padding: 7px 10px; border: 1px solid rgba(220, 238, 229, .52); border-radius: 7px; background: rgba(5, 12, 16, .88); color: #dceee5; font-size: 12px; font-weight: 800; cursor: pointer; }
.simulator-fullscreen-btn:hover, .simulator-fullscreen-btn:focus-visible { border-color: #f5d66c; background: rgba(37, 67, 76, .96); color: #fff2ae; outline: none; }
.simulator-fullscreen-btn:disabled { cursor: not-allowed; opacity: .7; }
.simulator-stage:fullscreen, .simulator-stage:-webkit-full-screen { width: 100vw; height: 100vh; min-height: 100vh; border: 0; border-radius: 0; }
.simulator-stage:fullscreen canvas, .simulator-stage:-webkit-full-screen canvas { width: 100%; height: 100%; }
.ds-troop-counter { position: absolute; top: 12px; right: 12px; z-index: 100; min-width: 92px; padding: 7px 10px; border: 1px solid rgba(220, 238, 229, .58); border-radius: 8px; background: rgba(5, 12, 16, .86); color: #f5d66c; font-size: 16px; font-weight: 900; line-height: 1; text-align: center; text-shadow: 0 1px 2px #000; box-shadow: 0 3px 12px #0006; font-variant-numeric: tabular-nums; }
.simulator-label-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.simulator-squad-hud { position: absolute; left: 12px; top: 12px; z-index: 4; display: grid; gap: 7px; width: max-content; max-width: calc(100% - 24px); pointer-events: none; }
.simulator-squad-hud-row { display: grid; grid-template-columns: auto auto auto; align-items: center; gap: 8px; width: max-content; min-width: 0; min-height: 38px; padding: 7px 8px; border-left: 4px solid #36a8ff; border-radius: 6px; background: rgba(5, 12, 16, .9); color: #dceee5; font-size: 14px; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); pointer-events: auto; }
.simulator-squad-hud-row.enemy { border-left-color: #ff3e4d; }
.simulator-squad-hud-row strong { color: #8ed2ff; font-size: 16px; }
.simulator-squad-hud-row.enemy strong { color: #ff8b93; }
.simulator-squad-hud-row strong.squad-loss-icon { color: #b8bec5; }
.simulator-squad-hud-row time { color: #ffe69a; font-variant-numeric: tabular-nums; font-weight: 900; font-size: 15px; }
.simulator-squad-return { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 1px solid rgba(220, 238, 229, .38); border-radius: 5px; background: #172b32; color: #dceee5; font-size: 19px; font-weight: 900; cursor: pointer; }
.simulator-squad-return:hover, .simulator-squad-return:focus-visible { border-color: #f5d66c; background: #25434c; color: #fff2ae; outline: none; }
.simulator-base-popup { position: absolute; left: 0; top: 0; z-index: 5; display: grid; gap: 6px; min-width: 196px; padding: 6px; pointer-events: auto; border: 1px solid rgba(220, 238, 229, .72); border-radius: 9px; background: rgba(5, 12, 16, .94); box-shadow: 0 3px 12px rgba(0, 0, 0, .48); }
.simulator-base-popup-hp { padding: 4px 6px; border: 1px solid rgba(220, 238, 229, .28); border-radius: 5px; color: #ffe69a; font-size: 12px; font-variant-numeric: tabular-nums; font-weight: 900; text-align: center; }
.simulator-base-popup-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.simulator-base-popup-move { display: grid; }
.simulator-base-popup-move button { width: 42px; height: 42px; margin: 0 auto; font-size: 28px; font-weight: 900; }
.simulator-base-popup button { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 1px solid rgba(220, 238, 229, .32); border-radius: 6px; background: #172b32; color: #dceee5; font-size: 26px; line-height: 1; cursor: pointer; }
.simulator-base-popup button:hover, .simulator-base-popup button:focus-visible { border-color: #f5d66c; background: #25434c; color: #fff2ae; outline: none; }
.simulator-base-popup button:disabled { cursor: not-allowed; opacity: .35; filter: grayscale(1); }
.simulator-base-popup button[data-base-action="remove"] { color: #ff7982; }
.simulator-base-popup button[data-base-action="attack"] { color: #ffbd70; }
.simulator-attack-panel { display: grid; gap: 6px; }
.simulator-squad-choices { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.simulator-squad-choices button { width: auto; height: 32px; font-size: 13px; }
.simulator-squad-choices button.selected { border-color: #f5d66c; background: #35535a; color: #fff2ae; }
.simulator-squad-choices button:disabled { cursor: not-allowed; opacity: .3; }
.simulator-attack-confirm { width: 100% !important; height: 46px !important; display: flex !important; flex-direction: column; justify-content: center; gap: 1px; font-size: 14px !important; background: #8f2830 !important; color: #fff !important; }
.simulator-attack-confirm strong { font-size: 14px; line-height: 1.1; }
.simulator-attack-confirm span { font-size: 12px; line-height: 1.1; }
.simulator-attack-confirm:disabled { cursor: not-allowed; opacity: .45; }
.simulator-world-label { position: absolute; left: 0; top: 0; transform-origin: center; white-space: nowrap; color: #dceee5; font-size: 12px; font-weight: 800; text-shadow: 0 1px 3px #000, 0 0 6px #000; }
.simulator-world-label.building-label { color: #a9d7da; font-size: 11px; }
.simulator-world-label.silo-label { color: #ffe69a; font-size: 14px; }
.simulator-world-label.base-label { padding: 2px 5px; border: 1px solid currentColor; border-radius: 4px; background: rgba(5, 12, 16, .82); }
.simulator-world-label.base-label.ally { color: #4bb7ff; }
.simulator-world-label.base-label.enemy { color: #ff6570; }
.simulator-world-label.base-level-label { display: block; min-width: 20px; margin-top: 18px; padding: 1px 4px; border-radius: 3px; background: rgba(5, 12, 16, .88); color: #f4f0dc; font-size: 10px; line-height: 14px; text-align: center; text-shadow: 0 1px 2px #000; }
.simulator-world-label.base-level-label.ally { border: 1px solid #4bb7ff; }
.simulator-world-label.base-level-label.enemy { border: 1px solid #ff6570; }
.simulator-world-label.base-hp-label { display: block; min-width: 48px; margin-top: -18px; padding: 1px 4px; border: 1px solid #ffe69a; border-radius: 3px; background: rgba(5, 12, 16, .9); color: #ffe69a; font-size: 10px; line-height: 14px; text-align: center; text-shadow: 0 1px 2px #000; }
.simulator-world-label.base-hp-label.ally { border-color: #4bb7ff; color: #b9e6ff; }
.simulator-world-label.base-hp-label.enemy { border-color: #ff6570; color: #ffd0d3; }
.simulator-world-label.squad-skull { color: #b8bec5; font-size: 22px; }
.simulator-inspector { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.simulator-inspector h3 { margin: -3px 0 0; overflow-wrap: anywhere; }
.simulator-selection-meta { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.simulator-actions { display: grid; gap: 8px; }
.simulator-actions output { float: right; color: var(--text); }
.simulator-launch { margin-top: 3px; }
.simulator-impersonation { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 8px; border: 1px solid #d6ae4b; border-radius: 6px; color: #f2ce70; font-size: 11px; }
.simulator-help { margin-top: auto; display: grid; gap: 5px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.4; }
.simulator-statusbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 8px 2px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.simulator-unavailable { padding: 28px; color: #ff8b8b; }
.simulator-guest-link-status { align-self: center; min-height: 1em; color: var(--muted); font-size: 11px; }
.simulator-guest-modal { width: min(420px, calc(100vw - 32px)); padding: 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: 0 18px 60px rgba(0,0,0,.45); }
.simulator-guest-modal h2 { margin: 0 0 6px; }
.simulator-guest-modal p { margin: 0 0 16px; color: var(--muted); }
.simulator-guest-modal form { display: grid; gap: 12px; }
.simulator-guest-modal label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.simulator-guest-modal input, .simulator-guest-modal select { width: 100%; }
.simulator-guest-error { min-height: 1.2em; margin: 0 !important; color: #ff8b8b !important; }
@media (max-width: 850px) {
  .simulator-shell { padding: 10px; }
  .simulator-heading { display: grid; }
  .simulator-toolbar { justify-content: start; }
  .simulator-layout { grid-template-columns: 1fr; min-height: 0; }
  .simulator-stage { min-height: 680px; }
  .simulator-inspector { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .simulator-inspector .eyebrow, .simulator-inspector h3, .simulator-inspector .simulator-selection-meta, .simulator-inspector .simulator-help { grid-column: 1 / -1; }
  .simulator-help { margin-top: 0; }
  .simulator-fullscreen-btn { display: inline-flex; }
}
@media (pointer: coarse) {
  .simulator-fullscreen-btn { display: inline-flex; }
}
@media (max-width: 520px) {
  .simulator-toolbar label { flex: 1 1 120px; }
  .simulator-stage { min-height: 600px; }
  .simulator-inspector { display: flex; }
}

/* VS form layout and colors */
.vs-team-grid {
  display: grid;
  grid-template-columns: minmax(240px, 24vw) auto minmax(240px, 24vw);
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin: 0 auto 12px;
}
.vs-team-grid fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  background: var(--panel);
  width: 100%;
  min-width: 240px;
}
.vs-team-grid fieldset.vs-blue {
  background: var(--match-blue-bg);
}
.vs-team-grid fieldset.vs-red {
  background: var(--match-red-bg);
}
.vs-team-grid label {
  margin-bottom: 0;
}
.vs-team-grid input {
  max-width: 100%;
}
.vs-shared-server-filter {
  max-width: 360px;
  margin: 0 auto;
}
.vs-divider {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  color: #ffd65d;
  font-weight: 900;
  font-size: 24px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.vs-actions-inline {
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  margin-top: 8px;
}
.vs-actions-inline button {
  align-self:center;
  min-height: 38px;
  padding: 0 14px;
}

.task-tier-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.mine-type-cell {
  display: flex;
  align-items: center;
  gap: 7px;
  text-transform: capitalize;
  white-space: nowrap;
}

.mine-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 22px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  color: #172033;
}

.mine-icon-gold {
  background: #f4c84a;
}

.mine-icon-iron {
  background: #a8b3c7;
}

.mine-icon-food {
  background: #7cc86a;
}

.mine-icon-unknown {
  background: var(--soft-panel);
  color: var(--muted);
  border: 1px solid var(--line);
}

.task-tier-badge {
  display: inline-flex;
  min-width: 46px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 2px 9px;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 900;
}

.task-tier-sr {
  color: #155db3;
  background: rgba(38, 126, 224, 0.12);
  border-color: rgba(38, 126, 224, 0.28);
}

.task-tier-ssr {
  color: #6f42c1;
  background: var(--resource-purple-bg);
  border-color: var(--resource-purple-line);
}

.task-tier-ur {
  color: #8a6200;
  background: var(--resource-gold-bg);
  border-color: var(--resource-gold-line);
}

.task-shiny-star {
  color: #c58b00;
  font-size: 17px;
  line-height: 1;
  text-shadow: 0 0 8px rgba(255, 204, 86, 0.55);
}

.player-table .player-seen-cell {
  width: 88px;
  min-width: 88px;
  max-width: 88px;
  padding-left: 8px;
  padding-right: 8px;
  text-align: right;
  white-space: nowrap;
}

.player-name-cell {
  font-weight: 400;
}

.player-table .roster-open-btn {
  font-weight: 400;
}

.player-identity-cell,
.player-coords-seen-cell,
.player-squad-shield-cell {
  white-space: nowrap;
}

.player-identity-header {
  white-space: nowrap;
}

.player-identity-lines,
.player-coords-seen-cell,
.player-squad-shield-lines {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.player-identity-lines {
  flex-direction: row;
  align-items: baseline;
  min-width: 0;
  min-height: 18px;
  overflow: hidden;
}

.player-alliance-line {
  flex: 0 0 auto;
  min-width: max-content;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.player-name-line {
  display: flex;
  flex: 1 1 auto;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
  line-height: 18px;
}

.player-name-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-squad-power-line {
  min-width: 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.player-power-cell {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.player-mobile-power-cell,
.player-mobile-power-stack-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.player-power-cell {
  display: table-cell;
}

.player-power-line,
.player-kills-line {
  display: block;
}

.player-squad-shield-cell {
  white-space: nowrap;
}

.player-squad-shield-lines {
  align-items: flex-start;
}

.player-kills-line,
.player-mobile-kills-cell,
.player-mobile-power-stack-header .player-mobile-static-header {
  color: var(--muted);
  font-size: 11px;
}

.player-desktop-table tbody > tr:not(.player-history-row) {
  height: 42px;
  border-bottom: 1px solid var(--line);
}

.player-desktop-table tbody > tr:not(.player-history-row) > td {
  box-sizing: border-box;
  height: 42px;
  border-bottom: 0;
  overflow: hidden;
  padding-top: 0;
  padding-bottom: 0;
  line-height: 1.1;
  vertical-align: middle;
}

.player-desktop-table tbody > tr:not(.player-history-row) > .player-coords-seen-cell {
  padding-top: 5px;
  padding-bottom: 5px;
}

.player-desktop-table tbody > tr:not(.player-history-row) > .player-squad-shield-cell {
  text-align: center;
}

.player-desktop-table {
  table-layout: fixed;
}

.player-name-line .player-name-wrap {
  display: flex;
  max-width: 100%;
  width: max-content;
}

.player-coordinate-x { color: #cc4b43; font-weight: 400; }
.player-coordinate-y { color: #3478b8; font-weight: 400; }
.player-seen-line,
.player-shield-line { color: var(--muted); font-size: 11px; }
.player-coords-seen-wrap { display: inline-flex; flex-direction: column; align-items: center; width: max-content; max-width: 100%; }
.player-coords-line { display: inline-flex; align-items: baseline; gap: 3px; min-height: 18px; white-space: nowrap; }
.player-coords-seen-cell .vs-coords-server { display: block; margin: 0; }

.player-name-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.player-name-text {
  flex: 0 1 auto;
}

.player-squad-badge,
.player-name-wrap .uid-copy-btn {
  flex: 0 0 auto;
}

.uid-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  min-height: 22px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  color: var(--muted);
  padding: 0;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.uid-copy-btn:hover {
  background: var(--panel-soft);
  color: var(--accent-dark);
}

.trade-data-btn {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.report-mobile-cards,
.trade-mobile-cards {
  display: none;
}

.trade-mobile-sort {
  display: none;
}

.number-cell,
.ratio-cell,
.report-date-cell {
  text-align: right !important;
  white-space: nowrap;
}

.ratio-cell {
  width: 78px;
}

.report-current-alliance-cell {
  width: 58px;
  max-width: 58px;
  text-align: center !important;
  white-space: nowrap;
}

.report-alliance-tier-red { color: #c62828 !important; font-weight: 800; }
.report-alliance-tier-orange { color: #ef6c00 !important; font-weight: 800; }
.report-alliance-tier-yellow { color: #a67c00 !important; font-weight: 800; }
.report-alliance-tier-light-green { color: #4f8f45 !important; font-weight: 800; }
.report-alliance-tier-dark-green { color: #1f6b3a !important; font-weight: 800; }

.report-current-coords-cell {
  width: 78px;
  white-space: nowrap;
}

.report-coords-age-cell {
  width: 48px;
  max-width: 48px;
  padding-left: 6px !important;
  padding-right: 6px !important;
  text-align: center !important;
  white-space: nowrap;
}

.report-table td.report-coords-age-cell {
  background-clip: padding-box;
}

.report-table td.report-coords-age-fresh {
  background-color: rgba(62, 184, 124, 0.18);
}

.report-table td.report-coords-age-warn {
  background-color: rgba(234, 179, 8, 0.18);
}

.report-table td.report-coords-age-stale {
  background-color: rgba(239, 68, 68, 0.2);
}

.report-table td.resource-highlight {
  background-clip: padding-box;
  box-shadow: inset 0 0 0 1px transparent;
}

.report-table td.resource-highlight-purple {
  background-color: var(--resource-purple-bg);
  box-shadow: inset 0 0 0 1px var(--resource-purple-line);
}

.report-table td.resource-highlight-gold {
  background-color: var(--resource-gold-bg);
  box-shadow: inset 0 0 0 1px var(--resource-gold-line);
}

.report-date-cell {
  width: 104px;
}

.sort-header {
  min-height: auto;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: inherit;
  text-transform: inherit;
}

.sort-header:hover {
  background: transparent;
  color: var(--accent-dark);
}

.player-history-row td {
  background: var(--review-bg);
  color: var(--muted);
  padding: 8px 10px 10px;
}

.player-history-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
}

.player-history-list strong {
  color: var(--ink);
}

.login-page {
  min-height: 100vh;
}

.login-shell {
  display: block;
  width: min(520px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 18px 0 42px;
}

.login-header {
  padding-top: 40px;
  justify-content: flex-start;
}

.login-card {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 18px;
}

.login-card .section-title {
  margin-bottom: 0;
}

.login-card .error {
  border: 1px solid var(--danger);
  border-radius: 6px;
  background: var(--match-red-bg);
  color: var(--danger);
  padding: 10px;
  font-weight: 800;
}

.admin-shell {
  display: grid;
  gap: 12px;
  width: min(1400px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 18px 0 46px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: start;
  gap: 18px;
}

.admin-content { min-width: 0; }

.admin-edit-shell {
  width: min(760px, calc(100vw - 32px));
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-header-actions .menu-action {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel);
  color: var(--ink);
  font-weight: 900;
}

.admin-section {
  display: grid;
  gap: 8px;
}

.admin-section .section-title { margin-bottom: 2px; }

.admin-tabs {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.admin-menu-heading {
  padding: 14px 18px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.admin-tab {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  min-height: 58px;
  border: 0;
  border-left: 5px solid transparent;
  border-radius: 0;
  background: var(--panel);
  color: var(--ink);
  padding: 0 18px 0 13px;
  text-align: left;
  font-weight: 900;
}

.admin-tab:hover,
.admin-tab.is-active {
  border-left-color: var(--accent);
  background: var(--pick-selected-bg);
  color: var(--pick-selected-ink);
}

.admin-side-menu .menu-action {
  margin: 8px;
  width: calc(100% - 16px);
  border-top: 1px solid var(--line);
}

.admin-toolbar {
  display: flex;
  justify-content: flex-end;
}

.admin-toolbar button,
.button-secondary {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 0 12px;
  font-weight: 900;
}

.admin-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
  box-shadow: var(--shadow);
}

.admin-create-card {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  color: var(--ink);
  font-size: 14px;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  text-align: left;
  vertical-align: middle;
}

.admin-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

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

.admin-table td strong {
  display: block;
  font-size: 14px;
  font-weight: 900;
}

.admin-table td span:not(.admin-status) {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-top: 2px;
}

.admin-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 900;
}

.admin-status.is-active {
  background: var(--chip);
  color: var(--accent-dark);
}

.admin-status.is-disabled {
  background: var(--match-red-bg);
  color: var(--danger);
}

.admin-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-row-actions form {
  margin: 0;
}

.admin-row-actions button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  color: var(--ink);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
}

.admin-card-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.admin-card-title strong {
  font-size: 16px;
  font-weight: 900;
}

.admin-card-title span,
.admin-tool-heading {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.admin-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.admin-card input,
.admin-card select,
.admin-card textarea {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  color: var(--ink);
  padding: 0 10px;
}

.admin-card textarea {
  min-height: 120px;
  resize: vertical;
  padding: 10px;
}

.admin-modal {
  position: relative;
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

.admin-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.admin-modal-header h2 {
  margin: 0;
}

.admin-modal .modal-close {
  flex: 0 0 auto;
  position: absolute;
  top: 14px;
  right: 14px;
}

.admin-help {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.admin-tool-list {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-actions button,
.admin-card button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 0 12px;
  font-weight: 900;
}

.admin-actions .danger,
.admin-row-actions .danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.admin-actions button:disabled,
.admin-row-actions button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.7);
  opacity: 0.5;
}

.admin-message {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
  padding: 12px 14px;
}

.admin-modal .modal-close {
  min-width: 44px;
  min-height: 44px;
}

@media (max-width: 760px) {
  .admin-layout {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .admin-side-menu {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: visible;
  }

  .admin-menu-heading,
  .admin-side-menu .menu-action { grid-column: 1 / -1; }

  .admin-header-actions {
    gap: 0;
  }

  .admin-header-actions .menu-action,
  .admin-header-actions .menu-logout {
    min-height: 46px;
    padding: 0 10px;
  }

  .admin-tab {
    min-height: 52px;
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 8px;
    text-align: center;
  }

  .admin-tab .menu-icon { display: none; }

  .admin-table {
    min-width: 0;
  }

  .admin-table thead {
    display: none;
  }

  .admin-table,
  .admin-table tbody,
  .admin-table tr,
  .admin-table td {
    display: block;
    width: 100%;
  }

  .admin-table tr {
    border-bottom: 1px solid var(--line);
    padding: 10px 0;
  }

  .admin-table tr:last-child {
    border-bottom: 0;
  }

  .admin-table td {
    border-bottom: 0;
    padding: 6px 12px;
  }

  .admin-row-actions {
    padding-top: 8px;
  }
}

/* The accounts table becomes compact, scannable cards on phones. */
@media (max-width: 560px) {
  body:has(.admin-accounts-table) .app-header { align-items: flex-start; gap: 10px; padding-top: 16px; padding-bottom: 12px; }
  body:has(.admin-accounts-table) .app-header h1 { font-size: clamp(25px, 8vw, 34px); }
  body:has(.admin-accounts-table) .app-header .menu-logout { flex: 0 0 auto; min-height: 40px; padding: 0 10px; font-size: 13px; white-space: nowrap; }
  .admin-accounts-table { border-collapse: separate; border-spacing: 0 8px; }
  .admin-accounts-table tbody { display: grid; gap: 8px; }
  .admin-accounts-table .admin-account-row { display: grid; gap: 0; padding: 6px 0; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: 0 3px 12px rgb(22 31 38 / 5%); }
  .admin-accounts-table .admin-account-row td { display: grid; grid-template-columns: minmax(76px, .34fr) minmax(0, 1fr); align-items: center; gap: 10px; min-width: 0; padding: 5px 10px; }
  .admin-accounts-table .admin-account-row td::before { color: var(--muted); content: attr(data-label); font-size: 11px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
  .admin-accounts-table .admin-account-row td[data-label="User"] strong { overflow-wrap: anywhere; }
  .admin-accounts-table .admin-account-row .admin-row-actions { align-items: stretch; padding-top: 8px; border-top: 1px solid var(--line); }
  .admin-accounts-table .admin-row-actions > form, .admin-accounts-table .admin-row-actions > .button-link { grid-column: 2; min-width: 0; }
  .admin-accounts-table .admin-row-actions > .button-link, .admin-accounts-table .admin-row-actions > form button { width: 100%; }
}

.standings.unavailable {
  display: block;
  filter: grayscale(0.8);
  opacity: 0.55;
}

.standings-empty {
  list-style: none;
}

.standing-row {
  grid-template-columns: 38px 1fr;
}

.standing-rank {
  background: var(--rank-bg);
  color: var(--lose);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(9, 14, 18, 0.62);
  padding: 24px;
}

.modal-backdrop[hidden] {
  display: none;
}

.export-modal {
  position: relative;
  width: fit-content;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border-radius: 8px;
  background: #ffffff;
  color: #111820;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  padding: 24px;
}

.export-modal-header {
  padding-right: 56px;
  margin-bottom: 14px;
}

.export-modal-header .eyebrow {
  color: #1f6472;
}

.trade-details-modal {
  width: min(960px, calc(100vw - 48px));
}

.trade-details-body {
  max-height: min(70vh, 760px);
  overflow: auto;
}

.trade-details-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
}

.trade-details-table th,
.trade-details-table td {
  border-top: 1px solid #d8e0e6;
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.trade-details-table th {
  width: 210px;
  color: #44515c;
  font-weight: 850;
  word-break: break-word;
}

.trade-details-table td,
.trade-details-table pre {
  color: #111820;
  overflow-wrap: anywhere;
}

.trade-details-table pre {
  max-height: 360px;
  overflow: auto;
  margin: 0;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
}

.scan-request-form {
  display: grid;
  gap: 14px;
  min-width: min(360px, calc(100vw - 96px));
}

.scan-request-form label {
  display: grid;
  gap: 6px;
  color: #3a4650;
  font-size: 13px;
  font-weight: 800;
}

.scan-request-form input {
  border: 1px solid #cfd8df;
  border-radius: 8px;
  padding: 11px 12px;
  font: inherit;
}

.scan-cost {
  color: #3a4650;
  font-size: 13px;
  font-weight: 800;
}

.task-status.is-error {
  color: #b42318;
}

.scan-tabs {
  display: inline-flex;
  gap: 8px;
  margin-top: 16px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.scan-tab {
  min-height: 34px;
  padding: 0 12px;
}

.scan-tab-panel {
  margin-top: 14px;
}

.scan-filter-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.scan-filter-form label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.scan-filter-form input,
.scan-filter-form select {
  min-height: 38px;
  font-size: 13px;
  text-transform: none;
}

.scan-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  width: calc(100% + 36px);
  margin-inline: -18px;
  border-left: 0;
  border-right: 0;
  border-radius: 0;
}

.scan-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  font-size: 13px;
}

.scan-table th,
.scan-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.scan-table th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.scan-table td {
  overflow-wrap: anywhere;
}

.scan-table td strong,
.scan-table td small {
  display: block;
}

.scan-table td small {
  color: var(--muted);
  font-size: 11px;
}

.scan-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  background: var(--match-empty-bg);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.scan-status-running {
  background: var(--match-blue-bg);
  color: var(--accent-dark);
}

.scan-status-succeeded {
  background: var(--pick-selected-bg);
  color: var(--pick-selected-ink);
}

.scan-status-failed,
.scan-status-cancelled,
.scan-status-expired {
  background: var(--match-red-bg);
  color: var(--danger);
}

.scan-selected-row {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.scan-schedule-runs {
  margin-top: 12px;
}

.scan-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

.scan-pagination span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.scan-list {
  display: grid;
  gap: 10px;
}

.scan-list-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.scan-list-item div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.scan-list-item strong,
.scan-list-item span,
.scan-list-item small {
  overflow-wrap: anywhere;
}

.scan-list-item small {
  color: var(--muted);
}

.scan-worker-table-wrap {
  overflow-x: auto;
}

.scan-template-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.scan-template-table-wrap {
  overflow-x: auto;
}

.scan-template-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 13px;
}

.scan-template-table th,
.scan-template-table td {
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
}

.scan-template-table th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.scan-template-table td strong,
.scan-template-table td small {
  display: block;
  overflow-wrap: anywhere;
}

.scan-template-table td small {
  color: var(--muted);
  font-size: 12px;
}

.scan-template-actions {
  white-space: nowrap;
}

.scan-template-actions button {
  margin-right: 6px;
}

.scan-template-modal {
  width: min(760px, calc(100vw - 48px));
}

.scan-template-settings-modal {
  display: grid;
  gap: 12px;
}

.scan-template-settings-modal label {
  display: grid;
  gap: 5px;
  color: #44515c;
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.scan-template-settings-modal textarea {
  width: 100%;
  min-height: 360px;
  border: 1px solid #cbd5dc;
  border-radius: 8px;
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  resize: vertical;
  white-space: pre;
}

.scan-worker-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 13px;
}

.scan-worker-table th,
.scan-worker-table td {
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
}

.scan-worker-table th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.scan-worker-table td:first-child {
  min-width: 190px;
}

.scan-worker-table td strong,
.scan-worker-table td small {
  display: block;
  overflow-wrap: anywhere;
}

.scan-worker-table td small,
.scan-worker-modal-meta {
  color: var(--muted);
  font-size: 12px;
}

.scan-worker-modal {
  width: min(760px, calc(100vw - 48px));
}

.scan-worker-settings-modal {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.scan-worker-settings-modal label {
  display: grid;
  gap: 5px;
  color: #44515c;
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.scan-worker-settings-modal input {
  min-height: 36px;
  font-size: 13px;
  text-transform: none;
}

.scan-worker-settings-modal .scan-worker-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
}

.scan-worker-settings-modal .scan-worker-check input {
  min-height: auto;
}

.scan-worker-settings-modal .scan-worker-json {
  grid-column: 1 / -1;
}

.scan-worker-settings-modal textarea {
  width: 100%;
  min-height: 300px;
  border: 1px solid #cbd5dc;
  border-radius: 8px;
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  resize: vertical;
  white-space: pre;
}

.scan-worker-modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  grid-column: 1 / -1;
}

.scan-worker-settings {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(120px, 180px) repeat(2, minmax(80px, 110px)) minmax(90px, auto) auto minmax(80px, auto);
  gap: 8px;
  align-items: end;
}

.scan-worker-settings label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.scan-worker-settings input {
  min-height: 34px;
  font-size: 13px;
  text-transform: none;
}

.scan-worker-settings .scan-worker-check {
  align-content: center;
  min-height: 34px;
}

.scan-worker-settings .scan-worker-check input {
  min-height: auto;
}

.scan-worker-json {
  grid-column: 1 / -1;
}

.scan-worker-json textarea,
.scan-template-settings textarea {
  width: 100%;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  resize: vertical;
  white-space: pre;
}

.scan-template-settings {
  display: grid;
  gap: 8px;
}

.scan-worker-save-status {
  min-height: 34px;
  align-content: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

.scan-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.scan-progress span {
  display: block;
  height: 100%;
  background: #2a9d8f;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  border-radius: 50%;
  background: #111820;
  color: #ffffff;
  font-size: 0;
  padding: 0;
}

.modal-close::before,
.modal-close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
  transform-origin: center;
}

.modal-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.modal-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.export-table-wrap {
  max-width: calc(100vw - 96px);
  overflow: auto;
}

.export-table {
  width: 860px;
  min-width: 760px;
  border-collapse: collapse;
  table-layout: fixed;
  background: #ffffff;
  color: #111820;
  font-size: 16px;
}

.export-match-col {
  width: 58px;
}

.export-place-col {
  width: 50px;
}

.export-table caption {
  caption-side: top;
  padding: 0 0 10px;
  color: #111820;
  font-size: 24px;
  font-weight: 900;
  text-align: left;
}

.export-table th,
.export-table td {
  border: 2px solid #2d3a42;
  padding: 6px;
  vertical-align: middle;
  text-align: center;
}

.export-table thead th {
  background: #e8eef1;
  font-size: 15px;
  text-align: center;
}

.export-table thead th.export-week-push {
  background: #e7f4eb;
}

.export-table thead th.export-week-save {
  background: #fae9e7;
}

.export-table thead th.export-week-push .export-week-status {
  color: #147a45;
}

.export-table thead th.export-week-save .export-week-status {
  color: #b3261e;
}

.export-week-status {
  display: block;
  margin-top: 3px;
  color: #1f6472;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.export-table tbody th {
  background: #f3f5f6;
  text-align: center;
}

.export-team {
  display: flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 3px 5px;
  border-radius: 4px;
  font-weight: 750;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.export-team + .export-team,
.export-place + .export-place {
  margin-top: 4px;
}

.export-winner {
  background: #e3f5e9;
  color: #0e5b38;
}

.export-final {
  background: #f5f1e9;
}

.export-place {
  display: flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: #f3f5f6;
  font-weight: 900;
}

.export-team.bookmarked {
  background: transparent;
  border: 2px solid #b3261e;
  color: #8a1c18;
  padding: 1px 3px;
}

.export-bookmark-star {
  color: #d4a017;
  font-weight: 900;
}

/* The final-results column should stay neutral; favourite is marked by the gold star only. */
.export-final.bookmarked {
  border: 0;
  background: #f5f1e9;
  color: #111820;
  padding: 3px 5px;
}

/* A bookmarked team should keep the winner state when prediction selects it. */
.export-team.export-winner.bookmarked {
  background: #e3f5e9;
  border-color: #126b40;
  color: #0e5b38;
}

.export-empty {
  color: #6b7880;
  font-style: italic;
}

.export-starred-matches {
  margin-top: 22px;
  width: 100%;
  overflow: auto;
}

.export-starred-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  table-layout: fixed;
  color: #111820;
  font-size: 13px;
}

.export-starred-table th,
.export-starred-table td {
  border: 1px solid #9caab1;
  padding: 7px;
  text-align: center;
  vertical-align: middle;
}

.export-starred-table thead th {
  background: #e8eef1;
  font-weight: 800;
}

.export-starred-table th.export-country-column,
.export-starred-table td.export-country-cell {
  width: 7%;
  max-width: 7%;
  padding-left: 4px;
  padding-right: 4px;
  white-space: nowrap;
}

.export-starred-table tbody th {
  background: #f3f5f6;
  text-align: left;
}

.export-starred-table td.export-metric-cell {
  text-align: center;
}

.export-starred-table tbody tr.export-starred-row th,
.export-starred-table tbody tr.export-starred-row td {
  background: transparent;
  font-weight: 400;
  text-align: center;
}

.export-starred-table tbody tr.export-mode-push td {
  background: #f2fbf5;
}

.export-starred-table tbody tr.export-mode-save td {
  background: #fdf3f2;
}

.export-starred-table tbody tr.export-mode-mixed td {
  background: #f7f7f2;
}

.export-metric-value,
.export-metric-delta {
  white-space: nowrap;
}

.export-metric-pair {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  column-gap: 8px;
}

.export-metric-value {
  min-width: 0;
  text-align: right;
}

.export-metric-delta {
  min-width: 0;
  padding-left: 4px;
  text-align: left;
}

.export-metric-delta {
  font-weight: 800;
}

.export-metric-delta.positive {
  color: #b3261e;
}

.export-metric-delta.negative {
  color: #147a45;
}

.export-metric-delta.neutral {
  color: #6b7880;
}

@media (max-width: 980px) {
  .app-header,
  main,
  .app-footer {
    width: min(100vw - 20px, 720px);
  }

  .app-header {
    display: flex;
  }

  .league-shell,
  .app-setup-collapsed .league-shell {
    grid-template-columns: 1fr;
  }

  .tool-local-header {
    display: grid;
  }

  .setup-panel {
    grid-row: auto;
  }

  .app-setup-collapsed .setup-panel,
  .app-setup-collapsed .bracket-panel,
  .app-setup-collapsed .standings-panel {
    grid-column: auto;
    grid-row: auto;
  }

  .app-setup-collapsed .setup-panel .section-title {
    display: flex;
    margin-bottom: 0;
  }

  .app-setup-collapsed .setup-actions .compact {
    writing-mode: horizontal-tb;
    min-height: 34px;
    padding: 0 10px;
  }

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

  .player-search-form,
  .report-search-form,
  .task-search-form,
  .healing-form,
  .healing-summary {
    grid-template-columns: 1fr 1fr;
  }

  .scan-worker-settings,
  .scan-worker-settings-modal,
  .scan-form-subgrid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .team-form {
    grid-template-columns: 1fr;
  }

  .scan-worker-settings,
  .scan-worker-settings-modal,
  .scan-form-subgrid {
    grid-template-columns: 1fr;
  }

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

  .header-module-title {
    display: none;
  }

  .app-header {
    width: 100vw;
    margin-left: 0;
    margin-right: 0;
    align-items: flex-start;
    gap: 10px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .app-menu {
    width: min(260px, calc(100vw - 20px));
    max-height: calc(100vh - 76px);
  }

  .header-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px 42px;
    grid-template-areas:
      "battery notification scan"
      ". . clock";
    align-items: center;
    gap: 4px 8px;
  }

  .battery-badge {
    grid-area: battery;
    min-width: 0;
    min-height: 36px;
    padding: 6px 8px;
  }

  .scan-launch-button {
    grid-area: scan;
    justify-self: end;
  }

  .notification-button {
    grid-area: notification;
  }

  .local-clock {
    grid-area: clock;
    justify-self: end;
    margin-left: 0;
    font-size: 14px;
    padding-top: 0;
  }

  .app-menu {
    width: min(260px, calc(100vw - 40px));
  }

  .player-search-form,
  .report-search-form,
  .vs-team-grid,
  .task-search-form,
  .healing-form,
  .healing-summary {
    grid-template-columns: 1fr;
  }

  .vs-divider {
    min-height: 34px;
  }
}

.config-shell {
  min-height: calc(100vh - 150px);
}

.tool-screen.account-shell.active {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: calc(100vh - 150px);
  padding-bottom: 32px;
}

.account-panel {
  width: min(100%, 860px);
  padding: 18px;
}

.account-form,
.account-password-form {
  display: grid;
  gap: 14px;
}

.account-form > label,
.account-password-form > label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.account-form > label input,
.account-form > label select,
.account-password-form > label input {
  width: 100%;
}

.account-form > .checkbox-label {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  color: var(--ink);
}

.account-form > .checkbox-label input {
  width: auto;
  flex: 0 0 auto;
  margin: 0;
}

.account-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.account-password-modal {
  position: relative;
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
  padding: 22px;
}

.account-password-header {
  padding-right: 48px;
  margin-bottom: 18px;
}

.account-password-header p:last-child {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.config-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.config-actions,
.config-preview-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.config-workbench {
  display: grid;
  grid-template-columns: minmax(340px, 430px) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
  min-height: calc(100vh - 245px);
}

.config-sidebar,
.config-preview-panel {
  min-height: min(720px, calc(100vh - 245px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.config-sidebar {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: calc(100vh - 245px);
  max-height: calc(100vh - 245px);
  position: sticky;
  top: 18px;
}

.config-meta {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 13px;
}

.config-meta label {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-weight: 800;
}

.config-dimension-status {
  display: grid;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}

.config-section-list {
  overflow: auto;
  padding: 8px;
  min-height: 0;
}

.config-section {
  border-bottom: 1px solid var(--line);
  padding: 10px 2px 12px;
}

.config-section:last-child {
  border-bottom: 0;
}

.config-section-header,
.config-coord-row {
  display: grid;
  gap: 8px;
  align-items: start;
}

.config-section-header {
  grid-template-columns: 26px 22px minmax(0, 1fr);
  padding: 4px 6px 8px;
}

.config-section-collapse {
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--field);
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.config-coord-row {
  grid-template-columns: 22px minmax(0, 1fr);
}

.config-section-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 850;
}

.config-section-title span:last-child {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.config-coord-row {
  padding: 8px 6px;
  border-radius: 6px;
}

.config-coord-row:hover {
  background: var(--pick-hover);
}

.config-coord-main {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.config-coord-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 750;
  font-size: 13px;
}

.config-color-swatch {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: 3px;
  border: 2px solid currentColor;
}

.config-coord-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.config-coord-type {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex: 0 0 auto;
}

.config-coord-inputs {
  display: grid;
  grid-template-columns: repeat(4, minmax(58px, 1fr));
  gap: 6px;
}

.config-coord-inputs label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.config-coord-inputs input {
  min-width: 0;
  width: 100%;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--field);
  color: var(--ink);
  padding: 0 7px;
  font-variant-numeric: tabular-nums;
}

.config-coord-inputs input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.config-coord-note {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.config-preview-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: calc(100vh - 245px);
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 245px);
}

.config-preview-toolbar {
  justify-content: space-between;
  min-height: 48px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.config-scale-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
}

.config-scale-control input {
  width: 130px;
  accent-color: var(--accent);
}

.config-preview-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 16px;
  overflow: auto;
  background:
    linear-gradient(45deg, rgba(96, 113, 124, 0.08) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(96, 113, 124, 0.08) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(96, 113, 124, 0.08) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(96, 113, 124, 0.08) 75%);
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

#configPreviewCanvas {
  display: block;
  width: var(--config-preview-width, 100%);
  max-width: none;
  height: auto;
  margin: 0 auto;
  background: var(--panel);
  border: 2px solid var(--ink);
  transform-origin: top left;
}

@media (max-width: 980px) {
  .config-workbench {
    grid-template-columns: 1fr;
  }

  .config-sidebar,
  .config-preview-panel {
    height: auto;
    min-height: auto;
    max-height: none;
    position: static;
  }

  .config-preview-wrap {
    min-height: 420px;
  }
}

/* Player defense roster: loaded on demand, with no list polling dependency. */
.hero-star-progress { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 1px; }
.hero-star { background: linear-gradient(to right, #b77900 var(--star-fill), #9aa4af var(--star-fill)); background-clip: text; -webkit-background-clip: text; color: transparent; font-size: 16px; line-height: 1.2; }
.hero-star-progress small { margin-left: 3px; color: var(--muted); }
.roster-open-btn { padding: 0; min-height: auto; border: 0; background: none; color: inherit; font: inherit; font-weight: 700; text-align: left; text-decoration: none; }
.roster-open-btn:hover,
.roster-open-btn:focus-visible { color: inherit; background: transparent !important; text-decoration: none; }
.roster-dialog { width: min(960px, calc(100vw - 24px)); max-height: 90vh; padding: 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink); overflow: auto; }
.roster-dialog::backdrop { background: rgb(0 0 0 / 65%); }
.roster-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.roster-header h2 { margin: 0; font-size: 22px; }
.roster-note { color: var(--muted); font-size: 13px; line-height: 1.5; }
.roster-tabs { display: flex; gap: 8px; margin: 18px 0; }
.roster-tabs button[aria-pressed="false"] { background: var(--panel-soft); color: var(--ink); }
.roster-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.roster-table td, .roster-table th { padding: 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.roster-squad { border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin: 12px 0; }
.roster-squad h3 { margin: 0; }
.squad-formation { width: min(100%, 440px); margin: 12px auto 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.roster-slot { grid-column: span 2; display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--line); border-top: 3px solid var(--muted); border-radius: 6px; background: var(--panel-soft); font-size: 13px; overflow-wrap: anywhere; }
.roster-slot:nth-child(1) { grid-column: 2 / span 2; }
.roster-slot:nth-child(2) { grid-column: 4 / span 2; }
.roster-slot small { color: var(--muted); }
.roster-slot.hero-rarity-ur { border-top-color: #caad56; }
.roster-slot.hero-rarity-sr { border-top-color: #60a5fa; }
.roster-slot.hero-rarity-ssr { border-top-color: #c084fc; }
@media (max-width: 600px) { .roster-dialog { padding: 12px; } .roster-header h2 { font-size: 18px; } .roster-squad { padding: 10px; } .squad-formation { gap: 5px; } .roster-slot { padding: 7px; font-size: 11px; } }

.player-squad-badge { display: inline-block; white-space: nowrap; font-size: 0.72rem; font-weight: 600; color: var(--accent); border: 1px solid currentColor; border-radius: 999px; padding: 2px 7px; }
.player-subtabs { display: flex; gap: 8px; margin: 0 0 16px; border-bottom: 1px solid var(--line); }
.player-subtab { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: transparent; color: var(--muted); padding: 9px 14px; font-weight: 700; cursor: pointer; }
.player-subtab.active { color: var(--accent); border-bottom-color: var(--accent); }
.alliance-search-form { align-items: end; }
.alliance-table td:first-child { font-weight: 700; }

.player-movement-alert { padding: 12px; margin: 10px 0; border-left: 4px solid #e09d24; background: #fff0c4; color: #352400; font-weight: 600; }

/* Alliance report: compact A4-style screen layout, printable later. */
.alliance-report-panel { width: 100%; max-width: 1180px; min-width: 0; margin: 0 auto; }
.alliance-report-form { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(180px, 1.2fr) minmax(140px, 1fr) auto; gap: 12px; align-items: end; margin: 16px 0; }
.alliance-report-form label { display: grid; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 700; }
.alliance-report-form input { width: 100%; }
.alliance-report-page { display: grid; gap: 18px; }
.alliance-report-results,
.alliance-report-page,
.alliance-report-card { min-width: 0; }
.alliance-report-card { background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--alliance-report-color, var(--accent)); border-radius: 10px; padding: 20px; break-inside: avoid; }
.alliance-report-color-1 { border-top-color: #d95f02; }
.alliance-report-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.alliance-report-heading h3 { margin: 0; font-size: 24px; }
.alliance-report-heading span, .alliance-report-note, .alliance-top-player small { color: var(--muted); }
.alliance-report-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin: 16px 0 8px; }
.alliance-report-stat { display: grid; gap: 4px; padding: 10px; background: var(--panel-soft); border-radius: 7px; }
.alliance-report-stat strong { font-size: 18px; }
.alliance-report-stat span { color: var(--muted); font-size: 11px; }
.alliance-report-card h4 { margin: 18px 0 8px; }
.alliance-power-chart { display: grid; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-soft); }
.alliance-chart-scroll { width: 100%; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; }
.alliance-power-series { display: grid; gap: 4px; }
.alliance-power-series > strong { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.alliance-power-bar-row { display: grid; grid-template-columns: 82px minmax(80px, 1fr) 32px; align-items: center; gap: 8px; font-size: 11px; }
.alliance-power-bar-track { display: block; height: 12px; overflow: hidden; border-radius: 99px; background: color-mix(in srgb, var(--muted) 18%, transparent); }
.alliance-power-bar { display: block; height: 100%; min-width: 2px; border-radius: inherit; background: var(--accent); }
.series-tank .alliance-power-bar { background: #4c78a8; }
.series-air .alliance-power-bar { background: #59a14f; }
.series-missile .alliance-power-bar { background: #e15759; }
.series-real .alliance-power-bar { background: #222; }
.alliance-report-match-mode { display: block; margin: 4px 0 8px; color: var(--muted); font-size: 11px; }
.alliance-power-plot { position: relative; display: grid; grid-template-columns: 54px minmax(0, 1fr); min-height: 210px; gap: 8px; border-bottom: 1px solid var(--line); padding-bottom: 22px; }
.alliance-power-y-axis { display: flex; align-items: stretch; justify-content: space-between; flex-direction: column; padding: 2px 0 0; color: var(--muted); font-size: 10px; }
.alliance-power-y-title { position: absolute; left: -3px; top: 50%; transform: rotate(-90deg) translateX(-50%); transform-origin: left top; color: var(--ink); font-weight: 700; font-size: 11px; }
.alliance-power-columns-inner { display: grid; grid-template-columns: repeat(var(--alliance-bin-count, 1), minmax(0, 1fr)); align-items: end; gap: 0; min-width: 0; height: 260px; overflow: visible; padding: 0; }
.alliance-power-column { position: relative; display: flex; min-width: 0; height: 100%; flex-direction: column; justify-content: end; align-items: center; }
.alliance-power-column-count { min-height: 14px; color: var(--ink); font-size: 10px; }
.alliance-power-column-bar { display: block; width: 100%; min-height: 0; border-radius: 2px 2px 0 0; background: var(--accent); }
.alliance-power-column-bar.is-empty { display: none; }
.series-real .alliance-power-column-bar, .series-tank .alliance-power-column-bar, .series-air .alliance-power-column-bar, .series-missile .alliance-power-column-bar { background: #4c78a8; }
.alliance-power-column-label { height: 18px; margin-top: 4px; white-space: nowrap; color: var(--muted); font-size: 9px; }
.alliance-power-x-title { position: absolute; bottom: 0; left: 54px; right: 0; text-align: center; color: var(--muted); font-size: 11px; }
.alliance-power-legend { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-bottom: 8px; font-size: 11px; font-weight: 700; }
.alliance-power-legend span::before { display: inline-block; width: 10px; height: 10px; margin-right: 4px; border-radius: 2px; background: var(--accent); content: ""; vertical-align: -1px; }
.alliance-power-legend .series-real::before, .alliance-power-legend .series-tank::before, .alliance-power-legend .series-air::before, .alliance-power-legend .series-missile::before { background: #4c78a8; }
.alliance-composition-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0 0 8px; color: var(--muted); font-size: 10px; }
.alliance-comparison-legends { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 18px; }
.alliance-comparison-legends .alliance-power-legend,
.alliance-comparison-legends .alliance-composition-legend { margin-bottom: 8px; }
.alliance-comparison-legends .alliance-composition-legend { justify-content: flex-end; }
.alliance-composition-legend-item { display: inline-flex; align-items: center; gap: 4px; }
.alliance-composition-legend-swatch { display: inline-block; width: 18px; height: 10px; border-radius: 2px; background: #6b7280; }
.alliance-composition-legend-item.is-air .alliance-composition-legend-swatch { background-image: repeating-linear-gradient(135deg, rgb(255 255 255 / 75%) 0 2px, transparent 2px 6px); }
.alliance-composition-legend-item.is-missile .alliance-composition-legend-swatch { background-image: repeating-linear-gradient(-135deg, rgb(255 255 255 / 75%) 0 2px, transparent 2px 6px); }
.alliance-power-shared-plot { position: relative; display: grid; grid-template-columns: 54px minmax(0, 1fr); min-height: 585px; gap: 8px; border-bottom: 1px solid var(--line); }
.alliance-power-shared-series { display: grid; gap: 5px; min-width: 0; }
.alliance-power-shared-row { display: grid; grid-template-columns: 82px minmax(0, 1fr); align-items: end; min-height: 135px; gap: 4px; background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(25% - 1px), color-mix(in srgb, var(--muted) 18%, transparent) calc(25% - 1px), color-mix(in srgb, var(--muted) 18%, transparent) 25%); }
.alliance-power-shared-row > strong { align-self: center; font-size: 11px; text-transform: uppercase; }
.alliance-power-shared-row .alliance-power-columns-inner { height: 135px; border-bottom: 1px solid color-mix(in srgb, var(--muted) 20%, transparent); }
.alliance-power-shared-row .alliance-power-column { border-left: 1px dashed color-mix(in srgb, var(--muted) 20%, transparent); }
.alliance-power-shared-x-axis { display: grid; grid-template-columns: 54px 82px minmax(0, 1fr); gap: 8px; align-items: start; }
.alliance-power-x-labels { display: grid; grid-column: 3; grid-template-columns: repeat(var(--alliance-bin-count, 1), minmax(0, 1fr)); text-align: center; color: var(--muted); font-size: 10px; }
.alliance-power-shared-x-axis > strong { grid-column: 3; text-align: center; color: var(--muted); font-size: 11px; }
.alliance-comparison-players { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.alliance-comparison-player-column { min-width: 0; }
.alliance-comparison-player-column > h4 { margin-top: 0; }
.alliance-comparison-player-column .alliance-top-players { grid-template-columns: 1fr; }
.alliance-comparison-players-count-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.alliance-comparison-players-count-3 .alliance-comparison-player-column,
.alliance-comparison-players-count-4 .alliance-comparison-player-column {
  border: 2px solid var(--alliance-report-color, var(--line));
  border-radius: 10px;
  padding: 8px;
}
.alliance-comparison-players-count-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.alliance-comparison-players-count-4 .alliance-top-squads { grid-template-columns: 1fr; }
.alliance-comparison-columns { background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(25% - 1px), color-mix(in srgb, var(--muted) 18%, transparent) calc(25% - 1px), color-mix(in srgb, var(--muted) 18%, transparent) 25%); }
.alliance-comparison-column { flex-direction: row; align-items: end; justify-content: center; gap: 1px; border-left: 1px dashed color-mix(in srgb, var(--muted) 20%, transparent); }
.alliance-comparison-bar-wrap { position: relative; display: block; width: calc(50% - 1px); min-height: 0; }
.alliance-comparison-bar { display: block; width: 100%; height: 100%; border-radius: 2px 2px 0 0; }
.alliance-comparison-bar { display: flex; flex-direction: column-reverse; overflow: hidden; }
.alliance-comparison-bar-segment { display: block; flex: 0 0 auto; width: 100%; min-height: 0; }
.alliance-comparison-bar-label { position: absolute; left: 50%; top: -17px; transform: translateX(-50%); font-size: 10px; line-height: 1; font-weight: 700; white-space: nowrap; }
.alliance-comparison-legend-item::before { background: var(--alliance-comparison-color) !important; }
.alliance-comparison-chart { padding: 8px; }
.alliance-comparison-chart .alliance-power-shared-plot { min-height: 312px; gap: 4px; }
.alliance-comparison-chart .alliance-power-columns-inner { height: 312px; }
.alliance-comparison-chart .alliance-power-shared-x-axis { grid-template-columns: 54px minmax(0, 1fr); }
.alliance-comparison-chart .alliance-power-x-labels,
.alliance-comparison-chart .alliance-power-shared-x-axis > strong { grid-column: 2; }
.alliance-top-player-alliance { display: block; margin-top: 4px; font-weight: 700; }
.alliance-top-player-alliance::before { display: inline-block; width: 9px; height: 9px; margin-right: 4px; border-radius: 2px; content: ""; }
.alliance-report-color-text-0::before { background: var(--accent); }
.alliance-report-color-text-1::before { background: #d95f02; }
.icon-button.notification-button { position: relative; display: inline-grid; place-items: center; width: 42px; height: 42px; min-width: 42px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--muted); }
.icon-button.notification-button:hover { border-color: var(--muted); background: var(--panel-soft); color: var(--ink); }
.notification-button.has-unread { border-color: color-mix(in srgb, var(--line) 70%, #d62828); }
.notification-count { position: absolute; top: -5px; right: -5px; min-width: 16px; padding: 1px 4px; border-radius: 10px; background: #d62828; color: white; font-size: 10px; }
.notification-panel { position: absolute; z-index: 20; top: 58px; right: 16px; width: min(360px, calc(100vw - 32px)); max-height: 60vh; overflow: auto; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: 0 8px 30px #0003; }
.notification-panel-title { font-weight: 700; margin-bottom: 8px; }
.notification-item { padding: 9px; border-bottom: 1px solid var(--line); cursor: pointer; }
.notification-item.unread { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.notification-item time { display: block; color: var(--muted); font-size: 11px; }
.notification-item p { margin: 5px 0 0; white-space: pre-wrap; }
.alliance-top-players { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.alliance-top-player { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: var(--panel-soft); }
.alliance-top-player-header { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.alliance-top-player-header span { white-space: nowrap; font-size: 12px; }
.alliance-top-squads { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.alliance-top-squad { padding: 8px; border: 1px solid var(--line); border-radius: 6px; }
.alliance-squad-members { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; margin-top: 6px; }
.alliance-squad-member:nth-child(1) { grid-column: 2 / span 2; }
.alliance-squad-member:nth-child(2) { grid-column: 4 / span 2; }
.alliance-squad-member:nth-child(n + 3) { grid-column: span 2; }
.alliance-squad-member { min-width: 0; text-align: center; font-size: 10px; overflow-wrap: anywhere; }
.alliance-squad-member .hero-portrait { margin: 0 auto; width: 100%; max-width: 100%; }
.alliance-squad-member .hero-portrait-stats { padding: 3px 1px 1px; background: linear-gradient(transparent, rgb(0 0 0 / 72%)); }
.alliance-squad-member .hero-portrait-stats > strong { display: none; }
.alliance-squad-member .hero-portrait .hero-star-progress { display: flex; width: calc(100% - 6px); margin: 0 auto; justify-content: stretch; gap: 0; font-size: clamp(10px, 2.5vw, 14px); line-height: 1; }
.alliance-squad-member .hero-portrait .hero-star-progress .hero-star { flex: 1 1 0; min-width: 0; text-align: center; font-size: inherit; }
.alliance-squad-member .hero-portrait .hero-star-progress small { display: none; }
@media print {
  .app-header, .app-menu-wrap, .alliance-report-form, .report-actions, .alliance-report-note { display: none !important; }
  .alliance-report-panel { max-width: none; }
  .alliance-report-card { box-shadow: none; }
}
@media (max-width: 800px) {
  /* Keep cards within the app gutter; charts get their own readability scroll area. */
  .alliance-report-shell { width: 100vw; max-width: 100vw; min-width: 0; margin-left: calc((100% - 100vw) / 2); overflow-x: clip; }
  .alliance-report-panel,
  .alliance-report-results,
  .alliance-report-page,
  .alliance-report-card { width: 100%; max-width: 100%; min-width: 0; }
  .alliance-report-panel { border-radius: 0; padding: 12px; }
  .alliance-report-results {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc((100% - 100vw) / 2);
  }
  .alliance-report-card { padding: 12px; }
  .alliance-chart-scroll { width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; }
  .alliance-chart-scroll > .alliance-power-chart { width: max-content; min-width: 680px; max-width: none; }
  .alliance-report-form, .alliance-report-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .alliance-report-form button { grid-column: 1 / -1; }
  .alliance-top-players { grid-template-columns: 1fr; }
  .alliance-comparison-players {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
  }
  .alliance-comparison-players-count-3 .alliance-top-squads { grid-template-columns: 1fr; }
  .alliance-comparison-players-count-3 .alliance-comparison-player-column,
  .alliance-comparison-players-count-4 .alliance-comparison-player-column {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 0;
  }
  .alliance-top-player { padding: 8px; }
  .alliance-top-squads { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; margin-top: 8px; }
  .alliance-top-squad { padding: 5px; }
  .alliance-squad-members {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
    justify-content: start;
    margin-top: 4px;
  }
  .alliance-squad-member .hero-portrait { width: 100%; max-width: 52px; }
  .alliance-squad-member .hero-portrait-stats { padding: 2px 1px 1px; }
  .alliance-squad-member .hero-portrait .hero-star-progress,
  .alliance-squad-member .hero-portrait .hero-star-progress .hero-star { font-size: clamp(10px, 2.5vw, 14px); }

  /* The comparison view has several nested cards. On a phone, keep the
     player frame and both squad frames flush with their parent; reserve
     horizontal space only for the player heading and enlarge the portraits. */
  .alliance-comparison-players {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc((100% - 100vw) / 2);
  }
  .alliance-comparison-player-column { padding-inline: 0; }
  .alliance-comparison-player-column .alliance-top-players {
    width: 100%;
    margin-inline: 0;
  }
  .alliance-comparison-players .alliance-top-player-header {
    align-items: flex-start;
    gap: 4px;
  }
  .alliance-comparison-players .alliance-top-player-header strong {
    min-width: 0;
    flex: 1 1 auto;
    overflow-wrap: anywhere;
    font-size: 12px;
    line-height: 1.2;
  }
  .alliance-comparison-players .alliance-top-player-header span {
    flex: 0 0 auto;
    font-size: 10px;
  }
  .alliance-comparison-players .alliance-squad-members {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 2px;
  }
  .alliance-comparison-players .alliance-squad-member:nth-child(1) { grid-column: 2 / span 2; }
  .alliance-comparison-players .alliance-squad-member:nth-child(2) { grid-column: 4 / span 2; }
  .alliance-comparison-players .alliance-squad-member:nth-child(n + 3) { grid-column: span 2; }
  .alliance-top-players {
    width: calc(100% + 24px);
    margin-inline: -12px;
  }
  .alliance-top-player {
    padding: 8px 0;
  }
  .alliance-top-player-header { padding-inline: 8px; }
  .alliance-top-squads {
    margin-inline: 0;
  }
  .alliance-comparison-players .alliance-top-squads {
    grid-template-columns: 1fr;
    gap: 5px;
  }
  .alliance-chart-scroll {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc((100% - 100vw) / 2);
  }
  .alliance-squad-member .hero-portrait {
    max-width: 52px;
  }
}

/* Fixed portrait geometry also applies to absent heroes and failed images. */
.roster-slot { padding: 5px; gap: 3px; font-size: 12px; }
.roster-slot > strong { line-height: 1.2; }
.hero-portrait { position: relative; aspect-ratio: 3 / 4; width: 100%; overflow: hidden; border-radius: 4px; background: var(--panel); border: 1px solid var(--line); }
.hero-portrait > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-portrait-placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); text-align: center; padding: 5px; }
.hero-portrait-placeholder[hidden] { display: none; }
.hero-ew-badge { position: absolute; top: 4px; right: 4px; z-index: 1; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: #ffd139; color: #2d2200; font-size: 13px; font-weight: 800; line-height: 1; pointer-events: none; }
.hero-portrait-stats { position: absolute; inset: auto 0 0; display: flex; flex-direction: column; padding: 14px 3px 3px; background: linear-gradient(transparent, rgb(0 0 0 / 85%)); color: white; text-shadow: 0 1px 2px black; }
.hero-portrait-stats > strong { font-size: clamp(12px, 2.5vw, 17px); }
.hero-portrait .hero-star-progress { display: flex; flex-wrap: wrap; gap: 0; font-size: clamp(12px, 2.6vw, 19px); line-height: 1.1; }
.hero-portrait .hero-star-progress small { color: white; font-size: 10px; margin-left: 2px; }
@media (max-width: 600px) { .roster-slot { padding: 3px; font-size: 10px; } }

@media (max-width: 800px) {
  .hero-ew-badge { top: 3px; right: 3px; width: 18px; height: 18px; font-size: 11px; }
}

.hero-portrait .hero-star { font-size: inherit; text-shadow: none; background-image: linear-gradient(to right, #ffd139 var(--star-fill), #89939f var(--star-fill)); }
.simulated-power-header, .simulated-power-cell { font-variant-numeric: tabular-nums; }
.simulated-power-header { color: var(--accent); font-size: 0.78em; white-space: nowrap; }
.simulated-power-cell { font-weight: 750; border-left: 2px solid currentColor; }
.simulated-tank { color: #b77900; }
.simulated-air { color: #287bb5; }
.simulated-missile { color: #a04b78; }
.roster-simulated-card.simulated-tank { color: #b77900; }
.roster-simulated-card.simulated-air { color: #287bb5; }
.roster-simulated-card.simulated-missile { color: #a04b78; }
.roster-simulated-card { border-color: currentColor; }
.roster-simulated-card > h3 { color: inherit; }
.simulated-meta { margin: 4px 0 0; }
.simulated-why { margin: 10px 0 0; font-size: 13px; }
@media (max-width: 600px) {
  .roster-tabs { flex-wrap: wrap; }
}

/* Keep mobile roster cards aligned to the dialog content instead of stacking
   the dialog, squad, formation, and hero-card side gutters. */
@media (max-width: 600px) {
  .roster-dialog {
    width: calc(100vw - 16px);
    max-width: none;
    padding-inline: 8px;
  }

  .roster-dialog > [aria-live],
  .roster-dialog > [aria-live] > section,
  .roster-squad {
    min-width: 0;
    width: 100%;
  }

  .roster-squad {
    margin-inline: 0;
    padding-inline: 0;
  }

  .squad-formation {
    width: 100%;
    margin-inline: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .roster-slot {
    grid-column: auto;
    padding-inline: 2px;
  }

  .roster-slot:nth-child(1),
  .roster-slot:nth-child(2) {
    grid-column: auto;
  }
}

@media (max-width: 600px) {
  .train-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .train-lottery-grid { grid-template-columns: 1fr; }
  .report-table-wrap, .trade-table-wrap { display: none; }
  .trade-mobile-sort { display: flex; align-items: center; flex-wrap: nowrap; gap: 3px; width: calc(100% + 36px); margin: 0 -18px 8px; padding: 0 18px; }
  .trade-mobile-sort-label { color: var(--muted); font-size: 12px; font-weight: 800; margin-right: 1px; }
  .trade-mobile-sort-button { min-height: 30px; padding: 4px 5px; border: 1px solid var(--line); border-radius: 6px; background: var(--field); color: var(--text); font-size: 10px; font-weight: 800; white-space: nowrap; }
  .trade-mobile-sort-button:hover, .trade-mobile-sort-button:focus-visible, .trade-mobile-sort-button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
  .report-mobile-cards, .trade-mobile-cards { display: grid; gap: 10px; width: calc(100% + 36px); margin-inline: -18px; }
  .report-mobile-card, .trade-mobile-card { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 12px; min-width: 0; }
  .mobile-card-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; }
  .mobile-card-heading strong { min-width: 0; overflow-wrap: anywhere; }
  .mobile-card-heading span { color: var(--muted); font-size: 12px; white-space: nowrap; }
  .report-mobile-coords, .trade-mobile-coords { margin: 8px 0 10px; padding: 9px 10px; border-radius: 7px; background: var(--panel-soft); color: var(--accent-dark); font-weight: 850; font-variant-numeric: tabular-nums; }
  .trade-mobile-meta-row { display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: center; gap: 10px; margin: 0 0 2px; min-width: 0; }
  .trade-mobile-meta-row .trade-mobile-coords { min-width: 0; max-width: 100%; margin: 8px 0 10px; padding: 0; background: transparent; color: inherit; font-weight: 400; white-space: nowrap; }
  .trade-mobile-meta-row .trade-mobile-coords .vs-coords-server { display: block; margin: 0 0 2px; padding: 2px 7px; font-size: 12px; font-weight: 400; }
  .report-mobile-coords-seen { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; white-space: nowrap; }
  .report-mobile-resources { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin: 2px 0 8px; }
  .report-resource-badge { display: block; padding: 7px 5px; border: 1px solid currentColor; border-radius: 8px; text-align: center; font-size: 14px; font-weight: 400; font-variant-numeric: tabular-nums; }
  .report-resource-badge-iron { color: #9fb2c2; background: rgba(159, 178, 194, 0.12); }
  .report-resource-badge-food { color: #d8c5a5; background: rgba(216, 197, 165, 0.12); }
  .report-resource-badge-gold { color: #d5a83e; background: rgba(213, 168, 62, 0.12); }
  .report-mobile-gold-shot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; padding: 7px 10px; border: 1px solid #d5a83e; border-radius: 8px; color: #d5a83e; background: rgba(213, 168, 62, 0.12); font-variant-numeric: tabular-nums; }
  .report-mobile-gold-shot span { font-size: 12px; }
  .report-mobile-gold-shot strong { font-weight: 400; }
  .report-mobile-updated { color: var(--muted); font-size: 12px; text-align: right; }
  .trade-mobile-identity { min-width: 0; margin: 0 0 9px; font-weight: 400; overflow-wrap: anywhere; text-align: right; }
  .mobile-card-fields { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 12px; margin: 0; font-size: 13px; }
  .mobile-card-fields dt { color: var(--muted); }
  .mobile-card-fields dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
  .trade-search-form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .trade-search-form > label:not(.checkbox-label) { gap: 3px; font-size: 11px; }
  .trade-search-form > label:nth-child(1) { grid-column: span 2; }
  .trade-search-form input, .trade-search-form select { min-height: 34px; padding: 6px 8px; }
  .trade-search-form .checkbox-label { min-height: 30px; font-size: 11px; }
}

.ds-combat-controls { position: absolute; left: 10px; bottom: 12px; z-index: 100; display: flex; flex-direction: column; gap: 5px; align-items: stretch; width: 48px; pointer-events: none; }
.ds-combat-controls button, .ds-teleport-cooldown { border: 1px solid var(--line); border-radius: 8px; padding: 8px 5px; background: var(--panel); color: var(--text); font-weight: 700; box-shadow: 0 3px 12px #0003; }
.ds-combat-controls button { width: 48px; min-height: 40px; padding: 3px 2px; font-size: 0; line-height: 1; pointer-events: auto; position: relative; }
.ds-combat-controls button::before { display: block; font-size: 22px; line-height: 27px; text-shadow: 0 1px 0 #fff8; }
.ds-control-defense::before { content: "⚙"; }
.ds-control-composition::before { content: "♟"; }
.ds-control-hospital::before { content: "✚"; }
.ds-control-healing::before { content: "✚"; }
.ds-combat-controls button::after { display: none; }
.ds-control-hospital strong { position: absolute; top: 1px; right: 1px; min-width: 13px; padding: 1px 2px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 8px; line-height: 11px; }
.ds-combat-controls .ds-teleport-cooldown { width: 48px; padding: 3px 1px; font-size: 0; text-align: center; pointer-events: auto; }
.ds-combat-controls .ds-teleport-cooldown::before { display: block; content: "↙"; font-size: 22px; line-height: 26px; color: var(--accent); }
.ds-combat-controls .ds-teleport-cooldown strong { display: block; margin-top: 2px; font-size: 10px; }
.ds-combat-controls button:not(:disabled):hover { border-color: var(--accent); }
.ds-combat-controls .disabled { opacity: .5; }
.ds-teleport-cooldown { font-size: 12px; }
.ds-combat-popup { position: absolute; left: 68px; bottom: 12px; z-index: 101; width: min(330px, calc(100% - 80px)); max-height: calc(100% - 24px); overflow: auto; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: 0 8px 30px #0005; }
.ds-defense-list { display: grid; gap: 5px; margin: 10px 0; }
.ds-defense-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 30px 30px; align-items: center; gap: 5px; padding: 4px 5px; border: 1px solid var(--line); border-radius: 6px; }
.ds-defense-row label { min-width: 0; }
.ds-defense-row button { min-width: 28px; padding: 3px 5px; }
.ds-defense-power { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.ds-combat-controls strong { color: var(--accent); font-variant-numeric: tabular-nums; }
.ds-hour-picker { display:flex; align-items:center; gap:6px; margin:4px 0 8px; color:var(--muted); font-size:11px; }
.ds-hour-picker select { padding:2px 5px; }
.ds-player-button.ds-hour-a { border-color:#4d9b60; background:#e7f6e9; }
.ds-player-button.ds-hour-b { border-color:#4a9e91; background:#e2f5f0; }
.ds-player-button.ds-hour-both { border-color:#8a55a8; background:#f0e4f8; }
.theme-dark .ds-player-button.ds-hour-a { background:#234d2b; color:#b9edc0; }
.theme-dark .ds-player-button.ds-hour-b { background:#1d4e49; color:#b7eee5; }
.theme-dark .ds-player-button.ds-hour-both { background:#4a2d59; color:#ead0fa; }
