:root {
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --bg-light: #F8FAFC;
  --bg-dark: #0F172A;
  --surface-light: #FFFFFF;
  --surface-dark: #1E293B;
  --text-light: #0F172A;
  --text-muted-light: #64748B;
  --text-dark: #F8FAFC;
  --text-muted-dark: #94A3B8;
  --border-light: #E2E8F0;
  --border-dark: #334155;
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --radius: 8px;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --header-height: 64px;
}

[data-theme="dark"] {
  --bg-light: var(--bg-dark);
  --surface-light: var(--surface-dark);
  --text-light: var(--text-dark);
  --text-muted-light: var(--text-muted-dark);
  --border-light: var(--border-dark);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  background-color: var(--bg-light);
  color: var(--text-light);
  line-height: 1.5;
  transition: background-color 0.2s, color 0.2s;
  overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.container { max-width: 1280px; margin: 0 auto; padding: 0 16px; }

/* Header */
.header {
  height: var(--header-height);
  background-color: var(--surface-light);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
}
.header-content { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.25rem; color: var(--text-light); text-decoration: none; }
.logo svg { width: 28px; height: 28px; color: var(--primary); }
.logo:hover { text-decoration: none; }

.nav-links { display: flex; gap: 24px; align-items: center; }
.nav-links a { color: var(--text-light); font-weight: 500; font-size: 0.95rem; }
.nav-links a:hover { color: var(--primary); text-decoration: none; }

.header-actions { display: flex; align-items: center; gap: 16px; }
.theme-toggle, .mobile-menu-btn { background: none; border: none; color: var(--text-light); cursor: pointer; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: var(--radius); }
.theme-toggle:hover, .mobile-menu-btn:hover { background-color: var(--border-light); }
.mobile-menu-btn { display: none; }

@media (max-width: 768px) {
  .nav-links { display: none; }
  .mobile-menu-btn { display: flex; }
}

/* Mobile Nav Overlay */
.mobile-nav { position: fixed; inset: 0; background: var(--surface-light); z-index: 100; transform: translateX(100%); transition: transform 0.3s ease; padding: 24px; display: flex; flex-direction: column; }
.mobile-nav.open { transform: translateX(0); }
.mobile-nav-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px; }
.mobile-nav-links { display: flex; flex-direction: column; gap: 16px; }
.mobile-nav-links a { font-size: 1.1rem; padding: 12px; border-radius: var(--radius); color: var(--text-light); font-weight: 500; }
.mobile-nav-links a:hover { background: var(--border-light); text-decoration: none; }

/* Hero */
.hero { padding: 48px 16px; text-align: center; }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; letter-spacing: -0.02em; margin-bottom: 16px; color: var(--text-light); }
.hero p { font-size: 1.1rem; color: var(--text-muted-light); max-width: 600px; margin: 0 auto 32px; }
.trust-indicators { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; margin-bottom: 32px; font-size: 0.9rem; color: var(--text-muted-light); font-weight: 500; }
.trust-indicators span { display: flex; align-items: center; gap: 6px; }
.trust-indicators svg { color: var(--success); width: 16px; height: 16px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; font-size: 0.95rem; font-weight: 600; border-radius: var(--radius); cursor: pointer; transition: all 0.2s; border: 1px solid transparent; text-decoration: none; }
.btn-primary { background-color: var(--primary); color: white; }
.btn-primary:hover { background-color: var(--primary-hover); text-decoration: none; color: white; }
.btn-secondary { background-color: var(--surface-light); color: var(--text-light); border-color: var(--border-light); }
.btn-secondary:hover { background-color: var(--border-light); text-decoration: none; }
.btn-danger { background-color: var(--danger); color: white; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }

