.mobile-only {
  display: none;
}
@media (max-width: 600px) {
  :root {
    --toolbar-height: 44px;
  }
  .timeline-block {
    --toolbar-height: 34px;
  }
  .control-tooltip {
    pointer-events: none;
  }
  .mobile-only {
    display: block;
  }
  .app-header,
  main {
    padding-inline: max(10px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-right));
  }
  main {
    padding-bottom: max(6px, env(safe-area-inset-bottom));
  }
  .app-header {
    grid-template-columns: minmax(0, 1fr) 44px;
    grid-template-rows: auto auto;
    gap: 0 6px;
    padding-top: max(6px, env(safe-area-inset-top));
  }
  .app-header > .brand {
    align-self: end;
  }
  .app-header > #status {
    grid-area: 2 / 1;
    justify-self: start;
    text-align: left;
    white-space: normal;
    text-transform: none;
    letter-spacing: normal;
    font-size: 12px;
  }
  #mobile-menu {
    grid-area: 1 / 2 / 3;
    font-size: 22px;
    padding: 0;
  }
  main > nav {
    flex-wrap: nowrap;
  }
  .control-controls {
    grid-template-columns: 54px;
  }
  .page-split > .workspace-controls,
  .page-split > .history-controls {
    flex: 1 1 0;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr);
  }
  :is(.workspace-controls, .history-controls)
    :is(#workspace-back, #workspace-forward, #history-back, #history-forward) {
    display: none;
  }
  #open-workspace,
  #session-jump {
    border: 0;
    border-radius: 7px;
    font-size: 14px;
  }
  #workspace-label {
    font-size: 11px;
    color: var(--muted-text);
  }
  #workspace-caption {
    font-size: 13px;
    line-height: 16px;
  }
  #open-workspace {
    grid-template-rows: 14px 16px;
  }
  #composer .composer-actions {
    flex-wrap: nowrap;
  }
  #mobile-agent-settings {
    position: relative;
    flex: 1;
    min-width: 0;
    padding: 6px 32px 6px 12px;
    height: auto;
    text-align: left;
    font-size: 13px;
    line-height: 18px;
    overflow-wrap: anywhere;
  }
  #mobile-agent-settings small {
    display: block;
    font-size: 11px;
    line-height: 14px;
    color: var(--muted-text);
  }
  #mobile-agent-settings::after {
    content: '⌃';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
  }
  .composer-input,
  .composer-input:has(#queue-bar:not([hidden])) {
    min-height: 112px;
    padding-top: var(--block-inset);
    padding-inline: var(--block-inset);
  }
  #prompt {
    font-size: 16px;
  }
  .composer-side {
    left: 3px;
    width: auto;
  }
  .composer-toolbars {
    justify-content: space-between;
  }
  #mobile-composer-tools {
    display: flex;
    position: static;
  }
  #request-tools {
    margin-left: auto;
  }
  #request-tools button,
  #mobile-composer-tools button {
    flex: 0 0 44px;
    width: 44px;
  }
  #request-tools #send {
    background: var(--control-active-surface);
    border-radius: 7px;
  }
  #mobile-record:is([aria-pressed='true'], [aria-busy='true']) {
    position: relative;
    color: var(--accent);
    background: var(--control-active-surface);
    box-shadow: inset 0 0 0 1px var(--accent);
  }
  #mobile-record[aria-busy='true']::before {
    content: '';
    position: absolute;
    inset: 3px;
    border: 2px solid currentcolor;
    border-top-color: transparent;
    border-bottom-color: transparent;
    border-radius: 50%;
    animation: voice-processing 1.2s linear infinite;
    pointer-events: none;
  }
  #interrupt:disabled {
    display: none;
  }
  #composer-attachments,
  #queue-bar:not([hidden]) {
    flex: 1 0 100%;
    order: -1;
  }
  #queue-items {
    max-width: none;
  }
  #queue-bar:has(#queue-items:empty):not(:has(#queue-edit-tools:not([hidden]))) {
    display: none;
  }
  #queue-bar button {
    min-width: 44px;
  }
  #notification-center {
    max-height: min(35vh, 220px);
  }
  .notification-card {
    padding: 10px;
  }
  .notification-preview {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  #submission-recovery .session-split {
    display: flex;
    flex-wrap: wrap;
  }
  #submission-recovery button {
    flex: 1 1 140px;
    white-space: normal;
    height: auto;
  }
  .mobile-sheet {
    position: fixed;
    inset: auto 0 0;
    margin: 0 auto;
    width: 100%;
    max-width: 600px;
    max-height: calc(var(--app-height, 100dvh) - 12px);
    overflow-y: auto;
    padding: 12px 16px max(16px, env(safe-area-inset-bottom));
    border: 1px solid var(--border);
    border-radius: 14px 14px 0 0;
    background: var(--card-background);
    color: var(--text);
  }
  .mobile-sheet::backdrop {
    background: rgb(0 0 0 / 60%);
  }
  .mobile-sheet-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
  }
  .mobile-sheet h2 {
    margin: 0;
    font-size: 18px;
  }
  .mobile-sheet button {
    min-height: 44px;
  }
  .mobile-sheet .close-icon {
    width: 44px;
  }
  #mobile-navigation > :not(.mobile-sheet-heading) {
    width: 100%;
    margin-block: 6px;
  }
  #mobile-navigation #session-source .source-controls,
  #mobile-navigation [aria-label='Appearance'] {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #mobile-navigation [aria-label='Appearance'] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  #mobile-navigation .mode-button {
    padding-inline: 4px;
    white-space: normal;
  }
  #mobile-navigation #central-tools {
    display: grid;
    grid-template-columns: 1fr;
  }
  #mobile-navigation #central-tools button,
  #mobile-message-tools button:not(.close-icon) {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 0;
    border-radius: 7px;
    text-align: left;
    height: auto;
  }
  #mobile-navigation #central-tools button::after,
  #mobile-navigation .mode-button::after,
  #mobile-message-tools button:not(.close-icon)::after {
    content: attr(aria-label);
    font-size: 14px;
  }
  #mobile-navigation #session-source button {
    display: flex;
    justify-content: center;
    gap: 8px;
  }
  #mobile-navigation #session-source button::before {
    content: attr(aria-label);
  }
  #mobile-navigation .mode-button svg,
  #mobile-message-tools svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
  }
  #mobile-message-tools #composer-tools {
    display: grid;
    grid-template-columns: 1fr;
  }
  #mobile-agent-sheet .composer-settings,
  #mobile-agent-sheet .model-effort {
    display: flex;
    flex-direction: column;
    flex: none;
    gap: 6px;
  }
  #mobile-agent-sheet .model-effort {
    padding: 10px;
  }
  #mobile-agent-sheet label {
    font-size: 13px;
    color: var(--muted-text);
  }
  #mobile-agent-sheet .composer-settings select {
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: 16px;
    padding-inline: 10px;
    background: var(--input-background);
    color: var(--text);
  }
  #mobile-agent-sheet .composer-settings select:last-child {
    border-radius: 7px;
  }
  #mobile-agent-sheet #subagents {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
  }
  #mobile-agent-sheet #subagents::after {
    content: attr(aria-label);
    position: static;
    background: none;
    width: auto;
    height: auto;
  }
}
@media (prefers-reduced-motion: reduce) {
  #mobile-record[aria-busy='true']::before {
    animation: none;
  }
}

