:root {
  color-scheme: dark;
  --menu-bg: url("/assets/backgrounds/menu-bg-generated.png");
  --bg: #050816;
  --bg-alt: #091227;
  --panel: rgba(10, 18, 38, 0.82);
  --panel-border: rgba(140, 181, 255, 0.18);
  --text: #eaf1ff;
  --muted: #97a8ca;
  --accent: #7be7ff;
  --accent-2: #9f7bff;
  --danger: #ff7a90;
  --success: #6ef3b0;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: var(--text);
  background-image:
    var(--menu-bg),
    radial-gradient(circle at top left, rgba(123, 231, 255, 0.14), transparent 28%),
    radial-gradient(circle at 80% 10%, rgba(159, 123, 255, 0.18), transparent 25%),
    linear-gradient(180deg, #04060f 0%, #07101f 100%);
  background-size: cover, auto, auto, auto;
  background-attachment: fixed;
}

button {
  font: inherit;
}

.backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px),
    radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 28px 28px, 64px 64px;
  background-position: 0 0, 12px 18px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9), transparent 100%);
  opacity: 0.35;
}

.shell {
  position: relative;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px;
  min-height: 100vh;
  padding: 24px;
}

.sidebar,
.main {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background:
    radial-gradient(circle at 30% 30%, #fff, transparent 26%),
    linear-gradient(145deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 40px rgba(123, 231, 255, 0.35);
}

h1,
h2,
.panel-title {
  margin: 0;
  font-family: "Orbitron", "Space Grotesk", sans-serif;
  letter-spacing: 0.04em;
}

h1 {
  font-size: 1.2rem;
}

h2 {
  font-size: clamp(2rem, 3vw, 3.2rem);
  line-height: 1.05;
}

.eyebrow,
.panel-title,
.pill {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
}

.eyebrow {
  color: var(--accent);
  margin: 0 0 6px;
}

.intro,
.hero-copy,
.muted {
  color: var(--muted);
  line-height: 1.6;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  padding: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.login-shell {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(100%, 520px);
  display: grid;
  gap: 18px;
}

.login-brand {
  align-items: center;
}

.auth-tabs {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-tabs button {
  border: 0;
  border-radius: 14px;
  padding: 10px 14px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
}

.auth-tabs button.active {
  color: #04111e;
  background: linear-gradient(145deg, #95f3ff, #7aa2ff);
  font-weight: 700;
}

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

.login-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.login-form input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(3, 10, 20, 0.65);
  color: var(--text);
  font: inherit;
  outline: none;
}

.login-form input:focus {
  border-color: rgba(123, 231, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(123, 231, 255, 0.12);
}

.login-form button {
  border: 0;
  border-radius: 16px;
  padding: 12px 16px;
  color: #04111e;
  background: linear-gradient(145deg, #95f3ff, #7aa2ff);
  cursor: pointer;
  font-weight: 700;
}

.login-error {
  min-height: 1.25rem;
  margin: 0;
  color: var(--danger);
  font-size: 0.92rem;
}

.login-hint {
  margin: 0;
  color: rgba(160, 210, 230, 0.7);
  font-size: 0.82rem;
  line-height: 1.4;
}

.setup-box {
  border: 1px dashed rgba(123, 231, 255, 0.35);
  border-radius: 18px;
  padding: 16px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.build-list,
.resource-grid,
.production-grid,
.status-grid {
  display: grid;
  gap: 12px;
}

.resource-card {
  display: flex;
  gap: 12px;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  padding: 12px 14px;
}

.resource-card img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex: 0 0 auto;
  filter: drop-shadow(0 0 16px rgba(123, 231, 255, 0.22));
}

.resource-sprite {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  background-repeat: no-repeat;
  background-size: 300% 200%;
  border-radius: 12px;
  filter: drop-shadow(0 0 16px rgba(123, 231, 255, 0.22));
}

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

.resource-card span {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.build-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  padding: 14px;
}

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

.building-meta {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.build-card .actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

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

.build-card button {
  border: 0;
  border-radius: 16px;
  padding: 10px 14px;
  color: #04111e;
  background: linear-gradient(145deg, #95f3ff, #7aa2ff);
  cursor: pointer;
  font-weight: 700;
}

.build-card .tag {
  white-space: nowrap;
}

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

.setup-form input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(3, 10, 20, 0.65);
  color: var(--text);
  font: inherit;
  outline: none;
}

.setup-form input:focus {
  border-color: rgba(123, 231, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(123, 231, 255, 0.12);
}

.setup-form button {
  border: 0;
  border-radius: 16px;
  padding: 12px 16px;
  color: #04111e;
  background: linear-gradient(145deg, #95f3ff, #7aa2ff);
  cursor: pointer;
  font-weight: 700;
}

.setup-form button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.status-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  padding: 14px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.hero-actions,
.action-list,
.tech-list,
.planet-list,
.stack,
.event-log {
  display: grid;
  gap: 12px;
}

.hero-actions button,
.action-card button,
.tech-card button {
  border: 0;
  border-radius: 16px;
  padding: 12px 16px;
  color: #04111e;
  background: linear-gradient(145deg, #95f3ff, #7aa2ff);
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.hero-actions button:hover,
.action-card button:hover,
.tech-card button:hover {
  transform: translateY(-1px);
}

.hero-actions .ghost {
  color: var(--text);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

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

.bottom {
  align-items: start;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
}

.pill {
  color: var(--accent);
  white-space: nowrap;
}

.stat,
.planet-card,
.tech-card,
.action-card,
.event-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  padding: 14px;
}

.stat {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.stat strong {
  font-size: 1rem;
}

.planet-card header,
.tech-card header,
.action-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.tag {
  color: var(--success);
  font-size: 0.8rem;
}

.tag.danger {
  color: var(--danger);
}

.planet-meta,
.tech-meta,
.action-meta,
.event-meta {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.planet-card .actions,
.action-card .actions,
.tech-card .actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.action-card button,
.tech-card button {
  padding: 10px 14px;
  font-size: 0.9rem;
}

.tech-card.researched {
  border-color: rgba(110, 243, 176, 0.35);
}

.event-item time {
  display: block;
  color: var(--accent);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .hero {
    flex-direction: column;
  }
}

@media (max-width: 760px) {
  .shell {
    padding: 16px;
  }

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

.game-shell {
  height: 100vh;
  height: 100svh; /* iOS Safari: uses actual visible height excluding browser chrome */
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  padding: 10px;
  overflow: hidden;
}

.top-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 10px 16px;
}

.colony-chip-name {
  display: flex;
  align-items: center;
  gap: 6px;
}

.colony-chip h1 {
  font-size: 1.1rem;
  margin: 0;
}

.rename-planet-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  opacity: 0.4;
  padding: 2px 4px;
  border-radius: 6px;
  transition: opacity 0.15s;
  line-height: 1;
}

.rename-planet-btn:hover {
  opacity: 1;
  background: rgba(123, 231, 255, 0.1);
}

.rename-planet-modal {
  width: min(380px, 90vw);
  display: grid;
  gap: 14px;
  padding: 20px 22px 18px;
  border-radius: 20px;
  border: 1px solid rgba(123, 231, 255, 0.2);
  background:
    radial-gradient(circle at 20% 10%, rgba(123, 231, 255, 0.1), transparent 40%),
    rgba(3, 10, 20, 0.94);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}

.rename-planet-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rename-planet-head strong {
  font-size: 1rem;
}

.rename-planet-head span {
  font-size: 0.78rem;
  color: var(--muted);
}

.rename-planet-input {
  width: 100%;
  background: rgba(2, 8, 18, 0.72);
  border: 1px solid rgba(123, 231, 255, 0.2);
  border-radius: 10px;
  padding: 9px 12px;
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  box-sizing: border-box;
}

.rename-planet-input:focus {
  outline: none;
  border-color: rgba(123, 231, 255, 0.5);
  box-shadow: 0 0 0 2px rgba(123, 231, 255, 0.1);
}

.rename-planet-error {
  font-size: 0.75rem;
  color: #ff8888;
  min-height: 1em;
  margin: 0;
}

.rename-planet-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.rename-planet-submit {
  background: linear-gradient(145deg, #95f3ff, #7aa2ff);
  color: #04111e;
  border: none;
  border-radius: 10px;
  padding: 9px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.rename-planet-actions button:last-child {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 14px;
  font: inherit;
  cursor: pointer;
}

.planet-quickswap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 0;
  min-width: 0;
  padding: 0 8px;
  overflow: hidden;
}

.planet-quickswap-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.1);
  background: rgba(3, 10, 20, 0.55);
  padding: 0;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  overflow: hidden;
  flex-shrink: 0;
}

.planet-quickswap-btn:hover {
  border-color: rgba(123, 231, 255, 0.5);
  box-shadow: 0 0 10px rgba(123, 231, 255, 0.25);
}

.planet-quickswap-btn.active {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(123, 231, 255, 0.4);
}

.planet-quickswap-portrait {
  display: block;
  width: 100%;
  height: 100%;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 500% 200%;
}

.resource-strip {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  flex-shrink: 1;
  min-width: 0;
  scrollbar-width: none;
}

.resource-strip::-webkit-scrollbar {
  display: none;
}

.resource-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 84px;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(3, 10, 20, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  box-shadow:
    inset 0 0 18px rgba(123, 231, 255, 0.08),
    0 10px 24px rgba(0, 0, 0, 0.18);
}

.resource-pill strong {
  font-size: 0.95rem;
}

.resource-sprite {
  width: 32px;
  height: 32px;
  display: inline-block;
  flex: 0 0 auto;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  border-radius: 8px;
  background-color: rgba(123, 231, 255, 0.08);
  box-shadow: 0 0 12px rgba(123, 231, 255, 0.18);
}

.playfield {
  position: relative;
  min-height: 0;
  border-radius: 28px;
  background:
    radial-gradient(circle at center, rgba(123, 231, 255, 0.05), transparent 42%),
    rgba(5, 8, 18, 0.26);
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.playfield--starmap {
  height: auto;
  min-height: 0;
  background: rgba(5, 8, 18, 0.18);
}

.playfield--dashboard {
  min-height: calc(100vh - 260px);
  background:
    linear-gradient(90deg, rgba(2, 6, 16, 0.28), rgba(2, 6, 16, 0.72)),
    var(--menu-bg);
  background-size: cover;
  background-position: center;
}

.playfield--social {
  background:
    linear-gradient(90deg, rgba(2, 6, 16, 0.74), rgba(2, 6, 16, 0.48)),
    var(--menu-bg);
  background-size: cover;
  background-position: center;
}

.playfield--starmap .playfield-glow {
  display: none;
}

.playfield-map-host {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.starmap-shell {
  display: grid;
  grid-template-columns: 180px auto minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  box-sizing: border-box;
  height: 100%;
  min-height: 0;
}

.starmap-map-column,
.starmap-info-column {
  min-width: 0;
  min-height: 0;
  display: grid;
  gap: 12px;
  align-content: start;
}

.starmap-map-column {
  aspect-ratio: 1;
  height: 100%;
}

.starmap-info-column {
  overflow-y: auto;
  grid-template-rows: auto auto;
}

.starmap-info-column .planet-details {
  padding: 16px;
}

.starmap-expedition-panel {
  padding: 12px 14px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.playfield--starmap .galaxy-frame {
  min-height: 100%;
  height: 100%;
  border: 0;
  background: linear-gradient(180deg, rgba(2, 4, 10, 0.96), rgba(4, 7, 16, 0.98));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

.galaxy-viewport {
  min-height: 0;
  overflow: hidden;
  border-radius: 20px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.galaxy-viewport.is-dragging {
  cursor: grabbing;
}

.playfield--starmap .galaxy-map {
  background:
    radial-gradient(circle at 20% 20%, rgba(42, 87, 164, 0.18), transparent 22%),
    radial-gradient(circle at 82% 30%, rgba(92, 56, 180, 0.14), transparent 20%),
    radial-gradient(circle at 52% 64%, rgba(55, 117, 111, 0.12), transparent 18%),
    linear-gradient(180deg, rgba(2, 4, 10, 0.98), rgba(2, 4, 10, 0.98));
}

.playfield-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 55%, rgba(123, 231, 255, 0.12), transparent 24%),
    radial-gradient(circle at 65% 40%, rgba(159, 123, 255, 0.09), transparent 18%);
  pointer-events: none;
}

.dashboard-stage {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  min-height: 100%;
  padding: 16px;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr) minmax(240px, 0.5fr);
  align-items: center;
  gap: 18px;
  border-radius: 18px;
  background:
    linear-gradient(90deg, rgba(6, 14, 30, 0.88), rgba(6, 14, 30, 0.58)),
    radial-gradient(circle at 18% 50%, rgba(123, 231, 255, 0.18), transparent 38%);
}

.dashboard-planet-art {
  width: 136px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 500% 200%;
  filter: drop-shadow(0 0 28px rgba(123, 231, 255, 0.32));
}

.dashboard-planet-copy {
  display: grid;
  gap: 10px;
}

.dashboard-planet-copy h2 {
  font-size: clamp(1.7rem, 3vw, 3.4rem);
  max-width: 760px;
}

.dashboard-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dashboard-badges span,
.dashboard-vitals div,
.trait-meter,
.friend-row {
  border: 1px solid rgba(123, 231, 255, 0.12);
  background: rgba(3, 10, 20, 0.52);
}

.dashboard-badges span {
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.82rem;
}

.dashboard-vitals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.dashboard-vitals div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 14px;
}

.dashboard-vitals span,
.trait-meter small,
.friend-row small,
.dashboard-section-head span,
.dashboard-muted {
  color: var(--muted);
  font-size: 0.78rem;
}

.dashboard-vitals strong {
  font-size: 1.05rem;
}

.dashboard-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr) minmax(260px, 0.5fr);
  grid-template-rows: auto auto auto auto;
  gap: 12px;
  align-items: start;
  min-height: 0;
}

#dashboardActivityStatus {
  display: contents;
}

.dashboard-panel,
.dashboard-community {
  border-radius: 18px;
  padding: 14px;
}

.dashboard-orders-panel {
  grid-column: 1 / 3;
}

.dashboard-orbit {
  align-self: stretch;
}

.dashboard-log-panel {
  grid-column: 1;
  grid-row: 3 / 5;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: clamp(200px, calc(100vh - 530px), 480px);
}

.dashboard-reports-panel {
  grid-column: 2;
  grid-row: 3 / 5;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: clamp(200px, calc(100vh - 530px), 480px);
}

.dashboard-log--scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.scout-report-list--scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.dashboard-community {
  grid-column: 3;
  grid-row: 1 / -1;
  align-self: stretch;
}

.dashboard-section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 12px;
}

.dashboard-section-head strong {
  font-size: 0.9rem;
}

.dashboard-traits,
.friend-list,
.scout-report-list {
  display: grid;
  gap: 8px;
}

.scout-report-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(123, 231, 255, 0.12);
  border-radius: 14px;
  padding: 8px;
  color: var(--text);
  text-align: left;
  background: rgba(3, 10, 20, 0.48);
  cursor: pointer;
}

.scout-report-row:hover {
  border-color: rgba(123, 231, 255, 0.32);
}

.scout-report-row small {
  color: var(--muted);
  font-size: 0.74rem;
}

.scout-report-planet {
  width: 42px;
  height: 42px;
}

.community-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 10px;
}

.community-search input {
  min-width: 0;
  border: 1px solid rgba(123, 231, 255, 0.14);
  border-radius: 12px;
  padding: 9px 10px;
  color: var(--text);
  background: rgba(3, 10, 20, 0.58);
  font: inherit;
  outline: none;
}

.community-search input:focus {
  border-color: rgba(123, 231, 255, 0.48);
  box-shadow: 0 0 0 3px rgba(123, 231, 255, 0.1);
}

.community-search button,
.community-result button,
.friend-actions button {
  border: 0;
  border-radius: 12px;
  padding: 9px 10px;
  color: #04111e;
  background: linear-gradient(145deg, #95f3ff, #7aa2ff);
  cursor: pointer;
  font-weight: 800;
  font-size: 0.72rem;
}

.community-result button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.community-results {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.community-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 14px;
  border: 1px solid rgba(123, 231, 255, 0.12);
  background: rgba(3, 10, 20, 0.45);
}

.community-result small,
.community-empty,
.community-error {
  color: var(--muted);
  font-size: 0.76rem;
}

.community-error {
  margin: -2px 0 10px;
  color: var(--danger);
}

.dashboard-traits {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.trait-meter {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border-radius: 14px;
}

.trait-meter .resource-sprite {
  width: 30px;
  height: 30px;
}

.dashboard-orders-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.dashboard-orders-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.dashboard-orders-col-head {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 0 2px 4px;
  border-bottom: 1px solid rgba(123,231,255,0.1);
  margin-bottom: 2px;
}

.dashboard-order-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid rgba(123,231,255,0.1);
  border-radius: 10px;
  background: rgba(3,10,20,0.45);
}

.dashboard-order-row strong {
  font-size: 0.82rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-order-row small {
  font-size: 0.73rem;
  color: var(--accent, #7be3ff);
}

.dashboard-order-idle {
  color: var(--muted);
}

.dashboard-order-sublabel {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mission-status-list {
  display: grid;
  gap: 6px;
}

.mission-status-row {
  position: relative;
  overflow: hidden;
}

.mission-status-progress {
  height: 3px;
  border-radius: 999px;
  background: rgba(123, 231, 255, 0.09);
  overflow: hidden;
}

.mission-status-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--success));
  transition: width 0.5s linear;
}

.dashboard-traits--compact {
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
}

.dashboard-traits--compact .trait-meter {
  padding: 7px 8px;
  gap: 7px;
}

.dashboard-traits--compact .trait-meter .resource-sprite {
  width: 22px;
  height: 22px;
}

.dashboard-traits--compact .trait-meter strong {
  font-size: 0.82rem;
}

.dashboard-traits--compact .trait-meter small {
  font-size: 0.68rem;
}

.dashboard-building-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.dashboard-building {
  position: relative;
  flex: 0 0 82px;
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid rgba(123, 231, 255, 0.12);
  background: rgba(3, 10, 20, 0.5);
}

.dashboard-building span {
  width: 58px;
  aspect-ratio: 1 / 1;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.dashboard-building strong {
  color: var(--success);
  font-size: 0.78rem;
}

.dashboard-log {
  display: grid;
  gap: 7px;
}

.dashboard-log-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 16px;
  align-items: baseline;
  min-width: 0;
}

.dashboard-log-row:has(.log-time--dated) {
  grid-template-columns: 130px minmax(0, 1fr);
}

.dashboard-log-row time {
  color: var(--accent);
  font-size: 0.72rem;
  white-space: nowrap;
}

.dashboard-log-row span {
  color: var(--text);
  font-size: 0.84rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 14px;
  opacity: 0.62;
}

.friend-row.online {
  opacity: 1;
}

.friend-row.offline {
  opacity: 0.48;
}

.friend-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #04111e;
  background: linear-gradient(145deg, #95f3ff, #6ef3b0);
  font-weight: 800;
}

.friend-row.online .friend-avatar::after,
.friend-row.offline .friend-avatar::after {
  content: "";
  position: absolute;
  bottom: 0;
  right: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid #04111e;
}

.friend-row.online .friend-avatar::after {
  background: #6ef3b0;
}

.friend-row.offline .friend-avatar::after {
  background: rgba(255, 255, 255, 0.2);
}

/* In-game alert banners */
.alert-container {
  position: fixed;
  bottom: 24px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 320px;
}

.ingame-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(6, 24, 44, 0.96);
  border: 1px solid rgba(123, 231, 255, 0.35);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.82rem;
  color: #e0f7ff;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
  animation: alertIn 0.25s ease, alertOut 0.4s ease 4.6s forwards;
  max-width: 320px;
}

.alert-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  line-height: 1;
}

@keyframes alertIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes alertOut {
  from { opacity: 1; }
  to   { opacity: 0; transform: translateX(20px); }
}

.friend-row > div:nth-child(2) {
  min-width: 0;
  flex: 1 1 auto;
}

.friend-row strong,
.community-result strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.friend-actions button:last-child {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-backdrop {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(1, 5, 13, 0.72);
  backdrop-filter: blur(8px);
}

.scout-modal {
  position: relative;
  width: min(760px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  display: grid;
  gap: 16px;
  border-radius: 20px;
  background:
    radial-gradient(circle at 16% 16%, rgba(123, 231, 255, 0.14), transparent 32%),
    rgba(6, 14, 30, 0.95);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
}

.scout-modal-hero {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding-right: 34px;
}

.scout-modal-hero h2 {
  font-size: clamp(1.5rem, 3vw, 2.6rem);
}

.scout-modal-grid,
.scout-resource-grid,
.scout-trait-grid {
  display: grid;
  gap: 10px;
}

.scout-modal-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.scout-modal-block,
.scout-resource-grid div,
.scout-trait-grid div {
  display: grid;
  gap: 5px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(123, 231, 255, 0.12);
  background: rgba(3, 10, 20, 0.5);
}

.scout-modal-block span,
.scout-resource-grid small,
.scout-trait-grid span {
  color: var(--muted);
  font-size: 0.78rem;
}

.scout-modal-section {
  display: grid;
  gap: 10px;
}

.scout-resource-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.scout-resource-grid div {
  justify-items: center;
  text-align: center;
}

.scout-trait-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.playfield::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 100% 72px;
  opacity: 0.15;
  pointer-events: none;
}

.bottom-dock {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.submenu-panel {
  min-height: 142px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 0 8px;
  min-width: 0;
  max-width: 100%;
}

.submenu-drawer {
  position: absolute;
  z-index: 3;
  top: 18px;
  right: 18px;
  bottom: 18px;
  width: min(420px, calc(100% - 36px));
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 16px 0 8px;
}

.submenu-drawer .submenu-head {
  padding: 0 16px 12px;
  border-bottom: 1px solid rgba(123,231,255,0.1);
  margin-bottom: 4px;
}

.submenu-drawer .profile-form-scroll,
.submenu-drawer .options-settings-grid {
  padding: 4px 16px 8px;
}

.submenu-drawer .profile-form-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.submenu-drawer .options-settings-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.submenu-drawer .submenu-scroll {
  flex: 1;
  min-height: 0;
  grid-auto-flow: row;
  grid-auto-columns: 100%;
  grid-template-columns: 1fr;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 4px;
}

.submenu-drawer .build-card,
.submenu-drawer .mini-card {
  width: 100%;
  height: auto;
  min-height: 112px;
}

.submenu-drawer .asset-card {
  min-height: 132px;
}

.submenu-drawer .asset-card .build-icon {
  width: min(100%, 112px);
}

.social-stage {
  position: absolute;
  z-index: 3;
  inset: 18px;
  min-width: 0;
  min-height: 0;
}

.social-command-center {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.85fr);
  gap: 14px;
  min-width: 0;
  min-height: 0;
}

.social-pane {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  overflow: hidden;
  border-radius: 18px;
}

.social-pane-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(123, 231, 255, 0.12);
}

.social-pane-head strong {
  font-size: 0.96rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.social-pane-head span {
  color: var(--muted);
  font-size: 0.76rem;
  white-space: nowrap;
}

.social-pane-body {
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.social-pane--messages .chat-panel {
  height: 100%;
  margin-top: 0;
}

.social-pane--messages .chat-messages {
  max-height: none;
}

.submenu-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  align-items: baseline;
  flex-shrink: 0;
}

.submenu-head strong {
  font-size: 0.9rem;
}

.submenu-head span {
  font-size: 0.77rem;
  line-height: 1.3;
}

.submenu-head span,
.submenu-empty div,
.mini-card div,
.building-meta {
  color: var(--muted);
}

.submenu-tabs,
.map-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.submenu-tabs button,
.map-toolbar button {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-weight: 700;
  font-size: 0.84rem;
}

.submenu-tabs button.active {
  color: #04111e;
  border-color: transparent;
  background: linear-gradient(145deg, #95f3ff, #7aa2ff);
}

.map-toolbar button.active {
  color: #04111e;
  border-color: transparent;
  background: linear-gradient(145deg, #95f3ff, #7aa2ff);
}

.map-toolbar {
  justify-content: space-between;
}

.map-control {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
}

.map-control input[type="range"] {
  width: 160px;
}

.map-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
}

.galaxy-frame {
  min-height: 100%;
  overflow: hidden;
  position: relative;
}

.planet-details {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  overflow: auto;
}

.planet-details-hero {
  display: grid;
  gap: 14px;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: start;
}

.planet-details-title {
  display: grid;
  gap: 10px;
}

.planet-details-title p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

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

.planet-missions {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.mission-grid {
  display: grid;
  gap: 8px;
}

.mission-action {
  display: grid;
  gap: 5px;
  width: 100%;
  border: 1px solid rgba(123, 231, 255, 0.14);
  border-radius: 14px;
  padding: 11px 12px;
  color: var(--text);
  text-align: left;
  background:
    linear-gradient(135deg, rgba(123, 231, 255, 0.09), transparent 48%),
    rgba(3, 10, 20, 0.56);
  cursor: pointer;
}

.mission-action:hover {
  border-color: rgba(123, 231, 255, 0.32);
}

.mission-action:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.mission-action span,
.mission-action small {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.25;
}

.mission-modal {
  width: min(520px, 92vw);
  display: grid;
  gap: 14px;
  padding: 20px 22px 18px;
  border-radius: 22px;
  border: 1px solid rgba(123, 231, 255, 0.2);
  background:
    radial-gradient(circle at 18% 12%, rgba(123, 231, 255, 0.13), transparent 38%),
    rgba(3, 10, 20, 0.92);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7);
  max-height: 88vh;
  overflow-y: auto;
}

.mission-modal-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: start;
  gap: 12px;
}

.mission-modal-head .eyebrow {
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 2px;
}

.mission-modal-head strong {
  font-size: 1rem;
  display: block;
}

.mission-modal-duration {
  color: var(--muted);
  font-size: 0.78rem;
  padding-top: 3px;
}

.mission-modal-empty {
  color: var(--muted);
  font-size: 0.82rem;
  padding: 8px 0;
}

.mission-modal-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.mission-modal-actions button:last-child {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.mission-cargo-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.82rem;
}

.mission-cargo-head span {
  color: var(--muted);
}

.mission-cargo-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 8px;
  align-items: center;
}

.mission-ship-list,
.mission-cargo,
.mission-preview {
  display: grid;
  gap: 8px;
}

.mission-ship-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.mission-ship-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  background-color: rgba(3, 10, 20, 0.52);
}

.mission-ship-row small,
.mission-cargo-row span,
.mission-preview span {
  color: var(--muted);
  font-size: 0.74rem;
}

.mission-stepper {
  display: grid;
  grid-template-columns: 30px 30px 30px;
  align-items: center;
  gap: 4px;
}

.mission-stepper span {
  text-align: center;
  font-weight: 800;
}

.mission-stepper button,
.mission-modal-actions button {
  border: 0;
  border-radius: 10px;
  padding: 7px 9px;
  color: #04111e;
  background: linear-gradient(145deg, #95f3ff, #7aa2ff);
  cursor: pointer;
  font-weight: 800;
}

.mission-stepper button:disabled,
.mission-modal-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}


.mission-cargo input {
  width: 100%;
  border: 1px solid rgba(123, 231, 255, 0.14);
  border-radius: 10px;
  padding: 7px 8px;
  color: var(--text);
  background: rgba(2, 8, 18, 0.72);
  font: inherit;
}

.mission-preview {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mission-preview div {
  display: grid;
  gap: 3px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.mission-preview strong {
  font-size: 0.82rem;
}


.planet-detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.planet-detail-row span {
  color: var(--muted);
  min-width: 112px;
}

.planet-detail-row strong {
  text-align: right;
  line-height: 1.35;
}

.planet-portrait--large {
  width: 112px;
  height: 112px;
}

.planet-portrait {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  border: 0;
  background-color: rgba(4, 9, 18, 0.48);
  box-shadow:
    inset 0 0 28px rgba(123, 231, 255, 0.08),
    0 0 22px rgba(123, 231, 255, 0.12);
}

.planet-coords {
  color: var(--muted);
  font-size: 0.85rem;
}

.trait-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.trait-list span {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 0.82rem;
}

.galaxy-map {
  position: relative;
  flex: 0 0 auto;
  transform-origin: 0 0;
  will-change: transform;
}

.planet-node {
  position: absolute;
  transform: translate(-50%, -50%);
  display: grid;
  justify-items: center;
  gap: 4px;
  width: 72px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  z-index: 2;
}

.mission-line {
  position: absolute;
  height: 2px;
  transform-origin: 0 50%;
  pointer-events: none;
  z-index: 1;
  background: linear-gradient(90deg, rgba(123, 231, 255, 0.08), rgba(123, 231, 255, 0.72), rgba(123, 231, 255, 0.12));
  box-shadow: 0 0 14px rgba(123, 231, 255, 0.24);
}

.mission-line--attack {
  background: linear-gradient(90deg, rgba(255, 122, 144, 0.08), rgba(255, 122, 144, 0.76), rgba(255, 122, 144, 0.12));
  box-shadow: 0 0 14px rgba(255, 122, 144, 0.3);
}

.mission-line--transport,
.mission-line--colonize {
  background: linear-gradient(90deg, rgba(110, 243, 176, 0.08), rgba(110, 243, 176, 0.76), rgba(110, 243, 176, 0.12));
  box-shadow: 0 0 14px rgba(110, 243, 176, 0.28);
}

.mission-marker {
  position: absolute;
  z-index: 3;
  transform: translate(18px, -50%);
  display: grid;
  grid-template-columns: 24px auto;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(123, 231, 255, 0.22);
  border-radius: 999px;
  padding: 4px 8px 4px 4px;
  color: var(--text);
  background: rgba(3, 10, 20, 0.82);
  box-shadow: 0 0 18px rgba(123, 231, 255, 0.18);
  cursor: help;
}

.mission-marker span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #04111e;
  background: linear-gradient(145deg, #95f3ff, #7aa2ff);
  font-size: 0.72rem;
  font-weight: 900;
}

.mission-marker small {
  color: var(--muted);
  font-size: 0.64rem;
  white-space: nowrap;
}

.mission-marker--attack span {
  background: linear-gradient(145deg, #ff9aac, #ff617d);
}

.mission-marker--transport span,
.mission-marker--colonize span {
  background: linear-gradient(145deg, #9dffd3, #4be99a);
}

.planet-node.undiscovered {
  opacity: 0.52;
}

.planet-node.undiscovered .planet-art {
  filter: grayscale(0.35) drop-shadow(0 0 12px rgba(151, 168, 202, 0.16));
}

.planet-node strong,
.planet-node small {
  display: none;
}

.planet-node.labels-visible strong,
.planet-node.labels-visible small {
  display: block;
}

.planet-node strong,
.planet-node small {
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.75);
}

.planet-node strong {
  font-size: 0.72rem;
}

.planet-node small {
  font-size: 0.6rem;
  color: var(--muted);
}

.planet-node .planet-art {
  width: 56px;
  height: 56px;
  display: block;
  background-repeat: no-repeat;
  background-size: 500% 200%;
  background-color: rgba(4, 9, 18, 0.42);
  border-radius: 50%;
  box-shadow:
    inset 0 0 18px rgba(123, 231, 255, 0.08),
    0 0 16px rgba(123, 231, 255, 0.18);
  filter: drop-shadow(0 0 18px rgba(123, 231, 255, 0.2));
}

.planet-node.home .planet-art {
  filter: drop-shadow(0 0 22px rgba(123, 231, 255, 0.45));
}

.planet-node.owned .planet-art {
  outline: 3px solid rgba(110, 243, 176, 0.68);
  box-shadow:
    inset 0 0 18px rgba(123, 231, 255, 0.08),
    0 0 24px rgba(110, 243, 176, 0.34);
}

.planet-node.friend .planet-art {
  outline: 3px solid rgba(123, 231, 255, 0.62);
  box-shadow:
    inset 0 0 18px rgba(123, 231, 255, 0.08),
    0 0 24px rgba(123, 231, 255, 0.34);
}

.planet-node.hostile .planet-art {
  outline: 3px solid rgba(255, 122, 144, 0.72);
  box-shadow:
    inset 0 0 18px rgba(255, 122, 144, 0.1),
    0 0 26px rgba(255, 122, 144, 0.38);
}

.planet-node.owned::after,
.planet-node.friend::after,
.planet-node.hostile::after {
  position: absolute;
  top: -5px;
  right: 3px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: #04111e;
  font-size: 0.58rem;
  font-weight: 900;
}

.planet-node.owned::after {
  content: "E";
  background: #6ef3b0;
}

.planet-node.friend::after {
  content: "F";
  background: #7be7ff;
}

.planet-node.hostile::after {
  content: "!";
  color: var(--text);
  background: #ff617d;
}

.planet-node.selected .planet-art {
  outline: 2px solid rgba(123, 231, 255, 0.45);
  border-radius: 50%;
}

.researched {
  border-color: rgba(110, 243, 176, 0.35);
}

.asset-card.locked {
  border-color: rgba(255, 80, 80, 0.22);
  opacity: 0.62;
  filter: grayscale(0.5);
}

.asset-card.locked .build-icon {
  filter: brightness(0.55) sepia(0.3);
}

.asset-card.locked .tag {
  color: rgba(255, 130, 130, 0.9);
}

.asset-card.unaffordable {
  border-color: rgba(255, 80, 80, 0.35);
  background: radial-gradient(ellipse at 50% 0%, rgba(255, 60, 60, 0.07) 0%, transparent 70%),
              linear-gradient(160deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
}

.asset-card.unaffordable .build-icon {
  filter: brightness(0.75) sepia(0.2) hue-rotate(-10deg);
}

.asset-card.unaffordable .tag {
  color: rgba(255, 130, 100, 0.9);
}

.queue-banner {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(123, 231, 255, 0.14);
}

.queue-banner div {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
}

.submenu-scroll {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 180px;
  gap: 10px;
  overflow-x: auto;
  padding: 0 10px 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(123, 231, 255, 0.25) transparent;
}

.submenu-scroll::-webkit-scrollbar {
  height: 4px;
}

.submenu-scroll::-webkit-scrollbar-thumb {
  background: rgba(123, 231, 255, 0.25);
  border-radius: 2px;
}

.build-scroll {
  grid-auto-columns: 180px;
}

.build-card,
.mini-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 18px;
  padding: 8px;
  width: 180px;
  height: 208px;
  box-sizing: border-box;
  overflow: hidden;
}

.asset-card {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  cursor: pointer;
  text-align: center;
  background:
    radial-gradient(circle at 50% 36%, rgba(123, 231, 255, 0.18), transparent 44%),
    linear-gradient(180deg, rgba(6, 16, 33, 0.84), rgba(3, 8, 18, 0.92));
  border-color: rgba(123, 231, 255, 0.16);
  box-shadow:
    inset 0 0 28px rgba(123, 231, 255, 0.08),
    0 18px 34px rgba(0, 0, 0, 0.22);
}

.asset-card header,
.asset-card .building-meta,
.asset-card .actions {
  display: none;
}

.asset-card .build-icon {
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
}

.asset-card .tag {
  position: absolute;
  top: 8px;
  right: 8px;
}

.asset-card-name {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 600;
  color: rgba(200, 232, 240, 0.8);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 4px;
  margin-top: 2px;
}

.asset-card-sub {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 0.6rem;
  color: rgba(160, 200, 220, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 4px;
}

.hover-tooltip {
  position: fixed;
  z-index: 9999;
  max-width: 380px;
  min-width: 280px;
  border-radius: 14px;
  background: rgba(5, 10, 22, 0.98);
  border: 1px solid rgba(123, 231, 255, 0.22);
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1.45;
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(0, 0, 0, 0.5) inset;
  pointer-events: none;
  overflow: hidden;
  /* legacy plain-text support */
  white-space: pre-line;
  padding: 12px 14px;
}

/* When HTML tooltip is active, override padding via tt-inner */
.hover-tooltip .tt-inner {
  white-space: normal;
  padding: 12px 14px;
}

.hover-tooltip:has(.tt-inner) {
  padding: 0;
  white-space: normal;
}

/* ── Tooltip inner sections ──────────────────────────────────────────────── */
.tt-inner {
  display: flex;
  flex-direction: column;
}

.tt-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: rgba(210, 238, 255, 0.98);
  letter-spacing: 0.02em;
  padding: 13px 16px 10px;
  line-height: 1.2;
}

.tt-sep {
  height: 1px;
  background: rgba(123, 231, 255, 0.13);
  margin: 0;
  flex-shrink: 0;
}

.tt-desc {
  font-size: 0.8rem;
  color: rgba(165, 200, 220, 0.78);
  padding: 9px 16px;
  line-height: 1.5;
}

/* ── Stats grid ──────────────────────────────────────────────────────────── */
.tt-stats {
  padding: 8px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.tt-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.tt-stat-label {
  color: rgba(155, 195, 220, 0.7);
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.tt-stat-val {
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(210, 235, 252, 0.92);
  text-align: right;
  white-space: nowrap;
}

.tt-stat-val.tt-pos { color: rgba(110, 243, 176, 0.92); }
.tt-stat-val.tt-neg { color: rgba(255, 140, 100, 0.88); }

/* ── Resource icon in tooltip ────────────────────────────────────────────── */
.tt-res-icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  background-repeat: no-repeat;
  vertical-align: middle;
  flex-shrink: 0;
  border-radius: 3px;
  image-rendering: pixelated;
}

/* ── Requirements ────────────────────────────────────────────────────────── */
.tt-reqs-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(150, 185, 210, 0.5);
  padding: 8px 16px 4px;
}

.tt-reqs {
  padding: 0 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tt-req {
  font-size: 0.8rem;
  padding: 2px 0;
}

.tt-req--met {
  color: rgba(110, 243, 176, 0.88);
}

.tt-req--unmet {
  color: rgba(255, 100, 90, 0.92);
}

/* ── Cost row ────────────────────────────────────────────────────────────── */
.tt-cost-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 9px 16px 13px;
  background: rgba(0, 0, 0, 0.22);
}

.tt-cost-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(210, 230, 250, 0.88);
  white-space: nowrap;
}
.tt-cost-item.tt-cost-missing {
  color: rgba(255, 90, 90, 0.95);
}

.asset-card::after {
  content: none;
}

.build-card {
  display: grid;
  gap: 6px;
}

.build-icon {
  width: 100%;
  aspect-ratio: 1 / 1;
  min-height: 76px;
  border-radius: 14px;
  background-color: rgba(4, 9, 18, 0.52);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  border: 1px solid rgba(123, 231, 255, 0.12);
  box-shadow:
    inset 0 0 22px rgba(123, 231, 255, 0.08),
    0 0 22px rgba(123, 231, 255, 0.1);
}

/* Placeholder when no image is available yet */
.build-icon:not([style*="background-image"]) {
  border-style: dashed;
  border-color: rgba(123, 231, 255, 0.18);
  background-image: none;
  position: relative;
}

.build-icon:not([style*="background-image"])::after {
  content: "?";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: rgba(123, 231, 255, 0.2);
  pointer-events: none;
}

.build-card header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}

.build-card header > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.build-card header strong,
.mini-card strong {
  line-height: 1.1;
}

.build-card .actions,
.mini-card .actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.build-card .building-meta {
  font-size: 0.77rem;
  line-height: 1.18;
}

.build-card header .building-meta {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.build-card button,
.mini-card button,
.menu-bar button {
  border: 0;
  border-radius: 14px;
  padding: 7px 10px;
  color: #04111e;
  background: linear-gradient(145deg, #95f3ff, #7aa2ff);
  cursor: pointer;
  font-weight: 700;
  font-size: 0.82rem;
}

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

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

.options-stack button {
  width: 100%;
  border: 1px solid rgba(123, 231, 255, 0.16);
  border-radius: 14px;
  padding: 10px 12px;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 20%, rgba(123, 231, 255, 0.14), transparent 38%),
    rgba(5, 12, 26, 0.82);
  cursor: pointer;
  font-weight: 700;
  text-align: left;
}

/* ─── Options Settings Tab ───────────────────────────────────────────────── */

.options-settings-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.options-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(123,231,255,0.1);
  border-radius: 12px;
  background: rgba(3,10,20,0.4);
}

.options-setting-row > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.options-setting-row strong {
  font-size: 0.85rem;
}

.options-setting-row small {
  font-size: 0.72rem;
  color: var(--muted);
}

.options-setting-row button {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
}

.btn-danger {
  background: rgba(220,60,60,0.18);
  border-color: rgba(220,60,60,0.4);
  color: #ff8888;
}

/* ─── Profile Form ───────────────────────────────────────────────────────── */

.profile-form-scroll {
  overflow-y: auto;
  padding: 4px 2px;
  flex: 1;
  min-height: 0;
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px 0;
}

.profile-form-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(123,231,255,0.1);
  border-radius: 12px;
  background: rgba(3,10,20,0.35);
}

.profile-form-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-form-label span {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.profile-form-label input,
.profile-form-label textarea {
  background: rgba(123,231,255,0.04);
  border: 1px solid rgba(123,231,255,0.14);
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
  resize: vertical;
}

.profile-form-label input:focus,
.profile-form-label textarea:focus {
  outline: none;
  border-color: rgba(123,231,255,0.4);
}

.profile-form-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.75rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  margin-top: 2px;
}

.profile-form-toggle input[type=checkbox] {
  accent-color: var(--accent, #7be3ff);
  width: 14px;
  height: 14px;
}

.profile-form-error {
  color: #ff7070;
  font-size: 0.78rem;
  padding: 4px 2px;
}

.profile-form-saved {
  color: #7bff9e;
  font-size: 0.78rem;
  padding: 4px 2px;
}

.profile-form-save {
  padding: 9px 20px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.85rem;
  align-self: flex-start;
}

/* ─── Profile Modal Extended Fields ─────────────────────────────────────── */

.social-profile-modal-since {
  color: var(--muted);
  font-size: 0.73rem;
}

.profile-modal-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(123,231,255,0.1);
}

.profile-modal-detail {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 0.82rem;
}

.profile-modal-detail span {
  color: var(--muted);
  font-size: 0.72rem;
  flex-shrink: 0;
}

.profile-modal-bio {
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

.profile-modal-bio p {
  margin: 0;
  line-height: 1.5;
  color: var(--text);
  font-size: 0.8rem;
  white-space: pre-wrap;
}

.menu-bar {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  align-content: stretch;
}

.menu-bar button {
  min-width: 0;
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
  font-size: 0.85rem;
  padding: 13px 10px;
  letter-spacing: 0.01em;
}

.menu-bar button.active {
  color: #04111e;
  border-color: transparent;
  background: linear-gradient(145deg, #95f3ff, #7aa2ff);
}

.submenu-empty {
  display: grid;
  gap: 8px;
  min-height: 120px;
  place-content: center;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 900px) {
  .game-shell {
    padding: 14px;
  }

  .top-hud {
    flex-direction: column;
    align-items: flex-start;
  }

  .resource-strip {
    justify-content: flex-start;
  }

  .submenu-scroll {
    grid-auto-flow: row;
    grid-auto-columns: 100%;
  }

  .bottom-dock {
    grid-template-columns: 1fr;
  }

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

  .playfield--starmap {
    height: auto;
    min-height: 72vh;
  }

  .playfield--dashboard {
    min-height: 76vh;
  }

  .starmap-shell {
    grid-template-columns: 1fr;
  }

  .dashboard-hero,
  .dashboard-main {
    grid-template-columns: 1fr;
  }

  .dashboard-community {
    grid-column: auto;
    grid-row: auto;
  }

  .dashboard-vitals,
  .dashboard-traits,
  .dashboard-orders-grid,
  .scout-modal-grid,
  .scout-resource-grid,
  .scout-trait-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-orders-panel {
    grid-column: auto;
  }

  .dashboard-hero {
    justify-items: start;
  }

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

  .build-card,
  .mini-card {
    width: 100%;
    height: auto;
  }

  .build-card {
    min-height: 0;
  }

  .menu-bar {
    flex-wrap: wrap;
  }

  .menu-bar button {
    flex: 1 1 calc(50% - 10px);
  }

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

/* ---- Chat Panel ---- */
.chat-panel {
  margin-top: 12px;
  border: 1px solid rgba(123, 231, 255, 0.2);
  border-radius: 14px;
  background: rgba(3, 10, 20, 0.6);
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(123, 231, 255, 0.1);
  font-size: 0.82rem;
}

.chat-header button {
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.9rem;
  line-height: 1;
}

.chat-header button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  max-height: 180px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-empty {
  color: var(--muted);
  font-size: 0.76rem;
  text-align: center;
  padding: 12px 0;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.chat-msg--me {
  align-items: flex-end;
}

.chat-body {
  background: rgba(123, 231, 255, 0.1);
  border-radius: 10px 10px 10px 2px;
  padding: 5px 10px;
  font-size: 0.82rem;
  max-width: 85%;
  word-break: break-word;
}

.chat-msg--me .chat-body {
  background: rgba(110, 243, 176, 0.15);
  border-radius: 10px 10px 2px 10px;
}

.chat-time {
  font-size: 0.68rem;
  color: var(--muted);
  padding: 0 4px;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid rgba(123, 231, 255, 0.1);
}

.chat-form input {
  min-width: 0;
  border: 1px solid rgba(123, 231, 255, 0.14);
  background: rgba(3, 10, 20, 0.6);
  border-radius: 8px;
  padding: 6px 10px;
  color: var(--text);
  font-size: 0.82rem;
}

.chat-form button {
  border: 0;
  border-radius: 10px;
  padding: 6px 12px;
  background: var(--accent);
  color: #04111e;
  font-weight: 700;
  font-size: 0.76rem;
  cursor: pointer;
}

.chat-btn {
  border: none;
  background: rgba(123, 231, 255, 0.1);
  border-radius: 8px;
  padding: 4px 8px;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
}

.chat-btn:hover {
  background: rgba(123, 231, 255, 0.2);
}

/* ---- Leaderboard ---- */
.leaderboard-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 12px 8px;
}

.leaderboard-loading {
  color: var(--muted);
  font-size: 0.82rem;
  padding: 16px 0;
  text-align: center;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  grid-template-rows: auto auto;
  gap: 2px 10px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(123, 231, 255, 0.1);
  background: rgba(3, 10, 20, 0.4);
  flex-shrink: 0;
  transition: border-color 0.2s;
}

.leaderboard-row--me {
  border-color: rgba(123, 231, 255, 0.45);
  background: rgba(123, 231, 255, 0.06);
}

.leaderboard-rank {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--muted);
}

.leaderboard-row--me .leaderboard-rank {
  color: var(--accent);
}

.leaderboard-name {
  font-weight: 700;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-pts {
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--accent);
}

.leaderboard-breakdown {
  grid-column: 2 / 4;
  display: flex;
  gap: 10px;
  font-size: 0.72rem;
  color: var(--muted);
  flex-wrap: wrap;
}

/* ================================================================
   SOCIAL — Nachrichten + Clan
   ================================================================ */

.menu-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 0 4px;
  margin-left: 4px;
  vertical-align: middle;
  line-height: 1;
}

/* Conversation list */
.social-conv-list { display: grid; gap: 6px; }

.social-conv-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border-radius: 14px;
  border: 1px solid rgba(123, 231, 255, 0.12);
  background: rgba(3, 10, 20, 0.48);
  cursor: pointer;
  text-align: left;
  color: var(--text);
  width: 100%;
}

.social-conv-row:hover { border-color: rgba(123, 231, 255, 0.32); }

.social-conv-body { display: grid; gap: 2px; min-width: 0; }

.social-conv-name {
  font-weight: 700;
  font-size: 0.84rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.social-conv-snippet {
  color: var(--muted);
  font-size: 0.74rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.social-conv-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.social-conv-time { color: var(--muted); font-size: 0.68rem; white-space: nowrap; }

.social-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px rgba(123, 231, 255, 0.7);
}

/* Clan no-clan option cards */
.social-clan-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.social-option-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(123, 231, 255, 0.14);
  background: rgba(3, 10, 20, 0.52);
}

.social-option-card strong { font-size: 0.88rem; color: var(--accent); }

.social-option-card input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 9px 10px;
  background: rgba(3, 10, 20, 0.65);
  color: var(--text);
  font: inherit;
  outline: none;
}

.social-option-card input:focus {
  border-color: rgba(123, 231, 255, 0.48);
  box-shadow: 0 0 0 3px rgba(123, 231, 255, 0.10);
}

.social-option-card button[type="submit"] {
  border: 0;
  border-radius: 12px;
  padding: 9px 12px;
  color: #04111e;
  background: linear-gradient(145deg, #95f3ff, #7aa2ff);
  cursor: pointer;
  font-weight: 800;
  font-size: 0.82rem;
}

/* Clan list */
.social-clan-list { display: grid; gap: 6px; max-height: 260px; overflow-y: auto; }

.social-clan-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 14px;
  border: 1px solid rgba(123, 231, 255, 0.12);
  background: rgba(3, 10, 20, 0.48);
}

.social-clan-row-info { flex: 1 1 auto; min-width: 0; }
.social-clan-row-name { font-weight: 700; font-size: 0.84rem; }
.social-clan-row-meta { color: var(--muted); font-size: 0.72rem; }

.social-clan-tag {
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(159, 123, 255, 0.4);
  color: var(--accent-2);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

/* Clan overview header */
.social-clan-header {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(123, 231, 255, 0.18);
  background: linear-gradient(135deg, rgba(123, 231, 255, 0.08), transparent 50%), rgba(3, 10, 20, 0.56);
  margin-bottom: 8px;
}

.social-clan-header-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 700;
}

.social-clan-header-stats {
  color: var(--muted);
  font-size: 0.74rem;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

/* Member list */
.social-member-list { display: grid; gap: 6px; }

.social-member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(123, 231, 255, 0.10);
  background: rgba(3, 10, 20, 0.44);
}

.social-member-info { flex: 1 1 auto; min-width: 0; }
.social-member-name { font-weight: 700; font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.social-member-pts { color: var(--muted); font-size: 0.70rem; }

/* Role badges */
.role-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.role-badge--leader {
  background: rgba(123, 231, 255, 0.18);
  border: 1px solid rgba(123, 231, 255, 0.35);
  color: var(--accent);
}

.role-badge--member {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: var(--muted);
}

/* Join request rows */
.social-request-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(123, 231, 255, 0.12);
  background: rgba(3, 10, 20, 0.48);
  flex-wrap: wrap;
}

.social-request-info { flex: 1 1 auto; min-width: 0; }
.social-request-name { font-weight: 700; font-size: 0.82rem; }
.social-request-pts { color: var(--muted); font-size: 0.70rem; }
.social-request-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; }

/* Shared small action buttons */
.social-btn {
  border: 0;
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  font-weight: 800;
  font-size: 0.72rem;
  font-family: inherit;
}

.social-btn--primary { color: #04111e; background: linear-gradient(145deg, #95f3ff, #7aa2ff); }
.social-btn--ghost { color: var(--text); background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.10); }
.social-btn--danger { color: #fff; background: rgba(255, 122, 144, 0.18); border: 1px solid rgba(255, 122, 144, 0.35); }
.social-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Section dividers */
.social-section { display: grid; gap: 8px; margin-top: 10px; }

.social-section-head {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* Pending invite banners */
.social-invite-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(159, 123, 255, 0.35);
  background: linear-gradient(135deg, rgba(159, 123, 255, 0.12), transparent 50%), rgba(3, 10, 20, 0.56);
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.social-invite-text { flex: 1 1 auto; font-size: 0.78rem; min-width: 0; }

/* Profile modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.social-profile-modal {
  position: relative;
  width: min(400px, 100%);
  display: grid;
  gap: 16px;
  border-radius: 20px;
  background: radial-gradient(circle at 16% 16%, rgba(123, 231, 255, 0.12), transparent 34%), rgba(6, 14, 30, 0.96);
  padding: 24px;
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
}

.modal-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  border: 0;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  cursor: pointer;
  color: var(--text);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.social-profile-modal-head { display: flex; align-items: center; gap: 14px; padding-right: 34px; }
.social-profile-modal-name { font-size: 1.05rem; font-weight: 700; }

.friend-avatar--lg {
  width: 44px;
  height: 44px;
  font-size: 1.1rem;
  min-width: 44px;
}

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

.social-profile-stat {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(123, 231, 255, 0.12);
  background: rgba(3, 10, 20, 0.5);
}

.social-profile-stat span { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.10em; }
.social-profile-stat strong { font-size: 1rem; }

/* Invite search */
.social-invite-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.social-invite-search input {
  min-width: 0;
  border: 1px solid rgba(123, 231, 255, 0.14);
  border-radius: 12px;
  padding: 9px 10px;
  color: var(--text);
  background: rgba(3, 10, 20, 0.58);
  font: inherit;
  outline: none;
}

.social-invite-search input:focus {
  border-color: rgba(123, 231, 255, 0.48);
  box-shadow: 0 0 0 3px rgba(123, 231, 255, 0.1);
}

.social-invite-results { display: grid; gap: 6px; margin-top: 4px; }

.social-invite-result {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(123, 231, 255, 0.12);
  background: rgba(3, 10, 20, 0.44);
}

.social-invite-result-name { flex: 1 1 auto; font-size: 0.82rem; font-weight: 700; }

/* Clan overview — full-width two-column layout */
.clan-overview {
  display: grid;
  gap: 12px;
  padding: 12px;
  height: 100%;
  box-sizing: border-box;
}

.clan-overview-header {
  padding: 16px 20px;
  border-radius: 16px;
  border: 1px solid rgba(123, 231, 255, 0.2);
  background: linear-gradient(135deg, rgba(123, 231, 255, 0.10), transparent 60%), rgba(3, 10, 20, 0.6);
}

.clan-overview-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--text);
  margin-bottom: 6px;
}

.clan-overview-meta {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.78rem;
}

.clan-overview-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-height: 0;
}

.clan-overview-left,
.clan-overview-right {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  overflow-y: auto;
}

.social-subpanel {
  border: 1px solid rgba(123, 231, 255, 0.12);
  background: rgba(3, 10, 20, 0.42);
}

.clan-overview-placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(123, 231, 255, 0.15);
  border-radius: 12px;
  color: var(--muted);
  font-size: 0.78rem;
  min-height: 80px;
}

