: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: 100dvh;
  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: 100dvh;
  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;
}

.home-video-preview {
  position: relative;
  display: grid;
  grid-template-columns: 132px 1fr;
  width: min(330px, 100%);
  min-height: 74px;
  margin-top: 20px;
  overflow: hidden;
  border: 1px solid rgba(112, 226, 255, 0.28);
  border-radius: 14px;
  background: rgba(8, 13, 27, 0.9);
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.home-video-preview:hover,
.home-video-preview:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(112, 226, 255, 0.72);
  box-shadow: 0 18px 40px rgba(2, 7, 18, 0.46);
}

.home-video-preview img {
  width: 132px;
  height: 74px;
  object-fit: cover;
}

.home-video-caption {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 10px 14px;
}

.home-video-caption b { font-size: 14px; }
.home-video-caption small { color: var(--muted); }

.home-video-play {
  position: absolute;
  top: 37px;
  left: 66px;
  width: 34px;
  height: 24px;
  border-radius: 7px;
  background: #ff0033;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, -50%);
}

.home-video-play::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 53%;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 10px solid #fff;
  transform: translate(-50%, -50%);
}

.admin-home-video-form { margin-top: 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;
  justify-self: start;
  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 прятал космический блок. */
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(112, 226, 255, 0.35) transparent;
}

.right-sidebar::-webkit-scrollbar {
  width: 6px;
}

.right-sidebar::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(112, 226, 255, 0.35);
}

.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); }
.label-narrow { display: none; }

.galaxy-zoom-controls { position: absolute; z-index: 4; right: 14px; bottom: 14px; display: grid; justify-items: center; gap: 4px; padding: 6px; border: 1px solid rgba(107,205,242,.24); border-radius: 14px; background: rgba(3,10,22,.82); backdrop-filter: blur(12px); }
.galaxy-zoom-button { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid rgba(107,205,242,.22); border-radius: 10px; background: rgba(8,20,38,.7); color: #cfe9f8; font-size: 19px; line-height: 1; cursor: pointer; }
.galaxy-zoom-button:hover { border-color: rgba(151,239,255,.6); background: rgba(104,205,244,.16); color: #eafaff; }
#galaxy-zoom-label { 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(230px, 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(100dvh - 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;
  }
}

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

.left-sidebar .panel {
  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;
}

.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-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;
  pointer-events: none;
}

.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);
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  color: var(--text);
  animation: toast-arrive 180ms ease-out both;
  backdrop-filter: blur(14px);
}

.toast.success {
  border-color: rgba(78, 225, 156, 0.46);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.34), 0 0 24px rgba(78, 225, 156, 0.08);
}

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

.toast-status-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(78, 225, 156, 0.14);
  color: #72efb2;
  font-weight: 900;
}

.toast.error .toast-status-icon {
  background: rgba(255, 123, 123, 0.14);
  color: #ff8e8e;
}

.toast.is-leaving {
  animation: toast-leave 200ms ease-in both;
}

button.is-request-pending,
input[type="submit"].is-request-pending {
  cursor: progress;
  opacity: 0.82;
  outline: 2px solid rgba(112, 226, 255, 0.58);
  outline-offset: 2px;
}

button.is-request-success,
input[type="submit"].is-request-success {
  outline: 2px solid rgba(78, 225, 156, 0.64);
  outline-offset: 2px;
}

button.is-request-error,
input[type="submit"].is-request-error {
  outline: 2px solid rgba(255, 123, 123, 0.68);
  outline-offset: 2px;
}

@keyframes toast-arrive { from { opacity: 0; transform: translateY(12px) scale(0.97); } }
@keyframes toast-leave { to { opacity: 0; transform: translateX(18px) scale(0.98); } }

@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: 1180px) {
  .hero-screen {
    grid-template-columns: 1fr;
  }

  .game-main-layout {
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
  }

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

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

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

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

  .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 {
  padding-top: 18px;
}

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

.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,
.right-sidebar .space-menu-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: 9px 12px;
  border-radius: 13px;
  background: rgba(4, 10, 22, 0.76);
  box-shadow: 0 16px 36px rgba(0, 3, 12, 0.48);
}

.mini-hud .eyebrow { margin-bottom: 2px; font-size: .65rem; }
.mini-hud #galaxy-map-hint { display: -webkit-box; overflow: hidden; font-size: .76rem; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }

.action-panel {
  display: grid;
  gap: 10px;
}

.action-group {
  display: grid;
  gap: 8px;
  align-content: start;
}

/* Группу без единой видимой кнопки скрывает JS, чтобы заголовок не висел пустым. */
.action-group.is-empty {
  display: none;
}

.action-group + .action-group {
  padding-top: 10px;
  border-top: 1px solid rgba(var(--accent-rgb), 0.12);
}

/* Названия групп заменили заголовок панели — он только съедал высоту. */
.action-panel > .panel-header {
  display: none;
}

