:root {
  /* Theme: Linear / Stripe SaaS Style */
  --bg-app: #08090a;
  --bg-panel: #161b22;
  --bg-input: #0d1117;
  
  --primary: #2f81f7;
  --primary-hover: #58a6ff;
  
  --accent: #d29922; /* Warning/Action */
  
  --text-main: #f0f6fc;
  --text-muted: #8b949e;
  
  --border: #30363d;
  --border-hover: #8b949e;
  
  --success: #2ea043;
  --danger: #da3633;
  
  --radius: 6px;
  --radius-l: 12px;
  
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.2);
}

* { box-sizing: border-box; outline: none; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.app-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon { width: 32px; height: 32px; color: var(--text-main); }

.logo-text h1 {
  font-size: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-free {
  background: var(--success);
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.logo-text p { font-size: 13px; color: var(--text-muted); }

/* Banner */
.intro-banner {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  padding: 24px;
  margin-bottom: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.intro-banner p { font-size: 14px; color: var(--text-muted); flex: 1; min-width: 280px; }
.intro-banner strong { color: var(--text-main); }

.icon-sm { width: 16px; height: 16px; display: inline-block; vertical-align: text-bottom; margin-right: 6px; }

/* Features */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.feature-card {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.2s;
}

.feature-card:hover { border-color: var(--text-muted); }

.feature-icon {
  color: var(--text-muted);
  margin-bottom: 12px;
}
.feature-icon svg { width: 24px; height: 24px; }

.feature-card h3 { font-size: 14px; margin-bottom: 4px; color: var(--text-main); }
.feature-card p { font-size: 13px; color: var(--text-muted); line-height: 1.4; }

/* Workspace */
.workspace {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 32px;
  flex: 1;
}

@media (max-width: 800px) {
  .workspace { grid-template-columns: 1fr; }
}

/* Dropzone */
.preview-col { display: flex; flex-direction: column; gap: 16px; }

.dropzone {
  background: var(--bg-panel);
  border: 1px dashed var(--border);
  border-radius: var(--radius-l);
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.2s;
}

.dropzone:hover { border-color: var(--text-muted); background: #1c2128; }
.dropzone.drag { border-color: var(--primary); background: rgba(47, 129, 247, 0.1); }

.dropzone input { position: absolute; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 5; }

.dz-content { text-align: center; pointer-events: none; z-index: 1; }
.dz-icon { color: var(--text-muted); margin-bottom: 16px; }
.dz-icon svg { width: 48px; height: 48px; stroke-width: 1; }

.dz-content h3 { font-size: 16px; margin-bottom: 4px; }
.dz-content p { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }

.dz-preview {
  position: absolute; inset: 0;
  background: #0d1117;
  display: flex; align-items: center; justify-content: center;
  z-index: 10;
  border-radius: var(--radius-l);
  overflow: hidden;
}
.dz-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }

.btn-reset {
  position: absolute; top: 12px; right: 12px;
  background: rgba(0,0,0,0.5); color: #fff;
  border: none; width: 32px; height: 32px; border-radius: 4px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px); z-index: 20;
}
.btn-reset:hover { background: var(--danger); }
.btn-reset svg { width: 16px; height: 16px; }

/* Controls */
.controls-col { display: flex; flex-direction: column; gap: 24px; }

.control-group {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.control-group h2 { font-size: 16px; margin-bottom: 16px; }

/* Forms */
.form-grid { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row.two-col { flex-direction: row; gap: 12px; }
.form-row.two-col > div { flex: 1; }

label { font-size: 12px; font-weight: 500; color: var(--text-main); }
label .hint { color: var(--text-muted); font-weight: 400; }

input[type="text"], textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--text-main);
  font-size: 13px;
  font-family: inherit;
  transition: border-color 0.2s;
}

input:focus, textarea:focus { border-color: var(--primary); }
textarea { resize: vertical; min-height: 80px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  cursor: pointer; border: 1px solid transparent;
  transition: all 0.2s; text-decoration: none; gap: 8px;
}
.full-width { width: 100%; }
.btnSmall { padding: 6px 12px; font-size: 12px; }

.btnPrimary { background: var(--primary); color: #fff; border-color: rgba(255,255,255,0.1); }
.btnPrimary:hover { opacity: 0.9; }

.btnSecondary { background: var(--bg-input); border-color: var(--border); color: var(--text-main); }
.btnSecondary:hover { border-color: var(--text-muted); }

.btnAccent { background: var(--text-main); color: var(--bg-app); }
.btnAccent:hover { opacity: 0.9; }

.btnSuccess { background: var(--success); color: #fff; }
.btnSuccess:hover { opacity: 0.9; }

.btnGhost { background: transparent; color: var(--text-muted); }
.btnGhost:hover { color: var(--text-main); }

.btnDanger { background: transparent; color: var(--danger); border-color: var(--border); }
.btnDanger:hover { border-color: var(--danger); }

/* Results */
.result-header { text-align: center; margin-bottom: 20px; }
.result-header h3 { color: var(--success); font-size: 16px; margin-top: 12px; }

.result-actions-list { margin-bottom: 20px; border: 1px solid var(--border); border-radius: var(--radius); }
.result-action {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-muted);
}
.result-action:last-child { border-bottom: none; }
.result-action.done { color: var(--text-main); }
.result-action .action-icon { color: var(--success); display: flex; }
.result-action svg { width: 16px; height: 16px; }

/* API Panel */
.apiKeyPanel { margin-top: 16px; padding: 16px; background: var(--bg-input); border-radius: var(--radius); }
.panelTitle { font-size: 11px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; }
.apiKeyRow { display: flex; gap: 8px; }
.apiKeyCode {
  flex: 1; background: var(--bg-panel); border: 1px solid var(--border);
  padding: 6px; font-family: monospace; font-size: 12px; color: var(--primary);
  border-radius: 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.btn-icon {
  background: transparent; border: 1px solid var(--border); color: var(--text-muted);
  width: 28px; height: 28px; border-radius: 4px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.btn-icon:hover { border-color: var(--text-main); color: var(--text-main); }
.btn-icon svg { width: 14px; height: 14px; }
.apiKeyHint { margin-top: 8px; font-size: 11px; color: var(--text-muted); }
.apiKeyHint code { background: var(--bg-panel); padding: 2px 4px; border-radius: 3px; }

/* Analysis Box */
.analysis-box { background: var(--bg-panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.analysis-header { display: flex; gap: 8px; margin-bottom: 12px; }
.status-indicator {
  flex: 1; background: var(--bg-input); padding: 8px; border-radius: var(--radius);
  font-size: 12px; text-align: center; border: 1px solid var(--border); color: var(--text-muted);
}
#metaLog {
  background: #000; color: #0f0; padding: 12px; border-radius: var(--radius);
  font-family: monospace; font-size: 11px; max-height: 200px; overflow-y: auto; white-space: pre-wrap;
}

/* API Docs */
.api-docs-section { margin-top: 60px; padding-top: 40px; border-top: 1px solid var(--border); }
.api-tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.api-tab {
  background: transparent; border: none; padding: 8px 16px;
  color: var(--text-muted); font-size: 13px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.api-tab:hover { color: var(--text-main); }
.api-tab.active { color: var(--text-main); border-bottom-color: var(--primary); }

.api-content pre { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; overflow-x: auto; }
.api-content code { font-family: monospace; font-size: 12px; color: var(--text-main); }

.api-info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 24px; }
.api-info-card {
  background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; text-align: center;
}
.api-info-card h4 { font-size: 12px; margin-bottom: 4px; }
.api-info-card p { font-size: 12px; color: var(--text-muted); }

/* Use Cases (Yandex SEO) */
.use-cases-section {
  margin-top: 60px;
  margin-bottom: 40px;
}

.use-cases-section h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 32px;
  color: #fff;
  text-align: center;
}

.use-cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.uc-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all 0.2s;
}

.uc-card:hover {
  border-color: var(--text-muted);
  transform: translateY(-2px);
}

.uc-card h3 {
  font-size: 15px;
  color: var(--text-main);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.uc-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* FAQ */
.seo-section { margin-top: 40px; border-top: 1px solid var(--border); padding-top: 40px; }
.geo-faq { border-bottom: 1px solid var(--border); }
.geo-faq summary { padding: 16px 0; cursor: pointer; font-size: 14px; font-weight: 500; }
.geo-faq div { padding-bottom: 16px; font-size: 13px; color: var(--text-muted); line-height: 1.6; }

/* SEO Article (Blog) */
.seo-article {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  padding: 40px;
  margin-top: 60px;
  box-shadow: var(--shadow-sm);
}

.seo-article h2 {
  font-size: 24px;
  margin-bottom: 32px;
  color: var(--text-main);
  text-align: center;
}

.seo-article article {
  max-width: 100%;
}

.seo-article h3 {
  font-size: 18px;
  margin: 32px 0 16px 0;
  color: var(--text-main);
}

.seo-article p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.seo-article ul,
.seo-article ol {
  margin-bottom: 24px;
  padding-left: 20px;
  color: var(--text-muted);
}

.seo-article li {
  margin-bottom: 8px;
  font-size: 15px;
  line-height: 1.6;
}

.seo-article strong {
  color: var(--text-main);
  font-weight: 600;
}

.seo-article code {
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-family: monospace;
  color: var(--primary);
}

.final-note {
  background: rgba(47, 129, 247, 0.1);
  border-left: 3px solid var(--primary);
  padding: 16px;
  border-radius: 4px;
  margin-top: 32px;
  color: var(--text-main) !important;
}

.trust-badge {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 12px;
  opacity: 0.8;
}

/* Footer */
.app-footer { margin-top: 60px; padding: 40px 0; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: flex-start; }
.seo-text h3 { font-size: 14px; margin-bottom: 8px; }
.seo-text p { font-size: 12px; color: var(--text-muted); max-width: 400px; }
.footer-links { display: flex; gap: 16px; }
.footer-links a { font-size: 12px; color: var(--text-muted); }
.footer-links a:hover { color: var(--text-main); }

/* Presets */
.chips-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; }
.chip {
  background: var(--bg-input); border: 1px solid var(--border); padding: 4px 12px;
  border-radius: 100px; font-size: 12px; cursor: pointer; white-space: nowrap; color: var(--text-muted);
}
.chip:hover { border-color: var(--text-muted); color: var(--text-main); }
