@media (max-width: 1050px) {
  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
  }

  html {
    height: -webkit-fill-available;
  }

  body {
    position: fixed;
    inset: 0;
    min-height: -webkit-fill-available;
  }

  .page-shell,
  .app {
    width: 100%;
    height: 100vh;
    height: -webkit-fill-available;
    min-height: 0;
    overflow: hidden;
  }

  .panel-resizer {
    display: none;
  }

  .app {
    grid-template-rows: auto auto minmax(0, 1fr) auto auto auto;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
    padding: 11px 9px 9px 9px;
  }

  .topbar-brand {
    width: 100%;
    justify-content: space-between;
  }

  .topbar-actions {
    display: none;
  }

  .mobile-workspace-tabs {
    display: flex;
    gap: 6px;
    padding: 7px 9px;
    border-bottom: 1px solid #2f2f2f;
    background: #151515;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-workspace-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid #333;
    border-radius: 10px;
    background: #1c1c1c;
    color: #aeb6c3;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
  }

  .mobile-workspace-tab.is-active {
    border-color: #345f9c;
    background: #1f334f;
    color: #eef5ff;
  }

  .mobile-workspace-tab:disabled,
  .mobile-workspace-tab.is-hidden {
    display: none;
  }

  .mobile-workspace-tab .ui-icon {
    width: 16px;
    min-width: 16px;
    font-size: 16px;
    line-height: 1;
    text-align: center;
  }

  .app-panels,
  .app.has-panel-resizers .app-panels,
  html.app-booting.ui-panel-resizers #appRoot .app-panels,
  .app.is-preview-collapsed .app-panels,
  .app.has-panel-resizers.is-preview-collapsed .app-panels,
  html.app-booting.ui-panel-resizers.ui-preview-collapsed #appRoot .app-panels,
  .app.is-history-collapsed .app-panels,
  .app.has-panel-resizers.is-history-collapsed .app-panels,
  html.app-booting.ui-panel-resizers.ui-history-collapsed #appRoot .app-panels,
  .app.is-preview-collapsed.is-history-collapsed .app-panels,
  .app.has-panel-resizers.is-preview-collapsed.is-history-collapsed .app-panels,
  html.app-booting.ui-panel-resizers.ui-preview-collapsed.ui-history-collapsed #appRoot .app-panels {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
  }

  .app:not(.mobile-workspace-preview):not(.mobile-workspace-history) .preview-panel,
  .app:not(.mobile-workspace-preview):not(.mobile-workspace-history) .history-panel,
  .app.mobile-workspace-source .preview-panel,
  .app.mobile-workspace-source .history-panel,
  .app.mobile-workspace-preview #sourcePanel,
  .app.mobile-workspace-preview .history-panel,
  .app.mobile-workspace-history #sourcePanel,
  .app.mobile-workspace-history .preview-panel {
    display: none !important;
  }

  #sourcePanel,
  .preview-panel,
  .history-panel {
    grid-column: auto;
    grid-row: 1;
    border-top: 0;
  }

  .panel > .panel-header {
    display: none;
  }

  .utility-strip {
    display: none !important;
  }

  .utility-strip-actions {
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .utility-strip-btn,
  button.soft.quick-template-btn {
    height: 45px;
    min-width: 42px;
    flex: 0 0 auto;
  }

  .quick-template-bar {
    flex-wrap: nowrap;
    flex: 0 0 auto;
  }

  .buttons,
  .action-row,
  .template-actions,
  .chain-actions,
  .modal-actions {
    justify-content: flex-start;
  }

  .code-toolbar {
    width: auto;
    margin-left: auto;
  }

  .code-toolbar #codeSettingsToggleBtn,
  .code-toolbar #codeSettingsMenu {
    display: none !important;
  }

  .app.is-code-toolbar-compact .code-settings-menu,
  html.app-booting.ui-code-toolbar-compact #appRoot .code-settings-menu {
    left: 0;
    right: auto;
  }

  .template-actions-toolbar {
    align-items: flex-start;
  }

  .template-actions-group-meta {
    margin-left: 5px;
    justify-content: space-between;
  }

  .mode-switcher-modal-window {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    max-height: none;
    border-radius: 16px;
  }

  .mode-switcher-toolbar {
    padding: 14px 14px 12px;
  }

  .mode-switcher-list {
    padding: 12px 14px 14px;
  }

  .input-row,
  .input-row.compact,
  .modal-body,
  .multi-builder {
    grid-template-columns: 1fr;
  }

  .code-editor-shell {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .code-editor-gutter {
    padding-right: 6px;
  }

  .code-editor-line-numbers,
  .code-editor-highlight,
  #codeInput {
    font-size: 16px;
  }

  .code-editor-highlight,
  #codeInput {
    padding: 3px 12px 14px;
  }

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

  .chain-step-top {
    grid-template-columns: auto 1fr;
  }

  .chain-step-buttons {
    grid-column: 1 / -1;
  }

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

  .history-entry-actions {
    justify-content: flex-start;
    border-left: 0;
    border-top: 1px solid #252525;
  }

  .status {
    align-items: center;
    flex-direction: row;
    justify-content: center;
    position: fixed;
    right: 0;
    bottom: 14px;
    left: 0;
    z-index: 31;
    min-height: 54px;
    max-height: 54px;
    overflow: visible;
    padding: 6px 12px 9px;
    font-size: 11px;
    border-top: 0;
    background: none;
  }

  .status-text-value,
  .status-links {
    display: none;
  }

  .mobile-status-label {
    display: none;
  }

  .mobile-status-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 2px;
    align-items: center;
    justify-content: center;
    min-width: 0;
    max-width: 100%;
    flex: 0 1 auto;
    padding: 4px 8px;
    border: 1px solid rgba(79, 103, 134, 0.62);
    border-radius: 999px;
    background: rgba(29, 41, 56, 0.92);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.32);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-status-btn {
    width: 38px;
    min-width: 38px;
    min-height: 34px;
    padding: 0 9px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #d7e4f4;
    font-size: 12px;
    line-height: 1;
  }

  .mobile-status-btn:hover,
  .mobile-status-btn:focus-visible {
    background: rgba(255, 255, 255, 0.08);
  }

  .mobile-status-btn-menu {
    width: 38px;
    padding: 0;
    font-size: 19px;
  }

  .mobile-status-btn-menu .ui-icon {
    width: 18px;
    min-width: 18px;
    font-size: 24px;
    line-height: 1;
  }

  .mobile-status-actions i {
    font-size: 22px;
    line-height: 1;
  }


  .mobile-quick-template-bar {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 2px;
    align-items: center;
  }

  .mobile-quick-template-bar.is-hidden {
    display: none;
  }

  .mobile-quick-template-bar button.soft.quick-template-btn {
    min-height: 34px;
    padding: 0 10px;
    border: 0;
    border-radius: 999px;
    background: transparent;
  }

  .mobile-quick-template-bar button.soft.quick-template-btn:hover,
  .mobile-quick-template-bar button.soft.quick-template-btn:focus-visible {
    background: rgba(255, 255, 255, 0.08);
  }

  .mobile-sheet-backdrop {
    align-items: flex-end;
    padding: 10px;
  }

  .mobile-sheet-window {
    max-width: none;
    max-height: 82vh;
    border-radius: 18px 18px 12px 12px;
    transform: translateY(24px);
  }

  .mobile-sheet-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
  }

  .mobile-sheet-action {
    grid-column: 1 / -1;
    min-height: 52px;
    font-size: 15px;
  }

  .mobile-sheet-action-half {
    grid-column: auto;
  }

  .about-panel {
    padding: 40px 14px 72px;
  }

  .about-summary {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 16px;
  }

  .about-summary-copy,
  .about-summary-side {
    width: 100%;
  }

  .about-summary-side {
    justify-items: start;
  }

  .about-summary-title {
    font-size: 17px;
  }

  .about-summary-subtitle {
    font-size: 13px;
  }

  .about-hero-meta {
    gap: 8px;
  }

  .about-meta-pill {
    min-height: 30px;
    font-size: 11px;
  }

  .about-lead {
    font-size: 15px;
  }

  .about-panel-inner h1 {
    font-size: 25px;
  }

  .about-panel-inner h2 {
    font-size: 18px;
  }

  .about-panel-inner p,
  .about-list {
    font-size: 14px;
  }

  .about-card {
    padding: 18px 16px;
  }

  .static-page-shell {
    padding: 16px 14px 56px;
  }

  .static-page-card {
    padding: 20px 16px;
  }

  .static-page-card h1 {
    font-size: 24px;
  }

  @supports not (gap: 8px) {
    .topbar > * + * {
      margin-top: 12px;
    }

    .panel-header > * + *,
    .modal-footer > * + * {
      margin-left: 0;
      margin-top: 10px;
    }
  }
}

