/*
 * Mobile-only presentation for standard upload/process tool pages.
 *
 * This file is conditionally loaded by tool_detail.html. Editor/camera tools
 * are excluded in apps/web/views.py, and every rule stays below 768px so the
 * desktop layout and shared header/logo remain unchanged.
 */

/* The wrappers are layout-neutral on desktop and only become visual shells on mobile. */
.tool-detail-mobile-progress-icon {
  display: none;
}

@media (min-width: 1025px) and (hover: hover) and (pointer: fine) {
  .tool-detail-workspace,
  .tool-detail-info-shell {
    display: contents;
  }

  .tool-detail-info-shell > .mmpdf-card {
    margin-top: 1.5rem;
  }
}

@media (max-width: 1024px), (hover: none) and (pointer: coarse) {
  .tool-detail-page {
    min-height: calc(100vh - 64px);
    padding: 0 12px 38px !important;
    background: #f5f7fb;
  }

  .tool-detail-container {
    width: 100%;
    max-width: 520px;
  }

  .tool-detail-hero {
    margin: 0 !important;
    padding: 22px 2px 18px;
    text-align: left !important;
  }

  .tool-detail-hero h1 {
    margin: 0;
    font-size: 32px;
    font-weight: 900;
    line-height: 1.16;
    letter-spacing: -.035em;
  }

  .tool-detail-hero p {
    margin-top: 9px;
    color: #64748b;
    font-size: 14px;
    line-height: 1.65;
  }

  .tool-detail-stack,
  .tool-detail-workspace {
    display: block;
    --tw-space-y-reverse: 0;
  }

  .tool-detail-workspace {
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 21px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .07);
  }

  .tool-detail-workspace > :not([hidden]) ~ :not([hidden]) {
    margin-top: 0;
  }

  .tool-detail-workspace > .mmpdf-card {
    padding: 18px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .tool-detail-workspace > .tool-detail-options-card,
  .tool-detail-workspace > .tool-detail-action-card {
    border-top: 1px solid #edf0f4;
  }

  .tool-detail-workspace[data-mobile-stage]:not([data-mobile-stage="idle"]) > .tool-detail-upload-card,
  .tool-detail-workspace[data-mobile-stage]:not([data-mobile-stage="idle"]) > .tool-detail-options-card {
    display: none !important;
  }

  .tool-detail-workspace[data-mobile-stage]:not([data-mobile-stage="idle"]) > .tool-detail-action-card {
    padding: 16px;
    border-top: 0;
  }

  .tool-detail-workspace[data-mobile-stage]:not([data-mobile-stage="idle"]) .tool-detail-action-head {
    display: none !important;
  }

  .tool-detail-workspace[data-mobile-stage]:not([data-mobile-stage="idle"]) .tool-detail-status-panel {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  .tool-detail-workspace-head {
    margin-bottom: 13px;
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
  }

  .tool-detail-workspace-head h2,
  .tool-detail-options-card h2,
  .tool-detail-action-card h2 {
    font-size: 18px;
    line-height: 1.35;
  }

  .tool-detail-workspace-head > div:last-child {
    padding-top: 4px;
    font-size: 12px;
    white-space: nowrap;
  }

  .tool-detail-upload-zone {
    min-height: 220px;
    padding: 24px 16px;
    border-width: 1.5px;
    border-color: #cbd5e1;
    border-radius: 17px;
    background: linear-gradient(180deg, #fbfdff, #f8fafc);
  }

  .tool-detail-upload-zone > div > div:first-child {
    border: 1px solid #eef2f7;
    border-radius: 18px;
    box-shadow: 0 7px 20px rgba(15, 23, 42, .07);
  }

  .tool-detail-upload-zone .text-base {
    font-size: 17px;
    line-height: 1.5;
  }

  .tool-detail-upload-zone p {
    margin-top: 5px;
    font-size: 13px;
  }

  .tool-detail-selected-files {
    margin-top: 16px;
  }

  .tool-detail-file-row {
    min-height: 58px;
    padding: 10px;
    border-radius: 13px;
    background: #fbfcfe;
    box-shadow: none;
  }

  .tool-detail-file-actions {
    margin-left: 8px;
    opacity: 1;
  }

  .tool-detail-file-actions button {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    background: #fff;
  }

  .tool-detail-options-card > .mb-5 {
    margin-bottom: 13px;
  }

  .tool-detail-options-shell {
    padding: 15px;
    border-radius: 14px;
  }

  .tool-detail-action-card > .flex:first-child {
    align-items: stretch;
    gap: 13px;
  }

  .tool-detail-action-card .mmpdf-btn {
    width: 100%;
    min-height: 48px;
    border-radius: 14px;
    font-size: 15px;
  }

  .tool-detail-action-card [x-show="status !== 'idle'"] {
    margin-top: 18px;
    padding-top: 18px;
  }

  .tool-detail-action-card [x-show="status === 'success'"],
  .tool-detail-action-card [x-show="status === 'failed'"] {
    padding: 18px;
  }

  .tool-detail-progress-card {
    min-height: 230px;
    padding: 28px 20px;
    border: 1px solid #bae6fd;
    border-radius: 16px;
    background: #f0faff;
  }

  .tool-detail-mobile-progress-icon {
    display: flex;
    width: 56px;
    height: 56px;
    margin: 0 auto 20px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #cffafe;
    color: #0891b2;
  }

  .tool-detail-mobile-progress-icon svg {
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
  }

  .tool-detail-progress-card > .mb-2 {
    margin-bottom: 12px;
  }

  .tool-detail-success-card,
  .tool-detail-failed-card {
    border-radius: 16px;
  }

  .tool-detail-info-shell {
    display: block;
    overflow: hidden;
    margin-top: 16px !important;
    border: 1px solid #e2e8f0;
    border-radius: 19px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .04);
  }

  .tool-detail-info-shell > .mmpdf-card {
    margin-top: 0;
    padding: 20px 17px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .tool-detail-info-shell > .mmpdf-card + .mmpdf-card {
    border-top: 1px solid #edf0f4;
  }

  .tool-detail-usage-card > h2:first-child,
  .tool-detail-info-shell > .mmpdf-card + .mmpdf-card > h2:first-child {
    margin-bottom: 17px;
    font-size: 20px;
    line-height: 1.35;
  }

  .tool-detail-usage-card > .grid:first-of-type {
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    padding: 5px 0 2px;
  }

  .tool-detail-usage-card > .grid:first-of-type::before {
    position: absolute;
    top: 23px;
    right: 12.5%;
    left: 12.5%;
    height: 2px;
    background: #dbeafe;
    content: "";
  }

  .tool-detail-usage-card > .grid:first-of-type > div {
    position: relative;
    z-index: 1;
    min-width: 0;
  }

  .tool-detail-usage-card > .grid:first-of-type > div > div:first-child {
    width: 36px;
    height: 36px;
    margin-bottom: 9px;
    border: 2px solid #93c5fd;
    background: #fff;
    box-shadow: 0 0 0 4px #fff;
    font-size: 12px;
  }

  .tool-detail-usage-card > .grid:first-of-type h3 {
    margin: 0;
    font-size: 12px;
    line-height: 1.35;
    white-space: nowrap;
  }

  .tool-detail-usage-card > .grid:first-of-type p {
    display: none;
  }

  .tool-detail-usage-card > h2:nth-of-type(2),
  .tool-detail-usage-card > ul {
    display: none !important;
  }

  .tool-detail-info-shell > .mmpdf-card + .mmpdf-card .space-y-6 {
    margin: 0;
  }

  .tool-detail-info-shell > .mmpdf-card + .mmpdf-card .space-y-6 > div {
    padding: 14px 0;
  }

  .tool-detail-info-shell > .mmpdf-card + .mmpdf-card .space-y-6 > div:first-child {
    padding-top: 0;
  }

  .tool-detail-info-shell > .mmpdf-card + .mmpdf-card .space-y-6 > div:last-child {
    padding-bottom: 0;
  }

  .tool-detail-info-shell > .mmpdf-card + .mmpdf-card .space-y-6 > div + div {
    margin-top: 0;
    border-top: 1px solid #edf0f4;
  }

  .tool-detail-info-shell > .mmpdf-card + .mmpdf-card h3 {
    font-size: 15px;
    line-height: 1.45;
  }

  .tool-detail-info-shell > .mmpdf-card + .mmpdf-card p {
    margin-top: 6px;
    color: #64748b;
    font-size: 13px;
    line-height: 1.65;
  }

  .tool-detail-info-shell ~ * {
    display: none !important;
  }

  footer[role="contentinfo"] {
    margin-top: 0 !important;
    border-top: 0;
    background: #f5f7fb;
  }

  footer[role="contentinfo"] > .container {
    padding: 25px 12px calc(18px + env(safe-area-inset-bottom));
  }

  footer[role="contentinfo"] > .container > .grid {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px 14px;
  }

  footer[role="contentinfo"] > .container > .grid > div:nth-child(-n+2) {
    display: none;
  }

  footer[role="contentinfo"] > .container > .grid > div:nth-child(n+3),
  footer[role="contentinfo"] > .container > .grid > div:nth-child(n+3) ul {
    display: contents;
  }

  footer[role="contentinfo"] > .container > .grid h3,
  footer[role="contentinfo"] > .container > .grid li {
    display: none;
  }

  footer[role="contentinfo"] > .container > .grid > div:nth-child(3) li:nth-child(3),
  footer[role="contentinfo"] > .container > .grid > div:nth-child(4) li:nth-child(1),
  footer[role="contentinfo"] > .container > .grid > div:nth-child(4) li:nth-child(4) {
    display: block;
    margin: 0;
    color: #64748b;
    font-size: 12px;
    line-height: 1.6;
    white-space: nowrap;
  }

  footer[role="contentinfo"] > .container > .grid a {
    color: #64748b;
  }

  footer[role="contentinfo"] > .container > .border-t {
    margin-top: 13px !important;
    padding-top: 0 !important;
    border-top: 0;
    color: #94a3b8;
    font-size: 11px;
    line-height: 1.7;
  }

  footer[role="contentinfo"] > .container > .border-t::before {
    content: "© 2026 喵喵工具箱 ·";
  }

  footer[role="contentinfo"] > .container > .border-t > p:first-child {
    display: none;
  }

  footer[role="contentinfo"] > .container > .border-t > p.mt-2 {
    display: inline;
    margin: 0 0 0 4px;
  }

  footer[role="contentinfo"] > .container > .border-t a {
    color: inherit;
  }
}

@media (max-width: 370px) {
  .tool-detail-page {
    padding-right: 10px !important;
    padding-left: 10px !important;
  }

  .tool-detail-hero h1 {
    font-size: 29px;
  }

  .tool-detail-workspace > .mmpdf-card {
    padding-right: 15px;
    padding-left: 15px;
  }

  .tool-detail-usage-card > .grid:first-of-type h3 {
    font-size: 11px;
  }
}
