/* ==========================================================================
   Free2Everyone – shared stylesheet for the embedded tool pages (tools/*).
   Mirrors the tokens in assets/style.css so a tool inside the iframe looks
   like part of the same product. One file, referenced by every tool page.
   ========================================================================== */

:root{
  --font-sans:-apple-system,BlinkMacSystemFont,"SF Pro Text","SF Pro Display","Segoe UI Variable Text","Segoe UI",Inter,Roboto,"Helvetica Neue",Arial,sans-serif;
  --bg:#fff;
  --panel:#fff;
  --panel2:#f5f5f7;
  --text:#1d1d1f;
  --muted:#6e6e73;
  --accent:#0b6bcb;
  --accent-hover:#095bb0;
  --accent-soft:#eff5fd;
  --border:#e4e4e7;
  --border-strong:#d2d2d7;
  --danger:#b42318;
  --r-sm:10px;
  --r-md:14px;
  --r-lg:18px;
  --sh-1:0 1px 2px rgba(0,0,0,.04);
  --sh-2:0 10px 30px rgba(0,0,0,.08);
}

*{box-sizing:border-box}
html{width:100%;max-width:100%;height:auto!important;min-height:0;overflow-x:hidden;overflow-y:visible!important;-webkit-text-size-adjust:100%;touch-action:pan-x pan-y pinch-zoom}
body{
  width:100%;max-width:100%;height:auto!important;min-height:0;margin:0;background:var(--bg);color:var(--text);overflow-x:hidden;overflow-y:visible!important;
  font-family:var(--font-sans);font-size:15px;line-height:1.6;
  -webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;
}
img,video,svg{max-width:100%}
a{color:var(--accent)}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:6px}

.app{width:100%;max-width:none;min-width:0;height:auto!important;max-height:none!important;margin:0;padding:28px 28px 44px;overflow-y:visible!important}
.head h1{margin:0 0 6px;font-size:28px;font-weight:650;letter-spacing:-.022em;line-height:1.14}
.head p{max-width:78ch;margin:0;color:var(--muted)}

.panel{
  margin-top:20px;background:var(--panel);border:1px solid var(--border);
  border-radius:var(--r-lg);padding:22px;box-shadow:var(--sh-1);
}

.drop{
  border:1.5px dashed var(--border-strong);border-radius:var(--r-lg);
  padding:36px 24px;text-align:center;background:#fafafc;color:var(--muted);
  transition:border-color .18s ease,background .18s ease;
}
.drop.drag{border-color:var(--accent);background:var(--accent-soft);color:var(--text)}

