@media (max-width: 1120px) {
  .lab-layout {
    grid-template-columns: minmax(0, 1fr) 310px;
  }

  .stats-strip {
    grid-template-columns: repeat(5, 1fr);
  }

  .population-chart {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 860px) {
  .lab-shell {
    padding-inline: 14px;
  }

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

  .topbar-copy {
    display: none;
  }

  .lab-layout {
    display: block;
  }

  .control-rail {
    position: static;
    display: grid;
    max-height: none;
    grid-template-columns: 1fr 1fr;
    margin-top: 14px;
    overflow: hidden;
  }

  .control-section {
    border-right: 1px solid var(--line);
  }

  .control-section:nth-child(even) {
    border-right: 0;
  }

  .lab-settings {
    grid-column: 1 / -1;
  }

  .betting-section {
    grid-column: 1 / -1;
    border-right: 0;
  }

  .farm-planner {
    border-right: 1px solid var(--line);
  }
}

@media (max-width: 620px) {
  .lab-shell {
    padding: 0 8px 16px;
  }

  .farm-planner {
    grid-column: 1 / -1;
    border-right: 0;
  }

  .topbar {
    min-height: 68px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand small,
  .culture-status {
    display: none;
  }

  .dish-panel {
    border-radius: var(--radius-md);
  }

  .dish-header {
    display: block;
    padding: 14px;
  }

  .dish-header > div:first-child {
    margin-bottom: 13px;
  }

  .tool-switcher {
    width: 100%;
  }

  .tool-button {
    flex: 1;
    justify-content: center;
    padding-inline: 7px;
  }

  .dish-stage {
    height: min(112vw, 540px);
    min-height: 420px;
  }

  .player-identity:not(.is-intro) {
    right: 10px;
    bottom: 178px;
    max-width: 190px;
  }

  .player-identity.is-intro { padding: 12px 14px; }
  .player-identity.is-intro > i { font-size: 21px; }
  .player-identity.is-intro strong { font-size: clamp(16px, 6vw, 22px); }

  .player-life-overlay { padding: 14px; }
  .player-life-overlay > div { padding: 20px 14px; }
  .player-life-overlay > div > strong { font-size: clamp(24px, 10vw, 38px); }

  .dish-readout--bottom {
    bottom: 12px;
    max-width: calc(100% - 24px);
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .pilot-controls {
    right: 9px;
    bottom: 40px;
    left: 10px;
    grid-template-columns: auto minmax(112px, 1fr);
    gap: 6px 9px;
    padding: 7px;
    border: 1px solid rgb(0 246 255 / 24%);
    background: rgb(2 7 8 / 72%);
    box-shadow: 0 5px 20px rgb(0 0 0 / 35%);
    backdrop-filter: blur(7px);
  }

  .pilot-pad {
    grid-template-columns: repeat(3, 38px);
    grid-template-rows: repeat(3, 38px);
  }

  .pilot-hint { display: none; }
  .pilot-touch-hint {
    display: block;
    grid-column: 2;
    color: rgb(233 255 247 / 66%);
    font-size: 6px;
    font-weight: 900;
    letter-spacing: .08em;
    line-height: 1.35;
  }
  .surge-button { min-height: 62px; }

  .arena-event {
    top: 8px;
    min-width: 180px;
    max-width: calc(100% - 130px);
    padding-inline: 8px;
  }

  .arena-event strong { font-size: 10px; }
  .arena-event small { overflow: hidden; max-width: 210px; text-overflow: ellipsis; white-space: nowrap; }

  .arcade-scoreboard {
    top: 49px;
    left: 50%;
    width: max-content;
    gap: 12px;
    transform: translateX(-50%);
  }

  .arcade-scoreboard strong { font-size: 9px; }
  .arcade-scoreboard span:nth-child(2) { display: none; }
  .arcade-scoreboard span:nth-child(5) { display: none; }
  .arcade-scoreboard span:nth-child(6) { display: none; }
  .arena-fighter-hud--player { top: 91px; width: min(230px, calc(100% - 24px)); }
  .arena-fighter-hud--rival,
  .versus-badge { display: none; }
  .arcade-callout strong { -webkit-text-stroke-width: 1px; }

  .arcade-callout {
    right: 10px;
    bottom: 174px;
    width: min(245px, calc(100% - 20px));
    padding: 6px 8px 7px;
  }

  .arcade-callout strong { font-size: clamp(17px, 7vw, 27px); }

  .rare-drop-radar {
    right: auto;
    bottom: 180px;
    left: 10px;
    width: min(190px, calc(100% - 20px));
    grid-template-columns: 27px minmax(0, 1fr) 22px;
    padding: 4px 5px;
  }
  .rare-drop-radar > i { width: 23px; height: 23px; }
  .rare-drop-radar em { display: none; }
  .rare-drop-radar > b { width: 19px; height: 19px; font-size: 7px; }

  .dish-footer {
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 12px;
  }

  .transport-controls .primary-button {
    min-width: 0;
  }

  .speed-control {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    max-width: none;
  }

  .cycle-readout {
    grid-column: 2;
    grid-row: 1;
  }

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

  .stat-block:nth-child(5) {
    grid-column: 1 / -1;
    border-bottom: 1px solid var(--line);
  }

  .stat-block:nth-child(2) {
    border-right: 0;
  }

  .stat-block:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .population-chart {
    min-height: 74px;
  }

  .control-rail {
    display: block;
    border-radius: var(--radius-md);
  }

  .control-section {
    border-right: 0;
  }

  .about-dialog {
    padding: 28px 22px;
  }

  .account-dialog {
    padding: 26px 20px;
  }

  .game-toast {
    right: 16px;
    bottom: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .arcade-callout.is-visible {
    opacity: 1;
    animation: none;
    transform: none;
  }

  .rare-drop-radar { animation: none; }
}

/* Story shell responsive hierarchy */
@media (max-width: 860px) {
  .mission-console {
    grid-column: 1 / -1;
  }

  .side-drawer {
    min-width: 0;
  }

  .side-drawer--signals,
  .lab-settings {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .mission-console {
    padding: 14px 12px 12px;
  }

  .mission-console__header strong { font-size: 15px; }
  .mission-console__header > b { font-size: 5px; }

  .mission-console__transmission {
    margin-top: 10px;
    padding: 9px;
  }

  .mission-console__sequence li {
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 4px;
    padding: 6px 4px;
  }

  .mission-console__sequence li > b {
    width: 17px;
    height: 17px;
  }

  .mission-console__sequence small { display: none; }
  .mission-console__legend { grid-template-columns: 1.25fr 1fr .75fr; }
  .mission-console__legend em { display: none; }

  .side-drawer > summary {
    min-height: 50px;
    padding-inline: 12px;
  }

  .story-overlay {
    top: 82px;
    left: 9px;
    width: min(250px, calc(100% - 18px));
    padding: 7px 8px 8px;
  }

  .story-overlay p { font-size: 7px; }

  .pilot-controls {
    grid-template-columns: auto repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }

  .pilot-pad { grid-row: 1 / span 2; }
  .surge-button,
  .split-button {
    min-height: 58px;
    padding: 6px;
  }

  .surge-button strong,
  .split-button strong { font-size: 7px; }
  .surge-button kbd,
  .split-button kbd { font-size: 7px; }
  .pilot-hint,
  .pilot-touch-hint { grid-column: 2 / -1; }
}

@media (max-width: 390px) {
  .player-life-overlay dl { margin-block: 14px; }
  .player-life-overlay dd { font-size: 11px; }

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

  .mission-console__objective > b { justify-self: start; }
  .mission-console__objective progress,
  .mission-console__objective p { grid-column: 1; }
  .mission-console__legend > span { justify-content: center; }
  .mission-console__legend strong { display: none; }

  .pilot-controls {
    right: 6px;
    left: 6px;
    gap: 5px;
    padding: 5px;
  }

  .pilot-pad {
    grid-template-columns: repeat(3, 32px);
    grid-template-rows: repeat(3, 32px);
  }

  .surge-button,
  .split-button { min-height: 51px; }
  .surge-button small,
  .split-button small { font-size: 5px; }
}