/* Dashboard "Alle Nachrichten →" button */
.social-goto-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 7px 10px;
  border: 1px solid rgba(123, 231, 255, 0.18);
  border-radius: 10px;
  background: transparent;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  text-align: right;
}

.social-goto-btn:hover { background: rgba(123, 231, 255, 0.06); }


/* ── Forschungs-Pfad-Tabs — gleicher Style wie submenu-tabs ─────────────── */
.research-path-tabs {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.research-path-tab {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
}
.research-path-tab:hover { background: rgba(255, 255, 255, 0.07); }
.research-path-tab.active {
  color: #04111e;
  border-color: transparent;
  background: linear-gradient(145deg, #95f3ff, #7aa2ff);
}

/* ── Gebaeude-Upgrade ────────────────────────────────────────────────────── */
.build-card-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.building-upgrade-btn {
  width: 100%;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid rgba(123,231,255,0.3);
  background: rgba(123,231,255,0.07);
  color: var(--accent);
  font-size: 0.7rem;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.building-upgrade-btn:hover:not([disabled]) { background: rgba(123,231,255,0.15); }
.building-upgrade-btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.building-maxlevel {
  font-size: 0.65rem;
  color: var(--muted);
  opacity: 0.7;
}

/* ── Schiffs-Klassen-Badge ───────────────────────────────────────────────── */
.ship-class-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-left: 4px;
}
.ship-class-badge--light  { background: rgba(123,231,255,0.15); color: #7be7ff; }
.ship-class-badge--medium { background: rgba(255,200,80,0.15);  color: #ffc850; }
.ship-class-badge--heavy  { background: rgba(255,90,90,0.15);   color: #ff5a5a; }
.ship-class-badge--stealth{ background: rgba(160,80,255,0.15);  color: #a050ff; }

/* ── Clan-Chat ───────────────────────────────────────────────────────────── */
.clan-chat-messages {
  min-height: 140px;
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: rgba(3,10,20,0.4);
  border-radius: 8px;
  border: 1px solid rgba(123,231,255,0.1);
  margin-bottom: 8px;
  scroll-behavior: smooth;
}
.clan-chat-msg {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.clan-chat-msg-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.clan-chat-msg-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
}
.clan-chat-msg-time {
  font-size: 0.65rem;
  color: var(--muted);
  opacity: 0.7;
  flex-shrink: 0;
}
.clan-chat-msg-body {
  font-size: 0.8rem;
  color: #c8d8e8;
  line-height: 1.4;
  word-break: break-word;
}
.clan-chat-loading, .clan-chat-empty {
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
  padding: 12px 0;
  opacity: 0.7;
}
.clan-chat-form {
  display: flex;
  gap: 6px;
}
.clan-chat-form input {
  flex: 1;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(123,231,255,0.2);
  background: rgba(3,10,20,0.5);
  color: #e0eaff;
  font-size: 0.8rem;
}
.clan-chat-form input:focus { outline: none; border-color: var(--accent); }

/* ─── Planet List Sidebar ─────────────────────────────────────────────────── */

.starmap-planet-list {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.planet-list-sidebar {
  background: var(--panel-bg, rgba(12,18,32,0.97));
  border: 1px solid rgba(123,231,255,0.12);
  border-radius: 14px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  overflow-y: auto;
}

.planet-list-head {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted, #7ecff4);
  padding: 4px 6px 8px;
  border-bottom: 1px solid rgba(123,231,255,0.1);
  margin-bottom: 4px;
}

.planet-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
  width: 100%;
}

.planet-list-item:hover {
  background: rgba(123,231,255,0.06);
  border-color: rgba(123,231,255,0.18);
}

.planet-list-item.active {
  background: rgba(123,231,255,0.12);
  border-color: rgba(123,231,255,0.35);
}

.planet-list-portrait {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  display: inline-block;
  image-rendering: pixelated;
}

.planet-list-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.planet-list-info strong {
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text, #e8f4ff);
}

.planet-list-info small {
  font-size: 0.62rem;
  color: var(--muted, #7ecff4);
}

.planet-list-empty {
  font-size: 0.68rem;
  color: var(--muted, #7ecff4);
  padding: 8px 6px;
  text-align: center;
}

/* ─── Blind Expedition Panel ─────────────────────────────────────────────── */

.expedition-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0;
}

.expedition-desc {
  font-size: 0.75rem;
  color: var(--muted, #7ecff4);
  line-height: 1.5;
  margin: 0;
}

.expedition-inputs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.expedition-inputs label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
}

.expedition-inputs label span:first-child {
  min-width: 70px;
  color: var(--muted, #7ecff4);
}

.expedition-inputs input[type="range"] {
  flex: 1;
  accent-color: var(--accent, #7ecff4);
}

.expedition-preview {
  background: rgba(123,231,255,0.06);
  border: 1px solid rgba(123,231,255,0.12);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.73rem;
  color: var(--muted, #7ecff4);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.expedition-preview div {
  white-space: nowrap;
}

.expedition-active {
  background: rgba(255, 200, 80, 0.08);
  border: 1px solid rgba(255, 200, 80, 0.2);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.75rem;
  color: #ffd86e;
}

.expedition-active strong {
  display: block;
  margin-bottom: 4px;
}

[data-launch-expedition] {
  align-self: flex-start;
  background: rgba(123,231,255,0.1);
  border: 1px solid rgba(123,231,255,0.3);
  color: var(--accent, #7ecff4);
  border-radius: 8px;
  padding: 7px 18px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

[data-launch-expedition]:hover:not(:disabled) {
  background: rgba(123,231,255,0.18);
}

[data-launch-expedition]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 900px) {
  .starmap-shell {
    grid-template-columns: 1fr;
  }
  .starmap-planet-list {
    display: none;
  }

  .social-stage {
    inset: 10px;
  }

  .social-command-center {
    grid-template-columns: 1fr;
  }

  .social-pane--messages {
    min-height: 360px;
  }

  .clan-overview-body {
    grid-template-columns: 1fr;
  }
}

/* ─── Berichte / Reports ──────────────────────────────────────────────────── */

.report-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 4px;
  border-bottom: 1px solid rgba(123,231,255,0.07);
}

button.report-row {
  width: 100%;
  color: inherit;
  text-align: left;
  background: transparent;
  border-top: 0;
  border-right: 0;
  border-left: 0;
  cursor: pointer;
}

button.report-row:hover {
  background: rgba(123, 231, 255, 0.06);
}

.report-row:last-child { border-bottom: none; }

.report-incoming .report-badge {
  color: #ff9f7a;
  background: rgba(255,100,50,0.12);
}

.report-outgoing .report-badge {
  color: #7bdcff;
  background: rgba(100,200,255,0.1);
}

.report-badge {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}

.report-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

.report-body span {
  font-size: 0.72rem;
  color: var(--text, #e8f4ff);
  line-height: 1.4;
}

.report-body small {
  font-size: 0.62rem;
  color: var(--muted, #7ecff4);
}

/* ─── Submenu Menu Header ─────────────────────────────────────────────────── */

.submenu-menu-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px 8px 18px;
  border-bottom: 1px solid rgba(123,231,255,0.1);
  margin-bottom: 2px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.submenu-menu-header-title {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text);
  white-space: nowrap;
}

.submenu-stats-strip {
  display: flex;
  gap: 6px;
  padding: 6px 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.submenu-stats-strip--empty {
  color: var(--muted);
  font-size: 0.8rem;
  padding: 8px 12px;
}

.submenu-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(123,231,255,0.05);
  border: 1px solid rgba(123,231,255,0.1);
  border-radius: 10px;
  padding: 6px 10px;
  min-width: 72px;
}

.submenu-stat span {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.submenu-stat strong {
  font-size: 0.9rem;
  color: var(--text);
}

.submenu-stat .stat-warn {
  color: #ff7070;
}

.submenu-stat .stat-bonus {
  color: #7be3ff;
}

.submenu-tabs--inline {
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
}

.research-path-tabs--inline {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* ─── Queue Bar ───────────────────────────────────────────────────────────── */

.queue-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  margin: 0 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(123,231,255,0.12);
  min-height: 56px;
  flex-shrink: 0;
}

.queue-bar--empty {
  color: var(--muted);
  font-size: 0.8rem;
}

.queue-bar-label {
  font-size: 0.58rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  white-space: nowrap;
  flex-shrink: 0;
  padding: 2px 0;
}

.queue-bar-empty {
  font-size: 0.78rem;
  color: var(--muted);
}

.queue-bar-items {
  display: flex;
  gap: 6px;
  align-items: center;
  overflow-x: auto;
  flex: 1;
  min-width: 0;
}

.queue-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  position: relative;
}

.queue-item--active {
  min-width: 72px;
}

.queue-item--pending {
  min-width: 52px;
  opacity: 0.6;
}

.queue-item-art {
  border-radius: 8px;
  image-rendering: pixelated;
  background-repeat: no-repeat;
}

.queue-item--active .queue-item-art {
  width: 48px;
  height: 48px;
  background-size: var(--sprite-size, 200px);
  border: 1px solid rgba(123,231,255,0.3);
  box-shadow: 0 0 10px rgba(123,231,255,0.15);
}

.queue-item--pending .queue-item-art {
  width: 34px;
  height: 34px;
  background-size: var(--sprite-size, 200px);
  border: 1px solid rgba(123,231,255,0.15);
}

.queue-item-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  max-width: 72px;
}

.queue-item-info strong {
  font-size: 0.62rem;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 72px;
  color: var(--text);
}

.queue-item-info small {
  font-size: 0.58rem;
  color: var(--accent);
  text-align: center;
}

.queue-item-progress {
  position: absolute;
  bottom: 18px;
  left: 2px;
  right: 2px;
  height: 2px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
}

.queue-item-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 1s linear;
}

/* ─── Context Menu ─────────────────────────────────────────────────────────── */

#contextMenu {
  position: fixed;
  z-index: 9999;
  min-width: 180px;
  background: #0c1a28;
  border: 1px solid rgba(123, 231, 255, 0.25);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.7);
  padding: 4px 0;
  animation: ctx-fadein 0.1s ease;
}

@keyframes ctx-fadein {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

.ctx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 16px;
  background: none;
  border: none;
  color: #c8e8f0;
  font-size: 0.83rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}

.ctx-item:hover {
  background: rgba(123, 231, 255, 0.12);
  color: #fff;
}

.ctx-item--danger {
  color: #ff7b7b;
}

.ctx-item--danger:hover {
  background: rgba(255, 80, 80, 0.15);
  color: #ff9999;
}

.ctx-separator {
  height: 1px;
  margin: 3px 10px;
  background: rgba(123, 231, 255, 0.12);
}

.friend-row { cursor: context-menu; }
.social-member-row { cursor: context-menu; }

/* ─── Detail Playfieldss (Bauen / Militär / Forschung) ────────────────────── */

.playfield--detail {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 24px;
  display: flex;
  align-items: stretch;
  min-width: 0;
}

.playfield--detail > * {
  min-width: 0;
  width: 100%;
}

/* Shared: two-column layout for build, military, research */
.build-playfield {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 320px) minmax(0, 320px);
  gap: 20px;
  width: 100%;
  align-items: start;
}

.info-playfield {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
  gap: 20px;
  width: 100%;
  align-items: start;
}

.build-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
}

/* Shared: left / right columns */
.build-playfield-left,
.build-playfield-center,
.build-playfield-right,
.info-playfield-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Production stat cards grid */
.build-prod-cards,
.info-stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.build-stat-card {
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 5px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(123,231,255,0.10);
  border-radius: 16px;
  padding: 14px 16px;
}

.build-stat-icon { font-size: 1.6rem; line-height: 1; }

.build-stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.build-stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
}

/* Energy chart (right column, full height) */
.build-energy-visual {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(123,231,255,0.10);
  border-radius: 18px;
  padding: 16px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.build-energy-surplus {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
  flex-shrink: 0;
}

.build-energy-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  justify-content: center;
}

.build-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.build-bar-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  flex-shrink: 0;
  width: 72px;
  text-align: right;
}

.build-bar-track {
  flex: 1;
  height: 10px;
  background: rgba(255,255,255,0.07);
  border-radius: 6px;
  overflow: hidden;
}

.build-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.4s ease;
  min-width: 3px;
}

.build-bar-fill--gen {
  background: linear-gradient(to right, rgba(123,231,255,0.5), #7be7ff);
  box-shadow: 0 0 8px rgba(123,231,255,0.4);
}

.build-bar-fill--dem {
  background: linear-gradient(to right, rgba(255,159,74,0.5), #ff9f4a);
  box-shadow: 0 0 8px rgba(255,159,74,0.4);
}

.build-bar-value {
  font-size: 0.82rem;
  font-weight: 700;
  flex-shrink: 0;
  width: 48px;
  text-align: left;
}

.build-energy-warn {
  color: #ff9f4a;
  font-weight: 600;
  font-size: 0.78rem;
  text-align: center;
  flex-shrink: 0;
}

.build-energy-empty {
  color: var(--muted);
  font-size: 0.8rem;
  padding: 4px 0;
}

/* Verbraucher/Erzeuger breakdown */
.build-energy-breakdown {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: 10px;
}

.build-energy-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.build-energy-section-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 2px;
}

.build-energy-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text);
  gap: 8px;
}

.build-energy-row span { color: var(--muted); }

/* Military / Research info panels */
.info-unit-list,
.info-tech-list,
.info-mission-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.info-unit-row,
.info-mission-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(123,231,255,0.08);
  border-radius: 12px;
  font-size: 0.88rem;
}