/* Ad Containers */
.ad-container { text-align: center; margin: 24px auto; background: var(--surface-light); border: 1px dashed var(--border-light); border-radius: var(--radius); padding: 8px; position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ad-label { display: block; font-size: 0.7rem; text-transform: uppercase; color: var(--text-muted-light); margin-bottom: 4px; letter-spacing: 0.5px; }
.ad-top { min-height: 110px; max-width: 760px; }
.ad-banner { min-height: 80px; max-width: 500px; }
.ad-sidebar { min-height: 620px; width: 180px; }
.ad-content { min-height: 270px; max-width: 320px; }
.ad-mobile { min-height: 70px; max-width: 340px; }

/* Workspace */
.workspace { display: grid; grid-template-columns: 240px 1fr; gap: 24px; margin-bottom: 64px; }
@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
}

.sidebar { background: var(--surface-light); border-radius: var(--radius); border: 1px solid var(--border-light); padding: 16px; align-self: start; }
.sidebar-title { font-size: 0.85rem; text-transform: uppercase; font-weight: 700; color: var(--text-muted-light); margin-bottom: 12px; padding: 0 8px; letter-spacing: 0.5px; }
.tool-nav { display: flex; flex-direction: column; gap: 4px; }
.tool-link { padding: 10px 12px; display: flex; align-items: center; gap: 12px; border-radius: var(--radius); color: var(--text-light); font-weight: 500; font-size: 0.95rem; cursor: pointer; transition: all 0.2s; background: transparent; border: none; width: 100%; text-align: left; }
.tool-link svg { width: 18px; height: 18px; color: var(--text-muted-light); }
.tool-link:hover { background: var(--border-light); }
.tool-link.active { background: var(--primary); color: white; }
.tool-link.active svg { color: white; }

@media (max-width: 900px) {
  .sidebar { display: flex; flex-direction: column; overflow-x: auto; padding: 12px; }
  .tool-nav { flex-direction: row; }
  .tool-link { white-space: nowrap; }
}

.main-panel { background: var(--surface-light); border-radius: var(--radius); border: 1px solid var(--border-light); padding: 24px; min-height: 500px; display: flex; flex-direction: column; }
.tool-header { margin-bottom: 24px; border-bottom: 1px solid var(--border-light); padding-bottom: 16px; }
.tool-header h2 { font-size: 1.5rem; font-weight: 700; }
.tool-header p { color: var(--text-muted-light); font-size: 0.95rem; margin-top: 4px; }

/* Upload Zone */
.upload-zone { border: 2px dashed var(--border-light); border-radius: var(--radius); padding: 64px 24px; text-align: center; transition: all 0.2s; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; background: var(--bg-light); flex-grow: 1; }
.upload-zone:hover, .upload-zone.dragover { border-color: var(--primary); background: var(--surface-light); }
.upload-icon { width: 48px; height: 48px; color: var(--primary); }
.upload-text { font-size: 1.25rem; font-weight: 600; color: var(--text-light); }
.upload-sub { font-size: 0.9rem; color: var(--text-muted-light); }
.upload-btn { background: var(--primary); color: white; padding: 10px 24px; border-radius: 20px; font-weight: 600; display: inline-block; pointer-events: none; }
.upload-privacy { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-muted-light); margin-top: 24px; }
.upload-privacy svg { width: 14px; height: 14px; }
#file-input { display: none; }

