:root {
  color-scheme: dark;
  --bg: #060914;
  --bg-soft: rgba(13, 19, 36, 0.88);
  --panel: rgba(14, 20, 39, 0.84);
  --panel-strong: rgba(20, 28, 51, 0.95);
  --border: rgba(122, 184, 255, 0.18);
  --border-strong: rgba(255, 204, 122, 0.34);
  --text: #eef3ff;
  --muted: #9ca7c4;
  --accent: #70e2ff;
  --accent-strong: #d6a556;
  --danger: #ff7b7b;
  --good: #8ce1a7;
  --shadow: 0 24px 90px rgba(2, 7, 18, 0.55);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

.oid-game-store-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  margin-top: 10px;
}

[data-deck-balance-summary].is-danger {
  color: var(--danger);
  font-weight: 700;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(76, 115, 255, 0.1), transparent 34%),
    linear-gradient(180deg, #050811 0%, #060914 45%, #03060d 100%);
  color: var(--text);
  font-family: "Manrope", sans-serif;
}

body {
  overflow-x: hidden;
  overflow-y: auto;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-shell {
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: visible;
}

.space-backdrop,
.starfield,
.nebula {
  position: absolute;
  inset: 0;
}

.space-backdrop {
  pointer-events: none;
  overflow: hidden;
}

.starfield {
  background-image:
    radial-gradient(circle at 12% 25%, rgba(255, 255, 255, 0.9) 0 1px, transparent 1px),
    radial-gradient(circle at 42% 62%, rgba(255, 255, 255, 0.65) 0 1px, transparent 1px),
    radial-gradient(circle at 75% 38%, rgba(255, 255, 255, 0.7) 0 1px, transparent 1px),
    radial-gradient(circle at 83% 72%, rgba(255, 255, 255, 0.55) 0 1px, transparent 1px),
    radial-gradient(circle at 26% 78%, rgba(255, 255, 255, 0.75) 0 1px, transparent 1px);
  background-size: 380px 380px;
  opacity: 0.45;
  animation: drift 42s linear infinite;
}

.nebula {
  filter: blur(56px);
  opacity: 0.42;
}

.nebula-a {
  background: radial-gradient(circle, rgba(90, 89, 255, 0.35), transparent 65%);
  transform: translate(-12%, -16%);
}

.nebula-b {
  background: radial-gradient(circle, rgba(53, 208, 255, 0.26), transparent 72%);
  transform: translate(48%, 18%);
}

.nebula-c {
  background: radial-gradient(circle, rgba(255, 170, 92, 0.16), transparent 70%);
  transform: translate(22%, 58%);
}

.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 28px;
}

.hero-screen,
.game-screen {
  min-height: auto;
}

.hero-screen {
  display: grid;
  grid-template-columns: 1.3fr 0.8fr;
  gap: 28px;
  align-items: center;
}

.hero-copy {
  max-width: 760px;
  padding: 32px 12px;
}

.eyebrow {
  margin: 0 0 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--accent);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  line-height: 1.1;
}

h1 {
  max-width: 780px;
  font-size: clamp(42px, 5vw, 76px);
}

h2 {
  font-size: clamp(24px, 2.2vw, 32px);
}

h3 {
  font-size: 18px;
}

.hero-text,
.muted-text,
.building-description,
.mini-hud p,
.auth-hint {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.hero-text {
  max-width: 620px;
  margin-top: 20px;
  font-size: 18px;
}

.hero-points {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.panel,
.stat-card,
.resource-card,
.building-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(20, 27, 48, 0.92), rgba(9, 13, 26, 0.86));
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.panel {
  padding: 24px;
}

.panel-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 20px;
}

.stat-card {
  padding: 20px;
}

.stat-label {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.auth-panel {
  width: min(460px, 100%);
  justify-self: end;
}

.stack-form {
  display: grid;
  gap: 14px;
}

.stack-form label {
  display: grid;
  gap: 8px;
}

.stack-form span {
  font-size: 13px;
  color: var(--muted);
}

input,
select {
  width: 100%;
  border: 1px solid rgba(112, 226, 255, 0.18);
  border-radius: 14px;
  background: rgba(7, 11, 22, 0.88);
  color: var(--text);
  padding: 14px 16px;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: rgba(112, 226, 255, 0.8);
  box-shadow: 0 0 0 3px rgba(112, 226, 255, 0.12);
}

.password-input-wrap {
  position: relative;
  width: 100%;
}

.password-input-wrap input {
  padding-right: 52px;
}

.password-visibility-toggle {
  position: absolute;
  top: 50%;
  right: 5px;
  display: grid;
  width: 40px;
  height: 40px;
  padding: 0;
  place-items: center;
  transform: translateY(-50%);
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  transition: color 180ms ease, background 180ms ease;
}

.password-visibility-toggle:hover,
.password-visibility-toggle:focus-visible,
.password-visibility-toggle.is-password-visible {
  color: var(--accent);
  background: rgba(112, 226, 255, 0.08);
}

.password-visibility-toggle:focus-visible {
  outline: 2px solid rgba(112, 226, 255, 0.65);
  outline-offset: -2px;
}

.password-visibility-toggle svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.password-visibility-toggle.is-password-visible .password-visibility-slash {
  display: none;
}

.primary-button,
.secondary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  border-radius: 16px;
  border: 1px solid transparent;
  padding: 0 18px;
  font-weight: 700;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}

.primary-button {
  background: linear-gradient(135deg, rgba(73, 139, 255, 0.98), rgba(127, 242, 255, 0.95));
  color: #04111f;
  box-shadow: 0 20px 36px rgba(69, 160, 255, 0.25);
}

.secondary-button {
  background: linear-gradient(135deg, rgba(255, 209, 107, 0.92), rgba(215, 146, 71, 0.96));
  color: #181006;
  box-shadow: 0 20px 36px rgba(214, 165, 86, 0.18);
}

.ghost-button {
  border-color: rgba(112, 226, 255, 0.18);
  background: rgba(12, 17, 31, 0.56);
  color: var(--text);
}

.ghost-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover:not(:disabled),
.modal-close:hover {
  transform: translateY(-1px);
}

.full-width {
  width: 100%;
}

.divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  margin: 18px 0;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.divider::before,
.divider::after {
  content: "";
  display: block;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(112, 226, 255, 0.22), transparent);
}

.game-screen {
  display: grid;
  gap: 16px;
  align-items: start;
}

.game-main-layout {
  --main-map-height: clamp(420px, 60vh, 720px);
  --main-top-height: calc(var(--main-map-height) + 66px);
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr) minmax(170px, 210px);
  grid-template-areas:
    "left center right";
  gap: 16px;
  align-items: start;
  min-width: 0;
  height: var(--main-top-height);
  min-height: var(--main-top-height);
  max-height: var(--main-top-height);
  overflow: hidden;
  position: relative;
}

.left-sidebar,
.right-sidebar {
  min-width: 0;
  gap: 14px;
  align-content: start;
}

.left-sidebar {
  display: grid;
}

.left-sidebar {
  grid-area: left;
  width: 118px;
  min-width: 118px;
  max-width: 118px;
  justify-self: start;
  padding-top: 26px;
  height: 100%;
  min-height: 0;
}

.right-sidebar {
  grid-area: right;
  display: flex;
  flex-direction: column;
  align-self: stretch;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}

.map-stage {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
  min-width: 0;
  min-height: 0;
  height: 100%;
  grid-area: center;
  padding-left: 10px;
}

.stage-header,
.header-badges {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.stage-header {
  flex-wrap: wrap;
  align-items: flex-start;
  padding-left: 12px;
  min-height: 48px;
}

.header-summary-inline {
  display: flex;
  flex: 0 1 auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  overflow: hidden;
}

.top-summary-title {
  flex: 0 0 auto;
  min-width: 0;
  max-width: 180px;
  font-family: "Orbitron", sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  min-height: 24px;
  padding: 0 8px;
}

.top-summary-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.summary-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  min-width: 0;
  padding: 3px 6px;
  min-height: 22px;
  border-radius: 999px;
  background: rgba(11, 18, 33, 0.88);
  box-shadow: none;
  border: 1px solid rgba(112, 226, 255, 0.14);
}

.summary-chip-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 999px;
  border: 1px solid rgba(255, 204, 122, 0.14);
  background: rgba(10, 16, 30, 0.76);
  color: var(--accent-strong);
  font-size: 6px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.summary-chip-value {
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--text);
}

.header-badges {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.header-badge {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 204, 122, 0.24);
  background: rgba(16, 24, 43, 0.84);
  color: var(--muted);
}

.header-icon-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(112, 226, 255, 0.22);
  background: rgba(11, 18, 33, 0.88);
  color: var(--text);
}

.header-icon-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(112, 226, 255, 0.14);
  color: var(--accent);
  font-size: 12px;
}

.map-frame,
.planet-map-frame {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid rgba(112, 226, 255, 0.16);
  background:
    radial-gradient(circle at 50% 20%, rgba(88, 129, 255, 0.2), transparent 30%),
    radial-gradient(circle at 10% 80%, rgba(76, 223, 255, 0.12), transparent 28%),
    linear-gradient(180deg, rgba(7, 10, 19, 0.94), rgba(3, 5, 11, 0.98));
  box-shadow: var(--shadow);
}

.map-frame {
  height: 100%;
  min-height: 0;
}

.planet-map-frame {
  height: clamp(360px, 56vh, 620px);
  min-height: 360px;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.map-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 18px;
  pointer-events: none;
}
.galaxy-map-toolbar { position: absolute; z-index: 4; top: 14px; left: 14px; display: flex; align-items: center; gap: 6px; padding: 6px; border: 1px solid rgba(107,205,242,.24); border-radius: 13px; background: rgba(3,10,22,.82); backdrop-filter: blur(12px); }
.galaxy-map-toolbar button { min-height: 34px; padding: 7px 11px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: #9fb4ca; cursor: pointer; }
.galaxy-map-toolbar button:hover { background: rgba(104,205,244,.1); color: #e7f8ff; }
.galaxy-map-toolbar button.is-active { border-color: rgba(94,210,255,.38); background: rgba(50,151,198,.2); color: #dff8ff; }
.galaxy-map-toolbar .galaxy-home-button { border-left-color: rgba(255,255,255,.08); }
.galaxy-map-toolbar span { min-width: 44px; color: #8fa8bd; font-size: 12px; text-align: center; }
.galaxy-selection { position: absolute; z-index: 4; top: 70px; left: 14px; display: grid; gap: 3px; width: min(340px, calc(100% - 28px)); padding: 11px 13px; border: 1px solid rgba(99,204,244,.27); border-radius: 12px; background: rgba(3,10,22,.88); color: #e8f7ff; backdrop-filter: blur(12px); pointer-events: none; }
.galaxy-selection span { color: #a9bed0; font-size: 13px; }
.galaxy-selection small { color: #6f91a9; }
#galaxy-canvas { cursor: grab; touch-action: none; }
#galaxy-canvas:active { cursor: grabbing; }
@media (max-width: 720px) {
  .galaxy-map-toolbar { right: 10px; left: 10px; flex-wrap: wrap; }
  .galaxy-map-toolbar button { flex: 1; white-space: nowrap; }
  .galaxy-selection { top: 105px; left: 10px; width: calc(100% - 20px); }
}

.mini-hud {
  width: min(320px, 100%);
}

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

.resource-grid.compact {
  grid-template-columns: 1fr;
}

.resource-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.resource-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 10px;
  border-radius: 12px;
  border: 1px solid rgba(112, 226, 255, 0.14);
  background: rgba(10, 16, 30, 0.76);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

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

.resource-value {
  font-size: 18px;
  justify-self: end;
}

.account-honor-strip {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.account-honor-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.account-honor-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 204, 122, 0.18);
  background: rgba(10, 16, 30, 0.76);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.account-honor-chip--imperial {
  border-color: rgba(255, 204, 122, 0.34);
  background: rgba(42, 24, 10, 0.76);
  color: #ffd38e;
}

.account-honor-chip--republic {
  border-color: rgba(124, 203, 255, 0.34);
  background: rgba(10, 25, 42, 0.76);
  color: #9adfff;
}

.account-honor-chip--feudal {
  border-color: rgba(186, 142, 255, 0.26);
  background: rgba(26, 16, 40, 0.76);
  color: #d3b4ff;
}

.account-honor-chip--frontier {
  border-color: rgba(140, 226, 167, 0.24);
  background: rgba(11, 27, 21, 0.76);
  color: #9fe3b3;
}

.account-honor-chip--elite {
  border-color: rgba(255, 120, 120, 0.34);
  background: rgba(40, 10, 18, 0.78);
  color: #ffb1b1;
}

.account-honor-list {
  display: grid;
  gap: 6px;
}

.account-honor-row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid rgba(112, 226, 255, 0.1);
  background: rgba(8, 13, 24, 0.72);
}

.account-honor-row--imperial {
  border-color: rgba(255, 204, 122, 0.18);
  background:
    linear-gradient(90deg, rgba(86, 50, 12, 0.34), rgba(8, 13, 24, 0.72) 28%);
}

.account-honor-row--republic {
  border-color: rgba(124, 203, 255, 0.18);
  background:
    linear-gradient(90deg, rgba(14, 48, 84, 0.34), rgba(8, 13, 24, 0.72) 28%);
}

.account-honor-row--feudal {
  border-color: rgba(186, 142, 255, 0.16);
  background:
    linear-gradient(90deg, rgba(58, 24, 88, 0.32), rgba(8, 13, 24, 0.72) 28%);
}

.account-honor-row--frontier {
  border-color: rgba(140, 226, 167, 0.14);
  background:
    linear-gradient(90deg, rgba(16, 60, 38, 0.28), rgba(8, 13, 24, 0.72) 28%);
}

.account-honor-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-honor-title {
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 700;
}

.account-honor-date,
.account-honor-loot {
  color: var(--muted);
  font-size: 11px;
}

.account-honor-campaign {
  color: var(--text);
  font-size: 12px;
}

.account-honor-empty {
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid rgba(112, 226, 255, 0.08);
  background: rgba(8, 13, 24, 0.56);
  color: var(--muted);
  font-size: 12px;
}

.cauldron {
  position: relative;
  width: 112px;
  height: 112px;
  margin: 4px auto 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.cauldron-glow,
.cauldron-core {
  position: absolute;
  border-radius: 50%;
}

.cauldron-glow {
  inset: 12px;
  background: radial-gradient(circle, rgba(255, 185, 73, 0.6), rgba(121, 61, 255, 0.18), transparent 74%);
  filter: blur(8px);
  animation: pulse 3.2s ease-in-out infinite;
}

.cauldron-core {
  inset: 24px;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 246, 184, 0.9), rgba(255, 165, 79, 0.72), rgba(111, 44, 166, 0.46));
  border: 1px solid rgba(255, 218, 150, 0.32);
  box-shadow:
    inset 0 -18px 32px rgba(74, 29, 124, 0.46),
    0 0 36px rgba(255, 194, 96, 0.24);
}

.prayer-panel.is-greater-good {
  border-color: rgba(98, 232, 213, 0.3);
  background:
    radial-gradient(circle at 50% 18%, rgba(63, 210, 190, 0.12), transparent 38%),
    linear-gradient(145deg, rgba(15, 39, 52, 0.94), rgba(8, 14, 27, 0.96));
  box-shadow: inset 0 0 28px rgba(68, 218, 200, 0.05);
}

.prayer-panel.is-greater-good .cauldron-glow {
  background: radial-gradient(circle, rgba(91, 244, 215, 0.68), rgba(63, 104, 255, 0.2), transparent 74%);
}

.prayer-panel.is-greater-good .cauldron-core {
  background: radial-gradient(circle at 50% 40%, rgba(222, 255, 246, 0.94), rgba(57, 218, 194, 0.75), rgba(38, 75, 153, 0.48));
  border-color: rgba(153, 255, 238, 0.38);
  box-shadow: inset 0 -18px 32px rgba(22, 55, 120, 0.5), 0 0 38px rgba(72, 231, 207, 0.28);
}

.greater-good-sacrifice {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(98, 232, 213, 0.18);
}

.greater-good-sacrifice > label {
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.greater-good-sacrifice-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.greater-good-sacrifice-controls input {
  min-width: 0;
}

.building-list {
  display: grid;
  gap: 12px;
}

.work-actions {
  display: grid;
  gap: 12px;
}

.colony-actions {
  display: grid;
  gap: 10px;
  margin: 14px 0 18px;
  position: relative;
  overflow: visible;
}

.work-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(112, 226, 255, 0.14);
  background: rgba(7, 12, 24, 0.72);
}

.work-summary-card {
  gap: 10px;
  background:
    linear-gradient(180deg, rgba(9, 16, 30, 0.94), rgba(6, 10, 20, 0.94));
}

.work-summary-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.work-summary-stats span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(112, 226, 255, 0.14);
  background: rgba(5, 10, 20, 0.76);
  color: var(--text);
  font-weight: 600;
}

.war-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.war-choice-card {
  display: grid;
  gap: 10px;
  min-height: 220px;
  padding: 22px;
  border: 1px solid rgba(112, 226, 255, 0.16);
  border-radius: 24px;
  background:
    radial-gradient(circle at top, rgba(112, 226, 255, 0.08), transparent 45%),
    linear-gradient(180deg, rgba(12, 18, 35, 0.96), rgba(7, 11, 22, 0.98));
  color: var(--text);
  text-align: left;
  align-content: center;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.war-choice-card:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: rgba(255, 204, 122, 0.34);
  box-shadow: 0 24px 44px rgba(3, 8, 22, 0.42);
}

.war-choice-card:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.war-choice-card-eyebrow {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.war-choice-card-title {
  font-family: "Orbitron", sans-serif;
  font-size: 24px;
  line-height: 1.2;
}

.war-choice-card-text {
  color: var(--muted);
  line-height: 1.6;
}

.work-progress {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}

.work-progress-bar {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 209, 107, 0.96), rgba(112, 226, 255, 0.92));
}

.work-meta {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.work-assignment {
  display: grid;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(112, 226, 255, 0.1);
}

.work-assignment-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.work-assignment-note {
  color: var(--muted);
  font-size: 12px;
}

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

.science-branch-card {
  display: grid;
  gap: 10px;
  min-height: 220px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(112, 226, 255, 0.14);
  background: rgba(7, 12, 24, 0.72);
}

.science-cost-list {
  display: inline;
}

.science-cost-item,
.science-requirement-item {
  display: inline;
  padding: 1px 4px;
  border-radius: 5px;
  font-weight: 700;
  transition: color 160ms ease, background-color 160ms ease;
}

.science-cost-item.is-available,
.science-requirement-item.is-available,
.science-control-requirement.is-available {
  color: #77e5ae;
  background: rgba(40, 180, 112, 0.1);
}

.science-cost-item.is-missing,
.science-requirement-item.is-missing,
.science-control-requirement.is-missing {
  color: #ff7b7b;
  background: rgba(255, 70, 70, 0.14);
  text-shadow: 0 0 12px rgba(255, 72, 72, 0.22);
}

.space-cost-item {
  display: inline;
  padding: 1px 4px;
  border-radius: 5px;
  font-weight: 700;
}

.space-cost-item.is-available {
  color: #77e5ae;
  background: rgba(40, 180, 112, 0.1);
}

.space-cost-item.is-missing {
  color: #ff7b7b;
  background: rgba(255, 70, 70, 0.14);
  text-shadow: 0 0 12px rgba(255, 72, 72, 0.22);
}

.building-card {
  padding: 18px;
}

.building-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.building-cost {
  color: var(--accent-strong);
  font-weight: 700;
  white-space: nowrap;
}

.building-eyebrow {
  margin-bottom: 6px;
}

.building-build-controls {
  display: grid;
  grid-template-columns: minmax(100px, 0.35fr) minmax(150px, 1fr);
  gap: 10px;
  align-items: end;
  margin-top: 14px;
}

.building-amount-label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.building-amount {
  width: 100%;
  min-width: 0;
}

.building-build-controls .build-button {
  width: 100%;
}

.official-automation-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
  border-color: rgba(94, 234, 212, 0.3);
}

.official-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.official-summary-grid > span,
.official-last-summary {
  padding: 10px 12px;
  border: 1px solid rgba(94, 234, 212, 0.16);
  border-radius: 12px;
  background: rgba(4, 18, 28, 0.65);
  color: var(--muted);
}

.official-summary-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
}

.official-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.official-mode-grid button {
  width: 100%;
}

.official-hire-form {
  display: grid;
  grid-template-columns: minmax(120px, 0.35fr) minmax(240px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.official-hire-form label {
  display: grid;
  gap: 6px;
}

.official-hire-cost {
  align-self: center;
  color: var(--muted);
}

.official-reserves {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(240, 183, 86, 0.28);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(72, 48, 16, 0.18), rgba(4, 18, 28, 0.72));
}

.official-reserve-title {
  display: grid;
  grid-template-columns: minmax(190px, 0.45fr) minmax(260px, 1fr);
  gap: 16px;
  align-items: end;
}

.official-reserve-title h4,
.official-reserve-title p {
  margin: 0;
}

.official-reserve-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 0.65fr) auto;
  gap: 10px;
  align-items: end;
}

.official-reserve-form label {
  display: grid;
  gap: 6px;
}

.official-reserve-list {
  display: grid;
  gap: 9px;
}

.official-reserve-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.65fr) minmax(180px, 1fr) minmax(160px, 0.65fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(94, 234, 212, 0.16);
  border-radius: 11px;
  background: rgba(4, 18, 28, 0.72);
}

