/* The six GIF tool pages on js/tc-gif.js (/gif-compressor, /loop-gif, /resize-gif, /crop-gif, /reverse-gif,
   /gif-to-jpg). The header, hero, upload box, FAQ and related rules are the house tool-page rules
   (gif-speed-changer.html, flip-book-maker.html); the gx- rules are the shared tool layout. */
*{margin:0;padding:0;box-sizing:border-box;font-family:'DM Sans',-apple-system,sans-serif}
:root{--bg:#0B1220;--surface:#141C2A;--surface2:#1F2A3A;--border:#1F2A3A;--text:#e8eaf0;--text-m:#8b90a0;--text-mm:#5a6478;--aqua:#22d3ee;--aqua-dark:#0891b2;--green:#22c55e;--green-dark:#16a34a;--red:#ef4444;--amber:#f59e0b}
body{background:var(--bg);color:var(--text);min-height:100vh;line-height:1.5;-webkit-font-smoothing:antialiased}
header.header{height:54px;background:var(--surface);border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;padding:0 16px;position:sticky;top:0;z-index:100}
.brand{font-size:15px;font-weight:700;color:var(--text);text-decoration:none}
.brand span{color:var(--aqua)}
.header-try-editor{padding:7px 14px;border-radius:8px;color:#fff;background:linear-gradient(135deg,#22c55e,#16a34a);border:1px solid #16a34a;font-size:13px;font-weight:700;text-decoration:none;box-shadow:0 2px 10px rgba(34,197,94,0.25);transition:all .2s;white-space:nowrap}
.header-try-editor:hover{background:linear-gradient(135deg,#4ade80,#22c55e);box-shadow:0 6px 20px rgba(34,197,94,0.5);transform:translateY(-1px)}
:focus-visible{outline:2px solid var(--aqua);outline-offset:2px}

.tbg-hero{max-width:1100px;margin:0 auto;padding:34px 22px 18px;text-align:center}
.tbg-kicker{display:inline-flex;align-items:center;gap:7px;font-size:11px;font-weight:700;color:var(--aqua);text-transform:uppercase;letter-spacing:0.1em;padding:4px 12px;border-radius:99px;border:1px solid rgba(34,211,238,0.3);background:rgba(34,211,238,0.06);margin-bottom:16px}
.tbg-kicker svg{width:11px;height:11px;color:#86efac}
.tbg-h1{font-size:44px;font-weight:800;letter-spacing:-0.02em;margin:0 auto 10px;line-height:1.06;max-width:840px;text-wrap:balance}
.tbg-h1 .accent{color:var(--aqua)}
.tbg-subhead{font-size:17px;font-weight:700;color:var(--text);max-width:660px;margin:-2px auto 10px;line-height:1.4;letter-spacing:-0.01em}
.tbg-sub{font-size:15px;color:var(--text-m);max-width:640px;margin:0 auto 20px;line-height:1.6}
.tbg-sub strong{color:var(--text)}
@media(max-width:640px){.tbg-hero{padding:18px 16px 10px}.tbg-h1{font-size:29px}.tbg-subhead{font-size:15px}.tbg-sub{font-size:13.5px;margin-bottom:14px}.tbg-kicker{margin-bottom:12px}}

.tbg-upload{max-width:520px;margin:0 auto;border:2px dashed rgba(34,211,238,0.35);border-radius:16px;padding:24px 20px;background:rgba(20,28,42,0.55);display:flex;flex-direction:column;align-items:center;gap:10px;position:relative;transition:border-color .15s,background .15s}
.tbg-upload:hover,.tbg-upload.dragover{border-color:var(--aqua);background:rgba(20,28,42,0.75)}
.tbg-upload input[type=file]{position:absolute;inset:0;opacity:0;cursor:pointer;width:100%;height:100%}
.tbg-up-kicker{font-size:11px;font-weight:700;color:var(--text-m);text-transform:uppercase;letter-spacing:0.1em}
.tbg-up-cta{display:inline-flex;align-items:center;gap:8px;min-height:48px;padding:13px 28px;border-radius:13px;background:linear-gradient(135deg,#22d3ee,#0891b2);color:#04222b;font-size:15px;font-weight:800;border:none;box-shadow:0 4px 18px rgba(34,211,238,0.3);cursor:pointer;font-family:inherit}
.tbg-up-cta svg{width:17px;height:17px}
.tbg-up-label{font-size:12px;color:var(--text-m);text-align:center}
.tbg-up-hint{font-size:11px;color:var(--text-mm);letter-spacing:0.02em;text-align:center}
.tbg-trust{max-width:620px;margin:14px auto 0;text-align:center;font-size:13px;color:var(--text-m);display:flex;flex-wrap:wrap;justify-content:center;gap:6px 14px}
.tbg-trust span{display:inline-flex;align-items:center;gap:5px}
.tbg-trust svg{width:13px;height:13px;color:#22c55e}
.tbg-trust strong{color:#86efac;font-weight:700}
.tbg-hidden{display:none !important}
.tbg-error{max-width:560px;margin:14px auto 0;padding:12px 16px;border-radius:10px;background:rgba(239,68,68,0.1);border:1px solid rgba(239,68,68,0.35);color:#fca5a5;font-size:13px;text-align:center;line-height:1.55}
.tbg-error a{color:#67e8f9}
.gx-preset{max-width:560px;margin:0 auto 14px;padding:10px 14px;border-radius:11px;background:rgba(34,211,238,.08);border:1px solid rgba(34,211,238,.35);color:#a5f3fc;font-size:13px;line-height:1.5}
.gx-preset b{color:#fff}

/* progress */
.gx-busy{margin:0 0 12px;padding:12px 14px;border-radius:12px;background:var(--surface);border:1px solid var(--border);text-align:left}
.gx-busy-row{display:flex;align-items:center;gap:10px}
.gx-busy-txt{flex:1;min-width:0;font-size:13px;color:var(--text-m);font-variant-numeric:tabular-nums}
.gx-bar{height:8px;background:var(--surface2);border-radius:99px;overflow:hidden;margin-top:9px}
.gx-bar i{display:block;height:100%;width:0;background:linear-gradient(90deg,#22d3ee,#22c55e);transition:width .12s}

/* tool */
.gx-tool{max-width:1120px;margin:16px auto 0;padding:0 20px;scroll-margin-top:64px}
.gx-grid{display:grid;grid-template-columns:minmax(0,1fr) 340px;gap:16px;align-items:start}
/* one column: the controls come first (picking a size is the next step), except on Crop, where the box is */
@media(max-width:920px){.gx-grid{grid-template-columns:minmax(0,1fr)}.gx-grid.gx-ctl-first>.gx-card:last-child{order:-1}}
.gx-card{background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:14px;min-width:0}
.gx-compare{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.gx-side{text-align:center;min-width:0}
.gx-side-h{font-size:10.5px;font-weight:800;color:var(--text-m);text-transform:uppercase;letter-spacing:.09em;margin-bottom:8px}
.gx-side-h b{color:var(--aqua)}
.gx-frame{border-radius:10px;overflow:hidden;background-color:#0f141d;background-image:linear-gradient(45deg,#151b26 25%,transparent 25%),linear-gradient(-45deg,#151b26 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#151b26 75%),linear-gradient(-45deg,transparent 75%,#151b26 75%);background-size:18px 18px;background-position:0 0,0 9px,9px -9px,-9px 0;display:flex;align-items:center;justify-content:center;min-height:180px;padding:8px}
.gx-frame img,.gx-frame canvas{max-width:100%;max-height:330px;width:auto;height:auto;display:block}
.gx-frame img[src=""],.gx-frame img:not([src]){display:none}
.gx-empty{font-size:12.5px;color:var(--text-mm);padding:12px}
.gx-cap{font-size:11.5px;color:var(--text-mm);margin-top:7px;font-variant-numeric:tabular-nums;line-height:1.5}
.gx-cap b{color:var(--text)}
.gx-facts{width:100%;border-collapse:collapse;margin-top:12px;font-size:12.5px;font-variant-numeric:tabular-nums}
.gx-facts th,.gx-facts td{padding:7px 8px;border-bottom:1px solid var(--border);text-align:left}
.gx-facts th{font-size:10.5px;font-weight:800;color:var(--text-mm);text-transform:uppercase;letter-spacing:.07em}
.gx-facts td{color:var(--text-m)}
.gx-facts td b{color:var(--text)}
.gx-facts .good{color:#86efac;font-weight:800}
.gx-facts .warn{color:#fcd34d;font-weight:800}

.gx-sec{font-size:11px;font-weight:800;color:var(--text-m);text-transform:uppercase;letter-spacing:.09em;margin:0 0 9px}
.gx-sec+.gx-sec{margin-top:14px}
.gx-block{margin-bottom:15px}
.gx-chips{display:flex;flex-wrap:wrap;gap:6px}
.gx-chip{min-height:44px;padding:8px 12px;border-radius:9px;background:var(--surface2);border:1px solid var(--border);color:var(--text-m);font-size:12.5px;font-weight:800;cursor:pointer;font-family:inherit;line-height:1.2;text-align:left}
.gx-chip small{display:block;font-size:10.5px;font-weight:700;color:var(--text-mm);margin-top:1px}
.gx-chip:hover{border-color:rgba(34,211,238,.5);color:var(--text)}
.gx-chip.on{background:rgba(34,211,238,.14);border-color:var(--aqua);color:var(--aqua)}
.gx-chip.on small{color:#67e8f9}
.gx-seg{display:flex;background:var(--surface2);border:1px solid var(--border);border-radius:10px;padding:3px;gap:2px}
.gx-seg button{flex:1;border:0;background:transparent;min-height:44px;padding:7px 6px;border-radius:7px;font-weight:800;font-size:12.5px;color:var(--text-m);cursor:pointer;font-family:inherit}
.gx-seg button.on{background:var(--aqua);color:#04222b}
.gx-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-bottom:10px}
.gx-row label,.gx-lbl{font-size:12.5px;color:var(--text-m);font-weight:700}
.gx-row select,.gx-row input[type=number],.gx-row input[type=text],.gx-sel{background:var(--surface2);color:var(--text);border:1px solid var(--border);border-radius:9px;min-height:44px;padding:8px 10px;font-size:13.5px;font-family:inherit;font-weight:700}
.gx-row input[type=number]{width:92px}
.gx-row select:focus,.gx-row input:focus{outline:none;border-color:var(--aqua)}
.gx-range{display:flex;align-items:center;gap:10px}
.gx-range input{flex:1;min-width:0;accent-color:#22d3ee;height:30px}
.gx-range output{font-size:12.5px;font-weight:800;color:var(--aqua);min-width:86px;text-align:right;font-variant-numeric:tabular-nums}
.gx-check{display:flex;align-items:flex-start;gap:9px;font-size:13px;color:var(--text);margin-bottom:10px;cursor:pointer;line-height:1.45;min-height:30px}
.gx-check input{width:18px;height:18px;margin-top:1px;flex:none;accent-color:#22d3ee}
.gx-check span small{display:block;color:var(--text-mm);font-size:11.5px}
.gx-note{font-size:12px;color:var(--text-mm);line-height:1.55;margin:6px 0 0}
.gx-note b{color:var(--text-m)}
.gx-warn{border-radius:10px;padding:10px 12px;font-size:12.5px;line-height:1.55;margin:10px 0}
.gx-warn.amber{background:rgba(245,158,11,.09);border:1px solid rgba(245,158,11,.36);color:#fde68a}
.gx-warn.aqua{background:rgba(34,211,238,.07);border:1px solid rgba(34,211,238,.3);color:#a5f3fc}
.gx-warn.green{background:rgba(34,197,94,.08);border:1px solid rgba(34,197,94,.35);color:#bbf7d0}
.gx-warn b{color:#fff}
.gx-act{display:flex;flex-direction:column;gap:8px;margin-top:12px}
.gx-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:46px;padding:11px 18px;border-radius:11px;font-size:14px;font-weight:800;border:none;cursor:pointer;text-decoration:none;transition:all .15s;font-family:inherit;width:100%}
.gx-btn svg{width:16px;height:16px}
.gx-btn[disabled],.gx-btn[aria-disabled=true]{opacity:.5;cursor:default;pointer-events:none}
.gx-btn-go{background:linear-gradient(135deg,#22d3ee,#0891b2);color:#04222b;box-shadow:0 4px 16px rgba(34,211,238,.25)}
.gx-btn-go:hover{filter:brightness(1.08)}
.gx-btn-dl{background:linear-gradient(135deg,#22c55e,#16a34a);color:#fff;box-shadow:0 4px 18px rgba(34,197,94,.28)}
.gx-btn-dl:hover{background:linear-gradient(135deg,#4ade80,#22c55e)}
.gx-btn-ghost{background:var(--surface2);color:var(--text);border:1px solid var(--border)}
.gx-btn-ghost:hover{background:#26334a}
.gx-tries{margin-top:10px;font-size:12px;color:var(--text-m)}
.gx-tries summary{cursor:pointer;font-weight:700;color:var(--text-m);min-height:44px;padding:11px 0}
.gx-tries ol{margin:6px 0 0 18px;line-height:1.6;font-variant-numeric:tabular-nums}

/* crop */
.gx-stage{position:relative;display:flex;justify-content:center;user-select:none;-webkit-user-select:none}
.gx-stage-in{position:relative;line-height:0;touch-action:none}
.gx-stage canvas{display:block;max-width:100%;border-radius:4px;background:#000}
/* the dim outside the crop box: a shadow on a hole, clipped to the picture so it never greys the page */
.gx-shade{position:absolute;inset:0;pointer-events:none;overflow:hidden;border-radius:4px}
.gx-hole{position:absolute;box-shadow:0 0 0 9999px rgba(5,8,14,.62)}
.gx-hole.circle{border-radius:50%}
.gx-box{position:absolute;border:2px solid #fff;box-shadow:0 0 0 1px rgba(0,0,0,.6) inset;cursor:move;touch-action:none}
.gx-box.circle{border-radius:50%}
.gx-box::after{content:"";position:absolute;inset:0;background:linear-gradient(to right,transparent 33%,rgba(255,255,255,.35) 33%,rgba(255,255,255,.35) calc(33% + 1px),transparent calc(33% + 1px),transparent 66%,rgba(255,255,255,.35) 66%,rgba(255,255,255,.35) calc(66% + 1px),transparent calc(66% + 1px)),linear-gradient(to bottom,transparent 33%,rgba(255,255,255,.35) 33%,rgba(255,255,255,.35) calc(33% + 1px),transparent calc(33% + 1px),transparent 66%,rgba(255,255,255,.35) 66%,rgba(255,255,255,.35) calc(66% + 1px),transparent calc(66% + 1px));pointer-events:none;border-radius:inherit}
.gx-h{position:absolute;width:22px;height:22px;background:#fff;border:2px solid #0891b2;border-radius:50%;transform:translate(-50%,-50%);touch-action:none;z-index:2}
.gx-h::before{content:"";position:absolute;inset:-12px}
.gx-h[data-h=nw]{left:0;top:0;cursor:nwse-resize}.gx-h[data-h=ne]{left:100%;top:0;cursor:nesw-resize}
.gx-h[data-h=sw]{left:0;top:100%;cursor:nesw-resize}.gx-h[data-h=se]{left:100%;top:100%;cursor:nwse-resize}
.gx-h[data-h=n]{left:50%;top:0;cursor:ns-resize}.gx-h[data-h=s]{left:50%;top:100%;cursor:ns-resize}
.gx-h[data-h=w]{left:0;top:50%;cursor:ew-resize}.gx-h[data-h=e]{left:100%;top:50%;cursor:ew-resize}
.gx-box.locked .gx-h[data-h=n],.gx-box.locked .gx-h[data-h=s],.gx-box.locked .gx-h[data-h=w],.gx-box.locked .gx-h[data-h=e]{display:none}
.gx-nums{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}
.gx-nums label{display:flex;flex-direction:column;gap:3px;font-size:11px;font-weight:800;color:var(--text-mm);text-transform:uppercase;letter-spacing:.06em}
.gx-nums input{width:100%;background:var(--surface2);color:var(--text);border:1px solid var(--border);border-radius:8px;min-height:44px;padding:6px 8px;font-size:13px;font-weight:700;font-family:inherit}

/* frames out */
.gx-strip{display:grid;grid-template-columns:repeat(auto-fill,minmax(118px,1fr));gap:9px;margin-top:6px}
.gx-tile{position:relative;border:1px solid var(--border);border-radius:10px;overflow:hidden;background:#0d1219;display:flex;flex-direction:column}
.gx-tile.on{outline:2px solid var(--aqua);outline-offset:1px}
.gx-tile canvas{display:block;width:100%;height:auto;aspect-ratio:var(--ar,1);background-color:#0f141d;background-image:linear-gradient(45deg,#151b26 25%,transparent 25%),linear-gradient(-45deg,#151b26 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#151b26 75%),linear-gradient(-45deg,transparent 75%,#151b26 75%);background-size:12px 12px;background-position:0 0,0 6px,6px -6px,-6px 0;object-fit:contain}
.gx-tile-bar{display:flex;align-items:center;gap:6px;padding:5px 6px;background:var(--surface2);font-size:11px;color:var(--text-m);font-variant-numeric:tabular-nums}
.gx-tile-bar label{display:flex;align-items:center;gap:5px;flex:1;min-width:0;cursor:pointer;font-weight:700;min-height:30px}
.gx-tile-bar input{width:16px;height:16px;accent-color:#22d3ee}
.gx-tile-dl{flex:none;width:30px;height:30px;border:0;border-radius:7px;background:transparent;color:var(--aqua);cursor:pointer;display:flex;align-items:center;justify-content:center}
.gx-tile-dl:hover{background:rgba(34,211,238,.15)}
.gx-tile-dl svg{width:15px;height:15px}
.gx-strip-head{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;margin-top:14px}
.gx-strip-head .gx-chip{min-height:34px;padding:6px 10px}

/* content */
.tbg-info{max-width:820px;margin:46px auto 0;padding:0 20px}
.tbg-info h2{font-size:22px;font-weight:800;text-align:center;margin-bottom:20px}
.tbg-info h2 span{color:var(--aqua)}
.tbg-steps{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}
.tbg-steps.three{grid-template-columns:repeat(3,1fr)}
@media(max-width:900px){.tbg-steps{grid-template-columns:repeat(2,1fr)}}
@media(max-width:520px){.tbg-steps,.tbg-steps.three{grid-template-columns:1fr}}
.tbg-step{background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:16px 15px}
.tbg-step-n{width:26px;height:26px;border-radius:50%;background:rgba(34,211,238,0.12);color:var(--aqua);font-size:13px;font-weight:800;display:flex;align-items:center;justify-content:center;margin-bottom:9px}
.tbg-step h3{font-size:14px;font-weight:800;margin-bottom:6px}
.tbg-step p{font-size:12.5px;color:var(--text-m);line-height:1.55}
.gx-content{max-width:820px;margin:44px auto 0;padding:0 20px}
.gx-content h2{font-size:22px;font-weight:800;margin:30px 0 12px;letter-spacing:-0.02em}
.gx-content h2:first-child{margin-top:0}
.gx-content h2 span{color:var(--aqua)}
.gx-content h3{font-size:16px;font-weight:800;margin:20px 0 8px}
.gx-content p{font-size:14.5px;color:var(--text-m);line-height:1.75;margin-bottom:12px}
.gx-content p strong,.gx-content li strong{color:var(--text)}
.gx-content ul,.gx-content ol{margin:0 0 14px 20px}
.gx-content li{font-size:14.5px;color:var(--text-m);line-height:1.7;margin-bottom:6px}
.gx-content a{color:var(--aqua);text-decoration:none}
.gx-content a:hover{text-decoration:underline}
.gx-content code{background:var(--surface2);padding:1px 6px;border-radius:5px;font-size:13px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace}
.gx-tablewrap{overflow-x:auto;margin:12px 0 16px}
.gx-table{width:100%;border-collapse:collapse;font-size:13.5px}
.gx-table th{text-align:left;padding:9px 11px;background:var(--surface2);color:var(--text);font-weight:800;font-size:11.5px;text-transform:uppercase;letter-spacing:.06em}
.gx-table td{padding:9px 11px;border-bottom:1px solid var(--border);color:var(--text-m);vertical-align:top}
.gx-table td b{color:var(--text)}
.tbg-faq{max-width:780px;margin:40px auto 0;padding:0 20px 48px}
.tbg-faq h2{font-size:22px;font-weight:800;text-align:center;margin-bottom:22px}
.tbg-faq h2 span{color:var(--aqua)}
.tbg-faq-item{background:var(--surface);border:1px solid var(--border);border-radius:10px;margin-bottom:8px;overflow:hidden}
.tbg-faq-q{padding:14px 18px;cursor:pointer;font-size:14px;font-weight:700;list-style:none;display:flex;align-items:center;justify-content:space-between;gap:14px;min-height:48px}
.tbg-faq-q::-webkit-details-marker{display:none}
.tbg-faq-q::after{content:"";flex:none;width:9px;height:9px;border-right:2px solid var(--text-m);border-bottom:2px solid var(--text-m);transform:rotate(45deg);transition:transform .2s}
.tbg-faq-item[open] .tbg-faq-q::after{transform:rotate(-135deg)}
.tbg-faq-a{padding:0 18px 16px;font-size:13.5px;color:var(--text-m);line-height:1.65}
.tbg-faq-a a{color:var(--aqua);text-decoration:none}
.tbg-related{max-width:780px;margin:0 auto;padding:0 20px 48px;text-align:center}
.tbg-related h2{font-size:20px;font-weight:800;margin-bottom:16px}
.tbg-related-grid{display:flex;flex-wrap:wrap;justify-content:center;gap:9px}
.tbg-related-link{display:inline-flex;align-items:center;min-height:44px;padding:9px 18px;border-radius:10px;background:rgba(34,211,238,0.07);border:1px solid rgba(34,211,238,0.28);color:var(--aqua);font-size:13px;font-weight:700;text-decoration:none}
.tbg-related-link:hover{background:rgba(34,211,238,0.16)}
@media(max-width:520px){.gx-tool{padding:0 12px}.gx-card{padding:12px}.gx-content,.tbg-info,.tbg-faq,.tbg-related{padding-left:16px;padding-right:16px}}
@media(prefers-reduced-motion:reduce){.gx-bar i{transition:none}}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.gx-facts small{color:var(--text-mm);font-size:11px}
.gx-stop{min-height:34px;padding:6px 12px;border-radius:8px;border:1px solid var(--border);background:var(--surface2);color:var(--text);font-weight:800;font-size:12px;cursor:pointer;font-family:inherit}
.gx-stop:hover{border-color:var(--red);color:#fca5a5}
.gx-mini{max-width:100%}
.gx-mini .gx-frame{min-height:120px}
.gx-mini .gx-frame img{max-height:200px}
/* touch screens: every control at least 44 px; the crop handles get a 46 px hit area around the dot */
@media(pointer:coarse){.gx-check,.gx-tile-bar label{min-height:44px}.gx-check{align-items:center}.gx-tile-dl{width:44px;height:44px}.gx-strip-head .gx-chip,.gx-stop{min-height:44px}.gx-h{width:28px;height:28px}.gx-h::before{content:"";position:absolute;inset:-9px}}
/* the before and after stay side by side down to small phones */
@media(max-width:560px){.gx-compare{gap:8px}.gx-compare .gx-frame{min-height:140px;padding:6px}.gx-compare .gx-frame img{max-height:240px}}
@media(max-width:340px){.gx-compare{grid-template-columns:1fr}}