/* Settings Area */
.settings-area { background: var(--bg-light); border: 1px solid var(--border-light); border-radius: var(--radius); padding: 20px; margin-bottom: 24px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; }
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group label { font-size: 0.9rem; font-weight: 600; color: var(--text-light); }
.form-control { padding: 10px; border: 1px solid var(--border-light); border-radius: var(--radius); background: var(--surface-light); color: var(--text-light); font-size: 0.95rem; width: 100%; transition: border-color 0.2s; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,0.2); }
.checkbox-group { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.checkbox-group input { width: 16px; height: 16px; accent-color: var(--primary); }
.checkbox-group span { font-size: 0.9rem; color: var(--text-light); }

.presets { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.preset-btn { padding: 4px 10px; font-size: 0.8rem; border-radius: 20px; border: 1px solid var(--border-light); background: var(--surface-light); color: var(--text-muted-light); cursor: pointer; transition: all 0.2s; }
.preset-btn:hover { border-color: var(--primary); color: var(--primary); }

.action-bar { display: flex; justify-content: space-between; align-items: center; margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border-light); flex-wrap: wrap; gap: 16px; }

/* Image Results */
.results-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; margin-top: 24px; }
.result-card { background: var(--surface-light); border: 1px solid var(--border-light); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.result-thumb { height: 160px; background: var(--bg-light); display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; border-bottom: 1px solid var(--border-light); }
.result-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.result-info { padding: 16px; flex-grow: 1; display: flex; flex-direction: column; gap: 8px; }
.result-name { font-weight: 600; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-meta { font-size: 0.85rem; color: var(--text-muted-light); display: flex; justify-content: space-between; }
.result-status { display: inline-flex; align-items: center; gap: 4px; font-size: 0.8rem; font-weight: 600; padding: 4px 8px; border-radius: 20px; background: var(--bg-light); color: var(--text-muted-light); width: fit-content; }
.status-ready { color: var(--primary); background: rgba(37,99,235,0.1); }
.status-success { color: var(--success); background: rgba(34,197,94,0.1); }
.status-error { color: var(--danger); background: rgba(239,68,68,0.1); }
.result-actions { display: flex; gap: 8px; margin-top: 12px; }

/* Sections */
.section { padding: 64px 16px; }
.section-title { font-size: 2rem; font-weight: 700; text-align: center; margin-bottom: 48px; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.feature-card { background: var(--surface-light); padding: 24px; border-radius: var(--radius); border: 1px solid var(--border-light); text-align: center; }
.feature-icon { width: 40px; height: 40px; color: var(--primary); margin: 0 auto 16px; }
.feature-card h3 { font-size: 1.1rem; margin-bottom: 8px; font-weight: 600; }
.feature-card p { color: var(--text-muted-light); font-size: 0.95rem; }

/* Article / Content */
.content-grid { display: grid; grid-template-columns: 1fr 300px; gap: 48px; }
@media (max-width: 900px) { .content-grid { grid-template-columns: 1fr; } }
.article { font-size: 1.05rem; color: var(--text-muted-light); }
.article h2, .article h3 { color: var(--text-light); margin: 32px 0 16px; font-weight: 700; }
.article p { margin-bottom: 16px; }
.article ul { margin: 16px 0 16px 24px; }
.article li { margin-bottom: 8px; }

/* FAQ */
.faq-list { max-width: 800px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.faq-item { background: var(--surface-light); border: 1px solid var(--border-light); border-radius: var(--radius); overflow: hidden; }
.faq-q { width: 100%; text-align: left; background: none; border: none; padding: 20px; font-size: 1.1rem; font-weight: 600; color: var(--text-light); cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.faq-q svg { width: 20px; height: 20px; transition: transform 0.3s; }
.faq-q[aria-expanded="true"] svg { transform: rotate(180deg); }
.faq-a { padding: 0 20px; max-height: 0; overflow: hidden; transition: all 0.3s ease; color: var(--text-muted-light); }
.faq-q[aria-expanded="true"] + .faq-a { padding: 0 20px 20px; max-height: 500px; }

/* Footer */
.footer { background: var(--surface-light); border-top: 1px solid var(--border-light); padding: 48px 16px 24px; margin-top: 64px; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 32px; max-width: 1280px; margin: 0 auto; }
.footer-col h4 { font-weight: 700; margin-bottom: 16px; color: var(--text-light); }
.footer-col p { color: var(--text-muted-light); font-size: 0.95rem; margin-bottom: 16px; }
.footer-links { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.footer-links a { color: var(--text-muted-light); font-size: 0.95rem; }
.footer-links a:hover { color: var(--primary); }
.footer-bottom { border-top: 1px solid var(--border-light); max-width: 1280px; margin: 48px auto 0; padding-top: 24px; text-align: center; color: var(--text-muted-light); font-size: 0.9rem; }

/* Utilities */
.hidden { display: none !important; }