.official-reserve-row.is-complete {
  border-color: rgba(94, 234, 212, 0.36);
}

.official-reserve-heading {
  display: grid;
  gap: 3px;
}

.official-reserve-heading span,
.official-reserve-row small {
  color: var(--muted);
}

.official-reserve-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.official-reserve-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d99b38, #5eead4);
}

.official-reserve-row form {
  margin: 0;
}

.official-reserve-empty,
.official-reserve-migration {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(4, 18, 28, 0.62);
}

@media (max-width: 800px) {
  .official-summary-grid,
  .official-mode-grid,
  .official-hire-form,
  .official-reserve-title,
  .official-reserve-form,
  .official-reserve-row {
    grid-template-columns: 1fr;
  }
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 28px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 5, 11, 0.76);
  backdrop-filter: blur(14px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(1320px, 100%);
  max-height: calc(100vh - 56px);
  overflow: auto;
  border-radius: 32px;
  border: 1px solid rgba(112, 226, 255, 0.18);
  background: linear-gradient(180deg, rgba(10, 15, 29, 0.98), rgba(5, 8, 16, 0.98));
  box-shadow: 0 42px 120px rgba(0, 0, 0, 0.52);
  padding: 28px;
}

.modal-card-wide {
  width: min(1440px, 100%);
}

.modal-card-medium {
  width: min(760px, 100%);
}

.public-profile-modal-card {
  display: grid;
  gap: 20px;
  width: min(820px, 100%);
  background:
    radial-gradient(circle at 12% 8%, rgba(var(--accent-rgb), 0.14), transparent 34%),
    linear-gradient(180deg, rgba(10, 15, 29, 0.99), rgba(5, 8, 16, 0.99));
}

.public-profile-hero {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding-right: 48px;
}

.public-profile-hero h2,
.public-profile-hero p {
  margin: 0;
}

.public-profile-hero .eyebrow {
  margin-bottom: 7px;
}

.public-profile-portrait {
  width: 112px;
  border-radius: 25px;
}

.public-profile-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.public-profile-stat,
.public-profile-empty {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid rgba(112, 226, 255, 0.13);
  border-radius: 15px;
  background: rgba(7, 13, 26, 0.76);
}

.public-profile-stat span,
.public-profile-stat strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.public-profile-stat span {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
}

.public-profile-stat strong {
  color: var(--text);
  font-size: 14px;
}

.public-profile-empty {
  grid-column: 1 / -1;
  color: var(--muted);
}

.public-profile-honors {
  display: grid;
  gap: 10px;
}

.public-profile-collection { display: grid; gap: 10px; }
.public-profile-collection .panel-header h3, .public-profile-collection .panel-header p { margin: 0; }
.public-profile-collection-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.public-profile-collection-card { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 10px; padding: 10px; border: 1px solid rgba(112, 226, 255, .16); border-radius: 14px; background: rgba(6, 14, 29, .68); }
.public-profile-collection-card img, .public-profile-collection-card > .artifact-placeholder { width: 72px; height: 72px; border-radius: 12px; object-fit: contain; }
.public-profile-collection-card strong, .public-profile-collection-card small, .public-profile-collection-card span { display: block; }
.public-profile-collection-card small, .public-profile-collection-card span { margin-top: 4px; color: var(--muted); font-size: 12px; }

.public-profile-honors .panel-header h3,
.public-profile-honors .panel-header p {
  margin: 0;
}

.public-profile-honor-row {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

#public-profile-message-button {
  width: 100%;
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(112, 226, 255, 0.18);
  border-radius: 50%;
  background: rgba(9, 14, 24, 0.76);
  color: var(--text);
  font-size: 28px;
}

.modal-header,
.planet-showcase,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.planet-showcase {
  margin: 20px 0 24px;
  align-items: center;
  justify-content: flex-start;
}

.planet-sphere {
  position: relative;
  width: 280px;
  min-width: 280px;
  min-height: 180px;
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 45%, rgba(89, 208, 255, 0.14), transparent 56%),
    linear-gradient(135deg, rgba(14, 26, 52, 0.92), rgba(7, 11, 22, 0.82));
  border: 1px solid rgba(112, 226, 255, 0.12);
  overflow: hidden;
}

.planet-core,
.planet-ring,
.planet-spec {
  position: absolute;
}

.planet-core {
  left: 50%;
  top: 50%;
  width: 124px;
  height: 124px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 248, 188, 0.28), transparent 22%),
    radial-gradient(circle at 42% 42%, rgba(84, 177, 136, 0.88), rgba(24, 73, 62, 0.98) 55%, rgba(10, 19, 41, 0.95));
  box-shadow:
    inset -26px -22px 40px rgba(0, 0, 0, 0.28),
    0 0 34px rgba(84, 190, 255, 0.18);
}

.planet-ring {
  left: 50%;
  top: 50%;
  width: 168px;
  height: 48px;
  transform: translate(-50%, -50%) rotate(-12deg);
  border: 2px solid rgba(255, 207, 112, 0.44);
  border-radius: 50%;
}

.planet-spec {
  border-radius: 50%;
  filter: blur(22px);
}

.planet-spec-a {
  right: 10%;
  top: 16%;
  width: 84px;
  height: 84px;
  background: rgba(69, 174, 255, 0.18);
}

.planet-spec-b {
  left: 18%;
  bottom: 12%;
  width: 70px;
  height: 70px;
  background: rgba(255, 177, 88, 0.12);
}

.planet-control-text {
  max-width: 420px;
}

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

.buildings-modal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.planet-legend {
  width: 250px;
  padding: 18px;
}

.planet-hover-card {
  position: absolute;
  left: 18px;
  bottom: 18px;
  min-width: 220px;
  max-width: 280px;
  border-radius: 18px;
  border: 1px solid rgba(112, 226, 255, 0.18);
  background: rgba(7, 12, 24, 0.86);
  padding: 14px 16px;
  backdrop-filter: blur(10px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

.planet-hover-card strong,
.planet-hover-card span {
  display: block;
}

.planet-hover-card strong {
  margin-bottom: 6px;
}

.planet-hover-card span {
  color: var(--muted);
  font-size: 13px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.9fr);
  gap: 20px;
  margin-top: 14px;
  align-items: start;
}

.admin-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
  padding: 7px;
  border: 1px solid rgba(112, 226, 255, 0.18);
  border-radius: 18px;
  background: rgba(3, 10, 22, 0.72);
}

.admin-tab {
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.admin-tab:hover {
  color: var(--text);
  background: rgba(112, 226, 255, 0.07);
}

.admin-tab.is-active {
  border-color: rgba(112, 226, 255, 0.52);
  color: var(--text);
  background: linear-gradient(180deg, rgba(51, 151, 192, 0.34), rgba(19, 74, 103, 0.42));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.admin-tab-panel[hidden] {
  display: none;
}

.admin-gift-form {
  margin-top: 16px;
}

.admin-gift-form select {
  width: 100%;
}

.compact-panel {
  padding: 10px;
}

.account-modal-panel {
  display: grid;
  gap: 16px;
}

.account-identity-card {
  display: grid;
  grid-template-columns: 126px minmax(180px, 0.75fr) minmax(280px, 1.25fr);
  align-items: center;
  gap: 18px;
  padding: 18px;
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  border-radius: 20px;
  background:
    radial-gradient(circle at 10% 10%, rgba(var(--accent-rgb), 0.11), transparent 38%),
    rgba(4, 10, 22, 0.76);
}

.account-portrait-frame {
  position: relative;
  width: 126px;
  aspect-ratio: 1;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 198, 90, 0.6);
  border-radius: 28px;
  background:
    radial-gradient(circle, rgba(var(--accent-rgb), 0.18), transparent 62%),
    #050b17;
  box-shadow: inset 0 0 0 5px rgba(3, 8, 18, 0.78), 0 0 28px rgba(255, 186, 72, 0.11);
}

.account-portrait-frame::after {
  content: "";
  position: absolute;
  inset: 6px;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 21px;
}

.account-portrait-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.account-portrait-frame > span {
  color: var(--accent);
  font-size: 42px;
  text-shadow: 0 0 22px rgba(var(--accent-rgb), 0.62);
}

.account-identity-copy {
  display: grid;
  gap: 7px;
}

.account-identity-copy h3,
.account-identity-copy p {
  margin: 0;
}

.account-avatar-form {
  display: grid;
  gap: 10px;
}

.account-avatar-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

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

.account-rename-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  border-radius: 18px;
  background:
    radial-gradient(circle at top right, rgba(255, 190, 75, 0.08), transparent 45%),
    rgba(4, 10, 22, 0.72);
}

.account-rename-card h3,
.account-rename-card p {
  margin: 0;
}

.account-rename-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.account-rename-card input {
  width: 100%;
}