.info-mission-list { gap: 8px; }

.info-unit-name,
.info-mission-label { flex: 1; min-width: 0; color: var(--text); font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.info-unit-count    { color: var(--muted); flex-shrink: 0; }
.info-unit-stat     { color: var(--accent); font-size: 0.82rem; flex-shrink: 0; }
.info-mission-ships { flex: 2; min-width: 0; color: var(--muted); font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.info-mission-eta   { color: #7be7ff; font-size: 0.82rem; white-space: nowrap; flex-shrink: 0; }

.info-tech-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 6px;
}

.info-tech-path {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 2px 0;
}

.info-tech-row {
  font-size: 0.8rem;
  color: var(--text);
  padding: 2px 6px;
}

.info-tech-row span { color: #6ef5b0; }

/* Research progress bar */
.research-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.research-progress-bar {
  height: 8px;
  background: rgba(255,255,255,0.07);
  border-radius: 8px;
  overflow: hidden;
}

.research-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #7be7ff, #7aa2ff);
  border-radius: 8px;
  transition: width 0.4s ease;
}

.research-progress-label {
  font-size: 0.76rem;
  color: var(--muted);
}

.info-queue-hint {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 0.76rem;
  color: var(--muted);
}

.info-queue-tag {
  background: rgba(123,231,255,0.1);
  border: 1px solid rgba(123,231,255,0.2);
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 0.74rem;
  color: var(--accent);
}

/* Resource strip emoji icon */
.resource-sprite--emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  width: 24px;
  height: 24px;
}

@media (max-width: 1000px) {
  .build-playfield {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

@media (max-width: 700px) {
  .build-playfield,
  .info-playfield {
    grid-template-columns: 1fr;
  }
}

/* ── Fleet Status Panel ─────────────────────────────────────────── */
.fleet-status-panel {
  margin: 4px 0;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(123, 231, 255, 0.12);
  flex-shrink: 0;
}

.fleet-status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.8rem;
}

.fleet-status-header strong {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.fleet-status-total {
  font-weight: 700;
  font-size: 0.85rem;
}

.fleet-status-rate {
  font-size: 0.72rem;
  opacity: 0.5;
  font-weight: 400;
}

.fleet-status-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fleet-status-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 8px;
  align-items: center;
  font-size: 0.8rem;
  padding: 3px 0;
}

.fleet-status-name {
  color: var(--text);
}

.fleet-status-count {
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

.fleet-status-upkeep {
  font-size: 0.75rem;
  white-space: nowrap;
  min-width: 60px;
  text-align: right;
}

.fleet-status-actions {
  display: flex;
  gap: 4px;
}

.fleet-status-btn {
  background: rgba(255, 90, 90, 0.15);
  border: 1px solid rgba(255, 90, 90, 0.3);
  color: rgba(255, 130, 130, 0.95);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 0.8rem;
  cursor: pointer;
  line-height: 1.4;
  transition: background 0.15s;
}

.fleet-status-btn:hover {
  background: rgba(255, 90, 90, 0.28);
}

.fleet-status-btn--reactivate {
  background: rgba(120, 220, 100, 0.12);
  border-color: rgba(120, 220, 100, 0.3);
  color: rgba(140, 230, 110, 0.95);
}

.fleet-status-btn--reactivate:hover {
  background: rgba(120, 220, 100, 0.25);
}

/* Tooltip positive color class */
.tt-pos {
  color: rgba(120, 220, 100, 0.95);
  font-weight: 700;
}

/* ================================================================
   MOBILE  (≤ 600 px)
   ================================================================ */
@media (max-width: 600px) {

  /* ── Core layout ──────────────────────────────────────────────── */
  .game-shell {
    padding: 6px;
    gap: 6px;
  }

  /* ── Top HUD ──────────────────────────────────────────────────── */
  .top-hud {
    padding: 6px 10px;
    gap: 6px;
  }

  .colony-chip h1 {
    font-size: 0.82rem;
  }

  /* ── Resource strip: smaller pills, horizontal scroll ─────────── */
  .resource-strip {
    gap: 4px;
  }

  .resource-pill {
    padding: 5px 8px;
    min-width: 60px;
    gap: 4px;
    border-radius: 10px;
  }

  .resource-pill strong {
    font-size: 0.78rem;
  }

  .resource-sprite {
    width: 22px;
    height: 22px;
  }

  /* ── Bottom dock ──────────────────────────────────────────────── */
  .bottom-dock {
    gap: 5px;
  }

  /* Build-queue panel: no min-height, let it size to content naturally */
  .submenu-panel {
    min-height: 0;
    padding: 4px 0 4px;
    gap: 4px;
  }

  /* Reduce queue-bar height on mobile */
  .queue-bar {
    min-height: 40px;
    padding: 6px 10px;
    margin: 0 6px;
  }

  /* CRITICAL: restore horizontal card scroll (900px stacks them full-width) */
  .submenu-scroll {
    grid-auto-flow: column;
    grid-auto-columns: 110px;
    overflow-x: auto;
    overflow-y: visible;
    padding: 0 6px 4px;
  }

  .build-card,
  .mini-card {
    width: 110px;
    height: 128px;
    padding: 6px;
  }

  .build-icon {
    min-height: 42px;
  }

  /* Submenu header: compact */
  .submenu-menu-header {
    padding: 6px 10px;
    gap: 8px;
  }

  .submenu-stats-strip {
    padding: 4px 8px;
    gap: 4px;
  }

  .submenu-stat {
    min-width: 60px;
    padding: 4px 8px;
  }

  /* ── Menu bar: 4 columns → 2 rows of 4 for all 8 items ────────── */
  .menu-bar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px;
    padding: 2px;
  }

  .menu-bar button {
    min-height: 40px;
    font-size: 0.68rem;
    padding: 6px 2px;
    border-radius: 10px;
    letter-spacing: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* override the flex-wrap rules set at 900px */
    flex: unset;
  }

  /* ── Touch targets: mission stepper / action buttons ─────────── */
  .mission-stepper {
    grid-template-columns: 44px 44px 44px;
    gap: 5px;
  }

  .mission-stepper button,
  .mission-modal-actions button {
    min-height: 44px;
    min-width: 44px;
    border-radius: 12px;
    padding: 10px;
  }

  /* General button touch targets */
  .build-card button,
  .mini-card button,
  .options-stack button,
  .fleet-status-btn,
  .ctx-item {
    min-height: 40px;
  }

  /* ── Submenu drawer: full-screen on mobile ───────────────────── */
  .submenu-drawer {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    border-radius: 0;
    padding: 12px 12px 8px;
  }

  /* ── Social stage: edge-to-edge on small screens ────────────── */
  .social-stage {
    inset: 0;
    border-radius: 0;
  }

  /* ── Detail playfield padding ────────────────────────────────── */
  .playfield--detail {
    padding: 10px;
  }

  /* ── Dashboard: compact padding ──────────────────────────────── */
  .dashboard-stage {
    padding: 8px;
    gap: 8px;
  }

  .dashboard-hero {
    padding: 10px 12px;
    gap: 10px;
  }

  .dashboard-planet-art {
    width: 80px;
  }

  .dashboard-planet-copy h2 {
    font-size: 1.2rem;
  }

  /* Vitals: 2×2 grid instead of 1×4 */
  .dashboard-vitals {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-vitals div {
    padding: 8px 10px;
  }

  .dashboard-vitals strong {
    font-size: 0.9rem;
  }

  /* Orders: 2×2 */
  .dashboard-orders-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-panel,
  .dashboard-community {
    padding: 10px;
  }

  /* Community panel: limit height so it doesn't dominate */
  .dashboard-community {
    max-height: 300px;
    overflow-y: auto;
  }

  /* Section heads: tighter */
  .dashboard-section-head {
    margin-bottom: 8px;
  }

  /* Log / reports panels: shorter on mobile */
  .dashboard-log-panel,
  .dashboard-reports-panel {
    max-height: 160px;
  }

  /* ── Build playfield: compact padding ────────────────────────── */
  .build-playfield-left,
  .build-playfield-center,
  .build-playfield-right,
  .info-playfield-col {
    gap: 10px;
  }

  /* ── Mission panel: full-width action buttons ────────────────── */
  .mission-action {
    padding: 9px 10px;
  }

  /* ── Starmap panel ───────────────────────────────────────────── */
  .planet-details,
  .starmap-info-column .planet-details {
    padding: 8px;
  }

  .planet-details-hero {
    grid-template-columns: 80px minmax(0, 1fr);
    gap: 10px;
  }

  .planet-details-grid {
    gap: 6px;
  }

  /* ── Expedition panel ────────────────────────────────────────── */
  .starmap-expedition-panel {
    padding: 8px 10px;
  }

  /* ── Starmap: scrollable vertically; map natural square, info below ─ */
  .starmap-info-column {
    overflow-y: visible; /* parent shell handles scroll */
  }

  .starmap-map-column {
    height: auto; /* let aspect-ratio 1/1 determine height from width */
  }

  /* ── Tooltip: constrained to viewport ───────────────────────── */
  .hover-tooltip {
    max-width: min(320px, 94vw);
    min-width: min(220px, 88vw);
    font-size: 0.78rem;
  }

  /* ── Modals: use almost full viewport width ──────────────────── */
  .rename-planet-modal,
  .scout-modal {
    width: min(480px, 96vw);
  }

  .mission-modal {
    width: min(460px, 96vw);
    max-height: 88vh;
    overflow-y: auto;
  }

  /* ── Context menu: bigger tap targets ───────────────────────── */
  .ctx-item {
    padding: 12px 16px;
    font-size: 0.88rem;
  }

  /* ── Clan option cards: stack on narrow screens ──────────────── */
  .social-clan-options {
    grid-template-columns: 1fr;
  }

  /* ── Queue banner: smaller gap ───────────────────────────────── */
  .queue-banner {
    padding: 10px 12px;
  }

  /* ── Build-stat cards: allow two per row on phone ────────────── */
  .build-prod-cards,
  .info-stat-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* ── Leaderboard row: slightly smaller ───────────────────────── */
  .leaderboard-row {
    padding: 8px 10px;
  }

  /* ── All inputs: prevent iOS zoom on focus (needs ≥ 16px) ────── */
  .chat-form input,
  .mission-cargo input,
  .social-option-card input,
  .profile-form-label input,
  .profile-form-label textarea {
    font-size: 1rem !important;
  }

  /* ── Override 900px min-heights that overflow on phones ─────── */
  .playfield--starmap {
    min-height: 0;
    height: 100%;
  }

  .playfield--dashboard {
    min-height: 0;
    overflow-y: auto;
  }

  /* ── Starmap: stack planet list below map ────────────────────── */
  .starmap-shell {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  /* ── Planet quick-swap: smaller buttons on phones ───────────── */
  .planet-quickswap {
    gap: 4px;
    padding: 0 4px;
  }

  .planet-quickswap-btn {
    width: 34px;
    height: 34px;
  }

  /* ── In-game alerts: lift above bottom menu bar ─────────────── */
  .alert-container {
    bottom: 100px; /* clear the menu bar */
    right: 10px;
    max-width: min(300px, 88vw);
  }

  /* ── Galaxy map controls: bigger touch targets ──────────────── */
  [data-map-zoom] {
    height: 28px;
  }

  [data-map-zoom-step] {
    min-width: 36px;
    min-height: 36px;
    padding: 6px 10px;
  }

  /* ── Prevent 300 ms tap delay on all interactive elements ────── */
  button, a, input, select, textarea {
    touch-action: manipulation;
  }
}
