#mobile-nav, .crop-touch, .pnl-mobile-results, .pc-cell-label { display: none; }

.preview {
  width: fit-content;
  max-width: 100%;
  outline: 1px solid var(--line);
}
.preview canvas {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(58vh,540px);
  max-height: min(58svh,540px);
  border: 0;
}

@media (pointer: coarse) {
  .preview { touch-action: pan-y pinch-zoom; cursor: auto; }
  .preview.is-drawing { touch-action: none; cursor: crosshair; }
  .crop-touch { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
  .crop-touch button[aria-pressed=true] { background: var(--action); color: var(--on-action); }
}

@media (max-width: 760px) {
  :root { --mobile-bar: calc(62px + env(safe-area-inset-bottom,0px)); }
  html { scroll-padding-bottom: calc(var(--mobile-bar) + 16px); }
  body { padding-bottom: var(--mobile-bar); }
  .shell,body:not(.tool-mode) .shell { min-height: calc(100dvh - var(--mobile-bar)); }
  main, body:not(.tool-mode) main {
    padding-left: max(16px,env(safe-area-inset-left,0px));
    padding-right: max(16px,env(safe-area-inset-right,0px));
  }
  #mobile-nav {
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    position: fixed;
    z-index: 5;
    inset: auto 0 0;
    min-height: var(--mobile-bar);
    padding: 4px max(8px,env(safe-area-inset-right,0px)) calc(4px + env(safe-area-inset-bottom,0px)) max(8px,env(safe-area-inset-left,0px));
    background: var(--surface);
    border-top: 1px solid var(--line);
    box-shadow: 0 -5px 20px #21153b16;
  }
  #mobile-nav a {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 3px;
    min-height: 52px;
    border-radius: 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }
  #mobile-nav a[aria-current=page] { color: var(--accent); background: var(--soft); }
  #mobile-nav a:focus-visible { outline: 2px solid var(--focus); outline-offset: -3px; }
  .landing-hero { min-height: 0; padding-top: 23px; }
  .landing-hero h1 { font-size: clamp(34px,9vw,58px); }
  .landing-actions > a { flex: 1 1 max-content; }
  .landing-nav { padding-top: env(safe-area-inset-top,0px); }
  .landing-nav nav > a { display: none; }
  .landing-nav nav .theme-picker { margin-left: auto; }
  .landing-note { gap: 4px 14px; }
  .landing .card { min-height: 0; }
  .landing-workflow { margin-bottom: 24px; }
  .workspace-bar { padding-top: env(safe-area-inset-top,0px); gap: 10px; }
  .breadcrumb { min-width: 0; overflow-wrap: anywhere; }
  .work-head { margin: 8px 0 16px; }
  .work-panel { min-width: 0; }
  .work-panel .field { min-width: 0; }
  .work-panel .field :is(input,select,textarea), .pc-scroll input { max-width: 100%; font-size: 16px; min-height: 46px; }
  .work-panel input[type=file] { padding: 7px; overflow: hidden; }
  .work-panel input[type=file]::file-selector-button { min-height: 36px; font: inherit; color: var(--accent); background: var(--soft); border: 0; border-radius: 6px; margin-right: 6px; }
  .work-panel .primary, .work-panel .secondary { min-height: 46px; }
  .pnl-mobile-results { display: inline-flex; }
  .pnl-summary { scroll-margin-top: 15px; }
  .pnl-return input[type=range] { height: 44px; }
  .qr-toggle input,.pnl-credit input { min-width: 22px; min-height: 22px; }
}

@media (max-width: 525px) {
  .quick-tools { grid-template-columns: 1fr; gap: 8px; }
  .quick-card { display: grid; grid-template-columns: 55px minmax(0,1fr); column-gap: 12px; align-items: center; min-height: 62px; padding: 7px 10px; }
  .quick-card svg { width: 53px; height: 46px; grid-row: span 2; }
  .quick-card strong { margin: 2px 0 0; align-self: end; font-size: 15px; }
  .quick-card span { align-self: start; font-size: 13px; }
  .landing .cards { grid-template-columns: 1fr; }
  .landing .filter { flex-grow: 1; }
  .crop-touch { flex-direction: column; align-items: flex-start; }
  .qr-preview { flex-wrap: wrap; }
  .pc-scroll { overflow: visible; border: 0; }
  .pc-scroll table,.pc-scroll tbody { display: block; }
  .pc-scroll thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .pc-scroll tbody tr { display: grid; margin-bottom: 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; }
  .pc-scroll tbody td { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.1fr); gap: 8px; align-items: center; padding: 6px 0; overflow-wrap: anywhere; }
  .pc-scroll tbody td:last-child { border-bottom: 0; }
  .pc-scroll input { width: 100%; }
  .pc-cell-label { display: block; color: var(--muted); font-size: 13px; font-weight: 700; }
}