@media (max-width: 760px) {
  .public-profile-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .public-profile-hero {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .public-profile-portrait {
    width: 82px;
    border-radius: 20px;
  }

  .public-profile-honor-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .public-profile-honor-row .account-honor-campaign {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .account-identity-card {
    grid-template-columns: 92px 1fr;
  }

  .account-portrait-frame {
    width: 92px;
    border-radius: 22px;
  }

  .account-avatar-form {
    grid-column: 1 / -1;
  }

  .account-rename-grid {
    grid-template-columns: 1fr;
  }
}

.left-sidebar .panel,
.right-sidebar .panel {
  padding: 12px;
}

.action-panel {
  flex: 0 0 auto;
}

.left-sidebar .panel {
  width: 118px;
  max-width: 118px;
  overflow: hidden;
}

.left-sidebar h2,
.right-sidebar h2 {
  font-size: clamp(15px, 1vw, 20px);
}

.left-sidebar .panel-header,
.right-sidebar .panel-header {
  margin-bottom: 10px;
}

.left-sidebar .panel-header {
  gap: 2px;
}

.left-sidebar .resource-card,
.right-sidebar .resource-card {
  padding: 8px 10px;
}

.left-sidebar .primary-button,
.left-sidebar .secondary-button,
.left-sidebar .ghost-button,
.right-sidebar .primary-button,
.right-sidebar .secondary-button,
.right-sidebar .ghost-button {
  min-height: 34px;
  padding: 0 9px;
  border-radius: 12px;
  font-size: 12px;
}

.prayer-panel .resource-grid {
  gap: 10px;
}

.prayer-panel .muted-text {
  line-height: 1.3;
  font-size: 11px;
}

.prayer-panel .cauldron {
  width: 56px;
  height: 56px;
  margin: 0 auto 8px;
}

.prayer-panel .resource-icon {
  min-width: 24px;
  height: 24px;
  padding: 0 5px;
  font-size: 9px;
  border-radius: 8px;
}

.prayer-panel .resource-name {
  font-size: 10px;
}

.prayer-panel .resource-value {
  font-size: 12px;
}

.left-sidebar .eyebrow,
.right-sidebar .eyebrow {
  margin-bottom: 6px;
  font-size: 9px;
  letter-spacing: 0.16em;
}

.left-sidebar .resource-card {
  grid-template-columns: 24px 1fr;
  gap: 6px;
  padding: 6px 7px;
  min-width: 0;
}

.left-sidebar .resource-value {
  grid-column: 2;
  justify-self: start;
  font-size: 11px;
}

.left-sidebar .panel-header h2 {
  line-height: 1.05;
}

.left-sidebar .header-badge,
.left-sidebar .header-icon-button,
.left-sidebar .resource-name,
.left-sidebar .resource-value,
.left-sidebar .muted-text {
  min-width: 0;
}

.prayer-panel .primary-button {
  margin-top: 6px;
}

.communication-panel {
  display: flex;
  flex-direction: column;
  padding: 8px 10px;
  min-height: 170px;
  height: 220px;
  max-height: 70vh;
  resize: vertical;
  overflow: auto;
}

.communication-header {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
  margin-bottom: 3px;
}

.communication-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.communication-space-lock { display: grid; gap: 6px; margin-bottom: 12px; padding: 14px 16px; border: 1px solid rgba(226, 183, 110, .32); border-radius: 13px; background: linear-gradient(120deg, rgba(91, 57, 14, .28), rgba(7, 18, 39, .78)); }
.communication-space-lock strong { color: #f1cf83; }
.communication-space-lock span { color: #aab8cf; font-size: .88rem; }

.communication-tab {
  min-height: 30px;
  padding: 0 10px;
  font-size: 11px;
}

.communication-tab.is-active {
  border-color: rgba(255, 204, 122, 0.34);
  background: rgba(22, 31, 56, 0.92);
  color: var(--text);
}

.communication-body {
  display: grid;
  flex: 1 1 auto;
  gap: 5px;
  min-height: 0;
  grid-template-rows: minmax(60px, 1fr) auto;
}

.communication-log {
  min-height: 58px;
  height: auto;
  max-height: none;
  resize: none;
  overflow-y: auto;
  display: grid;
  gap: 4px;
  padding-right: 3px;
  padding-bottom: 2px;
}

.communication-message,
.communication-empty {
  border: 1px solid rgba(112, 226, 255, 0.14);
  border-radius: 10px;
  background: rgba(7, 12, 24, 0.72);
  padding: 6px 9px;
}

.communication-message.is-own {
  border-color: rgba(255, 204, 122, 0.24);
}

.communication-message.is-system {
  border-style: dashed;
}

.communication-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 10px;
}

.communication-sender-line {
  min-width: 0;
}

.communication-player-link {
  appearance: none;
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-strong);
  font: inherit;
  font-weight: 700;
  line-height: inherit;
  text-align: left;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(var(--accent-rgb), 0.36);
  text-underline-offset: 3px;
}

.communication-player-link:hover,
.communication-player-link:focus-visible {
  color: #fff;
  text-decoration-color: var(--accent);
  text-shadow: 0 0 12px rgba(var(--accent-rgb), 0.5);
}

.communication-message-body {
  line-height: 1.3;
  font-size: 13px;
  word-break: break-word;
}

.communication-form {
  display: grid;
  gap: 4px;
}

.communication-cost {
  color: var(--muted);
  font-size: 11px;
}

.communication-compose,
.mail-compose {
  display: grid;
  gap: 6px;
}

.chat-emoji-picker { display: flex; gap: 4px; min-height: 30px; max-width: 100%; padding: 2px 0; overflow-x: auto; overflow-y: hidden; }
.chat-emoji-picker button { flex: 0 0 30px; width: 30px; height: 30px; display: grid; place-items: center; padding: 2px; border: 1px solid rgba(112, 226, 255, .16); border-radius: 8px; background: rgba(5, 13, 27, .72); cursor: pointer; }
.chat-emoji-picker button:hover { border-color: rgba(var(--accent-rgb), .55); background: rgba(var(--accent-rgb), .12); }
.chat-emoji-picker img { width: 24px; height: 24px; object-fit: contain; }
.chat-inline-emoji { display: inline-block; width: 24px; height: 24px; margin: -4px 2px; vertical-align: middle; object-fit: contain; }

.communication-compose {
  grid-template-columns: minmax(0, 1fr) 130px;
}

.mail-compose {
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr) 130px;
}

.mail-compose select {
  width: 100%;
  border: 1px solid rgba(112, 226, 255, 0.18);
  border-radius: 14px;
  background: rgba(7, 11, 22, 0.88);
  color: var(--text);
  padding: 14px 16px;
}
.mail-gift-compose { display: grid; grid-template-columns: minmax(240px, 420px) auto; gap: 10px; align-items: end; }
.mail-gift-compose label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; }
.mail-gift-compose select { min-height: 38px; border: 1px solid rgba(112, 226, 255, .18); border-radius: 12px; background: rgba(7, 11, 22, .88); color: var(--text); padding: 7px 10px; }
.mail-gift-balance { align-self: center; color: #d6b5ff; font-weight: 700; }
.mail-gift-preview, .communication-gift-card { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 10px; align-items: center; padding: 8px; border: 1px solid rgba(183, 122, 255, .28); border-radius: 12px; background: rgba(40, 15, 65, .32); }
.mail-gift-preview img, .communication-gift-card img { width: 58px; height: 58px; border-radius: 10px; object-fit: contain; }
.mail-gift-preview span, .mail-gift-preview small, .communication-gift-card span, .communication-gift-card small { display: block; margin-top: 3px; color: var(--muted); }
.communication-gift-card { margin-top: 8px; max-width: 420px; }
.communication-compose input, .mail-compose input, .mail-compose select,
.communication-compose button, .mail-compose button { min-height: 38px; padding: 8px 12px; }

.admin-user-list,
.admin-ban-list {
  display: grid;
  gap: 14px;
}

.admin-user-card {
  border: 1px solid rgba(112, 226, 255, 0.14);
  border-radius: 20px;
  padding: 18px;
  background: rgba(7, 12, 24, 0.72);
}

.admin-user-head,
.admin-user-meta,
.admin-actions {
  display: flex;
  gap: 12px;
}

.admin-user-head {
  align-items: center;
  justify-content: space-between;
}

.admin-user-meta {
  flex-wrap: wrap;
  margin: 14px 0 16px;
}

.admin-user-eyebrow {
  margin-bottom: 6px;
}

.admin-meta-chip,
.admin-ban-item {
  border: 1px solid rgba(112, 226, 255, 0.14);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(10, 16, 30, 0.7);
  color: var(--muted);
}

.admin-grant-form {
  display: grid;
  gap: 14px;
}

.admin-grant-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.admin-password-panel { align-self: start; }
.admin-password-panel form + form { margin-top: 16px; padding-top: 16px; border-top: 1px solid rgba(101, 204, 255, .16); }
.admin-password-panel #admin-password-status:not(:empty) { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: rgba(34, 105, 145, .16); }
.admin-emoji-panel { align-self: start; }
.admin-emoji-list { display: grid; gap: 8px; }
.admin-emoji-card { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px; border: 1px solid rgba(112, 226, 255, .18); border-radius: 12px; background: rgba(5, 14, 30, .62); }
.admin-emoji-card.is-disabled { opacity: .48; }
.admin-emoji-card img { width: 42px; height: 42px; object-fit: contain; }
.admin-emoji-card div { display: grid; gap: 3px; }
.admin-emoji-card code { color: var(--accent-strong); }

.admin-grant-grid label {
  display: grid;
  gap: 6px;
}

.admin-grant-grid span {
  font-size: 12px;
  color: var(--muted);
}

.admin-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.toast-stack {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  display: grid;
  gap: 12px;
}

.toast {
  min-width: 280px;
  max-width: 420px;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid rgba(112, 226, 255, 0.18);
  background: rgba(9, 14, 24, 0.92);
  box-shadow: var(--shadow);
}

.toast.error {
  border-color: rgba(255, 123, 123, 0.4);
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(-180px, 140px, 0);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.86;
  }
  50% {
    transform: scale(1.06);
    opacity: 1;
  }
}

@media (min-width: 1280px) {
  .building-list,
  .work-actions,
  .colony-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
  }
}

@media (max-width: 1520px) {
  .game-main-layout {
    --main-map-height: clamp(360px, 52vh, 540px);
    --main-top-height: calc(var(--main-map-height) + 66px);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "center center"
      "left right";
  }

  .map-frame {
    height: 100%;
    min-height: 0;
  }

  .left-sidebar,
  .right-sidebar {
    max-width: none;
  }

  .right-sidebar {
    max-height: min(46vh, 520px);
  }

  .left-sidebar {
    width: auto;
    min-width: 0;
    padding-top: 0;
  }

  .left-sidebar .panel {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 1180px) {
  .hero-screen,
  .game-main-layout {
    grid-template-columns: 1fr;
  }

  .game-main-layout {
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
    grid-template-areas:
      "center"
      "left"
      "right";
  }

  .auth-panel {
    justify-self: stretch;
    width: 100%;
  }

  .game-screen {
    padding-bottom: 24px;
  }

  .right-sidebar {
    max-height: none;
    overflow: visible;
  }

  .header-summary-inline {
    width: 100%;
  }

  .map-frame {
    height: clamp(380px, 54vh, 560px);
    min-height: 380px;
  }

  .planet-showcase {
    flex-direction: column;
  }

  .planet-legend {
    width: 100%;
  }

  .planet-layout {
    grid-template-columns: 1fr;
  }

  .buildings-modal-layout {
    grid-template-columns: 1fr;
  }

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

  .communication-header {
    flex-direction: row;
  }

  .communication-tabs {
    justify-content: flex-start;
  }

  .mail-compose {
    grid-template-columns: 1fr;
  }

  .communication-panel {
    height: auto;
    max-height: none;
    resize: none;
  }

  .communication-log {
    height: 125px;
    resize: vertical;
  }
}

@media (max-height: 860px) {
  .app {
    padding: 16px;
  }

  .game-screen {
    gap: 16px;
  }

  .left-sidebar,
  .right-sidebar {
    gap: 16px;
  }

  .panel {
    padding: 18px;
  }

  .map-stage {
    gap: 12px;
  }

  .map-frame {
    height: clamp(340px, 50vh, 500px);
    min-height: 340px;
  }

  .cauldron {
    width: 96px;
    height: 96px;
    margin: 0 auto 16px;
  }
}

@media (max-width: 820px) {
  .app {
    padding: 16px;
  }

  .hero-points {
    grid-template-columns: 1fr;
  }

  .modal {
    padding: 10px;
  }

  .modal-card {
    padding: 18px;
  }

  .stage-header,
  .modal-header,
  .modal-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .planet-showcase {
    align-items: flex-start;
  }

  .planet-sphere {
    width: 100%;
    min-width: 0;
  }

  .war-choice-grid {
    grid-template-columns: 1fr;
  }

  .market-refugee-card,
  .market-refugee-controls {
    grid-template-columns: 1fr;
  }

  .communication-compose,
  .mail-compose {
    grid-template-columns: 1fr;
  }

  .resource-card {
    grid-template-columns: auto 1fr;
  }

  .resource-value {
    justify-self: start;
    grid-column: 2;
  }

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

  .work-assignment-form,
  .science-branch-grid {
    grid-template-columns: 1fr;
  }
}

.admin-player-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(170px, 240px);
  gap: 10px;
  margin-bottom: 12px;
}
.admin-player-toolbar label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.admin-player-toolbar input, .admin-player-toolbar select,
.admin-space-grant-form input, .admin-space-grant-form select,
.admin-progression-form select {
  width: 100%; padding: 10px 12px; border: 1px solid rgba(112,226,255,.18);
  border-radius: 10px; background: rgba(7,11,22,.88); color: var(--text);
}
.admin-user-card { padding: 11px 13px; border-radius: 14px; }
.admin-user-head h3 { margin: 0; font-size: 14px; }
.admin-user-eyebrow { margin: 0 0 2px; font-size: 9px; }
.admin-user-expand { margin-top: 8px; padding: 7px 10px; font-size: 12px; }
.admin-user-details { padding-top: 8px; }
.admin-user-meta { margin: 6px 0 10px; gap: 5px; }
.admin-meta-chip { padding: 5px 7px; border-radius: 8px; font-size: 11px; }
.admin-grant-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.admin-grant-grid input { padding: 8px; }
.admin-space-grant-form { display: grid; grid-template-columns: minmax(220px, 1fr) 140px auto; align-items: end; gap: 8px; margin-top: 10px; }
.admin-space-grant-form label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.admin-progression-form { display: grid; grid-template-columns: minmax(220px, 1fr) auto auto; align-items: end; gap: 8px; margin-top: 10px; }
.admin-progression-form label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.admin-pagination { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 12px; }

.war-country-card {
  border-color: color-mix(in srgb, var(--country-color) 60%, transparent);
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--country-color) 22%, transparent), transparent 48%),
    linear-gradient(180deg, rgba(12, 18, 35, 0.96), rgba(7, 11, 22, 0.98));
  box-shadow: inset 4px 0 0 var(--country-color);
}

.war-strategy-form,
.war-campaign-timer,
.war-result-card {
  grid-column: 1 / -1;
  display: grid;
  gap: 16px;
  padding: 22px;
  border: 1px solid rgba(112, 226, 255, 0.2);
  border-radius: 22px;
  background: rgba(6, 12, 25, 0.86);
}

.war-strategy-form label {
  display: grid;
  gap: 8px;
}

.war-strategy-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.war-strategy-summary strong,
.war-live-chance {
  color: var(--text);
}

.war-supply-meter {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
}

.war-countdown {
  color: var(--accent-warm);
  font-family: "Orbitron", sans-serif;
  font-size: clamp(38px, 7vw, 76px);
  text-align: center;
}

.war-event-log {
  min-height: 52px;
  padding: 14px;
  border-left: 3px solid var(--accent);
  background: rgba(112, 226, 255, 0.06);
  color: var(--muted);
}

.war-start-button {
  grid-column: 1 / -1;
}

.war-commit-warning {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 174, 73, 0.42);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(104, 48, 14, 0.34), rgba(31, 17, 21, 0.72));
  color: #ffd8a3;
}

.war-commit-warning strong {
  color: #ffba62;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.war-commit-warning span {
  color: var(--text);
  line-height: 1.45;
}

.war-commit-warning.is-committed {
  border-color: rgba(255, 91, 91, 0.54);
  background: linear-gradient(135deg, rgba(115, 23, 29, 0.42), rgba(31, 14, 22, 0.78));
  animation: warning-pulse 1.8s ease-in-out infinite;
}

@keyframes warning-pulse {
  0%, 100% { box-shadow: 0 0 0 rgba(255, 82, 82, 0); }
  50% { box-shadow: 0 0 22px rgba(255, 82, 82, 0.16); }
}

.war-choice-card.is-revealed,
.war-result-card.is-victory {
  border-color: rgba(105, 230, 157, 0.55);
  box-shadow: 0 0 28px rgba(105, 230, 157, 0.12);
}

.war-result-card.is-defeat {
  border-color: rgba(255, 112, 126, 0.5);
}

.raid-result-card {
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(255, 195, 91, 0.12), transparent 42%),
    rgba(6, 12, 25, 0.94);
}

.raid-result-heading {
  display: flex;
  align-items: center;
  gap: 16px;
}

.raid-result-heading > div {
  display: grid;
  gap: 5px;
}

.raid-result-emblem {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid rgba(255, 202, 112, 0.28);
  border-radius: 18px;
  background: rgba(255, 190, 74, 0.08);
  font-size: 29px;
}

.raid-result-changes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(105px, 1fr));
  gap: 10px;
}

.raid-result-change {
  display: grid;
  gap: 3px;
  min-height: 92px;
  place-content: center;
  border: 1px solid rgba(112, 226, 255, 0.14);
  border-radius: 15px;
  background: rgba(1, 7, 16, 0.58);
  text-align: center;
}

