*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #6366f1; --primary-hover: #4f46e5; --primary-light: #eef2ff;
  --bg: #f8fafc; --surface: #ffffff; --text: #1e293b; --text-muted: #64748b;
  --border: #e2e8f0; --success: #22c55e; --radius: 12px;
}
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: none; }

/* ===== PRO GATE / USAGE LIMITS ===== */
.pro-banner { background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%); color: #fff; border-radius: var(--radius); padding: 1.25rem 1.5rem; margin: 1.5rem 0; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.pro-banner p { color: #e0e7ff; margin: 0; font-size: 0.95rem; }
.pro-banner strong { color: #fff; }
.pro-banner .btn-upgrade { background: #fff; color: var(--primary); border: none; border-radius: 8px; padding: 0.6rem 1.25rem; font-weight: 700; font-size: 0.9rem; cursor: pointer; text-decoration: none; white-space: nowrap; transition: all 0.2s; }
.pro-banner .btn-upgrade:hover { background: #eef2ff; transform: translateY(-1px); }
.usage-badge { display: inline-flex; align-items: center; gap: 0.4rem; background: var(--primary-light); color: var(--primary); font-size: 0.8rem; font-weight: 600; padding: 0.3rem 0.75rem; border-radius: 20px; margin-left: 0.5rem; }
.pro-tag { display: inline-flex; align-items: center; gap: 0.25rem; background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; font-size: 0.65rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 10px; text-transform: uppercase; letter-spacing: 0.05em; vertical-align: middle; }
.limit-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(15,23,42,0.7); z-index: 9998; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); align-items: center; justify-content: center; }
.limit-overlay.active { display: flex; }
.limit-modal { background: var(--surface); border-radius: 16px; padding: 2.5rem; max-width: 440px; width: 90%; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.limit-modal h3 { font-size: 1.3rem; margin-bottom: 0.5rem; }
.limit-modal p { font-size: 0.95rem; margin-bottom: 1.25rem; }
.limit-modal .limit-icon { font-size: 3rem; margin-bottom: 0.75rem; }
.limit-modal .btn-upgrade-lg { display: inline-block; background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; border: none; border-radius: 10px; padding: 0.85rem 2.5rem; font-size: 1.05rem; font-weight: 700; cursor: pointer; text-decoration: none; transition: all 0.2s; }
.limit-modal .btn-upgrade-lg:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(99,102,241,0.4); }
.limit-modal .limit-skip { display: block; margin-top: 0.75rem; font-size: 0.85rem; color: var(--text-muted); cursor: pointer; background: none; border: none; }

/* ===== NAV ===== */
.nav { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.nav-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 1.25rem; }
.nav-logo { font-weight: 800; font-size: 1.3rem; color: var(--primary); text-decoration: none; display: flex; align-items: center; gap: 0.4rem; }
.nav-logo:hover { opacity: 0.85; }
.nav-right { display: flex; align-items: center; gap: 0.75rem; }
.nav-link { color: var(--text-muted); font-size: 0.9rem; font-weight: 500; padding: 0.4rem 0.75rem; border-radius: 8px; transition: all 0.15s; text-decoration: none; }
.nav-link:hover { color: var(--primary); background: var(--primary-light); }
.nav-tools-btn { background: var(--primary); color: #fff; border: none; border-radius: 8px; padding: 0.5rem 1rem; font-size: 0.9rem; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 0.4rem; transition: all 0.2s; }
.nav-tools-btn:hover { background: var(--primary-hover); }
.nav-tools-btn svg { width: 14px; height: 14px; transition: transform 0.2s; }
.nav-tools-btn.active { background: var(--primary-hover); }
.nav-tools-btn.active svg { transform: rotate(180deg); }

/* ===== MEGA MENU ===== */
.mega-overlay { display: none; position: fixed; top: 56px; left: 0; right: 0; bottom: 0; background: rgba(15,23,42,0.3); z-index: 150; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.mega-menu { display: none; position: fixed; top: 56px; left: 0; right: 0; bottom: 0; background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: 0 12px 40px rgba(0,0,0,0.12); z-index: 200; overflow-y: auto; -webkit-overflow-scrolling: touch; }
body.menu-open { overflow: hidden; }
.mega-inner { max-width: 1200px; margin: 0 auto; padding: 2rem 1.25rem 4rem; display: grid; grid-template-columns: repeat(4, 1fr); gap: 2rem; }
.mega-cat-title { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--primary); margin-bottom: 0.75rem; }
.mega-link { display: flex; align-items: center; gap: 0.65rem; padding: 0.5rem 0.6rem; border-radius: 8px; color: var(--text); text-decoration: none; font-size: 0.88rem; font-weight: 500; transition: all 0.15s; }
.mega-link:hover { background: var(--primary-light); color: var(--primary); }
.mega-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.mega-icon.compress { background: #dbeafe; }
.mega-icon.convert { background: #fce7f3; }
.mega-icon.edit { background: #d1fae5; }
.mega-icon.create { background: #fef3c7; }

@media (max-width: 768px) {
  .mega-inner { grid-template-columns: repeat(2, 1fr); gap: 1.25rem; padding: 1.25rem; }
  .nav-link { display: none; }
}
@media (max-width: 480px) {
  .mega-inner { grid-template-columns: 1fr; }
}

/* ===== AI SEARCH BOX ===== */
.ai-search-box { max-width: 640px; margin: 1.5rem auto 0; }
.ai-search-inner { display: flex; align-items: center; background: var(--surface); border: 2px solid var(--border); border-radius: 16px; padding: 0.4rem 0.5rem 0.4rem 1rem; transition: border-color 0.2s, box-shadow 0.2s; }
.ai-search-inner:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99,102,241,0.12); }
.ai-search-icon { font-size: 1.3rem; margin-right: 0.6rem; flex-shrink: 0; }
.ai-search-input { flex: 1; border: none; outline: none; font-size: 1rem; background: transparent; color: var(--text); padding: 0.6rem 0; }
.ai-search-input::placeholder { color: var(--text-muted); }
.ai-search-btn { background: var(--primary); color: #fff; border: none; border-radius: 10px; padding: 0.6rem 1.25rem; font-size: 0.95rem; font-weight: 700; cursor: pointer; white-space: nowrap; transition: background 0.2s; }
.ai-search-btn:hover { background: var(--primary-hover); }
.ai-search-suggestions { position: relative; }
.ai-search-suggestions .suggestion-list { position: absolute; top: 4px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,0.12); z-index: 50; max-height: 300px; overflow-y: auto; display: none; }
.ai-search-suggestions .suggestion-list.active { display: block; }
.suggestion-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; cursor: pointer; transition: background 0.1s; text-decoration: none; color: var(--text); }
.suggestion-item:hover, .suggestion-item.selected { background: var(--primary-light); }
.suggestion-item .s-icon { font-size: 1.2rem; width: 32px; text-align: center; flex-shrink: 0; }
.suggestion-item .s-name { font-weight: 600; font-size: 0.92rem; }
.suggestion-item .s-desc { font-size: 0.8rem; color: var(--text-muted); }
.ai-search-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; margin-top: 0.75rem; }
.ai-tag { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 0.35rem 0.85rem; font-size: 0.82rem; cursor: pointer; transition: all 0.15s; color: var(--text-muted); font-weight: 500; }
.ai-tag:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* ===== LAYOUT ===== */
.container { max-width: 800px; margin: 0 auto; padding: 2rem 1rem; }
h1 { font-size: 2rem; margin-bottom: 0.5rem; font-weight: 800; }
h2 { font-size: 1.4rem; margin: 1.5rem 0 0.5rem; font-weight: 700; }
p { margin-bottom: 1rem; color: var(--text-muted); }

/* ===== HERO (homepage) ===== */
.hero { text-align: center; padding: 3rem 1rem 1rem; }
.hero h1 { font-size: 2.5rem; margin-bottom: 0.75rem; }
.hero p { font-size: 1.1rem; max-width: 550px; margin: 0 auto 2rem; }
.tools-grid { max-width: 1200px; margin: 0 auto; padding: 0 1.25rem 3rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.tool-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; text-align: center; text-decoration: none; color: var(--text); transition: all 0.2s; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.tool-card:hover { border-color: var(--primary); box-shadow: 0 4px 16px rgba(99,102,241,0.12); transform: translateY(-2px); }
.tool-card .tool-icon { font-size: 2rem; width: 56px; height: 56px; border-radius: 14px; display: flex; align-items: center; justify-content: center; margin-bottom: 0.25rem; }
.tool-card .tool-name { font-weight: 700; font-size: 0.95rem; }
.tool-card .tool-desc { font-size: 0.8rem; color: var(--text-muted); line-height: 1.4; }
.tool-icon.blue { background: #dbeafe; }
.tool-icon.pink { background: #fce7f3; }
.tool-icon.green { background: #d1fae5; }
.tool-icon.yellow { background: #fef3c7; }
.tool-icon.purple { background: #ede9fe; }
.tool-icon.orange { background: #ffedd5; }

/* ===== AD PLACEHOLDER ===== */
.ad-slot { background: var(--border); border: 2px dashed #cbd5e1; border-radius: var(--radius); padding: 1.5rem; text-align: center; color: var(--text-muted); font-size: 0.85rem; margin: 1.5rem 0; min-height: 90px; display: flex; align-items: center; justify-content: center; }

/* ===== DROPZONE ===== */
.dropzone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 3rem 1.5rem; text-align: center; cursor: pointer; transition: all 0.2s; background: var(--surface); }
.dropzone:hover, .dropzone.dragover { border-color: var(--primary); background: var(--primary-light); }
.dropzone-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.dropzone p { margin: 0; }
.dropzone input[type="file"] { display: none; }

/* ===== CONTROLS ===== */
.controls { margin: 1.5rem 0; display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
.controls label { font-weight: 600; font-size: 0.9rem; }
.controls select, .controls input[type="number"] { padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: 8px; font-size: 0.9rem; background: var(--surface); }

/* ===== PREVIEW ===== */
.preview-area { display: none; margin: 1.5rem 0; }
.preview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.preview-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; text-align: center; }
.preview-card img { max-width: 100%; max-height: 250px; border-radius: 8px; object-fit: contain; }
.preview-card .label { font-weight: 600; margin-bottom: 0.5rem; font-size: 0.9rem; }
.preview-card .size { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.5rem; }
.savings { text-align: center; padding: 0.75rem; background: #f0fdf4; border-radius: 8px; color: #16a34a; font-weight: 600; margin-top: 1rem; }

/* ===== BUTTONS ===== */
.btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.7rem 1.5rem; border: none; border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-download { background: var(--success); color: #fff; font-size: 1.05rem; padding: 0.8rem 2rem; box-shadow: 0 4px 14px rgba(34,197,94,0.3); }
.btn-download:hover { background: #16a34a; box-shadow: 0 6px 20px rgba(34,197,94,0.4); transform: translateY(-1px); }
@keyframes pulse-download { 0%,100%{box-shadow:0 4px 14px rgba(34,197,94,0.3)} 50%{box-shadow:0 4px 24px rgba(34,197,94,0.5)} }
.btn-download.ready { animation: pulse-download 2s ease-in-out 3; }
.actions { display: flex; gap: 1rem; margin-top: 1rem; flex-wrap: wrap; }

/* ===== LOADER ===== */
.loader { display: none; text-align: center; padding: 2rem; }
.spinner { width: 40px; height: 40px; border: 4px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 0.5rem; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== PROGRESS BAR ===== */
.progress-wrap { display: none; margin: 1rem 0; }
.progress-bar { width: 100%; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--primary), var(--success)); border-radius: 4px; transition: width 0.3s ease; }
.progress-text { text-align: center; font-size: 0.85rem; color: var(--text-muted); margin-top: 0.4rem; font-weight: 600; }

/* ===== SEO CONTENT ===== */
.seo-content { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.seo-content h2 { color: var(--text); }
.seo-content p { font-size: 0.95rem; }

/* ===== RELATED TOOLS ===== */
.related-tools { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.related-tools h2 { font-size: 1.3rem; margin-bottom: 1rem; color: var(--text); }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.75rem; }
.related-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1rem; text-align: center; text-decoration: none; color: var(--text); transition: all 0.2s; }
.related-card:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(99,102,241,0.1); transform: translateY(-2px); }
.related-card .rc-icon { font-size: 1.5rem; margin-bottom: 0.4rem; }
.related-card .rc-name { font-weight: 600; font-size: 0.88rem; }

/* ===== BLOG ===== */
.blog-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); gap:1.5rem; margin:1.5rem 0; }
.blog-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:1.5rem; text-decoration:none; color:var(--text); transition:all 0.2s; }
.blog-card:hover { border-color:var(--primary); box-shadow:0 4px 16px rgba(99,102,241,0.12); transform:translateY(-2px); }
.blog-card .blog-tag { display:inline-block; background:var(--primary-light); color:var(--primary); font-size:0.75rem; font-weight:600; padding:0.2rem 0.6rem; border-radius:20px; margin-bottom:0.75rem; }
.blog-card h3 { font-size:1.1rem; font-weight:700; margin-bottom:0.5rem; line-height:1.4; }
.blog-card .blog-excerpt { font-size:0.88rem; color:var(--text-muted); line-height:1.5; margin-bottom:0.75rem; }
.blog-card .blog-meta { font-size:0.8rem; color:var(--text-muted); }
.blog-article { max-width:800px; margin:0 auto; padding:2rem 1rem; }
.blog-article h1 { font-size:2rem; margin-bottom:0.5rem; line-height:1.3; }
.blog-article .blog-date { color:var(--text-muted); font-size:0.9rem; margin-bottom:2rem; }
.blog-article h2 { margin-top:2rem; }
.blog-article p { font-size:1rem; line-height:1.8; margin-bottom:1.25rem; }
.blog-article ul, .blog-article ol { margin:0.75rem 0 1.25rem 1.5rem; line-height:1.8; color:var(--text-muted); }
.blog-article li { margin-bottom:0.4rem; }
.blog-article .cta-box { background:var(--primary-light); border:1px solid var(--primary); border-radius:var(--radius); padding:1.25rem 1.5rem; margin:1.5rem 0; }
.blog-article .cta-box a { font-weight:700; }

/* ===== AD INTERSTITIAL MODAL ===== */
.ad-modal-overlay { display:none; position:fixed; top:0; left:0; right:0; bottom:0; background:rgba(15,23,42,0.6); z-index:9999; -webkit-backdrop-filter:blur(4px); backdrop-filter:blur(4px); align-items:center; justify-content:center; }
.ad-modal-overlay.active { display:flex; }
.ad-modal { background:var(--surface); border-radius:16px; padding:2rem; max-width:480px; width:90%; text-align:center; box-shadow:0 20px 60px rgba(0,0,0,0.3); position:relative; }
.ad-modal h3 { font-size:1.2rem; margin-bottom:0.5rem; color:var(--text); }
.ad-modal p { font-size:0.9rem; color:var(--text-muted); margin-bottom:1rem; }
.ad-modal .ad-container { min-height:100px; background:var(--bg); border:1px solid var(--border); border-radius:8px; margin-bottom:1.25rem; display:flex; align-items:center; justify-content:center; overflow:hidden; }
.ad-modal .countdown { font-size:2rem; font-weight:800; color:var(--primary); margin-bottom:0.75rem; }
.ad-modal .countdown.done { color:var(--success); }
.ad-modal .btn-dl-final { background:var(--success); color:#fff; border:none; border-radius:10px; padding:0.85rem 2.5rem; font-size:1.05rem; font-weight:700; cursor:pointer; transition:all 0.2s; opacity:0.4; pointer-events:none; }
.ad-modal .btn-dl-final.active { opacity:1; pointer-events:auto; box-shadow:0 4px 16px rgba(34,197,94,0.35); }
.ad-modal .btn-dl-final.active:hover { background:#16a34a; transform:translateY(-1px); }
.ad-modal .close-modal { position:absolute; top:0.75rem; right:1rem; background:none; border:none; font-size:1.5rem; cursor:pointer; color:var(--text-muted); }
.ad-modal .close-modal:hover { color:var(--text); }
.ad-modal .skip-text { font-size:0.8rem; color:var(--text-muted); margin-top:0.75rem; }

/* ===== FOOTER ===== */
.footer { text-align: center; padding: 2rem 1rem; color: var(--text-muted); font-size: 0.85rem; border-top: 1px solid var(--border); margin-top: 3rem; }

@media (max-width: 600px) {
  .preview-grid { grid-template-columns: 1fr; }
  h1 { font-size: 1.5rem; }
  .hero h1 { font-size: 1.75rem; }
  .dropzone { padding: 2rem 1rem; }
  .tools-grid { grid-template-columns: repeat(2, 1fr); }
}
