@media (max-width: 767px) {
  /* Show the complete mobile welcome artwork instead of cropping it with bg-cover. */
  html body .cofp-mobile-polish[style*="background-image"] {
    background-color: #000 !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: top center !important;
  }

  /* The command deck was forcing every Colony image to cover a fixed-height box. */
  html body .command-station[data-station="colony"] .command-station-content img:not(.colony-xeno-portrait) {
    min-height: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
    background: #000 !important;
    filter: brightness(1.28) contrast(1.04) saturate(1.08) !important;
  }

  /* Remove the attached XENO / alien-probe portrait module from the mobile Colony art. */
  html body .command-station[data-station="colony"] .colony-status-module > div:has(img.colony-xeno-portrait) {
    display: none !important;
  }

  /* Keep the card station as a single-screen console instead of an internal scroll page. */
  html body .command-station[data-station="cards"] {
    overflow-y: hidden !important;
  }

  html body .command-station[data-station="cards"] .command-station-content {
    height: calc(100% - 22px) !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  html body .command-station[data-station="cards"] .command-station-content > div {
    height: 100% !important;
    padding-top: 0 !important;
    overflow: hidden !important;
  }

  html body .command-station[data-station="cards"] .command-station-content > div > section {
    min-height: 0 !important;
    height: 100% !important;
    padding: 8px 9px 10px !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
  }

  /* Let the bay art read a little more clearly without flattening the mood. */
  html body .command-station[data-station="cards"] .card-vault {
    filter: brightness(0.82) saturate(0.96) contrast(1.03) !important;
    transform: scale(1.005) !important;
  }

  html body .command-station[data-station="cards"] .card-vault-shade {
    background:
      linear-gradient(180deg, rgba(0,0,0,0.02) 0%, rgba(2,0,8,0.08) 34%, rgba(1,0,6,0.30) 76%, rgba(0,0,0,0.58) 100%),
      radial-gradient(ellipse at 50% 37%, transparent 0 24%, rgba(2,0,8,0.05) 50%, rgba(0,0,0,0.27) 100%) !important;
    box-shadow:
      inset 0 0 44px rgba(0,0,0,0.36),
      inset 0 -58px 72px rgba(0,0,0,0.36) !important;
  }

  /* Shrink only the presentation stage, not the information itself. */
  html body .command-station[data-station="cards"] .command-station-content [class*="-mt-10"][class*="select-none"] {
    height: min(32dvh, 224px) !important;
    min-height: 198px !important;
    margin-top: 0 !important;
    flex: 0 0 auto !important;
  }

  html body .command-station[data-station="cards"] .command-station-content a[aria-label^="View "] {
    width: min(40vw, 150px) !important;
    height: min(29dvh, 210px) !important;
  }

  /* Keep side cards visible enough to read as a living carousel. */
  html body .command-station[data-station="cards"] .command-station-content button[class*="rotate-[14deg]"] {
    width: 78px !important;
    height: 112px !important;
    opacity: 0.56 !important;
    filter: brightness(1.08) saturate(0.95) !important;
  }

  html body .command-station[data-station="cards"] .command-station-content button[class*="rotate-[7deg]"] {
    width: 142px !important;
    height: 198px !important;
    opacity: 0.48 !important;
    filter: brightness(1.03) saturate(0.92) !important;
  }

  html body .command-station[data-station="cards"] .command-station-content a[aria-label^="View "] + span,
  html body .command-station[data-station="cards"] .command-station-content a[aria-label^="View "] span[aria-hidden] {
    font-size: 5px !important;
  }

  /* Compress whitespace around labels, stats and actions while preserving every control. */
  html body .command-station[data-station="cards"] .command-station-content section > div[class*="text-center"] {
    margin-top: 5px !important;
  }

  html body .command-station[data-station="cards"] .command-station-content section > div[class*="text-center"] h2 {
    margin-top: 3px !important;
    font-size: 18px !important;
  }

  html body .command-station[data-station="cards"] .command-station-content section > div[class*="text-center"] p {
    margin-top: 3px !important;
  }

  html body .command-station[data-station="cards"] .command-station-content section > div[class*="overflow-hidden"][class*="bg-black/46"] {
    margin-top: 8px !important;
    padding: 6px 8px !important;
    border-radius: 8px !important;
    background: rgba(3, 9, 15, 0.66) !important;
    box-shadow: inset 0 0 18px rgba(103,232,249,0.035) !important;
  }

  html body .command-station[data-station="cards"] .command-station-content section > div[class*="overflow-hidden"][class*="bg-black/46"] > div:first-child {
    margin-bottom: 4px !important;
  }

  html body .command-station[data-station="cards"] .command-station-content section > div[class*="overflow-hidden"][class*="bg-black/46"] .space-y-2\.5 {
    row-gap: 4px !important;
  }

  html body .command-station[data-station="cards"] .command-station-content section > div[class*="justify-center"][class*="gap-1.5"] {
    margin-top: 7px !important;
  }

  html body .command-station[data-station="cards"] .command-station-content section > div[class*="grid-cols-[1fr_1.25fr]"] {
    margin-top: 7px !important;
    gap: 5px !important;
  }

  html body .command-station[data-station="cards"] .command-station-content section > div[class*="grid-cols-[1fr_1.25fr]"] a {
    height: 32px !important;
    font-size: 7px !important;
    padding-left: 7px !important;
    padding-right: 7px !important;
  }

  /* ------------------------------------------------------------------
     COMMAND DECK SHELL POLISH V1
     Shared visual language across every mobile command station.
  ------------------------------------------------------------------ */

  html body .cofp-mobile-polish {
    background:
      radial-gradient(circle at 50% 20%, rgba(74, 114, 138, 0.10), transparent 32%),
      linear-gradient(180deg, #020609 0%, #010203 58%, #000 100%) !important;
  }

  html body .command-station {
    isolation: isolate;
    background:
      radial-gradient(circle at 50% 12%, color-mix(in srgb, var(--station-accent, #84ff00) 9%, transparent), transparent 31%),
      linear-gradient(180deg, rgba(8,12,16,0.96), rgba(2,4,7,0.98)) !important;
    box-shadow:
      inset 0 0 0 1px rgba(255,255,255,0.025),
      inset 0 26px 70px rgba(255,255,255,0.012),
      0 0 28px color-mix(in srgb, var(--station-accent, #84ff00) 13%, transparent) !important;
  }

  html body .command-station::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
      repeating-linear-gradient(0deg, rgba(255,255,255,0.018) 0 1px, transparent 1px 4px),
      linear-gradient(90deg, transparent 0 7%, rgba(255,255,255,0.018) 7.2%, transparent 7.4% 92.6%, rgba(255,255,255,0.018) 92.8%, transparent 93%);
    opacity: 0.42;
  }

  html body .command-station::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 24%;
    z-index: 0;
    width: 74%;
    height: 34%;
    transform: translateX(-50%);
    pointer-events: none;
    background: radial-gradient(circle, color-mix(in srgb, var(--station-accent, #84ff00) 14%, transparent), transparent 70%);
    filter: blur(24px);
    opacity: 0.62;
  }

  html body .command-station[data-station="colony"] { --station-accent: #84ff00; }
  html body .command-station[data-station="intel"] { --station-accent: #67e8f9; }
  html body .command-station[data-station="cards"] { --station-accent: #c084fc; }
  html body .command-station[data-station="media"] { --station-accent: #fb7185; }
  html body .command-station[data-station="extraction"] { --station-accent: #facc15; }

  html body .cofp-station-titlebar {
    position: relative;
    z-index: 20;
    background: linear-gradient(180deg, rgba(12,16,20,0.97), rgba(4,7,10,0.95)) !important;
    box-shadow:
      inset 0 -1px 0 rgba(255,255,255,0.035),
      0 5px 16px rgba(0,0,0,0.26) !important;
    backdrop-filter: blur(8px);
  }

  html body .cofp-station-titlebar::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: -1px;
    height: 1px;
    background: linear-gradient(90deg, transparent, currentColor 20%, currentColor 80%, transparent);
    opacity: 0.22;
    pointer-events: none;
  }

  html body .cofp-station-titlebar__status i {
    animation: cofp-shell-status-pulse 2.8s ease-in-out infinite;
  }

  html body .cofp-station-tab {
    border-radius: 6px 6px 0 0;
    transition: background-color 180ms ease, transform 180ms ease, opacity 180ms ease;
  }

  html body .cofp-station-tab[aria-selected="true"] {
    background: linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.012));
    transform: translateY(-1px);
  }

  html body .cofp-station-tab[aria-selected="true"]::before {
    content: "";
    position: absolute;
    left: 12%;
    right: 12%;
    bottom: -5px;
    height: 7px;
    background: radial-gradient(ellipse at center, currentColor 0%, transparent 70%);
    opacity: 0.18;
    filter: blur(3px);
    pointer-events: none;
  }

  html body .command-station-content {
    position: relative;
    z-index: 2;
  }

  html body .command-station-content::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
      linear-gradient(90deg, rgba(255,255,255,0.018), transparent 9%, transparent 91%, rgba(255,255,255,0.018)),
      radial-gradient(circle at 50% 0%, rgba(255,255,255,0.028), transparent 28%);
  }

  html body .cofp-command-dock {
    background:
      linear-gradient(180deg, rgba(9,14,17,0.95), rgba(2,4,6,0.985)) !important;
    border-top-color: rgba(255,255,255,0.10) !important;
    box-shadow:
      0 -10px 26px rgba(0,0,0,0.52),
      inset 0 1px 0 rgba(255,255,255,0.025),
      inset 0 9px 22px rgba(103,232,249,0.018) !important;
  }

  html body .cofp-command-dock::before {
    content: "";
    position: absolute;
    left: 5%;
    right: 5%;
    top: -1px;
    height: 1px;
    pointer-events: none;
    background: linear-gradient(90deg, transparent, rgba(103,232,249,0.22), rgba(132,255,0,0.18), transparent);
  }

  html body .cofp-command-key-icon {
    transition: transform 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
  }

  html body .cofp-command-key.is-active .cofp-command-key-icon,
  html body .cofp-command-key[aria-current="page"] .cofp-command-key-icon {
    transform: translateY(-1px) scale(1.04);
  }

  html body .cofp-command-track {
    filter: drop-shadow(0 0 7px rgba(132,255,0,0.32));
  }

  @keyframes cofp-shell-status-pulse {
    0%, 100% { opacity: 0.72; transform: scale(0.92); }
    50% { opacity: 1; transform: scale(1.12); }
  }

  @media (prefers-reduced-motion: reduce) {
    html body .cofp-station-titlebar__status i {
      animation: none !important;
    }
  }
}