.raid-result-change > span { font-size: 21px; }
.raid-result-change > strong { font-size: 20px; }
.raid-result-change > small { color: var(--muted); }
.raid-result-change.is-positive > strong { color: #75e7a4; }
.raid-result-change.is-negative > strong { color: #ff7c8c; }

.raid-result-costs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.raid-result-costs span {
  padding: 8px 11px;
  border-radius: 10px;
  background: rgba(255, 112, 126, 0.07);
  color: var(--muted);
}

.country-genocide-warning {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.planet-control-progress,
.country-genocide-card,
.country-invasion-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid rgba(255, 190, 100, 0.3);
  border-radius: 18px;
  background: rgba(28, 18, 10, 0.5);
}

.country-genocide-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border-color: rgba(255, 105, 120, 0.38);
}

.country-invasion-card {
  border-color: rgba(255, 188, 82, 0.42);
  background: linear-gradient(135deg, rgba(70, 36, 12, 0.56), rgba(16, 24, 43, 0.7));
}

.country-invasion-card div {
  display: grid;
  gap: 5px;
  color: var(--muted);
}

.country-invasion-card strong {
  color: #ffd28a;
}

.country-genocide-card div {
  display: grid;
  gap: 5px;
  color: var(--muted);
}

.country-genocide-card strong {
  color: #ffb7bf;
}

.danger-button {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid rgba(255, 105, 120, 0.5);
  border-radius: 14px;
  background: rgba(108, 22, 38, 0.52);
  color: #ffe9ec;
  font-weight: 800;
}

@media (max-width: 820px) {
  .war-strategy-summary,
  .country-genocide-card {
    grid-template-columns: 1fr;
    flex-direction: column;
  }
}

.market-refresh-note {
  grid-column: 1 / -1;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(112, 226, 255, 0.14);
  border-radius: 14px;
  background: rgba(5, 12, 24, 0.68);
  color: var(--muted);
  font-size: 13px;
}

.market-refugee-card {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(320px, 1.2fr);
  gap: 18px;
  align-items: center;
  padding: 18px;
  border: 1px solid rgba(255, 204, 122, 0.28);
  border-radius: 20px;
  background:
    radial-gradient(circle at top left, rgba(255, 204, 122, 0.12), transparent 42%),
    rgba(7, 12, 24, 0.78);
}

.market-refugee-description,
.market-refugee-card-exhausted {
  display: grid;
  gap: 7px;
  color: var(--muted);
}

.market-refugee-description strong,
.market-refugee-card-exhausted strong {
  color: var(--text);
}

.market-refugee-controls {
  display: grid;
  grid-template-columns: 100px minmax(210px, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.market-refugee-cost {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.planet-country-legend {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(112, 226, 255, 0.14);
}

.planet-country-legend-title {
  color: var(--text);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.planet-country-item {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.planet-country-marker {
  width: 12px;
  height: 12px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 4px;
  box-shadow: 0 0 8px currentColor;
}

@media (max-width: 820px) {
  .market-refugee-card,
  .market-refugee-controls {
    grid-template-columns: 1fr;
  }
}

/* ===== Visual refresh: strategic command interface ===== */
:root {
  --bg: #030611;
  --bg-soft: rgba(8, 14, 29, 0.9);
  --panel: rgba(10, 18, 35, 0.82);
  --panel-strong: rgba(15, 25, 47, 0.96);
  --border: rgba(116, 206, 255, 0.2);
  --border-strong: rgba(255, 204, 112, 0.42);
  --text: #f3f7ff;
  --muted: #9aa9c8;
  --accent: #62ddff;
  --accent-rgb: 98, 221, 255;
  --accent-strong: #ffc76b;
  --accent-strong-rgb: 255, 199, 107;
  --panel-highlight: rgba(124, 220, 255, 0.08);
  --shadow: 0 30px 90px rgba(0, 3, 12, 0.64);
  --shadow-tight: 0 14px 36px rgba(0, 4, 16, 0.48);
}

body[data-era="iron_age_unlocked"] {
  --accent: #79d8ff;
  --accent-rgb: 121, 216, 255;
  --accent-strong: #ffb45f;
  --accent-strong-rgb: 255, 180, 95;
}

body[data-era="feudalism_unlocked"],
body[data-era="holy_empire_unlocked"] {
  --accent: #bfa0ff;
  --accent-rgb: 191, 160, 255;
  --accent-strong: #ffd271;
  --accent-strong-rgb: 255, 210, 113;
}

body[data-era="republic_unlocked"] {
  --accent: #73e1ff;
  --accent-rgb: 115, 225, 255;
  --accent-strong: #8ef0c4;
  --accent-strong-rgb: 142, 240, 196;
}

body[data-era="manufacturing_unlocked"] {
  --accent: #68ddff;
  --accent-rgb: 104, 221, 255;
  --accent-strong: #f0b85b;
  --accent-strong-rgb: 240, 184, 91;
  --panel-highlight: rgba(240, 184, 91, 0.07);
}

html,
body {
  background:
    radial-gradient(circle at 50% -10%, rgba(var(--accent-rgb), 0.12), transparent 35%),
    radial-gradient(circle at 90% 80%, rgba(var(--accent-strong-rgb), 0.07), transparent 28%),
    linear-gradient(180deg, #040817 0%, #02050d 68%, #01030a 100%);
}

.app-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(126, 210, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 210, 255, 0.018) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 86%);
}

.app {
  padding: clamp(14px, 1.8vw, 30px);
}

.panel,
.stat-card,
.resource-card,
.building-card,
.work-card,
.science-branch-card,
.communication-message,
.communication-empty {
  position: relative;
  border-color: var(--border);
  background:
    linear-gradient(135deg, var(--panel-highlight), transparent 38%),
    linear-gradient(180deg, rgba(17, 28, 52, 0.94), rgba(6, 12, 25, 0.92));
  box-shadow: var(--shadow-tight), inset 0 1px rgba(255, 255, 255, 0.035);
}

.panel::before,
.modal-card::before,
.map-frame::before,
.planet-map-frame::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: -1px;
  left: 22px;
  width: 72px;
  height: 2px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.7);
}

.panel-header {
  position: relative;
  gap: 7px;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.1);
}

.panel-header::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 46px;
  height: 1px;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.55);
}

.eyebrow {
  margin-bottom: 2px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-shadow: 0 0 16px rgba(var(--accent-rgb), 0.36);
}

h1 {
  letter-spacing: -0.035em;
  text-wrap: balance;
  background: linear-gradient(115deg, #ffffff 15%, #bceeff 54%, #ffd899 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 10px 28px rgba(76, 181, 255, 0.12));
}

h2,
h3 {
  letter-spacing: 0.015em;
}

.primary-button,
.secondary-button,
.ghost-button,
.header-icon-button,
.modal-close {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-radius: 14px;
  font-weight: 700;
  letter-spacing: 0.015em;
  transform: translateZ(0);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.primary-button::after,
.secondary-button::after,
.ghost-button::after,
.header-icon-button::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, 0.17), transparent 72%);
  transform: translateX(-130%);
  transition: transform 380ms ease;
}

.primary-button:hover::after,
.secondary-button:hover::after,
.ghost-button:hover::after,
.header-icon-button:hover::after {
  transform: translateX(130%);
}

.primary-button {
  border: 1px solid rgba(var(--accent-rgb), 0.72);
  background:
    linear-gradient(180deg, rgba(139, 234, 255, 0.28), rgba(39, 154, 194, 0.2)),
    rgba(8, 28, 46, 0.92);
  color: #f6fdff;
  box-shadow: 0 10px 28px rgba(var(--accent-rgb), 0.16), inset 0 1px rgba(255, 255, 255, 0.14);
}

.secondary-button {
  border: 1px solid rgba(var(--accent-strong-rgb), 0.48);
  background:
    linear-gradient(180deg, rgba(var(--accent-strong-rgb), 0.16), rgba(84, 50, 16, 0.08)),
    rgba(16, 21, 36, 0.92);
  color: #ffe7b8;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.06);
}

.ghost-button {
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  background: linear-gradient(180deg, rgba(30, 46, 76, 0.5), rgba(10, 17, 31, 0.7));
  color: #dce7fa;
}

.primary-button:hover:not(:disabled),
.secondary-button:hover:not(:disabled),
.ghost-button:hover:not(:disabled),
.header-icon-button:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: rgba(var(--accent-rgb), 0.72);
  box-shadow: 0 14px 30px rgba(var(--accent-rgb), 0.15), inset 0 1px rgba(255, 255, 255, 0.1);
}

.primary-button:active:not(:disabled),
.secondary-button:active:not(:disabled),
.ghost-button:active:not(:disabled) {
  transform: translateY(0) scale(0.985);
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

button:disabled {
  filter: saturate(0.45);
  opacity: 0.48;
  cursor: not-allowed;
}

input,
select {
  border-color: rgba(var(--accent-rgb), 0.2);
  background:
    linear-gradient(180deg, rgba(16, 26, 48, 0.92), rgba(5, 10, 21, 0.94));
  box-shadow: inset 0 1px 8px rgba(0, 0, 0, 0.28);
}

/* Native dropdown menus do not reliably inherit the dark game surface on Windows. */
select {
  color-scheme: dark;
}

select option,
select optgroup {
  background-color: #0b1427;
  color: #f1f6ff;
}

select option:checked {
  background-color: #315d91;
  color: #ffffff;
}

select option:disabled {
  color: #8996ad;
}

input:hover,
select:hover {
  border-color: rgba(var(--accent-rgb), 0.38);
}

.game-main-layout {
  --main-map-height: clamp(400px, 54vh, 620px);
  grid-template-columns: minmax(168px, 190px) minmax(0, 1fr) minmax(210px, 238px);
  grid-template-areas: "left center right";
  gap: clamp(14px, 1.3vw, 22px);
}

.left-sidebar {
  width: auto;
  min-width: 0;
  max-width: none;
  padding-top: 18px;
}

.left-sidebar .panel {
  width: 100%;
  max-width: none;
}

.left-sidebar .panel,
.right-sidebar .panel {
  padding: 16px;
}

.left-sidebar .primary-button,
.left-sidebar .secondary-button,
.left-sidebar .ghost-button,
.right-sidebar .primary-button,
.right-sidebar .secondary-button,
.right-sidebar .ghost-button {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 13px;
  font-size: 13px;
}

.left-sidebar .resource-card {
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 8px;
  padding: 9px;
}

.prayer-panel .cauldron {
  width: 82px;
  height: 82px;
  margin-bottom: 12px;
}

.cauldron::before,
.cauldron::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(var(--accent-strong-rgb), 0.28);
  animation: orbit-ring 9s linear infinite;
}

.cauldron::before {
  inset: 2px;
  border-left-color: transparent;
  border-right-color: transparent;
}

.cauldron::after {
  inset: 12px;
  animation-direction: reverse;
  animation-duration: 6s;
  border-top-color: transparent;
}

.map-stage {
  padding-left: 0;
}

.stage-header {
  padding: 7px 10px 0;
}

.header-badge,
.header-icon-button {
  min-height: 38px;
  border-color: rgba(var(--accent-rgb), 0.2);
  background:
    linear-gradient(180deg, rgba(24, 39, 67, 0.86), rgba(7, 14, 28, 0.88));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.05), 0 8px 20px rgba(0, 4, 16, 0.24);
}

.header-icon-glyph {
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.3), rgba(var(--accent-rgb), 0.08));
  box-shadow: 0 0 16px rgba(var(--accent-rgb), 0.22);
}

.summary-chip {
  min-height: 28px;
  padding: 4px 8px 4px 5px;
  border-color: rgba(var(--accent-rgb), 0.16);
  background: linear-gradient(180deg, rgba(24, 39, 67, 0.82), rgba(7, 14, 28, 0.86));
}

.summary-chip-badge {
  min-width: 20px;
  height: 20px;
  border-color: rgba(var(--accent-strong-rgb), 0.26);
  color: var(--accent-strong);
  box-shadow: inset 0 0 10px rgba(var(--accent-strong-rgb), 0.08);
}

.map-frame,
.planet-map-frame {
  border-color: rgba(var(--accent-rgb), 0.28);
  background: #020610;
  box-shadow:
    0 34px 100px rgba(0, 3, 14, 0.72),
    0 0 0 1px rgba(255, 255, 255, 0.025) inset,
    0 0 46px rgba(var(--accent-rgb), 0.06) inset;
}

.map-frame::after,
.planet-map-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.34);
  background:
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.22), transparent 34px) left top / 80px 1px no-repeat,
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.22), transparent 34px) left top / 1px 80px no-repeat,
    linear-gradient(270deg, rgba(var(--accent-strong-rgb), 0.2), transparent 34px) right bottom / 80px 1px no-repeat,
    linear-gradient(0deg, rgba(var(--accent-strong-rgb), 0.2), transparent 34px) right bottom / 1px 80px no-repeat;
}

.mini-hud {
  padding: 15px 17px;
  border-radius: 16px;
  background: rgba(4, 10, 22, 0.76);
  box-shadow: 0 16px 36px rgba(0, 3, 12, 0.48);
}

.action-panel {
  gap: 9px;
}

.action-panel > button {
  justify-content: flex-start;
  min-height: 48px;
  padding-left: 18px;
}

.action-panel > button::before {
  content: "";
  display: inline-block;
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  margin-right: 10px;
  border-radius: 1px;
  background: var(--accent);
  transform: rotate(45deg);
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.72);
}

.resource-card {
  border-radius: 17px;
}

.resource-icon {
  background:
    radial-gradient(circle at 35% 25%, rgba(var(--accent-strong-rgb), 0.22), transparent 38%),
    rgba(5, 12, 25, 0.9);
  border-color: rgba(var(--accent-strong-rgb), 0.25);
  color: var(--accent-strong);
  box-shadow: inset 0 0 16px rgba(var(--accent-strong-rgb), 0.08);
}

.building-card,
.work-card,
.science-branch-card {
  transition: transform 170ms ease, border-color 170ms ease, box-shadow 170ms ease;
}

.building-card:hover,
.work-card:hover,
.science-branch-card:hover {
  transform: translateY(-2px);
  border-color: rgba(var(--accent-rgb), 0.34);
  box-shadow: 0 18px 42px rgba(0, 4, 16, 0.5), inset 0 1px rgba(255, 255, 255, 0.04);
}

.work-progress {
  height: 10px;
  padding: 2px;
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  background: rgba(1, 5, 13, 0.82);
}

.work-progress-bar {
  box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.42);
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
}

.resource-burst {
  position: absolute;
  z-index: 12;
  width: 0;
  height: 0;
  pointer-events: none;
}

.resource-particle {
  position: absolute;
  left: 0;
  top: 0;
  color: #adb9c9;
  font-size: 17px;
  line-height: 1;
  opacity: 0;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.72));
  animation: resource-particle-drop 820ms cubic-bezier(0.16, 0.7, 0.28, 1) var(--burst-delay) forwards;
}

.resource-burst--metal .resource-particle {
  color: #b8c5d5;
  text-shadow: 0 0 8px rgba(180, 215, 255, 0.78);
}

.resource-burst--gold .resource-particle {
  color: #ffc74f;
  text-shadow: 0 0 9px rgba(255, 189, 55, 0.9);
}

.resource-burst--food .resource-particle,
.resource-burst--wood .resource-particle,
.resource-burst--weapon .resource-particle,
.resource-burst--rest .resource-particle {
  font-size: 21px;
}

.resource-burst-label {
  position: absolute;
  left: 0;
  top: -18px;
  width: max-content;
  transform: translateX(-50%);
  color: #eaf8ff;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-shadow: 0 2px 10px #000, 0 0 12px rgba(var(--accent-rgb), 0.8);
  animation: resource-label-rise 900ms ease-out forwards;
}

.operation-resource-burst {
  z-index: 40;
}

.operation-resource-label {
  padding: 7px 11px;
  border: 1px solid rgba(var(--accent-rgb), 0.34);
  border-radius: 999px;
  background: rgba(3, 9, 20, 0.94);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.48), 0 0 16px rgba(var(--accent-rgb), 0.2);
  font-size: 15px;
  letter-spacing: 0.05em;
}

@keyframes resource-particle-drop {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) rotate(0) scale(0.35);
  }
  18% {
    opacity: 1;
  }
  48% {
    opacity: 1;
    transform: translate3d(var(--burst-x), var(--burst-peak), 0) rotate(var(--burst-rotate)) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--burst-x), var(--burst-fall), 0) rotate(var(--burst-rotate)) scale(0.72);
  }
}

@keyframes resource-label-rise {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(0.8); }
  18% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  72% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -42px) scale(1.05); }
}

.modal-backdrop {
  background:
    radial-gradient(circle at 50% 30%, rgba(var(--accent-rgb), 0.08), transparent 38%),
    rgba(0, 3, 10, 0.84);
  backdrop-filter: blur(18px) saturate(0.75);
}

.modal-card {
  border-color: rgba(var(--accent-rgb), 0.28);
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.05), transparent 30%),
    linear-gradient(180deg, rgba(12, 21, 41, 0.985), rgba(3, 8, 18, 0.99));
  box-shadow: 0 46px 140px rgba(0, 0, 0, 0.7), inset 0 1px rgba(255, 255, 255, 0.04);
  scrollbar-color: rgba(var(--accent-rgb), 0.35) rgba(3, 8, 18, 0.7);
}

