html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

:root {
  --bg: #070b12;
  --surface: #0f1624;
  --surface2: #141d30;
  --text: #e6edf7;
  --muted: #9fb0c9;
  --accent: #22c55e;
  --accent2: #4ade80;
  --border: rgba(159, 176, 201, 0.18);
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color-scheme: dark;
  background: radial-gradient(1000px 500px at 20% -10%, rgba(34, 197, 94, 0.12), transparent),
    radial-gradient(900px 500px at 100% 0%, rgba(74, 222, 128, 0.08), transparent), var(--bg);
  color: var(--text);
  line-height: 1.45;
}

body.light {
  color-scheme: light;
  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface2: #eef2fa;
  --text: #0b1220;
  --muted: #5b6475;
  --border: rgba(15, 23, 42, 0.12);
  background: var(--bg);
}

a {
  color: #60a5fa;
}

.skip-link {
  position: absolute;
  left: -999px;
}

.skip-link:focus {
  left: 12px;
  top: 12px;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: 8px;
  z-index: 100;
}

:focus-visible {
  outline: 2px solid var(--accent2);
  outline-offset: 2px;
}

.wrap-tool {
  max-width: 1180px;
}

.page-title {
  font-size: clamp(1.4rem, 3.5vw + 0.5rem, 1.9rem);
  line-height: 1.2;
  margin: 0 0 10px;
}

.lead {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
  max-width: 52rem;
}

.card-hero {
  padding: clamp(16px, 3vw, 22px);
}

.field-label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}

.section-title {
  margin: 18px 0 10px;
  font-size: 1.05rem;
}

.preview-caption {
  margin: 10px 0 4px;
  color: var(--muted);
  font-size: 0.85rem;
}

.faq-block {
  margin-top: 18px;
}

.faq-card {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--surface2);
}

.faq-answer {
  color: var(--muted);
  margin: 8px 0 0;
  font-size: 0.92rem;
  line-height: 1.5;
}

.site-footer {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(120px, calc(env(safe-area-inset-bottom) + 96px))
    max(14px, env(safe-area-inset-left));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}

.nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nav a {
  text-decoration: none;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
  margin-bottom: 12px;
}

.toolbar label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--muted);
  min-width: 0;
}

.toolbar label select {
  width: 100%;
  min-width: 140px;
}

@media (max-width: 640px) {
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar .btn {
    width: 100%;
  }
}

.btn {
  border: 0;
  border-radius: 11px;
  padding: 11px 14px;
  cursor: pointer;
  min-height: 44px;
  font-weight: 700;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #04120a;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

select {
  font: inherit;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  min-height: 44px;
}

.editor-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 900px) {
  .editor-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(12px, 3vw, 16px);
  box-shadow: var(--shadow);
}

.card > h1 {
  font-size: clamp(1.3rem, 3.5vw + 0.5rem, 1.75rem);
  line-height: 1.25;
  margin: 0 0 8px;
}

textarea.code {
  width: 100%;
  min-height: min(52vh, 280px);
  resize: vertical;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
}

.diff-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 900px) {
  .diff-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.pre-scroll {
  margin: 0;
  padding: 12px;
  overflow: auto;
  max-height: 320px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface2);
  font-size: 12px;
}

.ad-native-wrap {
  margin: 12px 0;
  min-height: 120px;
  border-radius: 12px;
  border: 1px dashed var(--border);
  padding: 8px;
}

.zero-log {
  margin-top: 14px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(34, 197, 94, 0.28);
  background: rgba(34, 197, 94, 0.06);
  color: var(--muted);
  font-size: 0.92rem;
}

#cookie-banner {
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  max-width: 640px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
  z-index: 50;
}

.cookie-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

@media (max-width: 520px) {
  .nav .btn-ghost {
    width: 100%;
    margin-top: 4px;
  }

  .pre-scroll {
    max-height: min(42vh, 280px);
  }
}
