:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --border: #e2e5ec;
  --text: #1c1f26;
  --text-muted: #6b7280;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --danger: #dc2626;
  --success: #16a34a;
  --radius: 10px;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161c;
    --surface: #1c1f27;
    --border: #2c3039;
    --text: #e7e9ee;
    --text-muted: #9298a5;
    --accent: #818cf8;
    --accent-hover: #a5b4fc;
    --accent-soft: #262b45;
    --danger: #f87171;
    --success: #4ade80;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  padding: 2rem 1.5rem 1rem;
  text-align: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.5rem;
  font-weight: 700;
}

.brand-mark {
  color: var(--accent);
  font-family: var(--mono);
}

.tagline {
  color: var(--text-muted);
  margin: 0.4rem 0 0;
  font-size: 0.95rem;
}

.conversions-list {
  color: var(--text-muted);
  margin: 0.6rem auto 0;
  max-width: 640px;
  font-size: 0.78rem;
  line-height: 1.6;
}

.privacy-note {
  color: var(--success);
  margin: 0.3rem 0 0;
  font-size: 0.82rem;
  font-weight: 600;
}

.container {
  flex: 1;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.format-row {
  display: flex;
  align-items: end;
  gap: 1rem;
  margin: 0 0 1.25rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

select {
  padding: 0.55rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  width: 100%;
}

.swap {
  padding-bottom: 0.6rem;
}

.icon-btn {
  height: 2.4rem;
  width: 2.4rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 1.1rem;
  align-self: flex-end;
}

.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

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

.editor-col {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.editor-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
  text-decoration: underline;
}

textarea {
  width: 100%;
  min-height: 320px;
  resize: vertical;
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.45;
}

textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.primary-btn {
  width: 100%;
  padding: 0.75rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 1.25rem;
}

.primary-btn:hover {
  background: var(--accent-hover);
}

.status {
  margin-top: 0.85rem;
  font-size: 0.88rem;
  min-height: 1.2em;
}

.status.error {
  color: var(--danger);
}

.status.success {
  color: var(--success);
}

.affiliate-links {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0 1.5rem;
}

.affiliate-links a {
  color: var(--accent);
}

.ad-slot {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.footer a {
  color: var(--text-muted);
}

.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 0.9rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--text-muted);
  z-index: 100;
}

.cookie-banner a {
  color: var(--accent);
}

.cookie-accept {
  padding: 0.4rem 0.9rem;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