.modal-close {
  z-index: 4;
  border-color: rgba(var(--accent-rgb), 0.26);
  background: rgba(7, 15, 29, 0.9);
  box-shadow: 0 8px 24px rgba(0, 3, 12, 0.38);
}

.modal-close:hover {
  transform: rotate(90deg);
  border-color: var(--accent);
  color: var(--accent);
}

.planet-hover-card {
  border-color: rgba(var(--accent-rgb), 0.32);
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.1), transparent 46%),
    rgba(3, 9, 20, 0.92);
  box-shadow: 0 22px 54px rgba(0, 2, 10, 0.58);
}

.communication-panel {
  border-radius: 22px;
}

.communication-tab.is-active {
  border-color: rgba(var(--accent-rgb), 0.5);
  background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.18), rgba(10, 20, 38, 0.88));
  color: #fff;
  box-shadow: 0 7px 18px rgba(var(--accent-rgb), 0.08);
}

@keyframes orbit-ring {
  to { transform: rotate(360deg); }
}

@media (max-width: 1360px) {
  .game-main-layout {
    grid-template-columns: 152px minmax(0, 1fr) 205px;
  }

  .left-sidebar .panel,
  .right-sidebar .panel {
    padding: 13px;
  }
}

@media (max-width: 1180px) {
  .game-main-layout {
    height: auto;
    min-height: 0;
    max-height: none;
    grid-template-columns: minmax(0, 1fr) minmax(210px, 250px);
    grid-template-areas:
      "center right"
      "left right";
    overflow: visible;
  }

  .left-sidebar {
    padding-top: 0;
  }

  .left-sidebar .prayer-panel {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
  }

  .left-sidebar .panel-header,
  .left-sidebar .muted-text {
    display: none;
  }

  .left-sidebar .resource-grid {
    min-width: 130px;
  }

  .left-sidebar .greater-good-sacrifice {
    grid-column: 1 / -1;
    width: 100%;
    margin-top: 0;
  }
}

@media (max-width: 820px) {
  .app {
    padding: 10px;
  }

  .game-main-layout {
    display: flex;
    flex-direction: column;
  }

  .map-stage,
  .left-sidebar,
  .right-sidebar {
    width: 100%;
  }

  .greater-good-sacrifice-controls {
    grid-template-columns: 1fr;
  }

  .map-stage { order: 1; }
  .right-sidebar { order: 2; }
  .left-sidebar { order: 3; }

  .right-sidebar .action-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .right-sidebar .panel-header {
    grid-column: 1 / -1;
  }

  .map-frame {
    min-height: 420px;
  }

  .modal {
    padding: 8px;
  }

  .modal-card {
    max-height: calc(100vh - 16px);
    padding: 20px 16px;
    border-radius: 22px;
  }

  .header-badges {
    justify-content: flex-start;
  }
}

/* Colony overview: separate territory, production, infrastructure and live statuses. */
.colony-summary-shell {
  margin-top: 18px;
}

.colony-summary-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 8px;
  overflow-x: auto;
  padding: 5px;
  border: 1px solid rgba(var(--accent-rgb), 0.16);
  border-radius: 18px;
  background: rgba(4, 10, 22, 0.72);
  scrollbar-width: thin;
}

.colony-summary-tab {
  min-height: 46px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.colony-summary-tab:hover {
  color: var(--text);
  border-color: rgba(var(--accent-rgb), 0.22);
  background: rgba(var(--accent-rgb), 0.07);
}

.colony-summary-tab.is-active {
  color: #fff;
  border-color: rgba(var(--accent-rgb), 0.46);
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb), 0.2), rgba(var(--accent-rgb), 0.08)),
    rgba(12, 22, 42, 0.9);
  box-shadow: 0 8px 24px rgba(0, 5, 18, 0.28), inset 0 1px rgba(255, 255, 255, 0.06);
}

.colony-summary-groups {
  display: block;
  margin-top: 12px;
}

.colony-summary-panel[hidden],
.colony-summary-group[hidden] {
  display: none !important;
}

.modal-card > .modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  left: auto;
}

.modal-card > .modal-header {
  padding-right: 56px;
}

.colony-summary-group {
  min-width: 0;
  padding: 18px;
}

.colony-summary-group .panel-header {
  margin-bottom: 12px;
  padding-bottom: 10px;
}

.colony-summary-group .resource-grid {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 9px;
}

.colony-summary-group .resource-card {
  min-width: 0;
  min-height: 62px;
  padding: 9px 11px;
  border-radius: 15px;
}

.work-finance-card {
  border-color: rgba(255, 204, 112, 0.34);
  background:
    radial-gradient(circle at 88% 12%, rgba(255, 202, 91, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(28, 30, 43, 0.96), rgba(8, 13, 25, 0.94));
}

@media (max-width: 980px) {
  .colony-summary-tabs {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
  }
}

@media (max-width: 600px) {
  .colony-summary-group .resource-grid {
    grid-template-columns: 1fr;
  }
}

/* Planet surface: keep the map and the complete resource overview inside one viewport. */
.modal-card-planet {
  width: min(1380px, 100%);
  max-height: calc(100dvh - 32px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  overflow: hidden;
  padding: 20px;
}

.modal-card-planet .modal-header {
  min-height: 48px;
  padding-right: 56px;
}

.modal-card-planet .modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  left: auto;
}

.modal-card-planet .modal-header h2 {
  margin-top: 2px;
}

.modal-card-planet .planet-showcase {
  display: none;
}

.modal-card-planet .planet-layout {
  min-height: 0;
  height: clamp(480px, 58dvh, 620px);
  grid-template-columns: minmax(0, 1fr) minmax(330px, 370px);
  gap: 14px;
  align-items: stretch;
}

.modal-card-planet .planet-map-frame {
  min-width: 0;
  min-height: 0;
  height: 100%;
  border-radius: 24px;
}

.modal-card-planet .planet-legend {
  width: auto;
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 14px;
  overflow: hidden auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--accent-rgb), 0.42) transparent;
}

.modal-card-planet .planet-legend .panel-header {
  margin-bottom: 10px;
  padding-bottom: 10px;
}

.modal-card-planet #planet-resource-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.modal-card-planet #planet-resource-grid .resource-card {
  min-width: 0;
  min-height: 58px;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 15px;
}

.modal-card-planet #planet-resource-grid .resource-icon {
  min-width: 36px;
  width: 36px;
  height: 36px;
  padding: 0 4px;
  border-radius: 10px;
  font-size: 10px;
}

.modal-card-planet #planet-resource-grid .resource-name {
  min-width: 0;
  overflow: visible;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.15;
  text-overflow: clip;
  white-space: normal;
}

.modal-card-planet #planet-resource-grid .resource-value {
  justify-self: end;
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
}

.modal-card-planet .modal-footer {
  min-height: 30px;
  margin: 0;
  padding-top: 4px;
}

.modal-card-planet #planet-hint-text {
  margin: 0;
  font-size: 13px;
}

@media (max-width: 980px) {
  .modal-card-planet {
    display: block;
    overflow: auto;
  }

  .modal-card-planet .planet-layout {
    height: auto;
    grid-template-columns: 1fr;
  }

  .modal-card-planet .planet-map-frame {
    height: clamp(390px, 58dvh, 560px);
  }

  .modal-card-planet .planet-legend {
    height: auto;
    max-height: none;
  }

  .modal-card-planet #planet-resource-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .modal-card-planet .modal-footer {
    margin-top: 12px;
  }
}

