/*
  Galactic Conquest — Theme System
  ---------------------------------
  Defines CSS custom properties for the three themes and
  supplies base typography + body chrome. Loaded after main.css
  so it can override legacy body/html/link defaults.

  Themes are selected via [data-theme] on <body>.
    - nebula   (default): modern space-minimal
    - classic            : legacy dark red / gold
    - daylight           : high-contrast light mode
*/

/* ---------- Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=IBM+Plex+Sans:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');


/* ---------- Nebula (default) ---------- */
:root,
body[data-theme="nebula"] {
  /* Surfaces — slightly deeper, bluer to match banner navy */
  --bg-base:        #0c1018;
  --bg-surface:     #1f2842;
  /* Alternate panel surface — sits a half-step above --bg-surface. Used as the
     upper stop of panel/tile/button gradients, which read as lit from above. */
  --bg-surface-alt: #26314f;
  --bg-elevated:    #2a365a;
  --bg-overlay:     rgba(21, 28, 49, 0.92);

  /* Text */
  --text-primary:   #f1eee8;
  --text-secondary: #b7bdd1;
  --text-muted:     #8890a8;
  --text-inverse:   #151c31;

  /* Accents — amber stays primary (warm, readable) */
  --accent:         #e8b563;       /* warm amber — text / data highlights */
  --accent-hover:   #f2c57a;
  --accent-hot:     #ec6262;       /* coral — danger / legacy red */
  --accent-cool:    #7dbff2;       /* electric banner blue — structural */
  --accent-steel:   #5a9fd4;       /* deeper banner blue — borders/chrome */
  --accent-good:    #7fc592;       /* success */
  --accent-gold:    #f5d98f;       /* premium / gold */

  /* Stats */
  --stat-cash:      #7fc592;
  --stat-food:      #e8b563;
  --stat-power:     #7dbff2;
  --stat-turns:     #f5d98f;

  /* Borders & shadows — shifted toward banner steel */
  --border:         #334b75;
  --border-strong:  #4e74b0;
  --ring:           rgba(125, 191, 242, 0.35);
  --shadow-sm:      0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md:      0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg:      0 12px 40px rgba(0, 0, 0, 0.5);

  /* Link colors (legacy main.css override targets) */
  --link:           #e8b563;
  --link-visited:   #e8b563;
  --link-hover:     #f2c57a;

  /* Typography */
  --font-display:   'Fraunces', Georgia, serif;
  --font-body:      Arial, Helvetica, sans-serif;
  --font-mono:      'IBM Plex Mono', ui-monospace, 'SF Mono', Consolas, monospace;

  /* Radii */
  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      16px;
  --radius-pill:    999px;

  /* Motion */
  --ease:           cubic-bezier(.2, .7, .3, 1);
  --dur-fast:       120ms;
  --dur-base:       220ms;
}

/* =========================================================
   EVENTS FEED (f_com_empire, cm=4)
   ---------------------------------------------------------
   Nebula/Daylight: modernized event feed with unified toolbar,
   card-like rows on narrow screens, and compact pagination.
   ========================================================= */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-page {
  max-width: 980px;
  width: 100%;
  margin: 0 auto 12px;
  padding: 0 2px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-sizing: border-box;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-page__title {
  margin: 4px 0 0;
  color: var(--text-primary);
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 10px;
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-page__title img {
  margin-left: 6px;
  vertical-align: -2px;
  opacity: 0.88;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-filter {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 0 0 2px;
  flex-wrap: wrap;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-filter__label {
  color: var(--text-muted);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 10px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-filter__select {
  min-height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  padding: 4px 8px;
  font-family: var(--font-body);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-panel {
  width: 100%;
  box-sizing: border-box;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table {
  width: 100%;
  margin: 0;
  table-layout: fixed;
  border-collapse: collapse;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__row {
  border-bottom: 1px solid var(--border);
  transition: background var(--dur-fast) var(--ease);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__row:last-child {
  border-bottom: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__row:hover {
  background: var(--bg-elevated);
}

/* main.css sets a global `th, td { border: 1px solid black }`. The events table used to
   cancel it by carrying the legacy `Default` class; it no longer does, so reset it here.
   The row separator lives on .gc-events-table__row, and mobile re-adds a divider under
   the time cell — neither is affected by zeroing the cell borders. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__time,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__body {
  border: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__time {
  width: 30%;
  min-width: 120px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  vertical-align: top;
  padding: 10px 12px !important;
  padding-right: 12px !important;
}


body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__time .gc-events-table__date {
  display: block;
  color: var(--text-secondary);
  text-transform: none;
  font-size: 9px;
  letter-spacing: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__body {
  min-width: 0;
  color: var(--text-primary);
  line-height: 1.42;
  font-size: 13px;
  vertical-align: top;
  padding: 10px 12px !important;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Time column must stay table-cell; flex lives on .gc-events-table__time-inner (see
   desktop non-battle rules) so table-layout:fixed 30%|70% applies to all row types. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__time-inner {
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__body-inner {
  display: block;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__tools {
  display: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__content {
  padding-right: 0;
  overflow-x: auto;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__empty {
  text-align: center;
  color: var(--text-muted);
  padding: 14px 12px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-right: 0;
  margin-top: -1px;
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-pagination__spacer {
  color: var(--text-muted);
}


/* =========================================================
   COMPACT EVENT ROW (Nebula / Daylight — modern div layout)
   ========================================================= */

/* Block container — rows stack naturally; no flex needed here */
.gc-event-list {
  display: flex;
  flex-direction: column;
  width: 100%;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-row {
  display: flex;
  align-items: flex-start;
  flex: 0 0 auto;
  gap: 10px;
  padding: 7px 12px;
  width: 100%;
  box-sizing: border-box;
  clear: both;
  border-bottom: 1px solid var(--border);
  transition: background var(--dur-fast) var(--ease);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-row:last-child {
  border-bottom: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-row:hover {
  background: var(--bg-elevated);
}

/* Event body: fills remaining width, allows battle tables to expand */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-body {
  display: flow-root;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.45;
  overflow-x: auto;
}

/* Compact meta block: timestamp + copy button, pinned to top-right */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-meta {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 5px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-time {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  line-height: 1.35;
  white-space: nowrap;
  padding-top: 2px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-date {
  display: block;
  font-size: 9px;
  opacity: 0.7;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 28px;
  min-height: 28px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  line-height: 1;
  opacity: 1;
  flex-shrink: 0;
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-copy-btn span {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Time-cell variant (e.g. compact .gc-event-row). Empire events .gc-events-table
   overrides on min-width:641px to keep copy+time+date on one line. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-copy-btn--time {
  display: flex;
  width: fit-content;
  margin-bottom: 4px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-row:hover .gc-event-copy-btn {
  opacity: 1;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-copy-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-copy-btn.gc-copied {
  color: var(--accent-good);
  opacity: 1;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__row:hover .gc-event-copy-btn {
  opacity: 1;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 14px 12px;
  margin: 0;
}

/* Battle-report tables embedded in event rows.
   Desktop keeps them comfortably capped; mobile restores full width. */
.gc-events-table__body table,
.gc-event-body table {
  width: auto;
  max-width: 100%;
  float: none !important;
  box-sizing: border-box;
  clear: both;
  display: table;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Nebula/Daylight: battle table header rows */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__body .Header td,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__body .Header th,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-body .Header td,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-body .Header th {
  background: var(--bg-elevated);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  padding: 5px 6px;
  border-bottom: 1px solid var(--border-strong);
}

/* Fleet-name section rows */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__body table.gc-battle-table tr > td[colspan],
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-body table.gc-battle-table tr > td[colspan] {
  background: var(--bg-base);
  color: var(--text-secondary);
  font-size: 11px;
  letter-spacing: 0.05em;
  padding: 4px 6px 2px;
  border-top: 1px solid var(--border);
}

/* Data rows in battle tables */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__body table.gc-battle-table td,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-body table.gc-battle-table td {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 3px 6px;
}

/* Override any inline width on all Default tables inside event content (covers legacy stored events) */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__content table.Default,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-body table.Default {
  width: 100% !important;
  max-width: 700px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__body table.gc-battle-table,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-body table.gc-battle-table {
  width: 100% !important;
  max-width: 700px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__body table.gc-battle-colonies,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-body table.gc-battle-colonies {
  width: 100% !important;
  max-width: 700px;
}

/* Colonies table: top gap from fleet table */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__body table.gc-battle-colonies,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-body table.gc-battle-colonies {
  margin-top: 6px !important;
}

/* =========================================================
   EMPIRE EVENTS TABLE (cm=4) — Nebula / Daylight
   ---------------------------------------------------------
   One breakpoint: >=768px renders a real 2-column table,
   <768px stacks. Rows containing a <table> (battle reports)
   are detected structurally via :has(table) so the layout
   never depends on a server-emitted class.
   ========================================================= */
/* Empire events (cm=4), desktop: compact meta *only* for non-battle rows (filter views).
   Battle rows keep the default stacked copy / time / date in the 30% column. */
@media (min-width: 768px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__row:not(:has(table)) .gc-events-table__time-inner {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0 6px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__row:not(:has(table)) .gc-events-table__time .gc-events-table__date {
    display: inline;
    margin-top: 0;
    white-space: nowrap;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__row:not(:has(table)) .gc-events-table__time .gc-event-copy-btn--time {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    width: auto;
    margin-bottom: 0;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__row:not(:has(table)) .gc-events-table__time .gc-events-table__time-text {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__row:not(:has(table)) .gc-events-table__time,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__row:not(:has(table)) .gc-events-table__body {
    padding-top: 5px !important;
    padding-bottom: 5px !important;
  }

  /* Centre both columns against each other (base sets vertical-align: top).
     Battle rows stay top-aligned so their report tables start at the row's top edge. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__row:not(:has(table)) .gc-events-table__time,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__row:not(:has(table)) .gc-events-table__body {
    vertical-align: middle;
  }

  /* ---- Battle rows: keep a real table layout (2 columns). Stops odd first-paint / cache
     cases where block-level rules leave time stacked above or tables shoved to one side. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table {
    display: table !important;
    table-layout: fixed !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__row {
    display: table-row !important;
  }

  /* Stored attack events wrap markup in <div align="center"> — that centers block tables
     in the 70% column and makes fleet/colonies + inline 50% look “empty left / pinched right.” */
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__body:has(table) .gc-events-table__content {
    text-align: start;
  }

  /* The wrapper holds two things: the one-line battle summary ("You attacked X.
     Attack has failed !") and the report table. The summary is loose inline text
     with no element of its own, so the only way to centre it is via the wrapper. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__body:has(table) .gc-events-table__content div[align="center"] {
    text-align: center !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  /* ...and pull the table back out of that centring. text-align inherits into
     cells, and the fleet-name section rows (<td colspan=4>) carry no align
     attribute of their own, so without this they'd centre along with the summary. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__body:has(table) .gc-events-table__content div[align="center"] > table {
    text-align: start;
  }

  /* In the feed, let battle tables use the full body column (700px cap reads as a narrow band) */
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__body:has(table) .gc-events-table__content table.Default,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__body:has(table) .gc-events-table__content table.gc-battle-table,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__body:has(table) .gc-events-table__content table.gc-battle-colonies {
    max-width: 100% !important;
  }
}

@media (max-width: 767.98px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-page {
    margin: 0 0 10px;
    padding: 0;
    gap: 6px;
    max-width: none;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-page__title {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-filter {
    justify-content: space-between;
    margin-bottom: 4px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-filter__label {
    display: none;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table tbody,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__row,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__time,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__body {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__row {
    padding: 3px 6px;
    position: relative;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__time {
    min-width: 0;
    padding: 0 0 2px !important;
    border-bottom: 1px solid var(--border);
    display: block;
  }

  /* Default (battle rows): copy, time and date share one full-width line above the body,
     centred over the report table below it. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__time-inner {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0 6px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__time .gc-event-copy-btn--time {
    display: inline-flex;
    width: auto;
    margin-bottom: 0;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__time-text {
    white-space: nowrap;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__time .gc-events-table__date {
    margin-top: 0;
    white-space: nowrap;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__body {
    font-size: 12px;
    padding: 4px 0 0 !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-copy-btn {
    opacity: 1;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__time {
    padding-right: 0 !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__body-inner,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__content {
    width: 100%;
    box-sizing: border-box;
    padding-right: 0;
    overflow-x: auto;
  }

  /* Empire events (cm=4), mobile: regular (non-battle) rows render as a compact
     2-column row — a time column that sizes to its own content (copy button beside the
     time, date stacked under it) and the event text taking the remaining width.
     Battle rows keep the stacked full-width layout, so their report tables get the
     whole viewport instead of scrolling behind a time column. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__row:not(:has(table)) {
    display: flex;
    flex-wrap: nowrap;
    /* Centre the time column and the event text against each other, whichever is taller. */
    align-items: center;
    gap: 10px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__row:not(:has(table)) .gc-events-table__time {
    display: block;
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
    padding: 0 !important;
    border-bottom: 0;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__row:not(:has(table)) .gc-events-table__time-inner {
    display: grid;
    grid-template-columns: auto auto;
    grid-template-areas:
      "copy time"
      "copy date";
    align-items: center;
    justify-content: start;
    column-gap: 4px;
    row-gap: 0;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__row:not(:has(table)) .gc-event-copy-btn--time {
    grid-area: copy;
    align-self: center;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__row:not(:has(table)) .gc-events-table__time-text {
    grid-area: time;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__row:not(:has(table)) .gc-events-table__date {
    grid-area: date;
    margin-top: 1px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__row:not(:has(table)) .gc-events-table__body {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    padding: 0 !important;
  }

  /* Legacy event HTML often inlines width/padding on table.Default (e.g. Colonies
     Captured) without gc-battle-colonies — mirror desktop !important fixes here. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__content table.Default,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-body table.Default {
    display: table !important;
    width: 100% !important;
    max-width: none !important;
    table-layout: auto !important;
    box-sizing: border-box;
    /* Beat stored inline % padding that wastes horizontal space on narrow viewports */
    padding-left: 4px !important;
    padding-right: 4px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__body table.gc-battle-table,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-body table.gc-battle-table {
    width: 100% !important;
    max-width: none;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__body table.gc-battle-colonies,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-body table.gc-battle-colonies {
    display: table;
    width: 100% !important;
    max-width: none;
    table-layout: auto !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__body table.gc-battle-colonies tbody,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-body table.gc-battle-colonies tbody,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__content table.Default tbody,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-body table.Default tbody {
    display: table-row-group;
    width: 100%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__body table.gc-battle-colonies tr,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-body table.gc-battle-colonies tr,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__content table.Default tr,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-body table.Default tr {
    display: table-row;
    width: 100%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__body table.gc-battle-colonies tr > td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-body table.gc-battle-colonies tr > td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__content table.Default tr > td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-body table.Default tr > td {
    display: table-cell;
    width: auto !important;
  }

  /* Let headers wrap on mobile. Keeping them nowrap ("CASUALTIES", "REMAINING") sets the
     table's min-content width above a phone viewport, which is what forces the battle
     report into a horizontal scroller no matter how much width the row gives it. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__body table.gc-battle-table .Header td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-body table.gc-battle-table .Header td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__body table.gc-battle-colonies .Header td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-body table.gc-battle-colonies .Header td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__content table.Default .Header td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-body table.Default .Header td {
    white-space: normal;
    overflow-wrap: break-word;
    padding-left: 3px;
    padding-right: 3px;
  }

  /* Numeric cells are wrapped in &nbsp; in the stored markup, so they can't wrap anyway;
     trim their padding to buy the name column room. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-table__body table.gc-battle-table td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-event-body table.gc-battle-table td {
    padding-left: 3px;
    padding-right: 3px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-events-pagination {
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
  }
}

/* Classic: battle tables fill the event body cell (all screen sizes) */
body[data-theme="classic"] .gc-event-body table {
  width: 100% !important;
  max-width: 100%;
  box-sizing: border-box;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Classic: mobile — stack timestamp above event body */
@media (max-width: 767.98px) {
  body[data-theme="classic"] table.gc-events-classic > tbody > tr {
    display: block;
    width: 100%;
  }

  body[data-theme="classic"] table.gc-events-classic > tbody > tr > td {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }

  body[data-theme="classic"] table.gc-events-classic > tbody > tr > td.gc-event-time {
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  /* Nested battle/Colonies tables: stored inline width/padding (same as nebula fixes above) */
  body[data-theme="classic"] .gc-event-body table.Default {
    display: table !important;
    width: 100% !important;
    max-width: 100% !important;
    table-layout: auto !important;
    box-sizing: border-box;
    padding-left: 4px !important;
    padding-right: 4px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  body[data-theme="classic"] .gc-event-body table.Default tbody {
    display: table-row-group !important;
    width: 100%;
  }

  body[data-theme="classic"] .gc-event-body table.Default tr {
    display: table-row !important;
    width: 100%;
  }

  body[data-theme="classic"] .gc-event-body table.Default tr > td {
    display: table-cell !important;
    width: auto !important;
  }

  body[data-theme="classic"] .gc-event-body table.Default .Header td {
    white-space: nowrap;
  }
}


/* ---------- Classic (preserves legacy look) ---------- */
body[data-theme="classic"] {
  --bg-base:        #000000;
  --bg-surface:     rgba(0, 0, 0, 0.99);
  --bg-surface-alt: #101014;
  --bg-elevated:    #141418;
  --bg-overlay:     rgba(18, 18, 24, 0.96);

  --text-primary:   #e0ddd7;
  --text-secondary: #b0b0b0;
  --text-muted:     #8a8a8a;
  --text-inverse:   #ffffff;

  --accent:         #b41837;       /* legacy crimson */
  --accent-hover:   #d4324f;
  --accent-hot:     #b41837;
  --accent-cool:    #9edcfe;
  --accent-good:    #117A65;
  --accent-gold:    gold;

  --stat-cash:      #117A65;
  --stat-food:      #e8b563;
  --stat-power:     #9edcfe;
  --stat-turns:     gold;

  --border:         #2a2a36;
  --border-strong:  #3f5f6f;
  --ring:           rgba(180, 24, 55, 0.4);
  --shadow-sm:      0 1px 2px rgba(0, 0, 0, 0.6);
  --shadow-md:      0 4px 12px rgba(0, 0, 0, 0.7);
  --shadow-lg:      0 12px 40px rgba(0, 0, 0, 0.8);

  --link:           #9edcfe;
  --link-visited:   #9edcfe;
  --link-hover:     #008a8a;

  --font-display:   Arial, Helvetica, sans-serif;
  --font-body:      Arial, Helvetica, sans-serif;
  --font-mono:      ui-monospace, Consolas, monospace;
}


/* ---------- Daylight (high-contrast light) ---------- */
body[data-theme="daylight"] {
  --bg-base:        #e7dfcb;
  --bg-surface:     #ffffff;
  --bg-surface-alt: #f5f3ed;
  --bg-elevated:    #fafaf7;
  --bg-overlay:     rgba(255, 255, 255, 0.96);

  --text-primary:   #1a1f2e;
  --text-secondary: #4a5068;
  --text-muted:     #7a8196;
  --text-inverse:   #ffffff;

  --accent:         #1e3a8a;       /* deep indigo */
  --accent-hover:   #2a4ba0;
  --accent-hot:     #b91c1c;
  --accent-cool:    #0f766e;
  --accent-good:    #15803d;
  --accent-gold:    #a16207;
  --accent-nebula:  #8f5b35;       /* warm bronze — section labels, dividers */

  --stat-cash:      #15803d;
  --stat-food:      #a16207;
  --stat-power:     #0369a1;
  --stat-turns:     #7c2d12;

  --border:         #d4d0c7;
  --border-strong:  #a9a499;
  --ring:           rgba(30, 58, 138, 0.25);
  --shadow-sm:      0 1px 2px rgba(26, 31, 46, 0.08);
  --shadow-md:      0 4px 16px rgba(26, 31, 46, 0.10);
  --shadow-lg:      0 12px 40px rgba(26, 31, 46, 0.15);

  --link:           #1e3a8a;
  --link-visited:   #5b21b6;
  --link-hover:     #2a4ba0;

  --font-body:      Arial, Helvetica, sans-serif;
}


/* ------------------------------------------------------------------ */
/*  Base body / typography — uses tokens                              */
/*  Loaded after main.css so these override legacy Arial + bg-image.  */
/*  Classic theme intentionally keeps legacy look (see overrides).    */
/* ------------------------------------------------------------------ */

body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-primary);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Preserve the legacy starfield background only on Classic theme. */
body[data-theme="classic"] {
  background-image: url(i/TestBG22.jpg);
  background-size: cover;
  background-attachment: fixed;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  line-height: 18px;
  color: lightgrey;
}

/* =========================================================
   LEGACY CONTENT TABLES (Nebula / Daylight mobile)
   ---------------------------------------------------------
   Many in-game pages still render fixed-width table.Default
   markup. On narrow screens, normalize those tables inside
   the main content column so they fill the viewport and wrap
   instead of pushing content off-screen.
   display:block is only for scrollable wrappers — real data tables
   (e.g. .gc-fed-war-table, .gc-fed-member-table, .gc-fed-list) must stay
   display:table or they collapse to content width inside the content column.

   CONTRACT: this is opt-OUT by design. Any table that styles its own layout
   must add its class to the :not() chain below, or these declarations will
   silently override it — that is how .gc-events-table ended up as a horizontal
   scroller. It cannot be flipped to an opt-in class: legacy battle reports are
   stored as raw <table class="Default"> HTML in the event.name DB column, and
   markup already in the database can never be re-tagged.
   ========================================================= */
@media (max-width: 640px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .col-lg-8 table.Default:not(.gc-events-table):not(.gc-battle-table):not(.gc-battle-colonies):not(.gc-events-classic):not(.gc-fed-war-table):not(.gc-fed-member-table):not(.gc-fed-list):not(.gc-market-detail-table--available-modern):not(.gc-explore-table):not(.gc-rtree-table):not(.gc-rtreed-table):not(.gc-restree-table):not(.gc-artifacts-table):not(.gc-linkbtn-table):not(.gc-battle-prev-table):not(.gc-cart-products-table):not(.gc-ship-aux-table):not(.gc-pm__list):not(.gc-colony-build-result-table):not(.gc-intel-mobile-table) {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 99% !important;
    max-width: 99% !important;
    table-layout: auto;
    margin: 0 auto !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .col-lg-8 table.Default:not(.gc-events-table):not(.gc-battle-table):not(.gc-battle-colonies):not(.gc-events-classic):not(.gc-fed-war-table):not(.gc-fed-member-table):not(.gc-fed-list):not(.gc-market-detail-table--available-modern):not(.gc-explore-table):not(.gc-rtree-table):not(.gc-rtreed-table):not(.gc-restree-table):not(.gc-artifacts-table):not(.gc-linkbtn-table):not(.gc-battle-prev-table):not(.gc-cart-products-table):not(.gc-ship-aux-table):not(.gc-pm__list):not(.gc-colony-build-result-table):not(.gc-intel-mobile-table) td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .col-lg-8 table.Default:not(.gc-events-table):not(.gc-battle-table):not(.gc-battle-colonies):not(.gc-events-classic):not(.gc-fed-war-table):not(.gc-fed-member-table):not(.gc-fed-list):not(.gc-market-detail-table--available-modern):not(.gc-explore-table):not(.gc-rtree-table):not(.gc-rtreed-table):not(.gc-restree-table):not(.gc-artifacts-table):not(.gc-linkbtn-table):not(.gc-battle-prev-table):not(.gc-cart-products-table):not(.gc-ship-aux-table):not(.gc-pm__list):not(.gc-colony-build-result-table):not(.gc-intel-mobile-table) th {
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
  }

  /* Link-button tables stretch full-width on mobile so their single
     centered cell reads as a proper tap target. Desktop keeps content width. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-linkbtn-table {
    width: 100% !important;
  }

  /* Cart row's Bootstrap default -15px side margins overflow the
     mobile content column (only 6px margin); force flush. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-cart-row {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-cart-row > [class^="col-"] {
    padding-left: 4px !important;
    padding-right: 4px !important;
  }

  /* Cart products table has 6 columns on desktop; mobile uses a 2-col
     variant. Tighten cells/inputs/buttons so everything fits viewport. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) .col-lg-8 .mobileShow > table.Default.gc-cart-products-table,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .col-lg-8 .mobileShow table.Default.gc-cart-products-table,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-cart-products-table {
    width: calc(100% - 12px) !important;
    max-width: calc(100% - 12px) !important;
    margin: 1% auto !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-md, 6px);
    box-shadow: var(--shadow-sm);
    box-sizing: border-box;
    font-size: 0.85em;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-cart-products-table--mobile {
    table-layout: fixed;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-cart-products-table--mobile > tbody > tr > td:first-child,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-cart-products-table--mobile > tr > td:first-child {
    width: 45%;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-cart-products-table--mobile > tbody > tr > td:last-child,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-cart-products-table--mobile > tr > td:last-child {
    width: 55%;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-cart-products-table td {
    padding: 4px 4px !important;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-cart-products-table .sc-product-item {
    white-space: nowrap;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-cart-products-table .sc-cart-item-qty {
    width: 46px;
    max-width: 46px;
    padding: 2px 0 2px 4px;
    box-sizing: border-box;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-cart-products-table .sc-add-to-cart {
    padding: 2px 8px;
    font-size: 0.85em;
  }
}

/* Cart layout needs to hold across the full mobile layout range
   (.mobileShow activates at <=767.98px, not just <=640px). */
@media (max-width: 767.98px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-cart-row {
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-cart-row > [class^="col-"] {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .col-lg-8 .mobileShow > table.Default.gc-cart-products-table,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .col-lg-8 .mobileShow table.Default.gc-cart-products-table {
    display: block;
    width: calc(100% - 24px) !important;
    max-width: calc(100% - 24px) !important;
    margin: 6px 12px !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-md, 6px);
    box-shadow: var(--shadow-sm);
    box-sizing: border-box;
  }
}

/* =========================================================
   RESEARCH PAGE (Nebula / Daylight) — desktop + mobile shared
   ========================================================= */
/* Header cells should be centered and the currently-researching row
   carries a dynamic tech name, so it stays in normal case. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-research-page .gc-research-status .Header td,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-research-page .gc-research-infra .Header td,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-research-page .gc-research-tree .Header td {
  text-align: center !important;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-research-page .gc-research-status .Header td,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-ship-detail-table .Header td {
  text-transform: none !important;
}

/* Ship detail page uses .kv which force-uppercases all label cells;
   keep these in natural case so abilities/weapon names read cleanly. */
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.kv.gc-ship-detail-table tbody td:first-child,
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.kv.gc-ship-detail-table td:first-child {
  text-transform: none !important;
  font-family: inherit;
  font-size: inherit;
  letter-spacing: normal;
  color: inherit;
}

/* Ship build interruption alert. Both desktop and mobile render this inside
   existing ship containers, so keep the component self-centering and fluid. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-alert {
  position: relative;
  width: min(100%, 44rem);
  margin: 0.65rem auto 0.9rem;
  padding: 1rem 1.15rem 1.05rem;
  box-sizing: border-box;
  overflow: hidden;
  text-align: center;
  border: 1px solid color-mix(in srgb, var(--accent-hot) 52%, var(--border));
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--accent-hot) 14%, transparent) 0%,
      transparent 48%),
    var(--bg-surface);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 14px 36px color-mix(in srgb, var(--accent-hot) 16%, transparent);
  color: var(--text-primary);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-builder-message:has(.gc-attack-alert) {
  max-width: none;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-alert::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent-hot), var(--accent), transparent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-alert__eyebrow {
  margin-bottom: 0.25rem;
  color: var(--accent-hot);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-alert__title {
  margin-bottom: 0.35rem;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.4vw, 1.9rem);
  font-weight: 600;
  line-height: 1.1;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-alert p {
  margin: 0.25rem auto;
  max-width: 32rem;
  color: var(--text-secondary);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-alert__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  margin: 0.55rem auto 0.35rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid color-mix(in srgb, var(--accent-hot) 64%, var(--border));
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--accent-hot) 18%, var(--bg-elevated));
  color: var(--text-primary) !important;
  font-weight: 600;
  text-decoration: none !important;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-alert__action:hover {
  border-color: var(--accent-hot);
  background: color-mix(in srgb, var(--accent-hot) 28%, var(--bg-elevated));
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-alert__note {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.03em;
}

body[data-theme="classic"] .gc-attack-alert {
  width: 30%;
  min-width: 250px;
  margin: 0.65rem auto;
  padding: 0.75rem;
  text-align: center;
  border: 1px solid red;
}

body[data-theme="classic"] .gc-attack-alert__eyebrow,
body[data-theme="classic"] .gc-attack-alert__note {
  display: none;
}

body[data-theme="classic"] .gc-attack-alert__title {
  color: red;
  font-weight: bold;
}

/* =========================================================
   RESEARCH PAGE (Nebula / Daylight mobile)
   ========================================================= */
@media (max-width: 640px) {
  body[data-theme="nebula"] .gc-research-page,
  body[data-theme="classic"] .gc-research-page,
  body[data-theme="daylight"] .gc-research-page {
    box-sizing: border-box;
  }

  body[data-theme="nebula"] .gc-research-page .row,
  body[data-theme="classic"] .gc-research-page .row,
  body[data-theme="daylight"] .gc-research-page .row {
    margin-left: 0;
    margin-right: 0;
  }

  body[data-theme="nebula"] .gc-research-page .gc-research-status,
  body[data-theme="classic"] .gc-research-page .gc-research-status,
  body[data-theme="nebula"] .gc-research-page .gc-research-infra,
  body[data-theme="classic"] .gc-research-page .gc-research-infra,
  body[data-theme="nebula"] .gc-research-page .gc-research-tree,
  body[data-theme="classic"] .gc-research-page .gc-research-tree,
  body[data-theme="daylight"] .gc-research-page .gc-research-status,
  body[data-theme="daylight"] .gc-research-page .gc-research-infra,
  body[data-theme="daylight"] .gc-research-page .gc-research-tree {
    display: table !important;
    overflow-x: visible;
    width: 100% !important;
    max-width: 100% !important;
    table-layout: auto;
    box-sizing: border-box;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  body[data-theme="nebula"] .gc-research-page .gc-research-status td,
  body[data-theme="nebula"] .gc-research-page .gc-research-infra td,
  body[data-theme="nebula"] .gc-research-page .gc-research-tree td,
  body[data-theme="classic"] .gc-research-page .gc-research-status td,
  body[data-theme="classic"] .gc-research-page .gc-research-infra td,
  body[data-theme="classic"] .gc-research-page .gc-research-tree td,
  body[data-theme="daylight"] .gc-research-page .gc-research-status td,
  body[data-theme="daylight"] .gc-research-page .gc-research-infra td,
  body[data-theme="daylight"] .gc-research-page .gc-research-tree td {
    padding-left: 6px;
    padding-right: 6px;
  }

  body[data-theme="nebula"] .gc-research-page .gc-research-status .Header td,
  body[data-theme="nebula"] .gc-research-page .gc-research-infra .Header td,
  body[data-theme="nebula"] .gc-research-page .gc-research-tree .Header td,
  body[data-theme="classic"] .gc-research-page .gc-research-status .Header td,
  body[data-theme="classic"] .gc-research-page .gc-research-infra .Header td,
  body[data-theme="classic"] .gc-research-page .gc-research-tree .Header td,
  body[data-theme="daylight"] .gc-research-page .gc-research-status .Header td,
  body[data-theme="daylight"] .gc-research-page .gc-research-infra .Header td,
  body[data-theme="daylight"] .gc-research-page .gc-research-tree .Header td {
    font-size: 10px;
    letter-spacing: 0.1em;
    text-align: center !important;
  }

  /* Currently-researching header carries a dynamic tech name (e.g. "Agriculture")
     — don't shout it. Keep normal case for this row only. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-research-page .gc-research-status .Header td {
    text-transform: none !important;
  }

  body[data-theme="nebula"] .gc-research-page .gc-research-status__label,
  body[data-theme="classic"] .gc-research-page .gc-research-status__label,
  body[data-theme="daylight"] .gc-research-page .gc-research-status__label {
    width: 58% !important;
    white-space: nowrap;
  }

  body[data-theme="nebula"] .gc-research-page .gc-research-infra__level,
  body[data-theme="classic"] .gc-research-page .gc-research-infra__level,
  body[data-theme="daylight"] .gc-research-page .gc-research-infra__level {
    width: 32%;
    min-width: 72px;
    font-size: 12px;
    white-space: nowrap;
  }

  body[data-theme="nebula"] .gc-research-page .gc-research-tree td,
  body[data-theme="classic"] .gc-research-page .gc-research-tree td,
  body[data-theme="daylight"] .gc-research-page .gc-research-tree td {
    font-size: 12px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-research-page .gc-research-detail {
    display: table !important;
    overflow-x: visible;
    width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}

/* =========================================================
   LEGACY MOBILE TABLE/FORM NORMALIZATION (Nebula / Daylight)
   ---------------------------------------------------------
   Many pages still use mobileShow + inline-width Default tables.
   Normalize those cards and two-column form layouts so they fill
   the content column on mobile without requiring per-page fixes.
   ========================================================= */
@media (max-width: 767.98px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .mobileShow table.Default {
    display: table !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .mobileShow table.Default thead {
    display: table-header-group !important;
    width: 100%;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .mobileShow table.Default tbody {
    display: table-row-group !important;
    width: 100%;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .mobileShow table.Default tr {
    display: table-row !important;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .mobileShow table.Default td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .mobileShow table.Default th {
    display: table-cell !important;
    box-sizing: border-box;
    min-width: 0;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .col-lg-8 .mobileShow > table.Default.gc-fed-list-lite-mobile {
    width: calc(100% - 8px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-list-lite-mobile-wrap {
    width: 100%;
    padding-left: 4px;
    padding-right: 4px;
    box-sizing: border-box;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-list-lite-mobile-wrap > table.Default.gc-fed-list-lite-mobile {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    table-layout: fixed;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-list-lite-mobile > tbody > tr > td:nth-child(1),
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-list-lite-mobile > tr > td:nth-child(1) {
    width: 44%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-list-lite-mobile > tbody > tr > td:nth-child(2),
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-list-lite-mobile > tr > td:nth-child(2) {
    width: 12%;
    text-align: center;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-list-lite-mobile > tbody > tr > td:nth-child(3),
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-list-lite-mobile > tr > td:nth-child(3) {
    width: 44%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .col-lg-8 .mobileShow form > table.Default {
    table-layout: fixed;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .col-lg-8 .mobileShow form > table.Default tr > td:first-child {
    width: 34%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .col-lg-8 .mobileShow form > table.Default tr > td:last-child {
    width: 66%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .col-lg-8 .mobileShow form > table.Default td {
    padding-left: 8px;
    padding-right: 8px;
    box-sizing: border-box;
    overflow-wrap: break-word;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .col-lg-8 .mobileShow form > table.Default td[nowrap] {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: normal;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .col-lg-8 .mobileShow form > table.Default td[nowrap] select {
    flex: 0 0 auto;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .col-lg-8 .mobileShow form > table.Default td[nowrap] input[type="text"] {
    flex: 1 1 auto;
    min-width: 0;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .col-lg-8 .mobileShow form > table.Default input[type="text"],
  body:is([data-theme="nebula"], [data-theme="daylight"]) .col-lg-8 .mobileShow form > table.Default input[type="number"],
  body:is([data-theme="nebula"], [data-theme="daylight"]) .col-lg-8 .mobileShow form > table.Default select {
    max-width: 100%;
    box-sizing: border-box;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .col-lg-8 .mobileShow form > table.Default input[type="submit"],
  body:is([data-theme="nebula"], [data-theme="daylight"]) .col-lg-8 .mobileShow form > table.Default input[type="button"] {
    min-width: 96px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-detail-page .gc-market-detail-table tr > td:first-child {
    width: 34%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-detail-page .gc-market-detail-table tr > td:last-child {
    width: 66%;
  }

  /* Available-for-purchase (modern) is a data grid, not a label/control form —
     opt it out of the 34%/66% form-table rule so it fills the panel. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-detail-page .gc-market-detail-table--available-modern tr > td:first-child,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-detail-page .gc-market-detail-table--available-modern tr > td:last-child {
    width: 50%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-detail-page .gc-market-detail-table .gc-market-detail-cell {
    width: 66%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-detail-page .gc-market-detail-table td[nowrap] {
    width: 66%;
    white-space: normal;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-detail-page .gc-market-detail-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-detail-page .gc-market-detail-controls select {
    flex: 0 0 auto;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-detail-page .gc-market-detail-controls input[type="text"] {
    flex: 1 1 auto;
    width: 100% !important;
    min-width: 0;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-detail-page .gc-market-detail-table td:not([nowrap]) > input[type="text"] {
    width: 100% !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-detail-page .gc-market-detail-help {
    display: block;
    width: 100%;
    margin-top: 4px;
    color: var(--text-muted);
    text-align: left;
    line-height: 1.3;
  }
}

/* =========================================================
   MARKET PAGE (Nebula / Daylight)
   ========================================================= */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-detail-modern {
  max-width: 980px;
  margin: 0 auto;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-detail-modern__back,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-detail-modern__summary,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-panel {
  border: 1px solid var(--border);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-detail-modern__back {
  margin-top: 8px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-detail-modern__backlink {
  display: block;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-detail-modern__summary {
  margin-top: 10px;
  padding: 10px 12px;
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-detail-modern__summary-title,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-panel__title {
  margin: 0;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-detail-modern__summary-copy {
  margin-top: 8px;
  color: var(--text-secondary);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-detail-modern-form {
  margin-top: 10px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-detail-modern-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-panel {
  padding: 10px 12px 12px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-field {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-field:first-of-type {
  margin-top: 10px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-field__label {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: right;
  padding-top: 8px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-field__value {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  font-weight: 600;
  color: var(--text-primary);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-field__muted,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-panel__disabled {
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-field__control {
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-field__control--inline {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-field__control input[type="text"],
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-field__control select {
  min-height: 40px;
  box-sizing: border-box;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-field__control input[type="text"] {
  width: 100%;
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-field__control--inline select {
  flex: 0 0 64px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-field__control--inline input[type="text"] {
  flex: 1 1 auto;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-field__hint {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-panel__actions {
  padding-top: 10px;
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-panel__actions input[type="submit"] {
  min-width: 112px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-panel--available {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 10px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-detail-table--available-modern {
  width: 100% !important;
  max-width: 100% !important;
  margin-top: 10px !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  table-layout: fixed;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-detail-table--available-modern > tbody > tr > td,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-detail-table--available-modern > tr > td {
  width: 50%;
}

@media (min-width: 700px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-detail-modern-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-field {
    grid-template-columns: 80px minmax(0, 1fr);
    gap: 8px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-field__label {
    font-size: 10px;
  }
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-page {
  max-width: 980px;
  margin: 0 auto;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-num-abbrev,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-hdr-mobile {
  display: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-grid {
  max-width: 820px;
  margin: 14px auto 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-col {
  padding-left: 6px;
  padding-right: 6px;
  box-sizing: border-box;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-table {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  table-layout: fixed;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-table--goods td:nth-child(1) {
  width: 42%;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-table--goods td:nth-child(2) {
  width: 18%;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-table--goods td:nth-child(3) {
  width: 40%;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-combined-wrap {
  max-width: 900px;
  margin: 14px auto 0;
}

body[data-theme="classic"] .gc-market-combined-wrap {
  max-width: 620px;
  margin: 14px auto 0;
}

body[data-theme="classic"] .gc-market-num-abbrev,
body[data-theme="classic"] .gc-market-hdr-mobile {
  display: none;
}

@media (max-width: 767.98px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .mobileShow > table.Default.gc-market-use-form-table {
    display: table !important;
    clear: both;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box;
    table-layout: fixed;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .mobileShow > table.Default.gc-market-use-form-table tr > td:first-child {
    width: 38%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .mobileShow > table.Default.gc-market-use-form-table tr > td:last-child {
    width: 62%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .mobileShow > table.Default.gc-market-use-form-table input[type="text"] {
    width: 100%;
    box-sizing: border-box;
  }
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-table--combined td:nth-child(1) {
  width: 31%;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-table--combined td:nth-child(2) {
  width: 17%;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-table--combined td:nth-child(3) {
  width: 26%;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-table--combined td:nth-child(4) {
  width: 26%;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-table .Header td {
  height: 34px;
  vertical-align: middle;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-table tr:not(.Header) td {
  height: 30px;
  padding-top: 4px;
  padding-bottom: 4px;
  vertical-align: middle;
  white-space: nowrap;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-action,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-help-toggle,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-help {
  width: auto !important;
  max-width: 640px;
}

@media (min-width: 641px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-grid {
    display: flex;
    gap: 14px;
    align-items: start;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-pane--desktop {
    display: block;
    min-width: 0;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-pane--desktop.gc-market-pane--goods {
    flex: 1.35 1 0;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-pane--desktop.gc-market-pane--stores {
    flex: 0.62 1 0;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-pane--desktop .gc-market-col {
    width: 100%;
    max-width: 100%;
    float: none;
    flex: none;
    padding-left: 0;
    padding-right: 0;
  }
}

@media (max-width: 640px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 8px;
    margin-top: 12px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-pane--mobile {
    display: block;
    min-width: 0;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-col {
    width: 100%;
    max-width: 100%;
    flex: none;
    float: none;
    padding-left: 0;
    padding-right: 0;
    margin: 0 !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-col--goods {
    min-width: 0;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-col--stores {
    min-width: 0;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-table {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-table tr:not(.Header) td {
    height: 28px;
    font-size: 12px;
    line-height: 1.15;
    padding-left: 6px;
    padding-right: 6px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-table .Header td {
    padding-left: 6px;
    padding-right: 6px;
    font-size: 10px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-table--goods td:nth-child(1) {
    width: 34%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-table--goods td:nth-child(2) {
    width: 18%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-table--goods td:nth-child(3) {
    width: 48%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-combined-wrap {
    margin-top: 12px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-table--combined td:nth-child(1) {
    width: 29%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-table--combined td:nth-child(2) {
    width: 14%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-table--combined td:nth-child(3) {
    width: 27%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-table--combined td:nth-child(4) {
    width: 30%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-detail-page .gc-market-detail-table {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    table-layout: auto;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-detail-page .gc-market-detail-back {
    margin-left: 0;
    margin-right: 0;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-detail-page .gc-market-detail-table td {
    padding-left: 8px;
    padding-right: 8px;
    box-sizing: border-box;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-detail-page input[type="text"] {
    max-width: 100%;
    box-sizing: border-box;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-combined-wrap {
    padding-left: 8px;
    padding-right: 8px;
    box-sizing: border-box;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-market-table--combined {
    width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-market-table--combined td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-market-table--combined th {
    padding-left: 4px !important;
    padding-right: 4px !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-market-table--combined td:nth-child(1) {
    width: 33%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-market-table--combined td:nth-child(2) {
    width: 11%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-market-table--combined td:nth-child(3) {
    width: 24%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-market-table--combined td:nth-child(4) {
    width: 32%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-good-link {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-num-full,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-hdr-full {
    display: none;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-num-abbrev,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-market-hdr-mobile {
    display: inline;
  }
}

/* -------- Nebula body: lighter deep-space base + solar bloom + offset starfields --------
   Multiple star layers use different tile sizes/positions so the field reads as organic
   instead of a visible grid on mobile. The warm sun is intentionally faded and off-axis.
------------------------------------------------------------------------------------------- */
body[data-theme="nebula"] {
  background-color: var(--bg-base);
  background-image:
    /* 1 — faded sun + corona */
    radial-gradient(circle at 84% 12%, rgba(190, 164, 128, 0.11) 0, rgba(190, 164, 128, 0.045) 7%, rgba(190, 164, 128, 0.014) 14%, transparent 28%),
    radial-gradient(circle at 84% 12%, rgba(232, 221, 201, 0.03) 0, transparent 9%),
    /* 2 — upper atmosphere wash */
    radial-gradient(ellipse 130% 78% at 50% -16%, rgba(88, 104, 122, 0.03), transparent 56%),
    /* 3 — ionized teal cloud */
    radial-gradient(ellipse 72% 54% at 8% 24%, rgba(82, 112, 118, 0.018), transparent 70%),
    /* 4 — blue-black mid-space haze */
    radial-gradient(ellipse 68% 54% at 86% 70%, rgba(73, 92, 114, 0.04), transparent 72%),
    /* 5 — subtle neutral lift */
    radial-gradient(ellipse 52% 38% at 42% 48%, rgba(226, 232, 240, 0.016), transparent 74%),
    /* 6 — warm dust reflection */
    radial-gradient(ellipse 40% 30% at 74% 30%, rgba(190, 164, 128, 0.018), transparent 68%),
    /* 7 — milky dust lane */
    linear-gradient(121deg,
      transparent 0%,
      transparent 34%,
      rgba(255, 255, 255, 0.006) 45%,
      rgba(125, 140, 149, 0.008) 52%,
      rgba(78, 92, 110, 0.008) 58%,
      transparent 69%,
      transparent 100%),
    /* 8 — small sharp stars */
    radial-gradient(circle at 32px 46px, rgba(255, 248, 239, 0.96) 0 1px, transparent 1.65px),
    radial-gradient(circle at 168px 118px, rgba(120, 191, 197, 0.78) 0 0.95px, transparent 1.6px),
    radial-gradient(circle at 284px 84px, rgba(255, 226, 194, 0.72) 0 1px, transparent 1.7px),
    radial-gradient(circle at 412px 212px, rgba(188, 220, 235, 0.62) 0 0.9px, transparent 1.5px),
    radial-gradient(circle at 96px 236px, rgba(255, 252, 245, 0.8) 0 1px, transparent 1.6px),
    /* 9 — cool, dimmer stars */
    radial-gradient(circle at 74px 42px, rgba(83, 166, 162, 0.54) 0 0.85px, transparent 1.45px),
    radial-gradient(circle at 232px 168px, rgba(255, 255, 255, 0.5) 0 0.9px, transparent 1.5px),
    radial-gradient(circle at 382px 286px, rgba(150, 192, 225, 0.5) 0 0.8px, transparent 1.45px),
    radial-gradient(circle at 520px 112px, rgba(214, 196, 166, 0.44) 0 0.95px, transparent 1.55px),
    /* 10 — brighter stars with halos */
    radial-gradient(circle at 212px 126px, rgba(255, 250, 235, 0.98) 0 1.45px, transparent 2.3px),
    radial-gradient(circle at 212px 126px, rgba(190, 164, 128, 0.11) 0 8px, transparent 18px),
    radial-gradient(circle at 618px 92px, rgba(232, 250, 255, 0.92) 0 1.35px, transparent 2.2px),
    radial-gradient(circle at 618px 92px, rgba(57, 115, 169, 0.12) 0 9px, transparent 18px),
    radial-gradient(circle at 802px 328px, rgba(255, 239, 213, 0.84) 0 1.3px, transparent 2.1px),
    radial-gradient(circle at 802px 328px, rgba(190, 164, 128, 0.09) 0 8px, transparent 16px),
    /* 11 — distant silhouettes */
    radial-gradient(ellipse 42vmin 36vmin at -8% 108%, rgba(8, 12, 20, 0.52), transparent 52%),
    radial-gradient(ellipse 52vmin 18vmin at -4% 96%, rgba(103, 121, 126, 0.012), transparent 58%),
    radial-gradient(ellipse 36vmin 30vmin at 108% 92%, rgba(10, 15, 24, 0.48), transparent 50%),
    radial-gradient(ellipse 44vmin 14vmin at 104% 88%, rgba(74, 89, 110, 0.012), transparent 55%),
    /* 12 — edge vignette */
    radial-gradient(ellipse 100% 100% at 50% 50%, transparent 32%, rgba(0, 0, 0, 0.7) 100%);
  background-size:
    auto, auto, auto, auto, auto, auto, auto, auto,
    517px 389px, 517px 389px, 517px 389px, 517px 389px, 517px 389px,
    743px 521px, 743px 521px, 743px 521px, 743px 521px,
    977px 683px, 977px 683px, 977px 683px, 977px 683px, 977px 683px, 977px 683px,
    auto, auto, auto, auto, auto;
  background-repeat:
    no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat,
    repeat, repeat, repeat, repeat, repeat,
    repeat, repeat, repeat, repeat,
    repeat, repeat, repeat, repeat, repeat, repeat,
    no-repeat, no-repeat, no-repeat, no-repeat, no-repeat;
  background-position:
    0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0,
    0 0, 0 0, 0 0, 0 0, 0 0,
    58px 34px, 58px 34px, 58px 34px, 58px 34px,
    -96px 18px, -96px 18px, -96px 18px, -96px 18px, -96px 18px, -96px 18px,
    0 0, 0 0, 0 0, 0 0, 0 0;
  background-attachment: fixed;
}

@media (max-width: 640px) {
  body[data-theme="nebula"] {
    background-attachment: scroll;
    background-position:
      0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0,
      0 0, 0 0, 0 0, 0 0, 0 0,
      42px 26px, 42px 26px, 42px 26px, 42px 26px,
      -72px 14px, -72px 14px, -72px 14px, -72px 14px, -72px 14px, -72px 14px,
      70% 15%, 70% 15%, 16% 68%, 16% 68%,
      0 0, 0 0, 0 0, 0 0, 0 0;
    background-size:
      auto, auto, auto, auto, auto, auto, auto, auto,
      372px 282px, 372px 282px, 372px 282px, 372px 282px, 372px 282px,
      544px 388px, 544px 388px, 544px 388px, 544px 388px,
      736px 512px, 736px 512px, 736px 512px, 736px 512px, 736px 512px, 736px 512px,
      auto, auto, auto, auto, auto;
  }
}

/* -------- Daylight body: warm parchment + faint dot grid + center wash + edge vignette -------- */
body[data-theme="daylight"] {
  background-color: var(--bg-base);
  background-image:
    radial-gradient(ellipse 100% 60% at 50% 0%, rgba(30, 58, 138, 0.06), transparent 70%),
    radial-gradient(ellipse 60% 50% at 100% 100%, rgba(161, 98, 7, 0.05), transparent 60%),
    /* Soft center-lit wash — brightens mid-viewport so panels sit in a "page light". */
    radial-gradient(ellipse 70% 55% at 50% 45%, rgba(255, 252, 240, 0.55), transparent 75%),
    /* 28px dot grid — indigo pinpricks at ~20% alpha, star-chart aesthetic. */
    radial-gradient(circle 1.3px at 1px 1px, rgba(30, 58, 138, 0.2), transparent 100%),
    /* Edge vignette — warm umber darkening the far corners. */
    radial-gradient(ellipse 100% 100% at 50% 50%,
      transparent 50%, rgba(80, 50, 10, 0.10) 100%);
  background-size:
    auto, auto,
    auto,
    28px 28px,
    auto;
  background-repeat:
    no-repeat, no-repeat,
    no-repeat,
    repeat,
    no-repeat;
  background-attachment: fixed;
}

/* Display type */
h1, h2, h3, h4, h5, h6,
.display-font {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

/* Tabular numerals — important for stats bar */
.stats, .statsM,
.tabular,
.font-mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* Links — only non-classic themes override, classic keeps legacy blue. */
body:is([data-theme="nebula"], [data-theme="daylight"]) a {
  color: var(--link);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) a:visited {
  color: var(--link-visited);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) a:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Nebula table headers: warmer steel-grey than body copy or links. */

/* Form inputs inherit tokens on modern themes */
body:is([data-theme="nebula"], [data-theme="daylight"]) input,
body:is([data-theme="nebula"], [data-theme="daylight"]) select,
body:is([data-theme="nebula"], [data-theme="daylight"]) textarea {
  font-family: var(--font-body);
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1px 3px;
  transition: border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) option,
body:is([data-theme="nebula"], [data-theme="daylight"]) optgroup {
  font-family: var(--font-body);
  background: var(--bg-elevated);
  color: var(--text-primary);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) input:focus,
body:is([data-theme="nebula"], [data-theme="daylight"]) select:focus,
body:is([data-theme="nebula"], [data-theme="daylight"]) textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}


/* ------------------------------------------------------------------ */
/*  Theme-selector UI (used on f_option_screen.cfm)                    */
/* ------------------------------------------------------------------ */

.theme-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  max-width: 820px;
  margin: 24px auto;
  padding: 0 16px;
}

.theme-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--dur-base) var(--ease),
              transform var(--dur-base) var(--ease);
}
.theme-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.theme-card[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--ring);
}

.theme-card__swatches {
  display: flex;
  height: 44px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}
.theme-card__swatches span { flex: 1; }

.theme-card__name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.theme-card__desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}
.theme-card__badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--text-inverse);
}


/* ================================================================== */
/*  LEGACY SURFACE OVERRIDES — modern themes only                     */
/*  --------------------------------------------------------------    */
/*  Many in-game panels use inline styles: black rgba backgrounds,    */
/*  `6px ridge #020C1C` borders, hardcoded reds/golds. They're wired  */
/*  into dozens of .cfm files so we override from CSS rather than     */
/*  editing each template. Classic theme is exempt — it keeps the     */
/*  original look (by design — that's why Classic exists).            */
/* ================================================================== */

/* Use a shared selector list that matches both modern themes.
   Panels get a lit-from-above treatment: inset top highlight + bottom shadow.
   The subtle gradient shifts ~3% from top to bottom so the surface has
   dimension without looking busy. */
body[data-theme="nebula"] .col-lg-8.col-sm-12 {
  background:
    linear-gradient(180deg,
      rgba(255, 240, 210, 0.03) 0%,
      rgba(255, 255, 255, 0.01) 22%,
      rgba(255, 255, 255, 0) 52%),
    var(--bg-surface) !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: var(--radius-md);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 2px 4px rgba(0, 0, 0, 0.45),
    0 14px 40px rgba(0, 0, 0, 0.5);
}
body[data-theme="daylight"] .col-lg-8.col-sm-12 {
  background:
    linear-gradient(180deg,
      rgba(255, 255, 255, 0.7) 0%,
      rgba(255, 255, 255, 0) 45%),
    var(--bg-surface) !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: var(--radius-md);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 2px 5px rgba(26, 31, 46, 0.08),
    0 14px 36px rgba(26, 31, 46, 0.14);
}

/* Nested .col-lg-8.col-sm-12 (e.g. inside empire/intel pages) should not
   inherit the outer content-panel border treatment. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .col-lg-8.col-sm-12 .col-lg-8.col-sm-12 {
  background: transparent !important;
  border: none !important;
  border-radius: 0;
  box-shadow: none;
}

/*
  .icon-bar2 vertical gaps: <br> is a void element — browsers ignore height/line-height on it.
  Use <div class="gc-lnav-gap gc-lnav-gap--N"> for reliable pixel gaps.
*/
.gc-lnav-gap {
  display: block;
  height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  font-size: 0;
  line-height: 0;
}
.gc-lnav-gap--2 { height: 2px; }
.gc-lnav-gap--3 { height: 3px; }
.gc-lnav-gap--4 { height: 4px; }
.gc-lnav-gap--6 { height: 6px; }

/* Left nav panels (.icon-bar2) and the store button box below them.
   Same lit-from-above treatment as the main content panel, scaled down. */
body[data-theme="nebula"] .icon-bar2 {
  background:
    linear-gradient(180deg,
      rgba(255, 240, 210, 0.025) 0%,
      rgba(255, 255, 255, 0.008) 22%,
      rgba(255, 255, 255, 0) 52%),
    var(--bg-surface) !important;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 7px 7px 8px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 2px 4px rgba(0, 0, 0, 0.4),
    0 10px 28px rgba(0, 0, 0, 0.4);
}
body[data-theme="daylight"] .icon-bar2 {
  background:
    linear-gradient(180deg,
      rgba(255, 255, 255, 0.65) 0%,
      rgba(255, 255, 255, 0) 50%),
    var(--bg-surface) !important;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 7px 7px 8px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 2px 4px rgba(26, 31, 46, 0.07),
    0 10px 24px rgba(26, 31, 46, 0.11);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .icon-bar2 a {
  display: block;
  padding: 6px 8px;
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.2;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (min-width: 992px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .icon-bar2 a {
    padding: 2px 8px;
  }
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .icon-bar2 a:hover {
  color: var(--accent);
  background: var(--bg-elevated);
  text-decoration: none;
}
body[data-theme="nebula"] .icon-bar2 a.gc-lnav-link--unseen,
body[data-theme="nebula"] .icon-bar2 a.gc-lnav-link--unseen:link,
body[data-theme="nebula"] .icon-bar2 a.gc-lnav-link--unseen:visited,
body[data-theme="nebula"] .icon-bar2 a.gc-lnav-link--unseen:hover,
body[data-theme="nebula"] .dropdown-menu a.gc-lnav-link--unseen,
body[data-theme="nebula"] .dropdown-menu a.gc-lnav-link--unseen:link,
body[data-theme="nebula"] .dropdown-menu a.gc-lnav-link--unseen:visited,
body[data-theme="nebula"] .dropdown-menu a.gc-lnav-link--unseen:hover {
  color: #1a1a2e;
  background: #f5c518;
  box-shadow: 0 0 0 2px rgba(245, 197, 24, 0.7), 0 0 18px 4px rgba(245, 197, 24, 0.35);
  font-weight: 700;
}
body[data-theme="daylight"] .icon-bar2 a.gc-lnav-link--unseen,
body[data-theme="daylight"] .icon-bar2 a.gc-lnav-link--unseen:link,
body[data-theme="daylight"] .icon-bar2 a.gc-lnav-link--unseen:visited,
body[data-theme="daylight"] .icon-bar2 a.gc-lnav-link--unseen:hover,
body[data-theme="daylight"] .dropdown-menu a.gc-lnav-link--unseen,
body[data-theme="daylight"] .dropdown-menu a.gc-lnav-link--unseen:link,
body[data-theme="daylight"] .dropdown-menu a.gc-lnav-link--unseen:visited,
body[data-theme="daylight"] .dropdown-menu a.gc-lnav-link--unseen:hover {
  color: var(--text-inverse);
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-hover) 100%);
  box-shadow: 0 8px 18px rgba(30, 58, 138, 0.12), 0 0 0 1px rgba(185, 28, 28, 0.28);
  font-weight: 700;
}
/* Section headings inside left nav — currently <span style="color:#b41837"> */
body:is([data-theme="nebula"], [data-theme="daylight"]) .icon-bar2 span[style*="b41837"] {
  color: var(--accent) !important;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  display: inline-block;
  margin: 3px 2px 3px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--border);
  width: calc(100% - 4px);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .icon-bar2 span[style*="b41837"]:first-child {
  margin-top: 0;
}

/* Classic left nav: same spacing as Nebula/Daylight; keeps legacy bg, border, font. */
body[data-theme="classic"] .icon-bar2 {
  padding: 7px 7px 8px !important;
  line-height: 1.2;
  box-sizing: border-box;
}
/* Collapse plain <br> tags — section gaps use .gc-lnav-gap divs */
body[data-theme="classic"] .icon-bar2 br {
  display: block;
  line-height: 0;
  margin: 0;
  padding: 0;
}
body[data-theme="classic"] .icon-bar2 a {
  display: block;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.2;
  letter-spacing: 0;
  color: var(--link);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
}
body[data-theme="classic"] .icon-bar2 a:visited {
  color: var(--link-visited);
}
@media (min-width: 992px) {
  body[data-theme="classic"] .icon-bar2 a {
    padding: 2px 8px;
  }
}
body[data-theme="classic"] .icon-bar2 a:hover {
  color: var(--link-hover);
  background: var(--bg-elevated);
  text-decoration: none;
}
body[data-theme="classic"] .icon-bar2 a.gc-lnav-link--unseen,
body[data-theme="classic"] .icon-bar2 a.gc-lnav-link--unseen:link,
body[data-theme="classic"] .icon-bar2 a.gc-lnav-link--unseen:visited,
body[data-theme="classic"] .icon-bar2 a.gc-lnav-link--unseen:hover,
body[data-theme="classic"] .dropdown-menu a.gc-lnav-link--unseen,
body[data-theme="classic"] .dropdown-menu a.gc-lnav-link--unseen:link,
body[data-theme="classic"] .dropdown-menu a.gc-lnav-link--unseen:visited,
body[data-theme="classic"] .dropdown-menu a.gc-lnav-link--unseen:hover {
  color: #fff2d5;
  background: linear-gradient(180deg, #7b132a 0%, #4e0b1a 100%);
  box-shadow: inset 0 1px 0 rgba(255, 214, 145, 0.18), inset 0 -1px 0 rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(180, 24, 55, 0.52), 0 0 14px rgba(180, 24, 55, 0.24);
  font-weight: 700;
}
/* Store link still uses <font color=yellow> — keep gold on hover background */
body[data-theme="classic"] .icon-bar2 a font {
  color: var(--accent-gold) !important;
}
/* Section titles: same spacing as Nebula, keeps legacy font (no mono/uppercase) */
body[data-theme="classic"] .icon-bar2 span[style*="b41837"] {
  color: var(--accent) !important;
  font-weight: bold;
  display: inline-block;
  margin: 3px 2px 3px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--border-strong);
  width: calc(100% - 4px);
}
body[data-theme="classic"] .icon-bar2 span[style*="b41837"]:first-child {
  margin-top: 0;
}

/* Right sidebar panels (chat + news). Hidden on mobile, themed on desktop. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .sidebar-item {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin: 0 8px 12px !important;
  padding: 12px !important;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .sidebar-item h3 {
  color: var(--accent) !important;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 8px;
}

/* ---------------------------------------------------------------------------
   API access page (f_option_api.cfm).

   Mostly unscoped: the page is built from the legacy .Default tables so it
   already works in classic, and these rules only add the bits classic has no
   vocabulary for (code spans, endpoint cards). Colours come from theme tokens
   where they exist and fall back to values that hold up on the classic panel.
   --------------------------------------------------------------------------- */
/* bootstrap.min.css styles bare `code` pink-on-pink (#c7254e on #f9f2f4), which
   reads as an error badge against these panels. Reset it before restyling. */
.gc-api-page code {
  padding: 0;
  background: none;
  color: inherit;
  border-radius: 0;
}
.gc-api-page code,
.gc-api-key,
.gc-api-url {
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
  word-break: break-all;
}
/* Scoped with .gc-api-page so these outrank the bare-`code` reset above,
   which is itself (0,2,0) and would otherwise strip the chip background. */
.gc-api-page .gc-api-key,
.gc-api-page .gc-api-url {
  display: inline-block;
  padding: 3px 7px;
  border: 1px solid var(--border, #334b75);
  border-radius: 4px;
  background: rgba(127, 143, 178, 0.12);
  color: var(--text-primary, #f1eee8);
}
.gc-api-page .gc-api-key {
  font-weight: bold;
  /* The key is the one thing on this page a player needs to select cleanly. */
  user-select: all;
}
.gc-api-prose {
  text-align: left !important;
  padding: 10px 14px !important;
  line-height: 1.5;
}
.gc-api-prose p { margin: 0 0 12px; }
.gc-api-h {
  font-weight: bold;
  color: var(--accent, #bfbf00);
}
.gc-api-msg { padding: 6px 0; }
.gc-api-msg--good { color: var(--accent-good, #7fc592); }
.gc-api-msg--warn { color: var(--accent-hot, #ec6262); }
.gc-api-ok  { color: var(--accent-good, #7fc592); font-weight: bold; }
.gc-api-bad { color: var(--accent-hot, #ec6262); font-weight: bold; }

.gc-api-endpoint {
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid var(--border, #334b75);
  border-radius: var(--radius-sm, 6px);
}
.gc-api-endpoint:last-child { margin-bottom: 0; }
.gc-api-endpoint__name { font-size: 1.05em; font-weight: bold; }
.gc-api-endpoint__summary { margin-top: 3px; }
.gc-api-endpoint__detail { margin-top: 4px; color: var(--text-secondary, #b7bdd1); }
.gc-api-endpoint__meta { margin-top: 7px; }
.gc-api-endpoint__example { margin-top: 9px; }
.gc-api-tag {
  display: inline-block;
  margin-right: 5px;
  padding: 2px 7px;
  border: 1px solid var(--border, #334b75);
  border-radius: 10px;
  color: var(--text-secondary, #b7bdd1);
}
.gc-api-tag--gated {
  border-color: rgba(236, 98, 98, 0.5);
  color: var(--accent-hot, #ec6262);
}
.gc-api-params { margin-top: 9px; }
.gc-api-params td { text-align: center; }

/* Wide tables scroll inside their own box rather than pushing the page sideways. */
.gc-api-scroll { overflow-x: auto; }

@media (max-width: 640px) {
  .gc-api-table { width: 96% !important; }
  .gc-api-params { display: block; overflow-x: auto; }
  /* The call log's nowrap cells cannot shrink, so on a phone let them wrap;
     the scroll wrapper above catches whatever still will not fit. */
  .gc-api-calls td { white-space: normal !important; }
  .gc-api-calls { font-size: 0.85em; }
}

/* Discord invite at the foot of the News / Updates panel (i_f_800.cfm).
   Deliberately unscoped: classic keeps its own inline-styled panel and never
   gets the .sidebar-item overrides above, so this has to stand on its own in
   all three themes. Discord blurple carries it on the two dark themes; only
   daylight needs a darker ink to hold contrast on white. */
.gc-discord-rule {
  border: 0;
  border-top: 1px solid var(--border, #334b75);
  margin: 10px 8px;
  opacity: 0.7;
}
.gc-discord-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 10px;
  padding: 7px 14px;
  border: 1px solid rgba(88, 101, 242, 0.55);
  border-radius: var(--radius-sm, 6px);
  background: rgba(88, 101, 242, 0.14);
  color: #8b95f7 !important;
  font-size: 0.85em;
  font-weight: bold;
  line-height: 1.2;
  text-decoration: none !important;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.gc-discord-link:hover,
.gc-discord-link:focus {
  background: #5865f2;
  border-color: #5865f2;
  color: #ffffff !important;
}
.gc-discord-link .fa {
  font-size: 1.05em;
}
body[data-theme="daylight"] .gc-discord-link {
  background: rgba(88, 101, 242, 0.1);
  border-color: rgba(88, 101, 242, 0.45);
  color: #4149c4 !important;
}

/* Generic Bootstrap cards used for the desktop stats + income/PM row. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .card-body {
  color: var(--text-primary);
}

/* Stats spans (desktop row: Cash/Food/PR/Turns) — legacy had no styling.
   Make them tabular, evenly spaced, color-coded. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .stats {
  display: inline-block;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  font-size: 13px;
  padding: 4px 7px;
  margin-left: 4px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
}
body[data-theme="nebula"] #Cash, body[data-theme="daylight"] #Cash { color: var(--stat-cash); }
body[data-theme="nebula"] #Food, body[data-theme="daylight"] #Food { color: var(--stat-food); }
body[data-theme="nebula"] #PR,   body[data-theme="daylight"] #PR   { color: var(--stat-power); }
body[data-theme="nebula"] #Turns,body[data-theme="daylight"] #Turns{ color: var(--stat-turns); }

/* Top nav button group on desktop (Command / Federation / Rankings / etc). */
body:is([data-theme="nebula"], [data-theme="daylight"]) .buttonN.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 6px 16px;
  min-height: 32px;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: border-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
}
/* Nebula: idle pills read cool/steel to tie into the banner;
   hover switches to warm amber so the action pops. */
body[data-theme="nebula"] .buttonN.pill {
  background:
    linear-gradient(180deg,
      rgba(255, 240, 210, 0.025) 0%,
      rgba(255, 255, 255, 0.008) 32%,
      rgba(255, 255, 255, 0) 100%),
    var(--bg-surface);
  border-color: var(--border-strong);
  color: var(--text-primary);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 6px 18px rgba(0, 0, 0, 0.2);
}
body[data-theme="nebula"] .buttonN.pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  background:
    linear-gradient(180deg,
      rgba(212, 162, 78, 0.07) 0%,
      rgba(255, 255, 255, 0.015) 42%,
      rgba(255, 255, 255, 0) 100%),
    var(--bg-surface);
  box-shadow: 0 0 0 2px rgba(212, 162, 78, 0.1);
  text-decoration: none;
}
body[data-theme="daylight"] .buttonN.pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

body[data-theme="classic"] button.buttonN {
  color: var(--link, #9edcfe);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .buttonN-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: center;
  list-style: none;
  padding: 0;
  margin: 0 auto;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .buttonN-group li {
  list-style: none;
}

/* Yellow announcement bar. Keep the yellow concept but detune. */
body:is([data-theme="nebula"], [data-theme="daylight"]) #topnavbar {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  list-style: none;
  margin: 4px auto;
  max-width: 900px;
}
body[data-theme="nebula"] #topnavbar {
  background:
    linear-gradient(180deg,
      rgba(212, 162, 78, 0.06) 0%,
      rgba(255, 255, 255, 0.012) 38%,
      rgba(255, 255, 255, 0) 100%),
    var(--bg-surface);
  border-color: var(--border-strong);
}

/* Legacy helper class used for headings inside content. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .yellowfont {
  color: var(--accent) !important;
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.01em;
}

/* Form buttons — main.css sets a legacy blue gradient, too loud here. */
body:is([data-theme="nebula"], [data-theme="daylight"]) input[type=button],
body:is([data-theme="nebula"], [data-theme="daylight"]) input[type=submit] {
  background: var(--accent);
  color: var(--text-inverse);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) input[type=button]:hover,
body:is([data-theme="nebula"], [data-theme="daylight"]) input[type=submit]:hover {
  background: var(--accent-hover);
}

/* Tables — many pages use plain <table> with inline bgcolor/font tags.
   Give them a readable baseline without breaking the layout. */
body:is([data-theme="nebula"], [data-theme="daylight"]) table {
  color: var(--text-primary);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) table th {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}

/* Nebula: let legacy Default tables sit one step deeper than the surrounding panel
   so content blocks don't visually merge into a single flat slab. */
body[data-theme="nebula"] table.Default {
  background: #242b31;
  border: 1px solid #64717b;
  border-radius: var(--radius-md);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    inset 0 0 0 1px rgba(12, 18, 24, 0.24),
    0 6px 14px rgba(0, 0, 0, 0.14);
  overflow: hidden;
}
body[data-theme="nebula"] table.Default .Header td,
body[data-theme="nebula"] table.Default .Header th,
body[data-theme="nebula"] table.Default th {
  background: #384149;
  color: #d8c7aa;
  border-bottom-color: #73808b;
}
body[data-theme="nebula"] table.Default td {
  background: transparent;
}
body[data-theme="nebula"] table.Default tr:not(.Header):nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}
body[data-theme="nebula"] table.Default tr:not(.Header):nth-child(odd) td {
  background: rgba(0, 0, 0, 0.04);
}
body[data-theme="nebula"] table.Default tr:not(.Header):hover td {
  background: rgba(83, 166, 162, 0.06);
}

/* Horizontal rules and small-font text */
body:is([data-theme="nebula"], [data-theme="daylight"]) hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .smallfont {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Scrollbar styling on WebKit — subtle and thematic. */
body:is([data-theme="nebula"], [data-theme="daylight"]) ::-webkit-scrollbar { width: 10px; height: 10px; }
body:is([data-theme="nebula"], [data-theme="daylight"]) ::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 10px;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) ::-webkit-scrollbar-track {
  background: var(--bg-base);
}


/* =========================================================
   DESKTOP RESOURCE BAR (.gc-resourcebar)
   Replaces the old desktop Cash/Food/Power/Turns + Income/PM card row.
   Mobile is hidden via .mobileHide; mobile uses app-shell stats strip.
   ========================================================= */

.gc-resourcebar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "actions stats" "meta meta";
  gap: 4px 12px;
  align-items: center;
  width: auto;
  padding: 0;
  margin: 2px 5px 5px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
body[data-theme="classic"] .gc-resourcebar {
  background: linear-gradient(180deg, rgba(36, 44, 72, 0.34) 0%, rgba(0, 0, 0, 0) 100%);
  color: #fff;
  box-shadow: none;
}

.gc-resourcebar__stats {
  grid-area: stats;
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, 1fr));
  gap: 4px;
  min-width: 0;
  justify-self: end;
}

.gc-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  min-width: 0;
  text-align: center;
}
body[data-theme="classic"] .gc-stat {
  background: linear-gradient(180deg, #101318 0%, #060708 100%);
  border-color: #2a4566;
  box-shadow: inset 0 1px 0 rgba(158, 220, 254, 0.12), inset 0 -1px 0 rgba(0, 0, 0, 0.55);
}
.gc-stat__label {
  display: block;
  width: 100%;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  line-height: 1;
  text-align: center;
}
body[data-theme="classic"] .gc-stat__label {
  color: #8da2b7;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.55);
}
.gc-stat__value {
  display: block;
  width: 100%;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.25;
  margin-top: 2px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: center;
}
body[data-theme="classic"] .gc-stat__value {
  color: #f0f4fb;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.65);
}
.gc-stat--cash  .gc-stat__value { color: var(--stat-cash); }
.gc-stat--food  .gc-stat__value { color: var(--stat-food); }
.gc-stat--power .gc-stat__value { color: var(--stat-power); }
.gc-stat--turns .gc-stat__value { color: var(--stat-turns); }

/* Turn bank full: whole pill lights up (no size change); --stat-turns tints all themes */
@keyframes gc-turns-capped-pulse {
  0%, 100% { opacity: 0.72; }
  50% { opacity: 1; }
}
.gc-stat--turns.gc-stat--turns-capped {
  position: relative;
  isolation: isolate;
  border-color: color-mix(in srgb, var(--stat-turns) 48%, var(--border));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--stat-turns) 22%, transparent),
    0 0 12px 1px color-mix(in srgb, var(--stat-turns) 30%, transparent),
    0 0 24px 3px color-mix(in srgb, var(--stat-turns) 16%, transparent);
}
.gc-stat--turns.gc-stat--turns-capped::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse 110% 95% at 50% 78%,
    color-mix(in srgb, var(--stat-turns) 38%, transparent) 0%,
    color-mix(in srgb, var(--stat-turns) 14%, transparent) 42%,
    transparent 72%
  );
  animation: gc-turns-capped-pulse 2.6s ease-in-out infinite;
}
.gc-stat--turns.gc-stat--turns-capped .gc-stat__label,
.gc-stat--turns.gc-stat--turns-capped .gc-stat__value {
  position: relative;
  z-index: 1;
}
.gc-stat--turns.gc-stat--turns-capped .gc-stat__value {
  text-shadow:
    0 0 4px var(--stat-turns),
    0 0 10px color-mix(in srgb, var(--stat-turns) 55%, transparent);
}
body[data-theme="classic"] .gc-stat--turns.gc-stat--turns-capped {
  border-color: color-mix(in srgb, var(--stat-turns) 55%, #2a4566);
  box-shadow:
    inset 0 1px 0 rgba(158, 220, 254, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.55),
    0 0 0 1px color-mix(in srgb, var(--stat-turns) 28%, transparent),
    0 0 16px 2px color-mix(in srgb, var(--stat-turns) 35%, transparent),
    0 0 32px 5px color-mix(in srgb, var(--stat-turns) 18%, transparent);
}
body[data-theme="classic"] .gc-stat--turns.gc-stat--turns-capped .gc-stat__value {
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.65),
    0 0 4px var(--stat-turns),
    0 0 10px color-mix(in srgb, var(--stat-turns) 50%, transparent);
}
body[data-theme="nebula"] .gc-stat--turns.gc-stat--turns-capped {
  border-color: color-mix(in srgb, var(--stat-turns) 42%, var(--border));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    0 8px 20px rgba(0, 0, 0, 0.22),
    0 0 0 1px color-mix(in srgb, var(--stat-turns) 20%, transparent),
    0 0 18px 2px color-mix(in srgb, var(--stat-turns) 32%, transparent),
    0 0 36px 5px color-mix(in srgb, var(--stat-turns) 18%, transparent);
}
body[data-theme="nebula"] .gc-stat--turns.gc-stat--turns-capped::before {
  background: radial-gradient(
    ellipse 115% 100% at 50% 85%,
    color-mix(in srgb, var(--stat-turns) 45%, transparent) 0%,
    color-mix(in srgb, var(--stat-turns) 16%, transparent) 48%,
    transparent 78%
  );
}
@media (prefers-reduced-motion: reduce) {
  .gc-stat--turns.gc-stat--turns-capped::before {
    animation: none;
    opacity: 0.9;
  }
}

.gc-resourcebar__actions {
  grid-area: actions;
  display: flex;
  gap: 4px;
  align-items: stretch;
}
.gc-action {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 2px 10px;
  min-height: 38px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 0;
  color: var(--text-primary);
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: border-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease);
}
.gc-action i {
  font-size: 14px;
  color: var(--text-secondary);
}
.gc-action:link,
.gc-action:visited {
  color: var(--text-primary);
  text-decoration: none;
}
.gc-action:link i,
.gc-action:visited i {
  color: var(--text-secondary);
}
.gc-action:hover {
  color: var(--accent);
  text-decoration: none;
}
.gc-action:hover i { color: var(--accent); }
.gc-action--primary {
  font-weight: 500;
}
.gc-action--primary:link,
.gc-action--primary:visited,
.gc-action--primary i,
.gc-action--primary:link i,
.gc-action--primary:visited i,
.gc-action--primary:hover,
.gc-action--primary:hover i {
  color: inherit;
}
.gc-action--unseen,
.gc-action--unseen:link,
.gc-action--unseen:visited,
.gc-action--unseen:hover {
  color: var(--text-inverse);
}
.gc-action--unseen i,
.gc-action--unseen:link i,
.gc-action--unseen:visited i,
.gc-action--unseen:hover i {
  color: var(--text-inverse);
}
.gc-action--unseen {
  border-color: var(--accent-hot);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.35), 0 0 18px rgba(239, 68, 68, 0.16);
}
body[data-theme="nebula"] .gc-action--primary {
  background:
    linear-gradient(180deg,
      rgba(14, 165, 233, 0.1) 0%,
      rgba(20, 27, 38, 0.96) 100%);
  border-color: var(--border-strong);
}
body[data-theme="daylight"] .gc-action--primary {
  background: linear-gradient(180deg, rgba(75, 92, 146, 0.14) 0%, rgba(255, 255, 255, 0.92) 100%);
  color: var(--text-primary);
}
body[data-theme="daylight"] .gc-action--unseen {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-hover) 100%);
  box-shadow: 0 8px 18px rgba(30, 58, 138, 0.12), 0 0 0 1px rgba(185, 28, 28, 0.28);
}
body[data-theme="classic"] .gc-action {
  background: linear-gradient(180deg, #1d2f4b 0%, #0e1726 100%);
  color: #f4f7fd;
  box-shadow: inset 0 1px 0 rgba(158, 220, 254, 0.16), inset 0 -1px 0 rgba(0, 0, 0, 0.45);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.55);
}
body[data-theme="classic"] .gc-action i {
  color: #d4d8e1;
}
body[data-theme="classic"] .gc-action:hover {
  color: #9edcfe;
  background: linear-gradient(180deg, #274266 0%, #101b2d 100%);
}
body[data-theme="classic"] .gc-action:hover i {
  color: #9edcfe;
}
body[data-theme="classic"] .gc-action--primary {
  background: linear-gradient(180deg, #1d2f4b 0%, #0e1726 100%);
  color: #f4f7fd;
  box-shadow: inset 0 1px 0 rgba(158, 220, 254, 0.16), inset 0 -1px 0 rgba(0, 0, 0, 0.45);
}
body[data-theme="classic"] .gc-action--unseen {
  background: linear-gradient(180deg, #7b132a 0%, #4e0b1a 100%);
  box-shadow: inset 0 1px 0 rgba(255, 214, 145, 0.18), inset 0 -1px 0 rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(180, 24, 55, 0.52), 0 0 14px rgba(180, 24, 55, 0.24);
}
body[data-theme="classic"] .gc-action--primary:link,
body[data-theme="classic"] .gc-action--primary:visited,
body[data-theme="classic"] .gc-action--primary i,
body[data-theme="classic"] .gc-action--primary:link i,
body[data-theme="classic"] .gc-action--primary:visited i,
body[data-theme="classic"] .gc-action--primary:hover,
body[data-theme="classic"] .gc-action--primary:hover i {
  color: #f4f7fd;
}
body[data-theme="classic"] .gc-action--unseen:link,
body[data-theme="classic"] .gc-action--unseen:visited,
body[data-theme="classic"] .gc-action--unseen i,
body[data-theme="classic"] .gc-action--unseen:link i,
body[data-theme="classic"] .gc-action--unseen:visited i,
body[data-theme="classic"] .gc-action--unseen:hover,
body[data-theme="classic"] .gc-action--unseen:hover i {
  color: #fff2d5;
}
body[data-theme="classic"] .gc-action__dot {
  box-shadow: 0 0 0 2px #111720;
}
body[data-theme="daylight"] .gc-resourcebar {
  background: rgba(233, 238, 252, 0.55);
  border: 0;
  box-shadow: none;
}
body[data-theme="daylight"] .gc-stat {
  background: linear-gradient(180deg, rgba(75, 92, 146, 0.14) 0%, rgba(255, 255, 255, 0.9) 100%);
  border-color: #6d7db1;
}
body[data-theme="daylight"] .gc-action {
  background: linear-gradient(180deg, rgba(75, 92, 146, 0.14) 0%, rgba(255, 255, 255, 0.92) 100%);
  box-shadow: none;
}
body[data-theme="nebula"] .gc-action {
  background:
    linear-gradient(180deg,
      rgba(255, 240, 210, 0.02) 0%,
      rgba(255, 255, 255, 0.008) 36%,
      rgba(255, 255, 255, 0) 100%),
    var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 8px 22px rgba(0, 0, 0, 0.22);
}
body[data-theme="nebula"] .gc-action:hover {
  color: var(--accent-cool);
  border-color: var(--border-strong);
  background:
    linear-gradient(180deg,
      rgba(14, 165, 233, 0.08) 0%,
      rgba(255, 255, 255, 0.02) 42%,
      rgba(255, 255, 255, 0) 100%),
    var(--bg-elevated);
}
body[data-theme="nebula"] .gc-action:hover i {
  color: var(--accent-cool);
}
body[data-theme="nebula"] .gc-action--unseen,
body[data-theme="nebula"] .gc-action--unseen:hover {
  background: #f5c518;
  border-color: #f5c518;
  box-shadow: 0 0 0 2px rgba(245, 197, 24, 0.7), 0 0 18px 4px rgba(245, 197, 24, 0.35);
}
body[data-theme="nebula"] .gc-action--unseen,
body[data-theme="nebula"] .gc-action--unseen:link,
body[data-theme="nebula"] .gc-action--unseen:visited,
body[data-theme="nebula"] .gc-action--unseen:hover,
body[data-theme="nebula"] .gc-action--unseen i,
body[data-theme="nebula"] .gc-action--unseen:link i,
body[data-theme="nebula"] .gc-action--unseen:visited i,
body[data-theme="nebula"] .gc-action--unseen:hover i {
  color: #1a1a2e;
}
.gc-action__dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-hot);
  box-shadow: 0 0 0 2px var(--bg-surface);
}

/* An unseen System message (userfrom 0 — admin notices and the like) flashes
   orange instead of the usual unseen colour, so it is tellable from ordinary
   player mail without opening the box. Declared after every themed
   .gc-action--unseen rule above so it wins in all three themes, and repeated
   for the link states because those are what the themes target. */
.gc-action--unseen-system,
.gc-action--unseen-system:link,
.gc-action--unseen-system:visited,
.gc-action--unseen-system:hover,
body[data-theme="nebula"] .gc-action--unseen-system,
body[data-theme="nebula"] .gc-action--unseen-system:hover,
body[data-theme="daylight"] .gc-action--unseen-system,
body[data-theme="daylight"] .gc-action--unseen-system:hover,
body[data-theme="classic"] .gc-action--unseen-system,
body[data-theme="classic"] .gc-action--unseen-system:hover {
  background: #f97316;
  border-color: #f97316;
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.7), 0 0 18px 4px rgba(249, 115, 22, 0.35);
}
.gc-action--unseen-system,
.gc-action--unseen-system:link,
.gc-action--unseen-system:visited,
.gc-action--unseen-system:hover,
.gc-action--unseen-system i,
.gc-action--unseen-system:link i,
.gc-action--unseen-system:visited i,
.gc-action--unseen-system:hover i,
body[data-theme="nebula"] .gc-action--unseen-system,
body[data-theme="nebula"] .gc-action--unseen-system i,
body[data-theme="classic"] .gc-action--unseen-system,
body[data-theme="classic"] .gc-action--unseen-system i,
body[data-theme="daylight"] .gc-action--unseen-system,
body[data-theme="daylight"] .gc-action--unseen-system i {
  color: #1a1a2e;
}
.gc-action--unseen-system .gc-action__dot {
  background: #7c2d12;
}

.gc-resourcebar__meta {
  grid-area: meta;
  display: flex;
  justify-content: flex-end;
  padding: 0 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

@media (max-width: 991.98px) {
  .gc-resourcebar { grid-template-columns: 1fr; grid-template-areas: "actions" "stats" "meta"; }
  .gc-resourcebar__actions { justify-content: flex-start; }
}

/* The main layout container has padding:0 which leaves Bootstrap's .row negative
   margins uncompensated, causing 15px horizontal overflow on mobile. Clip at body
   level — internal scroll containers (display:block overflow:auto tables) are
   unaffected because they create their own scroll context. */
@media (max-width: 767.98px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) {
    overflow-x: hidden;
  }
}


/* =========================================================
   DEFAULT TABLES
   Nearly every game page uses <table class="Default"> plus
   <tr class="Header"> for the caption row. Retheme both so
   modern themes get a clean readable data grid. Classic keeps
   its original dark gradient (untouched).
   ========================================================= */

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default {
  background: var(--bg-surface) !important;
  background-image: none !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  margin: 0 auto 4px !important;
  max-width: 100%;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default th,
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default td {
  border: 0;
  border-bottom: 1px solid rgba(var(--border-rgb, 31, 45, 60), 0.5);
  padding: 1px 6px;
  vertical-align: middle;
  color: var(--text-primary);
}
body[data-theme="nebula"] table.Default th,
body[data-theme="nebula"] table.Default td {
  border-bottom-color: rgba(31, 45, 60, 0.5);
}
body[data-theme="daylight"] table.Default th,
body[data-theme="daylight"] table.Default td {
  border-bottom-color: rgba(212, 208, 199, 0.6);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default tr:last-child td,
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default tr:last-child th {
  border-bottom: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default thead td,
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default thead th {
  background: transparent;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  padding: 5px 8px 4px;
}
body[data-theme="nebula"] table.Default thead td,
body[data-theme="nebula"] table.Default thead th {
  border-bottom: 1px solid rgba(212, 162, 78, 0.18);
}
body[data-theme="daylight"] table.Default thead td,
body[data-theme="daylight"] table.Default thead th {
  border-bottom: 1px solid rgba(30, 58, 138, 0.15);
}

/* The .Header tr is used as a caption/section row inside tables. */
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default tr.Header td,
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default tr.Header th {
  background: transparent !important;
  background-image: none !important;
  color: var(--accent) !important;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  padding: 5px 8px 4px;
}
body[data-theme="nebula"] table.Default tr.Header td,
body[data-theme="nebula"] table.Default tr.Header th {
  border-bottom: 1px solid rgba(212, 162, 78, 0.18);
}
body[data-theme="daylight"] table.Default tr.Header td,
body[data-theme="daylight"] table.Default tr.Header th {
  border-bottom: 1px solid rgba(30, 58, 138, 0.15);
}

/* =========================================================
   EXCAVATION DIG SITE
   (f_com_col_find.cfm)

   Two columns: the dig controls and notes on the left, what the
   dig turned up on the right. Stacks to one column on narrow
   screens as controls, results, notes - so what a dig found sits
   right under the button - with the empty results panel hidden
   before the first dig.

   Unscoped, like the Command Center and Event Rewards blocks:
   every theme defines the custom properties it reads.
   ========================================================= */

.gc-dig {
  display: grid;
  gap: 12px;
  max-width: 1040px;
  margin: 0 auto;
  padding-block: 8px 16px;
  font-size: 13px;
}

.gc-dig__head {
  text-align: center;
}

.gc-dig__title {
  margin: 0 0 5px;
}

.gc-dig__colony {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 4px 10px;
  margin: 0;
  color: var(--text-secondary);
}

.gc-dig__colony-name {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-primary);
}

.gc-dig__colony-type::after {
  content: "\00B7";
  margin-left: 10px;
  color: var(--text-muted);
}

/* cf_s_endturn prints its summary as a legacy table with an inline width and
   margin; inside the layout it should simply fill the row. */
.gc-dig__turnbar {
  overflow-wrap: anywhere;
}

.gc-dig__turnbar table.Default {
  width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
}

.gc-dig__notice {
  margin: 0;
  padding: 9px 12px;
  border: 1px solid color-mix(in srgb, var(--accent-hot) 45%, var(--border));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--accent-hot) 10%, var(--bg-surface));
  color: var(--text-primary);
  text-align: center;
}

/* "You feel lucky !" - the one notice that is good news. */
.gc-dig__notice--good {
  border-color: color-mix(in srgb, var(--accent-good) 45%, var(--border));
  background: color-mix(in srgb, var(--accent-good) 10%, var(--bg-surface));
}

/* --- Layout ------------------------------------------------------------- */

.gc-dig__layout {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 12px;
  align-items: start;
}

.gc-dig__side {
  display: grid;
  gap: 12px;
}

/* The anti-script links between the panels are empty and only there to move
   the form around in the DOM. As grid items they would still claim a gap (and
   on phones, with no order, sort to the top), so keep them out of layout. */
.gc-dig__side > a:empty {
  display: none;
}

/* --- Panels ------------------------------------------------------------- */

.gc-dig-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.gc-dig-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface-alt);
}

.gc-dig-panel__title {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.gc-dig-panel__foot {
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface-alt);
  text-align: right;
}

.gc-dig-link {
  color: var(--link);
  font-weight: 600;
  text-decoration: none;
}

.gc-dig-link:hover,
.gc-dig-link:focus-visible {
  color: var(--link-hover);
  text-decoration: underline;
}

.gc-dig-empty {
  margin: 0;
  padding: 26px 16px;
  color: var(--text-muted);
  text-align: center;
}

/* --- Batch badge -------------------------------------------------------- */

.gc-dig-batch {
  padding: 2px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text-primary);
}

.gc-dig-batch--uncommon {
  border-color: color-mix(in srgb, var(--accent-cool) 50%, var(--border));
  color: var(--accent-cool);
}

.gc-dig-batch--rare {
  border-color: color-mix(in srgb, var(--accent-gold) 55%, var(--border));
  color: var(--accent-gold);
}

.gc-dig-batch--mixed {
  border-color: color-mix(in srgb, var(--accent-good) 50%, var(--border));
  color: var(--accent-good);
}

.gc-dig-batch--default {
  color: var(--text-muted);
}

/* --- Dig form ----------------------------------------------------------- */

.gc-dig-control__form {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 13px 12px 14px;
}

.gc-dig-control__label {
  margin: 0;
  font-weight: normal;
  color: var(--text-secondary);
}

.gc-dig-control__row {
  display: flex;
  gap: 8px;
}

/* Phone-only pieces (see the narrow-screen block): on desktop the field
   wrapper steps aside so the input stays a direct flex item, and the unit
   is hidden - the visible label already says what the number is. */
.gc-dig-control__field {
  display: contents;
}

.gc-dig-control__unit {
  display: none;
}

/* Two classes deep on purpose: the themes' base input[type=button] and
   input[type=text] rules score (0,2,2) and would otherwise win. */
.gc-dig .gc-dig-control__turns[type="text"] {
  flex: 0 0 88px;
  width: 88px;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 15px;
  text-align: center;
}

.gc-dig .gc-dig-control__submit[type="button"] {
  flex: 1 1 auto;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--text-inverse);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}

.gc-dig .gc-dig-control__submit[type="button"]:hover {
  background: var(--accent-hover);
}

.gc-dig .gc-dig-control__turns[type="text"]:focus-visible,
.gc-dig .gc-dig-control__submit[type="button"]:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 1px;
}

/* --- Luck --------------------------------------------------------------- */

/* A secondary control: an outlined button, so Perform Dig stays the one
   filled button on the page. It shows which luck artifacts you hold and how
   many - never how much luck they give or how long it lasts. */
.gc-dig-luck__form {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 13px 12px 14px;
}

.gc-dig-luck__label {
  margin: 0;
  font-weight: normal;
  color: var(--text-secondary);
}

.gc-dig-luck__row {
  display: flex;
  gap: 8px;
}

/* Two classes deep, like the dig controls, to stay ahead of the themes'
   element rules. */
.gc-dig .gc-dig-luck__select {
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 13px;
}

.gc-dig .gc-dig-luck__submit {
  flex: 0 0 auto;
  height: 40px;
  padding: 0 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 60%, var(--border));
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}

.gc-dig .gc-dig-luck__submit:hover {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.gc-dig .gc-dig-luck__select:focus-visible,
.gc-dig .gc-dig-luck__submit:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 1px;
}

/* --- Notes -------------------------------------------------------------- */

.gc-dig-notes__list {
  margin: 0;
  padding: 11px 14px 13px 30px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.gc-dig-notes__list li + li {
  margin-top: 5px;
}

.gc-dig-notes__list strong {
  color: var(--text-primary);
}

.gc-dig-notes__clock {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-cool);
}

/* --- Results ------------------------------------------------------------ */

.gc-dig-finds__count {
  min-width: 26px;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--text-inverse);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.gc-dig-table-wrap {
  overflow-x: auto;
}

/* .gc-dig prefix: the themes' base "table th" / "table td" rules score
   (0,1,3) and would override single-class selectors. border: 0 first because
   main.css gives every th and td a 1px black border on all four sides. */
.gc-dig .gc-dig-table {
  width: 100%;
  margin: 0;
  border: 0;
  border-collapse: collapse;
  background: transparent;
}

.gc-dig .gc-dig-table th {
  padding: 7px 12px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: left;
  color: var(--text-muted);
}

.gc-dig .gc-dig-table td {
  padding: 9px 12px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  text-align: left;
  vertical-align: middle;
  color: var(--text-primary);
}

.gc-dig .gc-dig-table tbody tr:last-child td {
  border-bottom: 0;
}

.gc-dig .gc-dig-table tbody tr:nth-child(even) td {
  background: color-mix(in srgb, var(--bg-surface-alt) 60%, transparent);
}

/* Rarity and Held sit centred under their headings. Three classes deep to
   beat the text-align: left on the th / td rules above. */
.gc-dig .gc-dig-table .gc-dig-table__mid {
  text-align: center;
}

/* Held is a fixed-width group - the count right-aligned in 3ch, "/ cap"
   left-aligned in 5ch - so centring the group keeps every row's slash in the
   same place, whether it reads 6 / 50 or 255 / 255. ch is the mono digit
   width, and three digits covers the largest cap (255). */
.gc-dig-held {
  display: inline-flex;
  gap: 0.5ch;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.gc-dig-held__have {
  min-width: 3ch;
  text-align: right;
}

.gc-dig-held__cap {
  min-width: 5ch;
  text-align: left;
  color: var(--text-muted);
}

.gc-dig-table__name {
  font-weight: 700;
}

.gc-dig-table__cap {
  display: block;
  font-size: 11px;
  font-weight: normal;
  color: var(--accent-hot);
}

.gc-dig-rarity {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--text-secondary);
}

.gc-dig-rarity--uncommon {
  border-color: color-mix(in srgb, var(--accent-cool) 50%, var(--border));
  color: var(--accent-cool);
}

.gc-dig-rarity--rare {
  border-color: color-mix(in srgb, var(--accent-gold) 55%, var(--border));
  color: var(--accent-gold);
}

.gc-dig-event {
  display: grid;
  gap: 3px;
  margin: 12px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--accent-hot) 45%, var(--border));
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent-hot) 10%, var(--bg-surface));
  text-align: center;
}

.gc-dig-event__title {
  font-weight: 700;
  color: var(--accent-hot);
}

.gc-dig-event__detail {
  color: var(--text-secondary);
}

/* --- Narrow screens ----------------------------------------------------- */

@media (max-width: 719.98px) {
  .gc-dig {
    gap: 10px;
    font-size: 12px;
  }

  .gc-dig__layout {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* One column: the dig controls, then what was found, then the notes. The
     side column dissolves so its two panels and the results panel become
     siblings in a single stack that order can interleave - the results sit
     directly under the Perform Dig button. */
  .gc-dig__side {
    display: contents;
  }

  /* The dig card holds one box and one button, so on a phone it shrinks to
     fit them and sits centred - it has no reason to stretch to the full width
     the results table below needs. 280px = the 240px button plus padding. */
  .gc-dig-control {
    order: 1;
    justify-self: center;
    width: 100%;
    max-width: 280px;
  }

  .gc-dig-finds {
    order: 2;
  }

  /* Luck follows the results, so what a dig found still sits right under
     Perform Dig. A compact card like the dig controls, its select over its
     button, at the same 16px as the turns box. */
  .gc-dig-luck {
    order: 3;
    justify-self: center;
    width: 100%;
    max-width: 280px;
  }

  .gc-dig-luck__form {
    padding: 12px;
  }

  /* The panel heading already says Luck; the label stays for screen
     readers, as the dig card's does. */
  .gc-dig-luck__label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .gc-dig-luck__row {
    flex-direction: column;
    align-items: center;
  }

  .gc-dig .gc-dig-luck__select,
  .gc-dig .gc-dig-luck__submit {
    width: 100%;
    max-width: 240px;
    height: 44px;
  }

  .gc-dig .gc-dig-luck__select {
    flex: none;
    font-size: 16px;
  }

  .gc-dig .gc-dig-luck__submit {
    font-size: 15px;
  }

  .gc-dig-notes {
    order: 4;
  }

  /* Before a dig, an empty results panel is only a scroll in the way. */
  .gc-dig:not(.gc-dig--result) .gc-dig-finds {
    display: none;
  }

  /* The dig control on phones: the turns box centred on its own line with the
     button under it, capped in width so it stays a button rather than a slab.
     "turns" sits inside the box as its unit, so the separate label row goes -
     it stays for screen readers. */
  .gc-dig-control__form {
    padding: 12px;
  }

  .gc-dig-control__label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .gc-dig-control__row {
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }

  .gc-dig-control__field {
    position: relative;
    display: block;
    flex: none;
    width: 112px;
  }

  /* 16px for legibility. (iOS does not zoom into small fields on these pages:
     the shell's viewport tag sets maximum-scale=1.)
     The right padding leaves room for the unit, which sits over the box and
     lets taps through, so a tap anywhere in it lands in the input. */
  .gc-dig .gc-dig-control__turns[type="text"] {
    width: 100%;
    height: 44px;
    padding: 0 52px 0 10px;
    border-radius: var(--radius-sm);
    font-size: 16px;
    text-align: right;
  }

  .gc-dig-control__unit {
    position: absolute;
    top: 50%;
    right: 12px;
    display: block;
    transform: translateY(-50%);
    font-size: 12px;
    color: var(--text-muted);
    pointer-events: none;
  }

  .gc-dig .gc-dig-control__submit[type="button"] {
    flex: none;
    width: 100%;
    max-width: 240px;
    min-height: 44px;
    border-radius: var(--radius-sm);
    font-size: 15px;
  }
}

/* Phones from 360px, when there is a Luck card: the dig card and the Luck
   card side by side, with what the dig found - then the notes - full width
   beneath, so the results still sit directly under Perform Dig. With no Luck
   card (no luck artifacts held) the dig card stays the compact centred card
   above, and below 360px everything stacks.

   The dig card is the wider of the two (3:2); Luck only needs a dropdown and
   a short button. Its dropdown drops to 13px here, and its labels lead with
   the count ("5 x Minor Suerte"), so where a long name does not fit it is
   the end of the name that is cut - the amount held stays in view. Tapping
   it opens the phone's own picker, which shows every label in full.

   In half width the batch badge drops under its title and the Luck header
   takes the same height, so the two cards' controls sit level. */
@media (min-width: 360px) and (max-width: 719.98px) {
  .gc-dig--luck .gc-dig__layout {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  }

  .gc-dig--luck .gc-dig-control,
  .gc-dig--luck .gc-dig-luck {
    align-self: stretch;
    justify-self: stretch;
    max-width: none;
  }

  .gc-dig--luck .gc-dig-control {
    order: 1;
  }

  .gc-dig--luck .gc-dig-luck {
    order: 2;
  }

  .gc-dig--luck .gc-dig-finds,
  .gc-dig--luck .gc-dig-notes {
    grid-column: 1 / -1;
  }

  .gc-dig--luck .gc-dig-finds {
    order: 3;
  }

  .gc-dig--luck .gc-dig-notes {
    order: 4;
  }

  .gc-dig--luck .gc-dig-luck__form {
    padding: 12px 10px;
  }

  .gc-dig--luck .gc-dig-luck__select {
    padding: 0 4px 0 8px;
    font-size: 13px;
  }

  .gc-dig--luck .gc-dig-luck__submit {
    padding: 0 8px;
    font-size: 14px;
  }

  .gc-dig--luck .gc-dig-control .gc-dig-panel__head,
  .gc-dig--luck .gc-dig-luck .gc-dig-panel__head {
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    min-height: 60px;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gc-dig .gc-dig-control__submit[type="button"],
  .gc-dig .gc-dig-luck__submit {
    transition: none;
  }
}

/* ---------------------------------------------------------------------------
   EXCAVATION DIG SITE - Classic.

   The layout above is shared, but on its own it only recolours the modern
   look: rounded panels, spaced monospace titles and filled buttons, which is
   Nebula wearing Classic's colours. Classic pages read as main.css's legacy
   chrome instead, so the dig page takes those exact values:

     frame     table.Default  1px lightblue, #000 -40% to #323232 gradient,
                              square corners
     headings  .Header td     navy gradient, #DADADA bold Arial, centred
     text      body           lightgrey Arial
     fields    input, select  #2c375a, no border, lightgrey
     buttons   input[button]  #2e466e to #415989, white, 1px #1f2f47, 4px
     links     body A         #9edcfe, hover #008a8a underlined

   Layout, spacing and the phone arrangement are untouched.
   --------------------------------------------------------------------------- */
body[data-theme="classic"] .gc-dig,
body[data-theme="classic"] .gc-dig .gc-dig-panel__title,
body[data-theme="classic"] .gc-dig .gc-dig-batch,
body[data-theme="classic"] .gc-dig .gc-dig-finds__count,
body[data-theme="classic"] .gc-dig .gc-dig-table th,
body[data-theme="classic"] .gc-dig .gc-dig-held,
body[data-theme="classic"] .gc-dig .gc-dig-notes__clock,
body[data-theme="classic"] .gc-dig .gc-dig__colony-name {
  font-family: Arial, Helvetica, sans-serif;
}

body[data-theme="classic"] .gc-dig .gc-dig-panel {
  border: 1px solid lightblue;
  border-radius: 0;
  background: linear-gradient(to bottom, #000000 -40%, #323232 75%);
  box-shadow: none;
}

body[data-theme="classic"] .gc-dig .gc-dig-panel__head {
  justify-content: center;
  border-bottom: 1px solid #000000;
  background-image: linear-gradient(to bottom, #000207, #090d14, #10151d, #151b26, #192130, #1a2232, #1a2335, #1b2437, #182133, #141d2f, #111a2b, #0e1727);
}

body[data-theme="classic"] .gc-dig .gc-dig-panel__title {
  font-size: 13px;
  font-weight: bold;
  letter-spacing: normal;
  text-transform: none;
  color: #DADADA;
}

body[data-theme="classic"] .gc-dig .gc-dig-panel__foot {
  border-top: 1px solid #000000;
  background: transparent;
}

/* The batch name as coloured text, the way the old page showed it - no pill. */
body[data-theme="classic"] .gc-dig .gc-dig-batch {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  font-size: 13px;
  letter-spacing: normal;
  text-transform: none;
}

body[data-theme="classic"] .gc-dig .gc-dig-finds__count {
  min-width: 0;
  padding: 0;
  border-radius: 0;
  background: none;
  font-size: 13px;
  color: #DADADA;
}

body[data-theme="classic"] .gc-dig .gc-dig-finds__count::before { content: "("; }
body[data-theme="classic"] .gc-dig .gc-dig-finds__count::after { content: ")"; }

/* Fields: main.css's navy input, no border. */
body[data-theme="classic"] .gc-dig .gc-dig-control__turns[type="text"],
body[data-theme="classic"] .gc-dig .gc-dig-luck__select {
  border: 0;
  border-radius: 0;
  background: #2c375a;
  color: lightgrey;
  font-family: Arial, Helvetica, sans-serif;
}

body[data-theme="classic"] .gc-dig .gc-dig-control__unit {
  color: #a8b2c8;
}

/* Buttons: main.css's steel-blue input button. Perform Dig and Use Luck share
   it, as every button on a Classic page does. */
body[data-theme="classic"] .gc-dig .gc-dig-control__submit[type="button"],
body[data-theme="classic"] .gc-dig .gc-dig-luck__submit {
  border: 1px solid #1f2f47;
  border-radius: 4px;
  background: linear-gradient(to bottom, #2e466e 5%, #415989 100%);
  color: #ffffff;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: normal;
  letter-spacing: normal;
}

body[data-theme="classic"] .gc-dig .gc-dig-control__submit[type="button"]:hover,
body[data-theme="classic"] .gc-dig .gc-dig-luck__submit:hover {
  background: linear-gradient(to bottom, #415989 5%, #2e466e 100%);
}

/* The found-artifacts table: Default-table headings and black cell rules,
   no striping. */
body[data-theme="classic"] .gc-dig .gc-dig-table th {
  border: 1px solid #000000;
  background-image: linear-gradient(to bottom, #000207, #090d14, #10151d, #151b26, #192130, #1a2232, #1a2335, #1b2437, #182133, #141d2f, #111a2b, #0e1727);
  font-size: 13px;
  font-weight: bold;
  letter-spacing: normal;
  text-transform: none;
  color: #DADADA;
}

body[data-theme="classic"] .gc-dig .gc-dig-table td,
body[data-theme="classic"] .gc-dig .gc-dig-table tbody tr:nth-child(even) td {
  border: 1px solid #000000;
  background: transparent;
  color: lightgrey;
}

/* Rarity as coloured text, like the old "Found X (UnCommon)" lines. */
body[data-theme="classic"] .gc-dig .gc-dig-rarity {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  font-weight: normal;
}

body[data-theme="classic"] .gc-dig .gc-dig-link {
  font-weight: normal;
  color: #9edcfe;
}

body[data-theme="classic"] .gc-dig .gc-dig-link:hover,
body[data-theme="classic"] .gc-dig .gc-dig-link:focus-visible {
  color: #008a8a;
}

body[data-theme="classic"] .gc-dig .gc-dig-notes__list,
body[data-theme="classic"] .gc-dig .gc-dig-notes__list strong,
body[data-theme="classic"] .gc-dig .gc-dig__colony {
  color: lightgrey;
}

body[data-theme="classic"] .gc-dig .gc-dig__notice,
body[data-theme="classic"] .gc-dig .gc-dig-event {
  border-radius: 0;
}

/* =========================================================
   REPORT OFFENSIVE MESSAGE
   (f_pm_r.cfm)

   Two columns: the message being reported on the left, the report
   form and what happens next on the right. Stacks on narrow screens
   as message, then form, so the player reads what they are reporting
   before saying why.

   Unscoped, like the dig site: every theme defines the custom
   properties it reads. Classic is dressed in main.css's legacy
   chrome further down.
   ========================================================= */

.gc-pmr {
  display: grid;
  gap: 12px;
  max-width: 960px;
  margin: 0 auto;
  padding-block: 8px 16px;
  font-size: 13px;
}

.gc-pmr__head {
  display: grid;
  justify-items: center;
  gap: 5px;
}

.gc-pmr__title {
  margin: 0;
}

.gc-pmr__layout {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 12px;
  align-items: start;
}

.gc-pmr-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.gc-pmr-panel__head {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface-alt);
}

.gc-pmr-panel__title {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.gc-pmr-panel__foot {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface-alt);
  text-align: right;
}

.gc-pmr-link {
  color: var(--link);
  font-weight: 600;
  text-decoration: none;
}

.gc-pmr-link:hover,
.gc-pmr-link:focus-visible {
  color: var(--link-hover);
  text-decoration: underline;
}

.gc-pmr-empty {
  margin: 0;
  padding: 22px 16px;
  color: var(--text-muted);
  text-align: center;
}

/* --- The message -------------------------------------------------------- */

.gc-pmr-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin: 0;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
}

.gc-pmr-meta dt {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: normal;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 18px;
  color: var(--text-muted);
}

.gc-pmr-meta dd {
  margin: 0;
  line-height: 18px;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.gc-pmr-message__body {
  min-height: 120px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 12px;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  text-align: left;
  overflow-wrap: anywhere;
}

/* --- The form ----------------------------------------------------------- */

.gc-pmr-form__form {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 13px 12px 14px;
}

.gc-pmr-form__label {
  margin: 0;
  font-weight: normal;
  color: var(--text-secondary);
}

/* Two classes deep on purpose: the themes' base input[type=text] and button
   rules would otherwise win. */
.gc-pmr .gc-pmr-form__reason {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 14px;
}

.gc-pmr .gc-pmr-form__submit,
.gc-pmr .gc-pmr-button {
  display: inline-block;
  padding: 8px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--text-inverse);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}

.gc-pmr .gc-pmr-form__submit {
  justify-self: end;
}

.gc-pmr .gc-pmr-form__submit:hover,
.gc-pmr .gc-pmr-button:hover {
  background: var(--accent-hover);
  color: var(--text-inverse);
  text-decoration: none;
}

.gc-pmr .gc-pmr-form__reason:focus-visible,
.gc-pmr .gc-pmr-form__submit:focus-visible,
.gc-pmr .gc-pmr-button:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 1px;
}

.gc-pmr-form__error {
  margin: 0;
  color: var(--accent-hot);
}

.gc-pmr-notes {
  margin: 0;
  padding: 11px 14px 13px 30px;
  border-top: 1px solid var(--border);
  line-height: 1.5;
  color: var(--text-secondary);
  text-align: left;
}

.gc-pmr-notes li {
  list-style: disc;
}

.gc-pmr-notes li + li {
  margin-top: 4px;
}

/* --- Filed -------------------------------------------------------------- */

.gc-pmr-done {
  width: 100%;
  max-width: 560px;
  justify-self: center;
}

.gc-pmr-done__body {
  padding: 12px 14px 4px;
  line-height: 1.5;
  color: var(--text-secondary);
  text-align: left;
}

.gc-pmr-done__body p {
  margin: 0 0 9px;
}

.gc-pmr-done__body p:first-child {
  color: var(--text-primary);
  font-weight: 600;
}

.gc-pmr-done__tip img {
  vertical-align: middle;
}

/* --- Narrow screens ----------------------------------------------------- */

@media (max-width: 719.98px) {
  .gc-pmr__layout {
    grid-template-columns: 1fr;
  }

  .gc-pmr-message__body {
    min-height: 60px;
    max-height: 40vh;
  }

  /* 16px so iOS does not zoom when the field is focused. */
  .gc-pmr .gc-pmr-form__reason {
    font-size: 16px;
  }

  .gc-pmr .gc-pmr-form__submit {
    justify-self: stretch;
  }
}

/* ---------------------------------------------------------------------------
   REPORT OFFENSIVE MESSAGE - Classic.

   The same values the dig site takes from main.css's legacy chrome, so the
   page reads as a Classic page rather than Nebula in Classic's colours:
   lightblue frames with the #000-#323232 gradient and square corners, the
   navy header gradient with #DADADA bold Arial, #2c375a fields, the
   steel-blue button, #9edcfe links.
   --------------------------------------------------------------------------- */
body[data-theme="classic"] .gc-pmr,
body[data-theme="classic"] .gc-pmr .gc-pmr-panel__title,
body[data-theme="classic"] .gc-pmr .gc-pmr-meta dt,
body[data-theme="classic"] .gc-pmr .gc-pmr-form__reason,
body[data-theme="classic"] .gc-pmr .gc-pmr-form__submit,
body[data-theme="classic"] .gc-pmr .gc-pmr-button {
  font-family: Arial, Helvetica, sans-serif;
}

body[data-theme="classic"] .gc-pmr .gc-pmr-panel {
  border: 1px solid lightblue;
  border-radius: 0;
  background: linear-gradient(to bottom, #000000 -40%, #323232 75%);
  box-shadow: none;
}

body[data-theme="classic"] .gc-pmr .gc-pmr-panel__head {
  justify-content: center;
  border-bottom: 1px solid #000000;
  background-image: linear-gradient(to bottom, #000207, #090d14, #10151d, #151b26, #192130, #1a2232, #1a2335, #1b2437, #182133, #141d2f, #111a2b, #0e1727);
}

body[data-theme="classic"] .gc-pmr .gc-pmr-panel__title {
  font-size: 13px;
  letter-spacing: normal;
  text-transform: none;
  color: #DADADA;
}

body[data-theme="classic"] .gc-pmr .gc-pmr-panel__foot,
body[data-theme="classic"] .gc-pmr .gc-pmr-meta,
body[data-theme="classic"] .gc-pmr .gc-pmr-notes {
  border-color: #000000;
  background: transparent;
}

body[data-theme="classic"] .gc-pmr .gc-pmr-meta dt {
  font-size: 13px;
  letter-spacing: normal;
  text-transform: none;
  color: #C3BBC3;
  font-weight: bold;
}

body[data-theme="classic"] .gc-pmr .gc-pmr-meta dd,
body[data-theme="classic"] .gc-pmr .gc-pmr-message__body,
body[data-theme="classic"] .gc-pmr .gc-pmr-form__label,
body[data-theme="classic"] .gc-pmr .gc-pmr-notes,
body[data-theme="classic"] .gc-pmr .gc-pmr-done__body,
body[data-theme="classic"] .gc-pmr .gc-pmr-done__body p:first-child {
  color: lightgrey;
}

body[data-theme="classic"] .gc-pmr .gc-pmr-message__body {
  background: rgba(0, 0, 0, 0.35);
  border-top: 1px solid #000000;
}

body[data-theme="classic"] .gc-pmr .gc-pmr-form__reason {
  border: 0;
  border-radius: 0;
  background: #2c375a;
  color: lightgrey;
}

body[data-theme="classic"] .gc-pmr .gc-pmr-form__submit,
body[data-theme="classic"] .gc-pmr .gc-pmr-button {
  border: 1px solid #1f2f47;
  border-radius: 4px;
  background: linear-gradient(to bottom, #2e466e 5%, #415989 100%);
  color: #ffffff;
  font-size: 13px;
  font-weight: normal;
  letter-spacing: normal;
}

body[data-theme="classic"] .gc-pmr .gc-pmr-form__submit:hover,
body[data-theme="classic"] .gc-pmr .gc-pmr-button:hover {
  background: linear-gradient(to bottom, #415989 5%, #2e466e 100%);
  color: #ffffff;
}

body[data-theme="classic"] .gc-pmr .gc-pmr-link {
  font-weight: normal;
  color: #9edcfe;
}

body[data-theme="classic"] .gc-pmr .gc-pmr-link:hover,
body[data-theme="classic"] .gc-pmr .gc-pmr-link:focus-visible {
  color: #008a8a;
}

body[data-theme="classic"] .gc-pmr .gc-pmr-form__error {
  color: #ff6666;
}

/* Vacation mode options: use shared Default table chrome, with a compact modern
   control layout for the explanatory copy and day selector. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-vacation-page {
  padding-bottom: 1.25rem;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-vacation-status,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-vacation-form {
  width: min(100%, 36rem) !important;
  margin: 0.85rem auto 0 !important;
  box-shadow: var(--shadow-md);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-vacation-status td,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-vacation-form td {
  padding: 7px 10px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-vacation-status tr > td:first-child {
  width: 42%;
  color: var(--text-secondary);
  text-align: right;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-vacation-warning {
  color: var(--text-secondary);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-vacation-warning font[color="yellow"] {
  color: var(--accent) !important;
  font-family: var(--font-display);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-vacation-copy {
  width: min(100%, 42rem);
  margin: 1rem auto 0 !important;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  color: var(--text-secondary);
  line-height: 1.55;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-vacation-copy .yellowfont {
  display: block;
  margin: 0.35rem 0 0.2rem;
  color: var(--accent);
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-vacation-copy .yellowfont:first-child {
  margin-top: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-vacation-form td {
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-vacation-form select {
  min-width: 9rem;
  margin: 0 0.35rem;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-vacation-form input[type="button"] {
  min-width: 110px;
}

@media (max-width: 640px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-vacation-status,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-vacation-form,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-vacation-copy {
    width: calc(100% - 12px) !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-vacation-status tr > td:first-child {
    width: 45%;
    text-align: left;
  }
}

/* Mission pages include many legacy act/mission templates with Default2 tables.
   Retheme them from the wrapper so Classic stays untouched and each mission file
   does not need its own class edits. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-mission-page {
  padding-bottom: 1.25rem;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-mission-page > p:first-child {
  margin-bottom: 0.85rem !important;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-mission-reward-note {
  width: min(100%, 56rem);
  margin: 0 auto 0.95rem;
  padding: 0.8rem 1rem;
  text-align: center;
  color: var(--accent-good);
  background: color-mix(in srgb, var(--bg-surface) 88%, var(--accent-good) 12%);
  border: 1px solid color-mix(in srgb, var(--accent-good) 42%, transparent);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

body[data-theme="daylight"] .gc-mission-reward-note {
  background: color-mix(in srgb, white 90%, var(--accent-good) 10%);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-mission-page table.Default2,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-mission-notice {
  width: min(100%, 56rem) !important;
  margin: 0.85rem auto 0 !important;
  background: var(--bg-surface) !important;
  background-image: none !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 12px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-mission-page table.Default2 td,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-mission-notice td {
  border: 0;
  border-bottom: 1px solid rgba(31, 45, 60, 0.5);
  padding: 8px 10px;
  color: var(--text-primary);
  line-height: 1.42;
}

body[data-theme="daylight"] .gc-mission-page table.Default2 td,
body[data-theme="daylight"] .gc-mission-notice td {
  border-bottom-color: rgba(212, 208, 199, 0.6);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-mission-page table.Default2 tr:last-child td,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-mission-notice tr:last-child td {
  border-bottom: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-mission-page table.Default2 tr.Header td {
  color: var(--accent) !important;
  text-align: center;
  font-weight: 600;
  background: rgba(125, 191, 242, 0.06) !important;
}

body[data-theme="daylight"] .gc-mission-page table.Default2 tr.Header td {
  background: rgba(30, 58, 138, 0.05) !important;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-mission-page table.Default2 > tbody > tr > td {
  text-align: center;
}

/* Mission completion templates use an unclassed nested 90% table for
   image + text. Convert only that legacy media row in modern themes. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-mission-page table.Default2 table[width="90%"] {
  width: min(100%, 50rem) !important;
  margin: 0.35rem auto 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-mission-page table.Default2 table[width="90%"] > tbody > tr {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(280px, 1.4fr);
  align-items: center;
  gap: 1.25rem;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-mission-page table.Default2 table[width="90%"] td {
  display: block;
  padding: 0 !important;
  border: 0 !important;
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-mission-page table.Default2 table[width="90%"] td:last-child {
  max-width: 30rem;
  margin: 0 auto;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-mission-page table.Default2 table[width="90%"] td:has(> img[src*="sp_.gif"]) {
  display: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-mission-page table.Default2 table[width="90%"] img:not([src*="sp_.gif"]) {
  display: block;
  width: min(100%, 260px);
  height: auto;
  margin: 0 auto;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-mission-page table.Default2 form {
  display: block;
  width: 100%;
  margin-top: 0.6rem;
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-mission-page table.Default2 form input[type="submit"] {
  display: block;
  width: auto;
  min-width: 150px;
  max-width: 16rem;
  margin: 0 auto 0.35rem;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-mission-reward {
  display: inline-block;
  margin-top: 0.15rem;
  color: var(--accent-good);
  font-weight: 700;
  text-shadow: 0 0 14px rgba(127, 197, 146, 0.18);
}

body[data-theme="daylight"] .gc-mission-reward {
  text-shadow: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-mission-page .gc-found-planet-title {
  margin: 0.95rem auto 0.45rem !important;
  color: var(--accent-good) !important;
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.01em;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-mission-page table.Default.gc-found-planet-table {
  width: min(100%, 20rem) !important;
  margin: 0 auto 1rem !important;
  box-shadow: var(--shadow-sm);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-mission-page table.Default.gc-found-planet-table td {
  padding: 5px 10px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-mission-notice {
  width: min(100%, 26rem) !important;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-mission-notice td {
  text-align: center;
}

@media (max-width: 640px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-mission-page table.Default2,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-mission-notice {
    width: calc(100% - 12px) !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-mission-page table.Default2 td {
    padding: 7px 8px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-mission-page table.Default2 table[width="90%"] > tbody > tr {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-mission-page table.Default2 table[width="90%"] img:not([src*="sp_.gif"]) {
    width: min(100%, 220px);
  }
}

@media (min-width: 992px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-mission-page table.Default2 {
    width: 92% !important;
  }
}

/* f_rank2: PR Ratio — muted reference column (Classic-style), all breakpoints */
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-results-table tbody td.rank-table__pr-ratio,
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-results-table-mobile tbody td.rank-table__pr-ratio {
  color: var(--text-secondary) !important;
  font-family: var(--font-body) !important;
  font-variant-numeric: normal !important;
  font-feature-settings: normal !important;
  letter-spacing: normal !important;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-results-table tbody td.rank-table__pr-ratio--vm,
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-results-table-mobile tbody td.rank-table__pr-ratio--vm {
  color: #5c5c5c !important;
  font-style: italic;
}

body[data-theme="nebula"] .rank-s-table__power-full,
body[data-theme="classic"] .rank-s-table__power-full,
body[data-theme="daylight"] .rank-s-table__power-full {
  display: inline !important;
}

body[data-theme="nebula"] .rank-s-table__power-abbrev,
body[data-theme="classic"] .rank-s-table__power-abbrev,
body[data-theme="daylight"] .rank-s-table__power-abbrev {
  display: none !important;
}

@media (max-width: 991.98px) {
  body[data-theme="nebula"] table.rank-page-table .rank-s-table__power-full,
  body[data-theme="classic"] table.rank-page-table .rank-s-table__power-full,
  body[data-theme="daylight"] table.rank-page-table .rank-s-table__power-full {
    display: none !important;
  }

  body[data-theme="nebula"] table.rank-page-table .rank-s-table__power-abbrev,
  body[data-theme="classic"] table.rank-page-table .rank-s-table__power-abbrev,
  body[data-theme="daylight"] table.rank-page-table .rank-s-table__power-abbrev {
    display: inline !important;
  }
}

@media (max-width: 767.98px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-s-table {
    display: table !important;
    width: calc(100% - 8px) !important;
    max-width: calc(100% - 8px) !important;
    margin-left: 4px !important;
    margin-right: 4px !important;
    table-layout: fixed;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-s-table td {
    padding-left: 2px !important;
    padding-right: 2px !important;
    box-sizing: border-box;
    min-width: 0;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-s-table tr.Header td {
    padding-left: 1px !important;
    padding-right: 1px !important;
    font-size: 10px;
    letter-spacing: 0.08em;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-s-table tr > td:nth-child(1) {
    width: 7%;
    text-align: right;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-s-table tr > td:nth-child(2) {
    width: 32%;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-s-table tr > td:nth-child(3) {
    width: 18%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-s-table tr > td:nth-child(4) {
    width: 13%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-s-table tr > td:nth-child(5) {
    width: 18%;
    white-space: nowrap;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-s-table tr > td:nth-child(6) {
    width: 12%;
    white-space: nowrap;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-s-table--type8 tr > td:nth-child(2) {
    width: 34%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-s-table--type8 tr > td:nth-child(3) {
    width: 18%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-s-table--type8 tr > td:nth-child(4) {
    width: 13%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-s-table--type8 tr > td:nth-child(5) {
    width: 28%;
  }
}

/* Hover: elevated bg + gold left accent strip. */
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default tbody tr {
  transition: background var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default tbody tr:hover td {
  background: var(--bg-elevated);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default tbody tr:hover td:first-child {
  /* no left-border accent on hover */
}

/* First column: mildly muted so values stand out. */
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default tbody tr td:first-child {
  color: var(--text-secondary);
}

/* Links inside tables should use the theme accent, not legacy blue. */
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default a {
  color: var(--accent);
  text-decoration: none;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default a:hover {
  text-decoration: underline;
}

/* Numeric cells — tabular figures for alignment. */
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default td[align="right"],
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default td.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}

/* Row-stripe helper classes used sporadically across pages. */
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default .table_row1 {
  background: var(--bg-surface) !important;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default .table_row2 {
  background: var(--bg-elevated) !important;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default .tr1_header {
  background: var(--bg-elevated) !important;
  color: var(--accent) !important;
}

/* Mobile: full-width, tighter cells, smaller type. */
@media (max-width: 640px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    border-radius: 0;
    font-size: 12px;
  }
  /* The scroll rule sets display:block on table.Default. Explicitly restoring
     internal table display values keeps tbody/tr/td filling the full width
     whether the outer table is display:table or display:block. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default thead {
    display: table-header-group !important;
    width: 100%;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default tbody {
    display: table-row-group !important;
    width: 100%;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default tr {
    display: table-row !important;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default th,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default td {
    display: table-cell !important;
    padding: 2px 4px;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default thead td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default thead th,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default tr.Header td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default tr.Header th {
    padding: 5px 8px 4px;
  }
}

/* Rank pages (f_rank / f_rank2): mobile gutters — Nebula + Daylight beat generic table.Default td padding */
@media (max-width: 767.98px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-page-table--your-rank,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-page-table--top50,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-results-table-mobile {
    table-layout: auto;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-page-table--your-rank td.rank-table__rank-cell {
    padding: 1px 0 !important;
    text-align: center;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-page-table--top50 td.rank-table__rank-cell {
    padding: 1px 0.38rem 1px 0 !important;
    text-align: right;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-page-table--your-rank td.rank-table__empire-cell {
    padding: 1px 1px 1px 0 !important;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-page-table--top50 td.rank-table__empire-cell {
    padding: 1px 1px 1px 0 !important;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-page-table--your-rank td:last-child,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-page-table--top50 td:last-child {
    padding-left: 1px !important;
    padding-right: 1px !important;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-page-table--top50 tr.Header td.rank-table__rank-hdr {
    padding: 1px 0.38rem 1px 0 !important;
    text-align: right !important;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-page-table--your-rank tr.Header td.rank-table__rank-hdr {
    padding: 1px 0 !important;
    text-align: center !important;
  }
  /* f_rank2 mobile: fit viewport — tighter than generic table.Default; drop mono numerics (narrower) */
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-results-table-mobile {
    font-size: 11px !important; /* ~10% over 10px */
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-results-table-mobile td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-results-table-mobile th {
    padding: 1px 1px !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-results-table-mobile tr.Header td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-results-table-mobile tr.Header th {
    padding: 2px 1px !important;
    font-size: 10px !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-results-table-mobile tr.Header td.rank-table__pr-ratio-hdr {
    padding: 2px 0 !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-results-table-mobile td.rank-table__pr-ratio,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-results-table-mobile td.rank-table__pr-ratio--vm {
    padding: 1px 0 !important;
    letter-spacing: 0 !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.rank-results-table-mobile td[align="right"] {
    font-family: var(--font-body) !important;
    font-variant-numeric: normal !important;
    font-feature-settings: normal !important;
    letter-spacing: normal !important;
  }
}

/* =========================================================
   RANK FILTER TOOLBAR (f_rank2.cfm, f_rank_s.cfm)
   ---------------------------------------------------------
   Both pages ship the same legacy markup — a .table_back table
   of alternating .rank-filter-table__label / __field cells — so
   Classic keeps its original boxed grey control panel untouched.
   Modern themes flatten that table into one centered control
   bar: table = chassis, tr = flex line, label/field pairs = the
   items. Same vocabulary as .gc-events-filter.

   Desktop only: below 768px main.css already reflows the same
   cells into a label-over-select grid and strips the legacy
   borders, which is the right shape for narrow screens.
   ========================================================= */

@media (min-width: 768px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .rank-filter-form {
    display: flex;
    justify-content: center;
    width: 100%;
    margin: 0 0 12px;
    padding: 0;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.rank-filter-table {
    display: block;
    width: auto;
    max-width: 100%;
    margin: 0 !important;
    padding: 8px 16px;
    box-sizing: border-box;
    background: var(--bg-surface) !important;
    background-image: none !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    color: var(--text-primary);
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.rank-filter-table tbody {
    display: block;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.rank-filter-table tr {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    background: transparent !important;
    background-image: none !important;
    border: 0 !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.rank-filter-table td {
    display: block;
    padding: 0;
    border: 0 !important;
    background: transparent !important;
    text-align: left;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.rank-filter-table td.rank-filter-table__label {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
  }

  /* Groups each label with the select that follows it: extra breathing room
     opens before every label except the first. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.rank-filter-table td.rank-filter-table__label:not(:first-child) {
    margin-left: 12px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.rank-filter-table td.rank-filter-table__field select {
    min-height: 30px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 13px;
  }
}

/* Mobile: f_rank_s has two label/field pairs, not f_rank2's three, so the
   shared 3-column grid in main.css would leave a dead third column. */
@media (max-width: 767.98px) {
  .rank-filter-table--grid.rank-filter-table--cols2 tr {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* =========================================================
   ART-BESIDE-PANEL PAGES (f_com_explore.cfm)
   ---------------------------------------------------------
   Lays out a portrait image in a left column and a data
   panel in the right one, and asks the panel to hug the
   inner edge (`margin-left: 1%` inline on the table).

   The DEFAULT TABLES block above sets `margin: 0 auto 4px
   !important` on every table.Default — the !important is what
   keeps legacy pages centered, but as a *shorthand* it also
   resets margin-left/right to auto and margin-top to 0, which
   outranks those inline margins. The panel therefore centers
   itself in its own column and opens a ~70-100px trench next
   to the art, and the inline vertical rhythm collapses to 4px.

   Re-assert the intended margins per page. Desktop only:
   below 768px the columns stack, the panels go full width, and
   the mobile blocks already zero these margins themselves.
   ========================================================= */

@media (min-width: 768px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-explore-panel {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* --- f_com_attack_prev: same again, but NOT theme-scoped. Intel and Explore
     already carry an inline `margin-left: 0` that Classic honours (main.css's
     centring rule has no !important), so only the modern themes were broken
     there. This table has no such inline margin, so every theme centres it and
     every theme shows the trench.

     Scoped to the page wrapper rather than .gc-battle-prev-table: f_fed_prev.cfm
     reuses the same table via s_com_attack_prev.cfm with its art column
     commented out, and there the centred margin is correct and deliberate. --- */
  .gc-battle-prev-page table.Default.gc-battle-prev-table {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* The battle log is a wide 4-column table, so the stock 15px+15px Bootstrap
     gutter between the art column and it reads as dead space. Collapse the
     gutter to a single hairline gap and let the art sit right against the log. */
  .gc-battle-prev-page .col-sm-3 {
    padding-right: 0;
  }

  .gc-battle-prev-page .col-sm-9 {
    padding-left: 8px;
  }

  /* The log table is width:90% pinned to the column's left edge, so its right
     edge lands at 90%. The pager and footnote in s_com_attack_prev.cfm carry
     inline 5% margins that were tuned for the old centred table (5% gutter each
     side) and now sit inboard on the left and outboard on the right. Re-hang
     both on the table's actual edges. */
  .gc-battle-prev-page .FRight {
    margin-right: 10% !important;
  }

  .gc-battle-prev-page .mobileHide > p.smallfont {
    margin-left: 0 !important;
  }
}

/* =========================================================
   KEY-VALUE MODIFIER (.kv)
   Add class="Default kv" to 2-column label:value tables.
   Turns them into instrument-readout cards: mono labels,
   shrink-to-fit label column, emphasized values.
   ========================================================= */

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.kv thead td,
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.kv thead th,
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.kv tr.Header td,
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.kv tr.Header th {
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.kv tbody td {
  padding: 2px 8px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.kv tbody td:first-child {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  width: 1%;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.kv tbody td:last-child {
  color: var(--text-primary);
  font-size: 14px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.kv.gc-pm-detail tbody td.gc-pm-detail__body {
  font-family: inherit;
  font-size: 14px;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text-primary);
  white-space: normal;
  width: auto;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.kv.gc-colupgrade-options tbody td,
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.kv.gc-colupgrade-options td {
  font-family: var(--font-body);
  font-size: 14px;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text-primary);
  white-space: normal;
  width: auto;
}

@media (max-width: 767.98px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .col-lg-8 table.Default.gc-colupgrade-minerals,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colupgrade-minerals {
    display: table !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box;
  }
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-project-detail-page__image-wrap {
  display: flex;
  justify-content: center;
  width: 100%;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-project-detail-page__image {
  display: block;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-itech-reset-note {
  width: min(100% - 16px, 560px);
  box-sizing: border-box;
  margin: 4px auto 12px !important;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--bg-elevated) 54%, transparent);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
  box-shadow: var(--shadow-sm);
}

@media (max-width: 767.98px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-project-detail-content {
    display: block !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-project-invest-spacer {
    display: none !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-project-invest-summary {
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
    display: block !important;
    min-height: 0 !important;
    height: auto !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-project-action-panel {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-project-invest-summary__intro {
    margin-top: 4px !important;
    margin-bottom: 6px !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-project-invest-summary__table {
    margin-bottom: 0 !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-project-invest-summary > form {
    margin: 0 !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-project-invest-summary__table + br,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-project-invest-summary form:empty {
    display: none !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-itech-reset-note {
    margin-top: 4px !important;
    margin-bottom: 6px !important;
    padding: 8px 10px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-itech-redistribution-form {
    margin: 0 !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-itech-redistribution-table {
    margin-top: 0 !important;
  }
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-capsule-lab {
  width: 100%;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-capsule-lab__title {
  margin: 0 0 12px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-capsule-lab__grid {
  align-items: flex-start;
  margin-left: -8px;
  margin-right: -8px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-capsule-lab__left,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-capsule-lab__right {
  padding-left: 8px;
  padding-right: 8px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-capsule-lab__form,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-capsule-lab__stocks,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-capsule-lab__recipes {
  margin-left: auto;
  margin-right: auto;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-capsule-lab__form tr.Header td,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-capsule-lab__stocks tr.Header td,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-capsule-lab__recipes tr.Header td {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-capsule-lab__form td,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-capsule-lab__stocks td,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-capsule-lab__recipes td {
  padding: 6px 10px;
  color: var(--text-primary);
  vertical-align: middle;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-capsule-lab__form select {
  width: 100%;
  min-height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 4px 10px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-capsule-lab input[type="submit"],
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-capsule-lab input[type="button"].ArtifactFuser {
  border: 1px solid var(--border-strong) !important;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--accent) 72%, var(--bg-elevated)) !important;
  color: var(--text-inverse) !important;
  box-shadow: none;
  font-family: var(--font-body);
  font-weight: 600;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-capsule-lab input[type="button"].ArtifactFuser {
  width: 100% !important;
  font-size: 12px !important;
  line-height: 1.2;
  padding: 6px 10px !important;
  white-space: normal;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-capsule-lab__stocks-wrap {
  margin-top: 14px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-capsule-lab__stocks td:nth-child(2),
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-capsule-lab__stocks td:nth-child(3) {
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-capsule-lab__recipes td {
  vertical-align: top;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-capsule-lab__help {
  margin: 14px 0 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-capsule-lab__help a {
  color: var(--accent);
}

@media (max-width: 767.98px) {
  /* On narrow screens the desktop shrink-to-fit label column makes intel/profile
     tables collapse into a thin strip. Give labels a real share of the row and
     let them wrap so the value column still fills the remaining space. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-page,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-project-page,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-project-detail-page {
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-project-detail-page .row {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-page .mobileShow,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-project-page .mobileShow {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-capsule-lab__grid {
    margin-left: 0;
    margin-right: 0;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-capsule-lab__left,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-capsule-lab__right {
    padding-left: 0;
    padding-right: 0;
  }

  .gc-capsule-lab__stocks-wrap {
    display: none !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-page .gc-colony-page__mobile,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-project-page .gc-project-page__mobile,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-project-detail-page {
    padding-left: 4px !important;
    padding-right: 4px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-project-detail-page table.Default {
    display: table !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-project-detail-page table.Default thead {
    display: table-header-group !important;
    width: 100% !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-project-detail-page table.Default tbody {
    display: table-row-group !important;
    width: 100% !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-project-detail-page table.Default tr {
    display: table-row !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-project-detail-page table.Default th,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-project-detail-page table.Default td {
    display: table-cell !important;
    box-sizing: border-box;
    min-width: 0;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.kv tbody td {
    padding: 2px 4px;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.kv tbody td:last-child {
    font-size: 13px;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.kv.gc-pm-detail tbody td.gc-pm-detail__body {
    font-size: 13px;
  }
}

/* =========================================================
   FEDERATION JOIN LIST
   Keeps Classic untouched. Modern themes keep the legacy
   table shape; columns size to content, cells centred.
   ========================================================= */

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-list {
  width: calc(100% - 8px) !important;
  max-width: 100%;
  margin: 0 auto;
  table-layout: auto;
}

body[data-theme="nebula"] table.Default.gc-fed-list td,
body[data-theme="nebula"] table.Default.gc-fed-list th,
body[data-theme="daylight"] table.Default.gc-fed-list td {
  vertical-align: middle;
}

body[data-theme="daylight"] table.Default.gc-fed-list th {
  vertical-align: middle;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-list tr.Header td {
  font-size: 10px;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-list tr:not(.Header) td {
  padding: 4px 6px;
  line-height: 1.15;
  text-align: center !important;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-list td:nth-child(2),
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-list td:nth-child(3),
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-list td:nth-child(4) {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-list__power-full {
  display: inline;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-list__power-abbrev {
  display: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-list__hdr-full {
  display: inline;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-list__hdr-mobile {
  display: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-list td:nth-child(1),
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-list td:nth-child(5) {
  overflow-wrap: anywhere;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-prev-table {
  width: calc(100% - 8px) !important;
  margin-left: auto !important;
  margin-right: auto !important;
  table-layout: fixed;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-member-table {
  width: 100% !important;
  margin-left: auto !important;
  margin-right: auto !important;
  table-layout: fixed;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-member-table--mobile {
  width: calc(100% - 8px) !important;
  margin-left: auto !important;
  margin-right: auto !important;
  table-layout: fixed !important;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-member-table td {
  vertical-align: middle;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-member-table__empire {
  width: 34%;
  min-width: 0;
  text-align: center;
  overflow-wrap: break-word;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-member-table__empire a {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: break-word;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-member-table__race {
  width: 10%;
  overflow-wrap: anywhere;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-member-table__numeric {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Planets/Last Login are short (a few digits, or "Inactive"); Power Rating can run to
   11 digits unabbreviated, so it needs a much bigger share than an even 3-way split —
   an even split let it wrap, which threw off its vertical centering relative to the
   single-line cells beside it. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-member-table__numeric--planets {
  width: 10%;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-member-table__numeric--power {
  width: 18%;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-member-table__numeric--log {
  width: 14%;
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-member-table__action {
  width: 14%;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-member-table tr.gc-fed-member-table__empty td {
  width: 100% !important;
  text-align: center !important;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-detail-notice {
  margin-left: auto !important;
  margin-right: auto !important;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-detail-notice__body {
  width: 100%;
  box-sizing: border-box;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-detail-notice__body table {
  width: 100% !important;
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  table-layout: auto !important;
  box-sizing: border-box;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-detail-notice__body td,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-detail-notice__body th {
  overflow-wrap: break-word;
  word-break: normal;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-member-empty {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  color: var(--text-primary);
  text-align: left;
  margin-left: auto;
  margin-right: auto;
  padding: 20px 14px;
  box-sizing: border-box;
}

/* main.css sets .mobileHide { display: inline } on desktop — a block child with
   width:100% then shrink-wraps. Establish a real column-width box for empty state.
   ONLY >=768px: on mobile, app-shell sets .mobileHide { display:none !important } and
   a global display:block here would override that (higher specificity) and duplicate
   the empty card next to .mobileShow. */
@media (min-width: 768px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .col-lg-8 .mobileHide:has(.gc-fed-member-empty) {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box;
  }
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-member-empty--desktop {
  width: 100% !important;
  max-width: 100% !important;
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-member-empty--mobile {
  width: 100% !important;
  max-width: 100% !important;
  text-align: center;
}






















/* =========================================================
   Mobile full-width: f_fed_member apply list + f_fed_war tables
   Legacy inline widths (90%/98%) left these tables narrow on
   phones. Force them to fill the column in Nebula/Daylight.
   ========================================================= */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-war-grid table.Default.gc-fed-war-table {
  width: 90%;
}

/* Federation forum action alignment applies at every modern viewport. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-forum-action {
  display: flex;
  justify-content: center;
  width: 100%;
  margin: 10px auto 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-forum-action__button {
  flex: 0 0 auto;
  max-width: 100%;
}

@media (max-width: 767.98px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .col-lg-8 .mobileShow {
    width: 100% !important;
    box-sizing: border-box;
  }

  /* Nested .col-sm-12 (f_fed_join → f_fed_member) doubles Bootstrap horizontal padding;
     bleed the fed member mobile block to the outer column so it matches kv / list width. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) .col-lg-8 .col-sm-12 > .mobileShow:has(.gc-fed-member-empty, .gc-fed-member-table--mobile) {
    margin-left: -15px !important;
    margin-right: -15px !important;
    width: calc(100% + 30px) !important;
    max-width: none !important;
    box-sizing: border-box;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .col-lg-8 .col-sm-12 .col-sm-12 > .mobileShow:has(.gc-fed-member-empty, .gc-fed-member-table--mobile) {
    margin-left: -15px !important;
    margin-right: -15px !important;
    width: calc(100% + 30px) !important;
    max-width: none !important;
    box-sizing: border-box;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .mobileShow > table.Default.gc-fed-member-table--mobile {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-detail-notice {
    display: table !important;
    width: calc(100% + 30px) !important;
    max-width: none !important;
    margin-left: -15px !important;
    margin-right: -15px !important;
    table-layout: fixed !important;
    box-sizing: border-box;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-detail-notice tbody {
    display: table-row-group !important;
    width: 100% !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-detail-notice tr {
    display: table-row !important;
    width: 100% !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-detail-notice > tbody > tr > td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-detail-notice > tr > td {
    display: table-cell !important;
    width: 100% !important;
    box-sizing: border-box;
    white-space: normal;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-forum-page {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding-left: 6px;
    padding-right: 6px;
    box-sizing: border-box;
    overflow-x: clip;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-compose {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    table-layout: fixed !important;
    box-sizing: border-box;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-compose td {
    box-sizing: border-box;
    max-width: 100% !important;
    overflow-wrap: anywhere;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-compose textarea {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    box-sizing: border-box;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-compose input[name="remLen2"] {
    width: 58px !important;
    max-width: 100%;
    box-sizing: border-box;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-compose input[type="button"],
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-compose input[type="reset"],
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-compose input[type="submit"] {
    max-width: 100%;
    white-space: normal;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-pager {
    display: table !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    table-layout: fixed !important;
    box-sizing: border-box;
    border-collapse: collapse !important;
    border-spacing: 0 !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-list {
    display: table !important;
    width: 95% !important;
    max-width: 95% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    table-layout: fixed !important;
    box-sizing: border-box;
    border-collapse: collapse !important;
    border-spacing: 0 !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-list tbody,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-pager tbody {
    display: table-row-group !important;
    width: 100% !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-list tr,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-pager tr {
    display: table-row !important;
    width: 100% !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-list > tbody > tr > td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-list > tr > td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-pager > tbody > tr > td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-pager > tr > td {
    display: table-cell !important;
    box-sizing: border-box;
    white-space: normal;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-list tbody {
    display: block !important;
    width: 100% !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-list tr {
    display: grid !important;
    grid-template-columns: 76px minmax(0, 1fr);
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-list > tbody > tr > td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-list > tr > td {
    display: block !important;
    min-width: 0;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-forum-action {
    text-align: center;
    margin: 10px auto 0;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-forum-action__button {
    display: inline-flex;
    width: auto;
    max-width: 100%;
    justify-content: center;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-forum-list__meta {
    width: auto !important;
    min-width: 0 !important;
    max-width: 76px !important;
    white-space: normal !important;
    vertical-align: top;
    padding-left: 4px;
    padding-right: 4px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-forum-list__body {
    width: 100% !important;
    min-width: 0;
    max-width: 100% !important;
    box-sizing: border-box;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal !important;
    overflow: visible;
    padding-left: 6px;
    padding-right: 6px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-forum-list__user {
    display: block;
    white-space: nowrap;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-forum-list__stamp {
    display: inline-block;
    white-space: nowrap;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-pager {
    float: none !important;
    margin-top: 6px !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-detail-notice__body table {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    table-layout: auto !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    overflow-x: visible !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-detail-notice__body table tbody {
    display: block !important;
    width: 100% !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-detail-notice__body table tr {
    display: block !important;
    width: 100% !important;
    margin-bottom: 8px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-detail-notice__body td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-detail-notice__body th {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 0;
    padding-right: 0;
    white-space: normal;
    box-sizing: border-box;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-detail-notice__body table colgroup,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-detail-notice__body table col {
    display: none !important;
    width: auto !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-detail-notice__body table[width],
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-detail-notice__body td[width],
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-detail-notice__body th[width] {
    width: 100% !important;
    max-width: 100% !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-detail-notice__body table tr > td:first-child,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-detail-notice__body table tr > th:first-child {
    width: 100% !important;
    vertical-align: top;
    margin-bottom: 4px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-detail-notice__body table tr > td:last-child,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-detail-notice__body table tr > th:last-child {
    width: 100% !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-detail-notice__body table tr:has(> td:last-child:empty) > td:last-child,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-detail-notice__body table tr:has(> th:last-child:empty) > th:last-child {
    display: none !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-detail-notice__body table tr:has(> td:last-child:empty) > td:first-child,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-detail-notice__body table tr:has(> th:last-child:empty) > th:first-child {
    width: 100% !important;
    max-width: 100% !important;
    margin-bottom: 8px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-member-table--mobile.gc-fed-member-table--applicants td {
    padding: 3px 3px;
    vertical-align: middle;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-member-table--mobile td {
    padding: 3px 3px;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-member-table--mobile .gc-fed-member-table__empire {
    width: 34%;
    font-size: 11px;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-member-table--mobile .gc-fed-member-table__race {
    width: 10%;
    font-size: 11px;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-member-table--mobile .gc-fed-member-table__numeric {
    font-size: 11px;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-member-table--mobile .gc-fed-member-table__numeric--planets {
    width: 10%;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-member-table--mobile .gc-fed-member-table__numeric--power {
    width: 18%;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-member-table--mobile .gc-fed-member-table__numeric--log {
    width: 14%;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-member-table--mobile .gc-fed-member-table__action {
    width: 14%;
    padding: 2px 4px;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-member-actions {
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: stretch;
    width: 100%;
    min-width: 0;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-member-actions__note {
    display: block;
    font-size: 9px;
    line-height: 1.2;
    color: var(--text-muted);
    text-align: center;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-member-actions input[type="button"] {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 5px 6px;
    font-size: 11px;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-member-table--mobile.gc-fed-member-table--applicants .gc-fed-member-table__empire {
    width: 29%;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-member-table--mobile.gc-fed-member-table--applicants .gc-fed-member-table__action {
    width: 29%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-war-grid table.Default.gc-fed-war-table {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box;
  }
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-prev-table tr > td:nth-child(1) {
  width: 30%;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-prev-table tr > td:nth-child(2) {
  width: 27%;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-prev-table tr > td:nth-child(3) {
  width: 27%;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-prev-table tr > td:nth-child(4) {
  width: 16%;
  white-space: nowrap;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-prev-pager {
  margin-right: 4px !important;
}

/* =========================================================
   COLONY LIST (f_com_col)
   ========================================================= */
body[data-theme="classic"] .gc-colony-page {
  width: auto;
  max-width: none;
  padding: 0;
}

body[data-theme="classic"] .gc-colony-build-form {
  display: block;
  width: auto;
  max-width: none;
  margin: 0;
}

body[data-theme="classic"] .gc-colony-list-page,
body[data-theme="classic"] .gc-colony-detail-modern {
  display: none !important;
}

body[data-theme="classic"] table.Default.gc-colony-list-table,
body[data-theme="classic"] table.Default.gc-colony-list-mobile-table,
body[data-theme="classic"] table.Default.gc-colony-detail-table,
body[data-theme="classic"] table.Default.gc-colony-mobile-table,
body[data-theme="classic"] table.Default.gc-colony-build-result-table {
  display: table !important;
  width: auto;
  max-width: none;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
}

body[data-theme="classic"] table.Default.gc-colony-list-table thead,
body[data-theme="classic"] table.Default.gc-colony-list-mobile-table thead,
body[data-theme="classic"] table.Default.gc-colony-detail-table thead,
body[data-theme="classic"] table.Default.gc-colony-mobile-table thead,
body[data-theme="classic"] table.Default.gc-colony-build-result-table thead {
  display: table-header-group !important;
}

body[data-theme="classic"] table.Default.gc-colony-list-table tbody,
body[data-theme="classic"] table.Default.gc-colony-list-mobile-table tbody,
body[data-theme="classic"] table.Default.gc-colony-detail-table tbody,
body[data-theme="classic"] table.Default.gc-colony-mobile-table tbody,
body[data-theme="classic"] table.Default.gc-colony-build-result-table tbody {
  display: table-row-group !important;
}

body[data-theme="classic"] table.Default.gc-colony-list-table tfoot,
body[data-theme="classic"] table.Default.gc-colony-list-mobile-table tfoot,
body[data-theme="classic"] table.Default.gc-colony-detail-table tfoot,
body[data-theme="classic"] table.Default.gc-colony-mobile-table tfoot,
body[data-theme="classic"] table.Default.gc-colony-build-result-table tfoot {
  display: table-footer-group !important;
}

body[data-theme="classic"] table.Default.gc-colony-list-table tr,
body[data-theme="classic"] table.Default.gc-colony-list-mobile-table tr,
body[data-theme="classic"] table.Default.gc-colony-detail-table tr,
body[data-theme="classic"] table.Default.gc-colony-mobile-table tr,
body[data-theme="classic"] table.Default.gc-colony-build-result-table tr {
  display: table-row !important;
  height: auto !important;
}

body[data-theme="classic"] table.Default.gc-colony-list-table th,
body[data-theme="classic"] table.Default.gc-colony-list-table td,
body[data-theme="classic"] table.Default.gc-colony-list-mobile-table th,
body[data-theme="classic"] table.Default.gc-colony-list-mobile-table td,
body[data-theme="classic"] table.Default.gc-colony-detail-table th,
body[data-theme="classic"] table.Default.gc-colony-detail-table td,
body[data-theme="classic"] table.Default.gc-colony-mobile-table th,
body[data-theme="classic"] table.Default.gc-colony-mobile-table td,
body[data-theme="classic"] table.Default.gc-colony-build-result-table th,
body[data-theme="classic"] table.Default.gc-colony-build-result-table td {
  display: table-cell !important;
  width: auto !important;
  height: auto !important;
  max-width: none !important;
  vertical-align: middle;
}

body[data-theme="classic"] table.Default.gc-colony-list-table img,
body[data-theme="classic"] table.Default.gc-colony-list-mobile-table img,
body[data-theme="classic"] table.Default.gc-colony-detail-table img,
body[data-theme="classic"] table.Default.gc-colony-mobile-table img,
body[data-theme="classic"] table.Default.gc-colony-build-result-table img {
  display: inline-block;
  width: auto !important;
  height: auto !important;
  max-width: none !important;
}

body[data-theme="classic"] .gc-colony-detail-classic,
body[data-theme="classic"] .gc-colony-detail-classic__left,
body[data-theme="classic"] .gc-colony-detail-classic__right {
  box-sizing: border-box;
  min-width: 0;
}

body[data-theme="classic"] .gc-colony-detail-classic {
  width: 100% !important;
  max-width: 100% !important;
}

body[data-theme="classic"] .gc-colony-detail-classic__left,
body[data-theme="classic"] .gc-colony-detail-classic__right {
  overflow: hidden;
}

body[data-theme="classic"] .gc-colony-detail-classic table.Default.gc-colony-detail-table {
  width: 100% !important;
  max-width: 100% !important;
}

body[data-theme="classic"] .gc-colony-detail-classic table.Default.gc-colony-detail-table--form,
body[data-theme="classic"] .gc-colony-detail-classic__right table.Default.gc-colony-detail-table {
  table-layout: fixed;
}

body[data-theme="classic"] .gc-colony-detail-classic table.Default.gc-colony-detail-table td {
  max-width: 100% !important;
  overflow-wrap: anywhere;
}

body[data-theme="classic"] .gc-colony-detail-classic__infra-row > td:nth-child(1) {
  width: 69% !important;
}

body[data-theme="classic"] .gc-colony-detail-classic__infra-row > td:nth-child(2) {
  width: 1% !important;
  white-space: nowrap;
  text-align: left;
}

body[data-theme="classic"] .gc-colony-detail-classic__infra-row > td:nth-child(3) {
  width: 30% !important;
  text-align: right;
}

body[data-theme="classic"] .gc-colony-detail-classic__right table.Default.gc-colony-detail-table img.pic {
  max-width: 100% !important;
  height: auto !important;
}


@media (min-width: 768px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-list-table tbody tr > td:nth-child(3),
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-list-table thead tr > td:nth-child(3),
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-list-table tbody tr > td:nth-child(4),
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-list-table thead tr > td:nth-child(4),
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-list-table tbody tr > td:last-child,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-list-table thead tr > td:last-child {
    white-space: nowrap;
  }
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-detail-table tr.Header td,
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-detail-table thead td,
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-mobile-table tr.Header td,
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-mobile-table thead td {
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-detail-table tbody td,
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-detail-table tbody td * {
  letter-spacing: 0 !important;
  text-transform: none !important;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-detail-table .gc-colony-manage-title {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-build-form {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-build-form > table.Default.gc-colony-detail-table,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-build-form > table.Default.gc-colony-mobile-table {
  width: 100% !important;
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  box-sizing: border-box;
}

@media (max-width: 767.98px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.kv.gc-colony-mobile-table {
    table-layout: fixed;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.kv.gc-colony-mobile-table tbody td:first-child {
    width: 42%;
    min-width: 0;
    white-space: normal;
    line-height: 1.2;
    text-align: left;
    letter-spacing: 0;
    text-transform: none;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-mobile-table tbody td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-mobile-table tbody td * {
    letter-spacing: 0 !important;
    text-transform: none !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.kv.gc-colony-mobile-table tbody td:last-child {
    width: 58%;
    overflow-wrap: anywhere;
    text-align: left;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-mobile-table--actions td {
    text-align: center;
  }
}

/* =========================================================
   INTEL / COLONY / PROJECT MOBILE TABLES
   Target the actual legacy tables, not just their wrappers,
   so auto-inserted thead/tbody sections do not shrink to content.
   Mirrors the direct-table strategy used by research.
   ========================================================= */
@media (max-width: 767.98px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-page .gc-colony-page__mobile {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
    box-sizing: border-box;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-mobile-table,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-build-result-table,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-disband-mobile-table,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-project-mobile-table,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-project-detail-mobile-table,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-list-mobile-table {
    display: table !important;
    overflow-x: visible;
    width: calc(100vw - 16px) !important;
    max-width: calc(100% - 16px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box;
    table-layout: auto;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-project-mobile-table,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-project-detail-mobile-table,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-list-mobile-table,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-build-result-table,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-mobile-table {
    width: calc(100% - 16px) !important;
    max-width: calc(100% - 16px) !important;
    margin-left: 4px !important;
    margin-right: 4px !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-disband-mobile-table {
    width: calc(100% - 8px) !important;
    max-width: calc(100% - 8px) !important;
    margin-left: 2px !important;
    margin-right: 2px !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-mobile-table thead,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-build-result-table thead,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-disband-mobile-table thead,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-project-mobile-table thead,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-project-detail-mobile-table thead,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-list-mobile-table thead {
    display: table-header-group !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-mobile-table tbody,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-build-result-table tbody,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-disband-mobile-table tbody,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-project-mobile-table tbody,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-project-detail-mobile-table tbody,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-list-mobile-table tbody {
    display: table-row-group !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-mobile-table tr,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-build-result-table tr,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-disband-mobile-table tr,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-project-mobile-table tr,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-project-detail-mobile-table tr,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-list-mobile-table tr {
    display: table-row !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-mobile-table th,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-mobile-table td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-build-result-table th,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-build-result-table td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-disband-mobile-table th,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-disband-mobile-table td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-project-mobile-table th,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-project-mobile-table td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-project-detail-mobile-table th,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-project-detail-mobile-table td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-list-mobile-table th,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-list-mobile-table td {
    display: table-cell !important;
    box-sizing: border-box;
    min-width: 0;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-project-mobile-table--list,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-project-detail-mobile-table,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-mobile-table--form {
    table-layout: fixed;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-project-mobile-table--list tr > td:nth-child(1) {
    width: 44%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-project-mobile-table--list tr > td:nth-child(2) {
    width: 24%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-project-mobile-table--list tr > td:nth-child(3) {
    width: 32%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-mobile-table--form tr > td:nth-child(1) {
    width: 62%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-mobile-table--form tr > td:nth-child(2) {
    width: 12%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-mobile-table--form tr > td:nth-child(3) {
    width: 26%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-mobile-table {
    width: calc(100% - 14px) !important;
    max-width: calc(100% - 14px) !important;
    margin-left: 7px !important;
    margin-right: 7px !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-page .gc-colony-page__mobile > table.Default.gc-colony-mobile-table,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-page .gc-colony-page__mobile > .gc-colony-build-form > table.Default.gc-colony-mobile-table {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-page table.Default.gc-colony-build-result-table {
    width: calc(100% - 20px) !important;
    max-width: calc(100% - 20px) !important;
    margin-left: 10px !important;
    margin-right: 10px !important;
    display: table !important;
    overflow-x: visible;
    box-sizing: border-box;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-mobile-table .gc-colony-manage-title {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-project-detail-mobile-table tr > td:nth-child(1) {
    width: 20%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-project-detail-mobile-table tr > td:nth-child(2) {
    width: 40%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-project-detail-mobile-table tr > td:nth-child(3) {
    width: 40%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-list-mobile-table {
    table-layout: fixed;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-list-mobile-table td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-list-mobile-table th {
    padding-left: 3px !important;
    padding-right: 3px !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-list-mobile-table tbody tr > td:nth-child(1) {
    width: 8px;
    padding-left: 1px !important;
    padding-right: 1px !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-list-mobile-table tbody tr > td:nth-child(2) {
    width: 12px;
    padding-left: 1px !important;
    padding-right: 1px !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-list-mobile-table tbody tr > td:nth-child(3) {
    width: 10%;
    text-align: left;
    font-size: 12px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-list-mobile-table tbody tr > td:nth-child(4) {
    width: 14%;
    text-align: left;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-list-mobile-table tbody tr > td:nth-child(5) {
    width: 16%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-list-mobile-table tbody tr > td:nth-child(6) {
    width: 25%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-list-mobile-table tbody tr > td:nth-child(7) {
    width: 16%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-list-mobile-table thead tr > td:first-child {
    width: 40px;
    padding-left: 1px !important;
    padding-right: 1px !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-list-mobile-table thead tr > td:nth-child(2) {
    width: 26%;
    text-align: left;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-list-mobile-table thead tr > td:nth-child(3) {
    width: 21%;
    text-align: left;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-list-mobile-table thead tr > td:nth-child(4) {
    width: 10%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-list-mobile-table thead tr > td:nth-child(5) {
    width: 15%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-list-mobile-table thead tr > td:nth-child(6) {
    width: 8%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-colony-list-mobile-table tbody tr > td:nth-child(6) {
    width: 13%;
  }
}

/* =========================================================
   MULTIPLE PLUNDER PREVIEW (f_com_col_plunder2)
   Nebula/Daylight get a compact summary and a dedicated
   mobile table that drops non-critical columns instead of
   forcing horizontal scroll. Classic stays untouched.
   ========================================================= */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-plunder-page {
  padding-bottom: 12px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-plunder-summary {
  width: min(80%, 980px);
  margin: 0 auto 14px;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.85fr);
  gap: 8px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-plunder-summary__card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-surface) 92%, transparent), color-mix(in srgb, var(--bg-surface-2) 94%, transparent));
  box-shadow: var(--shadow-sm);
  text-align: left;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-plunder-summary__card--credit {
  border-color: color-mix(in srgb, var(--accent-good) 42%, var(--border));
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-plunder-summary__card--turns {
  border-color: color-mix(in srgb, var(--accent) 36%, var(--border));
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-plunder-summary__label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-plunder-summary__value {
  font-family: var(--font-display);
  font-size: clamp(22px, 3vw, 31px);
  line-height: 1;
  color: var(--text-primary);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-plunder-summary__card--credit .gc-plunder-summary__value {
  color: var(--accent-good);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-plunder-summary__hint {
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-plunder-list-table {
  width: min(80%, 980px) !important;
  max-width: 100%;
  margin-left: auto !important;
  margin-right: auto !important;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-plunder-list-table tr.Header td,
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-plunder-list-mobile-table tr.Header td {
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-plunder-note {
  width: min(80%, 980px) !important;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-plunder-actions {
  margin-bottom: 0;
}

/* Multi infect / assimilate (f_com_change2.cfm) reuses the plunder preview
   shell, but its selection can contain colonies that cannot be converted --
   already-converted planets of your own race, Similare C.5, and the two C.1
   types that map nowhere. Those rows stay listed so the selection still reads
   back accurately, just marked as taking no part in the action. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-change-row--skip {
  opacity: 0.55;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-change-skiptag {
  margin-left: 4px;
  padding: 0 5px;
  border: 1px solid color-mix(in srgb, var(--text-muted) 45%, transparent);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Classic keeps its plain table, so just dim the row there too. */
body[data-theme="classic"] .gc-change-row--skip,
.gc-change-row--skip {
  opacity: 0.6;
}

.gc-change-skiptag {
  font-size: 0.8em;
  text-transform: uppercase;
  opacity: 0.85;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-plunder-confirm-page {
  padding-bottom: 12px;
}

@media (max-width: 767.98px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-plunder-summary,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-plunder-note {
    width: calc(100% - 14px) !important;
    max-width: calc(100% - 14px) !important;
    margin-left: 7px !important;
    margin-right: 7px !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-plunder-summary {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.85fr);
    gap: 8px;
    margin-bottom: 10px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-plunder-summary__card {
    min-width: 0;
    padding: 10px 12px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-plunder-summary__value {
    font-size: clamp(18px, 6.4vw, 26px);
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-plunder-summary__hint {
    font-size: 10px;
    line-height: 1.2;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-plunder-confirm-page table.Default.gc-plunder-confirm-table {
    display: table !important;
    overflow-x: visible;
    width: calc(100% - 20px) !important;
    max-width: calc(100% - 20px) !important;
    margin-left: 10px !important;
    margin-right: 10px !important;
    box-sizing: border-box;
    table-layout: auto;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-plunder-confirm-page table.Default.gc-plunder-confirm-table tbody {
    display: table-row-group !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-plunder-confirm-page table.Default.gc-plunder-confirm-table tr {
    display: table-row !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-plunder-confirm-page table.Default.gc-plunder-confirm-table td {
    display: table-cell !important;
    box-sizing: border-box;
    min-width: 0;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-plunder-list-mobile-table {
    table-layout: fixed;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-plunder-list-mobile-table td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-plunder-list-mobile-table th {
    padding-left: 3px !important;
    padding-right: 3px !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-plunder-list-mobile-table tbody tr > td:nth-child(1) {
    width: 26px;
    padding-left: 2px !important;
    padding-right: 2px !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-plunder-list-mobile-table tbody tr > td:nth-child(2) {
    width: 28%;
    text-align: left;
    font-size: 12px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-plunder-list-mobile-table tbody tr > td:nth-child(3) {
    width: 24%;
    font-size: 11px;
    line-height: 1.15;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-plunder-list-mobile-table tbody tr > td:nth-child(4),
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-plunder-list-mobile-table tbody tr > td:nth-child(5),
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-plunder-list-mobile-table tbody tr > td:nth-child(6) {
    width: 16%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-plunder-list-mobile-table thead tr > td:nth-child(1) {
    width: 26px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-plunder-list-mobile-table thead tr > td:nth-child(2) {
    width: 28%;
    text-align: left;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-plunder-list-mobile-table thead tr > td:nth-child(3) {
    width: 24%;
    text-align: left;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-plunder-list-mobile-table thead tr > td:nth-child(4),
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-plunder-list-mobile-table thead tr > td:nth-child(5),
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-plunder-list-mobile-table thead tr > td:nth-child(6) {
    width: 16%;
  }
}

@media (max-width: 640px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-list tr.Header td {
    font-size: 7px;
    letter-spacing: 0.06em;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-list tr:not(.Header) td {
    padding: 3px 2px;
    font-size: 10px;
    line-height: 1.05;
  }






  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-list__power-full {
    display: none;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-list__power-abbrev {
    display: inline;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-list__hdr-full {
    display: none;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-list__hdr-mobile {
    display: inline;
    color: inherit;
    line-height: 1;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-list__hdr-mobile svg {
    display: block;
    width: 10px;
    height: 10px;
    margin: 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
}

/* Strip legacy inline ridge/solid borders applied on the page via style=""
   (common pattern: style="border: 3px solid rgba(38,35,53,0.5)"). We win
   via specificity + !important without editing 80+ .cfm files. */
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default[style*="border"] {
  border: 1px solid var(--border) !important;
}


/* =========================================================
   INCOME / UPKEEP LEDGER
   Modern template used on f_com_income.cfm for Nebula and
   Daylight only. Classic keeps the legacy table layout.

   Layout: mobile-first, single-viewport target.
     1. Hero P/L (2 stat cards, color-coded by sign)
     2. Income / Expenses side-by-side (stack on narrow)
     3. Each row: label + bold total, calc breakdown below
        in muted mono. No redundant empty cells.
   ========================================================= */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-income-page {
  display: grid;
  gap: 10px;
  max-width: 900px;
  margin: 0 auto 8px;
}

/* -------- Hero P/L -------- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-income-hero {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 8px;
}
@media (max-width: 520px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-income-hero {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-income-hero__card,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-hero__card {
  position: relative;
  overflow: hidden;
  padding: 10px 14px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
/* Sign accent strip on the leading edge */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-income-hero__card::before,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-hero__card::before {
  content: none;
}
/* Atmospheric glow in the corner — dimmer on Daylight */
body[data-theme="nebula"] .gc-income-hero__card::after,
body[data-theme="nebula"] .gc-hero__card::after {
  content: "";
  position: absolute;
  top: -60px; right: -60px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.06), transparent 70%);
  pointer-events: none;
}
body[data-theme="daylight"] .gc-income-hero__card::after,
body[data-theme="daylight"] .gc-hero__card::after {
  content: "";
  position: absolute;
  top: -60px; right: -60px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(30, 58, 138, 0.05), transparent 70%);
  pointer-events: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-income-hero__label,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-hero__label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-nebula);
  line-height: 1.2;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-income-hero__value,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-hero__value {
  font-family: var(--font-display);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  font-size: clamp(22px, 4.2vw, 34px);
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--text-primary);
  word-break: break-all;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-income-hero__card--primary .gc-income-hero__value {
  font-size: clamp(26px, 5.2vw, 40px);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-income-hero__card--positive .gc-income-hero__value {
  color: var(--accent-good);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-income-hero__card--negative .gc-income-hero__value {
  color: var(--accent-hot);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-income-hero__hint,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-hero__hint {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

/* -------- Ledger sections -------- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-income-ledger {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
@media (max-width: 640px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-income-ledger {
    grid-template-columns: 1fr;
  }
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-income-section {
  position: relative;
  padding: 10px 12px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-income-section--credits {
  border-top: 1px solid var(--border);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-income-section--debits {
  border-top: 1px solid var(--border);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-income-section--resources {
  grid-column: 1 / -1;
  border-top: 1px solid var(--border);
}

body[data-theme="nebula"] .gc-income-section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 6px;
  padding: 0 0 6px;
  border-bottom: 1px dashed var(--border-strong);
}
body[data-theme="daylight"] .gc-income-section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 6px;
  padding: 0 0 6px;
  border-bottom: 1px dashed rgba(143, 91, 53, 0.35);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-income-section__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--text-primary);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-income-section__total {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-income-section--credits .gc-income-section__total {
  color: var(--accent-good);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-income-section--debits .gc-income-section__total {
  color: var(--accent-hot);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-income-section--resources .gc-income-section__total {
  color: var(--accent-good);
}

/* -------- Rows -------- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-ledger {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-ledger__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  column-gap: 10px;
  row-gap: 0;
  margin: 0;
  padding: 5px 0 5px;
  border-bottom: 1px solid var(--border);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-ledger__row:last-child {
  border-bottom: 0;
  padding-bottom: 2px;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-ledger__label {
  grid-column: 1;
  margin: 0;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.25;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-ledger__actual {
  grid-column: 2;
  margin: 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  white-space: nowrap;
  text-align: right;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-ledger__calc {
  grid-column: 1 / -1;
  margin: 1px 0 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  line-height: 1.3;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-ledger__calc em {
  font-style: normal;
  color: var(--text-secondary);
  margin: 0 3px;
  opacity: 0.8;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-ledger__pct {
  margin-left: 1px;
  opacity: 0.65;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-ledger__empty {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 400;
  font-style: italic;
  color: var(--text-muted);
  letter-spacing: 0;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) :is(.gc-ledger__row--mineral-detail, .gc-ledger__row--detail) {
  border-bottom: 0;
  padding-top: 2px;
  padding-bottom: 2px;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) :is(.gc-ledger__row--mineral-detail, .gc-ledger__row--detail) .gc-ledger__label {
  padding-left: 10px;
  color: var(--text-secondary);
}
/* The mineral breakdown is always last in the ledger, so dropping its bottom
   border is free. The raw-material breakdown sits mid-list, so its final row
   has to put the separator back or it runs straight into the Minerals row. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-ledger__row--detail-end {
  border-bottom: 1px solid var(--border);
  padding-bottom: 5px;
}

tr.gc-resource-mineral-row td {
  border-top: 0 !important;
  border-bottom: 0 !important;
}

/* Footer helper text under the ledger */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-income-page + .smallfont {
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-muted);
}

/* Mobile tightening — trim hero padding so everything fits one view */
@media (max-width: 520px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-income-hero__card,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-hero__card {
    padding: 8px 12px 9px;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-income-section {
    padding: 8px 10px 9px;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-ledger__row {
    padding: 4px 0;
  }
}


/* =========================================================
   NEBULA HEADER BAND — tighter vertical rhythm + shrunk logo
   ---------------------------------------------------------
   Scoped to nebula so Classic keeps its original dimensions.
   Collapses the inline margin-tops coming from s_loadbar.cfm
   and caps the banner image height so the nav feels compact.
   ========================================================= */

/* Kill the 1% top margin on <section id="blog"> inline style. */
body[data-theme="nebula"] #blog {
  margin-top: 0 !important;
}

/* Tighten the .icon-bar wrappers (banner + pill nav). Both carry
   an inline margin-top: 0.5% from s_loadbar.cfm — collapse those. */
body[data-theme="nebula"] .icon-bar {
  margin-top: 0 !important;
}

/* The banner img lives inside <ul class="icon-bar gc-header-logo">.
   Default ul padding from main.css is 0 already, but browsers vary;
   make the header logo row compact and centered. */
body[data-theme="nebula"] ul.gc-header-logo {
  padding: 8px 0 2px !important;
  margin-bottom: 0 !important;
  min-height: 0;
  height: auto;
  background:
    radial-gradient(ellipse 50% 80% at 50% 100%,
      rgba(14, 165, 233, 0.05),
      transparent 70%);
}

/* Shrunk logo on Nebula — natural is 797×67, cap to ~44px tall. */
body[data-theme="nebula"] img.gc-logo {
  max-height: 44px;
  width: auto;
  height: auto;
  display: inline-block;
  filter: drop-shadow(0 2px 10px rgba(14, 165, 233, 0.15));
}

/* Pull the pill nav flush against the logo band. */
body[data-theme="nebula"] ul.buttonN-group {
  margin: 6px auto 0 !important;
}

/* Main content column: the inline rule is
   padding-top:5px; min-height:77.5vh; border:6px ridge #020C1C;
   theme.css already rewrites the border. Tighten pad / min-height
   so short pages don't feel bottom-heavy on Nebula. */
body[data-theme="nebula"] .col-lg-8.col-sm-12 {
  padding-top: 2px !important;
  min-height: 60vh !important;
}
body[data-theme="nebula"] .col-lg-8.col-sm-12 .col-lg-8.col-sm-12 {
  padding-top: 0 !important;
  min-height: 0 !important;
}

/* Sidebar (right column) also carried that min-height feel via
   its inline ridge border; theme.css restyles it. No change needed. */

/* Tighten the yellow msg header wrapper vertical. */
body[data-theme="nebula"] #header {
  margin: 0 auto !important;
}
body[data-theme="nebula"] #header .navbar {
  margin-bottom: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}
body[data-theme="nebula"] #topnavbar {
  margin: 2px auto !important;
  padding: 4px 12px !important;
}

/* Resource bar sits inside the content column — on Nebula we want
   the stat/action pills to feel like they float in the main div
   instead of living in a bordered card. Kill the container chrome
   but keep display/grid intact; inner .gc-stat and .gc-action keep
   their own pill styling so they look like individual floating chips. */
body[data-theme="nebula"] .gc-resourcebar {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0;
  /* Inner .row (i_f_800.cfm) has Bootstrap's -15px gutters which would
     otherwise push pills past .col-lg-8's 6px ridge border. Add side
     margins to absorb the negative row gutter so the bar stays inside
     the container (invisibly — no bg/border). Also ensure the bar
     spans the available width so stats + actions lay out edge-to-edge. */
  margin: 2px 5px 5px;
  width: auto;
  flex: 1 1 auto;
  /* Let stats shrink properly so actions column doesn't squeeze them. */
  grid-template-columns: minmax(0, 1fr) auto;
}
/* Inner stats grid: enforce a per-column minimum so pills can't
   collapse and overlap when the main column is narrower. */
body[data-theme="nebula"] .gc-resourcebar__stats {
  grid-template-columns: repeat(4, minmax(72px, 1fr)) !important;
  gap: 4px;
  min-width: 0;
}
body[data-theme="classic"] .gc-resourcebar__stats,
body[data-theme="daylight"] .gc-resourcebar__stats {
  gap: 4px;
  min-width: 0;
}
/* Tighten individual stat pills on Nebula so 4 still fit comfortably,
   and center label/value like the mobile stats strip does. */
body[data-theme="nebula"] .gc-stat {
  background:
    linear-gradient(180deg,
      rgba(255, 240, 210, 0.02) 0%,
      rgba(255, 255, 255, 0.006) 32%,
      rgba(255, 255, 255, 0) 100%),
    var(--bg-elevated);
  border-color: var(--border);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    0 8px 20px rgba(0, 0, 0, 0.22);
  padding: 2px 4px;
  align-items: center;
  text-align: center;
}
body[data-theme="nebula"] .gc-stat__value {
  font-size: 15px;
}
body[data-theme="classic"] .gc-stat__value,
body[data-theme="daylight"] .gc-stat__value {
  font-size: 15px;
}

/* Abbreviation vs. full-number display.
   - Default (tablet + mobile-visible card range): show the abbreviated form.
   - Desktop (>= 992px, where col-lg-8 is wide enough): show the full
     grouped number up to 5T (e.g. "5,000,000,000,000"), shrink the
     font so it fits inside a stat pill without ellipsis. */
.gc-stat__num-full { display: none; }
.gc-stat__num-abbrev { display: inline; }

@media (min-width: 992px) {
  .gc-stat__num-full { display: inline; }
  .gc-stat__num-abbrev { display: none; }

  body[data-theme="nebula"] .gc-stat__value,
  body[data-theme="classic"] .gc-stat__value,
  body[data-theme="daylight"] .gc-stat__value {
    font-size: 13px;
    letter-spacing: 0.02em;
    margin-top: 1px;
  }
  body[data-theme="nebula"] .gc-stat__label,
  body[data-theme="classic"] .gc-stat__label,
  body[data-theme="daylight"] .gc-stat__label {
    font-size: 10px;
    letter-spacing: 0.14em;
  }

  /* Weighted columns based on each stat's realistic max digit count:
       Cash   5T   (17 chars) → widest
       Food   25B  (14 chars)
       Power  1.2B (13 chars)
       Turns  1000 (5 chars)  → narrowest
       */
  .gc-resourcebar__stats {
    grid-template-columns:
      minmax(168px, 1.75fr)
      minmax(128px, 1.3fr)
      minmax(104px, 1.0fr)
      minmax(56px, 0.5fr);
  }

  .gc-stat {
    padding: 2px 4px;
  }

  .gc-resourcebar__actions {
    gap: 3px;
  }

  .gc-action {
    gap: 8px;
    padding: 2px 8px;
  }

  body[data-theme="nebula"] .gc-stat {
    padding: 2px 6px;
  }

  body[data-theme="nebula"] .gc-resourcebar__stats {
    grid-template-columns:
      minmax(168px, 1.75fr)
      minmax(128px, 1.3fr)
      minmax(104px, 1.0fr)
      minmax(56px, 0.5fr)
      !important;
  }

  body[data-theme="nebula"] .gc-stat--turns .gc-stat__value {
    color: var(--stat-turns);
    font-weight: 600;
    font-size: 14px;
  }

  body[data-theme="nebula"] .gc-resourcebar {
    margin: 2px 6px 6px;
  }
}


/* =========================================================
   NEBULA — UNIFORM PILL NAV
   ---------------------------------------------------------
   main.css gives the first/last .buttonN in a .buttonN-group
   flat inner corners (the classic "segmented button" look).
   For Nebula we want every pill identical — each one a
   discrete rounded chip. Classic keeps the segmented look.
   ========================================================= */
body[data-theme="nebula"] .buttonN-group > .buttonN,
body[data-theme="nebula"] .buttonN-group > li > .buttonN,
body[data-theme="nebula"] .buttonN-group li:first-child .buttonN,
body[data-theme="nebula"] .buttonN-group li:last-child .buttonN,
body[data-theme="nebula"] .buttonN-group > .buttonN:first-child,
body[data-theme="nebula"] .buttonN-group > .buttonN:last-child {
  border-radius: var(--radius-md) !important;
  margin-left: 0 !important;
}


/* =========================================================
   NEBULA — BANNER BLEND (top atmospheric wash)
   ---------------------------------------------------------
   Extend the banner's palette (indigo / ion / gas / gold) into the space around logo + pill nav so
   the image doesn't feel dropped on a plain page. Kept subtle
   and fades out well before the content column so pages below
   the fold stay neutral.
   ========================================================= */

/* Drop the small local glow on the logo ul — it's replaced
   by a larger gradient on #blog below. */
body[data-theme="nebula"] ul.gc-header-logo {
  background: none;
}

/* Atmospheric wash behind the top header band. */
body[data-theme="nebula"] #blog {
  position: relative;
}
body[data-theme="nebula"] #blog::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 180px;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 62% 132px at 50% 0%,
      rgba(14, 165, 233, 0.05), transparent 76%),
    radial-gradient(ellipse 40% 100px at 18% 8%,
      rgba(91, 155, 181, 0.04), transparent 72%),
    radial-gradient(ellipse 28% 84px at 76% 14%,
      rgba(212, 162, 78, 0.035), transparent 72%),
    radial-gradient(ellipse 30% 88px at 24% 18%,
      rgba(255, 255, 255, 0.025), transparent 74%);
}
/* Keep header band content above the gradient. */
body[data-theme="nebula"] #blog > * {
  position: relative;
  z-index: 1;
}

/* Hairline gradient divider below the pill nav — subtle warm/cool. */
body[data-theme="nebula"] ul.buttonN-group {
  padding-bottom: 10px;
  background:
    linear-gradient(90deg,
      transparent 10%,
      rgba(91, 155, 181, 0.1) 32%,
      rgba(14, 165, 233, 0.16) 50%,
      rgba(91, 155, 181, 0.1) 68%,
      transparent 90%) no-repeat bottom / 100% 1px;
}


/* =========================================================
   NEBULA — WIDER LEFT NAV COLUMN
   ---------------------------------------------------------
   Default Bootstrap col-lg-2 = 16.67%. Links like "Manage
   Colonies" and "Important Events" wrap at that width. The
   left-nav .col-lg-2 is nested inside a .mobileHide wrapper
   which IS the flex item in .row — so we size the wrapper
   and let the inner column fill it. Classic grid stays 2/8/2.

   From 1200px, not 992px: below 1200 app-shell.css hides both side
   columns, and a 64% cap there pinned the lone main column to the left
   with an empty third beside it (992-1199px).
   ========================================================= */
@media (min-width: 992px) {
  /* Left nav wrapper (.mobileHide around the .col-lg-2).
     Scope via :has() so sibling .gc-resourcebar.mobileHide (also a
     direct child of .row) is NOT sized to 19%. */
  body[data-theme="nebula"] .row > .mobileHide:has(> .col-lg-2) {
    flex: 0 0 19%;
    max-width: 19%;
  }
  body[data-theme="nebula"] .row > .mobileHide:has(> .col-lg-2) > .col-lg-2 {
    flex: 0 0 100%;
    max-width: 100%;
  }
  /* Main column shrinks to compensate. */
  body[data-theme="nebula"] .col-lg-8.col-sm-12 {
    flex: 0 0 64%;
    max-width: 64%;
  }
  body[data-theme="nebula"] .col-lg-8.col-sm-12 .col-lg-8.col-sm-12 {
    flex: 0 0 100%;
    max-width: 100%;
  }
  /* Right sidebar shrinks slightly. */
  body[data-theme="nebula"] .col-lg-2.app-desktop-only {
    flex: 0 0 17%;
    max-width: 17%;
  }
}

/* =========================================================
   ATTACK PAGE (Nebula / Daylight)
   Keep legacy tables readable without the global instrument
   header treatment used by other modernized pages.
   ========================================================= */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-page table.Default tr.Header td,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-page table.Default tr.Header th,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-page table.Default thead td,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-page table.Default thead th {
  font-family: var(--font-body);
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-page table.Default.kv tbody td:first-child,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-page table.Default.kv td:first-child {
  font-family: var(--font-body);
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
}

@media (max-width: 767.98px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .col-lg-8.col-sm-12:has(.gc-attack-page) {
    width: calc(100% - 16px) !important;
    max-width: calc(100% - 16px) !important;
    margin-left: 8px !important;
    margin-right: 8px !important;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-page {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    float: none !important;
    width: calc(100% - 32px) !important;
    max-width: calc(100% - 32px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 0;
    padding-right: 0;
    overflow-x: hidden;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-page .com-attack-title {
    margin-top: 2px !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
    line-height: 1;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-page .com-attack-title .yellowfont {
    line-height: 1;
    display: inline-block;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-page .com-attack-controls-row {
    order: 1;
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-top: -28px !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-page .com-attack-controls {
    width: 100%;
    max-width: 100%;
    flex: 0 0 100%;
    box-sizing: border-box;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-page .com-attack-fleet-wrap {
    order: 2;
    width: 100%;
    max-width: 100%;
    margin: 10px auto 0;
    padding: 0;
    align-self: center;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-page .com-attack-fleet-note {
    order: 3;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-page .com-attack-help {
    order: 4;
    display: table !important;
    width: calc(100% - 24px) !important;
    max-width: calc(100% - 24px);
    margin-left: auto !important;
    margin-right: auto !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-page .com-attack-image,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-page .com-attack-desktop-spacer {
    display: none;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-page .com-attack-controls table.Default {
    display: table !important;
    width: 100% !important;
    max-width: 100%;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-page .com-attack-controls table.Default:first-of-type {
    margin-top: 0 !important;
    margin-bottom: 4px !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-page .com-attack-controls table.Default:first-of-type td {
    padding-top: 4px;
    padding-bottom: 4px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-page .com-attack-fleet-table {
    display: table !important;
    width: 100% !important;
    max-width: 100%;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box;
    table-layout: fixed;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-page .com-attack-fleet-table td {
    padding-left: 3px;
    padding-right: 3px;
    overflow-wrap: anywhere;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-page .com-attack-fleet-table td:nth-child(2) {
    width: 40%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-page .com-attack-fleet-table td:nth-child(3) {
    width: 18%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-page .com-attack-fleet-table td:nth-child(4) {
    width: 20%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-page .com-attack-fleet-table td:nth-child(6) {
    width: 22%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-page .com-attack-fleet__power-unit {
    display: none;
  }
}

/* =========================================================
   CONFIRM ATTACK PAGE (Nebula / Daylight)
   Compact confirmation tables with natural-case labels.
   ========================================================= */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-confirm-page table.Default tr.Header td,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-confirm-page table.Default tr.Header th {
  font-family: var(--font-body);
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-confirm-page table.Default.kv tbody td:first-child,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-confirm-page table.Default.kv td:first-child {
  font-family: var(--font-body);
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-confirm-page .com-attack-confirm-table {
  width: 82% !important;
  margin-left: auto !important;
  margin-right: auto !important;
  margin-bottom: 8px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-confirm-page .com-attack-confirm-table td {
  padding-top: 4px;
  padding-bottom: 4px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-confirm-page .com-attack-confirm-actions {
  margin-top: 2px !important;
}

@media (max-width: 767.98px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .col-lg-8.col-sm-12:has(.gc-attack-confirm-page) {
    width: calc(100% - 16px) !important;
    max-width: calc(100% - 16px) !important;
    margin-left: 8px !important;
    margin-right: 8px !important;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-confirm-page {
    box-sizing: border-box;
    float: none !important;
    width: calc(100% - 24px) !important;
    max-width: calc(100% - 24px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 0;
    padding-right: 0;
    overflow-x: hidden;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-confirm-page .com-attack-confirm-title {
    margin-top: 0 !important;
    margin-bottom: 2px !important;
    padding: 0 !important;
    line-height: 1;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-confirm-page .com-attack-confirm-title .yellowfont {
    display: inline-block;
    line-height: 1;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-confirm-page .com-attack-confirm-row {
    margin-top: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-confirm-page .com-attack-confirm-main {
    width: 100%;
    max-width: 100%;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-confirm-page .com-attack-confirm-table {
    display: table !important;
    width: 100% !important;
    max-width: 100%;
    margin: 0 auto 4px !important;
    table-layout: fixed;
    box-sizing: border-box;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-confirm-page .com-attack-confirm-table td {
    padding: 2px 6px;
    line-height: 1.15;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-confirm-page .com-attack-confirm-table tr.Header td {
    padding-top: 3px;
    padding-bottom: 3px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-confirm-page .com-attack-confirm-table td:first-child {
    width: 42% !important;
    white-space: nowrap;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-confirm-page .com-attack-confirm-table td:last-child {
    width: 58% !important;
    overflow-wrap: anywhere;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-confirm-page .com-attack-confirm-actions {
    margin-top: 0 !important;
    margin-bottom: 4px !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-confirm-page .com-attack-confirm-actions input[type="button"],
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-confirm-page .com-attack-confirm-actions input[type="submit"] {
    padding-top: 3px;
    padding-bottom: 3px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-confirm-page .com-attack-confirm-side {
    width: 100%;
    max-width: 100%;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-confirm-page .com-attack-confirm-side img.pic {
    display: none;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-confirm-page .com-attack-confirm-spacer {
    display: none;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-confirm-page .com-attack-confirm-notes {
    width: 100%;
    margin-top: 0 !important;
    line-height: 1.2;
    text-align: center;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-confirm-page .com-attack-confirm-notes br {
    display: none;
  }
}

/* =========================================================
   ATTACK RESULT PAGE (Nebula / Daylight)
   Modern result-first battle report; detailed log is last.
   ========================================================= */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page table.Default tr.Header td,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page table.Default tr.Header th {
  font-family: var(--font-body);
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .com-attack-result-title {
  display: table;
  width: auto !important;
  margin: 0 auto 10px !important;
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--text-primary);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .com-attack-result-title td {
  padding: 5px 12px;
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .com-attack-result-fleets {
  margin-left: 0;
  margin-right: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .com-attack-result-fleet-table,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .gc-battle-table,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .com-attack-result-log {
  margin-left: auto !important;
  margin-right: auto !important;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .com-attack-result-fleet-table td,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .gc-battle-table td {
  padding-top: 4px;
  padding-bottom: 4px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .com-attack-result-log-row {
  margin-left: 0;
  margin-right: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .com-attack-result-log {
  width: 82% !important;
  max-width: 820px;
  text-align: left !important;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .com-attack-result-log td {
  padding: 10px 12px;
  line-height: 1.35;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .com-attack-result-log b:first-child {
  display: block;
  margin-bottom: 6px;
  text-align: center;
  color: var(--accent);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .com-attack-result-actions {
  margin-top: 8px !important;
}

@media (min-width: 768px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .gc-battle-table {
    width: min(88%, 700px) !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .com-attack-result-fleets {
    width: min(96%, 980px);
    margin-left: auto;
    margin-right: auto;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .com-attack-result-fleet-col {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .com-attack-result-fleet-table {
    width: 100% !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .com-attack-result-log {
    width: min(92%, 860px) !important;
    max-width: 860px;
  }
}

@media (max-width: 767.98px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .col-lg-8.col-sm-12:has(.gc-attack-result-page) {
    width: calc(100% - 16px) !important;
    max-width: calc(100% - 16px) !important;
    margin-left: 8px !important;
    margin-right: 8px !important;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page {
    box-sizing: border-box;
    float: none !important;
    width: calc(100% - 24px) !important;
    max-width: calc(100% - 24px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    margin-top: 4px !important;
    padding-left: 0;
    padding-right: 0;
    overflow-x: hidden;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .com-attack-result-title {
    display: table !important;
    width: 100% !important;
    max-width: 100%;
    margin: 0 auto 6px !important;
    table-layout: fixed;
    font-size: 13px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .com-attack-result-title td {
    padding: 4px 6px;
    text-align: center !important;
    overflow-wrap: anywhere;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .com-attack-result-fleets {
    margin-top: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .com-attack-result-fleet-col {
    width: 100%;
    max-width: 100%;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .com-attack-result-fleet-table,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .gc-battle-table {
    display: table !important;
    width: 100% !important;
    max-width: 100%;
    margin: 0 auto 6px !important;
    table-layout: fixed;
    box-sizing: border-box;
    font-size: 12px !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .com-attack-result-fleet-table td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .gc-battle-table td {
    padding: 2px 3px;
    line-height: 1.15;
    overflow-wrap: anywhere;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .com-attack-result-fleet-table tr.Header td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .gc-battle-table tr.Header td {
    padding-top: 3px;
    padding-bottom: 3px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .com-attack-result-actions {
    margin-top: 2px !important;
    margin-bottom: 4px !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .com-attack-result-actions input[type="button"] {
    padding-top: 3px;
    padding-bottom: 3px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .com-attack-result-log-row {
    margin: 6px 0 0 !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .com-attack-result-log {
    display: table !important;
    width: 100% !important;
    max-width: 100%;
    margin: 0 auto !important;
    font-size: 11px;
    table-layout: fixed;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-attack-result-page .com-attack-result-log td {
    padding: 6px 7px;
    line-height: 1.25;
    overflow-wrap: anywhere;
  }
}

/* Attack range/protection errors render before attack3's page wrapper exists. */
@media (max-width: 767.98px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-attack-range-table {
    display: table !important;
    width: 100% !important;
    max-width: 100%;
    margin-left: auto !important;
    margin-right: auto !important;
    table-layout: fixed;
    box-sizing: border-box;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-attack-range-table td {
    padding-left: 3px;
    padding-right: 3px;
    overflow-wrap: anywhere;
  }
}

/* =========================================================
   PRIVATE MESSAGES — LIST (f_pm.cfm) + DETAIL (f_pm_d.cfm)
   + COMPOSER (f_pm_p.cfm / pop_msguser.cfm)
   Nebula + Daylight modern themes only. Classic untouched.
   ========================================================= */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sidechat,
body[data-theme="classic"] .gc-sidechat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  min-height: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sidechat__controls,
body[data-theme="classic"] .gc-sidechat__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12px;
  line-height: 1.2;
}

/* Disable / More reuse the chat page's .gc-chatnav__btn, sized for the column. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sidechat__controls .gc-chatnav__btn,
body[data-theme="classic"] .gc-sidechat__controls .gc-chatnav__btn {
  padding: 5px 10px;
  letter-spacing: 0.08em;
}

/* Inline chat composer (i_chat_compose.cfm) - side chat and f_com_msgsector.cfm.
   The Post button is a .gc-chatnav__btn, so each theme draws it like its others. */
.gc-chatcompose {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
  max-width: 640px;
  margin: 8px auto;
  box-sizing: border-box;
}

.gc-sidechat .gc-chatcompose {
  margin: 0;
}

.gc-chatcompose__input {
  flex: 1 1 0;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-surface-alt);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
}

.gc-chatcompose__input::placeholder {
  color: var(--text-muted);
}

.gc-chatcompose__input:focus {
  outline: none;
  border-color: var(--accent);
}

body[data-theme] .gc-chatcompose__btn.gc-chatnav__btn {
  flex: 0 0 auto;
  padding: 5px 12px;
  cursor: pointer;
}

/* main.css's `button:after` hover bar matches any <button>. */
.gc-chatcompose__btn::after {
  content: none;
}

body[data-theme="classic"] .gc-chatcompose__input {
  border-radius: 3px;
}

body[data-theme="classic"] .gc-chatcompose__btn.gc-chatnav__btn {
  font-family: var(--font-body);
}

.gc-chatcompose.is-busy {
  opacity: 0.6;
  pointer-events: none;
}

.gc-chatcompose__status {
  flex: 1 1 100%;
  font-size: 11px;
  line-height: 1.3;
  text-align: left;
  color: var(--accent-hot);
}

/* Same gap to the main column as the left nav, whose .icon-bar2 (85% wide,
   22.5% margin) leaves 15px - 7.5% x (column - 30px); both columns match. */
@media (min-width: 1200px) {
  #gc-side .sidebar-item {
    margin-left: calc(17.25px - 7.5%) !important;
  }
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sidechat__feed,
body[data-theme="classic"] .gc-sidechat__feed {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 320px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  text-align: left;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sidechat__feed::-webkit-scrollbar,
body[data-theme="classic"] .gc-sidechat__feed::-webkit-scrollbar {
  width: 8px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sidechat__feed::-webkit-scrollbar-track,
body[data-theme="classic"] .gc-sidechat__feed::-webkit-scrollbar-track {
  background: transparent;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sidechat__feed::-webkit-scrollbar-thumb,
body[data-theme="classic"] .gc-sidechat__feed::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--border-strong), var(--border));
  border-radius: 999px;
  border: 1px solid rgba(12, 16, 24, 0.35);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sidechat__feed::-webkit-scrollbar-thumb:hover,
body[data-theme="classic"] .gc-sidechat__feed::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--accent-cool), var(--border-strong));
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sidechat__entry,
body[data-theme="classic"] .gc-sidechat__entry {
  margin: 0 0 6px;
  line-height: 1.3;
  color: #aaaaaa;
  overflow-wrap: anywhere;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sidechat__name,
body[data-theme="classic"] .gc-sidechat__name {
  display: inline;
  font-weight: 700;
  color: #c3bbc3;
  text-decoration: underline;
  margin-right: 4px;
}

/* Staff chat name. A post made from the Admin panel's Chat screen stores its
   name as <span class="gc-chat-staff">Name</span> (see gcChatStaffName() in
   Modules/Functions/Functions.cfm). Not tied to one surface: the side chat,
   f_com_msgsector.cfm and f_com_msgsector2.cfm all print it, and the Admin
   feed draws the same thing from admin.css. The STAFF tag is generated here,
   so it is never part of the stored name. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chat-staff,
body[data-theme="classic"] .gc-chat-staff {
  font-weight: 700;
  color: #5b9bff;
  white-space: nowrap;
}

/* Deep sapphire on Daylight's white; the light shade above is for the dark
   panels (Nebula surface, Classic black). */
body[data-theme="daylight"] .gc-chat-staff {
  color: #0f52ba;
}

/* The side chat underlines every name on its wrapper, and an inherited
   underline cannot be cancelled from the child - so drop it on the wrapper
   when it holds a staff name. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sidechat__name:has(> .gc-chat-staff),
body[data-theme="classic"] .gc-sidechat__name:has(> .gc-chat-staff) {
  text-decoration: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chat-staff::after,
body[data-theme="classic"] .gc-chat-staff::after {
  content: "STAFF";
  display: inline-block;
  margin-left: 5px;
  padding: 1px 5px;
  border-radius: 3px;
  background: #0f52ba;
  color: #ffffff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-decoration: none;
  vertical-align: middle;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sidechat__text,
body[data-theme="classic"] .gc-sidechat__text {
  color: inherit;
}

/* Thin divider under the author's name in the side chat. Tight margins so the
   name and post stay close together — just a visible line, not a gap. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sidechat__rule,
body[data-theme="classic"] .gc-sidechat__rule {
  border: 0;
  border-top: 1px solid rgba(150, 155, 175, 0.28);
  height: 0;
  margin: 2px 0;
}

/* Admin-scrubbed chat post: makes clear an admin replaced the text, never a
   player. Same .removed class used by the admin panel and i_chatt.cfm. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .removed,
body[data-theme="classic"] .removed {
  color: #e05a5a;
  font-style: italic;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm,
body[data-theme="classic"] .gc-pm {
  width: min(100%, 940px);
  margin: 0 auto 14px;
  padding: 0 10px;
  box-sizing: border-box;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm__title,
body[data-theme="classic"] .gc-pm__title,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-compose-title {
  margin: 2px 0 6px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--text-primary);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-page-nav,
body[data-theme="classic"] .gc-pm-page-nav {
  display: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-page-nav__btn,
body[data-theme="classic"] .gc-pm-page-nav__btn {
  flex: 1 1 calc(16.66% - 4px);
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 3px 5px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(125, 191, 242, 0.08), rgba(125, 191, 242, 0)),
    var(--bg-elevated);
  color: var(--text-secondary);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition:
    border-color var(--dur-base) var(--ease),
    color var(--dur-base) var(--ease),
    transform var(--dur-base) var(--ease);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-page-nav__btn:hover,
body[data-theme="classic"] .gc-pm-page-nav__btn:hover,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-page-nav__btn--active,
body[data-theme="classic"] .gc-pm-page-nav__btn--active {
  color: var(--accent);
  border-color: var(--border-strong);
  text-decoration: none;
  transform: translateY(-1px);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-page-nav__btn i,
body[data-theme="classic"] .gc-pm-page-nav__btn i {
  font-size: 12px;
}

body[data-theme="classic"] .gc-pm__tablewrap {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

body[data-theme="classic"] table.Default.gc-pm__list,
body[data-theme="classic"] table.Default.gc-pm__toolbar,
body[data-theme="classic"] table.Default.gc-pm__legend {
  width: 100% !important;
  max-width: 100%;
  box-sizing: border-box;
}

body[data-theme="classic"] table.Default.gc-pm__list {
  table-layout: fixed;
}

body[data-theme="classic"] table.Default.gc-pm__list td,
body[data-theme="classic"] table.Default.gc-pm__list th {
  padding-top: 2px !important;
  padding-bottom: 2px !important;
}

body[data-theme="classic"] .gc-pm__col--chk { width: 30px; }
body[data-theme="classic"] .gc-pm__col--icn { width: 32px; }
body[data-theme="classic"] .gc-pm__col--time { width: 184px; }
body[data-theme="classic"] .gc-pm__col--from { width: 135px; }

body[data-theme="classic"] .gc-pm__td--subj a {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-shell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-bulk {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 2px 0 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-detail-card__eyebrow,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-compose__eyebrow {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-bulk__actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-bulk__note {
  color: var(--text-muted);
  font-size: 11px;
  text-align: left;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 11px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-button {
  appearance: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--text-inverse);
  padding: 6px 12px;
  min-height: 30px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-button--danger {
  background: transparent;
  color: var(--accent-hot);
  border-color: rgba(236, 98, 98, 0.45);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-button--ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-card {
  position: relative;
  display: grid;
  grid-template-columns: 20px 20px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-card--new {
  border-color: rgba(125, 191, 242, 0.5);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-card--replied {
  border-color: rgba(127, 197, 146, 0.45);
}

/* An unread System notice — admin actions and the like. It stays flagged until
   the message itself is opened (i_f_800.cfm keys the topbar indicator off the
   same newflag), so it has to read as "you must open this" rather than as one
   more unread card. Light orange fill and a solid orange edge, matching that
   indicator. Declared after --new/--replied so it wins on the border. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-card--system-unread {
  border-color: #f97316;
  border-width: 2px;
  background: rgba(249, 115, 22, 0.16);
  box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.35), var(--shadow-sm);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-card--system-unread:hover {
  background: rgba(249, 115, 22, 0.24);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-card__select,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-card__status {
  padding-top: 2px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-card__status img {
  display: block;
  width: auto;
  max-height: 13px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-card__status-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(125, 191, 242, 0.3);
  margin-top: 3px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-card__body {
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-card__row {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-card__meta {
  display: block;
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-card__senderline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-card__sender {
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-card__sender img {
  width: auto;
  max-height: 14px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-card__system {
  color: var(--accent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-card__ghost {
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-card__stamp {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 6px;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-card__preview {
  display: block;
  color: var(--accent);
  text-decoration: none;
  font-size: 12px;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-card__preview:hover {
  color: var(--accent-hover);
  text-decoration: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-empty {
  padding: 12px 10px;
  text-align: center;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0;
  flex-wrap: wrap;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm__pager {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--text-muted);
  font-style: italic;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm__pager a {
  text-decoration: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm__pager-disabled,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm__pager-divider {
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-legend {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--text-secondary);
  font-size: 11px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-legend__title {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-legend__item img {
  max-height: 14px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-detail-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
  margin-top: 2px;
  box-shadow: var(--shadow-sm);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-detail-card {
  background: var(--bg-surface);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-detail-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 9px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  align-items: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-detail-card__actions a {
  font-size: 10px;
  color: var(--text-secondary);
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-detail-card__actions a:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-detail-card__actions a.gc-pm-action--primary {
  color: var(--accent);
  border-color: var(--accent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-actions-back {
  margin-right: 4px;
  padding-right: 10px;
  border-right: 1px solid var(--border) !important;
  border-color: var(--border) !important;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-detail-card__meta {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 10px;
  align-items: baseline;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-detail-card__meta-label {
  font-size: 10px;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-detail-card__meta-value {
  color: var(--text-primary);
  font-size: 12px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-detail-card__status {
  font-size: 9px;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  margin-left: 6px;
  vertical-align: middle;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-detail-card__body {
  padding: 10px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-primary);
  word-break: break-word;
  overflow-wrap: anywhere;
  min-height: 0;
  text-align: left;
  border-top: 1px solid var(--border);
  background: var(--bg-base);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-thread {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-thread__item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 82%;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-thread__item--self {
  align-self: flex-end;
  text-align: right;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-thread__item--other,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-thread__item--system {
  align-self: flex-start;
  text-align: left;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-thread__hdr {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-thread__author {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-thread__bubble {
  padding: 6px 9px;
  border-radius: 12px;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-thread__item--self .gc-pm-thread__author {
  color: var(--accent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-thread__item--self .gc-pm-thread__bubble {
  background: rgba(232, 181, 99, 0.12);
  border: 1px solid rgba(232, 181, 99, 0.28);
  color: var(--text-primary);
  border-bottom-right-radius: 6px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-thread__item--other .gc-pm-thread__author,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-thread__item--system .gc-pm-thread__author {
  color: var(--accent-cool);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-thread__item--other .gc-pm-thread__bubble {
  background: rgba(125, 191, 242, 0.12);
  border: 1px solid rgba(125, 191, 242, 0.26);
  color: var(--text-primary);
  border-bottom-left-radius: 6px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-thread__item--system .gc-pm-thread__bubble {
  background: rgba(127, 197, 146, 0.12);
  border: 1px solid rgba(127, 197, 146, 0.24);
  color: var(--text-primary);
  border-bottom-left-radius: 6px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-thread__stamp {
  font-family: var(--font-body);
  font-size: 10px;
  color: var(--text-muted);
}

/* Grouped quoted-message blocks (consecutive > lines) */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-quote-block {
  border-left: 3px solid var(--accent-cool);
  background: rgba(125, 191, 242, 0.08);
  padding: 7px 10px;
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-quote-gap {
  height: 6px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-quote-block__hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 10px;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-style: normal;
  margin-bottom: 6px;
  opacity: 0.75;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-quote-block__label {
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-quote-block__body {
  line-height: 1.4;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-quote-block__author {
  font-weight: 700;
  letter-spacing: 0.04em;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-quote-block--self {
  border-left-color: rgba(232, 181, 99, 0.95);
  background: rgba(232, 181, 99, 0.08);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-quote-block--self .gc-pm-quote-block__author {
  color: var(--accent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-quote-block--other {
  border-left-color: rgba(125, 191, 242, 0.95);
  background: rgba(125, 191, 242, 0.08);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-quote-block--other .gc-pm-quote-block__author {
  color: var(--accent-cool);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-quote-block--depth-2 {
  filter: saturate(0.92);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-quote-block--depth-3,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-quote-block--depth-4,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-quote-block--depth-5 {
  filter: saturate(0.84) brightness(0.96);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-compose {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(100%, 980px);
  margin: 0 auto;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-compose__panel,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-compose__quote {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-compose__panel {
  padding: 16px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-compose__heading {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-compose__title {
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.1;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-compose__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-compose__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-compose__field > span {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-compose__field input[type="text"],
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-compose__field select,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-compose__textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-base);
  color: var(--text-primary);
  padding: 10px 12px;
  font-size: 13px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-compose__textarea {
  min-height: 220px;
  resize: vertical;
  line-height: 1.5;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-compose__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-compose__counter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-compose__counter input {
  width: 58px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 6px 8px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-compose__actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-compose__quote {
  padding: 14px 16px;
  background:
    linear-gradient(180deg, rgba(125, 191, 242, 0.08), transparent),
    var(--bg-surface);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-compose__quote-label {
  margin-bottom: 8px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-compose__quote-body {
  border-left: 3px solid var(--accent-cool);
  padding-left: 12px;
  color: var(--text-secondary);
  line-height: 1.55;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-book {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-book__alert {
  width: min(100%, 940px);
  margin: 0 auto 8px;
  padding: 10px 12px;
  border: 1px solid rgba(232, 181, 99, 0.34);
  border-radius: var(--radius-md);
  background: rgba(232, 181, 99, 0.1);
  color: var(--text-primary);
  box-sizing: border-box;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-book__panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-book__heading {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-book__title {
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1.1;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-book__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-book__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-book__list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-book__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-book__identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-book__intel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  flex: 0 0 auto;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-book__name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-book__name a {
  color: var(--text-primary);
  text-decoration: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-book__name a:hover {
  color: var(--accent);
  text-decoration: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-book__item-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (max-width: 640px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm,
  body[data-theme="classic"] .gc-pm {
    width: calc(100% - 16px);
    margin-left: auto;
    margin-right: auto;
    padding: 0 4px;
    box-sizing: border-box;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm__title,
  body[data-theme="classic"] .gc-pm__title,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-compose-title {
    margin-bottom: 6px;
    font-size: 14px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-page-nav,
  body[data-theme="classic"] .gc-pm-page-nav {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
    margin-bottom: 6px;
    width: 100%;
    box-sizing: border-box;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-page-nav__btn,
  body[data-theme="classic"] .gc-pm-page-nav__btn {
    padding: 5px 1px 4px;
    font-size: 7px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-bulk,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-footer,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-compose__footer {
    flex-direction: column;
    align-items: stretch;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-bulk {
    padding: 0;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-shell,
  body[data-theme="classic"] .gc-pm__tablewrap,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-list,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-footer {
    width: 100%;
    box-sizing: border-box;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-bulk__note {
    text-align: left;
  }

  body[data-theme="classic"] table.Default.gc-pm__list {
    table-layout: fixed;
    font-size: 12px;
  }

  body[data-theme="classic"] table.Default.gc-pm__list tr.Header td {
    font-size: 10px;
    white-space: nowrap;
  }

  body[data-theme="classic"] .gc-pm__col--time { width: 118px; }
  body[data-theme="classic"] .gc-pm__col--from { width: 112px; }

  body[data-theme="classic"] .gc-pm__td--time,
  body[data-theme="classic"] .gc-pm__td--from,
  body[data-theme="classic"] .gc-pm__td--subj {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  body[data-theme="classic"] .gc-pm__td--time {
    font-size: 11px;
  }

  body[data-theme="classic"] .gc-pm__td--subj a {
    white-space: normal;
  }

  body[data-theme="classic"] table.Default.gc-pm__toolbar,
  body[data-theme="classic"] table.Default.gc-pm__legend {
    width: 100% !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-card {
    grid-template-columns: 18px 18px minmax(0, 1fr);
    gap: 6px;
    padding: 4px 7px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-list {
    padding-inline: 2px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-card__row {
    display: block;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-card__meta {
    margin-bottom: 3px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-card__senderline {
    flex-wrap: wrap;
    gap: 3px 6px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-card__stamp {
    align-items: flex-start;
    gap: 6px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-card__sender,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-card__preview {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-detail-card {
    border-radius: var(--radius-md);
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-detail-card {
    margin-top: 0;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-compose__panel,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-compose__quote {
    padding: 12px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-compose__title {
    font-size: 18px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-detail-card__body {
    padding: 12px 10px;
    font-size: 13px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-thread__item {
    max-width: 92%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-thread__hdr {
    gap: 5px;
    flex-wrap: wrap;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-detail-card__meta {
    gap: 4px 8px;
    padding: 8px 10px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-detail-card__actions {
    padding: 7px 10px;
    gap: 5px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-detail-card__actions a {
    flex-shrink: 0;
    font-size: 10px;
    padding: 3px 8px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-quote-block__hdr {
    gap: 6px;
    flex-wrap: wrap;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-compose__grid {
    grid-template-columns: 1fr;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-compose__textarea {
    min-height: 170px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-compose__actions {
    width: 100%;
    justify-content: stretch;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-compose__actions .gc-pm-button {
    width: 100%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-book__panel,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-book__alert {
    padding: 12px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-book__grid {
    grid-template-columns: 1fr;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-book__item {
    flex-direction: column;
    align-items: stretch;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-book__item-actions {
    justify-content: stretch;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-pm-book__item-actions .gc-pm-button {
    width: 100%;
    text-align: center;
  }
}

/* =========================================================
   REDEEM PROJECT TOOLTIPS (f_com_donate_redeem)
   ========================================================= */

table.Default.gc-redeem-projects {
  overflow: visible;
}

.gc-redeem-projects td {
  overflow: visible;
}

.gc-redeem-projects__project {
  position: relative;
}

.gc-redeem-projects__cost {
  text-align: right;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.gc-project-tooltip__link {
  text-decoration: none;
}

.gc-project-tooltip__link:hover,
.gc-project-tooltip__link:focus {
  text-decoration: none;
}

.gc-project-tooltip__float {
  position: fixed;
  z-index: 10000;
  width: max-content;
  max-width: min(340px, calc(100vw - 16px));
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  text-align: left;
  white-space: normal;
  line-height: 1.45;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-3px);
  transition:
    opacity var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease),
    visibility var(--dur-fast) var(--ease);
}

.gc-project-tooltip__float--active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.gc-project-tooltip__float::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -5px;
  width: 9px;
  height: 9px;
  transform: translateX(-50%) rotate(45deg);
}

.gc-project-tooltip__float--above::before {
  top: auto;
  bottom: -5px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-redeem-projects {
  width: min(100%, 380px) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md);
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-surface);
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-sm);
  table-layout: auto;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-redeem-projects__header td {
  padding: 7px 10px !important;
  background:
    linear-gradient(180deg, rgba(125, 191, 242, 0.12), rgba(125, 191, 242, 0)),
    var(--bg-elevated) !important;
  color: var(--accent) !important;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-strong);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-redeem-projects__row td {
  padding: 7px 10px !important;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  transition:
    background var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-redeem-projects__row:nth-child(even) td {
  background: rgba(125, 191, 242, 0.035);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-redeem-projects__row:hover td {
  background: var(--bg-elevated);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-redeem-projects__project a {
  color: var(--accent);
  font-weight: 500;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-redeem-projects__project a:hover,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-redeem-projects__project a:focus {
  color: var(--accent-hover);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-redeem-projects__cost {
  color: var(--text-primary);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-project-tooltip__float {
  border: 1px solid var(--border-strong);
  background:
    linear-gradient(135deg, rgba(232, 181, 99, 0.13), transparent 58%),
    var(--bg-overlay);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  font-family: var(--font-body);
  font-size: 12px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-project-tooltip__float::before {
  border-left: 1px solid var(--border-strong);
  border-top: 1px solid var(--border-strong);
  background: var(--bg-overlay);
}

body[data-theme="classic"] .gc-redeem-projects__cost {
  color: var(--text-primary);
}

body[data-theme="classic"] .gc-project-tooltip__link:hover,
body[data-theme="classic"] .gc-project-tooltip__link:focus {
  color: var(--link-hover);
}

body[data-theme="classic"] .gc-project-tooltip__float {
  border: 1px solid var(--accent);
  background: var(--bg-base);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  font-family: var(--font-body);
  font-size: 12px;
}

body[data-theme="classic"] .gc-project-tooltip__float::before {
  border-left: 1px solid var(--accent);
  border-top: 1px solid var(--accent);
  background: var(--bg-base);
}

/* Redeem credit transfer form. Classic keeps the legacy Default2 table skin;
   modern themes use the shared Default table chrome with a compact form layout. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-redeem-transfer {
  width: min(100%, 32rem) !important;
  margin: 0 auto !important;
  box-shadow: var(--shadow-md);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-redeem-transfer td {
  padding: 12px 14px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-redeem-transfer__form {
  display: grid;
  grid-template-columns: 1fr 1.35fr auto;
  align-items: end;
  gap: 10px;
  margin: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-redeem-transfer__field {
  display: grid;
  gap: 4px;
  margin: 0;
  color: var(--text-secondary);
  font-size: 11px;
  text-align: left;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-redeem-transfer__field span {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-redeem-transfer__field input[type="text"] {
  width: 100% !important;
  box-sizing: border-box;
  text-align: center;
  font-family: var(--font-mono);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-redeem-transfer__submit {
  min-width: 96px;
}

@media (max-width: 640px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-redeem-transfer {
    width: calc(100% - 12px) !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-redeem-transfer__form {
    grid-template-columns: 1fr;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-redeem-transfer__submit {
    justify-self: center;
  }
}

/* -------------------------------------------------------------------------
   Users online popup (`pop_useronline.cfm`) + sidebar subtitle (`i_f_800`)
-------------------------------------------------------------------------- */

body:is([data-theme="nebula"], [data-theme="daylight"]) .modern-public.is-popup .modern-content {
  padding: 10px 12px 14px !important;
  max-width: 32rem;
  margin: 0 auto;
}

body[data-theme="daylight"].modern-public.is-popup {
  background: var(--bg-base) !important;
  color: var(--text-primary);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sidebar-online-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-useronline-popup {
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-useronline-popup__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-useronline-popup__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-useronline-popup__close {
  appearance: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  background: var(--bg-overlay);
  color: var(--accent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-useronline-popup__close:hover {
  border-color: var(--accent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-useronline-popup__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

@media (max-width: 520px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-useronline-popup__stats {
    grid-template-columns: 1fr;
  }
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-useronline-popup__stat {
  border-radius: var(--radius-md);
  padding: 10px 12px;
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-useronline-popup__stat--live {
  border-top: 3px solid var(--accent-good);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-useronline-popup__stat--day {
  border-top: 3px solid var(--accent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-useronline-popup__stat-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-useronline-popup__stat-value {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text-primary);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-useronline-popup__stat-hint {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-useronline-popup__list-head {
  margin: 0 0 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-useronline-popup__grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 14px;
}

@media (min-width: 520px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-useronline-popup__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-useronline-popup__cell {
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-useronline-popup__name {
  display: block;
  font-weight: 600;
  color: var(--link);
  text-decoration: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-useronline-popup__name:hover {
  color: var(--link-hover);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-useronline-popup__server {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-useronline-popup__trunc,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-useronline-popup__empty {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

/* =========================================================
   RESEARCHED TECHNOLOGY ARCHIVE (f_com_rtreed)
   Modern replacement for the legacy two-column fixed table.
   ========================================================= */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-rtreed-page {
  width: min(100%, 1080px);
  margin: 0 auto;
  padding: 4px 0 16px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-rtreed-hero {
  width: min(100%, 980px);
  margin: 0 auto 14px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 18%, transparent), transparent 30%),
    linear-gradient(180deg, color-mix(in srgb, var(--bg-surface) 94%, transparent), color-mix(in srgb, var(--bg-surface-2) 96%, transparent));
  box-shadow: var(--shadow-md);
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-rtreed-hero__eyebrow {
  margin-bottom: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-rtreed-hero__title {
  font-family: var(--font-display);
  font-size: clamp(18px, 2.4vw, 24px);
  line-height: 1;
  color: var(--accent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-rtreed-hero__meta {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-rtreed-table {
  width: min(100%, 980px) !important;
  margin: 0 auto;
  table-layout: fixed;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-rtreed-table tr.Header td {
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-rtreed-table tbody td {
  padding-top: 6px;
  padding-bottom: 6px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-rtreed-table tbody tr > td:nth-child(1) {
  width: 52%;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-rtreed-table tbody tr > td:nth-child(2) {
  width: 28%;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-rtreed-table tbody tr > td:nth-child(3) {
  width: 20%;
  text-align: right;
  font-family: var(--font-mono);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-rtreed-table__link {
  color: var(--link);
  font-weight: 700;
  text-decoration: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-rtreed-table__link:hover {
  color: var(--link-hover);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-rtreed-empty {
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--bg-surface) 92%, transparent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-rtreed-actions {
  margin: 16px 0 0;
  text-align: center;
}

@media (max-width: 767.98px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-rtreed-page {
    padding-bottom: 12px;
    overflow-x: hidden;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-rtreed-hero,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-rtreed-table {
    width: calc(100% - 20px) !important;
    max-width: calc(100% - 20px) !important;
    margin-left: 10px !important;
    margin-right: 10px !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-rtreed-hero {
    padding: 14px 14px 15px;
    margin-bottom: 10px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-rtreed-hero__title {
    font-size: clamp(16px, 5.5vw, 20px);
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-rtreed-table {
    display: table !important;
    overflow-x: visible;
    table-layout: fixed;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-rtreed-table thead {
    display: table-header-group !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-rtreed-table tbody {
    display: table-row-group !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-rtreed-table tr {
    display: table-row !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-rtreed-table td,
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-rtreed-table th {
    display: table-cell !important;
    box-sizing: border-box;
    min-width: 0;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-rtreed-table tr.Header td {
    font-size: 10px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-rtreed-table tbody td {
    padding-top: 5px;
    padding-bottom: 5px;
    padding-left: 4px;
    padding-right: 4px;
    font-size: 11px;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-rtreed-table tbody tr > td:nth-child(1) {
    width: 50%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-rtreed-table tbody tr > td:nth-child(2) {
    width: 28%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-rtreed-table tbody tr > td:nth-child(3) {
    width: 22%;
    font-size: 10px;
  }
}

body[data-theme="classic"] .gc-rtreed-page {
  width: min(100%, 1080px);
  margin: 0 auto;
}

body[data-theme="classic"] .gc-rtreed-hero {
  margin: 0 auto 12px;
  text-align: center;
}

body[data-theme="classic"] .gc-rtreed-actions {
  text-align: center;
}

body[data-theme="classic"] table.Default.gc-rtreed-table {
  margin-left: auto;
  margin-right: auto;
}

/* =========================================================
   COLONY LIST MODERN (s_show_colony / f_com_col)
   ========================================================= */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-list-page {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 4px 0 10px;
  overflow-x: hidden;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-list-page__toolbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 12px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-list-page__toolbar::before,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-list-page__toolbar::after {
  content: "";
  flex: 1 1 auto;
  max-width: 140px;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 22%, transparent));
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-list-page__toolbar::after {
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 22%, transparent), transparent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-list-page__tabs {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  margin: 0 12px;
  padding: 4px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
  border-radius: 999px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--bg-surface-alt) 96%, white 4%), color-mix(in srgb, var(--bg-surface) 96%, transparent)),
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 62%);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, white 5%, transparent),
    0 8px 18px rgba(4, 10, 26, 0.12);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-list-page__tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 14px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-muted);
  transition: transform 160ms ease, color 160ms ease, background 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
  border: 1px solid transparent;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-list-page__tab:hover,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-list-page__tab.is-active {
  color: var(--accent-strong);
  border-color: color-mix(in srgb, var(--accent) 22%, transparent);
  background: color-mix(in srgb, var(--accent) 11%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 16%, transparent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-list-page__tab:hover {
  transform: translateY(-1px);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-list-page__tab.is-active {
  color: #18213a;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 88%, white 12%), color-mix(in srgb, var(--accent) 72%, black 6%));
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, white 22%, transparent),
    0 4px 10px color-mix(in srgb, var(--accent) 14%, transparent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-list-form {
  display: grid;
  gap: 8px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-list-page__desktop {
  display: block;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-modern-table {
  width: 100%;
  max-width: 100%;
  table-layout: auto;
  border-collapse: collapse !important;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, white 8%, transparent);
  border-radius: calc(var(--radius-md) + 2px);
  background: color-mix(in srgb, white 5%, var(--bg-surface));
  box-shadow:
    0 1px 0 color-mix(in srgb, white 4%, transparent) inset,
    0 8px 24px rgba(0, 0, 0, 0.28);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-modern-table thead,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-modern-table tbody,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-modern-table tfoot,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-modern-table tr {
  border: 0 !important;
  background: transparent;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-modern-table th,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-modern-table td {
  padding: 2px 3px;
  border: 0 !important;
  vertical-align: middle;
  font-size: 12px;
}

/* Subtle row separator — one near-invisible hairline matching the reference */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-modern-table tbody tr + tr td {
  border-top: 1px solid color-mix(in srgb, white 5%, transparent) !important;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-modern-table th {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--accent) 80%, var(--text-muted));
  background: color-mix(in srgb, var(--bg-surface-alt) 55%, transparent);
  text-align: left;
  text-shadow: none;
  border-bottom: 1px solid color-mix(in srgb, white 7%, transparent) !important;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-modern-table th.gc-colony-modern-table__metric {
  text-align: right;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-modern-table tbody tr:hover td {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-modern-table tbody tr:nth-child(odd) td {
  background: transparent;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-modern-table tbody tr:nth-child(even) td {
  background: color-mix(in srgb, white 3%, transparent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-modern-table tfoot td {
  border-top: 1px solid color-mix(in srgb, white 7%, transparent) !important;
  background: color-mix(in srgb, var(--bg-surface-alt) 35%, transparent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-modern-table__select {
  width: 20px;
  min-width: 20px;
  text-align: center;
  padding: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-modern-table__select input {
  inline-size: 16px;
  block-size: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  margin: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-modern-table__colony {
  display: flex;
  align-items: center;
  gap: 6px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-modern-table__colony img {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-modern-table__colony-copy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-modern-table__colony-copy a {
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  font-size: 11px;
  color: var(--accent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-modern-table__badge,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__badge,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-list-page__legend-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 14px;
  height: 14px;
  padding: 0 1px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-hot) 28%, transparent);
  color: var(--accent-hot);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-modern-table__class {
  white-space: nowrap;
  font-weight: 600;
  font-size: 11px;
  color: color-mix(in srgb, var(--text) 94%, white 6%);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-modern-table__mineral {
  width: 28px;
  min-width: 28px;
  padding-left: 4px;
  padding-right: 4px;
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-modern-table__mineral-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  vertical-align: middle;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-modern-table__mineral-icon {
  display: block;
  width: 20px;
  height: 20px;
  object-fit: contain;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-modern-table__metric {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
  font-size: 11px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-modern-table tbody td.gc-colony-modern-table__metric {
  font-size: 14px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-modern-table td.gc-colony-modern-table__name {
  background-image: linear-gradient(90deg, color-mix(in srgb, var(--accent) 7%, transparent), transparent 72%);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-modern-table tfoot .gc-colony-modern-table__total-row td {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--bg-surface-alt) 96%, white 3%), color-mix(in srgb, var(--bg-surface-alt) 92%, transparent));
  border-top: 1px solid color-mix(in srgb, var(--accent) 16%, transparent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-modern-table .is-good,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__stats .is-good {
  color: var(--accent-good);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-modern-table .is-bad,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__stats .is-bad {
  color: var(--accent-hot);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-cards {
  display: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card {
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-radius: var(--radius-md);
  padding: 8px 9px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--bg-surface) 96%, white 4%), color-mix(in srgb, var(--bg-surface-alt) 95%, transparent)),
    radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 11%, transparent), transparent 58%);
  box-shadow: 0 8px 16px rgba(5, 10, 24, 0.14);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__top {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__select {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 20px;
  min-height: 20px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__select input {
  inline-size: 16px;
  block-size: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  margin: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__planet {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__identity {
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__identity-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: nowrap;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__name {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  flex: 0 1 auto;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__class {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  flex: 0 0 auto;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px 6px;
  margin: 8px 0 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__stats div {
  padding: 0;
  border: none;
  background: transparent;
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__stats dt {
  margin: 0 0 2px;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__stats dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__mineral-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__mineral-icon {
  display: block;
  width: 15px;
  height: 15px;
  object-fit: contain;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-list-page__actions {
  display: flex;
  justify-content: flex-start;
  /* Collective / Viral get a second submit here (Assimilate / Infect), so the
     row has to space them and wrap on narrow screens rather than collide. */
  flex-wrap: wrap;
  gap: 8px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-list-page__submit {
  min-height: 28px;
  padding: 0 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
  border-radius: 7px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 86%, white 14%), color-mix(in srgb, var(--accent) 70%, black 10%));
  color: #1b2138;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 4px 10px color-mix(in srgb, var(--accent) 16%, transparent);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-list-page__submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px color-mix(in srgb, var(--accent) 22%, transparent);
}


body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-list-page__legend {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 2%;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 14%, transparent);
  border-radius: 10px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-surface-alt) 86%, transparent), color-mix(in srgb, var(--bg-surface) 92%, transparent));
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.5;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-modern-table tfoot td {
  padding-top: 7px;
  padding-bottom: 7px;
  font-size: 12px;
  font-weight: 700;
  background: color-mix(in srgb, var(--bg-surface-alt) 92%, transparent);
  border-top: 1px solid color-mix(in srgb, var(--accent) 16%, transparent);
}

@media (max-width: 767.98px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-list-page {
    padding-left: 6px;
    padding-right: 6px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-list-page__toolbar {
    margin-bottom: 8px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-list-page__tabs {
    width: 100%;
    border-radius: 16px;
    padding: 4px;
    gap: 4px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-list-page__tab {
    flex: 1 1 30%;
    min-width: 0;
    padding-left: 6px;
    padding-right: 6px;
    min-height: 24px;
    font-size: 9px;
    letter-spacing: 0.08em;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-list-page__desktop {
    display: none;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-cards {
    display: grid;
    gap: 2px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Shared column tracks so population / land / mineral line up on every row */
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-cards:has(.gc-colony-cards__head--summary) {
    grid-template-columns: minmax(0, max-content) repeat(4, minmax(44px, 1fr));
    column-gap: 8px;
    row-gap: 2px;
    align-items: center;
  }

  @supports not (grid-template-columns: subgrid) {
    body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card--summary,
    body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-cards__head--summary {
      grid-column: auto;
      grid-template-columns: minmax(0, max-content) repeat(4, minmax(44px, 1fr));
    }
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-cards__head {
    display: none;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card {
    padding: 3px 4px;
    border-radius: 8px;
    border-color: color-mix(in srgb, var(--accent) 14%, transparent);
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--bg-surface-alt) 92%, white 2%), color-mix(in srgb, var(--bg-surface) 96%, transparent));
    box-shadow: none;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    cursor: pointer;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__top {
    grid-template-columns: 20px 20px minmax(0, 1fr);
    gap: 5px;
    align-items: center;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card--summary {
    position: relative;
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
    align-items: center;
    padding: 1px 4px;
    overflow: visible;
    cursor: pointer;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card--summary .gc-colony-card__lead {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    max-width: 100%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card--summary .gc-colony-card__top {
    display: contents;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__select input {
    inline-size: 16px;
    block-size: 16px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__planet {
    width: 18px;
    height: 18px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card--summary .gc-colony-card__select input {
    inline-size: 16px;
    block-size: 16px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card--summary .gc-colony-card__planet {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card--summary .gc-colony-card__identity {
    min-width: 0;
    flex: 1 1 auto;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__name {
    font-size: 11px;
    line-height: 1.1;
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__identity-line {
    gap: 5px;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__resource {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    color: var(--text-muted);
    text-transform: uppercase;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card--summary .gc-colony-card__resource {
    grid-column: 4;
    grid-row: 1;
    position: static;
    width: auto;
    margin-left: 0;
    justify-self: center;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__class {
    min-height: auto;
    padding: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__badge {
    min-width: 14px;
    height: 14px;
    padding: 0 2px;
    font-size: 8px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2px 3px;
    margin-top: 2px;
    padding-top: 2px;
    border-top: 1px solid color-mix(in srgb, var(--accent) 10%, transparent);
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__stat--pair {
    grid-column: span 2;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__stats--summary {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 1px 6px;
    align-items: center;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card--summary .gc-colony-card__stats {
    display: contents;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-cards__head--summary {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
    padding: 0 4px 2px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 7px;
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1.1;
    text-transform: uppercase;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-cards__head--summary .gc-colony-cards__head__lead {
    grid-column: 1;
    grid-row: 1;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-cards__head--summary span:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
    justify-self: stretch;
    text-align: center;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-cards__head--summary span:nth-child(3) {
    grid-column: 3;
    grid-row: 1;
    justify-self: stretch;
    text-align: center;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-cards__head--summary span:nth-child(4) {
    grid-column: 4;
    grid-row: 1;
    justify-self: stretch;
    text-align: center;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card--summary .gc-colony-card__stats > div:nth-child(1) {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    width: 100%;
    justify-content: center;
    justify-self: stretch;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card--summary .gc-colony-card__stats > div:nth-child(2) {
    grid-column: 3;
    grid-row: 1;
    min-width: 0;
    width: 100%;
    justify-content: center;
    justify-self: stretch;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card--summary .gc-colony-card__stats div {
    display: flex;
    align-items: center;
    min-height: 16px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__stats div {
    min-width: 0;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__stats dd {
    font-size: 10px;
    line-height: 1.1;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__stats dt {
    margin-bottom: 1px;
    font-size: 7px;
    letter-spacing: 0.08em;
    line-height: 1.1;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__stats--summary dt {
    display: none;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__stats--summary dd {
    font-size: 12px;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card--summary .gc-colony-card__stats > div:nth-child(1) dd,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card--summary .gc-colony-card__stats > div:nth-child(2) dd {
    width: 100%;
    text-align: center;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__resource .gc-colony-card__mineral-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 100%;
    flex: 0 0 18px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__resource .gc-colony-card__mineral-icon {
    width: 18px;
    height: 100%;
    max-height: 28px;
    object-fit: contain;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__stats div:last-child {
    grid-column: span 2;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__stats--infrastructure {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__stats--consumption {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__stats--infrastructure div:last-child,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__stats--consumption div:last-child {
    grid-column: auto;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card--summary .gc-colony-card__stats div:last-child {
    grid-column: 3;
    grid-row: 1;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card--summary .gc-colony-card__tooltip {
    grid-column: 5;
    grid-row: 1;
    justify-self: center;
    margin-left: 0;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__tooltip-toggle {
    display: inline-grid;
    place-items: center;
    width: 16px;
    height: 16px;
    padding: 0;
    border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--bg-surface-alt) 88%, transparent);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
    appearance: none;
    transform: translateZ(0);
    vertical-align: middle;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card--summary .gc-colony-card__tooltip-toggle {
    width: 18px;
    height: 18px;
    font-size: 10px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__tooltip-mark {
    display: block;
    line-height: 1;
    transform: translateY(-0.5px);
    pointer-events: none;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card--summary .gc-colony-card__tooltip-mark {
    transform: none;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__tooltip-toggle:active {
    transform: translateZ(0);
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__tooltip-toggle[aria-expanded="true"],
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__tooltip-toggle:focus-visible {
    outline: none;
    border-color: color-mix(in srgb, var(--accent) 55%, transparent);
    background: color-mix(in srgb, var(--accent) 14%, var(--bg-surface-alt));
    color: var(--text-primary);
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__tooltip-panel {
    position: absolute;
    top: calc(100% + 6px);
    right: -2px;
    z-index: 12;
    width: min(212px, calc(100vw - 24px));
    padding: 9px 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background:
      linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, transparent), transparent 62%),
      var(--bg-overlay);
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__tooltip-panel::before {
    content: "";
    position: absolute;
    top: -5px;
    right: 9px;
    width: 9px;
    height: 9px;
    transform: rotate(45deg);
    border-left: 1px solid var(--border-strong);
    border-top: 1px solid var(--border-strong);
    background: var(--bg-overlay);
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__tooltip-grid {
    display: grid;
    gap: 6px;
    margin: 0;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__tooltip-grid > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: baseline;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__tooltip-grid dt {
    margin: 0;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1.15;
    text-transform: uppercase;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-card__tooltip-grid dd {
    margin: 0;
    text-align: right;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
  }


  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-list-page__legend {
    padding: 6px 8px;
    gap: 8px;
    font-size: 10px;
    line-height: 1.35;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-list-page__actions {
    justify-content: flex-start;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-list-page__submit {
    width: auto;
  }
}

/* =========================================================
   COLONY DETAIL MODERN (f_com_col&colid)
   ---------------------------------------------------------
   Sci-fi command-console aesthetic. Dense data grids,
   notched/clipped panel corners, HUD corner brackets,
   scanline overlays, monospace telemetry, tight padding.
   ========================================================= */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern {
  display: grid;
  gap: 6px;
  width: 100%;
  max-width: 100%;
  padding: 0 0 6px;
  --gc-cdm-accent: var(--accent);
  --gc-cdm-accent-soft: color-mix(in srgb, var(--accent) 18%, transparent);
  --gc-cdm-accent-line: color-mix(in srgb, var(--accent) 32%, transparent);
  --gc-cdm-grid-line: color-mix(in srgb, var(--accent) 6%, transparent);
  --gc-cdm-surface: color-mix(in srgb, var(--bg-surface) 96%, black 4%);
  --gc-cdm-tile: color-mix(in srgb, var(--bg-surface-alt) 70%, transparent);
}

/* ----- Panel chassis: notched corner + scanline + corner brackets ----- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-card,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__panel {
  position: relative;
  isolation: isolate;
  border: 1px solid color-mix(in srgb, var(--accent) 16%, transparent);
  border-radius: 4px;
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--bg-surface) 96%, white 2%) 0%,
      var(--gc-cdm-surface) 100%);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, white 4%, transparent),
    0 2px 0 rgba(0, 0, 0, 0.18),
    0 0 0 1px color-mix(in srgb, var(--accent) 4%, transparent);
  clip-path: polygon(
    0 0,
    calc(100% - 12px) 0,
    100% 12px,
    100% 100%,
    12px 100%,
    0 calc(100% - 12px)
  );
}

/* Scanline + grid texture overlay (sci-fi data panel feel) */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-card::before,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    linear-gradient(transparent 49.5%, color-mix(in srgb, var(--accent) 4%, transparent) 50%, transparent 50.5%) 0 0 / 100% 3px,
    linear-gradient(90deg, var(--gc-cdm-grid-line) 1px, transparent 1px) 0 0 / 22px 100%,
    linear-gradient(180deg, var(--gc-cdm-grid-line) 1px, transparent 1px) 0 0 / 100% 22px;
  opacity: 0.55;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.8), rgba(0,0,0,0.25));
}

/* ----- HERO BAR (identity card + stats card) ----- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 8px;
  align-items: stretch;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 9px 12px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-card--single {
  clip-path: none;
  overflow: visible;
  padding: 9px 14px;
  z-index: 8;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-card--identity {
  padding: 9px 14px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-identity {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  align-items: stretch;
  width: 100%;
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-pop-full {
  display: inline;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-pop-abbrev {
  display: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-icon {
  position: relative;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  padding: 2px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 62%),
    color-mix(in srgb, var(--bg-surface-alt) 88%, transparent);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--accent) 38%, transparent),
    0 0 18px color-mix(in srgb, var(--accent) 14%, transparent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-profile {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(118px, max-content);
  gap: 10px;
  align-items: center;
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-heading {
  display: grid;
  gap: 2px;
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__title {
  margin: 0;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: clamp(20px, 2.4vw, 26px);
  line-height: 1;
  letter-spacing: 0;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 0 18px color-mix(in srgb, var(--accent) 22%, transparent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-chips {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__type-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__type-chip {
  min-height: 17px;
  padding: 0 7px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  color: color-mix(in srgb, var(--accent) 75%, var(--text-primary));
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__type-label {
  display: inline-block;
  min-width: 0;
  white-space: nowrap;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__type-chip .gc-colony-help__toggle {
  width: 13px;
  height: 13px;
  border-color: color-mix(in srgb, var(--accent) 34%, transparent);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  font-size: 7px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-chips > .gc-colony-detail-modern__chip,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__type-group > .gc-colony-detail-modern__chip {
  flex: 0 0 auto;
  white-space: nowrap;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-chips > .gc-colony-detail-modern__chip--muted {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  line-height: 17px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__chip {
  display: inline-flex;
  align-items: center;
  min-height: 17px;
  padding: 0 7px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  color: color-mix(in srgb, var(--accent) 75%, var(--text-primary));
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__chip--muted {
  border-color: color-mix(in srgb, var(--text-muted) 28%, transparent);
  background: color-mix(in srgb, var(--bg-surface-alt) 70%, transparent);
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: none;
  font-weight: 500;
  font-family: var(--font-body);
  font-size: 10px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__chip--border {
  border-color: color-mix(in srgb, var(--accent-hot) 50%, transparent);
  background: color-mix(in srgb, var(--accent-hot) 18%, transparent);
  color: color-mix(in srgb, var(--accent-hot) 75%, white 25%);
  gap: 5px;
  padding-left: 6px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__border-icon {
  display: inline-block;
  height: 11px;
  width: auto;
  vertical-align: middle;
}

/* Hero stat tiles */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-stat {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  align-content: start;
  gap: 1px;
  padding: 5px 8px;
  background: color-mix(in srgb, var(--bg-surface-alt) 60%, transparent);
  border-radius: 3px;
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-stat > span {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
  line-height: 1.2;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-stat > strong {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  white-space: nowrap;
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-stat > strong em {
  color: var(--text-muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 500;
  margin-left: 1px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-mineral {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  width: 100%;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-aside {
  display: inline-flex;
  align-items: stretch;
  justify-self: end;
  gap: 6px;
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__profile-land,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__profile-mineral {
  display: inline-grid;
  gap: 6px;
  align-items: center;
  min-width: 0;
  padding: 4px 7px 4px 5px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
  border-radius: 3px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 10%, transparent), transparent 72%),
    color-mix(in srgb, var(--bg-surface-alt) 58%, transparent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__profile-land {
  align-content: center;
  min-width: 86px;
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__profile-land strong {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  white-space: nowrap;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__profile-mineral {
  grid-template-columns: auto minmax(0, 1fr);
  max-width: 172px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__mineral-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__profile-mineral-label {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__mineral-name {
  display: block;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__mineral-chip {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 3px;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%);
  border-radius: 50%;
  flex: 0 0 auto;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__mineral-icon {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--accent) 35%, transparent));
}

/* ----- BODY LAYOUT ----- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(248px, 0.9fr);
  gap: 6px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__column {
  display: grid;
  gap: 6px;
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__panel {
  padding: 9px 12px 10px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
  padding-bottom: 5px;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 12%, transparent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__panel-headings {
  display: grid;
  gap: 1px;
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__panel-head--tabs {
  align-items: center;
  display: block;
  gap: 0;
  padding-bottom: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__panel-kicker {
  color: color-mix(in srgb, var(--accent) 72%, var(--text-muted));
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__panel-title {
  margin: 0;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

/* Extra spacing above the secondary metrics group when stacked in one panel */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__metrics--spaced {
  margin-top: 8px;
}


/* ----- MODIFIER CARDS ----- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__modifier-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__modifier-card {
  position: relative;
  display: grid;
  gap: 2px;
  padding: 6px 8px;
  background: color-mix(in srgb, var(--bg-surface-alt) 60%, transparent);
  border-radius: 3px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__modifier-label {
  color: var(--text-muted);
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__modifier-value {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__modifier-bar {
  display: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__modifier-card.is-good .gc-colony-detail-modern__modifier-value {
  color: var(--accent-good);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__modifier-card.is-bad .gc-colony-detail-modern__modifier-value {
  color: var(--accent-hot);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__modifier-card.is-disabled {
  opacity: 0.55;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__modifier-card.is-disabled .gc-colony-detail-modern__modifier-value {
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern .is-good {
  color: var(--accent-good);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern .is-bad {
  color: var(--accent-hot);
}

/* ----- METRICS (compact data tiles) ----- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin: 0;
  padding: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__metrics.gc-colony-detail-modern__metrics--empire {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__metrics.gc-colony-detail-modern__metrics--empire > div {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: 12px;
  padding: 5px 10px;
  background: transparent;
  border-radius: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 8%, transparent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__metrics.gc-colony-detail-modern__metrics--empire > div:last-child {
  border-bottom: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__metrics.gc-colony-detail-modern__metrics--empire dt {
  font-size: 10px;
  letter-spacing: 0.12em;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__metrics.gc-colony-detail-modern__metrics--empire dd {
  text-align: right;
  font-size: 13px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__metrics.gc-colony-detail-modern__metrics--profile {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__num--abbrev {
  display: none;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__num--full {
  display: inline;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__metrics > div {
  display: grid;
  gap: 1px;
  min-width: 0;
  padding: 5px 8px 6px;
  background: color-mix(in srgb, var(--bg-surface-alt) 60%, transparent);
  border-radius: 3px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__metrics dt {
  margin: 0;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__metrics dd {
  margin: 0;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__metrics dd em {
  color: var(--text-muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 500;
}

/* ----- PROFILE TABS ----- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__profile-tabs {
  position: relative;
  display: grid;
  gap: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__tab-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__tab-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  width: 100%;
  gap: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__tab-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 8px 5px;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1;
  text-transform: uppercase;
  cursor: pointer;
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__tab-label:hover {
  color: var(--text-primary);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__tab-input--main:checked ~ .gc-colony-detail-modern__panel-head--tabs .gc-colony-detail-modern__tab-label--main,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__tab-input--mods:checked ~ .gc-colony-detail-modern__panel-head--tabs .gc-colony-detail-modern__tab-label--mods {
  border-bottom-color: color-mix(in srgb, var(--accent) 72%, transparent);
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--accent) 9%, transparent));
  color: color-mix(in srgb, var(--accent) 82%, var(--text-primary));
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__tab-panel {
  display: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__tab-input--main:checked ~ .gc-colony-detail-modern__tab-panel--main,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__tab-input--mods:checked ~ .gc-colony-detail-modern__tab-panel--mods {
  display: block;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__modifier-note {
  margin: 0 0 6px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.35;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__modifier-grid--tab .gc-colony-detail-modern__modifier-label {
  letter-spacing: 0;
  text-transform: none;
}

/* ----- BUILD FORM ----- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__form {
  display: grid;
  gap: 5px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__form-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px 38px 64px;
  gap: 4px 4px;
  padding: 0 8px;
  color: color-mix(in srgb, var(--accent) 65%, var(--text-muted));
  font-family: var(--font-mono);
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__form-head > span:nth-child(2) {
  text-align: center;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__form-head > span:nth-child(3) {
  text-align: right;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__form-head > span:nth-child(4) {
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__form-head-stat {
  color: color-mix(in srgb, var(--text-primary) 72%, var(--text-muted));
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  padding: 0;
  text-align: right;
  white-space: nowrap;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__form-grid {
  display: grid;
  gap: 3px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px 38px 64px;
  gap: 4px;
  align-items: center;
  padding: 4px 8px;
  background: color-mix(in srgb, var(--bg-surface-alt) 60%, transparent);
  border-radius: 3px;
  transition: background 0.15s ease;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__form-row:hover {
  background: color-mix(in srgb, var(--bg-surface-alt) 80%, transparent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__max-btn {
  box-sizing: border-box;
  display: block;
  width: 100%;
  height: 22px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-radius: 3px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: color-mix(in srgb, var(--accent) 85%, var(--text-primary));
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 20px;
  text-align: center;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__max-btn:hover {
  background: color-mix(in srgb, var(--accent) 24%, transparent);
  color: var(--text-primary);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__form-row.is-disabled {
  opacity: 0.55;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__form-row span {
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 600;
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__form-row em {
  color: var(--text-muted);
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 10px;
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__form-row strong {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__form-row input {
  width: 100%;
  min-width: 0;
  padding: 3px 5px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-radius: 2px;
  background: color-mix(in srgb, var(--bg-surface) 92%, transparent);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__form-row input:focus {
  outline: none;
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--bg-surface));
  box-shadow:
    0 0 0 1px var(--accent),
    0 0 12px color-mix(in srgb, var(--accent) 35%, transparent);
}

/* ----- ACTIONS (buttons / links) ----- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__actions--form {
  margin-top: 6px;
  justify-content: flex-end;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__actions-spacer {
  flex: 1;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__action--done {
  flex: 0 0 auto;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__actions--stack {
  flex-direction: column;
  align-items: stretch;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__action,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__action[type="submit"] {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 12px;
  /* Top/bottom rules only — no side borders. clip-path cuts this box into a
     parallelogram, and a CSS border can't follow a clip: the left and right
     borders survive only as ~4px stubs in the two corners the clip happens to
     spare, which reads as a half-drawn outline. Dropping them leaves two clean
     horizontal rules that the clip trims to the fill's exact width, which is
     the shape the hover state already appears to have.
     Modifiers keep overriding plain `border-color`; with zero-width sides only
     the top and bottom pick it up, so they need no changes. */
  border: 0 solid color-mix(in srgb, var(--accent) 32%, transparent);
  border-top-width: 1px;
  border-bottom-width: 1px;
  /* Mixed against --bg-surface-alt, NOT transparent: mixing a tint into
     `transparent` also mixes in its alpha, so an "14% accent" stop lands at
     alpha 0.14 and the fill all but disappears over a dark page. Keep both
     stops opaque so the clipped parallelogram reads as a solid shape — the
     same reason --submit (opaque) has always looked right. */
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--accent) 14%, var(--bg-surface-alt)),
      var(--bg-surface-alt));
  color: color-mix(in srgb, var(--accent) 80%, var(--text-primary));
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
  /* Bottom two points run 1px past the box on purpose. With them at exactly
     100% the bottom border rule sits on the clip boundary, and Firefox
     antialiases that boundary row away — the border vanishes there while
     Chromium keeps it. Pushing the region 1px below the box puts that row
     safely inside the clip. Shape is unchanged for practical purposes: at the
     real bottom edge the diagonals shift by ~0.2px. */
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) calc(100% + 1px), 0 calc(100% + 1px));
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__action:hover,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__action[type="submit"]:hover {
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--accent) 28%, transparent),
      color-mix(in srgb, var(--accent) 12%, transparent));
  color: var(--text-primary);
  transform: translateY(-1px);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__action--submit {
  flex: 0 0 108px;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--accent) 92%, white 8%),
    color-mix(in srgb, var(--accent) 70%, black 6%));
  color: #1b2138;
  border-color: var(--accent);
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 30%, transparent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__action--submit:hover {
  background: linear-gradient(180deg,
    var(--accent),
    color-mix(in srgb, var(--accent) 80%, black 4%));
  color: #1b2138;
  box-shadow: 0 0 22px color-mix(in srgb, var(--accent) 50%, transparent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__action--subtle {
  background: var(--bg-surface-alt);
  border-color: color-mix(in srgb, var(--text-muted) 30%, transparent);
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__action--warn {
  border-color: color-mix(in srgb, var(--accent-hot) 45%, transparent);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--accent-hot) 16%, var(--bg-surface-alt)),
    var(--bg-surface-alt));
  color: color-mix(in srgb, var(--accent-hot) 86%, white 14%);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__action--warn:hover {
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--accent-hot) 32%, transparent),
    color-mix(in srgb, var(--accent-hot) 14%, transparent));
  color: white;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__action--disabled {
  opacity: 0.48;
  pointer-events: none;
}

/* ----- SURFACE PANEL ----- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__panel--surface {
  padding: 0;
  overflow: hidden;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__panel--surface::before,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__panel--surface::after {
  z-index: 2;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__surface-link {
  position: relative;
  display: block;
  text-decoration: none;
  overflow: hidden;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__surface-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 8;
  object-fit: cover;
  filter: brightness(0.85) saturate(1.1);
  transition: filter 0.25s ease, transform 0.4s ease;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__surface-link:hover .gc-colony-detail-modern__surface-image {
  filter: brightness(1.0) saturate(1.2);
  transform: scale(1.04);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__surface-overlay {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  background: linear-gradient(180deg,
    transparent,
    color-mix(in srgb, var(--bg-surface) 88%, black));
  z-index: 1;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__surface-cta {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-help__toggle {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-surface-alt) 88%, transparent);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  line-height: 1;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-help__mark {
  display: block;
  line-height: 1;
  transform: translateY(-0.5px);
  pointer-events: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-help__toggle[aria-expanded="true"],
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-help__toggle:focus-visible {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: color-mix(in srgb, var(--accent) 14%, var(--bg-surface-alt));
  color: var(--text-primary);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-help__panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 1000;
  width: min(240px, calc(100vw - 24px));
  padding: 7px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, transparent), transparent 62%),
    var(--bg-overlay);
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.35;
  text-transform: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-help__panel::before {
  content: "";
  position: absolute;
  top: -5px;
  right: 9px;
  width: 9px;
  height: 9px;
  transform: rotate(45deg);
  border-left: 1px solid var(--border-strong);
  border-top: 1px solid var(--border-strong);
  background: var(--bg-overlay);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-help__panel p {
  margin: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-help__panel--mods {
  width: min(280px, calc(100vw - 24px));
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__modifier-tooltip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin: 7px 0 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__modifier-tooltip > div {
  display: grid;
  gap: 1px;
  min-width: 0;
  padding: 5px 6px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--bg-surface-alt) 62%, transparent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__modifier-tooltip dt {
  margin: 0;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  text-transform: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__modifier-tooltip dd {
  margin: 0;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__modifier-tooltip dd.is-disabled {
  color: var(--text-muted);
}

@media (max-width: 767.98px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern {
    padding-left: 4px;
    padding-right: 4px;
    gap: 5px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-bar {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-card {
    padding: 8px 10px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-pop-full {
    display: none;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-pop-abbrev {
    display: inline;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-stat--pop > strong {
    font-size: 11px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__layout {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Treasury: horizontal 3-up tile layout on mobile (overrides desktop vertical) */
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__metrics.gc-colony-detail-modern__metrics--empire {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__metrics.gc-colony-detail-modern__metrics--empire > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1px;
    padding: 5px 8px 6px;
    background: color-mix(in srgb, var(--bg-surface-alt) 60%, transparent);
    border-bottom: 0;
    border-radius: 3px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__metrics.gc-colony-detail-modern__metrics--empire dd {
    text-align: left;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__metrics.gc-colony-detail-modern__metrics--empire dt {
    font-size: 7.5px;
    letter-spacing: 0.14em;
  }

  /* Use the abbreviated form on mobile so big numbers fit the tile */
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__metrics.gc-colony-detail-modern__metrics--empire .gc-colony-detail-modern__num--full {
    display: none;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__metrics.gc-colony-detail-modern__metrics--empire .gc-colony-detail-modern__num--abbrev {
    display: inline;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__panel {
    padding: 8px 11px 9px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-identity {
    grid-template-columns: 44px minmax(0, 1fr) minmax(112px, 0.62fr);
    gap: 8px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-aside {
    grid-column: 3;
    grid-row: 1;
    align-self: stretch;
    justify-self: stretch;
    flex-direction: column;
    gap: 4px;
    max-width: 100%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__profile-land,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__profile-mineral {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__profile-land {
    justify-items: center;
    text-align: center;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__profile-mineral {
    grid-template-columns: 22px minmax(0, 1fr);
    max-width: 100%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__mineral-chip {
    width: 22px;
    height: 22px;
    padding: 2px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-icon {
    width: 44px;
    height: 44px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__title {
    font-size: clamp(18px, 5.2vw, 22px);
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__modifier-grid,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__metrics:not(.gc-colony-detail-modern__metrics--empire) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__metrics.gc-colony-detail-modern__metrics--profile .gc-colony-detail-modern__num--full {
    display: none;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__metrics.gc-colony-detail-modern__metrics--profile .gc-colony-detail-modern__num--abbrev {
    display: inline;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__form-head {
    display: none;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__form-head-stat {
    font-size: 8.5px;
    white-space: normal;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__form-row {
    grid-template-columns: minmax(0, 1fr) 58px 32px 64px;
    gap: 5px;
    padding: 5px 7px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__action,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__action[type="submit"] {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    min-height: 30px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__actions--form .gc-colony-detail-modern__action {
    flex: 1 1 0;
    padding: 0 6px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__actions--stack .gc-colony-detail-modern__action {
    flex: 1 1 100%;
  }
}

@media (max-width: 480px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-stats {
    gap: 3px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-profile {
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-aside {
    grid-column: 3;
    flex-wrap: nowrap;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__profile-land,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__profile-mineral {
    flex: 1 1 auto;
    padding: 4px 5px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__profile-land strong,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__mineral-name {
    font-size: 10px;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__profile-mineral-label {
    font-size: 6px;
    letter-spacing: 0.1em;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-stat {
    padding: 4px 5px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-colony-detail-modern__hero-stat > span {
    font-size: 6.5px;
    letter-spacing: 0.1em;
  }
}

/* =========================================================
   ARTIFACT INVENTORY (f_com_market_use.cfm — listing view)
   ---------------------------------------------------------
   One box per rarity tier, driven by the good table's `hard`
   column (1 common … 5 special). Flex-flowed: ~3 across on the
   desktop content column, 2 on tablet, 1 full-width box per
   tier stacked down on mobile.

   Deliberately NOT scoped to [data-theme] — this replaces a
   plain table.Default that every theme rendered, so Classic
   needs the layout too. All colour comes from tokens each
   theme already defines, so it re-skins automatically.
   ========================================================= */

.gc-artifacts {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  margin: 0 auto 8px;
  padding: 0;
  box-sizing: border-box;
}

.gc-artifacts__group {
  /* basis tuned so the ~730px content column fits 3 tiers per row */
  flex: 1 1 220px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-top: 2px solid var(--tier, var(--border-strong));
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* Per-tier accent; each group sets --tier, everything else reads it. */
.gc-artifacts__group--common   { --tier: var(--text-secondary); }
.gc-artifacts__group--uncommon { --tier: var(--accent-good); }
.gc-artifacts__group--rare     { --tier: var(--accent-cool); }
.gc-artifacts__group--unique   { --tier: #a155e7; }
.gc-artifacts__group--special  { --tier: var(--accent-gold); }

/* The stock purple is too light on Daylight's parchment. */
body[data-theme="daylight"] .gc-artifacts__group--unique { --tier: #7c3aed; }

.gc-artifacts__group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 7px 10px 6px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  font-family: var(--font-mono);
  font-weight: 600;
}

.gc-artifacts__group-name {
  color: var(--tier, var(--text-primary));
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.gc-artifacts__group-cap {
  color: var(--text-muted);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  font-weight: 400;
}

.gc-artifacts__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.gc-artifacts__item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 10px;
  border-bottom: 1px solid var(--border);
}

.gc-artifacts__item:last-child {
  border-bottom: 0;
}

.gc-artifacts__item:hover {
  background: var(--bg-elevated);
}

.gc-artifacts__name {
  min-width: 0;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.gc-artifacts__stock {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  font-size: 12px;
  color: var(--text-secondary);
}

/* Mobile: one full-width box per tier, stacked. */
@media (max-width: 640px) {
  .gc-artifacts {
    gap: 10px;
  }

  .gc-artifacts__group {
    flex: 1 1 100%;
  }

  .gc-artifacts__item {
    padding: 5px 10px;
  }
}

/* =========================================================
   DISBAND CONTROLS (f_com_disband.cfm)
   ---------------------------------------------------------
   The -/input/+ controls deliberately carry the builder's
   own .gc-builder-adjust / .gc-builder-input classes so the
   two pages stay visually identical and pick up the builder's
   per-theme sizing for free. Only the bits unique to disband
   live here: the row wrapper, the drop-below button, and the
   summary cards.
   ========================================================= */

.gc-disband-toolbar {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: center;
  gap: 0.35rem;
  margin: 0.7rem auto 0.2rem;
}

.gc-disband-summarycard {
  box-sizing: border-box;
  padding: 0.34rem 1.1rem 0.38rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  text-align: center;
  line-height: 1.15;
  min-width: 15rem;
  max-width: 100%;
}

.gc-disband-summarycard__label {
  display: block;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 1.05rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.gc-disband-summarycard strong {
  display: block;
  margin-top: 0.14rem;
  color: var(--accent-hot);
  font-size: 1.65rem;
  line-height: 1.1;
}

.gc-disband-summarycard--newpr strong {
  color: var(--accent-cool);
}

/* Inline-level rather than flex, on purpose. Chrome's selection serialiser
   emits a line break around block-level content, and flex items get blockified
   — so copying a row landed the -/+ glyphs on their own lines mid-row. Inline
   blocks keep the row on one line, and user-select:none drops the glyphs from
   the copy entirely, which together make Chrome's clipboard output identical to
   Firefox's. Spacing comes from the source whitespace between the controls,
   since gap has no effect outside flex/grid. */
.gc-disband-controls {
  display: inline;
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
}

body .gc-disband-controls .gc-disband-adjust,
body .gc-disband-controls .gc-disband-input {
  display: inline-block;
  vertical-align: middle;
}

/* NOTE: do NOT put user-select:none on .gc-disband-cell itself. It does stop the
   line break, but Chromium then drops the cell from the walk entirely and the
   row copies with one tab where Firefox emits two — the empty Disband column
   vanishes and every following column shifts left when pasted into a sheet.
   The cell has to stay in the walk and contribute its empty-cell tab. */

/* Belt and braces: nothing inside the cell may be block-level. Chromium
   emits a newline for block-level boxes in a selection, and this has already
   regressed twice (first the -/+ glyphs, then the drop SVG), so the rule is
   stated once for the subtree rather than per element. Scoped to the controls'
   own children and the icon, deliberately not `*`, which would hit the SVG's
   <polyline> internals. */
body .gc-disband-controls > *,
body .gc-disband-controls .gc-disband-drop__icon {
  display: inline-block;
}

/* Deliberately NOT inline-flex. Although inline-flex is itself inline-level, it
   makes the button a flex CONTAINER, and flex containers blockify their
   children — so the drop SVG became a block-level box no matter what display it
   declared. Chrome emits a newline per block-level box when serialising a
   selection, which broke every fleet row onto two lines on copy. See the
   .gc-disband-drop block further down. */
body .gc-disband-controls .gc-disband-drop {
  display: inline-block;
}

/* All three buttons pinned to one height, so the drop button lines up with the
   -/+ pair beside it rather than sizing to its glyph. */
body .gc-disband-controls .gc-disband-adjust {
  height: 1.62rem;
  min-height: 1.62rem;
  /* Tighter around the glyph than the build page, which has a whole card to
     spend width on; here three buttons share one table cell. */
  min-width: 2.1rem;
  flex: 0 0 2.1rem;
}

/* main.css carries a stray rule whose selector was meant to be a.button:after
   but also matches every plain <button>. It hangs a darkslategrey pseudo-element
   off the button and slides it to width:100% on hover, wiping across the glyph.
   Cancel it here and glow instead. */
body .gc-disband-controls .gc-disband-adjust::before,
body .gc-disband-controls .gc-disband-adjust::after {
  content: none;
}

body .gc-disband-controls .gc-disband-adjust:hover:not(:disabled) {
  border-color: rgba(158, 220, 254, 0.75);
  box-shadow: 0 0 0.6rem rgba(158, 220, 254, 0.7);
}

body .gc-disband-controls .gc-disband-input {
  width: 4.6rem;
  min-width: 4.6rem;
  max-width: 4.6rem;
  flex: 0 0 4.6rem;
}

/* Sits apart from -/+ : it's a jump, not a nudge. */
/* inline-block, NOT inline-flex. A flex container blockifies its children, so an
   inline-flex button turns its SVG into a block-level box — and Chrome's
   clipboard serialiser emits a newline for every block-level box in the range,
   even one under user-select:none (that suppresses the text, not the box). That
   split every fleet row across two lines on copy in Chromium while Firefox,
   which serialises by table structure rather than layout boxes, stayed correct.
   Centring is done with text-align + vertical-align on the icon instead. */
.gc-disband-drop {
  margin-left: 0.3rem;
  display: inline-block;
  text-align: center;
  overflow: hidden;
  background: rgba(37, 78, 122, 0.92);
  cursor: pointer;
}

.gc-disband-drop:hover:not(:disabled) {
  background: rgba(45, 92, 143, 0.95);
}

.gc-disband-drop:disabled {
  opacity: 0.35;
  cursor: default;
}

/* Must stay inline-level for the same reason as the button above — a block SVG
   is its own line break in Chrome's copy output.
   The offset centres the glyph in the button. vertical-align:middle aligns to
   the baseline plus half the x-height, which sits ~1px high for an empty
   replaced element like this SVG (it has no text metrics of its own); -0.15em
   drops it back to centre. Measured identical across all three themes. */
.gc-disband-drop__icon {
  display: inline-block;
  vertical-align: -0.15em;
  pointer-events: none;
}

/* Rows being scrapped stay findable after the list re-sorts. */
.gc-disband-row.is-active > td {
  background: rgba(236, 98, 98, 0.1);
}

.gc-disband-table td[align="right"] {
  padding-right: 0.35rem;
}

@media (max-width: 767.98px) {
  .gc-disband-summarycard {
    flex: 0 1 13rem;
    min-width: 0;
  }

  .gc-disband-summarycard__label {
    font-size: 0.95rem;
  }

  .gc-disband-summarycard strong {
    font-size: 1.45rem;
  }

  .gc-disband-controls {
    gap: 0.2rem;
  }

  .gc-disband-drop {
    margin-left: 0.15rem;
  }

  /* Four controls in a narrow phone cell — shrink below the builder's sizing. */
  body .gc-disband-controls .gc-disband-adjust {
    min-width: 1.75rem;
    flex: 0 0 1.75rem;
    font-size: 1rem;
  }

  body .gc-disband-controls .gc-disband-input {
    width: 2.9rem;
    min-width: 2.9rem;
    max-width: 2.9rem;
    flex: 0 0 2.9rem;
    font-size: 0.85rem;
  }

  .gc-disband-drop__icon {
    width: 12px;
    height: 12px;
  }
}

@media (max-width: 479.98px) {
  .gc-disband-summarycard {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  .gc-disband-summarycard__label {
    font-size: 0.85rem;
    letter-spacing: 0.04em;
  }
}

/* =========================================================
   FEDERATION FORUM — POST SEPARATION (f_fed_forum.cfm)
   ---------------------------------------------------------
   Every post is one <tr>: author/timestamp cell on the left,
   message body on the right. All the existing forum rules are
   inside the mobile block, so on desktop the only thing
   dividing two posts was table.Default's half-alpha bottom
   border — far too faint to read as a boundary.

   Turn each row into a self-contained card: the table drops
   its own chrome, the row gains a gap, and the two cells share
   one surface closed off by a rounded border, with an accent
   rail down the author edge tying the byline to its body.

   Nebula/Daylight only — Classic keeps main.css's solid black
   cell borders, which already separate the rows plainly.
   ========================================================= */

@media (min-width: 768px) {
  /* The table stops being the card so each row can become one. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-list {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    border-collapse: separate !important;
    border-spacing: 0 9px !important;
    overflow: visible !important;
  }

  /* A <tr> can't paint a border under border-spacing, so the cells carry the
     card between them: both take the top/bottom edge, then each end closes
     off its own side. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-list > tbody > tr > td {
    background: var(--bg-surface) !important;
    border-top: 1px solid var(--border) !important;
    border-bottom: 1px solid var(--border) !important;
    vertical-align: top;
    padding: 9px 12px;
    transition: background var(--dur-fast) var(--ease);
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-list td.gc-fed-forum-list__meta {
    width: 150px;
    background: var(--bg-elevated) !important;
    /* Rail is mixed down toward the page base so it sits inside the palette
       instead of cutting across it; the inset shadow does the actual work of
       marking the author edge, reading as a faint glow rather than a stripe. */
    border-left: 3px solid color-mix(in srgb, var(--accent-cool) 34%, var(--bg-base)) !important;
    box-shadow: inset 6px 0 9px -6px color-mix(in srgb, var(--accent-cool) 42%, transparent);
    border-right: 1px solid var(--border) !important;
    border-top-left-radius: var(--radius-md);
    border-bottom-left-radius: var(--radius-md);
    text-align: center;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-list td.gc-fed-forum-list__body {
    border-right: 1px solid var(--border) !important;
    border-top-right-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
    text-align: left;
    line-height: 1.5;
  }

  /* Byline reads as the heading of its own block. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-forum-list__user {
    display: block;
    margin-bottom: 3px;
    color: var(--accent);
    font-weight: 600;
    font-size: 13px;
    overflow-wrap: anywhere;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-forum-list__stamp {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.04em;
  }

  /* Lighting the whole row on hover proves the two cells are one post. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-list > tbody > tr:hover > td {
    background: var(--bg-elevated) !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-list > tbody > tr:hover > td.gc-fed-forum-list__meta {
    background: var(--bg-overlay) !important;
  }

  /* The empty-state row spans both columns, so it closes itself off. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-list > tbody > tr > td[colspan] {
    border-left: 1px solid var(--border) !important;
    border-right: 1px solid var(--border) !important;
    border-radius: var(--radius-md);
    text-align: center;
  }
}

/* Mobile keeps the existing 76px grid; it just needs the same gap and edge so
   consecutive posts stop running together. */
@media (max-width: 767.98px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-list tr {
    margin-bottom: 8px;
    border: 1px solid var(--border) !important;
    border-left: 3px solid color-mix(in srgb, var(--accent-cool) 34%, var(--bg-base)) !important;
    box-shadow: inset 6px 0 9px -6px color-mix(in srgb, var(--accent-cool) 42%, transparent);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-surface) !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-list .gc-fed-forum-list__meta {
    background: var(--bg-elevated) !important;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-list .gc-fed-forum-list__user {
    color: var(--accent);
    font-weight: 600;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-fed-forum-list .gc-fed-forum-list__stamp {
    color: var(--text-muted);
    font-family: var(--font-mono);
  }
}

/* Daylight's --bg-base is parchment, so the shared mix above would erase the
   rail. Weight it back toward the accent, which is dark on this theme. */
@media (min-width: 768px) {
  body[data-theme="daylight"] table.Default.gc-fed-forum-list td.gc-fed-forum-list__meta {
    border-left-color: color-mix(in srgb, var(--accent-cool) 78%, var(--bg-base)) !important;
  }
}

@media (max-width: 767.98px) {
  body[data-theme="daylight"] table.Default.gc-fed-forum-list tr {
    border-left-color: color-mix(in srgb, var(--accent-cool) 78%, var(--bg-base)) !important;
  }
}

/* =========================================================
   SHIP BUILDER — HELD BUT UNBUILDABLE STACKS (f_com_ship.cfm)

   Captured hulls, mission rewards and lapsed-premium ships sit INLINE among the
   buildable rows, sorted into their real fleet position by the same projected-PR
   re-sort, so you can see what you would be building directly above or below
   them. They reuse .gc-builder-card verbatim to keep the three-column grid
   aligned; only the controls change. The disabled input keeps its box so the
   middle column cannot collapse and the details column stays on one axis.
   ========================================================= */

body .gc-builder-card--readonly,
body .gc-builder-card--readonly:hover {
  cursor: default;
}

body .gc-builder-card--readonly .gc-builder-card__titleline a,
body .gc-builder-card--readonly .gc-builder-card__titleline a:link,
body .gc-builder-card--readonly .gc-builder-card__titleline a:visited,
body .gc-builder-card--readonly .gc-builder-card__titleline a:hover {
  color: var(--text-secondary) !important;
}

body .gc-builder-card--readonly .gc-builder-card__stats {
  color: var(--text-secondary);
}

body .gc-builder-card--readonly .gc-builder-adjust,
body .gc-builder-card--readonly .gc-builder-adjust--add {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text-muted);
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

body .gc-builder-card--readonly .gc-builder-input {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text-muted);
  opacity: 0.55;
  cursor: not-allowed;
}


body .gc-builder-card--readonly .gc-builder-adjust::before,
body .gc-builder-card--readonly .gc-builder-adjust::after {
  content: none;
}


body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-options-page table.Default2 {
  background: var(--bg-surface);
  background-image: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  color: var(--text-primary);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-options-page table.Default2 td {
  color: var(--text-primary);
}

/* The .Header row is the card's clickable title bar. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-options-page table.Default2 tr.Header td {
  background-image: none;
  color: var(--accent);
  font-weight: 600;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-options-page table.Default2 tr.Header td a {
  color: var(--accent);
}

body[data-theme="daylight"] .gc-options-page table.Default2 tr.Header td {
  background: rgba(30, 58, 138, 0.05);
  border-bottom: 1px solid rgba(30, 58, 138, 0.15);
}

body[data-theme="daylight"] .gc-options-page table.Default2:hover tr.Header td {
  background: rgba(30, 58, 138, 0.09);
}

body[data-theme="nebula"] .gc-options-page table.Default2 tr.Header td {
  background: rgba(232, 181, 99, 0.08);
  border-bottom: 1px solid rgba(232, 181, 99, 0.22);
}

body[data-theme="nebula"] .gc-options-page table.Default2:hover tr.Header td {
  background: rgba(232, 181, 99, 0.14);
}


/* =========================================================
   SCIENCE COMMAND — CONSOLIDATED RESEARCH PAGE
   (s_com_research_view.cfm, reached via f_com_research.cfm,
    f_com_research2.cfm and f_com_rtree.cfm)

   ========================================================= */

/* Side padding keeps the panels off the content column's borders. box-sizing is
   border-box, so this insets the panels rather than widening the page. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-page {
  display: grid;
  gap: 10px;
  width: min(100%, 1100px);
  margin: 0 auto;
  padding: 4px 12px 16px;
  box-sizing: border-box;
}

/* -------- Head -------- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-head {
  display: grid;
  gap: 2px;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-head__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(20px, 4vw, 28px);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  color: var(--text-primary);
  text-align: center;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-head__sub {
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-muted);
}

/* -------- Tabs -------- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 2px 0;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-tabs__tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--bg-surface) 88%, transparent);
  box-shadow: var(--shadow-sm);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-muted);
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-tabs__tab:hover {
  color: var(--accent-cool);
  border-color: color-mix(in srgb, var(--accent-cool) 55%, transparent);
  background: color-mix(in srgb, var(--accent-cool) 12%, var(--bg-surface));
  transform: translateY(-1px);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-tabs__tab.is-active {
  color: var(--text-inverse);
  background: var(--accent);
  border-color: var(--accent);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-tabs__tab.is-active:hover {
  color: var(--text-inverse);
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-tabs__tab--away::after {
  content: "\2197";
  margin-left: 6px;
  font-size: 12px;
  line-height: 1;
  opacity: 0.75;
}

/* -------- Action flash -------- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-flash {
  padding: 8px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--border));
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-surface));
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text-primary);
  text-align: center;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-flash p {
  margin: 0 auto;
  text-align: center !important;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-flash table {
  margin: 0;
  background: none;
}

/* -------- Panels -------- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-top {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 720px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-top {
    grid-template-columns: 1.15fr 1fr;
    align-items: start;
  }
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-panel,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-panel {
  position: relative;
  padding: 10px 12px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-panel__head,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: -10px -12px 10px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-surface-alt));
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-panel__title,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-panel__title {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  line-height: 1.2;
  color: var(--accent);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-panel__meta,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-panel__meta {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* -------- Focus panel body -------- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-focus__name {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(16px, 3.4vw, 24px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--text-primary);
  text-align: center;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-type {
  display: inline-block;
  padding: 1px 7px;
  border: 1px solid color-mix(in srgb, var(--accent-cool) 34%, transparent);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--accent-cool) 12%, transparent);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-cool);
  white-space: nowrap;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-focus__type {
  display: block;
  width: fit-content;
  margin: 7px auto 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-dash {
  color: var(--text-muted);
}

/* -------- Fact lists -------- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-facts {
  margin: 10px 0 0;
  display: grid;
  gap: 2px;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-facts__row {
  display: grid;
  grid-template-columns: minmax(84px, 34%) 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 5px 0;
  border-bottom: 1px dashed color-mix(in srgb, var(--border) 70%, transparent);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-facts__row:last-child {
  border-bottom: 0;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-facts__row--block {
  grid-template-columns: 1fr;
  gap: 4px;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-facts__label {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-facts__value {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text-primary);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-facts__num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  font-size: 15px;
  font-weight: 600;
  text-align: right;
  color: var(--text-primary);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-facts--metrics .gc-sci-facts__row {
  grid-template-columns: 1fr auto;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-facts__prose {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-secondary);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-empty {
  margin: 10px 0 0;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.45;
  text-align: center;
  color: var(--text-muted);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-note {
  margin: 8px 0 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-muted);
}

/* -------- Investment form -------- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-invest {
  margin: 0;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-invest__field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  margin: 10px 0 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bg-surface-alt) 70%, transparent);
}
/* Anti-script decoy anchors are emitted at random inside the field; they carry
   no content and must never take layout or focus. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-invest__field > a {
  display: none;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-invest__input {
  width: 84px;
  padding: 4px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-base);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  text-align: right;
  color: var(--text-primary);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-invest__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--ring);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-actions input[type="button"] {
  flex: 1 1 auto;
  min-height: 30px;
  padding: 4px 12px;
  background: color-mix(in srgb, var(--bg-elevated) 80%, transparent);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-actions input[type="button"]:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-actions input[type="button"].gc-sci-actions__primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-inverse);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-actions input[type="button"].gc-sci-actions__primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--text-inverse);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-swap {
  margin: 10px 0 0;
  padding: 8px 0 0;
  border-top: 1px dashed color-mix(in srgb, var(--border) 70%, transparent);
  text-align: center;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-swap input[type="button"] {
  min-height: 0;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-swap input[type="button"]:hover {
  color: var(--accent-hot);
  border-color: color-mix(in srgb, var(--accent-hot) 40%, transparent);
  background: color-mix(in srgb, var(--accent-hot) 8%, transparent);
}

/* -------- Infrastructure cards -------- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-infra {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
@media (min-width: 520px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-infra {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 780px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-infra {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

/* Centred stack: label over figure over hint. Scoped to the research cards so
   the income hero, which shares .gc-hero__card, keeps its left-aligned stack. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-infra__card {
  padding: 8px 10px 9px;
  align-items: center;
  text-align: center;
  text-decoration: none;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
/* Three states, three colours, none of them shared: cool for hover, warm for
   the card you are looking at, green for the one actually being researched. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-infra__card:hover {
  border-color: var(--accent-cool);
  background: color-mix(in srgb, var(--accent-cool) 12%, var(--bg-surface));
  transform: translateY(-1px);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-infra__card .gc-hero__value {
  font-size: clamp(20px, 3.4vw, 28px);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-infra__card.is-selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-infra__card.is-selected:hover {
  border-color: var(--accent-cool);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-cool) 45%, transparent);
}

/* Active research reads at a glance: the good accent on the card and the
   figure, so the row answers "what am I researching" without a legend. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-hero__card--active {
  border-color: color-mix(in srgb, var(--accent-good) 60%, var(--border));
  background: color-mix(in srgb, var(--accent-good) 9%, var(--bg-surface));
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-hero__card--active .gc-hero__value {
  color: var(--accent-good);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-hero__card--active .gc-hero__hint {
  color: var(--accent-good);
  font-weight: 700;
}
/* Hovering the card that is actually being researched keeps its green fill —
   only the border picks up the hover cue, so the state does not appear to
   change under the pointer. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-infra__card.gc-hero__card--active:hover {
  border-color: var(--accent-cool);
  background: color-mix(in srgb, var(--accent-good) 16%, var(--bg-surface));
}

/* -------- Research tree table -------- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-tablewrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-restree-table {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0;
  border-collapse: collapse;
  background: none;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-restree-table tr.Header td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--border-strong);
  background: none;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: left;
  color: var(--text-muted);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-restree-table tbody td {
  padding: 7px 8px;
  border-bottom: 1px dashed color-mix(in srgb, var(--border) 70%, transparent);
  background: none;
  font-size: 12.5px;
  vertical-align: top;
  color: var(--text-primary);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-restree-table tbody tr:last-child td {
  border-bottom: 0;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-restree-table tbody tr:hover td {
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) table.Default.gc-restree-table tbody tr.is-selected td {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-restree-table__link {
  font-weight: 700;
  text-decoration: none;
  color: var(--link);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-restree-table__link:hover {
  color: var(--link-hover);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-restree-table__num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-restree-table__req {
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--text-secondary);
}

/* ========================================================================
   FEDERATION FLAGS — all themes (Classic included; purely additive)
   ======================================================================== */
.gc-fedflag {
  display: inline-block;
  vertical-align: middle;
  object-fit: contain;
  margin: 0;
  flex-shrink: 0;
}
.gc-fedflag--sm { width: 32px; height: 16px; }
.gc-fedflag--md { width: 36px; height: 18px; }
.gc-fedflag--lg { width: 60px; height: 30px; }

.gc-fedflag-slot {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  vertical-align: middle;
  flex-shrink: 0;
  box-sizing: content-box;
  margin-right: 0.3em;
}
.gc-fedflag-slot--sm { width: 32px; height: 16px; }
.gc-fedflag-slot--md { width: 36px; height: 18px; }
.gc-fedflag-slot--lg { width: 60px; height: 30px; }

table.rank-page-table > tbody > tr > td,
table.rank-page-table > tr > td,
table.rank-results-table > tbody > tr > td,
table.rank-results-table > tr > td,
table.rank-results-table-mobile > tbody > tr > td,
table.rank-results-table-mobile > tr > td,
table.rank-s-table > tbody > tr > td,
table.rank-s-table > tr > td,
table.Default.rank-page-table td,
table.Default.rank-results-table td,
table.Default.rank-results-table-mobile td {
  vertical-align: middle;
}
td.rank-table__empire-cell {
  text-align: left !important;
}
.gc-rank-empire {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  text-align: left;
  line-height: 1;
  vertical-align: middle;
}
.gc-rank-empire img {
  vertical-align: middle;
}


/* =========================================================
   CONVERGENCE EVENT — FACTION + STATION
   (f_com_faction.cfm, text/p/convergence.cfm)
   ========================================================= */

/* ----- Faction page ----- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-page {
  display: grid;
  gap: 12px;
  max-width: 760px;
  margin: 8px auto 16px;
  padding: 0 8px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-intro {
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-intro__title {
  margin: 0 0 4px;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-intro__sub {
  margin: 0 auto;
  max-width: 560px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-flash {
  margin: 0;
  padding: 8px 12px;
  border: 1px solid color-mix(in srgb, var(--accent-good) 40%, transparent);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent-good) 10%, var(--bg-surface));
  color: var(--text-primary);
  font-size: 12px;
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-choice {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

@media (min-width: 640px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-choice {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-card {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, var(--bg-surface-alt), var(--bg-surface));
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-card__name {
  margin: 0;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-card__desc {
  margin: 0;
  color: var(--text-secondary);
  font-size: 11.5px;
  line-height: 1.45;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-card__stats {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  margin: 0 auto;
  padding: 0 16px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--accent) 92%, white 8%),
    color-mix(in srgb, var(--accent) 70%, black 6%));
  color: var(--text-inverse);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-btn:hover {
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 40%, transparent);
  transform: translateY(-1px);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-confirm {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--accent-hot) 45%, transparent);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--accent-hot) 8%, var(--bg-surface));
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-confirm__text {
  margin: 0;
  color: var(--text-primary);
  font-size: 12.5px;
  line-height: 1.5;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-confirm__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-confirm__cancel {
  color: var(--text-muted);
  font-size: 11px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-aligned {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--accent) 10%, var(--bg-surface)),
    var(--bg-surface));
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-aligned__label {
  color: var(--text-secondary);
  font-size: 11px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-aligned__name {
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-aligned__link {
  margin-top: 2px;
  font-size: 11.5px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-boards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

@media (min-width: 640px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-boards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-board {
  align-content: start;
  display: grid;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  overflow: hidden;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-board__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-surface-alt));
  border-bottom: 1px solid var(--border);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-board__title {
  margin: 0;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-board__meta {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-board__empty {
  margin: 0;
  padding: 14px 10px;
  color: var(--text-muted);
  font-size: 11.5px;
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-board__rows {
  margin: 0;
  padding: 4px 0;
  list-style: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-board__row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  gap: 6px;
  align-items: baseline;
  padding: 3px 10px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-board__row:nth-child(odd) {
  background: color-mix(in srgb, var(--bg-surface-alt) 45%, transparent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-board__rank {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-board__name {
  color: var(--text-primary);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-board__tokens {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

/* ----- Convergence war fleets (phase 2) ----- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-war {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

@media (min-width: 640px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-war {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-fleet {
  align-content: start;
  display: grid;
  gap: 8px;
  padding: 10px 12px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-fleet--defeated {
  border-color: color-mix(in srgb, var(--accent-hot) 45%, transparent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-fleet__head {
  display: grid;
  gap: 1px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-fleet__name {
  margin: 0;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-fleet__nic {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

/* Health track. The fill is inline-styled with a width percentage, so the
   remaining track showing through is the damage the enemy has done. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-fleet__bar {
  position: relative;
  height: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--accent-hot) 22%, var(--bg-surface-alt));
  overflow: hidden;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-fleet__fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--accent-good) 70%, var(--accent)),
    var(--accent-good));
  transition: width var(--dur-base) var(--ease);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-fleet__hp {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-fleet__hp b {
  color: var(--accent-good);
  font-size: 12px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-fleet--defeated .gc-faction-fleet__hp b {
  color: var(--accent-hot);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-fleet__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-fleet__stat {
  display: grid;
  gap: 1px;
  padding: 5px 6px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bg-surface-alt) 60%, transparent);
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-fleet__k {
  color: var(--text-muted);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-fleet__v {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

/* Roster of the fleets a faction fields, each with its own engage button. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-fleet__roster {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-fleet__unit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 6px;
  align-items: center;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bg-surface-alt) 55%, transparent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-fleet__unit-nic {
  color: var(--text-primary);
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-fleet__unit-role {
  color: var(--text-muted);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-btn--sm {
  padding: 3px 10px;
  font-size: 10.5px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-fleet__note {
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
}

/* Result banner, shown once a faction has been driven to zero. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-result {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--accent-gold) 45%, transparent);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--accent-gold) 12%, var(--bg-surface)),
    var(--bg-surface));
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-result__title {
  margin: 0;
  color: var(--accent-gold);
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-result__sub {
  margin: 0;
  color: var(--text-secondary);
  font-size: 11.5px;
}

/* Damage leaderboards carry an extra column against the contributor boards. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-board__row--war {
  grid-template-columns: 26px minmax(0, 1fr) auto auto;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-board__pr {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-faction-board__dmg {
  color: var(--accent-hot);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

/* ----- Convergence Station project page ----- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-page {
  display: grid;
  gap: 8px;
  max-width: 680px;
  margin: 8px auto 16px;
  padding: 0 8px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

@media (min-width: 900px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-page {
    max-width: 940px;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-cols {
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    align-items: start;
  }
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-cols > .gc-income-section {
  grid-column: auto;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-page .gc-income-section {
  padding: 8px 10px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-page .gc-income-section__head {
  margin-bottom: 4px;
  padding-bottom: 4px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-page .gc-ledger__row {
  padding: 3px 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-head {
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-head__title {
  margin: 0;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-head__faction {
  display: block;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-head__sub {
  margin: 4px auto 0;
  max-width: 520px;
  color: var(--text-secondary);
  font-size: 11.5px;
  line-height: 1.45;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-give form {
  display: grid;
  gap: 6px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-grid {
  display: grid;
  gap: 2px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-grid__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) 96px;
  gap: 6px;
  align-items: center;
  margin: 0;
  padding: 3px 3px;
  background: color-mix(in srgb, var(--bg-surface-alt) 60%, transparent);
  border-radius: 3px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-grid__row--head {
  background: transparent;
  padding-top: 0;
  padding-bottom: 0;
  color: color-mix(in srgb, var(--accent) 65%, var(--text-muted));
  font-family: var(--font-mono);
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-grid__row--head > span:nth-child(2) {
  text-align: right;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-grid__row--head > span:nth-child(3) {
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-grid__label {
  color: var(--text-primary);
  font-size: 11.5px;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-grid__have {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-grid__input {
  width: 100%;
  min-width: 0;
  padding: 1px 3px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-radius: 2px;
  background: color-mix(in srgb, var(--bg-surface) 92%, transparent);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-grid__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-actions--colony {
  justify-content: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-select {
  max-width: 100%;
  min-width: 0;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface-alt);
  color: var(--text-primary);
  font-size: 11.5px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--accent) 92%, white 8%),
    color-mix(in srgb, var(--accent) 70%, black 6%));
  color: var(--text-inverse);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-btn:hover {
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 40%, transparent);
  transform: translateY(-1px);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-btn--danger {
  border-color: color-mix(in srgb, var(--accent-hot) 60%, transparent);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--accent-hot) 22%, var(--bg-surface-alt)),
    var(--bg-surface-alt));
  color: color-mix(in srgb, var(--accent-hot) 86%, white 14%);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-btn--danger:hover {
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent-hot) 35%, transparent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-note {
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-note--legend {
  padding-top: 2px;
}

body .gc-faction-btn::before,
body .gc-faction-btn::after,
body .gc-converge-btn::before,
body .gc-converge-btn::after {
  content: none;
}

body .gc-faction-btn,
body .gc-converge-btn {
  white-space: nowrap;
}


/* -------- Narrow screens -------- */
@media (max-width: 519.98px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-page {
    gap: 8px;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-panel,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-panel {
    padding: 8px 10px 10px;
  }
  /* Panel padding tightens here, so the title bar's bleed has to match it. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-panel__head,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-panel__head {
    margin: -8px -10px 8px;
    padding: 5px 10px;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-facts__row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-facts--metrics .gc-sci-facts__row {
    grid-template-columns: 1fr auto;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-sci-actions input[type="button"] {
    flex: 1 1 100%;
  }
}

/* Colony hand-over picker — multi-select list (text/p/convergence.cfm).
   Mirrors .gc-converge-grid so both panels read as the same kind of table. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-collist {
  display: grid;
  gap: 2px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-collist__row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 88px 66px;
  gap: 6px;
  align-items: center;
  margin: 0;
  padding: 3px 3px;
  background: color-mix(in srgb, var(--bg-surface-alt) 60%, transparent);
  border-radius: 3px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-collist__row--head {
  background: transparent;
  padding-top: 0;
  padding-bottom: 0;
  color: color-mix(in srgb, var(--accent) 65%, var(--text-muted));
  font-family: var(--font-mono);
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-collist__row--head > span:nth-child(3),
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-collist__row--head > span:nth-child(4) {
  text-align: right;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-collist__check {
  margin: 0;
  justify-self: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-collist__name {
  color: var(--text-primary);
  font-size: 11.5px;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-collist__name em {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-style: normal;
  font-weight: 500;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-collist__land,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-collist__tokens {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-collist__land {
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-converge-collist__tokens {
  color: var(--accent);
  font-weight: 700;
}

/* =====================================================================
   CONVERGENCE EVENT LOG  (f_com_t_eventlog.cfm)
   Staff-only view of every empire's contribution. The expanded panel
   deliberately reuses .gc-income-section / .gc-ledger from the player's own
   contribution screen, so what staff see is what the player sees.
   ===================================================================== */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-eventlog {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 12px 40px;
}

/* -------- Summary strip -------- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-eventlog__summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  margin: 18px 0 14px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-eventlog__stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  background: var(--bg-surface);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-eventlog__stat-k {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-eventlog__stat-v {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  font-weight: 600;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-eventlog__stat-v--tok { color: var(--accent-good); }
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-eventlog__stat-s {
  color: var(--text-muted);
  font-size: 11px;
}

/* -------- Server filter -------- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-eventlog__filter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-eventlog__filter label {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* -------- The list -------- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-eventlog__list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-eventlog__item + .gc-eventlog__item {
  border-top: 1px solid var(--border);
}

/* The whole summary row is the click target. list-style:none on both the
   element and ::marker because browsers disagree about which one draws the
   default disclosure triangle. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-eventlog__summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
  background: var(--bg-surface);
  transition: background var(--dur-fast) var(--ease);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-eventlog__summary::-webkit-details-marker { display: none; }
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-eventlog__summary::marker { content: ""; }
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-eventlog__summary:hover { background: var(--bg-surface-alt); }
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-eventlog__summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-eventlog__row[open] > .gc-eventlog__summary {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-eventlog__rank {
  flex: none;
  min-width: 26px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  text-align: right;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-eventlog__who {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-eventlog__nic {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-eventlog__meta {
  color: var(--text-muted);
  font-size: 11px;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-eventlog__inactive { color: var(--accent-hot); }

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-eventlog__tokens {
  flex: none;
  display: flex;
  align-items: baseline;
  gap: 5px;
  color: var(--accent-good);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 600;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-eventlog__tokens-u {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* CSS-only chevron, rotated by [open]. No icon font, no JS. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-eventlog__chev {
  flex: none;
  width: 7px; height: 7px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform var(--dur-fast) var(--ease);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-eventlog__row[open] .gc-eventlog__chev {
  transform: rotate(-135deg) translate(-2px, -2px);
}

/* -------- Expanded panel -------- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-eventlog__body {
  padding: 14px;
  background: var(--bg-base);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-eventlog__body .gc-income-section {
  max-width: 460px;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-eventlog__last {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 11px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-eventlog__empty {
  padding: 40px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-muted);
  text-align: center;
}

@media (max-width: 560px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-eventlog__summary {
    flex-wrap: wrap;
    gap: 6px 10px;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-eventlog__tokens { margin-left: 38px; }
}


/* =========================================================
   FEDERATION COMMAND — HUB (f_fed.cfm)
   Hero band, tab strip, overview grid and the list components
   for notice / discussion / status / combat / top-feds.
   Panel chrome is the shared .gc-panel alias declared with
   .gc-sci-panel in the SCIENCE COMMAND block above.
   ========================================================= */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-page {
  display: grid;
  gap: 10px;
  width: min(100%, 1100px);
  margin: 0 auto;
  /* Side padding insets the page rather than widening it. */
  padding: 4px 12px 16px;
  box-sizing: border-box;
}

/* -------- Hero band -------- */
/* Warm accent wash at the top marks this as the identity band; the stat tiles
   inside sit on --bg-surface-alt so they read as raised off it. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhead {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 12px;
  padding: 14px 12px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, var(--bg-surface)), var(--bg-surface));
  box-shadow: var(--shadow-md);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhead__identity {
  display: flex;
  align-items: center;
  gap: 12px;
}
/* No-federation hero: identity only, no stats row to separate from. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhead--solo {
  gap: 0;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhead__flag {
  display: inline-flex;
  flex: 0 0 auto;
  padding: 4px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-base);
  box-shadow: var(--shadow-sm);
}
/* fedFlagTag()'s largest size is "lg" at 60x30, too small to anchor the hero.
   The stored PNG is 160x80, so this is still a downscale of the real asset —
   overridden here rather than adding a size to the shared function. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhead__flag .gc-fedflag {
  width: 108px;
  height: 54px;
}
@media (min-width: 640px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhead__flag .gc-fedflag {
    width: 132px;
    height: 66px;
  }
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhead__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(20px, 4.4vw, 30px);
  font-weight: 600;
  line-height: 1.15;
  color: var(--text-primary);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhead__sub {
  margin: 3px 0 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text-secondary);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhead__facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}
/* Stat tiles reuse the shared .gc-hero__card so the hub reads the same as the
   income and research pages. Only the deltas are declared here. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhead__stat {
  padding: 8px 12px 10px;
  background: var(--bg-surface-alt);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhead__stat dt,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhead__stat dd {
  margin: 0;
}
/* .gc-hero__label paints with var(--accent-nebula), which is only declared in
   the Daylight token block — on Nebula it falls through to inherit and the
   label ends up the same colour as its value. Pinned here rather than fixed at
   source, because the shared rule also drives the income and research pages. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhead__stat .gc-hero__label {
  color: var(--text-muted);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhead__stat .gc-hero__value {
  font-size: clamp(19px, 3.8vw, 27px);
}
/* Leader is a name, not a figure — at figure size it competes with the counts.
   .gc-hero__value carries word-break:break-all, which snaps a long nic mid-word
   onto a second line and makes the tile taller than its neighbours. The name is
   held to one line and stepped down in size by length (f_fed.cfm picks the
   modifier) so it shrinks to fit rather than truncating. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhead__stat--text .gc-hero__value {
  font-size: clamp(13px, 2.4vw, 17px);
  line-height: 1.3;
  word-break: normal;
  overflow-wrap: normal;
  white-space: nowrap;
  overflow: hidden;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhead__stat--name-sm .gc-hero__value {
  font-size: clamp(11px, 2vw, 14px);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhead__stat--name-xs .gc-hero__value {
  font-size: clamp(9.5px, 1.7vw, 11.5px);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhead__stat--name-xxs .gc-hero__value {
  font-size: clamp(8px, 1.45vw, 9.5px);
  letter-spacing: -0.01em;
}
@media (min-width: 640px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhead__facts {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* -------- Tab strip -------- */
/* Left-aligned, unlike the centred research tabs — the hero above it is
   left-aligned and a centred strip reads as detached from it. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px 0;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-tabs__tab {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--bg-surface) 88%, transparent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-muted);
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-tabs__tab:hover {
  color: var(--accent-cool);
  border-color: color-mix(in srgb, var(--accent-cool) 55%, transparent);
  background: color-mix(in srgb, var(--accent-cool) 12%, var(--bg-surface));
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-tabs__tab.is-active {
  color: var(--text-inverse);
  background: var(--accent);
  border-color: var(--accent);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-tabs__tab.is-active:hover {
  color: var(--text-inverse);
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-tabs__tab--away::after {
  content: "\2197";
  margin-left: 5px;
  font-size: 12px;
  line-height: 1;
  opacity: 0.75;
}

/* -------- Overview grid -------- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-grid__main,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-grid__rail {
  display: grid;
  gap: 10px;
  align-content: start;
  min-width: 0;
}
@media (min-width: 992px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-grid {
    grid-template-columns: 1.55fr 1fr;
    align-items: start;
  }
}

/* -------- Notice board -------- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-notice__body {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-notice__excerpt {
  margin: 0;
  max-height: 10.5em;
  overflow: hidden;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-notice__excerpt img,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-notice__excerpt table {
  max-width: 100%;
}

/* -------- Discussion -------- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-posts {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-posts__item {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface-alt);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-posts__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 10px;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-posts__author {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text-primary);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-posts__stamp {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 10px;
  color: var(--text-muted);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-posts__excerpt,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-posts__body {
  margin: 4px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}
/* The excerpt is real markup, so it is clipped by height rather than clamped
   by line count — line-clamp only counts lines in a single inline run and
   mis-measures once the post contains <br> or block tags. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-posts__excerpt {
  max-height: 6em;
  overflow: hidden;
}
/* Author markup must not escape the card and break the overview grid. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-posts__excerpt img,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-posts__excerpt table {
  max-width: 100%;
}

/* -------- Status list -------- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-status {
  display: grid;
  gap: 5px;
  margin: 0;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-status__row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface-alt);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-status__label {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-status__value {
  margin: 0;
  font-size: 12.5px;
  text-align: right;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
/* Non-interactive counterpart to __action — same bordered chip, but it states
   a fact rather than offering one, so it carries no hover and no link colour. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-status__badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bg-base) 45%, transparent);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-status__badge--war {
  border-color: var(--accent-hot);
  background: color-mix(in srgb, var(--accent-hot) 16%, transparent);
  color: var(--accent-hot);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-status__badge--peace {
  border-color: var(--accent-good);
  background: color-mix(in srgb, var(--accent-good) 16%, transparent);
  color: var(--accent-good);
}
/* A status row whose value is the way to act on it — rendered as a control so
   it reads as clickable rather than as another piece of data. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-status__action {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 12px;
  border: 1px solid var(--accent-cool);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent-cool) 16%, transparent);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--accent-cool);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-status__action:hover {
  background: var(--accent-cool);
  color: var(--text-inverse);
}

/* -------- Recent combat -------- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-combat {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}
/* Outcome reads from the left edge before the text is parsed — the fastest
   scan on the page, and the reason combat rows are cards not table rows. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-combat__row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-surface-alt);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-combat__row--win {
  border-left-color: var(--accent-good);
  background: color-mix(in srgb, var(--accent-good) 7%, var(--bg-surface-alt));
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-combat__row--loss {
  border-left-color: var(--accent-hot);
  background: color-mix(in srgb, var(--accent-hot) 7%, var(--bg-surface-alt));
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-combat__result {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-combat__result--win {
  color: var(--accent-good);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-combat__result--loss {
  color: var(--accent-hot);
}
/* Names never clip: a long pair wraps onto a second line instead. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-combat__pair {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
  font-size: 11px;
  color: var(--text-secondary);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-combat__name {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text-primary);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-combat__arrow {
  flex: 0 0 auto;
  color: var(--text-muted);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-combat__when {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 10px;
  white-space: nowrap;
  color: var(--text-muted);
}

/* -------- Top federations preview -------- */
/* Columns live on the list so every row aligns (subgrid); tracks size to content. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-topfeds {
  display: grid;
  grid-template-columns: auto auto minmax(max-content, auto);
  gap: 5px 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-topfeds__row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  gap: 4px 10px;
  align-items: center;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface-alt);
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-topfeds__row:hover {
  border-color: color-mix(in srgb, var(--accent-cool) 55%, transparent);
  background: color-mix(in srgb, var(--accent-cool) 9%, var(--bg-surface-alt));
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-topfeds__rank {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-topfeds__name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-topfeds__stat {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 10.5px;
  text-align: center;
  white-space: nowrap;
  color: var(--text-muted);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-topfeds__stat--power {
  grid-column: 3;
  font-weight: 700;
  color: var(--stat-power);
}
/* Below 520px the member count drops to its own line under the name so the
   power figure keeps the right-hand column to itself. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-topfeds__row > .gc-fedhq-topfeds__stat:not(.gc-fedhq-topfeds__stat--power) {
  grid-column: 2;
}
@media (min-width: 520px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-topfeds {
    grid-template-columns: auto auto minmax(max-content, auto) minmax(max-content, auto);
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-topfeds__row > .gc-fedhq-topfeds__stat:not(.gc-fedhq-topfeds__stat--power) {
    grid-column: 3;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-topfeds__stat--power {
    grid-column: 4;
  }
}

/* -------- Join explainer -------- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-intro {
  display: block;
  max-width: 68ch;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-intro__lede {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-intro__points {
  margin: 8px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-secondary);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-cta__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 16px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-pill);
  background: var(--accent);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-inverse);
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-cta__button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--text-inverse);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-cta__button--ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-primary);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-cta__button--ghost:hover {
  background: color-mix(in srgb, var(--accent-cool) 12%, var(--bg-surface));
  border-color: var(--accent-cool);
  color: var(--accent-cool);
}

/* -------- Shared small bits -------- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-empty {
  margin: 0;
  padding: 14px 10px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.45;
  text-align: center;
  color: var(--text-muted);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-more {
  margin: 10px 0 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-panel__head .gc-fedhq-more {
  margin: 0;
  font-size: 8.5px;
  letter-spacing: 0.1em;
  text-decoration: none;
}

@media (max-width: 519.98px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-page {
    gap: 8px;
    padding: 4px 8px 14px;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhead {
    padding: 10px;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedhq-tabs__tab {
    padding: 0 11px;
    letter-spacing: 0.08em;
  }
}


/* =========================================================
   FEDERATION ROSTER — MEMBERS + APPLICANTS (f_fed_member.cfm,
   also embedded by f_fed_join.cfm&fid=)
   ========================================================= */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster-page {
  display: grid;
  gap: 10px;
  width: min(100%, 1100px);
  margin: 0 auto;
  padding: 4px 12px 16px;
  box-sizing: border-box;
}

/* Columns live on the parent so head and rows share them via subgrid. Tracks size to
   their widest entry and split leftover width evenly; Empire/Race shrink first when tight. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster {
  display: grid;
  grid-template-columns: auto auto minmax(max-content, auto) minmax(max-content, auto) minmax(max-content, auto);
  gap: 4px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__head,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  align-items: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__head {
  padding: 0 5px 4px;
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__head > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__h-full {
  display: none;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__h-abbrev {
  display: inline;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__row {
  padding: 3px 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface-alt);
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}

@media (min-width: 720px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster {
    column-gap: 16px;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__head {
    padding: 0 11px 6px;
    border-bottom: 1px solid var(--border);
    font-size: 9.5px;
    letter-spacing: 0.12em;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__h-full {
    display: inline;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__h-abbrev {
    display: none;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__row {
    padding: 7px 11px;
  }
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__row:hover {
  border-color: color-mix(in srgb, var(--accent-cool) 50%, transparent);
  background: color-mix(in srgb, var(--accent-cool) 8%, var(--bg-surface-alt));
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__empire {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 5px;
  min-width: 0;
}
/* Names never clip; on a narrow phone a long nic wraps instead. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__name {
  min-width: 0;
  font-size: 10px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
@media (min-width: 720px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__empire {
    gap: 7px;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__name {
    font-size: 13px;
  }
}
/* Presence is a dot, not a word — at 20+ rows the label costs more width than
   it earns, and colour alone carries it. The title attribute keeps it readable
   for anyone who cannot rely on the colour. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  opacity: 0.45;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__dot--on {
  background: var(--accent-good);
  opacity: 1;
  box-shadow: 0 0 5px color-mix(in srgb, var(--accent-good) 65%, transparent);
}
/* Damage-protection marker keeps its legacy glyph — players already read it. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__dp {
  flex: 0 0 auto;
  vertical-align: middle;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__cell {
  min-width: 0;
  font-size: 9.5px;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}
@media (min-width: 720px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__cell {
    font-size: 12px;
  }
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: center;
  white-space: nowrap;
  color: var(--text-primary);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__race {
  text-align: center;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__head .gc-fed-roster__num {
  color: var(--text-muted);
}
/* Full figure on wide screens, abbreviated once the column gets tight. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__pr-abbrev {
  display: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__action {
  display: flex;
  flex-wrap: nowrap;
  gap: 3px;
  justify-content: flex-end;
  min-width: 0;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 18px;
  padding: 0 5px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  color: var(--text-secondary);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
@media (min-width: 720px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__action {
    gap: 5px;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__btn {
    min-height: 24px;
    padding: 0 10px;
    font-size: 9px;
    letter-spacing: 0.1em;
  }
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__btn--ok {
  border-color: var(--accent-good);
  color: var(--accent-good);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__btn--ok:hover {
  background: var(--accent-good);
  color: var(--text-inverse);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__btn--no {
  border-color: var(--accent-hot);
  color: var(--accent-hot);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__btn--no:hover {
  background: var(--accent-hot);
  color: var(--text-inverse);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--accent);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__note {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-align: right;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (min-width: 720px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__pill {
    padding: 2px 9px;
    font-size: 9px;
    letter-spacing: 0.1em;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__note {
    font-size: 9px;
    letter-spacing: 0.08em;
  }
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__notes {
  display: grid;
  gap: 3px;
  padding: 3px 6px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bg-base) 35%, transparent);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__notes p {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-muted);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__notes span {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-right: 6px;
}

/* -------- Roster: stacked cards on narrow screens -------- */
/* Power abbreviates before the column collapses, matching .gc-fed-list. */
@media (max-width: 900px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__pr-full {
    display: none;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster__pr-abbrev {
    display: inline;
  }
}


/* =========================================================
   FEDERATION PUBLIC PROFILE (f_fed_join.cfm&fid=)
   The recruiting page other players see before applying.
   ========================================================= */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-page {
  display: grid;
  gap: 10px;
  width: min(100%, 1100px);
  margin: 0 auto;
  padding: 4px 12px 16px;
  box-sizing: border-box;
}

/* Mobile-first: identity stacked over a compact text fact list. The whole band
   is deliberately shallow — on a phone this sits above the recruitment copy,
   which is what the visitor actually came to read. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-hero {
  display: grid;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, var(--bg-surface)), var(--bg-surface));
  box-shadow: var(--shadow-md);
}
/* Left column: identity over diplomacy. Right column: stats over the apply
   control. Both stack into one flow on a phone. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-hero__lead,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-hero__aside {
  display: grid;
  gap: 8px;
  align-content: start;
  min-width: 0;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-hero__identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-hero__flag {
  display: inline-flex;
  flex: 0 0 auto;
  padding: 3px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-base);
  box-shadow: var(--shadow-sm);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-hero__flag .gc-fedflag {
  width: 72px;
  height: 36px;
}
@media (min-width: 780px) {
  /* Facts move beside the identity rather than under it, so the band stays
     about one identity-block tall instead of two. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-hero {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 18px;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-hero__flag .gc-fedflag {
    width: 88px;
    height: 44px;
  }
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-hero__copy {
  min-width: 0;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-hero__eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-hero__title {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-size: clamp(20px, 4.4vw, 30px);
  font-weight: 600;
  line-height: 1.15;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-hero__sub {
  margin: 3px 0 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text-secondary);
}
/* Two columns of plain label/value rows on a phone — no borders, no fills, no
   card padding. Reads like the compact stat block in the reference layout. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-hero__facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
  margin: 0;
  padding-top: 8px;
  border-top: 1px dashed color-mix(in srgb, var(--border) 70%, transparent);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-hero__stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 3px 0;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-hero__stat-label {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-hero__stat-value {
  margin: 0;
  min-width: 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 700;
  text-align: right;
  color: var(--text-primary);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-hero__stat-value--name {
  font-family: var(--font-body);
  overflow-wrap: anywhere;
}

@media (min-width: 780px) {
  /* Desktop: a compact 2x2 of small tiles sitting to the right of the name. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-hero__facts {
    grid-template-columns: repeat(2, minmax(104px, auto));
    gap: 6px;
    padding-top: 0;
    border-top: 0;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-hero__stat {
    display: grid;
    gap: 1px;
    justify-content: unset;
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-surface-alt);
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-hero__stat-value {
    font-size: 14px;
    text-align: left;
  }
}

/* -------- Diplomacy, folded into the header's left column -------- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-diplo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px dashed color-mix(in srgb, var(--border) 70%, transparent);
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-diplo__label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* -------- Enlist control, under the stat block -------- */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-enlist {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-enlist__note {
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-muted);
}
@media (min-width: 780px) {
  /* Right-aligned so the button lines up with the edge of the stat grid. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-enlist {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-enlist__note {
    text-align: center;
  }
}

/* Leader-authored recruitment copy — sanitised, but still arbitrary markup, so
   it is fenced in so it cannot break the profile layout. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-about {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-about img,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-about table {
  max-width: 100%;
}

/* War opponents as inline chips — a fed can be at war with several others, and
   a stacked list would make the header grow with each one. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-wars {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-wars__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border: 1px solid color-mix(in srgb, var(--accent-hot) 45%, var(--border));
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--accent-hot) 9%, transparent);
  font-size: 10.5px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-wars__link:hover {
  border-color: var(--accent-hot);
  background: color-mix(in srgb, var(--accent-hot) 20%, transparent);
}

@media (max-width: 519.98px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-page,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fed-roster-page {
    gap: 8px;
    padding: 4px 8px 14px;
  }
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-hero {
    padding: 10px;
  }
  /* Facts drop to one column only on the very narrowest screens; two columns
     of label/value pairs still fit comfortably at 400px. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedpro-hero__facts {
    gap: 0 12px;
  }
}


/* =========================================================
   FEDERATION DISCUSSION BOARD (f_fed_forum.cfm)
   ---------------------------------------------------------
   The board used to be a paged table of seven rows with the
   compose form hidden behind a "Post New Message" link. The
   modern branch puts the composer first — posting is why most
   players open the page — and reads the thread newest first
   underneath it.

   A post is two stacked bands rather than a table row: a meta
   strip carrying author, actions and date, then the body at
   full width below. That is what lets a long message use the
   whole column instead of being squeezed beside a 150px
   author cell, which is the main thing the legacy table got
   wrong. The "From / Date" captions above the list are a
   presentational echo of the strip, so they are aria-hidden
   and collapse away on phones where the strip wraps.

   Nebula/Daylight only — Classic keeps the legacy table.
   ========================================================= */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard {
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* Full width; the inset lives on .gc-fedboard__panel — see .gc-battlelog. */
  width: 100%;
  margin: 8px auto 12px;
  box-sizing: border-box;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard__panel {
  /* Matches .gc-battlelog: the inset rides the bordered element. */
  width: 95%;
  max-width: 900px;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  box-sizing: border-box;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-surface-alt));
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard__title {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  line-height: 1.2;
  color: var(--accent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard__channel {
  min-width: 0;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* -------- Post / delete confirmations -------- */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard__notice {
  width: 95%;
  max-width: 900px;
  margin: 0 auto;
  padding: 6px 12px;
  border: 1px solid color-mix(in srgb, var(--accent-good) 40%, var(--border));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--accent-good) 12%, var(--bg-surface));
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  color: var(--accent-good);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard__notice--warn {
  border-color: color-mix(in srgb, var(--accent-hot) 40%, var(--border));
  background: color-mix(in srgb, var(--accent-hot) 12%, var(--bg-surface));
  color: var(--accent-hot);
}

/* -------- Composer -------- */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-compose__body {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px 12px 11px;
}

/* The placeholder and the character line already name the field on screen, so
   the label stays in the accessibility tree only. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-compose__label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-compose__input {
  width: 100%;
  max-height: 320px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-base);
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-primary);
  resize: vertical;
  overflow-y: auto;
  box-sizing: border-box;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-compose__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--ring);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-compose__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-compose__limit {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-compose__count {
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-compose__send {
  appearance: none;
  flex: 0 0 auto;
  min-height: 32px;
  padding: 7px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-inverse);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background var(--dur-fast) var(--ease);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-compose__send::before,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-compose__send::after {
  content: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-compose__send:hover {
  background: var(--accent-hover);
}

/* -------- Thread -------- */

/* Captions sit on the same grid as a post's meta strip so they line up with
   the values beneath them. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-thread__columns {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 5px 12px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--accent-cool) 7%, var(--bg-surface-alt));
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-posts {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-post + .gc-fedboard-post {
  border-top: 1px solid var(--border);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-post__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  padding: 6px 12px;
  background: var(--bg-elevated);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}

/* Your own posts take an accent rail on the meta strip — enough to find
   yourself in a long thread without colouring the whole row. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-post--own .gc-fedboard-post__meta {
  box-shadow: inset 3px 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-post__from {
  display: inline-flex;
  flex: 1 1 auto;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-post__author {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent-gold);
  overflow-wrap: anywhere;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-post--own .gc-fedboard-post__author {
  color: var(--accent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-post__badge {
  padding: 0 5px;
  border: 1px solid color-mix(in srgb, var(--accent-cool) 50%, var(--border));
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--accent-cool) 12%, transparent);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-cool);
  white-space: nowrap;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-post__actions {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-post__action {
  padding: 1px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-post__action:hover {
  border-color: var(--accent-hot);
  color: var(--accent-hot);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-post__date {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  white-space: nowrap;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-post__body {
  padding: 9px 12px 11px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Bodies are stored markup going back years — keep an oversized paste from
   breaking the post out of the panel. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-post__body img,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-post__body table {
  max-width: 100%;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-post__body a {
  color: var(--link);
}

/* -------- Pager -------- */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface-alt);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-pager__link {
  padding: 3px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-decoration: none;
  transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) a.gc-fedboard-pager__link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* The dead end of the thread keeps its slot so the live control does not
   slide across the panel between pages. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-pager__link--off {
  border-style: dashed;
  background: transparent;
  color: var(--text-muted);
  opacity: 0.55;
}

/* -------- Empty states -------- */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard__empty,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard__void {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 26px 14px;
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard__empty-line,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard__void-line {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard__empty-hint,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard__void-hint {
  margin: 0;
  max-width: 34em;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard__void-action {
  margin-top: 6px;
  padding: 5px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-inverse);
  text-decoration: none;
}

/* -------- Wider viewports -------- */

@media (min-width: 640px) {
  /* Below this the meta strip wraps onto two lines, so captions sitting above
     it would point at the wrong things. They appear only once the strip is a
     single row. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-thread__columns {
    display: flex;
    justify-content: space-between;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-post__meta {
    flex-wrap: nowrap;
    padding: 6px 14px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-post__body {
    padding: 10px 14px 12px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-compose__body {
    padding: 11px 14px 12px;
  }

  /* Actions reveal on hover once there is a pointer, so a long thread is not a
     column of repeated buttons. Focus keeps them reachable by keyboard. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-post__action {
    opacity: 0;
    transition: opacity var(--dur-fast) var(--ease),
                border-color var(--dur-fast) var(--ease),
                color var(--dur-fast) var(--ease);
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-post:hover .gc-fedboard-post__action,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-post__action:focus {
    opacity: 1;
  }
}

@media (hover: none) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-post__action {
    opacity: 1;
  }
}

/* -------- Narrowest phones -------- */

@media (max-width: 519.98px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard {
    gap: 8px;
    margin: 6px auto 10px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-compose__body {
    padding: 9px 10px 10px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-post__meta,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-post__body {
    padding-left: 10px;
    padding-right: 10px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-post__body,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-compose__input {
    font-size: 12.5px;
  }

  /* The date drops to its own line under the author rather than squeezing the
     name, which is the value worth keeping legible. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-post__date {
    flex-basis: 100%;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedboard-pager {
    padding: 7px 10px;
  }
}


/* =========================================================
   ENGAGEMENT LOG (s_com_attack_prev.cfm, f_fed_prev.cfm)
   ========================================================= */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedprev,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog-page {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin: 8px auto 12px;
  box-sizing: border-box;
}

/* f_com_attack_prev.cfm wraps the same log panel with a line of related
   links above it. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog-page__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog-page__links a {
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 1px dotted var(--border-strong);
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog-page__links a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog-page__sep {
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedprev__panel {
  --bl-when: 54px;
  --bl-outcome: auto;
  --bl-gap: 7px;

  display: block;
  width: 98%;
  max-width: 900px;
  margin: 4px auto 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  box-sizing: border-box;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedprev .gc-battlelog,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedprev .gc-fedprev__panel,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog-page .gc-battlelog {
  margin-top: 0;
  margin-bottom: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__head,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedprev__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-surface-alt));
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__title,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedprev__title {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  line-height: 1.2;
  color: var(--accent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__meta {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__meta-win {
  color: var(--accent-good);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__meta-loss {
  color: var(--accent-hot);
}

/* -------- Column captions --------
   Hidden on phones: with the roles screen-reader only, the arrow and the
   outcome pill carry the meaning, and the strip would cost a line that the
   narrow columns cannot align to anyway. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__columns {
  display: none;
}

/* -------- The list -------- */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* One row at every width. The three parts never stack. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__row {
  display: grid;
  grid-template-columns: var(--bl-when) minmax(0, 1fr) var(--bl-outcome);
  align-items: center;
  gap: var(--bl-gap);
  padding: 5px 9px;
  border-left: 3px solid transparent;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__row + .gc-battlelog__row {
  border-top: 1px solid var(--border);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__row--win {
  border-left-color: color-mix(in srgb, var(--accent-good) 65%, transparent);
  background: color-mix(in srgb, var(--accent-good) 5%, transparent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__row--loss {
  border-left-color: color-mix(in srgb, var(--accent-hot) 65%, transparent);
  background: color-mix(in srgb, var(--accent-hot) 5%, transparent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__when {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__date {
  font-size: 9.5px;
  color: var(--text-secondary);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__time {
  font-size: 8.5px;
  color: var(--text-muted);
}

/* -------- Attacker vs defender -------- */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__combat {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__side {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

/* The pair reads inward toward the arrow. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__side--attacker {
  text-align: right;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__side--defender {
  text-align: left;
}

/* Screen-reader only at every width — a visible role label costs a line per
   side, and the arrow plus the captions above already say which is which.

   user-select keeps it out of a copied selection. The copy handler in
   s_com_attack_prev.cfm normally replaces the payload wholesale, so this is
   the fallback for when that does not run: clipped-but-selectable text is
   still copied, which is how "Attacker*" ended up pasted into the middle of
   a battle row. Selection is not part of the accessibility tree, so screen
   readers still announce it. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__role {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
  -webkit-user-select: none;
  user-select: none;
}

/* Same reasoning for the status markers and the arrow: decoration in the
   layout, noise in a paste ('Online now' on its own line). */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__flags,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__arrow {
  -webkit-user-select: none;
  user-select: none;
}

/* Name and flags are separate cells so only the name is allowed to clip —
   an empire long enough to overflow used to break mid-word ("MaggotInfsted /
   Hemroid") and shove the online/DP markers onto a second line with it. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__who {
  display: flex;
  align-items: baseline;
  gap: 3px;
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__side--attacker .gc-battlelog__who {
  justify-content: flex-end;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--accent-gold);
}

/* A resolved empire links to its intel page. The name keeps its gold
   rather than main.css's link colour — colour is doing identity work here,
   not link work, so the underline on hover carries the affordance instead.
   Selector names the element (a.) to clear the legacy a:hover rules. */
body:is([data-theme="nebula"], [data-theme="daylight"]) a.gc-battlelog__name {
  color: var(--accent-gold);
  text-decoration: none;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) a.gc-battlelog__name:hover,
body:is([data-theme="nebula"], [data-theme="daylight"]) a.gc-battlelog__name:focus {
  color: var(--accent);
  text-decoration: underline;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__flags {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__flag {
  vertical-align: baseline;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__power {
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__power--none {
  opacity: 0.5;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__arrow {
  align-self: center;
  font-size: 12px;
  line-height: 1;
  color: var(--accent-cool);
}

/* -------- Outcome -------- */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__outcome {
  justify-self: end;
  padding: 1px 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.5;
  text-transform: uppercase;
  white-space: nowrap;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__row--win .gc-battlelog__outcome {
  border-color: color-mix(in srgb, var(--accent-good) 50%, var(--border));
  background: color-mix(in srgb, var(--accent-good) 14%, transparent);
  color: var(--accent-good);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__row--loss .gc-battlelog__outcome {
  border-color: color-mix(in srgb, var(--accent-hot) 50%, var(--border));
  background: color-mix(in srgb, var(--accent-hot) 14%, transparent);
  color: var(--accent-hot);
}

/* -------- Pager, note, empty -------- */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface-alt);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__pager-link {
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-decoration: none;
  transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) a.gc-battlelog__pager-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* The end of the log keeps its slot so the live control does not slide across
   the panel between pages. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__pager-link--off {
  border-style: dashed;
  background: transparent;
  color: var(--text-muted);
  opacity: 0.55;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__note {
  margin: 0;
  padding: 6px 10px 8px;
  border-top: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  font-size: 10px;
  line-height: 1.45;
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__empty,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedprev__void {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 24px 14px;
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__empty-line,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedprev__void-line {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__empty-hint,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedprev__void-hint {
  margin: 0;
  max-width: 34em;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedprev__void-action {
  margin-top: 6px;
  padding: 5px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-inverse);
  text-decoration: none;
}

/* -------- Roomier phones -------- */

@media (min-width: 420px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedprev__panel {
    --bl-when: 66px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__name {
    font-size: 10px;
  }
}

/* -------- Wider viewports -------- */

@media (min-width: 640px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedprev,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog-page {
    gap: 10px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedprev__panel {
    /* Fixed tracks here so the caption strip can line up with the cards. */
    --bl-when: 104px;
    --bl-outcome: 64px;
    --bl-gap: 12px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__head,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedprev__head {
    padding: 7px 12px;
  }

  /* Captions share the card's grid, so each sits over its own column. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__columns {
    display: grid;
    grid-template-columns: var(--bl-when) minmax(0, 1fr) var(--bl-outcome);
    align-items: center;
    gap: var(--bl-gap);
    padding: 5px 12px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--accent-cool) 7%, var(--bg-surface-alt));
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__columns-vs {
    /* Mirrors .gc-battlelog__combat; the middle cell is the hidden arrow
       holding that column open. */
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    min-width: 0;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__columns-vs > span:first-child {
    text-align: right;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__columns > span:last-child {
    text-align: right;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__columns-gap {
    visibility: hidden;
    font-size: 12px;
    line-height: 1;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__row {
    padding: 7px 12px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__combat {
    gap: 12px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__date {
    font-size: 10.5px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__time {
    font-size: 9.5px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__name {
    font-size: 11px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__power {
    font-size: 9.5px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__outcome {
    padding: 1px 9px;
    font-size: 9px;
    letter-spacing: 0.12em;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__pager,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__note {
    padding-left: 12px;
    padding-right: 12px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-battlelog__note {
    font-size: 10.5px;
  }
}


/* =========================================================
   FEDERATION WAR — DIPLOMATIC CENTER (f_fed_war.cfm)
   Reuses .gc-panel and .gc-fedhq-status__badge from HQ.
   Mobile first: one column, then target + hostile side by
   side from 640px with Declare War spanning both.
   Nebula/Daylight only — Classic keeps the legacy tables.
   ========================================================= */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar {
  display: grid;
  gap: 10px;
  width: 95%;
  max-width: 1100px;
  margin: 8px auto 14px;
  box-sizing: border-box;
}

/* -------- Hero -------- */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar__hero {
  /* Grid, not wrapping flex: wrapped flex items each hug the left of
     their own line, which left the header in half the width on phones. */
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar__hero--war {
  border-left-color: var(--accent-hot);
  background: color-mix(in srgb, var(--accent-hot) 9%, var(--bg-surface));
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar__hero--peace {
  border-left-color: var(--accent-good);
  background: color-mix(in srgb, var(--accent-good) 6%, var(--bg-surface));
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar__ident {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar__flag img,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar__foe-flag img {
  display: block;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar__ident-text {
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar__eyebrow {
  margin: 0 0 2px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

/* -------- Result notice -------- */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar__notice {
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.45;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar__notice--good {
  border-color: color-mix(in srgb, var(--accent-good) 45%, var(--border));
  background: color-mix(in srgb, var(--accent-good) 12%, var(--bg-surface));
  color: var(--accent-good);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar__notice--bad {
  border-color: color-mix(in srgb, var(--accent-hot) 45%, var(--border));
  background: color-mix(in srgb, var(--accent-hot) 12%, var(--bg-surface));
  color: var(--accent-hot);
}

/* -------- Panels -------- */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar__grid {
  display: grid;
  gap: 10px;
  align-items: start;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar__foes {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar__foe {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-left: 3px solid color-mix(in srgb, var(--accent-hot) 50%, var(--border));
  border-radius: var(--radius-sm);
  background: var(--bg-surface-alt);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar__foe--target {
  border-left-color: var(--accent-hot);
  background: color-mix(in srgb, var(--accent-hot) 8%, var(--bg-surface-alt));
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar__foe-flag {
  flex: 0 0 auto;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar__foe-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) a.gc-fedwar__foe-name {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-gold);
  text-decoration: none;
  overflow-wrap: anywhere;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) a.gc-fedwar__foe-name:hover,
body:is([data-theme="nebula"], [data-theme="daylight"]) a.gc-fedwar__foe-name:focus {
  color: var(--accent);
  text-decoration: underline;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar__foe-stats {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar__hint {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar__hint--warn {
  margin: 0;
  padding: 12px 10px;
  border: 1px dashed color-mix(in srgb, var(--accent-hot) 55%, var(--border));
  border-radius: var(--radius-sm);
  text-align: center;
  color: var(--accent-hot);
}

/* -------- Controls -------- */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar__action {
  margin: 10px 0 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar button.gc-fedwar__btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 36px;
  padding: 0 18px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}

/* main.css's `a.button:before,button:after` also matches plain buttons and
   grows a pseudo-element to width:100% on hover. In an inline-flex button
   that pseudo is a flex item, so it squeezed the label into half the button. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar button.gc-fedwar__btn::before,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar button.gc-fedwar__btn::after {
  content: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar button.gc-fedwar__btn--war {
  border-color: var(--accent-hot);
  background: var(--accent-hot);
  color: var(--text-inverse);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar button.gc-fedwar__btn--war:hover {
  background: color-mix(in srgb, var(--accent-hot) 82%, var(--text-primary));
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar button.gc-fedwar__btn--peace {
  border-color: var(--accent-good);
  background: color-mix(in srgb, var(--accent-good) 16%, transparent);
  color: var(--accent-good);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar button.gc-fedwar__btn--peace:hover {
  background: var(--accent-good);
  color: var(--text-inverse);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar__declare {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar__field {
  display: flex;
  flex: 1 1 100%;
  flex-direction: column;
  gap: 5px;
  margin: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar__field-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) a.gc-fedwar__help {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  font-size: 9px;
  letter-spacing: 0;
  color: var(--text-secondary);
  text-decoration: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) a.gc-fedwar__help:hover {
  border-color: var(--accent);
  color: var(--accent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar input.gc-fedwar__input {
  width: 100%;
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-base);
  font-family: var(--font-mono);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  box-sizing: border-box;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar input.gc-fedwar__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--ring);
}

/* -------- Wider -------- */

@media (min-width: 420px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar__field {
    flex: 1 1 160px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar button.gc-fedwar__btn {
    width: auto;
  }
}

@media (min-width: 640px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar__panel--wide {
    grid-column: 1 / -1;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar__hero {
    padding: 14px 16px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar__title {
    font-size: 21px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedwar__field {
    flex: 0 1 240px;
  }
}


/* =========================================================
   FEDERATION ELECTION (f_fed_elect.cfm)
   Same shell as the Diplomatic Center. Standings are cards
   with a bar toward the majority threshold; the ballot sits
   beside them from 768px.
   Nebula/Daylight only — Classic keeps the legacy tables.
   ========================================================= */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect {
  display: grid;
  gap: 10px;
  width: 95%;
  max-width: 1100px;
  margin: 8px auto 14px;
  box-sizing: border-box;
}

/* -------- Hero -------- */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__hero {
  /* Grid, not wrapping flex: wrapped flex items each hug the left of
     their own line, which left the header in half the width on phones. */
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--accent) 7%, var(--bg-surface));
  box-shadow: var(--shadow-sm);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__ident {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__flag img {
  display: block;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__ident-text {
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__eyebrow {
  margin: 0 0 2px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__leader {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  max-width: 40vw;
  margin: 0;
  min-width: 0;
  text-align: right;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__leader dt {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__leader dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-gold);
  overflow-wrap: anywhere;
}

/* -------- Notice -------- */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__notice {
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.45;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__notice--good {
  border-color: color-mix(in srgb, var(--accent-good) 45%, var(--border));
  background: color-mix(in srgb, var(--accent-good) 12%, var(--bg-surface));
  color: var(--accent-good);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__notice--bad {
  border-color: color-mix(in srgb, var(--accent-hot) 45%, var(--border));
  background: color-mix(in srgb, var(--accent-hot) 12%, var(--bg-surface));
  color: var(--accent-hot);
}

/* -------- Standings -------- */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__grid {
  display: grid;
  gap: 10px;
  align-items: start;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__cand {
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-surface-alt);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__cand--majority {
  border-left-color: var(--accent-good);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__cand--leader {
  border-left-color: var(--accent-gold);
  background: color-mix(in srgb, var(--accent-gold) 7%, var(--bg-surface-alt));
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__cand--me {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__cand-top,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__cand-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__who {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) a.gc-fedelect__name {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-gold);
  text-decoration: none;
  overflow-wrap: anywhere;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) a.gc-fedelect__name:hover,
body:is([data-theme="nebula"], [data-theme="daylight"]) a.gc-fedelect__name:focus {
  color: var(--accent);
  text-decoration: underline;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__online {
  vertical-align: middle;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__tag {
  padding: 0 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.6;
  text-transform: uppercase;
  color: var(--text-secondary);
  white-space: nowrap;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__tag--leader {
  border-color: color-mix(in srgb, var(--accent-gold) 55%, var(--border));
  background: color-mix(in srgb, var(--accent-gold) 14%, transparent);
  color: var(--accent-gold);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__tag--majority {
  border-color: color-mix(in srgb, var(--accent-good) 55%, var(--border));
  background: color-mix(in srgb, var(--accent-good) 14%, transparent);
  color: var(--accent-good);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__votes {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__votes strong {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  color: var(--text-primary);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__bar {
  height: 5px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--border) 70%, transparent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent-cool);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__cand--majority .gc-fedelect__bar-fill {
  background: var(--accent-good);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__planets {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__assume {
  margin: 0;
}

/* -------- Ballot -------- */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__current {
  margin: 0 0 3px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-secondary);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__current strong {
  font-family: var(--font-mono);
  color: var(--accent-gold);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__weight {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__field {
  display: flex;
  flex: 1 1 100%;
  flex-direction: column;
  gap: 5px;
  margin: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__field-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect select.gc-fedelect__select {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--bg-base);
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-primary);
  box-sizing: border-box;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect select.gc-fedelect__select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--ring);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect button.gc-fedelect__btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 36px;
  padding: 0 18px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-pill);
  background: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-inverse);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background var(--dur-fast) var(--ease);
}

/* main.css's `a.button:before,button:after` also matches plain buttons and
   grows a pseudo-element to width:100% on hover. In an inline-flex button
   that pseudo is a flex item, so it squeezed the label into half the button. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect button.gc-fedelect__btn::before,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect button.gc-fedelect__btn::after {
  content: none;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect button.gc-fedelect__btn:hover {
  background: var(--accent-hover);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect button.gc-fedelect__btn--assume {
  width: auto;
  min-height: 28px;
  padding: 0 12px;
  border-color: var(--accent-good);
  background: var(--accent-good);
  font-size: 9px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect button.gc-fedelect__btn--assume:hover {
  background: color-mix(in srgb, var(--accent-good) 82%, var(--text-primary));
}

/* -------- Wider -------- */

@media (min-width: 420px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__field {
    flex: 1 1 180px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect button.gc-fedelect__btn {
    width: auto;
  }
}

@media (min-width: 640px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__hero {
    padding: 14px 16px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__title {
    font-size: 21px;
  }
}

@media (min-width: 768px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-fedelect__grid {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  }
}


/* =========================================================
   CHAT ABUSE REPORT (f_com_msgsector2.cfm)

   Built on the same panel/post/pager shapes as .gc-fedboard:
   this page is reached from chat and reads as a message list
   too, so borrowing the board's language keeps the two from
   looking like different products. The differences are the
   ones that carry meaning - the post being reported gets a
   hot-accent rail, and the remaining-complaints count sits
   in the panel head.

   Nebula/Daylight only - Classic keeps the legacy tables.
   ========================================================= */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin: 8px auto 12px;
  box-sizing: border-box;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse__panel {
  width: 95%;
  max-width: 900px;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  box-sizing: border-box;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-surface-alt));
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse__title {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  line-height: 1.2;
  color: var(--accent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse__meta {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  color: var(--text-muted);
}

/* -------- Outcome notices -------- */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse__notice {
  width: 95%;
  max-width: 900px;
  margin: 0 auto;
  padding: 6px 12px;
  border: 1px solid color-mix(in srgb, var(--accent-good) 40%, var(--border));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--accent-good) 12%, var(--bg-surface));
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  color: var(--accent-good);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse__notice--warn {
  border-color: color-mix(in srgb, var(--accent-hot) 40%, var(--border));
  background: color-mix(in srgb, var(--accent-hot) 12%, var(--bg-surface));
  color: var(--accent-hot);
}

/* -------- The complaint form -------- */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-file__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px 11px;
}

/* The post under report. The rail is the point of the block: it marks this as
   quoted evidence rather than another item in the list. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-quote {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 7px 10px;
  border-left: 2px solid var(--accent-hot);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--bg-surface-alt);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-quote__author {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-hot);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-quote__server {
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-quote__post {
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
  color: var(--text);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-file__label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-file__input {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface-alt);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  box-sizing: border-box;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-file__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-file__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-file__limit {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-file__count {
  color: var(--text);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-file__buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-file__cancel {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-file__cancel:hover {
  color: var(--text);
}

/* Filing is the consequential action on this page, so it takes the hot accent
   rather than the board composer's neutral one. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-file__send {
  padding: 6px 14px;
  border: 1px solid color-mix(in srgb, var(--accent-hot) 55%, var(--border));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--accent-hot) 14%, var(--bg-surface-alt));
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-hot);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-file__send:hover {
  border-color: var(--accent-hot);
  background: color-mix(in srgb, var(--accent-hot) 24%, var(--bg-surface-alt));
}

/* -------- The reportable chat log -------- */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-posts {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Post text and the Report card sit side by side. The card is always visible:
   reporting is the only reason this page exists, so it should never need to be
   discovered by hovering. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-post {
  display: flex;
  align-items: stretch;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-post + .gc-chatabuse-post {
  border-top: 1px solid var(--border);
}

/* min-width:0 so a long unbroken post wraps instead of shoving the card out. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-post__main {
  flex: 1 1 auto;
  min-width: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-post__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  padding: 7px 12px 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-post__author {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-post__server {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

/* The Report card. Centred on the post's height so it stays put whether the
   post is one line or five. */
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-post__report {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  align-self: center;
  width: 78px;
  margin: 8px 10px 8px 6px;
  padding: 9px 6px;
  border: 1px solid color-mix(in srgb, var(--accent-hot) 35%, var(--border));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--accent-hot) 8%, var(--bg-surface-alt));
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none;
  color: var(--accent-hot);
  transition: background 120ms ease, border-color 120ms ease;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-post__report:hover,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-post__report:focus {
  border-color: var(--accent-hot);
  background: color-mix(in srgb, var(--accent-hot) 22%, var(--bg-surface-alt));
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-post__body {
  padding: 2px 12px 8px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
  color: var(--text);
}

/* -------- Pager -------- */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface-alt);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-pager__link {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--accent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) a.gc-chatabuse-pager__link:hover {
  color: var(--text);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-pager__link--off {
  color: var(--text-muted);
  opacity: 0.5;
}

/* -------- Empty state + guidance -------- */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse__empty {
  padding: 18px 12px;
  text-align: center;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse__empty-line {
  margin: 0 0 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse__empty-hint {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-help__body {
  padding: 9px 12px 10px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-help__body p {
  margin: 0 0 6px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-muted);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-help__links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 0;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-help__links a {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--accent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-help__links a:hover {
  color: var(--text);
}

/* -------- Phones -------- */

@media (max-width: 519.98px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse {
    gap: 8px;
    margin: 6px auto 10px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-file__body {
    padding: 9px 10px 10px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-post__meta,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-post__body {
    padding-left: 10px;
    padding-right: 8px;
  }

  /* Stays on the right, just narrower — the post text is what gives up room. */
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-post__report {
    width: 62px;
    margin: 7px 8px 7px 2px;
    padding: 8px 4px;
    letter-spacing: 0.08em;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-post__body,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-quote__post,
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-file__input {
    font-size: 12.5px;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-file__buttons {
    width: 100%;
    justify-content: space-between;
  }

  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatabuse-pager {
    padding: 7px 10px;
  }
}


/* =========================================================
   CHAT NAV BUTTONS - modern (f_com_msgsector.cfm)

   Base layout comes from main.css .gc-chatnav; this only
   restyles the buttons in the theme's own language, so they
   read as siblings of the Report card on the abuse page and
   the composer's send button on the fed board.
   ========================================================= */

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatnav {
  gap: 8px;
  margin: 10px auto 12px;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatnav__btn {
  padding: 8px 18px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-surface-alt));
  box-shadow: var(--shadow-md);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  transition: background 120ms ease, border-color 120ms ease;
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatnav__btn:hover,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatnav__btn:focus {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 20%, var(--bg-surface-alt));
  color: var(--accent);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatnav__btn--warn {
  border-color: color-mix(in srgb, var(--accent-hot) 35%, var(--border));
  background: color-mix(in srgb, var(--accent-hot) 8%, var(--bg-surface-alt));
  color: var(--accent-hot);
}

body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatnav__btn--warn:hover,
body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatnav__btn--warn:focus {
  border-color: var(--accent-hot);
  background: color-mix(in srgb, var(--accent-hot) 22%, var(--bg-surface-alt));
  color: var(--accent-hot);
}

@media (max-width: 519.98px) {
  body:is([data-theme="nebula"], [data-theme="daylight"]) .gc-chatnav__btn {
    padding: 8px 12px;
    letter-spacing: 0.08em;
  }
}

/* =========================================================
   EVENT REWARDS — POINTS BALANCE, CATALOGUE, LEDGER
   (f_com_eventrewards.cfm)
   ========================================================= */

.gc-evrw {
  max-width: 900px;
  margin: 0 auto;
  padding-block: 0.5rem;
  font-size: 13px;
}

.gc-evrw__intro {
  margin: 0 0 1rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.gc-evrw__flash {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface-alt);
  color: var(--text-primary);
}

.gc-evrw__empty {
  margin: 0;
  padding: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

/* --- Balance ------------------------------------------------------------ */

.gc-evrw-hero {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.gc-evrw-hero__card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 190px;
  padding: 0.85rem 1.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface-alt);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.gc-evrw-hero__label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.gc-evrw-hero__value {
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--accent-gold);
}

.gc-evrw-hero__hint {
  font-size: 11px;
  color: var(--text-muted);
}

/* --- Catalogue sections ------------------------------------------------- */

.gc-evrw-section {
  margin-bottom: 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  overflow: hidden;
}

.gc-evrw-section__head {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px dashed var(--border);
  background: var(--bg-surface-alt);
}

.gc-evrw-section__title {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

/* --- Reward rows -------------------------------------------------------- */

.gc-evrw-list {
  display: grid;
  grid-template-columns: auto minmax(max-content, auto) minmax(max-content, auto);
  margin: 0;
  padding: 0;
  list-style: none;
}

.gc-evrw-list__head,
.gc-evrw-list__row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
}

.gc-evrw-list__head {
  border-bottom: 1px dashed var(--border);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.gc-evrw-list__head > span + span,
.gc-evrw-list__row > span + span { text-align: center; }

.gc-evrw-list__row + .gc-evrw-list__row { border-top: 1px dashed var(--border); }

.gc-evrw-list__row--short { opacity: 0.62; }

.gc-evrw-list__name {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 0.4rem;
  overflow-wrap: anywhere;
  color: var(--text-primary);
}

.gc-evrw-list__desc {
  flex: 1 0 100%;
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-muted);
}

.gc-evrw-list__cost {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--accent-gold);
}

.gc-evrw-list__note {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.gc-evrw-list__act {
  display: flex;
  justify-content: center;
}

.gc-evrw-list__form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin: 0;
  padding: 0;
}

a.gc-evrw-list__note { color: var(--link); text-decoration: underline; }
a.gc-evrw-list__note:hover { color: var(--link-hover); }

/* Which infrastructure the +2 goes to. */
.gc-evrw-choice {
  max-width: 150px;
  padding: 4px 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--text-primary);
}

/* Label kept for screen readers; the select is self-evident on screen. */
.gc-evrw-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.gc-evrw-tag {
  padding: 1px 5px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  white-space: nowrap;
}

.gc-evrw-tag--manual {
  border-color: color-mix(in srgb, var(--accent-cool) 45%, var(--border));
  color: var(--accent-cool);
}

.gc-evrw-buy {
  padding: 5px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--accent) 10%, var(--bg-surface-alt));
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}

.gc-evrw-buy:hover,
.gc-evrw-buy:focus {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 22%, var(--bg-surface-alt));
}

/* --- Activity ledger ---------------------------------------------------- */

.gc-evrw-log {
  display: grid;
  grid-template-columns: minmax(max-content, auto) auto minmax(max-content, auto) minmax(max-content, auto);
  margin: 0;
  padding: 0;
  list-style: none;
}

.gc-evrw-log__head,
.gc-evrw-log__row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
}

.gc-evrw-log__head {
  border-bottom: 1px dashed var(--border);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.gc-evrw-log__head > span + span,
.gc-evrw-log__row > span + span { text-align: center; }

.gc-evrw-log__row + .gc-evrw-log__row { border-top: 1px dashed var(--border); }

.gc-evrw-log__when,
.gc-evrw-log__amt,
.gc-evrw-log__bal {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.gc-evrw-log__what { overflow-wrap: anywhere; color: var(--text-secondary); }

.gc-evrw-log__amt--in  { color: var(--accent-good); }
.gc-evrw-log__amt--out { color: var(--accent-hot); }
.gc-evrw-log__bal      { color: var(--text-primary); }

/* --- Narrow screens ----------------------------------------------------- */

@media (max-width: 519.98px) {
  .gc-evrw-list,
  .gc-evrw-log { grid-template-columns: 1fr; }

  .gc-evrw-list__head,
  .gc-evrw-log__head { display: none; }

  .gc-evrw-list__row,
  .gc-evrw-log__row {
    grid-template-columns: 1fr;
    justify-items: start;
    gap: 0.25rem;
  }

  .gc-evrw-list__row > span + span,
  .gc-evrw-log__row > span + span { text-align: left; }

  .gc-evrw-list__cost::after { content: " Event Points"; font-weight: 400; color: var(--text-muted); }
  .gc-evrw-log__bal::before  { content: "Balance "; color: var(--text-muted); }
}

/* --- Classic ------------------------------------------------------------ */

/* Classic's starfield shows through, so the panels get its opaque surface.
   Everything else already resolves from Classic's tokens. */
body[data-theme="classic"] .gc-evrw-section,
body[data-theme="classic"] .gc-evrw-hero__card {
  border-color: var(--border-strong);
  background: var(--bg-surface);
}

body[data-theme="classic"] .gc-evrw-hero__card { border-left-color: var(--accent-gold); }

/* ---------------------------------------------------------------------------
   Ranking rows: clipboard-safe empire cell (f_rank.cfm, f_rank2.cfm,
   f_rank_s.cfm).

   Same fault the disband row had. .gc-rank-empire was inline-flex, so Chrome's
   selection serialiser blockified its children and copying a row broke the
   empire name onto its own line. The fed-flag slot made it worse: fedFlagTag()
   returns "" for a player with no federation, but .gc-fedflag-slot--sm still
   reserves 32x16, so that empty box serialised as a second line break — the
   blank line above unaffiliated players in a copied ranking.

   Inline container + inline-block children keep the row on one line, and
   user-select:none drops the flag slot and the status letters (d = damage
   protection, a = online) from the copy, which are legend markers rather than
   part of the row's text. Result is one tab-separated line per player, the
   same in Chrome and Firefox. Scoped to .gc-rank-empire so .gc-fedflag-slot
   keeps its flex centring everywhere else it is used.
   --------------------------------------------------------------------------- */
body .gc-rank-empire {
  white-space: nowrap;
  display: inline;
  width: auto;
  max-width: none;
}

body .gc-rank-empire > a,
body .gc-rank-empire > span:not(.gc-fedflag-slot) {
  display: inline;
  vertical-align: middle;
}

body .gc-rank-empire .gc-fedflag-slot {
  vertical-align: middle;
  display: inline-block;
  text-align: center;
  line-height: 0;
  -webkit-user-select: none;
  user-select: none;
}

body .gc-rank-empire > img {
  vertical-align: middle;
  -webkit-user-select: none;
  user-select: none;
}

/* ---------------------------------------------------------------------------
   Colony detail sections: clipboard-safe cells (f_com_col.cfm).

   Same family as the disband row and the ranking cell. The value cells wrap
   their content in <div align=center> (the N/A markers, and the centred
   figures), and a block-level box inside a td makes Chrome's selection
   serialiser emit a line break — so copying a section gave "Agriculture\t\nN/A"
   with the value on its own line instead of "Agriculture\tN/A".

   inline-block keeps the value on the cell's line while width:100% plus
   text-align:center preserves the centring the align attribute was doing, so
   nothing moves on screen. The help icons are dropped from the copy: they are
   affordances, not part of the value.
   --------------------------------------------------------------------------- */
body .gc-colony-detail-table td > div,
body .gc-colony-mobile-table td > div,
body .gc-colony-detail-classic table.Default td > div {
  display: inline-block;
  width: 100%;
  vertical-align: middle;
}

body .gc-colony-detail-table td > div[align="center"],
body .gc-colony-mobile-table td > div[align="center"],
body .gc-colony-detail-classic table.Default td > div[align="center"] {
  text-align: center;
}

body .gc-colony-detail-table img[src*="help.gif"],
body .gc-colony-mobile-table img[src*="help.gif"],
body .gc-colony-detail-classic table.Default img[src*="help.gif"] {
  -webkit-user-select: none;
  user-select: none;
}


/* =========================================================
   COMMAND CENTER — THE GAME'S LANDING PAGE
   (f_com.cfm, i.cfm?f=com)

   A map of the game: three featured tiles, then one panel per
   area holding a grid of link cards. Unscoped (like the Event
   Rewards block) so it renders in every theme off the shared
   custom properties — classic, nebula and daylight all define
   the full set, so no theme-specific overrides are needed.
   ========================================================= */

.gc-hub {
  max-width: 980px;
  margin: 0 auto;
  padding-block: 8px;
  font-size: 13px;
  /* Layout below reads the hub's own width, not the window's: the shell's
     columns change around it at different window sizes, so the viewport says
     little about how much room the hub actually has. */
  container: hub / inline-size;
}

.gc-hub__title {
  margin: 0 0 6px;
  text-align: center;
}

.gc-hub__intro {
  margin: 0 0 18px;
  color: var(--text-secondary);
  line-height: 1.5;
  text-align: center;
}

.gc-hub__who {
  color: var(--text-primary);
  font-weight: 700;
}

/* --- Featured tiles ----------------------------------------------------- */

.gc-hub-featured {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.gc-hub-feature {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 15px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, var(--bg-surface-alt), var(--bg-surface));
  box-shadow: var(--shadow-sm);
  text-align: center;
  text-decoration: none;
  transition: border-color var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
}

.gc-hub-feature:hover,
.gc-hub-feature:focus-visible {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.gc-hub-feature__icon {
  margin-bottom: 5px;
  font-size: 22px;
  line-height: 1;
  color: var(--accent-cool);
}

.gc-hub-feature__name {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.gc-hub-feature__desc {
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-muted);
}

/* The one tile worth spending points on gets the gold treatment. */
.gc-hub-feature--gold {
  border-color: color-mix(in srgb, var(--accent-gold) 40%, var(--border));
}

.gc-hub-feature--gold .gc-hub-feature__icon,
.gc-hub-feature--gold .gc-hub-feature__name {
  color: var(--accent-gold);
}

.gc-hub-feature--gold:hover,
.gc-hub-feature--gold:focus-visible {
  border-color: var(--accent-gold);
}

/* --- Area panels -------------------------------------------------------- */

.gc-hub-section {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  overflow: hidden;
}

.gc-hub-section__head {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface-alt);
}

.gc-hub-section__title {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

/* --- Link cards --------------------------------------------------------- */

.gc-hub-grid {
  display: grid;
  grid-template-columns: 1fr;
}

/* Separators are drawn by the cards themselves rather than by a 1px grid gap
   over a coloured background: a section whose last row is short - a fifth
   card in a two-column grid - would otherwise paint its empty cell in the
   separator colour, which reads as a missing card. The negative
   margins lap the first row onto the header rule and the first column past the
   panel edge, where overflow:hidden clips it. */
.gc-hub-card {
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  margin: -1px 0 0 -1px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  background: var(--bg-surface);
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease);
}

.gc-hub-card:hover,
.gc-hub-card:focus-visible {
  background: var(--bg-elevated);
  text-decoration: none;
}

.gc-hub-card__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface-alt);
  font-size: 13px;
  color: var(--accent-cool);
  transition: border-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease);
}

.gc-hub-card:hover .gc-hub-card__icon,
.gc-hub-card:focus-visible .gc-hub-card__icon {
  border-color: var(--border-strong);
  color: var(--accent);
}

.gc-hub-card__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.gc-hub-card__name {
  font-weight: 700;
  color: var(--text-primary);
}

.gc-hub-card__ext {
  margin-left: 6px;
  font-size: 9px;
  vertical-align: 1px;
  opacity: 0.6;
}

.gc-hub-card__desc {
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-muted);
}

@media (max-width: 519.98px) {
  .gc-hub {
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gc-hub-feature,
  .gc-hub-card,
  .gc-hub-card__icon {
    transition: none;
  }

  .gc-hub-feature:hover,
  .gc-hub-feature:focus-visible {
    transform: none;
  }
}

/* Empire tools and Help and community: stacked by default, side by side once
   the hub is wide enough (below). Top-aligned rather than stretched, so a
   shorter panel does not grow an empty band. */
.gc-hub-sections {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.gc-hub-sections .gc-hub-section {
  margin-bottom: 0;
}

/* ---------------------------------------------------------------------------
   Command Center layout, by the hub's width (container "hub" above).

   A card reads well from about 180px, and each panel holds four - so a panel
   is either one card across or exactly two, never three. Three is what left
   one card stranded on a row of its own at in-between window sizes.

     under 420px   everything in one column; featured tiles lie flat
     420px+        featured tiles share one row; cards two across (2x2)
     760px+        the two panels side by side, still two across each
                   (760 = two 372px panels + the 16px gap)

   Browsers without container queries keep the one-column defaults above.
   --------------------------------------------------------------------------- */
@container hub (max-width: 419.98px) {
  .gc-hub-featured {
    gap: 7px;
  }

  .gc-hub-feature {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 10px;
    padding: 10px 11px;
    text-align: left;
  }

  .gc-hub-feature__icon {
    margin-bottom: 0;
    flex: 0 0 auto;
    width: 22px;
  }

  .gc-hub-feature__desc {
    flex-basis: 100%;
  }
}

@container hub (min-width: 420px) {
  /* However many featured tiles there are, they share the row equally. */
  .gc-hub-featured {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
  }

  .gc-hub-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@container hub (min-width: 760px) {
  .gc-hub-sections {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* =========================================================
   EMPIRE INTEL / SUMMARY (f_com_intel.cfm, also embedded by
   f_com_empire.cfm&cm=1|3)
   One template for all three themes: everything resolves from
   tokens, Classic adjustments sit at the end of the block.
   ========================================================= */

.gc-intel {
  display: grid;
  gap: 10px;
  width: min(100%, 1100px);
  margin: 0 auto;
  padding: 4px 12px 16px;
  box-sizing: border-box;
  font-size: 13px;
  color: var(--text-primary);
}
.gc-intel *,
.gc-intel *::before,
.gc-intel *::after {
  box-sizing: border-box;
}
.gc-intel h1,
.gc-intel h2,
.gc-intel p,
.gc-intel dl,
.gc-intel dd,
.gc-intel ul {
  margin: 0;
}
.gc-intel dt {
  font-weight: inherit;
}

/* -------- Hero band -------- */
.gc-intelhead {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 9px;
  padding: 10px 12px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, var(--bg-surface)), var(--bg-surface));
  box-shadow: var(--shadow-md);
}
/* Survey-grid texture fading in from the right: reads as a dossier sheet.
   The mask only uses alpha, so its colour is irrelevant. */
.gc-intelhead::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(color-mix(in srgb, var(--accent-cool) 10%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--accent-cool) 10%, transparent) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(100deg, transparent 40%, black);
  mask-image: linear-gradient(100deg, transparent 40%, black);
}
.gc-intelhead > * {
  position: relative;
  min-width: 0;
}
.gc-intelhead__identity {
  display: grid;
  gap: 6px;
}
.gc-intelhead__eyebrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}
/* Name with its ID tag beside it; a long name pushes the tag to the next line. */
.gc-intelhead__name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  min-width: 0;
}
.gc-intelhead__name .gc-intelhead__title {
  min-width: 0;
}
.gc-intelhead__id {
  flex: 0 0 auto;
  padding: 2px 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  line-height: 1.4;
  white-space: nowrap;
  color: var(--accent);
}
.gc-intelhead__title {
  font-family: var(--font-display);
  font-size: clamp(22px, 5vw, 32px);
  font-weight: 600;
  line-height: 1.1;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
.gc-intelhead__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.gc-intelhead__facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.gc-intelhead__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
@media (min-width: 640px) {
  .gc-intelhead {
    padding: 12px 16px 12px;
  }
  .gc-intelhead__facts {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* -------- Status badges -------- */
.gc-intel-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--bg-base) 45%, transparent);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text-secondary);
}
.gc-intel-badge--cool {
  border-color: var(--accent-cool);
  background: color-mix(in srgb, var(--accent-cool) 14%, transparent);
  color: var(--accent-cool);
}

/* Last Activity tile: status word with a dot; only "online" pulses. Sized so
   the longest state ("Seen 30d ago") stays on one line in the narrowest tile. */
.gc-intel-stat dd .gc-intel-presence {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  font-family: var(--font-mono);
  font-size: clamp(11px, 1.9vw, 13px);
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.6;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text-muted);
}
.gc-intel-presence::before {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.gc-intel-stat dd .gc-intel-presence--online { color: var(--accent-good); }
.gc-intel-stat dd .gc-intel-presence--idle   { color: var(--accent-gold); }
.gc-intel-presence--online::before {
  animation: gc-intel-pulse 2.4s var(--ease) infinite;
}
.gc-intel-presence--offline::before {
  background: transparent;
  border: 1px solid currentColor;
}
@keyframes gc-intel-pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 55%, transparent); }
  70%  { box-shadow: 0 0 0 5px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* -------- Stat tiles -------- */
.gc-intel-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  padding: 6px 10px 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface-alt);
}
.gc-intel-stat dt {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  line-height: 1.2;
  color: var(--text-muted);
}
.gc-intel-stat dd {
  font-family: var(--font-display);
  font-size: clamp(16px, 3vw, 21px);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text-primary);
}
.gc-intel-stat--power dd {
  color: var(--stat-power);
}
.gc-intel-stat__muted {
  font-size: 0.7em;
  letter-spacing: 0;
  color: var(--text-muted);
}

/* -------- Actions -------- */
.gc-intel .gc-intel-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-surface-alt);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.gc-intel .gc-intel-action:hover,
.gc-intel .gc-intel-action:focus-visible {
  color: var(--accent-cool);
  border-color: color-mix(in srgb, var(--accent-cool) 55%, transparent);
  background: color-mix(in srgb, var(--accent-cool) 12%, var(--bg-surface));
}
.gc-intel .gc-intel-action--primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--text-inverse);
}
.gc-intel .gc-intel-action--primary:hover,
.gc-intel .gc-intel-action--primary:focus-visible {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
  color: var(--text-inverse);
}
.gc-intel .gc-intel-action--back {
  margin-left: auto;
}

/* -------- Notices -------- */
.gc-intel-notice {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-good);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  font-size: 12.5px;
  line-height: 1.45;
}
.gc-intel-notice--hot {
  border-left-color: var(--accent-hot);
}

/* -------- Layout -------- */
.gc-intel-grid,
.gc-intel-grid__main,
.gc-intel-grid__rail {
  display: grid;
  gap: 10px;
  align-content: start;
  min-width: 0;
}
@media (min-width: 640px) {
  .gc-intel-grid {
    grid-template-columns: 1.55fr 1fr;
    align-items: start;
  }
}

/* -------- Cards -------- */
.gc-intel-card {
  position: relative;
  overflow: hidden;
  min-width: 0;
  padding: 10px 12px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  animation: gc-intel-rise var(--dur-base) var(--ease) both;
}
.gc-intel-grid__rail .gc-intel-card {
  animation-delay: 60ms;
}
@keyframes gc-intel-rise {
  from { opacity: 0; transform: translateY(6px); }
}
.gc-intel-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: -10px -12px 10px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-surface-alt));
}
.gc-intel-card__title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  line-height: 1.2;
  color: var(--accent);
}
.gc-intel-card__meta {
  font-family: var(--font-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.gc-intel-empty {
  padding: 6px 0 2px;
  font-size: 12px;
  text-align: center;
  color: var(--text-muted);
}

/* -------- Key / value rows -------- */
.gc-intel-facts {
  display: grid;
}
.gc-intel-facts__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-top: 1px dashed var(--border);
}
.gc-intel-facts__row:first-child {
  padding-top: 2px;
  border-top: 0;
}
.gc-intel-facts__row:last-child {
  padding-bottom: 0;
}
.gc-intel-facts__row > dt {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.gc-intel-facts__row > dd {
  min-width: 0;
  text-align: right;
  overflow-wrap: anywhere;
}
.gc-intel-facts__num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.gc-intel .gc-intel-help {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  text-decoration: none;
}
.gc-intel-help img {
  width: 12px;
  height: 12px;
}
.gc-intel-tone--good  { color: var(--accent-good); }
.gc-intel-tone--hot   { color: var(--accent-hot); }
.gc-intel-tone--muted { color: var(--text-muted); }

/* -------- Standing tiles -------- */
/* Small raised cards. Race / Colonies / Protection always share one row at
   equal widths (two fill it when Colonies is absent); Federation, itself a
   link, takes the full row below. */
.gc-intel-tiles {
  display: grid;
  gap: 8px;
}
.gc-intel-tiles__row {
  display: flex;
  gap: 8px;
  min-width: 0;
}
.gc-intel-tiles__row > .gc-intel-tile {
  flex: 1 1 0;
}
.gc-intel .gc-intel-tile {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 8px 9px 9px;
  border: 1px solid color-mix(in srgb, var(--text-muted) 38%, transparent);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, color-mix(in srgb, var(--text-primary) 5%, var(--bg-surface-alt)), var(--bg-surface-alt));
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--text-primary) 6%, transparent);
  color: var(--text-primary);
  text-decoration: none;
}

.gc-intel-tile__label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.gc-intel-tile__value {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
/* Three tiles share a phone-width row, so they start compact and relax. */
@media (min-width: 520px) {
  .gc-intel .gc-intel-tile {
    padding: 9px 12px 10px;
  }
  .gc-intel-tile__label {
    letter-spacing: 0.12em;
  }
  .gc-intel-tile__value {
    font-size: 14px;
  }
}
.gc-intel-tile__value--num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.gc-intel-tile__sub {
  font-size: 11px;
  color: var(--text-muted);
}
.gc-intel-tile__fed {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.gc-intel-tile__fed .gc-fedflag {
  flex: 0 0 auto;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
}
.gc-intel-tile__cue {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text-secondary);
  transition: color var(--dur-fast) var(--ease);
}
.gc-intel-tile__cue::after {
  content: "\2192";
  display: inline-block;
  margin-left: 6px;
  transition: transform var(--dur-fast) var(--ease);
}
.gc-intel .gc-intel-tile--link {
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.gc-intel .gc-intel-tile--link:hover,
.gc-intel .gc-intel-tile--link:focus-visible {
  border-color: color-mix(in srgb, var(--accent-cool) 55%, transparent);
  background: color-mix(in srgb, var(--accent-cool) 10%, var(--bg-surface-alt));
  color: var(--text-primary);
  text-decoration: none;
}
.gc-intel-tile--link:hover .gc-intel-tile__cue,
.gc-intel-tile--link:focus-visible .gc-intel-tile__cue {
  color: var(--accent-cool);
}
.gc-intel-tile--link:hover .gc-intel-tile__cue::after,
.gc-intel-tile--link:focus-visible .gc-intel-tile__cue::after {
  transform: translateX(3px);
}
/* Wider screens: the cue moves to the right of the flag and name. */
@media (min-width: 520px) {
  .gc-intel .gc-intel-tile--link {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 12px;
    align-items: center;
  }
  .gc-intel-tile--link .gc-intel-tile__label {
    grid-column: 1 / -1;
  }
  .gc-intel-tile--link .gc-intel-tile__cue {
    margin-top: 0;
  }
}

/* -------- Combat record: won / lost / ratio grid -------- */
.gc-intel-record {
  display: grid;
  gap: 10px;
}
/* Columns on the list; head and rows share them through subgrid. */
.gc-intel-combat {
  display: grid;
  grid-template-columns: auto repeat(3, minmax(max-content, auto));
  column-gap: 10px;
}
.gc-intel-combat__head,
.gc-intel-combat__row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  align-items: baseline;
}
.gc-intel-combat__head > :not(:first-child),
.gc-intel-combat__row > :not(:first-child) {
  text-align: center;
}
.gc-intel-combat__head {
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.gc-intel-combat__row {
  padding: 7px 0;
  border-bottom: 1px dashed var(--border);
  font-family: var(--font-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.gc-intel-combat__label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.gc-intel-combat__won   { color: var(--accent-good); }
.gc-intel-combat__lost  { color: var(--accent-hot); }
.gc-intel-combat__ratio {
  font-weight: 700;
  color: var(--text-primary);
}
/* Explored / plundered: the label spans Won and Lost, the figure sits in the
   Ratio column so every right-hand number shares one alignment. */
.gc-intel-combat__row--single > .gc-intel-combat__label {
  grid-column: 1 / -2;
}
.gc-intel-combat__total {
  grid-column: -2 / -1;
  color: var(--text-primary);
}
.gc-intel-combat__row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

/* -------- Medals (reusable: art in i/medals/, square animated WebP, rows in medal / user_medal) -------- */
.gc-medals {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  padding: 0;
  list-style: none;
}
.gc-medals__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 8px 4px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--accent-gold) 16%, var(--bg-surface-alt)), var(--bg-surface-alt) 70%);
  transition: transform var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.gc-medals__item:hover {
  transform: translateY(-2px);
  border-color: var(--accent-gold);
}
.gc-medals__item img {
  display: block;
  width: 56px;
  height: 56px;
  object-fit: contain;
}
.gc-medals__name {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  line-height: 1.25;
  text-align: center;
  text-transform: uppercase;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

/* -------- Search --------- */
.gc-intel-search {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.gc-intel-search__label {
  flex: 0 0 100%;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
body .gc-intel input.gc-intel-search__input[type="text"] {
  flex: 1 1 180px;
  min-width: 0;
  width: auto;
  height: 34px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-base);
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-primary);
}
body .gc-intel input.gc-intel-search__input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}
body .gc-intel input.gc-intel-search__submit {
  height: 34px;
  margin: 0;
}

/* Columns on the list; head and rows share them through subgrid. */
.gc-intel-results {
  display: grid;
  grid-template-columns: auto minmax(max-content, auto) minmax(max-content, auto) minmax(max-content, auto);
  column-gap: 10px;
}
.gc-intel-results__head,
.gc-intel-results__row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  align-items: center;
}
.gc-intel-results__head > :not(:first-child),
.gc-intel-results__row > :not(:first-child) {
  text-align: center;
}
.gc-intel-results__head {
  padding: 0 4px 6px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.gc-intel-results__row {
  padding: 7px 4px;
  border-bottom: 1px dashed var(--border);
  transition: background var(--dur-fast) var(--ease);
}
.gc-intel-results__row:last-child {
  border-bottom: 0;
}
.gc-intel-results__row:hover {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.gc-intel-results__name {
  min-width: 0;
  overflow-wrap: anywhere;
}
.gc-intel-results__name a {
  font-weight: 600;
}
.gc-intel-results__name mark {
  padding: 0 1px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--accent-gold) 32%, transparent);
  color: inherit;
}
.gc-intel-results__flag {
  vertical-align: middle;
}
.gc-intel-results__num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
/* Power abbreviates on phones before the column can crowd the name. */
.gc-intel-num--full { display: none; }
@media (min-width: 520px) {
  .gc-intel-num--full { display: inline; }
  .gc-intel-num--abbr { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .gc-intel-card,
  .gc-intel-presence--online::before {
    animation: none;
  }
}

/* -------- Classic -------- */
/* Keeps the legacy feel: squarer corners, opaque black panels over the
   starfield, no survey grid, and sentence-case bold headings in place of
   the modern mono caps. Colours and fonts come from Classic's tokens. */
body[data-theme="classic"] .gc-intelhead,
body[data-theme="classic"] .gc-intel-card,
body[data-theme="classic"] .gc-intel-stat,
body[data-theme="classic"] .gc-intel-notice,
body[data-theme="classic"] .gc-intel .gc-intel-tile,
body[data-theme="classic"] .gc-medals__item {
  border-color: var(--border-strong);
  border-radius: var(--radius-sm);
}
body[data-theme="classic"] .gc-intelhead {
  background: var(--bg-surface);
}
body[data-theme="classic"] .gc-intelhead::before {
  content: none;
}
body[data-theme="classic"] .gc-intelhead__title {
  font-weight: bold;
  letter-spacing: 0;
}
body[data-theme="classic"] .gc-intel-card__head {
  background: var(--bg-elevated);
}
body[data-theme="classic"] .gc-intel-card__title {
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--text-primary);
}
body[data-theme="classic"] .gc-intel-stat dd {
  font-weight: bold;
  letter-spacing: 0;
}

/* =========================================================
   GLOBAL SEARCH — PAGES + EMPIRES (i_gsearch.cfm, JS/gc-search.js)
   Inside the top of every desktop left-nav panel (s_loadbar.cfm) and
   the mobile shell's search sheet (_shell_mobile.cfm, app-shell.css).
   Result rows sit inside .icon-bar2, so their selectors outrank its
   link rules (nowrap + ellipsis would cut empire names).
   ========================================================= */
.gc-gsearch {
  position: relative;
  margin: 0 0 6px;
  font-size: 13px;
}
/* The shell has its own box below 1200px, where the left nav is hidden anyway. */
@media (max-width: 1199.98px) {
  .gc-gsearch--nav { display: none; }
}
.gc-gsearch__field {
  position: relative;
  display: flex;
  align-items: center;
}
.gc-gsearch__icon {
  position: absolute;
  left: 10px;
  font-size: 12px;
  color: var(--text-muted);
  pointer-events: none;
}
.gc-gsearch input.gc-gsearch__input {
  width: 100%;
  height: 28px;
  margin: 0;
  padding: 0 10px 0 30px;
  background: var(--bg-base);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: none;
  font-family: var(--font-body);
  font-size: 13px;
  line-height: normal;
  -webkit-appearance: none;
  appearance: none;
}
.gc-gsearch input.gc-gsearch__input::placeholder {
  color: var(--text-muted);
  opacity: 1;
}
.gc-gsearch input.gc-gsearch__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent);
}
.gc-gsearch__list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 70;
  min-width: 100%;
  width: max-content;
  max-width: min(340px, calc(100vw - 24px));
  max-height: min(440px, 70vh);
  overflow-y: auto;
  padding: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}
.gc-gsearch__list[hidden] { display: none; }
.gc-gsearch__group {
  padding: 6px 8px 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.gc-gsearch__item + .gc-gsearch__group,
.gc-gsearch__note + .gc-gsearch__group {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
body .gc-gsearch .gc-gsearch__list .gc-gsearch__item,
body .gc-gsearch .gc-gsearch__list .gc-gsearch__item:link,
body .gc-gsearch .gc-gsearch__list .gc-gsearch__item:visited {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  margin: 0;
  padding: 6px 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.3;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
body .gc-gsearch .gc-gsearch__list .gc-gsearch__item.is-active {
  background: var(--bg-elevated);
  color: var(--accent);
  text-decoration: none;
}
.gc-gsearch__label { overflow-wrap: anywhere; }
.gc-gsearch__meta {
  flex: none;
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}
.gc-gsearch mark {
  padding: 0;
  background: none;
  color: var(--accent);
  font-weight: 700;
}
.gc-gsearch__note {
  padding: 6px 8px;
  font-size: 12px;
  color: var(--text-muted);
}
body .gc-gsearch .gc-gsearch__list .gc-gsearch__item--all {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Mobile sheet: full-width list under the box, 16px text so iOS won't zoom. */
.gc-gsearch--shell { margin: 0; }
.gc-gsearch--shell input.gc-gsearch__input {
  height: 40px;
  font-size: 16px;
}
.gc-gsearch--shell .gc-gsearch__list {
  right: 0;
  width: auto;
  max-width: none;
  max-height: calc(100dvh - 72px);
}
body .gc-gsearch--shell .gc-gsearch__list .gc-gsearch__item,
body .gc-gsearch--shell .gc-gsearch__list .gc-gsearch__item:link,
body .gc-gsearch--shell .gc-gsearch__list .gc-gsearch__item:visited {
  padding: 9px 8px;
  font-size: 14px;
}

/* Classic: crimson accent is too dark for text on black, so active rows and
   matches use the classic link colours instead. */
body[data-theme="classic"] .gc-gsearch input.gc-gsearch__input {
  border-color: var(--border);
}
body[data-theme="classic"] .gc-gsearch input.gc-gsearch__input:focus {
  border-color: var(--accent-hover);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent);
}
body[data-theme="classic"] .gc-gsearch .gc-gsearch__list .gc-gsearch__item.is-active {
  color: var(--link-hover);
}
body[data-theme="classic"] .gc-gsearch mark {
  color: var(--link);
}