.action-group-title {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.action-group > button,
.action-group > a {
  /* .space-menu-button не наследует flex от базовых кнопок — задаём явно,
     иначе ромбовидный маркер уезжает на отдельную строку. */
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 44px;
  padding-left: 16px;
}

.action-group > button::before,
.action-group > a::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 {
    display: none;
  }

  .left-sidebar .prayer-panel .muted-text {
    grid-column: 1 / -1;
    margin-top: 2px;
    text-align: center;
  }

  .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(100dvh - 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(100dvh - 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; }
.market-catalog-list { display: grid; gap: 8px; }
.market-search { display: grid; gap: 6px; max-width: 430px; margin-bottom: 14px; color: #9cadca; font-size: .78rem; }
.market-catalog-row { display: grid; grid-template-columns: minmax(170px, 1.5fr) repeat(3, minmax(120px, 1fr)) auto; gap: 14px; align-items: center; width: 100%; padding: 14px 16px; border: 1px solid rgba(101, 201, 255, .2); border-radius: 13px; color: #9cadca; background: rgba(5, 16, 37, .76); font: inherit; text-align: left; cursor: pointer; transition: border-color 160ms ease, background 160ms ease, transform 160ms ease; }
.market-catalog-row:hover { border-color: rgba(101, 218, 255, .55); background: rgba(12, 32, 65, .9); transform: translateY(-1px); }
.market-catalog-row strong { color: #f1f8ff; font-size: 1rem; }
.market-catalog-row b { color: #f0c761; }
.market-catalog-row i { color: #71d9f5; font-style: normal; font-weight: 700; white-space: nowrap; }
.market-browser-head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.market-browser-head h3, .market-browser-head p { margin: 0; }
.market-browser-head span { display: block; margin-top: 5px; color: #9cadca; font-size: .84rem; }
.market-back-button { flex: 0 0 auto; }
.market-load-more { display: flex; justify-content: center; padding-top: 16px; }
.market-loading { min-height: 110px; }
.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-card-reveal { min-height:350px; margin:18px 0; perspective:1400px; }
.expedition-card-turn { position:relative; width:100%; min-height:350px; transform-style:preserve-3d; animation:expedition-card-reveal .82s cubic-bezier(.2,.75,.2,1) both; }
.expedition-card-side { position:absolute; inset:0; overflow:hidden; border:1px solid color-mix(in srgb,var(--surface-accent) 48%,transparent); border-radius:22px; backface-visibility:hidden; box-shadow:0 20px 48px rgba(0,0,0,.34); }
.expedition-card-back { display:grid; place-content:center; gap:5px; color:var(--surface-accent); background:radial-gradient(circle at 50% 45%,color-mix(in srgb,var(--surface-b) 72%,transparent),transparent 29%),repeating-conic-gradient(from 45deg,color-mix(in srgb,var(--surface-a) 88%,#06101d) 0 12deg,color-mix(in srgb,var(--surface-b) 45%,#07101e) 12deg 24deg); text-align:center; }
.expedition-card-back::before,.expedition-card-back::after { content:""; position:absolute; inset:12%; border:1px solid color-mix(in srgb,var(--surface-accent) 32%,transparent); border-radius:18px; }
.expedition-card-back::after { inset:24%; border-radius:50%; transform:rotate(28deg); box-shadow:0 0 35px var(--surface-glow); }
.expedition-card-back b,.expedition-card-back i { position:relative; z-index:2; }
.expedition-card-back b { font-size:1.25rem; letter-spacing:.08em; text-transform:uppercase; }
.expedition-card-back i { color:#d5e3ed; font-style:normal; letter-spacing:.2em; text-transform:uppercase; }
.card-back-orbit { position:absolute; z-index:2; top:50%; left:50%; width:90px; height:90px; border:2px solid var(--surface-accent); border-radius:50%; transform:translate(-50%,-50%); box-shadow:0 0 24px var(--surface-glow),inset 0 0 18px var(--surface-glow); }
.expedition-card-front { display:grid; grid-template-columns:minmax(190px,34%) 1fr; gap:0; transform:rotateY(180deg); background:linear-gradient(140deg,color-mix(in srgb,var(--surface-a) 38%,#071326),#07101e 62%); }
.expedition-card-art { position:relative; min-height:350px; overflow:hidden; background:radial-gradient(circle,var(--surface-b),var(--surface-a)); }
.expedition-card-art::after { content:""; position:absolute; inset:0; box-shadow:inset -25px 0 40px rgba(1,6,14,.42); pointer-events:none; }
.expedition-card-art img,.expedition-card-art .expedition-card-symbol { width:100%; height:100%; min-height:350px; border-radius:0; object-fit:cover; }
.expedition-card-art > span { position:absolute; z-index:2; right:10px; bottom:10px; left:10px; padding:7px 9px; border:1px solid color-mix(in srgb,var(--surface-accent) 45%,transparent); border-radius:9px; color:#fff; background:rgba(2,9,18,.78); font-size:.75rem; font-weight:800; text-transform:uppercase; }
.expedition-card-copy { overflow:auto; display:grid; align-content:center; gap:8px; max-height:430px; padding:22px; }
.expedition-card-copy > small { color:var(--surface-accent); font-weight:850; letter-spacing:.12em; text-transform:uppercase; }
.expedition-card-copy h3,.expedition-card-copy p { margin:0; }
.expedition-card-copy p { color:#aebbd1; line-height:1.55; }
@keyframes expedition-card-reveal { 0%,18% { transform:rotateY(0deg) scale(.94); } 45% { transform:rotateY(88deg) scale(1.02); } 100% { transform:rotateY(180deg) scale(1); } }
@media (prefers-reduced-motion:reduce) { .expedition-card-turn { animation:none; transform:rotateY(180deg); } .expedition-cell.is-available { animation:none; } }
.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-cargo-note { color: #e7c56e; }
.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-loss-note { color: #ff9da6; }
.theme-terran { --surface-a:#183f35; --surface-b:#526841; --surface-accent:#8bd878; --surface-glow:rgba(96,220,140,.42); }
.theme-desert { --surface-a:#5a321c; --surface-b:#aa6c32; --surface-accent:#ffd073; --surface-glow:rgba(255,173,69,.42); }
.theme-ice { --surface-a:#153d58; --surface-b:#82bdd3; --surface-accent:#d8fbff; --surface-glow:rgba(115,225,255,.48); }
.theme-volcanic { --surface-a:#35151a; --surface-b:#8d2c18; --surface-accent:#ff8a35; --surface-glow:rgba(255,74,32,.5); }
.theme-ocean { --surface-a:#092f55; --surface-b:#087a88; --surface-accent:#70f0e4; --surface-glow:rgba(58,218,224,.45); }
.theme-toxic { --surface-a:#253716; --surface-b:#65752b; --surface-accent:#c8ff57; --surface-glow:rgba(174,255,65,.42); }
.theme-crystal { --surface-a:#302550; --surface-b:#6b4c91; --surface-accent:#e1a9ff; --surface-glow:rgba(196,111,255,.48); }
.theme-ruins { --surface-a:#2e3236; --surface-b:#665e4e; --surface-accent:#dfc692; --surface-glow:rgba(220,188,126,.35); }
.expedition-biome-label { width: fit-content; padding: 4px 8px; border: 1px solid color-mix(in srgb,var(--surface-accent,#75dfff) 45%,transparent); border-radius: 999px; color: var(--surface-accent,#9eeaff); background: color-mix(in srgb,var(--surface-a,#123) 65%,transparent); font-size: .72rem; }
.expedition-board-wrap { width: min(100%,820px); margin: 20px auto 0; }
.expedition-board-caption { display: flex; justify-content: space-between; gap: 12px; padding: 0 5px 8px; color: #9cb0ca; }
.expedition-board-caption span { color: var(--surface-accent); font-weight: 800; }
.expedition-board { position: relative; isolation: isolate; overflow: hidden; display: grid; grid-template-columns: repeat(10,1fr); gap: 5px; padding: 14px; border: 1px solid color-mix(in srgb,var(--surface-accent) 42%,transparent); border-radius: 24px; background: radial-gradient(circle at 18% 14%,color-mix(in srgb,var(--surface-b) 55%,transparent),transparent 32%),radial-gradient(circle at 78% 68%,color-mix(in srgb,var(--surface-a) 70%,#020712),#020712 72%); box-shadow: inset 0 0 60px rgba(0,0,0,.52),0 18px 50px rgba(0,0,0,.26); }
.expedition-surface-source { position: absolute; z-index: -1; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .14; filter: saturate(1.25) contrast(1.15); mix-blend-mode: screen; pointer-events: none; }
.expedition-cell { position: relative; aspect-ratio: 1; display: grid; place-items: center; min-width: 0; overflow: hidden; border: 1px solid color-mix(in srgb,var(--surface-b) 34%,#0a1424); border-radius: 11px; color: #8ca0b9; background: linear-gradient(145deg,color-mix(in srgb,var(--surface-a) 42%,#071221),color-mix(in srgb,var(--surface-b) 22%,#06101e)); box-shadow: inset 0 1px 0 rgba(255,255,255,.035),inset 0 -8px 18px rgba(0,0,0,.25); }
.expedition-cell::before { content:""; position:absolute; inset:0; opacity:.34; pointer-events:none; }
.expedition-cell.terrain-0::before { background:radial-gradient(circle at 28% 32%,var(--surface-b) 0 5%,transparent 7%),radial-gradient(circle at 72% 68%,var(--surface-a) 0 10%,transparent 12%); }
.expedition-cell.terrain-1::before { background:linear-gradient(120deg,transparent 35%,color-mix(in srgb,var(--surface-accent) 28%,transparent) 37% 39%,transparent 41%); }
.expedition-cell.terrain-2::before { background:repeating-radial-gradient(ellipse at 20% 80%,transparent 0 8px,color-mix(in srgb,var(--surface-b) 28%,transparent) 9px 10px); }
.expedition-cell.terrain-3::before { background:linear-gradient(35deg,transparent 47%,color-mix(in srgb,var(--surface-a) 80%,#000) 48% 52%,transparent 53%); }
.expedition-cell.terrain-4::before { background:radial-gradient(ellipse at 60% 25%,color-mix(in srgb,var(--surface-accent) 22%,transparent),transparent 38%); }
.expedition-cell button { position:absolute; inset:0; width:100%; height:100%; padding:0; overflow:hidden; border:0; color:var(--surface-accent); background:transparent; cursor:pointer; font:inherit; }
.expedition-cell-back { position:absolute; inset:5px; display:grid; place-items:center; border:1px solid color-mix(in srgb,var(--surface-accent) 32%,transparent); border-radius:8px; background:linear-gradient(145deg,color-mix(in srgb,var(--surface-a) 74%,#07101f),color-mix(in srgb,var(--surface-b) 48%,#06101e)); box-shadow:inset 0 0 15px rgba(0,0,0,.35); }
.expedition-cell-back::before,.expedition-cell-back::after { content:""; position:absolute; border:1px solid color-mix(in srgb,var(--surface-accent) 35%,transparent); transform:rotate(45deg); }
.expedition-cell-back::before { width:30%; aspect-ratio:1; }
.expedition-cell-back::after { width:12%; aspect-ratio:1; background:var(--surface-accent); box-shadow:0 0 12px var(--surface-glow); }
.expedition-cell.is-available { border-color:var(--surface-accent); box-shadow:0 0 16px var(--surface-glow),inset 0 0 14px color-mix(in srgb,var(--surface-accent) 10%,transparent); animation:expedition-cell-pulse 1.7s ease-in-out infinite; }
.expedition-move-hint { position:absolute; right:4px; bottom:3px; left:4px; padding:2px; border-radius:5px; color:#eefcff; background:rgba(1,8,18,.72); font-size:.55rem; opacity:0; transition:opacity .16s ease; }
.expedition-cell button:hover .expedition-move-hint { opacity:1; }
.expedition-cell.is-revealed { border-color:color-mix(in srgb,var(--surface-accent) 36%,transparent); filter:saturate(.72); }
.expedition-cell-face { position:absolute; inset:3px; overflow:hidden; display:grid; place-items:center; border:1px solid color-mix(in srgb,var(--surface-accent) 55%,transparent); border-radius:8px; background:color-mix(in srgb,var(--surface-a) 55%,#07101c); }
.expedition-cell-face img { width:100%; height:100%; object-fit:cover; }
.expedition-cell-face b { color:var(--surface-accent); font-size:1.35rem; text-shadow:0 0 12px var(--surface-glow); }
.expedition-cell-face i { position:absolute; right:2px; bottom:2px; left:2px; overflow:hidden; padding:2px; color:#fff; background:rgba(2,7,15,.76); font-size:.48rem; font-style:normal; text-align:center; text-overflow:ellipsis; white-space:nowrap; }
.expedition-team-marker,.expedition-board-marker,.expedition-trail-dot { position:absolute; z-index:3; display:grid; place-items:center; }
.expedition-team-marker { width:36%; aspect-ratio:1; border:1px solid #fff; border-radius:50%; color:#fff; background:#127a9c; box-shadow:0 0 16px #65e6ff; font-size:.72rem; }
.expedition-board-marker { inset:18%; border-radius:9px; font-weight:900; }
.expedition-board-marker.is-exit { color:#9fffd0; background:rgba(23,112,77,.56); }
.expedition-board-marker.is-start { color:#ffe092; background:rgba(112,75,22,.48); }
.expedition-trail-dot { color:var(--surface-accent); font-size:1.2rem; }
.expedition-cell.is-current { border-color:#8ceeff; box-shadow:0 0 20px rgba(75,220,255,.55); filter:none; }
.expedition-cell.is-flipped .expedition-cell-face { animation:expedition-mini-flip .55s ease both; }
@keyframes expedition-cell-pulse { 50% { box-shadow:0 0 24px var(--surface-glow),inset 0 0 18px color-mix(in srgb,var(--surface-accent) 18%,transparent); } }
@keyframes expedition-mini-flip { from { transform:rotateY(90deg); opacity:0; } to { transform:rotateY(0); opacity:1; } }
.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; }
#admin-nightmare-cost-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-card-reveal,.expedition-card-turn { min-height:590px; }
  .expedition-card-front { grid-template-columns:1fr; }
  .expedition-card-art,.expedition-card-art img,.expedition-card-art .expedition-card-symbol { min-height:230px; height:230px; }
  .expedition-card-copy { max-height:360px; padding:16px; }
  .expedition-board-caption { align-items:flex-start; flex-direction:column; }
  .expedition-board { gap: 2px; padding: 5px; border-radius:14px; }
  .expedition-cell { border-radius: 5px; font-size: .72rem; }
  .expedition-cell-back { inset:2px; border-radius:4px; }
  .expedition-cell-face { inset:1px; border-radius:4px; }
  .expedition-cell-face i,.expedition-move-hint { display:none; }
  .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-artifact-card > .admin-news-actions { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
.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(100dvh - 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%);
}

#auth-screen .visitor-counter {
  z-index: 2;
  grid-column: 1 / -1;
  justify-self: center;
  display: flex;
  align-items: center;
  gap: clamp(18px, 4vw, 48px);
  padding: 10px 18px;
  border: 1px solid rgba(112, 226, 255, .16);
  border-radius: 999px;
  background: rgba(5, 10, 22, .66);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .24);
  backdrop-filter: blur(14px);
}

#auth-screen .visitor-counter-title {
  color: rgba(225, 238, 255, .56);
  font: 700 10px/1 "Orbitron", sans-serif;
  letter-spacing: .18em;
  text-transform: uppercase;
}

#auth-screen .visitor-counter > span:not(.visitor-counter-title) {
  display: flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
}

#auth-screen .visitor-counter b {
  color: #c5f6ff;
  font: 700 15px/1 "Orbitron", sans-serif;
}

#auth-screen .visitor-counter small {
  color: var(--muted);
  font-size: 11px;
}

.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; }
  #auth-screen .visitor-counter { width: 100%; justify-content: space-between; gap: 8px; border-radius: 18px; }
  #auth-screen .visitor-counter-title { display: none; }
  #auth-screen .visitor-counter > span:not(.visitor-counter-title) { flex-direction: column; align-items: center; gap: 3px; }
}

/* 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; }

/* ============================================================================
   ШАПКА КАРТЫ
   Две осмысленные строки вместо одной переполненной. Раньше орбиты колоний
   стояли последними в первой строке, вплотную к правому сайдбару: их значок
   и свечение выходили в зазор грида, а панель сайдбара (backdrop-filter,
   отдельный контекст наложения) закрашивала их сверху.
   Теперь строка 1 — кто и где, строка 2 — что у колонии.
   ============================================================================ */

.header-badges {
  justify-content: flex-start;
  align-items: center;
  padding-right: 8px;
}

/* Псевдоэлемент нулевой высоты на всю ширину принудительно ломает строку
   между order 3 и order 5. */
.header-badges::after {
  content: "";
  order: 4;
  flex-basis: 100%;
  height: 0;
}

#open-account-button {
  order: 1;
  margin-right: 2px;
}

#header-position-badge {
  order: 2;
}

#header-time-badge {
  order: 3;
}

.colony-world-orbits {
  order: 5;
  flex: 0 0 auto;
  /* запас под значок гексов (right: -5px) и свечение орбиты */
  padding-right: 10px;
}

.header-summary-inline {
  order: 6;
  /* Маленький базис обязателен: при flex-wrap перенос считается по базису,
     а не по сжатой ширине — с basis:auto сводка уезжала на третью строку. */
  flex: 1 1 220px;
  min-width: 0;
}

/* ============================================================================
   МОБИЛЬНАЯ ОБОЛОЧКА
   На узких экранах интерфейс перестаёт быть «сжатым сайтом»: карта занимает
   весь экран, боковые панели и связь уезжают в нижние листы, вызываемые
   таб-баром. Разметка и id не меняются — ни один блок не теряется.
   Слой намеренно идёт последним в файле: он должен побеждать в каскаде.
   ============================================================================ */

:root {
  --mobile-tabbar-h: 62px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

.mobile-tabbar,
.mobile-sheet-scrim {
  display: none;
}

#planet-canvas {
  touch-action: none;
}

/* Блокировка прокрутки фона под модалкой и под открытым листом. */
body.is-modal-open,
body.is-sheet-open {
  overflow: hidden;
}

.modal-card,
.communication-log {
  overscroll-behavior: contain;
}

/* --- Тач-устройства любого размера ---------------------------------------- */

@media (pointer: coarse) {
  .communication-panel,
  .communication-log {
    resize: none;
  }

  .communication-tab {
    min-height: 40px;
    padding: 0 14px;
    font-size: 12px;
  }

  .chat-emoji-picker {
    min-height: 42px;
  }

  .chat-emoji-picker button {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
  }

  .galaxy-map-toolbar button,
  .galaxy-zoom-button {
    min-height: 42px;
  }

  .galaxy-zoom-button {
    width: 42px;
    height: 42px;
  }

  .colony-summary-tab,
  .space-tab {
    min-height: 46px;
  }
}

/* --- Оболочка ≤ 820px ------------------------------------------------------ */

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

  .game-screen {
    display: block;
    gap: 0;
    padding-bottom: 0;
  }

  .game-main-layout {
    display: block;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
  }

  /* Карта забирает всю высоту между шапкой и таб-баром: страница не скроллится. */
  .map-stage {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: calc(100dvh - var(--mobile-tabbar-h) - var(--safe-bottom) - 16px);
    padding: 0;
  }

  .map-frame {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    border-radius: 18px;
  }

  .map-overlay {
    padding: 10px;
  }

  .mini-hud {
    display: none;
  }

  /* Шапка: строка со статусами + отдельная строка с ресурсами колонии. */
  .stage-header {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 0;
    min-height: 0;
  }

  .header-badges {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px;
  }

  .header-badges > .header-badge {
    min-height: 32px;
    padding: 0 10px;
    font-size: 11px;
  }

  #open-account-button {
    min-height: 40px;
    padding: 0 12px;
  }

  /* Порядок строк тот же, что на десктопе: 1 — кто и где, 2 — орбиты и колония. */
  .header-summary-inline {
    flex: 1 1 140px;
    gap: 6px;
  }

  .top-summary-title {
    max-width: 45%;
    min-height: 30px;
    font-size: 11px;
  }

  /* Ресурсы — главная информация экрана, поэтому кегль и высота растут. */
  .top-summary-grid {
    gap: 6px;
    padding-bottom: 2px;
  }

  .summary-chip {
    min-height: 32px;
    padding: 5px 10px 5px 6px;
  }

  .summary-chip-badge {
    min-width: 22px;
    height: 22px;
    font-size: 8px;
  }

  .summary-chip-value {
    font-size: 12px;
  }

  /* Тулбар держим в одну строку — на карте дорога каждая полоса высоты. */
  .galaxy-map-toolbar {
    top: 8px;
    right: 8px;
    left: 8px;
    flex-wrap: nowrap;
    gap: 4px;
    padding: 4px;
  }

  .galaxy-map-toolbar button {
    flex: 1 1 0;
    min-width: 0;
    padding: 0 8px;
    font-size: 12px;
    white-space: nowrap;
  }

  .label-wide { display: none; }
  .label-narrow { display: inline; }

  .galaxy-zoom-controls {
    right: 10px;
    bottom: 10px;
  }

  .galaxy-selection {
    top: auto;
    bottom: 10px;
    left: 10px;
    width: calc(100% - 84px);
  }

  /* --- Нижние листы ------------------------------------------------------- */

  .left-sidebar,
  .right-sidebar,
  .communication-panel {
    position: fixed;
    z-index: 26;
    right: 0;
    bottom: calc(var(--mobile-tabbar-h) + var(--safe-bottom));
    left: 0;
    width: auto;
    max-width: none;
    /* .left-sidebar несёт justify-self: start из грид-раскладки; для
       фиксированного бокса это даёт shrink-to-fit вместо полной ширины. */
    justify-self: stretch;
    height: auto;
    min-height: 0;
    max-height: min(66dvh, 580px);
    margin: 0;
    padding: 22px 14px 18px;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid rgba(var(--accent-rgb), 0.18);
    border-bottom: 0;
    border-radius: 22px 22px 0 0;
    background: linear-gradient(180deg, rgba(16, 24, 44, 0.98), rgba(6, 10, 21, 0.99));
    box-shadow: 0 -26px 64px rgba(0, 0, 0, 0.6);
    transform: translateY(110%);
    visibility: hidden;
    transition: transform 300ms cubic-bezier(0.32, 0.72, 0, 1), visibility 300ms;
  }

  /* Ручка листа: ::before у .panel уже занят декоративной рамкой. */
  .left-sidebar::after,
  .right-sidebar::after,
  .communication-panel::after {
    content: "";
    position: absolute;
    top: 9px;
    left: 50%;
    width: 42px;
    height: 4px;
    border-radius: 999px;
    background: rgba(var(--accent-rgb), 0.32);
    transform: translateX(-50%);
  }

  body[data-mobile-sheet="faith"] .left-sidebar,
  body[data-mobile-sheet="actions"] .right-sidebar,
  body[data-mobile-sheet="comms"] .communication-panel {
    transform: none;
    visibility: visible;
  }

  /* Внутри листа вложенные панели уже не нужны как отдельные карточки.
     Саму .communication-panel сюда не берём — она и есть лист. */
  .left-sidebar .panel,
  .right-sidebar .panel {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    backdrop-filter: none;
  }

  .left-sidebar .panel::before,
  .right-sidebar .panel::before {
    display: none;
  }

  .left-sidebar {
    padding-top: 22px;
  }

  .left-sidebar .prayer-panel {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .left-sidebar .prayer-panel .cauldron {
    width: 96px;
    height: 96px;
  }

  .left-sidebar .resource-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-width: 0;
  }

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

  .left-sidebar .resource-name {
    font-size: 12px;
  }

  .left-sidebar .resource-value {
    font-size: 15px;
  }

  .left-sidebar .prayer-panel .muted-text {
    font-size: 13px;
  }

  /* Действия: две колонки внутри каждой смысловой группы. */
  .right-sidebar .action-panel {
    display: grid;
    grid-template-columns: 1fr;
  }

  .right-sidebar .panel-header {
    display: none;
  }

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

  .action-group-title {
    grid-column: 1 / -1;
    font-size: 10px;
  }

  .action-group > button,
  .action-group > a {
    min-height: 52px;
    padding-left: 14px;
    font-size: 13px;
    text-align: left;
  }

  .communication-panel {
    height: auto;
    max-height: min(72dvh, 620px);
  }

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

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

  .communication-log {
    min-height: 32dvh;
  }

  .communication-message-body {
    font-size: 14px;
  }

  .communication-meta {
    font-size: 11px;
  }

  /* --- Таб-бар ------------------------------------------------------------ */

  .mobile-sheet-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(2, 5, 12, 0.62);
    backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms ease;
  }

  body.is-sheet-open .mobile-sheet-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-tabbar {
    position: fixed;
    z-index: 27;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    height: calc(var(--mobile-tabbar-h) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    border-top: 1px solid rgba(var(--accent-rgb), 0.16);
    background: linear-gradient(180deg, rgba(10, 17, 33, 0.96), rgba(4, 8, 18, 0.99));
    backdrop-filter: blur(18px);
  }

  .mobile-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    transition: color 180ms ease;
  }

  .mobile-tab-glyph {
    font-size: 17px;
    line-height: 1;
  }

  .mobile-tab.is-active {
    color: var(--accent);
  }

  .mobile-tab.is-active .mobile-tab-glyph {
    text-shadow: 0 0 14px rgba(var(--accent-rgb), 0.7);
  }

  /* --- Модалки во весь экран ---------------------------------------------- */

  /* Модалка перекрывает и листы (26), и таб-бар (27). */
  .modal {
    z-index: 30;
    padding: 0;
    place-items: stretch;
  }

  .modal-card,
  .modal-card-wide,
  .modal-card-medium,
  .public-profile-modal-card,
  .space-modal-card {
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: 100dvh;
    padding: 16px 14px calc(20px + var(--safe-bottom));
    border: 0;
    border-radius: 0;
  }

  .modal-card > .modal-close {
    top: 10px;
    right: 10px;
  }

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

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

  .toast-stack {
    z-index: 34;
    right: 10px;
    bottom: calc(var(--mobile-tabbar-h) + var(--safe-bottom) + 12px);
    left: 10px;
  }

  .toast {
    min-width: 0;
  }
}

/* Совсем узкие экраны: кнопки действий в одну колонку. */
@media (max-width: 360px) {
  .action-group {
    grid-template-columns: 1fr;
  }

  .mobile-tab-label {
    font-size: 9px;
  }
}

.guest-verification {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(97, 236, 224, 0.28);
  border-radius: 14px;
  background: rgba(4, 18, 34, 0.72);
}

.guest-verification-title {
  margin: 0;
  color: var(--text-main);
  font-weight: 700;
}

.guest-honeypot {
  position: fixed !important;
  left: -10000px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}

.artifact-curse-fields {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 105, 120, 0.38);
  border-radius: 14px;
  background: rgba(62, 10, 24, 0.18);
}

.artifact-curse-fields legend,
.artifact-curse {
  color: #ff8d9b;
}

.artifact-curse {
  font-weight: 700;
}

.planet-colony-confirm { display: grid; gap: 8px; margin-top: 10px; }
.planet-colony-confirm button { min-height: 42px; width: 100%; }
.codex-search { display: grid; gap: 8px; margin-bottom: 18px; }
.codex-search input { width: 100%; }
.codex-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.codex-entry { padding: 16px; border: 1px solid rgba(136, 190, 255, .18); border-radius: 14px; background: rgba(7, 18, 35, .72); }
.codex-entry span { color: var(--accent, #72d7ff); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.codex-entry h3 { margin: 6px 0 8px; }
.codex-entry p { margin: 0; color: var(--muted, #9aaabd); line-height: 1.5; }
.action-forecast-grid { display: grid; grid-template-columns: minmax(120px, .75fr) minmax(180px, 1.25fr); gap: 7px 14px; margin-top: 12px; }
.action-forecast-grid span { color: var(--muted, #9aaabd); }
.action-forecast-grid b { color: #e8f7ff; }
.nightmare-menu-button { border: 1px solid rgba(193, 91, 255, .55); color: #f0c7ff; background: linear-gradient(135deg, rgba(91, 17, 111, .62), rgba(23, 7, 44, .88)); }
.nightmare-modal-card { background: radial-gradient(circle at 50% 0, rgba(96, 20, 119, .2), transparent 42%), rgba(3, 8, 19, .98); }
.nightmare-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.nightmare-tabs .is-active { border-color: #c969ff; color: #f2c8ff; box-shadow: 0 0 20px rgba(190, 82, 255, .18); }
.nightmare-content, .nightmare-builders, .nightmare-history { display: grid; gap: 16px; }
.nightmare-builders { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.nightmare-builder { overflow: hidden; border-color: rgba(188, 92, 255, .25); }
.nightmare-body { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; min-height: 330px; padding: 55px 12px 24px; border-radius: 22px; background: radial-gradient(ellipse at center, rgba(168, 70, 201, .2), transparent 55%); }
.nightmare-body::before { content: ""; position: absolute; inset: 38px 30% 22px; border: 2px solid rgba(210, 141, 238, .22); border-radius: 45% 45% 35% 35%; box-shadow: 0 0 40px rgba(174, 69, 226, .12); pointer-events: none; }
.nightmare-slot { position: relative; z-index: 1; display: grid; gap: 5px; padding: 8px; border: 1px solid rgba(190, 102, 230, .24); border-radius: 11px; background: rgba(5, 10, 25, .86); }
.nightmare-slot label { display: grid; gap: 4px; color: #d7b5e7; font-size: .75rem; }
.nightmare-slot select { min-width: 0; width: 100%; }
.nightmare-stats { margin: 11px 0; color: #e6bfef; }
.nightmare-cargo { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px; border: 1px solid rgba(229, 188, 105, .28); border-radius: 12px; background: rgba(87, 55, 13, .18); }
.nightmare-cargo > div { display: grid; gap: 4px; }
.nightmare-cargo strong, .nightmare-loot strong { color: #f0ca72; }
.nightmare-cargo span, .nightmare-cargo small { color: #b9a98a; }
.nightmare-cargo button { min-width: 210px; }
.nightmare-loot { display: grid; gap: 5px; padding: 10px 12px; border-left: 3px solid #e5bc69; background: rgba(87, 55, 13, .16); }
.nightmare-loot > span { color: #b9a98a; font-size: .8rem; }
.nightmare-name-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.nightmare-part-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.nightmare-part-card { display: grid; grid-template-columns: 86px minmax(0, 1fr); gap: 12px; padding: 13px; border: 1px solid rgba(181, 97, 220, .22); border-radius: 15px; background: rgba(9, 12, 29, .84); }
.nightmare-part-card img, .nightmare-part-placeholder { width: 86px; height: 86px; border-radius: 12px; object-fit: cover; }
.nightmare-part-placeholder { display: grid; place-items: center; color: #d57dff; background: rgba(129, 37, 160, .18); font-size: 2rem; }
.nightmare-part-card > div { display: grid; gap: 5px; min-width: 0; }
.nightmare-part-card strong { color: #f2d7ff; }
.nightmare-part-card small, .nightmare-part-card span { color: #ae9abb; }
.nightmare-part-card p { margin: 0; color: #c9bdd0; }
.nightmare-part-card b { color: #e5bc69; }
.nightmare-part-card form, .nightmare-part-card > .admin-news-actions { grid-column: 1 / -1; }
.rarity-rare { border-color: rgba(91, 146, 255, .55); }.rarity-legendary { border-color: rgba(245, 180, 70, .66); box-shadow: inset 0 0 26px rgba(218, 145, 34, .08); }
.nightmare-portal { display: grid; justify-items: center; gap: 13px; padding: 35px; text-align: center; }
.nightmare-portal-ring { display: grid; place-items: center; width: 150px; height: 150px; border: 2px solid #cb70ff; border-radius: 50%; color: #ead1ff; background: radial-gradient(circle, #43145f, #090515 65%); box-shadow: 0 0 50px rgba(185, 65, 255, .36), inset 0 0 38px #12021f; font-size: 4rem; animation: nightmare-portal 5s linear infinite; }
@keyframes nightmare-portal { to { transform: rotate(360deg); } }
@media (max-width: 820px) { .nightmare-builders { grid-template-columns: 1fr; } .nightmare-part-card { grid-template-columns: 64px minmax(0, 1fr); } .nightmare-part-card img, .nightmare-part-placeholder { width: 64px; height: 64px; } }
@media (max-width: 620px) { .action-forecast-grid { grid-template-columns: 1fr; gap: 4px; } .action-forecast-grid b { margin-bottom: 7px; } }
.return-summary-list { display: grid; gap: 8px; margin: 16px 0; }
.return-summary-list article { display: flex; justify-content: space-between; gap: 16px; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.05); }
.crisis-warning { margin: 14px 0; padding: 14px; border: 1px solid rgba(255, 176, 76, .35); border-radius: 12px; background: rgba(111, 62, 12, .22); }

/* Game news --------------------------------------------------------------- */
#auth-screen .home-news {
  position: relative;
  z-index: 2;
  grid-column: 1 / -1;
  width: 100%;
  margin-top: 10px;
  padding: clamp(22px, 3vw, 38px);
  border: 1px solid rgba(112, 226, 255, .16);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(8, 15, 31, .92), rgba(4, 8, 19, .86));
  box-shadow: 0 28px 70px rgba(0, 0, 0, .3);
  backdrop-filter: blur(18px);
}

.home-news-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 24px;
}

.home-news-heading h2 { margin: 0; font-family: "Orbitron", sans-serif; font-size: clamp(24px, 3vw, 40px); }
.home-news-heading > p { max-width: 510px; margin: 0; color: var(--muted); line-height: 1.6; }
.news-feed { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: start; }
.news-modal-card .news-feed { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.news-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(112, 226, 255, .16);
  border-radius: 19px;
  background: rgba(6, 12, 25, .9);
  box-shadow: 0 15px 36px rgba(0, 0, 0, .25);
}

.news-card.is-draft { opacity: .62; border-style: dashed; }
.news-card > header, .news-copy, .news-reactions, .news-comments { margin-right: 18px; margin-left: 18px; }
.news-card > header { position: relative; padding-top: 20px; }
.news-card > header .eyebrow { margin-bottom: 8px; }
.news-card > header time { position: absolute; top: 20px; right: 0; color: rgba(206, 222, 241, .52); font-size: 11px; }
.news-card h3 { margin: 0 0 17px; padding-right: 10px; color: #effbff; font: 700 19px/1.3 "Orbitron", sans-serif; }
.news-image { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #02040a; }
.news-video { position: relative; aspect-ratio: 16 / 9; background: #010205; }
.news-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.news-copy { padding: 18px 0; color: rgba(225, 237, 251, .78); font-size: 14px; line-height: 1.65; }

.news-reactions { display: flex; align-items: center; gap: 9px; padding: 0 0 15px; }
.news-reactions small { margin-left: auto; color: var(--muted); font-size: 10px; text-align: right; }
.news-reaction { min-width: 64px; padding: 7px 11px; border: 1px solid rgba(112, 226, 255, .17); border-radius: 999px; background: rgba(112, 226, 255, .06); color: #aac0d8; cursor: pointer; }
.news-reaction:hover:not(:disabled), .news-reaction.is-active { border-color: rgba(112, 226, 255, .65); background: rgba(112, 226, 255, .16); color: #dffaff; }
.news-reaction:disabled { cursor: not-allowed; opacity: .52; }

.news-comments { padding: 14px 0 18px; border-top: 1px solid rgba(112, 226, 255, .12); }
.news-comments summary { color: #b8cce1; cursor: pointer; font-weight: 700; }
.news-comments summary span { display: inline-grid; place-items: center; min-width: 21px; min-height: 21px; margin-left: 5px; border-radius: 50%; background: rgba(112, 226, 255, .12); font-size: 11px; }
.news-comment-list { display: grid; gap: 9px; max-height: 300px; margin-top: 14px; overflow-y: auto; }
.news-comment { padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .035); }
.news-comment > div { display: flex; justify-content: space-between; gap: 10px; }
.news-comment strong { color: #dffaff; font-size: 12px; }
.news-comment time { color: var(--muted); font-size: 10px; }
.news-comment p { margin: 5px 0 0; color: rgba(225, 237, 251, .72); font-size: 12px; line-height: 1.5; }
.news-comment-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 12px; }
.news-comment-form textarea { min-height: 54px; resize: vertical; }
.news-comment-lock { margin: 12px 0 0; color: var(--muted); font-size: 11px; }
.news-empty { grid-column: 1 / -1; margin: 0; padding: 34px; border: 1px dashed rgba(112, 226, 255, .18); border-radius: 16px; color: var(--muted); text-align: center; }

.admin-news-panel { grid-column: 1 / -1; }
.admin-news-panel form { max-width: 760px; }
.admin-news-list { display: grid; gap: 12px; margin-top: 24px; }
.admin-news-card { display: grid; grid-template-columns: 90px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: rgba(6, 12, 25, .74); }
.admin-news-card.is-draft { opacity: .65; }
.admin-news-card > img, .admin-news-card > .artifact-placeholder { width: 90px; height: 66px; border-radius: 9px; object-fit: cover; }
.admin-news-card > div:not(.admin-news-actions) { display: grid; gap: 3px; min-width: 0; }
.admin-news-card p { margin: 0; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.admin-news-actions { display: grid; gap: 7px; }

@media (max-width: 1000px) {
  .news-feed, .news-modal-card .news-feed { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .home-news-heading { display: grid; }
  .news-feed, .news-modal-card .news-feed { grid-template-columns: 1fr; }
  .news-comment-form { grid-template-columns: 1fr; }
  .admin-news-card { grid-template-columns: 64px minmax(0, 1fr); }
  .admin-news-card > img, .admin-news-card > .artifact-placeholder { width: 64px; height: 64px; }
  .admin-news-actions { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
}

/* Living civilization: era vignette, story campaign, projects and pirate AI. */
.civilization-vignette { position: absolute; z-index: 2; right: 16%; bottom: 0; left: 16%; height: 150px; overflow: hidden; pointer-events: none; opacity: .82; filter: drop-shadow(0 -10px 24px rgba(56, 170, 225, .14)); transition: opacity 300ms ease, filter 300ms ease; }
.civilization-ground { position: absolute; right: 0; bottom: -48px; left: 0; height: 100px; border-radius: 50% 50% 0 0; background: linear-gradient(180deg, rgba(25, 56, 71, .82), rgba(3, 10, 20, .97)); box-shadow: 0 -4px 20px rgba(61, 181, 213, .1); }
.civilization-sky i { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #c8f6ff; box-shadow: 0 0 9px #8be9ff; animation: civilization-star 4s ease-in-out infinite; }
.civilization-sky i:nth-child(1) { left: 16%; top: 30%; }
.civilization-sky i:nth-child(2) { left: 58%; top: 14%; animation-delay: 1.2s; }
.civilization-sky i:nth-child(3) { right: 13%; top: 38%; animation-delay: 2.1s; }
.civilization-landmark { position: absolute; z-index: 2; bottom: 38px; background: linear-gradient(145deg, #233b51, #091522); transition: width 350ms ease, height 350ms ease, clip-path 350ms ease; }
.civilization-landmark-a { left: 24%; width: 74px; height: 45px; clip-path: polygon(50% 0, 100% 45%, 90% 100%, 10% 100%, 0 45%); }
.civilization-landmark-b { right: 23%; width: 58px; height: 38px; clip-path: polygon(50% 0, 100% 42%, 88% 100%, 12% 100%, 0 42%); }
.civilization-fire { position: absolute; z-index: 4; bottom: 37px; left: 50%; width: 16px; height: 30px; transform: translateX(-50%); border-radius: 55% 45% 55% 45%; background: linear-gradient(#fff6a2, #ff9d38 45%, #d8381f); box-shadow: 0 0 18px #ff9d38, 0 0 42px rgba(255, 120, 32, .55); animation: civilization-fire 1.1s ease-in-out infinite alternate; }
.civilization-fire i { position: absolute; right: -17px; bottom: -5px; width: 50px; height: 6px; border-radius: 50%; background: #17100c; }
.civilization-vignette.first-night-complete .civilization-fire { height: 38px; box-shadow: 0 0 24px #ffc352, 0 0 60px rgba(255, 150, 45, .7); }
.civilization-vignette.era-iron-age .civilization-landmark-a { left: 20%; width: 125px; height: 65px; clip-path: polygon(0 30%, 18% 30%, 18% 5%, 34% 5%, 34% 30%, 66% 30%, 66% 5%, 82% 5%, 82% 30%, 100% 30%, 100% 100%, 0 100%); }
.civilization-vignette.era-iron-age .civilization-landmark-b { width: 82px; height: 62px; clip-path: polygon(15% 0, 85% 0, 100% 100%, 0 100%); }
.civilization-vignette.era-feudalism .civilization-landmark-a,
.civilization-vignette.era-holy-empire .civilization-landmark-a,
.civilization-vignette.era-republic .civilization-landmark-a { left: 24%; width: 150px; height: 100px; clip-path: polygon(0 25%, 15% 25%, 15% 0, 32% 0, 32% 34%, 43% 34%, 50% 14%, 57% 34%, 68% 34%, 68% 0, 85% 0, 85% 25%, 100% 25%, 100% 100%, 0 100%); }
.civilization-vignette.era-manufacturing .civilization-landmark-a,
.civilization-vignette.era-space-age .civilization-landmark-a,
.civilization-vignette.era-interstellar .civilization-landmark-a { left: 18%; width: 180px; height: 105px; clip-path: polygon(0 100%, 0 48%, 20% 48%, 20% 22%, 31% 22%, 31% 65%, 48% 65%, 48% 8%, 57% 8%, 57% 55%, 72% 55%, 72% 30%, 83% 30%, 83% 70%, 100% 70%, 100% 100%); }
.civilization-vignette.era-space-age::after,
.civilization-vignette.era-interstellar::after { content: ""; position: absolute; top: 25px; left: 46%; width: 90px; height: 20px; border: 1px solid rgba(139, 236, 255, .65); border-radius: 50%; transform: rotate(-14deg); box-shadow: 0 0 18px rgba(88, 207, 255, .35); animation: civilization-orbit 7s linear infinite; }
.civilization-vignette.is-reacting { opacity: 1; filter: drop-shadow(0 -12px 34px rgba(255, 174, 66, .46)); }
.civilization-alert { position: absolute; z-index: 8; right: 76px; bottom: 18px; display: grid; gap: 1px; width: min(230px, calc(100% - 330px)); padding: 8px 11px; border: 1px solid rgba(111, 218, 255, .35); border-radius: 12px; color: #edfaff; background: rgba(4, 15, 32, .88); box-shadow: 0 12px 30px rgba(0, 0, 0, .32); backdrop-filter: blur(12px); text-align: left; cursor: pointer; }
.civilization-alert:hover { border-color: rgba(129, 232, 255, .7); }
.civilization-alert > span { color: #73dff7; font-size: .61rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.civilization-alert > strong { overflow: hidden; font-size: .86rem; text-overflow: ellipsis; white-space: nowrap; }
.civilization-alert > small { display: -webkit-box; overflow: hidden; color: #9fb3d2; font-size: .7rem; line-height: 1.25; -webkit-box-orient: vertical; -webkit-line-clamp: 1; }
.era-guidance-banner { position: absolute; z-index: 7; top: 14px; right: 14px; max-width: min(390px, calc(100% - 330px)); padding: 7px 12px; border: 1px solid rgba(255, 194, 92, .3); border-radius: 999px; color: #ffe0a6; background: rgba(21, 15, 9, .78); box-shadow: 0 8px 24px rgba(0, 0, 0, .26); backdrop-filter: blur(10px); font-size: .72rem; line-height: 1.3; text-align: center; pointer-events: none; }
.civilization-alert.is-danger { border-color: rgba(255, 103, 91, .7); animation: civilization-warning 2s ease-in-out infinite; }
.civilization-alert.is-danger > span { color: #ff9d92; }
.civilization-content { display: grid; gap: 16px; }
.civilization-story-card, .civilization-section { padding: 18px; border: 1px solid rgba(101, 201, 255, .2); border-radius: 17px; background: rgba(4, 14, 31, .78); }
.civilization-story-card { display: grid; grid-template-columns: 150px 1fr; gap: 20px; align-items: center; }
.civilization-story-card h3, .civilization-story-card p { margin-top: 0; }
.civilization-story-card.is-complete { grid-template-columns: auto 1fr; border-color: rgba(103, 229, 167, .38); background: linear-gradient(135deg, rgba(19, 79, 71, .34), rgba(4, 14, 31, .78)); }
.story-complete-mark { display: grid; place-items: center; width: 70px; height: 70px; border-radius: 50%; color: #afffd6; background: rgba(66, 201, 139, .16); font-size: 2rem; box-shadow: 0 0 28px rgba(75, 224, 158, .18); }
.first-night-fire { position: relative; width: 125px; height: 125px; margin: auto; border-radius: 50%; background: radial-gradient(circle, rgba(255, 201, 77, .42), rgba(213, 66, 27, .13) 42%, transparent 70%); }
.first-night-fire::before, .first-night-fire::after, .first-night-fire i { content: ""; position: absolute; bottom: 29px; left: 50%; width: 42px; height: 72px; border-radius: 55% 45% 58% 42%; transform-origin: center bottom; background: linear-gradient(#fff8a5, #ff9e2f 48%, #d63422); box-shadow: 0 0 28px rgba(255, 135, 42, .8); animation: first-night-flame 1.1s ease-in-out infinite alternate; }
.first-night-fire::after { width: 28px; height: 52px; margin-left: -24px; animation-delay: -.4s; }
.first-night-fire i { width: 25px; height: 46px; margin-left: 12px; animation-delay: -.75s; }
.first-night-fire.is-dormant::before, .first-night-fire.is-dormant::after, .first-night-fire.is-dormant i { height: 7px; filter: grayscale(.8); opacity: .35; }
.first-night-copy { min-width: 0; }
.first-night-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.first-night-choices form, .first-night-choices button { height: 100%; }
.first-night-choices button { display: grid; gap: 5px; width: 100%; text-align: left; }
.first-night-choices small { color: #91a7c8; font-weight: 400; }
.story-score { margin-top: 10px; color: #f0c76a; font-size: .82rem; }
.civilization-project-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 12px; }
.civilization-project-card { display: grid; gap: 11px; padding: 15px; border: 1px solid rgba(100, 202, 255, .18); border-radius: 14px; background: rgba(7, 21, 44, .68); }
.civilization-project-card.is-legacy { border-color: rgba(233, 198, 108, .28); background: linear-gradient(135deg, rgba(80, 57, 22, .24), rgba(7, 21, 44, .68)); }
.civilization-project-card > p, .civilization-project-card > footer { margin: 0; color: #9cadca; font-size: .84rem; }
.civilization-project-card > footer { color: #e9c66c; }
.project-heading { display: flex; justify-content: space-between; gap: 12px; }
.project-heading span { display: block; margin-top: 3px; color: #8fa7c9; font-size: .75rem; }
.project-heading > b { color: #72def4; }
.project-resources { display: grid; gap: 7px; }
.project-resources form { display: grid; grid-template-columns: minmax(0, 1fr) 82px auto; gap: 8px; align-items: center; }
.project-resources form span { display: block; color: #8fa7c9; font-size: .72rem; }
.project-resources input { min-width: 0; }

.politics-section h4 { margin: 18px 0 8px; color: #dce9ff; }
.politics-government { display: grid; grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); gap: 8px; margin: 12px 0; }
.politics-government span { padding: 9px 11px; border: 1px solid rgba(99,178,255,.18); border-radius: 10px; background: rgba(7,21,43,.62); color: #95a9c8; }
.politics-government strong { display: block; margin-top: 3px; color: #f0f6ff; }
.politics-list { display: grid; gap: 8px; }
.politics-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 11px; border: 1px solid rgba(99,178,255,.15); border-radius: 11px; background: rgba(4,14,31,.55); }
.politics-row.is-coalition { border-color: rgba(99,220,167,.45); box-shadow: inset 3px 0 0 #63dca7; }
.politics-row.is-active { border-color: rgba(246,199,100,.45); }
.politics-row.is-paused { border-color: rgba(255,112,94,.35); }
.politics-row div { display: grid; gap: 4px; }
.politics-row span,.politics-row small { color: #91a7c7; }
.politics-row form { display: flex; gap: 7px; align-items: center; }
.politics-row input[type="number"] { width: 100px; }
.politics-deputies { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 8px; }
.politics-deputy { display: grid; gap: 3px; padding: 10px; border: 1px solid rgba(99,178,255,.13); border-radius: 10px; background: rgba(4,14,31,.42); }
.politics-deputy span,.politics-deputy small { color: #91a7c7; }
.politics-explainer { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin: 12px 0; }
.politics-explainer article { display: grid; gap: 5px; padding: 11px; border-radius: 11px; background: linear-gradient(145deg,rgba(20,55,91,.7),rgba(5,18,37,.68)); border: 1px solid rgba(105,198,244,.2); }
.politics-explainer span { color: #9eb2cf; font-size: .78rem; line-height: 1.45; }
.politics-process-summary { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin: 10px 0; }
.politics-process-summary > div { display: grid; gap: 3px; padding: 9px 11px; border-radius: 10px; background: rgba(4,14,31,.62); border: 1px solid rgba(99,178,255,.15); }
.politics-process-summary span { color: #70dcb2; }
.active-effects { display: grid; gap: 5px; padding: 11px; border-left: 3px solid #70dcb2; border-radius: 8px; background: rgba(64,181,136,.08); }
.active-effects > span { color: #a8bdd5; font-size: .8rem; }
.active-effects b { color: #dff8ee; }
.process-status { display: inline-block; margin-left: 5px; padding: 2px 6px; border-radius: 999px; background: rgba(115,164,219,.12); color: #9db5d3; font-size: .68rem; font-style: normal; font-weight: 500; }
.process-status.is-running { background: rgba(74,205,147,.13); color: #76dfb2; }
.process-status.is-stopped { background: rgba(255,112,94,.12); color: #f19a8f; }
.process-effect { color: #75dcb5 !important; }
.process-shortage { color: #f2a18f !important; }
.politics-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.politics-election { padding: 10px; border-radius: 10px; background: rgba(246,199,100,.12); color: #f6c764; }
.politics-election strong,.politics-election span { display: block; }
.politics-election span { margin-top: 3px; color: #c8ab69; font-size: .78rem; }
@media (max-width: 720px) { .politics-row { grid-template-columns: 1fr; } .politics-row form { flex-wrap: wrap; } .politics-row input[type="number"] { flex: 1; min-width: 90px; } .politics-explainer,.politics-process-summary { grid-template-columns: 1fr; } }
.pirate-locked, .pirate-section { position: relative; overflow: hidden; }
.pirate-locked { display: flex; align-items: center; gap: 18px; }
.pirate-signal { color: #7be4ff; font-size: 3.2rem; text-shadow: 0 0 24px rgba(95, 219, 255, .62); animation: pirate-signal 2.5s ease-in-out infinite; }
.pirate-section::after { content: ""; position: absolute; top: -70px; right: -40px; width: 210px; height: 150px; border: 1px solid rgba(255, 94, 80, .25); border-radius: 50%; transform: rotate(-20deg); pointer-events: none; }
.pirate-section.is-warning { border-color: rgba(255, 96, 83, .55); box-shadow: inset 0 0 40px rgba(159, 32, 28, .13); }
.pirate-intel-grid { display: grid; grid-template-columns: repeat(4, minmax(100px, 1fr)); gap: 8px; }
.pirate-intel-grid span { padding: 10px; border-radius: 10px; color: #91a8ca; background: rgba(3, 12, 28, .72); }
.pirate-intel-grid strong { display: block; margin-top: 4px; color: #eff8ff; }
.pirate-deadline { color: #e7c46c; }
.pirate-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.pirate-event-log { display: grid; gap: 6px; margin-top: 14px; }
.pirate-event-log > div { display: grid; grid-template-columns: 160px 1fr; gap: 10px; padding-top: 7px; border-top: 1px solid rgba(104, 198, 245, .12); color: #a7b7d1; font-size: .8rem; }
.pirate-event-log time { color: #7188aa; }
@keyframes civilization-star { 50% { opacity: .25; transform: scale(.65); } }
@keyframes civilization-fire { to { transform: translateX(-50%) rotate(4deg) scale(.9, 1.08); } }
@keyframes civilization-orbit { to { transform: rotate(346deg); } }
@keyframes civilization-warning { 50% { box-shadow: 0 0 30px rgba(230, 65, 55, .28); } }
@keyframes first-night-flame { to { transform: rotate(5deg) scale(.86, 1.08); filter: brightness(1.15); } }
@keyframes pirate-signal { 50% { opacity: .45; transform: scale(.9); } }

@media (max-width: 820px) {
  .civilization-vignette { right: 4%; left: 4%; height: 115px; opacity: .62; }
  .civilization-alert { top: 58px; right: 10px; bottom: auto; left: 10px; width: auto; max-width: none; }
  .civilization-alert > span, .civilization-alert > small { display: none; }
  .era-guidance-banner { top: 105px; right: 10px; left: 10px; max-width: none; border-radius: 12px; }
  .civilization-story-card { grid-template-columns: 1fr; text-align: center; }
  .civilization-story-card.is-complete { grid-template-columns: 1fr; }
  .story-complete-mark { margin: auto; }
  .first-night-choices { grid-template-columns: 1fr; text-align: left; }
  .civilization-project-grid { grid-template-columns: 1fr; }
  .project-resources form { grid-template-columns: 1fr 76px auto; }
  .pirate-intel-grid { grid-template-columns: repeat(2, 1fr); }
  .pirate-event-log > div { grid-template-columns: 1fr; gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  .civilization-vignette *, .civilization-vignette::after, .civilization-alert,
  .first-night-fire::before, .first-night-fire::after, .first-night-fire i, .pirate-signal { animation: none !important; }
}

@media (max-width: 820px) {
  .market-catalog-row {
    grid-template-columns: 1fr auto;
    gap: 7px 12px;
  }

  .market-catalog-row strong { grid-column: 1; grid-row: 1; }
  .market-catalog-row span:nth-of-type(1) { grid-column: 2; grid-row: 1; text-align: right; }
  .market-catalog-row span:nth-of-type(2) { grid-column: 1; grid-row: 2; }
  .market-catalog-row span:nth-of-type(3) { grid-column: 1; grid-row: 3; }
  .market-catalog-row i { grid-column: 2; grid-row: 3; text-align: right; }

  .market-browser-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  .left-sidebar,
  .right-sidebar,
  .communication-panel,
  .mobile-sheet-scrim {
    transition: none;
  }
}