@media (max-width: 640px) {
  .modal-card-planet .modal-header {
    padding-right: 48px;
  }

  .modal-card-planet .header-badges {
    display: none;
  }

  .modal-card-planet .planet-map-frame {
    height: 420px;
  }

  .modal-card-planet #planet-resource-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
/* Space-age interface */
.space-menu-button {
  border: 1px solid rgba(111, 224, 255, .42);
  border-radius: 12px;
  padding: 12px 14px;
  color: #dff9ff;
  background: linear-gradient(135deg, rgba(27, 96, 139, .72), rgba(47, 34, 100, .7));
  box-shadow: inset 0 0 22px rgba(80, 211, 255, .08), 0 0 18px rgba(49, 168, 255, .08);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.space-menu-button:hover { border-color: rgba(151, 239, 255, .82); transform: translateY(-1px); }
.space-modal-card { width: min(1380px, calc(100vw - 36px)); max-height: calc(100vh - 44px); }
.space-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0 0 14px; padding: 6px; border: 1px solid rgba(101, 204, 255, .2); border-radius: 14px; background: rgba(2, 10, 25, .72); }
.space-tab { padding: 12px; border: 0; border-radius: 10px; color: #91a4c6; background: transparent; font: inherit; font-weight: 750; cursor: pointer; }
.space-tab.is-active { color: #f3fcff; background: linear-gradient(135deg, rgba(49, 151, 197, .48), rgba(85, 75, 171, .42)); box-shadow: inset 0 0 0 1px rgba(105, 224, 255, .42); }
.space-content { display: grid; gap: 14px; }
.space-section { margin: 0; }
.space-empty { min-height: 190px; display: grid; place-content: center; gap: 12px; text-align: center; color: #9fb2d1; padding: 34px; border: 1px dashed rgba(112, 212, 255, .28); border-radius: 18px; }
.space-empty strong { color: #effbff; font-size: 1.35rem; }
.space-hero-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.space-stat { padding: 16px; border: 1px solid rgba(102, 211, 255, .22); border-radius: 15px; background: linear-gradient(145deg, rgba(22, 43, 78, .9), rgba(8, 18, 42, .92)); }
.space-stat span { display: block; color: #91a5c8; font-size: .78rem; }
.space-stat strong { display: block; margin-top: 6px; color: #f4fbff; font-size: 1.15rem; }
.space-action-grid, .space-facility-grid, .space-recipe-grid, .space-market-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.space-action-grid form, .space-facility-card, .space-recipe-card, .space-offer-card { display: grid; align-content: start; gap: 10px; padding: 15px; border: 1px solid rgba(101, 201, 255, .2); border-radius: 15px; background: rgba(5, 16, 37, .76); }
.space-action-grid span, .space-facility-card span, .space-recipe-card span, .space-offer-card span { color: #9cadca; font-size: .84rem; line-height: 1.45; }
.space-recipe-card { transition: opacity 180ms ease, filter 180ms ease, border-color 180ms ease; }
.space-recipe-card.is-unavailable { border-color: rgba(139, 151, 172, .14); filter: grayscale(.82); opacity: .5; background: rgba(12, 17, 28, .72); }
.space-recipe-card.is-unavailable:hover { opacity: .64; }
.space-recipe-card.is-unavailable .space-tier { color: #d2d7df !important; background: #596273; }
.space-recipe-status { min-height: 1.2em; color: #78deb8; font-size: .76rem; }
.space-recipe-card.is-unavailable .space-recipe-status { color: #b5bbc6; }
.space-recipe-card input:disabled { color: #7f8795; border-color: rgba(139, 151, 172, .15); background: rgba(12, 16, 24, .82); cursor: not-allowed; }
.space-orbit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.space-object-card { position: relative; overflow: hidden; display: grid; gap: 7px; padding: 15px; border: 1px solid rgba(104, 215, 255, .24); border-radius: 16px; background: radial-gradient(circle at 14% 12%, rgba(72, 193, 255, .17), transparent 36%), rgba(4, 13, 31, .9); }
.space-object-card::after { content: ""; position: absolute; width: 130px; height: 44px; right: -38px; top: -9px; border: 1px solid rgba(138, 228, 255, .16); border-radius: 50%; transform: rotate(-18deg); }
.space-object-icon { color: #bdf4ff; font-size: 1.7rem; text-shadow: 0 0 18px rgba(108, 225, 255, .75); }
.space-object-card span, .space-object-card small { color: #9cafd0; }
.space-object-card form, .space-recipe-card form, .space-facility-card form { display: grid; gap: 8px; margin-top: 5px; }

.expedition-target-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.expedition-target-card { overflow: hidden; display: grid; grid-template-columns: minmax(100px, 34%) 1fr; border: 1px solid rgba(101, 201, 255, .22); border-radius: 16px; background: rgba(5, 16, 37, .78); }
.expedition-target-card > img { width: 100%; height: 100%; min-height: 220px; object-fit: cover; }
.expedition-target-card > div { display: grid; align-content: start; gap: 9px; padding: 15px; }
.expedition-target-card p, .expedition-target-card small { margin: 0; color: #9cadca; }
.expedition-target-card form { display: grid; gap: 8px; }
.expedition-run-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.expedition-run-stats > span { padding: 9px 12px; border: 1px solid rgba(103, 207, 255, .18); border-radius: 10px; color: #9cadca; background: rgba(3, 12, 28, .7); }
.expedition-open-card { display: grid; grid-template-columns: minmax(130px, 220px) 1fr; gap: 18px; margin: 16px 0; padding: 15px; border: 1px solid rgba(224, 183, 91, .35); border-radius: 18px; background: linear-gradient(135deg, rgba(52, 38, 15, .45), rgba(4, 14, 33, .94)); }
.expedition-open-card > img, .expedition-card-symbol { width: 100%; height: 180px; border-radius: 13px; object-fit: cover; }
.expedition-card-symbol { display: grid; place-items: center; font-size: 4rem; color: #e8c779; background: radial-gradient(circle, rgba(228, 183, 84, .24), transparent 70%); }
.expedition-open-card h3, .expedition-open-card p { margin: 6px 0; }
.expedition-open-card p { color: #aebbd1; line-height: 1.55; }
.expedition-answer-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.expedition-step-result { display: grid; gap: 10px; margin: 14px 0; padding: 14px 16px; border: 1px solid rgba(91, 231, 167, .38); border-radius: 14px; background: linear-gradient(135deg, rgba(25, 104, 75, .24), rgba(4, 18, 34, .9)); }
.expedition-step-result.is-failed { border-color: rgba(255, 119, 128, .4); background: linear-gradient(135deg, rgba(112, 35, 46, .24), rgba(4, 18, 34, .9)); }
.expedition-step-result > div:first-child { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.expedition-step-result > div:first-child span { color: #7fe4b3; font-size: .74rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.expedition-step-result.is-failed > div:first-child span { color: #ff9ca5; }
.expedition-step-result p { margin: 0; color: #aebdd2; }
.expedition-reward-list { display: flex; flex-wrap: wrap; gap: 7px; }
.expedition-reward-chip, .expedition-reward-empty { padding: 6px 9px; border: 1px solid rgba(117, 170, 213, .25); border-radius: 999px; color: #afbed3; background: rgba(5, 17, 35, .72); font-size: .8rem; }
.expedition-reward-chip.is-positive { color: #a8f3cc; border-color: rgba(91, 231, 167, .3); background: rgba(24, 105, 75, .2); }
.expedition-reward-chip.is-negative { color: #ffadb4; border-color: rgba(255, 119, 128, .3); background: rgba(112, 35, 46, .2); }
.expedition-archive-list { display: grid; gap: 10px; }
.expedition-archive-run { display: grid; gap: 9px; padding: 13px 15px; border: 1px solid rgba(91, 231, 167, .24); border-radius: 13px; background: rgba(5, 21, 35, .7); }
.expedition-archive-run.is-lost { border-color: rgba(255, 119, 128, .22); }
.expedition-archive-run > div:first-child { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.expedition-archive-run > div:first-child span, .expedition-archive-run p { margin: 0; color: #93a8c6; font-size: .82rem; }
.expedition-archive-run > p { color: #e9c879; font-weight: 800; }
.expedition-board { width: min(100%, 760px); margin: 18px auto 0; display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; padding: 10px; border: 1px solid rgba(94, 201, 255, .22); border-radius: 18px; background: rgba(2, 9, 23, .92); }
.expedition-cell { aspect-ratio: 1; display: grid; place-items: center; min-width: 0; border: 1px solid rgba(90, 128, 173, .13); border-radius: 7px; color: #52637e; background: rgba(13, 27, 49, .72); }
.expedition-cell form { display: contents; }
.expedition-cell button { width: 100%; height: 100%; padding: 0; border: 1px solid rgba(89, 219, 255, .6); border-radius: 7px; color: #8aeaff; background: rgba(21, 126, 162, .22); cursor: pointer; }
.expedition-cell.is-current { color: #fff; border-color: #77e8ff; background: radial-gradient(circle, #42c8e8, #125082); box-shadow: 0 0 18px rgba(75, 220, 255, .45); }
.expedition-cell.is-exit { color: #83ffc1; border-color: rgba(88, 239, 166, .45); }
.expedition-cell.is-start { color: #e9c26c; }
.expedition-cell.is-revealed { background: rgba(30, 60, 91, .72); }
.expedition-card-picker { grid-column: 1 / -1; padding: 14px; border: 1px solid rgba(101, 201, 255, .2); border-radius: 12px; }
.expedition-card-picker > div { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; margin-top: 8px; }
.expedition-card-picker label { display: flex !important; grid-template-columns: none !important; align-items: center; gap: 8px; }
.expedition-resource-builder { grid-column: 1 / -1; padding: 14px; border: 1px solid rgba(101, 201, 255, .2); border-radius: 12px; }
.expedition-resource-builder > p { margin: 4px 0 12px; }
#admin-expedition-resource-rows { display: grid; gap: 9px; margin-bottom: 10px; }
.expedition-resource-row { display: grid; grid-template-columns: minmax(190px, 2fr) minmax(120px, 1fr) 42px; align-items: end; gap: 8px; padding: 9px; border: 1px solid rgba(94, 175, 224, .16); border-radius: 10px; background: rgba(4, 13, 31, .55); }
.expedition-resource-row label { display: grid !important; gap: 5px; }
.expedition-resource-remove { width: 42px; min-width: 42px; height: 42px; padding: 0; color: #ff8e9b; font-size: 1.25rem; }
.expedition-question-builder { grid-column: 1 / -1; padding: 14px; border: 1px solid rgba(101, 201, 255, .2); border-radius: 12px; }
.expedition-question-builder > p { margin: 4px 0 12px; }
#admin-expedition-option-rows { display: grid; gap: 9px; margin-bottom: 10px; }
.expedition-option-row { display: grid; grid-template-columns: 112px minmax(220px, 2fr) minmax(105px, .7fr) minmax(105px, .7fr) 42px; align-items: end; gap: 8px; padding: 10px; border: 1px solid rgba(94, 175, 224, .16); border-radius: 10px; background: rgba(4, 13, 31, .55); }
.expedition-option-row label { display: grid !important; gap: 5px; }
.expedition-option-row .expedition-correct-choice { display: flex !important; align-items: center; align-self: center; gap: 7px; padding-top: 18px; }
.expedition-option-row .expedition-correct-choice input { width: auto; }
.expedition-option-remove { width: 42px; min-width: 42px; height: 42px; padding: 0; color: #ff8e9b; font-size: 1.25rem; }
.expedition-generator-bar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; padding: 14px; border: 1px solid rgba(226, 183, 110, .28); border-radius: 13px; background: linear-gradient(120deg, rgba(87, 55, 12, .25), rgba(5, 16, 37, .7)); }
.expedition-generator-bar > div { display: grid; gap: 4px; }
.expedition-generator-bar span { color: #9cadca; font-size: .84rem; }
.expedition-generator-bar > .expedition-generator-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.expedition-image-preview { display: grid; align-content: start; gap: 7px; padding: 10px; border: 1px solid rgba(101, 201, 255, .2); border-radius: 12px; background: rgba(4, 13, 31, .55); }
.expedition-image-preview span { color: #9cadca; font-size: .78rem; }
.expedition-image-preview img { width: 100%; max-width: 260px; max-height: 200px; border-radius: 10px; object-fit: contain; background: rgba(0, 0, 0, .22); }
.expedition-image-preview a { width: fit-content; color: #73d7ff; font-size: .82rem; text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.space-object-card label, .space-recipe-card label, .space-facility-card label, .space-inline-form label, .space-market-form label, .space-offer-card label { display: grid; gap: 5px; color: #93a8c9; font-size: .78rem; }
.space-content input, .space-content select { width: 100%; min-width: 0; padding: 10px 11px; border: 1px solid rgba(104, 189, 255, .26); border-radius: 10px; color: #eefaff; background: #071226; }
.space-mission-list { display: grid; gap: 8px; }
.space-mission-list article { display: grid; grid-template-columns: 1.3fr 1fr .7fr 1fr; gap: 10px; align-items: center; padding: 12px; border-radius: 12px; background: rgba(7, 20, 44, .78); color: #9fb2d2; }
.space-mission-list strong { color: #effaff; }
.space-inventory-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 8px; }
.space-inventory-item { display: grid; gap: 3px; padding: 11px; border: 1px solid rgba(105, 198, 255, .18); border-radius: 11px; background: rgba(7, 18, 40, .7); }
.space-inventory-item span, .space-inventory-item small { color: #91a5c8; }
.space-inventory-item strong { color: #f6fbff; font-size: 1.08rem; }
.space-tier { width: max-content; padding: 4px 8px; border-radius: 999px; color: #081429 !important; background: #83dcff; font-weight: 900; }
.space-inline-form, .space-market-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; gap: 10px; }

.work-inline-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.work-inline-form input {
  width: 100%;
}
.space-price { color: #ffd78c !important; font-weight: 800; }
.space-cargo-actions { display: grid; gap: 8px; margin-top: 12px; }
.colony-world-orbits { display: flex; align-items: center; gap: 7px; padding: 2px 4px; }
.colony-orbit { position: relative; width: 38px; height: 38px; padding: 0; border: 1px solid rgba(121, 207, 255, .45); border-radius: 50%; background: #13243d; color: #f5fbff; cursor: pointer; box-shadow: 0 0 14px rgba(69, 170, 255, .2); }
.colony-orbit span, .federation-world-sphere { background: radial-gradient(circle at 33% 28%, #aaf0c3 0 12%, #368c6b 35%, #183a4b 72%); }
.colony-orbit span { position: absolute; inset: 4px; border-radius: 50%; }
.colony-orbit b { position: absolute; right: -5px; bottom: -4px; min-width: 18px; padding: 1px 4px; border-radius: 9px; background: #07111f; border: 1px solid #4db0df; font-size: 10px; z-index: 1; }
.biome-desert span, .biome-desert.federation-world-sphere { background: radial-gradient(circle at 33% 28%, #ffe4a3, #b86f32 48%, #4e2b25 78%); }
.biome-ocean span, .biome-ocean.federation-world-sphere { background: radial-gradient(circle at 33% 28%, #b5f5ff, #2176b5 45%, #102e65 78%); }
.biome-ice span, .biome-ice.federation-world-sphere { background: radial-gradient(circle at 33% 28%, #fff, #a8dce8 45%, #426b8f 78%); }
.biome-jungle span, .biome-jungle.federation-world-sphere { background: radial-gradient(circle at 33% 28%, #d7ff9c, #3f8d3c 42%, #153f34 78%); }
.biome-volcanic span, .biome-volcanic.federation-world-sphere { background: radial-gradient(circle at 33% 28%, #ffd076, #c74626 38%, #2c2027 72%); }
.federation-world-grid { display: grid; gap: 12px; margin-top: 14px; }
.federation-world-card { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 14px; padding: 14px; border: 1px solid rgba(111, 190, 226, .24); border-radius: 15px; background: rgba(8, 22, 39, .72); }
.federation-world-card h4 { margin: 3px 0 5px; font-size: 18px; }
.federation-world-card p { margin: 0 0 10px; color: var(--muted-text, #9fb0c4); }
.federation-world-sphere { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: end center; padding-bottom: 8px; box-shadow: inset -12px -9px 18px rgba(0,0,0,.4), 0 0 19px rgba(70,170,220,.18); }
.federation-world-sphere b { padding: 2px 6px; border-radius: 9px; background: rgba(5,14,25,.82); font-size: 11px; }
.world-production-line { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.federation-mini-hexes { display: flex; flex-wrap: wrap; gap: 2px; max-width: 310px; margin: 4px 0 10px; }
.federation-mini-hexes i { width: 20px; height: 23px; clip-path: polygon(25% 0,75% 0,100% 50%,75% 100%,25% 100%,0 50%); background: #29485a; }
.federation-mini-hexes i.has-resource { background: linear-gradient(145deg, #7dd8a8, #2d8876); box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
.federation-mini-hexes em { align-self: center; margin-left: 5px; color: #8dcde8; font-size: 12px; font-style: normal; }
.world-production-line span { padding: 4px 8px; border-radius: 9px; background: rgba(72, 135, 169, .14); font-size: 12px; }
.federation-world-actions { display: grid; grid-template-columns: minmax(210px, .8fr) 1.2fr; gap: 9px; }
.federation-world-actions form { display: flex; gap: 7px; align-items: end; }
.federation-world-actions label { flex: 1; }
.federation-logistics { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; align-items: center; padding: 12px; border-radius: 12px; }
.federation-logistics strong { color: #8ce7b7; }
.federation-logistics.is-offline strong { color: #ff9b8e; }
.federation-logistics span { color: #a8b9ca; font-size: 13px; }
.federation-logistics form { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 7px; }
.federation-logistics input { width: 76px; }
.federation-directory, .federation-member-list, .federation-requests { display: grid; gap: 8px; }
.federation-directory article, .federation-member-row, .federation-requests article { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid rgba(111,190,226,.2); border-radius: 11px; background: rgba(8,22,39,.55); }
.federation-directory article div, .federation-member-row div { display: grid; gap: 3px; }
.federation-directory span, .federation-member-row span { color: #9db0c3; font-size: 12px; }
.federation-colony-access { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.federation-colony-access label { display: flex; align-items: center; gap: 5px; color: #b8c7d7; font-size: 12px; }
.federation-colony-access input[type="number"] { width: 76px; }
.federation-rank-stats { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 9px; }
.federation-rank-stats article { display: grid; gap: 4px; padding: 11px; border-radius: 12px; background: linear-gradient(145deg, rgba(44,91,119,.25), rgba(12,29,47,.65)); }
.federation-rank-stats span { color: #9bb1c5; font-size: 12px; }
.federation-rank-stats strong { font-size: 17px; color: #9ee9c2; }
.federation-rank-progress { padding: 9px 11px; border-left: 3px solid #5ecda0; background: rgba(64,156,119,.08); }
.federation-common-storage { display: flex; align-items: center; gap: 12px; margin: 12px 0; padding: 12px; border: 1px solid rgba(202,169,78,.35); border-radius: 12px; background: rgba(154,116,31,.1); }
.federation-common-storage span { flex: 1; color: #c9b986; }
.federation-member-list h4, .federation-requests h4 { margin: 14px 0 3px; }
@media (max-width: 780px) {
  .federation-world-card { grid-template-columns: 1fr; }
  .federation-world-actions, .federation-logistics { grid-template-columns: 1fr; }
  .federation-logistics form { grid-column: 1; grid-row: auto; }
  .federation-rank-stats { grid-template-columns: repeat(2, 1fr); }
  .federation-directory article, .federation-member-row, .federation-common-storage { align-items: stretch; flex-direction: column; }
}
.space-cargo-actions form { display: grid; grid-template-columns: 1fr 110px minmax(190px, auto); gap: 9px; align-items: center; }
.galactic-market-tabs { display: grid; grid-template-columns: repeat(7, minmax(120px, 1fr)); gap: 7px; margin-bottom: 14px; padding: 6px; overflow-x: auto; border: 1px solid rgba(101, 204, 255, .2); border-radius: 14px; background: rgba(2, 10, 25, .72); }
.galactic-market-tabs button { min-height: 42px; padding: 8px 12px; border: 1px solid transparent; border-radius: 10px; color: #9cadca; background: transparent; font: inherit; font-weight: 700; white-space: nowrap; cursor: pointer; }
.galactic-market-tabs button.is-active { border-color: rgba(83, 207, 255, .55); color: #f1f8ff; background: linear-gradient(135deg, rgba(44, 177, 219, .35), rgba(75, 74, 177, .35)); }
.space-storage-projection { margin: 12px 0 0; color: #73e2ba; }
.space-storage-projection.is-overflow { color: #ff7d87; }
.space-trip-list { display: grid; gap: 12px; }
.space-trip-card { display: grid; grid-template-columns: minmax(180px, .8fr) minmax(240px, 1.5fr) minmax(260px, 1fr) auto; gap: 14px; align-items: center; padding: 14px; border: 1px solid rgba(101, 201, 255, .2); border-radius: 14px; background: rgba(5, 16, 37, .76); }
.space-trip-card > div:first-child { display: grid; gap: 5px; }
.space-trip-card span, .space-trip-card small, .space-trip-card time { color: #9cadca; }
.space-shuttle-route { --trip-progress: 0; position: relative; height: 8px; border-radius: 99px; background: linear-gradient(90deg, rgba(69, 211, 255, .65), rgba(128, 99, 255, .35)); box-shadow: inset 0 0 0 1px rgba(101, 204, 255, .18); }
.space-shuttle-route::after { content: ""; position: absolute; inset: 2px; width: calc(var(--trip-progress) * 100%); border-radius: inherit; background: #66f0c6; opacity: .65; }
.space-shuttle-route i { position: absolute; z-index: 1; top: 50%; left: calc(var(--trip-progress) * (100% - 26px)); width: 26px; transform: translateY(-50%); filter: drop-shadow(0 0 7px rgba(100, 225, 255, .9)); font-style: normal; transition: left 1s linear; }

.capital-ship-panel { background: radial-gradient(circle at 78% 0, rgba(102, 81, 220, .18), transparent 38%), rgba(9, 18, 39, .86); }
.space-card-collection { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 300px)); justify-content: start; gap: 14px; align-items: start; }
.space-card-choice { display: grid; gap: 9px; min-width: 0; }
.space-card-choice.is-used { opacity: .46; filter: grayscale(.5); }
.space-card-choice > p, .space-card-choice > small { margin: 0; color: #91a5c8; font-size: .78rem; line-height: 1.4; }
.space-card-choice > form { display: grid; grid-template-columns: minmax(80px, 1fr) minmax(100px, auto); gap: 7px; align-items: end; }
.space-card-choice > form label { color: #91a5c8; font-size: .72rem; }
.space-battle-card { position: relative; overflow: hidden; display: grid; gap: 8px; padding: 10px; border: 1px solid rgba(102, 211, 255, .34); border-radius: 16px; background: linear-gradient(155deg, rgba(20, 40, 78, .96), rgba(5, 12, 29, .98)); box-shadow: inset 0 0 28px rgba(83, 190, 255, .05), 0 9px 25px rgba(0, 0, 0, .25); }
.space-battle-card.has-shield { border-color: rgba(125, 240, 255, .9); box-shadow: inset 0 0 25px rgba(79, 218, 255, .2), 0 0 18px rgba(79, 218, 255, .18); }
.space-battle-card header { display: flex; justify-content: space-between; gap: 8px; min-width: 0; }
.space-battle-card header strong { overflow: hidden; color: #f4f8ff; text-overflow: ellipsis; white-space: nowrap; }
.space-battle-card header span { color: #76dcff; font-size: .68rem; text-transform: uppercase; }
.space-battle-card-art { position: relative; isolation: isolate; overflow: hidden; height: 170px; min-height: 0; border-radius: 12px; background: radial-gradient(circle, rgba(84, 132, 215, .26), rgba(3, 9, 23, .9)); }
.space-card-art-backdrop { position: absolute; z-index: 0; inset: -12px; width: calc(100% + 24px); height: calc(100% + 24px); object-fit: cover; filter: blur(13px) saturate(.8); opacity: .48; }
.space-card-art-image { position: relative; z-index: 1; display: block; width: 100%; height: 100%; object-fit: contain; object-position: center; }
.space-card-placeholder { width: 100%; height: 100%; display: grid; place-items: center; border-radius: 12px; color: #7de4ff; font-size: 44px; }
.card-attack, .card-armor { position: absolute; z-index: 2; bottom: 7px; display: grid; place-items: center; min-width: 42px; height: 34px; padding: 0 7px; border: 1px solid rgba(255, 255, 255, .3); border-radius: 999px; color: #fff; font-size: .82rem; box-shadow: 0 4px 13px rgba(0, 0, 0, .5); }
.card-attack { left: 7px; background: linear-gradient(135deg, #a62e3d, #e35b3c); }
.card-armor { right: 7px; background: linear-gradient(135deg, #185b8c, #3797be); }
.card-shield { position: absolute; z-index: 2; top: 7px; left: 50%; transform: translateX(-50%); padding: 4px 8px; border-radius: 99px; color: #c9fbff; background: rgba(10, 78, 108, .86); font-size: .66rem; font-style: normal; white-space: nowrap; }
.space-card-cost { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.space-card-cost span { padding: 5px; border-radius: 8px; text-align: center; color: #d4e4ff; background: rgba(2, 10, 25, .72); font-size: .7rem; }
.space-battle-card footer { display: grid; gap: 2px; padding-top: 7px; border-top: 1px solid rgba(109, 206, 255, .16); }
.space-battle-card footer strong { color: #9bf0ff; font-size: .74rem; }
.space-battle-card footer small { color: #a5b3cd; font-size: .68rem; }
.space-battle-card footer em { color: #ff9a9f; font-size: .66rem; font-style: normal; }
.space-battle-card.is-compact { padding: 6px; border-radius: 11px; }
.space-battle-card.is-compact header strong { font-size: .72rem; }
.space-battle-card.is-compact header span { display: none; }
.space-battle-card.is-compact .space-battle-card-art { height: 84px; min-height: 84px; }
.space-battle-card.is-compact .space-card-placeholder { font-size: 28px; }
.space-battle-card.is-compact footer { display: none; }
.space-battle-board { display: grid; grid-template-columns: repeat(5, minmax(155px, 1fr)); gap: 10px; overflow-x: auto; padding: 3px 2px 10px; }
.space-battle-lane { display: grid; grid-template-rows: auto minmax(105px, auto) auto minmax(105px, auto); gap: 6px; min-width: 155px; padding: 8px; border: 1px solid rgba(108, 207, 255, .18); border-radius: 14px; background: linear-gradient(180deg, rgba(90, 41, 81, .17), rgba(6, 17, 38, .68) 48%, rgba(31, 83, 113, .17)); }
.lane-number, .lane-clash { color: #8095b8; font-size: .65rem; font-weight: 800; text-align: center; text-transform: uppercase; letter-spacing: .08em; }
.lane-side { min-height: 105px; }
.empty-lane { height: 100%; min-height: 105px; display: grid; place-items: center; border: 1px dashed rgba(119, 203, 255, .18); border-radius: 11px; color: #667b9e; font-size: .72rem; }
.battle-ship-status { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; margin-bottom: 14px; }
.battle-ship-status > div { display: grid; gap: 4px; padding: 10px 12px; border-radius: 12px; background: rgba(4, 13, 31, .72); }
.battle-ship-status > div:nth-child(2) { text-align: center; color: #9feeff; }
.battle-ship-status > div:last-child { text-align: right; }
.battle-ship-status span { color: #92a6c8; font-size: .72rem; }
.battle-ship-status strong { color: #f2f8ff; }
.battle-skill-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 8px; }
.battle-skill-form { display: grid; grid-template-columns: 1fr minmax(90px, .5fr) auto; gap: 8px; align-items: end; padding: 9px; border: 1px solid rgba(109, 206, 255, .17); border-radius: 11px; background: rgba(5, 15, 34, .68); }
.battle-skill-form label { color: #91a5c8; font-size: .7rem; }
.space-battle-log { max-height: 220px; overflow-y: auto; display: grid; gap: 5px; margin: 0; padding-left: 22px; }
.space-battle-log li { padding: 6px 9px; color: #bdc9dd; background: rgba(5, 14, 31, .58); border-radius: 8px; font-size: .78rem; }
.space-battle-log li span { margin-right: 8px; color: #6edfff; }
.battle-result { padding: 12px; border-radius: 12px; font-weight: 800; }
.battle-result.is-victory { color: #83efbe; background: rgba(35, 143, 96, .16); }
.battle-result.is-defeat { color: #ff969f; background: rgba(174, 48, 61, .16); }

@media (max-width: 850px) {
  .expedition-target-card, .expedition-open-card { grid-template-columns: 1fr; }
  .expedition-target-card > img { max-height: 220px; }
  .expedition-board { gap: 2px; padding: 5px; }
  .expedition-cell { border-radius: 4px; font-size: .72rem; }
  .expedition-resource-row { grid-template-columns: 1fr; }
  .expedition-resource-remove { width: 100%; }
  .expedition-option-row { grid-template-columns: 1fr; }
  .expedition-option-row .expedition-correct-choice { padding-top: 0; }
  .expedition-option-remove { width: 100%; }
  .expedition-generator-bar { align-items: stretch; flex-direction: column; }
  .space-hero-grid { grid-template-columns: repeat(2, 1fr); }
  .space-tabs { grid-template-columns: 1fr; }
  .space-mission-list article { grid-template-columns: 1fr; }
  .space-cargo-actions form { grid-template-columns: 1fr; }
  .space-trip-card { grid-template-columns: 1fr; }
  .battle-ship-status, .battle-skill-form { grid-template-columns: 1fr; }
  .battle-ship-status > div, .battle-ship-status > div:last-child { text-align: left; }
  .admin-player-toolbar, .admin-space-grant-form, .admin-progression-form { grid-template-columns: 1fr; }
  .admin-grant-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.account-artifact-strip { margin-top: 18px; padding-top: 16px; border-top: 1px solid rgba(99, 210, 255, .18); }
.account-artifact-list, .artifact-market-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.account-artifact-card, .artifact-market-card, .admin-artifact-card { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: start; padding: 12px; border: 1px solid rgba(114, 196, 255, .22); border-radius: 14px; background: rgba(5, 14, 30, .58); }
.account-artifact-card img, .artifact-market-card img, .admin-artifact-card img, .artifact-placeholder { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; }
.artifact-placeholder { display: grid; place-items: center; color: #e2b76e; background: radial-gradient(circle, rgba(226, 183, 110, .24), rgba(15, 25, 48, .85)); border: 1px solid rgba(226, 183, 110, .34); font-size: 28px; }
.account-artifact-card p, .artifact-market-card p { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: .82rem; }
.account-artifact-card small, .admin-artifact-card span, .admin-artifact-card small, .artifact-market-card span, .artifact-market-card small { display: block; margin-top: 4px; color: var(--muted); }
.artifact-list-form { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(100px, 1fr) auto; gap: 8px; }
.artifact-market-badge { grid-column: 1 / -1; color: #e2b76e; font-size: .82rem; }
.artifact-market-card { grid-template-columns: 72px 1fr; }
.artifact-market-card form, .artifact-market-card p { grid-column: 1 / -1; }
.admin-artifact-panel { grid-column: 1 / -1; }
.admin-artifact-panel form { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 12px; }
.admin-artifact-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; margin-top: 18px; }
#admin-path-card-list { grid-template-columns: repeat(auto-fill, minmax(270px, 320px)); justify-content: start; align-items: start; }
#admin-path-card-list .space-card-choice { width: 100%; }
.admin-artifact-card > button { grid-column: 1 / -1; }
.admin-gift-catalog-panel { grid-column: 1 / -1; }
.admin-gift-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; margin-top: 18px; }
.admin-gift-card { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 10px; padding: 12px; border: 1px solid rgba(183, 122, 255, .25); border-radius: 14px; background: rgba(24, 10, 42, .34); }
.admin-gift-card.is-inactive { opacity: .58; }
.admin-gift-card img { width: 72px; height: 72px; object-fit: contain; border-radius: 12px; }
.admin-gift-card span, .admin-gift-card small { display: block; margin-top: 4px; color: var(--muted); }
.admin-gift-card > button { grid-column: 1 / -1; }

@media (max-width: 760px) {
  .admin-artifact-panel form { grid-template-columns: 1fr; }
  .account-artifact-list, .artifact-market-grid { grid-template-columns: 1fr; }
  .admin-tabs { grid-template-columns: 1fr; }
  .mail-gift-compose, .public-profile-collection-grid { grid-template-columns: 1fr; }
  .space-card-collection, #admin-path-card-list { grid-template-columns: minmax(0, 1fr); }
}

/* Era of Wars landing screen */
#auth-screen.hero-screen {
  position: relative;
  isolation: isolate;
  min-height: calc(100vh - 56px);
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.65fr);
  gap: clamp(36px, 7vw, 132px);
  padding: clamp(22px, 4vw, 68px) clamp(8px, 2vw, 34px);
  overflow: hidden;
}

#auth-screen.hero-screen::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 4% 25% 2% -16%;
  background:
    linear-gradient(90deg, transparent 49.8%, rgba(106, 222, 255, .06) 50%, transparent 50.2%),
    linear-gradient(0deg, transparent 49.8%, rgba(106, 222, 255, .045) 50%, transparent 50.2%);
  background-size: 88px 88px;
  opacity: .5;
  mask-image: radial-gradient(circle at 45% 48%, black, transparent 72%);
  transform: perspective(520px) rotateX(62deg) translateY(42%);
}

.space-backdrop::after {
  content: "";
  position: absolute;
  inset: -20%;
  background-image:
    radial-gradient(circle, rgba(136, 230, 255, .9) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(255, 207, 129, .7) 0 1px, transparent 1.5px);
  background-position: 12px 8px, 120px 88px;
  background-size: 180px 180px, 260px 260px;
  opacity: .16;
  animation: war-star-pulse 7s ease-in-out infinite alternate;
}

#auth-screen .hero-copy {
  position: relative;
  z-index: 2;
  max-width: 850px;
  padding: 18px 0;
}

.war-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  color: rgba(225, 238, 255, .72);
  font: 700 11px/1 "Orbitron", sans-serif;
  letter-spacing: .25em;
  text-transform: uppercase;
}

.war-brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid rgba(111, 226, 255, .58);
  border-radius: 50%;
  color: #a8f1ff;
  box-shadow: inset 0 0 14px rgba(65, 204, 255, .18), 0 0 18px rgba(65, 204, 255, .12);
}

#auth-screen .eyebrow {
  color: #6ee7ff;
  font-weight: 700;
}

#auth-screen h1 {
  max-width: none;
  margin-top: 4px;
  font-size: clamp(70px, 8.3vw, 152px);
  line-height: .78;
  letter-spacing: -.065em;
  text-transform: uppercase;
  text-shadow: 0 12px 60px rgba(37, 110, 188, .16);
}

#auth-screen h1 > span {
  display: block;
}

#auth-screen .war-title-accent {
  width: max-content;
  margin-top: .16em;
  color: transparent;
  background: linear-gradient(112deg, #fff4d0 4%, #e8ae57 42%, #ff7048 96%);
  background-clip: text;
  -webkit-background-clip: text;
  filter: drop-shadow(0 0 28px rgba(242, 147, 66, .2));
}

.hero-lead {
  max-width: 720px;
  margin: 34px 0 0;
  color: #f2f7ff;
  font-family: "Orbitron", sans-serif;
  font-size: clamp(15px, 1.25vw, 21px);
  line-height: 1.55;
  letter-spacing: .025em;
}

#auth-screen .hero-text {
  max-width: 690px;
  margin-top: 14px;
  color: #8999b8;
  font-size: 15px;
}

.era-route {
  position: relative;
  display: flex;
  width: min(650px, 100%);
  gap: 0;
  margin-top: 28px;
  border-top: 1px solid rgba(111, 204, 255, .18);
}

.era-route span {
  position: relative;
  flex: 1;
  padding: 15px 10px 0 0;
  color: #697997;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.era-route span::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #263857;
  box-shadow: 0 0 0 4px #070c17;
}

.era-route span.is-active {
  color: #c8efff;
}

.era-route span.is-active::before {
  background: #72e9ff;
  box-shadow: 0 0 0 4px #070c17, 0 0 18px #58ddff;
  animation: war-beacon 2.4s ease-in-out infinite;
}

.era-route b {
  margin-right: 5px;
  color: #e4ad5e;
  font-family: "Orbitron", sans-serif;
}

#auth-screen .hero-points {
  width: min(720px, 100%);
  margin-top: 26px;
  gap: 10px;
}

#auth-screen .stat-card {
  position: relative;
  min-height: 100px;
  padding: 18px;
  overflow: hidden;
  border-radius: 3px;
  border-color: rgba(92, 177, 222, .16);
  background: linear-gradient(135deg, rgba(14, 30, 55, .7), rgba(5, 10, 21, .78));
  box-shadow: none;
  transition: transform .25s ease, border-color .25s ease, background .25s ease;
}

#auth-screen .stat-card::after {
  content: "";
  position: absolute;
  right: -24px;
  bottom: -34px;
  width: 80px;
  height: 80px;
  border: 1px solid rgba(105, 215, 255, .1);
  transform: rotate(45deg);
}

#auth-screen .stat-card:hover {
  transform: translateY(-4px);
  border-color: rgba(103, 220, 255, .42);
  background: linear-gradient(135deg, rgba(20, 46, 80, .82), rgba(6, 13, 27, .86));
}

#auth-screen .stat-card strong {
  position: relative;
  z-index: 1;
  display: block;
  font-size: 14px;
  line-height: 1.45;
}

#auth-screen .auth-panel {
  position: relative;
  z-index: 3;
  width: min(455px, 100%);
  padding: clamp(24px, 2.2vw, 38px);
  overflow: hidden;
  border-radius: 4px 26px 4px 26px;
  border-color: rgba(103, 211, 255, .28);
  background:
    linear-gradient(90deg, rgba(100, 221, 255, .9), transparent 32%) top left / 100% 1px no-repeat,
    radial-gradient(circle at 0 0, rgba(44, 133, 189, .19), transparent 38%),
    linear-gradient(150deg, rgba(13, 29, 52, .96), rgba(4, 10, 22, .96));
  box-shadow: 0 34px 100px rgba(0, 0, 0, .54), inset 0 0 60px rgba(64, 161, 221, .035);
  animation: war-panel-enter .8s cubic-bezier(.2, .8, .2, 1) both;
}

#auth-screen .auth-panel::before,
#auth-screen .auth-panel::after {
  content: "";
  position: absolute;
  width: 46px;
  height: 46px;
  pointer-events: none;
}

#auth-screen .auth-panel::before {
  top: 9px;
  right: 9px;
  border-top: 1px solid rgba(232, 174, 87, .7);
  border-right: 1px solid rgba(232, 174, 87, .7);
}

#auth-screen .auth-panel::after {
  bottom: 9px;
  left: 9px;
  border-bottom: 1px solid rgba(105, 224, 255, .5);
  border-left: 1px solid rgba(105, 224, 255, .5);
}

.auth-panel-status {
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  margin: 0 0 28px auto;
  color: #7d8ba8;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.auth-panel-status span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7fffc1;
  box-shadow: 0 0 12px #5fffb3;
  animation: war-beacon 2s ease-in-out infinite;
}

#auth-screen .auth-panel h2 {
  max-width: 340px;
  font-size: clamp(25px, 2vw, 34px);
  line-height: 1.18;
}

#auth-screen .auth-panel .primary-button {
  position: relative;
  border-color: rgba(118, 235, 255, .62);
  border-radius: 3px 14px 3px 14px;
  color: #eafcff;
  background: linear-gradient(110deg, rgba(20, 105, 139, .9), rgba(17, 54, 91, .9));
  box-shadow: 0 15px 38px rgba(31, 157, 202, .17), inset 0 0 20px rgba(113, 231, 255, .08);
}

#auth-screen .auth-panel .primary-button:hover {
  box-shadow: 0 18px 45px rgba(31, 181, 226, .26), inset 0 0 30px rgba(113, 231, 255, .12);
}

#auth-screen .auth-panel .secondary-button {
  border-radius: 3px 14px 3px 14px;
  border-color: rgba(232, 174, 87, .58);
  color: #ffe8be;
  background: linear-gradient(110deg, rgba(104, 65, 33, .48), rgba(42, 31, 32, .82));
}

#auth-screen .auth-panel input {
  border-radius: 3px 12px 3px 12px;
  background: rgba(2, 8, 18, .8);
}

.war-orbit-scene {
  position: absolute;
  z-index: 0;
  top: 50%;
  left: 64%;
  width: clamp(380px, 39vw, 720px);
  aspect-ratio: 1;
  opacity: .8;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.war-planet {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 31%;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 50%;
  background:
    radial-gradient(circle at 67% 24%, rgba(255, 211, 130, .6), transparent 9%),
    radial-gradient(ellipse at 28% 62%, rgba(38, 137, 150, .8), transparent 32%),
    radial-gradient(ellipse at 73% 66%, rgba(112, 68, 57, .7), transparent 27%),
    linear-gradient(145deg, #5fb8be, #243c67 47%, #15162a 72%);
  box-shadow:
    inset -34px -25px 42px rgba(0, 0, 0, .76),
    inset 14px 10px 24px rgba(157, 239, 255, .22),
    -14px -7px 48px rgba(93, 213, 255, .22),
    16px 13px 50px rgba(237, 142, 68, .08);
  transform: translate(-50%, -50%);
  animation: war-planet-float 8s ease-in-out infinite;
}

.war-planet::before {
  content: "";
  position: absolute;
  inset: -15%;
  border: 1px solid rgba(119, 233, 255, .35);
  border-radius: 50%;
  box-shadow: inset 0 0 22px rgba(119, 233, 255, .18);
}

.war-planet span {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-linear-gradient(96deg, transparent 0 18px, rgba(201, 244, 255, .035) 19px 20px);
  animation: war-planet-scan 10s linear infinite;
}

.war-orbit-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  border: 1px solid rgba(105, 214, 255, .18);
  border-radius: 50%;
  transform: translate(-50%, -50%) rotate(-18deg);
}

.war-orbit-ring-a {
  width: 62%;
  height: 31%;
  animation: war-orbit-tilt 14s linear infinite;
}

.war-orbit-ring-b {
  width: 91%;
  height: 49%;
  border-style: dashed;
  border-color: rgba(233, 173, 84, .14);
  animation: war-orbit-tilt 22s linear infinite reverse;
}

.war-orbit-ring i {
  position: absolute;
  top: 48%;
  left: -4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #87ecff;
  box-shadow: 0 0 18px #65dfff, 0 0 36px rgba(101, 223, 255, .7);
}

.war-orbit-ring-b i {
  top: 16%;
  left: 78%;
  background: #ffc56c;
  box-shadow: 0 0 18px #ff9d4a;
}

.war-signal {
  position: absolute;
  width: 130px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(128, 231, 255, .9), transparent);
  filter: drop-shadow(0 0 6px #64dfff);
  opacity: 0;
}

.war-signal-a {
  top: 25%;
  left: 4%;
  transform: rotate(-14deg);
  animation: war-signal-flight 5.8s 1.2s ease-in-out infinite;
}

.war-signal-b {
  right: 1%;
  bottom: 27%;
  transform: rotate(164deg);
  animation: war-signal-flight 7.2s 3.6s ease-in-out infinite;
}

@keyframes war-star-pulse {
  from { opacity: .1; transform: translate3d(0, 0, 0); }
  to { opacity: .25; transform: translate3d(-18px, 12px, 0); }
}

@keyframes war-beacon {
  0%, 100% { opacity: .48; transform: scale(.82); }
  50% { opacity: 1; transform: scale(1.16); }
}

@keyframes war-panel-enter {
  from { opacity: 0; transform: translateX(26px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes war-planet-float {
  0%, 100% { transform: translate(-50%, -50%) rotate(-3deg) scale(1); }
  50% { transform: translate(-50%, calc(-50% - 9px)) rotate(2deg) scale(1.025); }
}

@keyframes war-planet-scan {
  to { transform: translateX(36px); }
}

@keyframes war-orbit-tilt {
  to { transform: translate(-50%, -50%) rotate(342deg); }
}

@keyframes war-signal-flight {
  0%, 70%, 100% { opacity: 0; transform: translateX(-80px) rotate(-14deg) scaleX(.4); }
  78% { opacity: .85; }
  92% { opacity: 0; transform: translateX(150px) rotate(-14deg) scaleX(1); }
}

@media (max-width: 1180px) {
  #auth-screen.hero-screen {
    grid-template-columns: minmax(0, 1.15fr) minmax(330px, .7fr);
    gap: 34px;
  }

  #auth-screen h1 { font-size: clamp(68px, 10vw, 112px); }
  .war-orbit-scene { left: 59%; opacity: .48; }
  #auth-screen .hero-points { grid-template-columns: 1fr; max-width: 500px; }
  #auth-screen .stat-card { min-height: 0; }
}

@media (max-width: 840px) {
  #auth-screen.hero-screen {
    min-height: auto;
    grid-template-columns: 1fr;
    padding: 46px 14px 70px;
  }

  #auth-screen .hero-copy { max-width: 680px; }
  #auth-screen h1 { font-size: clamp(66px, 20vw, 118px); }
  .war-orbit-scene { top: 26%; left: 78%; width: 520px; opacity: .38; }
  #auth-screen .auth-panel { width: 100%; max-width: 680px; justify-self: start; }
  #auth-screen .hero-points { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: none; }
}

@media (max-width: 580px) {
  #auth-screen h1 { font-size: clamp(61px, 21vw, 92px); }
  .war-brand { letter-spacing: .14em; }
  .hero-lead { margin-top: 26px; }
  .era-route { overflow: hidden; }
  .era-route span { font-size: 9px; }
  #auth-screen .hero-points { grid-template-columns: 1fr; }
  #auth-screen .auth-panel { padding: 24px 18px; }
  .war-orbit-scene { left: 90%; width: 430px; }
}

/* Science-branch atmosphere ------------------------------------------------ */
body[data-branch="theology"] {
  --bg: #100906;
  --bg-soft: rgba(29, 17, 12, 0.9);
  --panel: rgba(32, 19, 14, 0.86);
  --panel-strong: rgba(49, 28, 17, 0.96);
  --border: rgba(255, 194, 104, 0.24);
  --border-strong: rgba(255, 218, 144, 0.5);
  --accent: #ffd28a;
  --accent-strong: #e89a43;
  --shadow: 0 24px 90px rgba(35, 12, 2, 0.64);
}

body[data-branch="heresy"] {
  --bg: #020b11;
  --bg-soft: rgba(4, 19, 27, 0.91);
  --panel: rgba(5, 23, 31, 0.87);
  --panel-strong: rgba(6, 34, 43, 0.96);
  --border: rgba(70, 245, 218, 0.24);
  --border-strong: rgba(98, 255, 221, 0.48);
  --accent: #62ffdd;
  --accent-strong: #40bfff;
  --shadow: 0 24px 90px rgba(0, 14, 23, 0.72);
}

.branch-atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: none;
  overflow: hidden;
  pointer-events: none;
}

body[data-branch="theology"] .theology-atmosphere,
body[data-branch="heresy"] .heresy-atmosphere {
  display: block;
}

body[data-branch="theology"] .space-backdrop { opacity: 0.32; filter: sepia(0.45) saturate(1.15); }
body[data-branch="heresy"] .space-backdrop { opacity: 0.5; filter: hue-rotate(118deg) saturate(1.35); }

body[data-branch="theology"] .panel,
body[data-branch="theology"] .modal-card {
  box-shadow: inset 0 1px rgba(255, 226, 166, 0.08), 0 18px 58px rgba(45, 15, 3, 0.34);
}

body[data-branch="heresy"] .panel,
body[data-branch="heresy"] .modal-card {
  box-shadow: inset 0 0 0 1px rgba(96, 255, 220, 0.035), 0 18px 58px rgba(0, 13, 22, 0.46);
  background-image:
    linear-gradient(90deg, transparent 0 96%, rgba(91, 255, 219, 0.04) 96%),
    linear-gradient(0deg, transparent 0 96%, rgba(91, 255, 219, 0.035) 96%);
  background-size: 22px 22px;
}

.holy-light {
  position: absolute;
  top: -30%;
  left: 14%;
  width: 72vw;
  height: 115vh;
  background: conic-gradient(from 167deg at 50% 0%, transparent 0 43%, rgba(255, 223, 151, 0.13) 47%, transparent 51% 55%, rgba(255, 186, 87, 0.09) 59%, transparent 64%);
  filter: blur(10px);
  transform-origin: 50% 0;
  animation: holy-light-breathe 8s ease-in-out infinite;
}

.organ-pipes {
  position: absolute;
  top: 9%;
  right: 1.5%;
  height: 52vh;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  opacity: 0.24;
  filter: drop-shadow(0 0 16px rgba(255, 177, 69, 0.28));
}

.organ-pipes i {
  width: 13px;
  height: 34%;
  border: 1px solid rgba(255, 211, 137, 0.38);
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(90deg, #3b1f10, #d49b55 48%, #5d3219);
  animation: organ-resonance 5s ease-in-out infinite;
}

.organ-pipes i:nth-child(2) { height: 48%; animation-delay: -.7s; }
.organ-pipes i:nth-child(3) { height: 63%; animation-delay: -1.4s; }
.organ-pipes i:nth-child(4) { height: 78%; animation-delay: -2.1s; }
.organ-pipes i:nth-child(5) { height: 56%; animation-delay: -2.8s; }
.organ-pipes i:nth-child(6) { height: 39%; animation-delay: -3.5s; }

.temple-chain {
  position: absolute;
  top: -4%;
  width: 18px;
  height: 75vh;
  opacity: 0.22;
  background: radial-gradient(ellipse at center, transparent 0 28%, #d0a66c 31% 42%, transparent 45%) center top / 16px 24px repeat-y;
  transform-origin: top center;
  animation: chain-sway 7s ease-in-out infinite;
}

.chain-left { left: 2.4%; }
.chain-right { right: 9%; height: 47vh; animation-delay: -3.5s; }

.candle-row {
  position: absolute;
  right: 1%;
  bottom: 2%;
  display: flex;
  align-items: flex-end;
  gap: 18px;
  opacity: 0.64;
}

.chat-candle-shelf {
  display: none;
  position: absolute;
  z-index: 5;
  left: 0;
  right: auto;
  bottom: 8px;
  width: 100%;
  height: 82px;
  pointer-events: none;
}

.left-sidebar {
  position: relative;
}

body[data-branch="theology"] .chat-candle-shelf {
  display: block;
}

body[data-branch="theology"] .chat-candle-row {
  display: flex;
  top: auto;
  bottom: 0;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  opacity: 0.88;
  filter: drop-shadow(0 0 15px rgba(255, 151, 46, 0.3));
}

.candle-row i {
  position: relative;
  width: 10px;
  height: 42px;
  border-radius: 3px 3px 1px 1px;
  background: linear-gradient(90deg, #7b4e2a, #ffe0a3 44%, #9d6734);
  box-shadow: 0 0 24px rgba(255, 163, 54, 0.24);
}

.candle-row i:nth-child(2n) { height: 63px; }
.candle-row i:nth-child(3n) { height: 31px; }
.candle-row i::before {
  content: "";
  position: absolute;
  left: 1px;
  top: -17px;
  width: 8px;
  height: 17px;
  border-radius: 70% 30% 65% 35%;
  background: radial-gradient(circle at 50% 70%, #fffbd1 0 18%, #ffc45c 38%, #ff742e 66%, transparent 70%);
  filter: drop-shadow(0 0 8px #ff9f35);
  transform-origin: 50% 100%;
  animation: candle-flicker 1.45s ease-in-out infinite alternate;
}

.candle-row i:nth-child(2n)::before { animation-delay: -.55s; }
.candle-row i:nth-child(3n)::before { animation-delay: -1.05s; }

.circuit-grid {
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background:
    radial-gradient(circle, rgba(82, 255, 218, 0.9) 0 1px, transparent 2px) 0 0 / 54px 54px,
    linear-gradient(90deg, transparent 49%, rgba(64, 223, 211, 0.3) 50%, transparent 51%) 0 0 / 108px 54px,
    linear-gradient(0deg, transparent 49%, rgba(38, 173, 255, 0.25) 50%, transparent 51%) 0 0 / 54px 108px;
  mask-image: radial-gradient(circle at center, #000, transparent 82%);
  animation: circuit-drift 18s linear infinite;
}

.matrix-stream {
  position: absolute;
  top: -45%;
  width: 18px;
  color: rgba(92, 255, 203, 0.54);
  font: 12px/1.28 "Orbitron", monospace;
  letter-spacing: 0.2em;
  overflow-wrap: anywhere;
  text-shadow: 0 0 8px rgba(73, 255, 198, 0.9);
  opacity: 0.52;
  animation: matrix-fall 12s linear infinite;
}

.stream-a { left: 2%; }
.stream-b { left: 9%; animation-duration: 17s; animation-delay: -9s; }
.stream-c { right: 3%; animation-duration: 14s; animation-delay: -5s; }

.robot-core {
  position: absolute;
  right: 2%;
  bottom: 4%;
  width: 96px;
  height: 78px;
  border: 1px solid rgba(95, 255, 222, 0.44);
  clip-path: polygon(18% 0, 82% 0, 100% 28%, 90% 100%, 10% 100%, 0 28%);
  background: linear-gradient(145deg, rgba(19, 72, 84, 0.72), rgba(2, 18, 26, 0.82));
  box-shadow: inset 0 0 28px rgba(47, 238, 255, 0.16), 0 0 26px rgba(50, 255, 210, 0.14);
  opacity: 0.48;
  animation: robot-hover 4s ease-in-out infinite;
}

.robot-core i {
  position: absolute;
  top: 25px;
  width: 18px;
  height: 7px;
  border-radius: 7px;
  background: #76ffe0;
  box-shadow: 0 0 13px #33ffc8;
  animation: robot-scan 2.6s steps(2, end) infinite;
}

.robot-core i:first-child { left: 20px; }
.robot-core i:nth-child(2) { right: 20px; }
.robot-core span { position: absolute; left: 0; right: 0; bottom: 12px; text-align: center; color: rgba(100, 255, 225, 0.7); font: 10px "Orbitron", monospace; letter-spacing: .25em; }

body[data-branch="theology"] .theology-operation {
  border-color: rgba(255, 195, 105, 0.52);
  background: linear-gradient(100deg, rgba(110, 52, 14, 0.52), rgba(255, 185, 78, 0.12));
  box-shadow: inset 0 0 24px rgba(255, 178, 66, 0.08), 0 0 22px rgba(255, 151, 43, 0.08);
}

body[data-branch="heresy"] button:not(.danger-button):not(:disabled):hover {
  box-shadow: 0 0 0 1px rgba(88, 255, 218, 0.22), 0 0 24px rgba(38, 242, 224, 0.13);
}

@keyframes holy-light-breathe { 0%, 100% { opacity: .55; transform: rotate(-1deg) scaleX(.96); } 50% { opacity: .92; transform: rotate(1deg) scaleX(1.04); } }
@keyframes organ-resonance { 0%, 100% { filter: brightness(.72); } 50% { filter: brightness(1.32); } }
@keyframes chain-sway { 0%, 100% { transform: rotate(-1.8deg); } 50% { transform: rotate(2.1deg); } }
@keyframes candle-flicker { 0% { transform: rotate(-5deg) scale(.9, 1.02); opacity: .78; } 100% { transform: rotate(5deg) scale(1.08, .94); opacity: 1; } }
@keyframes circuit-drift { to { background-position: 54px 54px, 108px 54px, 54px 108px; } }
@keyframes matrix-fall { from { transform: translateY(-10vh); } to { transform: translateY(170vh); } }
@keyframes robot-hover { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes robot-scan { 0%, 76%, 100% { opacity: 1; transform: scaleX(1); } 80% { opacity: .2; transform: scaleX(.2); } }

@media (max-width: 800px) {
  .organ-pipes, .robot-core { opacity: .24; transform: scale(.75); transform-origin: right bottom; }
  .chain-right, .stream-b { display: none; }
  .candle-row { gap: 11px; opacity: .42; }
  body[data-branch="theology"] .chat-candle-row {
    opacity: .7;
    transform: scale(.76);
    transform-origin: right bottom;
  }
  .chat-candle-shelf { right: 14px; width: 180px; height: 68px; }
}

@media (max-width: 1360px) {
  body[data-branch="theology"] .chat-candle-row {
    transform: translateX(-50%) scale(.86);
    transform-origin: center bottom;
  }
}

@media (max-width: 1180px) {
  body[data-branch="theology"] .chat-candle-shelf {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .branch-atmosphere *, .branch-atmosphere *::before { animation: none !important; }
}
.ascendant-board {
  display: grid;
  grid-template-columns: repeat(8, minmax(34px, 1fr));
  width: min(100%, 640px);
  margin: 1rem auto;
  border: 1px solid rgba(93, 225, 209, .45);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 0 32px rgba(72, 124, 255, .16);
}

.ascendant-board-cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  position: relative;
  background: rgba(44, 91, 132, .3);
}

.ascendant-board-cell.is-dark { background: rgba(14, 31, 61, .72); }
.ascendant-board-cell strong { font-size: clamp(1rem, 3vw, 2rem); filter: drop-shadow(0 0 8px currentColor); }
.ascendant-board-cell .is-own { color: #64f1db; }
.ascendant-board-cell .is-enemy { color: #ff6d91; }
.ascendant-board-cell small { position: absolute; right: 4px; bottom: 2px; color: #fff; font-size: .65rem; }