button,input,select,textarea,.btn{font:inherit;color:inherit}
.btn,button{
  border:1px solid var(--border-strong);background:#fff;color:var(--text);
  padding:10px 17px;border-radius:999px;cursor:pointer;font-weight:550;font-size:14px;
  transition:background .15s ease,border-color .15s ease,transform .15s ease;
}
.btn:hover,button:hover{background:var(--panel2)}
.btn:active,button:active{transform:scale(.985)}
button:disabled{opacity:.5;cursor:default}
.primary{background:var(--accent)!important;color:#fff!important;border-color:var(--accent)!important;font-weight:600}
.primary:hover{background:var(--accent-hover)!important;border-color:var(--accent-hover)!important}
.danger{color:var(--danger);border-color:#f0c4c0}
.danger:hover{background:#fef3f2}

.row{display:flex;gap:12px;flex-wrap:wrap;align-items:flex-end}
.field{flex:1;min-width:min(170px,100%)}
.field label{display:block;color:var(--muted);font-size:12.5px;margin-bottom:6px;font-weight:550}
.field input,.field select,.field textarea{
  width:100%;background:#fff;color:var(--text);border:1px solid var(--border-strong);
  border-radius:var(--r-md);padding:10px 12px;outline:none;transition:border-color .15s ease;
}
.field input:focus,.field select:focus,.field textarea:focus{border-color:var(--accent)}
input[type=file]{color:var(--muted)}

.actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:16px}

.status{
  margin-top:14px;padding:11px 14px;background:var(--accent-soft);
  border:1px solid #d7e6fa;border-radius:var(--r-md);color:#0a4d92;font-size:14px;
}
.note,.filelist{font-size:13px;color:var(--muted);margin-top:12px}
.note{max-width:78ch}
.filelist{
  width:100%;min-height:42px;padding:10px 12px;border:1px solid var(--border);
  border-radius:var(--r-md);background:var(--panel2);overflow-wrap:anywhere;
}

.progress{height:6px;background:var(--panel2);border-radius:999px;overflow:hidden;margin-top:12px}
.progress>div{height:100%;width:0;background:var(--accent);transition:width .15s ease}
/* Native multi-file controllers inside the six protected PPT tool pages still use these two
   class names for their own queue markup, so both rules stay. */
.f2e-batch-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}.f2e-batch-list{padding-left:22px;max-height:240px;overflow:auto}.f2e-batch-list li{display:grid;grid-template-columns:1fr auto;gap:4px 12px;padding:7px;border-bottom:1px solid var(--border)}.f2e-batch-list small{grid-column:1/-1;color:var(--danger)}.f2e-batch-list li[data-state="done"] b{color:#087443}.f2e-batch-list li[data-state="failed"] b{color:var(--danger)}

/* Shared file tray. Injected by assets/tool-runtime.js next to the tool's own file input:
   the visitor decides how many files go in, and sees every name, every size and the total. */
.f2e-files{margin-top:16px;padding:14px 16px;border:1px solid var(--border-strong);border-radius:var(--r-lg);background:#fff}
.f2e-files-head{display:flex;justify-content:space-between;gap:10px;flex-wrap:wrap;align-items:baseline}
.f2e-files-head strong{font-size:14.5px;font-weight:650}
.f2e-files-summary{color:var(--muted);font-size:12.5px;overflow-wrap:anywhere}
.f2e-files-list{list-style:none;margin:10px 0 0;padding:0;max-height:260px;overflow:auto}
.f2e-files-list:empty{margin:0}
.f2e-files-list li{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:10px;align-items:center;padding:8px 0;border-bottom:1px solid var(--border)}
.f2e-files-name{min-width:0;overflow-wrap:anywhere;font-size:13.5px}
.f2e-files-size{color:var(--muted);font-size:12.5px;white-space:nowrap}
.f2e-files-remove{padding:5px 11px;font-size:12.5px}
.f2e-files-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}
.f2e-files-actions button{padding:8px 14px;font-size:13px}
.f2e-cloud-file-button{border-color:#bfd4f3;background:#f5f9ff;color:#0b4f9c;font-weight:650}
.f2e-cloud-file-button:hover,.f2e-cloud-file-button:focus{border-color:var(--accent);background:var(--accent-soft)}
.f2e-cloud-file-button:disabled{opacity:.58;cursor:wait}
.f2e-cloud-only-actions{margin:10px 0 0}
.f2e-files-question{margin-top:12px;padding:12px 14px;border:1px solid #d7e6fa;border-left:4px solid var(--accent);border-radius:var(--r-md);background:var(--accent-soft);color:#0a4d92;font-size:13.5px}
.f2e-files-question[hidden]{display:none}
.f2e-files-question p{margin:0 0 8px;overflow-wrap:anywhere}
.f2e-files-choices{display:flex;gap:8px;flex-wrap:wrap}
.f2e-files-choices button{padding:7px 14px;font-size:13px}
.f2e-files-hint{margin:8px 0 0!important;font-size:12.5px;opacity:.85}
.f2e-files-notice{margin-top:12px;padding:12px 14px;border:1px solid #f0c4c0;border-left:4px solid var(--danger);border-radius:var(--r-md);background:#fef3f2;color:#842424;font-size:13.5px}
.f2e-files-notice[hidden]{display:none}
.f2e-files-notice p{margin:0 0 6px;overflow-wrap:anywhere}
.f2e-files-notice p:last-child{margin-bottom:0}
.f2e-files-links{display:flex;gap:6px;flex-wrap:wrap;align-items:center}
.f2e-files-link{font-weight:600}
/* Browser FFmpeg engine notice. Injected by assets/tool-runtime.js on tools that
   embed @ffmpeg/ffmpeg only, so tools such as merge-pdf or json-formatter are untouched. */
.f2e-engine{margin:16px 0;padding:14px 16px;border:1px solid #d7e6fa;border-left:4px solid var(--accent);border-radius:var(--r-md);background:var(--accent-soft);color:#0a4d92}
.f2e-engine-title{display:block;font-size:14.5px;font-weight:650;line-height:1.35;overflow-wrap:anywhere}
.f2e-engine-body{margin:6px 0 0;font-size:13px;line-height:1.5;color:#0a4d92;overflow-wrap:anywhere}
.f2e-engine-actions{display:flex;gap:12px;flex-wrap:wrap;align-items:center;margin-top:11px}
.f2e-engine-actions button{padding:8px 14px;font-size:13px}
.f2e-engine-source{font-size:12.5px;overflow-wrap:anywhere;word-break:break-all}
.f2e-engine-progress{margin-top:10px}
.f2e-engine-progress[hidden]{display:none}
.f2e-engine-status{margin-top:8px;font-size:13px;line-height:1.45;overflow-wrap:anywhere}
.f2e-engine-status:empty{display:none}
.f2e-engine-detail{margin-top:5px;font-size:12px;line-height:1.4;opacity:.8;overflow-wrap:anywhere}
.f2e-engine-detail:empty{display:none}
/* No "ready" rule: a ready engine takes the whole panel out of the document instead of
   recolouring it, so the state can never be rendered. */
.f2e-engine[data-engine-state="failed"]{border-color:#f0c4c0;border-left-color:var(--danger);background:#fef3f2;color:#842424}
.f2e-engine[data-engine-alert="true"]{box-shadow:0 0 0 3px rgba(11,107,203,.22)}
.f2e-engine[data-engine-state="failed"][data-engine-alert="true"]{box-shadow:0 0 0 3px rgba(180,35,24,.22)}

.ppt-toolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:12px;border-bottom:1px solid var(--border);background:#fafafc}.ppt-toolbar .field{min-width:110px;flex:0 1 160px}.ppt-toolbar input,.ppt-toolbar select{padding:7px 9px}.ppt-workspace{display:grid;grid-template-columns:210px minmax(0,1fr);min-height:620px;border:1px solid var(--border);border-radius:var(--r-lg);overflow:hidden;background:var(--panel2);margin-top:18px}.ppt-slides{padding:12px;border-right:1px solid var(--border);background:#fff;overflow:auto}.ppt-slide-thumb{position:relative;display:block;width:100%;aspect-ratio:16/9;margin-bottom:10px;border:2px solid transparent;border-radius:9px;background:#f8f8fa;overflow:hidden;cursor:pointer;text-align:left;padding:8px}.ppt-slide-thumb.active{border-color:var(--accent)}.ppt-slide-thumb span{font-size:11px;color:var(--muted);overflow-wrap:anywhere}.ppt-canvas-area{display:flex;align-items:center;justify-content:center;min-width:0;padding:28px;overflow:auto}.ppt-canvas{position:relative;width:min(960px,100%);aspect-ratio:16/9;background:#fff;box-shadow:var(--sh-2);overflow:hidden}.ppt-element{position:absolute;min-width:24px;min-height:18px;border:1px solid transparent;overflow:hidden}.ppt-element.selected{border-color:var(--accent);outline:2px solid rgba(11,107,203,.18)}.ppt-element[data-type="text"]{white-space:pre-wrap;padding:4px;line-height:1.18}.ppt-element img{display:block;width:100%;height:100%;object-fit:contain}.ppt-status{margin:10px 0 0}.ppt-image-list{list-style:none;padding:0;margin:12px 0 0}.ppt-image-list li{display:grid;grid-template-columns:46px minmax(0,1fr) auto auto auto;gap:8px;align-items:center;padding:8px 0;border-bottom:1px solid var(--border)}.ppt-image-list img{width:46px;height:34px;object-fit:cover;border-radius:5px}.ppt-image-list span{min-width:0;overflow-wrap:anywhere}.ppt-options{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:12px;margin-top:14px}.ppt-empty{color:var(--muted);padding:30px;text-align:center}.ppt-warning{background:#fff8e6;border-color:#ecd28b;color:#714d00}

/* Shared no-truncation overrides also cover legacy inline tool styles. */
.symbol-menu button,.aspect-lock{white-space:normal!important;overflow-wrap:anywhere}
.page-chip strong{white-space:normal!important;overflow:visible!important;text-overflow:clip!important;overflow-wrap:anywhere}

.pages{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:8px;width:100%;margin-top:12px}
.page-chip{padding:8px 12px;border:1px solid var(--border);border-radius:var(--r-sm);background:var(--panel2);font-size:13px}
.thumbs button.thumb{font:inherit;color:var(--text);text-align:inherit}
.result-list a[download]{font-weight:650;overflow-wrap:anywhere}

.preview{display:block;width:100%;max-width:100%;height:auto;max-height:560px;object-fit:contain;margin:16px auto;border-radius:var(--r-md);background:#fff;box-shadow:var(--sh-1)}
.canvas-wrap{width:100%;overflow:auto;background:var(--panel2);border-radius:var(--r-lg);margin-top:14px;padding:14px}
.canvas-wrap canvas{display:block;max-width:100%;height:auto;margin:auto;background:#fff;border-radius:8px;box-shadow:var(--sh-1)}

/* Runtime-only fit profiles are applied by the outer, non-protected shell. */
html.f2e-fit-preview body{overflow-x:hidden!important}
html.f2e-fit-preview[data-f2e-preview-profile="image-canvas"] .canvas-wrap{
  display:flex;align-items:center;justify-content:center;overflow:hidden
}
html.f2e-fit-preview[data-f2e-preview-profile="image-canvas"] .canvas-wrap canvas{
  width:auto!important;height:auto!important;max-width:100%!important;
  max-height:var(--f2e-preview-max-height,650px)!important;object-fit:contain
}
html.f2e-fit-preview[data-f2e-preview-profile="image-list"] .ppt-image-list img{
  object-fit:contain;background:#fff
}
html.f2e-fit-preview[data-f2e-preview-profile="document-editor"] .ppt-canvas-area{
  min-height:0;overflow:hidden
}
html.f2e-fit-preview[data-f2e-preview-profile="document-editor"] .ppt-canvas{
  flex:none;max-width:100%;max-height:100%
}

/* Once a PDF exists, constrain the editor viewport so the first page can be
   fitted as a whole.  The empty drop state keeps its original sizing. */
html.f2e-fit-preview[data-f2e-preview-profile="pdf-editor"][data-f2e-preview-ready="true"]:not(.f2e-tool-immersive) .app:has(.workspace) .workspace{
  height:var(--f2e-preview-frame-height,620px)!important;min-height:0!important
}
html.f2e-fit-preview[data-f2e-preview-profile="pdf-editor"][data-f2e-preview-ready="true"]:not(.f2e-tool-immersive) .app:has(.workspace) .sidebar,
html.f2e-fit-preview[data-f2e-preview-profile="pdf-editor"][data-f2e-preview-ready="true"]:not(.f2e-tool-immersive) .app:has(.workspace) .viewer{
  height:100%!important;max-height:100%!important;overflow:auto!important
}

/* The editor expands with the page outside immersive mode. */
.app:has(.workspace){height:auto!important;max-height:none!important;padding:0}
.app:has(.workspace) .workspace{height:auto!important;max-height:none!important}
.app:has(.workspace) .sidebar,.app:has(.workspace) .viewer{height:auto!important;max-height:none!important;overflow-y:visible!important}

/* Immersive mode is the sole exception: the iframe owns the viewport and may scroll. */
html.f2e-tool-immersive,html.f2e-tool-immersive body{height:100%!important;overflow-y:auto!important}
html.f2e-tool-immersive .app:has(.workspace){height:100%!important;overflow-y:auto!important}
html.f2e-tool-immersive .app:has(.workspace) .workspace{height:100%!important;min-height:0!important}
html.f2e-tool-immersive .app:has(.workspace) .sidebar,
html.f2e-tool-immersive .app:has(.workspace) .viewer{height:100%!important;overflow:auto!important}

@media(min-width:900px){
  .row{
    display:grid;grid-template-columns:repeat(auto-fit,minmax(min(220px,100%),1fr));
    align-items:end;
  }
  .row>.field:only-child{max-width:380px}
  .panel>.field:has(select):not(:has(textarea)){max-width:380px}
  .panel>.field:has(input):not(:has(textarea)){max-width:640px}

  /* QR keeps a readable input column and reserves the extra width for output. */
  .panel:has(#qr){
    display:grid;grid-template-columns:minmax(0,720px) minmax(280px,1fr);
    column-gap:28px;align-items:start;
  }
  .panel:has(#qr)>.field,.panel:has(#qr)>.actions{grid-column:1}
  .panel:has(#qr)>#qr{grid-column:2;grid-row:1 / span 2;margin:0!important;justify-self:center}
  .panel:has(#qr)>.status{grid-column:1 / -1}

  /* Text and JSON are work surfaces, so their editors intentionally span the panel. */
  .panel:has(textarea#input)>.field,
  .panel:has(textarea#text):not(:has(#qr))>.field{max-width:none}
  textarea#input,textarea#text{min-height:380px;resize:vertical}
}

@media(max-width:640px){
  .app{padding:20px 16px 32px}
  .head h1{font-size:24px}
  .panel{padding:18px}
  .ppt-workspace{grid-template-columns:92px minmax(0,1fr);min-height:480px}.ppt-slides{padding:6px}.ppt-canvas-area{padding:10px}.ppt-toolbar{padding:8px}.ppt-toolbar .field{min-width:90px;flex-basis:125px}.ppt-image-list li{grid-template-columns:38px minmax(0,1fr) auto}.ppt-image-list li button:nth-last-child(-n+2){display:none}
}

/* Mobile tool system: every built-in tool loads this stylesheet.  Keep controls
   compact and in DOM order, then reserve the viewport for the actual editor. */
@media(max-width:640px){
  html,body{width:100%!important;max-width:100%!important;overflow-x:hidden!important}
  body{font-size:13.5px;line-height:1.45}
  .app{width:100%!important;max-width:100%!important;padding:12px 10px 22px!important;overflow-x:hidden!important}
  .head{padding-inline:2px}
  .head h1{margin-bottom:4px!important;font-size:21px!important;line-height:1.15!important}
  .head p{font-size:12.5px!important;line-height:1.4!important}
  .panel{margin-top:10px!important;padding:12px!important;border-radius:12px!important}
  .drop{padding:20px 10px!important;border-radius:12px!important}
  .btn,button{
    min-height:34px!important;max-width:100%;padding:6px 10px!important;border-radius:9px!important;
    font-size:12px!important;line-height:1.15!important;white-space:normal;overflow-wrap:anywhere
  }
  .field{width:100%!important;min-width:0!important;max-width:none!important}
  .field label{margin-bottom:4px;font-size:11.5px}
  .field input,.field select,.field textarea{min-height:38px;padding:7px 9px!important;border-radius:9px!important;font-size:13px!important}
  .row{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:8px!important;width:100%!important}
  .actions,.f2e-batch-actions,.f2e-files-actions,.f2e-files-choices{
    display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:6px!important;margin-top:10px!important;align-items:stretch!important
  }
  .actions>*,.f2e-batch-actions>*,.f2e-files-actions>*,.f2e-files-choices>*{width:100%!important;min-width:0!important;margin:0!important}
  .actions>:only-child,.f2e-batch-actions>:only-child,.f2e-files-actions>:only-child,.f2e-files-choices>:only-child{grid-column:1/-1}
  .drop .actions{display:flex!important;justify-content:center!important;align-items:center!important}
  .drop .actions>*{width:auto!important;min-width:120px!important}
  .file-nav{display:grid!important;grid-template-columns:auto minmax(0,1fr) auto!important;gap:6px!important;align-items:center!important}
  .file-nav span{min-width:0;text-align:center;font-size:11.5px;overflow-wrap:anywhere}
  .move-row{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;gap:6px!important;align-items:end!important}
  .status{margin-top:10px!important;padding:8px 10px!important;border-radius:9px!important;font-size:12px!important}
  .note,.filelist{font-size:12px}
  .filelist{padding:8px 9px!important}
  .f2e-files{margin-top:10px!important;padding:10px!important;border-radius:12px!important}
  .f2e-files-list{max-height:190px}
  .f2e-files-list li{grid-template-columns:minmax(0,1fr) auto!important;gap:5px 8px!important;padding:6px 0!important}
  .f2e-files-size{grid-column:1;font-size:11px}
  .f2e-files-remove{grid-column:2;grid-row:1 / span 2}
  .f2e-engine{margin:10px 0!important;padding:10px!important}
  .canvas-wrap{margin-top:10px!important;padding:8px!important;border-radius:10px!important}
  .preview{margin:10px auto!important;max-height:420px!important}

  /* Editors: one ordered toolbar row, then the largest possible work surface. */
  .app:has(.workspace){padding:0!important;overflow:hidden!important}
  .app:has(.workspace)>.toolbar{
    display:flex!important;flex-wrap:nowrap!important;align-items:center!important;gap:4px!important;
    min-height:46px!important;padding:6px!important;overflow-x:auto!important;overflow-y:hidden!important;
    scrollbar-width:thin;-webkit-overflow-scrolling:touch
  }
  .app:has(.workspace)>.toolbar button{flex:0 0 auto!important;min-height:32px!important;padding:6px 8px!important;font-size:11.5px!important;white-space:nowrap!important}
  .app:has(.workspace)>.toolbar .sep{flex:0 0 auto!important;margin-inline:1px!important}
  .app:has(.workspace)>.toolbar .spacer{display:none!important}
  .app:has(.workspace) .workspace{grid-template-columns:minmax(0,1fr)!important;min-width:0!important}
  .app:has(.workspace) .sidebar{display:none!important}
  .app:has(.workspace) .viewer{min-width:0!important;padding:10px!important}
  .app:has(.workspace) .page-stage{margin-bottom:14px!important}
  .app:has(.workspace) .empty-drop{min-height:calc(100% - 20px)!important;padding:18px 10px!important}
  .app:has(.workspace) .symbol-menu{
    position:fixed!important;z-index:300!important;top:52px!important;left:8px!important;right:8px!important;
    width:auto!important;max-height:60vh!important;overflow:auto!important
  }
  body>.status{right:8px!important;bottom:8px!important;max-width:calc(100% - 16px)!important;padding:6px 9px!important;font-size:11px!important}
  .modal-card{width:calc(100vw - 20px)!important;max-height:calc(100dvh - 20px)!important;padding:12px!important;overflow:auto!important}

  .ppt-toolbar{display:flex!important;flex-wrap:nowrap!important;gap:4px!important;padding:6px!important;overflow-x:auto!important;overflow-y:hidden!important;-webkit-overflow-scrolling:touch}
  .ppt-toolbar .field{flex:0 0 112px!important;min-width:112px!important}
  .ppt-toolbar button{flex:0 0 auto!important;white-space:nowrap!important}
  .ppt-workspace{grid-template-columns:68px minmax(0,1fr)!important;min-height:540px!important;margin-top:10px!important;border-radius:10px!important}
  .ppt-slides{padding:4px!important}
  .ppt-canvas-area{padding:8px!important}
  .ppt-options{grid-template-columns:minmax(0,1fr)!important;gap:8px!important}
  .ppt-image-list li{grid-template-columns:34px minmax(0,1fr) auto!important;gap:6px!important}
}
@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{transition-duration:.01ms!important}
}