body.focus-mode > .app-header,
body.focus-mode main > nav,
body.focus-mode:not(.focus-composer-visible) #composer {
  display: none;
}
body.focus-mode main {
  padding-top: max(4px, env(safe-area-inset-top));
  padding-bottom: max(4px, env(safe-area-inset-bottom));
}
#exit-focus,
#focus-composer {
  width: 34px;
  height: var(--toolbar-height);
  padding: 0;
  position: fixed;
  z-index: 10;
  top: max(8px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  box-shadow: 0 2px 10px var(--border);
}

[aria-label='Appearance'] > button:not(:first-child):not(:last-child) {
  border-radius: 0;
}

body:not(.focus-mode) .exit-focus-tool,
body:not(.focus-mode) .focus-composer-tool {
  display: none;
}
#exit-focus svg,
#focus-composer svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}
body.focus-mode .timeline-block {
  --block-age-width: 68px;
}
body.focus-mode .timeline-block:has(.block-age) {
  --block-age-width: 102px;
}

#focus-composer {
  right: max(54px, calc(env(safe-area-inset-right) + 42px));
}

body.focus-mode #composer .composer-settings,
body.focus-mode #mobile-agent-settings {
  display: none;
}
body.focus-mode #composer .composer-actions {
  margin-top: 0;
}
