/* The compact web layout shares controls with Tabletop, but owns its palette. */
html[data-ui-runtime=web] body.phone-refined[data-board-background=cosmic] #phone-faithful {
  --mobile-cosmic-ink: #f8edda;
  --mobile-cosmic-muted: #c7ccd5;
  --mobile-cosmic-surface: #162635;
  --mobile-cosmic-line: #826b49;
}

@media (orientation: portrait) {
  html[data-ui-runtime=web] body.phone-refined[data-board-background=cosmic] #phone-faithful .mini-header {
    align-items: center;
    padding-inline: 10px;
    gap: 6px;
  }
  html[data-ui-runtime=web] body.phone-refined[data-board-background=cosmic] #phone-faithful .mini-header .logo {
    object-position: left center;
    min-width: 0;
  }
  html[data-ui-runtime=web] body.phone-refined[data-board-background=cosmic] #phone-faithful .mini-header .round {
    --moon-size: 38px;
    --moon-label: 10px;
    --moon-value: 15px;
    margin-inline-start: auto !important;
  }
  html[data-ui-runtime=web] body.phone-refined[data-board-background=cosmic] #phone-faithful .mini[data-player-count] .players {
    grid-template-columns: repeat(var(--mobile-player-count), minmax(0, 1fr)) !important;
    grid-auto-flow: row;
    gap: 4px;
  }
}

@media (orientation: portrait) and (max-width: 520px) {
  /* Keep resource groups readable inside the narrower portrait cards. */
  html[data-ui-runtime=web] body.phone-refined[data-board-background=cosmic] #phone-faithful .mini:not([data-player-count="2"]) .production-value {
    flex-direction: column;
    gap: 1px;
  }
  html[data-ui-runtime=web] body.phone-refined[data-board-background=cosmic] #phone-faithful .mini:is([data-player-count="4"], [data-player-count="5"]) .player-stats > span {
    flex-direction: column;
    gap: 1px;
    font-size: 10px;
  }
  html[data-ui-runtime=web] body.phone-refined[data-board-background=cosmic] #phone-faithful .mini:is([data-player-count="4"], [data-player-count="5"]) :is(.player-stats, .production-values) {
    gap: 0;
  }
  html[data-ui-runtime=web] body.phone-refined[data-board-background=cosmic] #phone-faithful .mini:is([data-player-count="4"], [data-player-count="5"]) .player {
    gap: 1px;
  }
}

html[data-ui-runtime=web] body.phone-refined[data-board-background=cosmic] #phone-faithful .production-resource {
  flex: none;
}
html[data-ui-runtime=web] body.phone-refined[data-board-background=cosmic] #phone-faithful .production-values {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.25fr);
}

html[data-ui-runtime=web] body.phone-refined[data-board-background=cosmic] #phone-faithful :is(.turn-strip, .inspector) {
  color: var(--mobile-cosmic-ink);
  background: var(--mobile-cosmic-surface);
  border-color: var(--mobile-cosmic-line);
}
html[data-ui-runtime=web] body.phone-refined[data-board-background=cosmic] #phone-faithful :is(.turn-strip > strong, .online-compact-state, .online-compact-state .async-deadline, .mobile-context > .production) {
  color: var(--mobile-cosmic-ink);
  background: transparent;
}
html[data-ui-runtime=web] body.phone-refined[data-board-background=cosmic] #phone-faithful .online-compact-state {
  font-variant-numeric: tabular-nums;
}

html[data-ui-runtime=web] body.phone-refined[data-board-background=cosmic] #phone-faithful .mobile-tasks {
  color: var(--mobile-cosmic-ink);
  background: #22394a;
  border-color: #a58b61;
  box-shadow: none;
}
html[data-ui-runtime=web] body.phone-refined.faithful-target[data-board-background=cosmic] #phone-faithful .sheet {
  --astrolabe-edge: clamp(12px, 4vw, 24px);
  --paper: #172635;
  --surface: #192b3b;
  --ink: var(--mobile-cosmic-ink);
  --muted: var(--mobile-cosmic-muted);
  padding: 8px !important;
  overflow: hidden;
}
html[data-ui-runtime=web] body.phone-refined[data-board-background=cosmic] #phone-faithful .sheet-head {
  background: #142432;
  border-color: var(--mobile-cosmic-line);
  border-radius: 8px 8px 0 0;
}
html[data-ui-runtime=web] body.phone-refined[data-board-background=cosmic] #phone-faithful .sheet :is(.sheet-head small, .connection-status, .access-role > small) {
  color: var(--mobile-cosmic-muted);
}
html[data-ui-runtime=web] body.phone-refined[data-board-background=cosmic] #phone-faithful .sheet-body {
  padding: 10px 6px 6px;
}
html[data-ui-runtime=web] body.phone-refined.faithful-target[data-board-background=cosmic] #phone-faithful .sheet-body :is(details, .drone-panel, .installation-panel, .research-panel, .cost-total, fieldset, .access-role) {
  background: var(--surface) !important;
  color: var(--ink);
  border-color: var(--mobile-cosmic-line);
}
html[data-ui-runtime=web] body.phone-refined.faithful-target[data-board-background=cosmic] #phone-faithful .sheet-body :is(.connection-panel, .trait-panel) {
  background: transparent !important;
  color: var(--ink);
}
html[data-ui-runtime=web] body.phone-refined[data-board-background=cosmic] #phone-faithful .sheet-body :is(p, small, h2, h3, h4, .mobile-experimental-label) {
  color: var(--ink);
}
html[data-ui-runtime=web] body.phone-refined[data-board-background=cosmic] #phone-faithful .sheet-body .mobile-experimental-label {
  margin: 0;
  background: #273140;
  color: #edd19b;
}
html[data-ui-runtime=web] body.phone-refined[data-board-background=cosmic] #phone-faithful .sheet-body :is(.access-role, .installation-panel, .drone-panel) {
  padding: 10px;
}
html[data-ui-runtime=web] body.phone-refined[data-board-background=cosmic] #phone-faithful .sheet-body .access-role > p {
  margin-block: 7px;
}
html[data-ui-runtime=web] body.phone-refined[data-board-background=cosmic] #phone-faithful .sheet-body .mobile-task-list button {
  min-width: 0;
  overflow-wrap: anywhere;
}
html[data-ui-runtime=web] body.phone-refined.faithful-target[data-board-background=cosmic] #modal:not(.local-entry-dialog) {
  --astrolabe-edge: clamp(12px, 4vw, 24px);
  padding: 14px !important;
}

/* Keep long headings clear of the shared 44px close control. */
html[data-ui-runtime=web] body.phone-refined.faithful-target[data-board-background=cosmic] #modal :is(.research-collection > h2, .company-summary-heading) {
  padding-inline-end: 46px;
  overflow-wrap: anywhere;
}
