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

  .stats-panel {
    position: static;
    height: auto;
    overflow: visible;
    border-left: 0;
    border-top: 1px solid var(--line);
    order: -1;
  }

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

@media (max-width: 560px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .brand {
    justify-content: space-between;
  }

  .top-controls {
    justify-content: space-between;
  }

  .slot-main {
    grid-template-columns: 72px minmax(0, 1fr);
  }

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

  .slot-meta-row {
    align-items: stretch;
  }

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

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

  .picker-backdrop {
    padding: 8px;
    place-items: stretch;
  }

  .picker-panel {
    width: 100%;
    height: calc(100dvh - 16px);
    max-height: calc(100dvh - 16px);
  }

  .picker-panel.jewel-editor-panel {
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: calc(100dvh - 16px);
  }

  .jewel-editor-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .jewel-part {
    grid-template-columns: repeat(3, 72px);
    justify-content: start;
    gap: 10px;
  }

  .jewel-section-head {
    align-items: start;
    flex-direction: column;
  }

  .jewel-tier-field {
    justify-self: start;
  }

  .jewel-part-details {
    grid-column: 1 / -1;
  }

  .stat-row {
    grid-template-columns: 88px 1fr auto;
  }

  .stat-total-row {
    grid-template-columns: minmax(72px, 0.9fr) minmax(58px, 1fr) minmax(58px, auto) minmax(
        44px,
        auto
      );
    gap: 6px;
  }

  .stat-total-row .stat-percent {
    padding-right: 0;
  }
}

@media (max-height: 720px) {
  .stats-panel {
    position: static;
    height: auto;
    overflow: visible;
  }
}