@media (max-width: 420px) {
  .mobile-sheet-action-half {
    grid-column: 1 / -1;
  }

  .code-settings-toggle-text {
    display: none;
  }

  .topbar-mode-btn-text {
    display: none;
  }
}

@media (max-width: 1050px) {
  html[dir="rtl"] .history-panel {
    border-right: 0;
  }
}

@media (max-width: 1050px) {
  html[dir="rtl"] .preview-panel {
    border-right: 0;
  }
}

@media (max-width: 1050px) {
  html[dir="rtl"] .topbar-brand {
    flex-direction: row-reverse;
  }

  html[dir="rtl"] .topbar-actions,
  html[dir="rtl"] .buttons,
  html[dir="rtl"] .action-row,
  html[dir="rtl"] .template-actions,
  html[dir="rtl"] .chain-actions,
  html[dir="rtl"] .modal-actions,
  html[dir="rtl"] .status-links {
    justify-content: flex-end;
  }

  html[dir="rtl"] .code-settings-menu {
    left: auto;
    right: 0;
  }

  html[dir="rtl"] .template-actions-group-meta {
    justify-content: space-between;
  }

  html[dir="rtl"] .about-summary-side {
    justify-items: end;
  }

  html[dir="rtl"] .history-entry-actions {
    left: auto;
  }
}
