@media (max-width: 820px) {
  .mobile-layout-active .reader-translation-layout:not([data-translation-open="true"]) > #translation-panel,
  .mobile-layout-active .reader-translation-layout > #translation-panel[hidden] {
    display: none;
  }

  .mobile-layout-active .reader-translation-layout[data-translation-open="true"] {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
  }

  .mobile-layout-active .reader-translation-layout[data-translation-open="true"] > #translation-panel {
    position: fixed;
    z-index: 34;
    right: max(8px, env(safe-area-inset-right, 0px));
    bottom: calc(68px + env(safe-area-inset-bottom, 0px));
    left: max(8px, env(safe-area-inset-left, 0px));
    box-sizing: border-box;
    width: auto;
    max-width: calc(var(--mobile-viewport-width, 100vw) - 16px);
    height: 72dvh;
    height: calc(var(--mobile-viewport-height, 100dvh) * 0.72);
    max-height: calc(var(--mobile-viewport-height, 100dvh) - 180px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    margin: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--ui-border-strong);
    border-radius: 4px;
    background: var(--ui-surface);
    box-shadow: 0 8px 24px var(--ui-menu-shadow);
  }

  .mobile-layout-active #translation-panel .translation-panel-content {
    max-width: 100%;
    font-size: 14px;
    line-height: 1.5;
  }

  .mobile-layout-active #translation-panel .translation-header {
    position: sticky;
    top: 0;
    z-index: 2;
    align-items: center;
    min-height: 52px;
    padding: 0 4px 0 12px;
    background: var(--ui-surface);
  }

  .mobile-layout-active #translation-panel .translation-header h2 {
    margin: 0;
    font-size: 16px;
    line-height: 1.4;
  }

  .mobile-layout-active #translation-panel .translation-header p {
    display: none;
  }

  .mobile-layout-active #translation-panel .translation-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    font-size: 24px;
  }

  .mobile-layout-active #translation-panel .translation-history-tabs {
    gap: 4px;
    padding: 4px 12px 0;
  }

  .mobile-layout-active #translation-panel .translation-history-tabs .button {
    padding: 6px 8px;
    font-size: 14px;
  }

  .mobile-layout-active #translation-panel .translation-form {
    gap: 6px;
    padding: 8px 12px 12px;
  }

  .mobile-layout-active #translation-panel .translation-page-choice {
    gap: 0 10px;
  }

  .mobile-layout-active #translation-panel .translation-page-choice label {
    min-height: 44px;
    font-size: 14px;
  }

  .mobile-layout-active #translation-panel .translation-page-choice input {
    flex: none;
    width: 18px;
    height: 18px;
    min-height: 18px;
    margin: 0;
  }

  .mobile-layout-active #translation-panel :is(.translation-field, .translation-saved-row) {
    font-size: 14px;
  }

  .mobile-layout-active #translation-panel :is(.translation-field, .translation-saved-row) :is(input, select) {
    min-height: 44px;
    font-size: 16px;
  }

  .mobile-layout-active #translation-panel :is(.translation-start-row, .translation-unavailable, .translation-progress) .button {
    min-height: 44px;
    font-size: 14px;
  }

  .mobile-layout-active #translation-panel :is(button, select, summary),
  .reader-toolbar .translation-mode-button,
  .reader-toolbar .translation-mode-notice button {
    min-height: 44px;
  }

  .mobile-layout-active #translation-panel :is(.translation-excerpt-action, .translation-source-icon) {
    min-width: 44px;
  }

  .mobile-layout-active #translation-panel :is(
    .translation-page-limit,
    .translation-retry-hint,
    .translation-status,
    .translation-empty,
    .translation-visual-notice,
    .translation-unavailable,
    .translation-progress,
    .translation-run-confirmation p,
    .translation-run-page-picker small
  ) {
    font-size: 14px;
  }

  .mobile-layout-active #translation-panel .translation-run-history > div {
    flex-wrap: wrap;
  }

  .mobile-layout-active #translation-panel .translation-run-history select {
    flex: 1 1 160px;
  }
}
