:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-muted: #f1f5f9;
  --text: #0f172a;
  --text-soft: #475569;
  --border: #dbe4ef;
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-soft: #eef2ff;
  --danger: #b91c1c;
  --ok: #166534;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  --radius: 18px;
  --radius-sm: 10px;
  --font: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "Segoe UI Mono", Consolas, monospace;
}

*,
*::before,
*::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(circle at 18% -8%, #dbeafe 0, transparent 38%), var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.container { width: min(1120px, calc(100% - 2.5rem)); margin: 0 auto; }
.main-wrap { padding: 2rem 0 3rem; }
.section { padding: 5rem 0; }

.skip-link { position: absolute; left: -999px; top: -999px; }
.skip-link:focus { left: 1rem; top: 1rem; z-index: 1000; background: var(--primary); color: #fff; padding: .5rem .75rem; border-radius: 8px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(8px);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  border-bottom: 1px solid var(--border);
}

.nav-wrap { display: flex; align-items: center; gap: 1rem; min-height: 72px; }
.brand { display: inline-flex; align-items: center; gap: .65rem; text-decoration: none; color: inherit; font-weight: 700; }
.brand-mark { width: 2rem; height: 2rem; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: #fff; background: linear-gradient(135deg,#6366f1,#3b82f6); }
.brand-text { font-size: 1.05rem; }
.header-tagline {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-soft);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
}

.mobile-nav-toggle {
  margin-left: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .45rem .7rem;
  background: var(--surface);
  display: none;
}

.site-nav { margin-left: auto; display: flex; flex-wrap: wrap; gap: .75rem; }
.site-nav a { text-decoration: none; color: var(--text-soft); font-weight: 600; padding: .35rem .45rem; border-radius: 8px; }
.site-nav a:hover, .site-nav a.active { color: var(--text); background: var(--primary-soft); }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.1rem, 2vw, 1.75rem);
}

h1 { margin: 0 0 .65rem; font-size: clamp(1.45rem, 2.2vw, 2rem); letter-spacing: -.02em; }
h2 { margin: 0 0 .35rem; font-size: 1.06rem; }
.lede { color: var(--text-soft); max-width: 75ch; }

.cards { display: grid; gap: 1rem; margin-top: 1rem; }
.cards.three { grid-template-columns: repeat(3,minmax(0,1fr)); }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .9rem;
  text-decoration: none;
  color: inherit;
}
.card p { margin: 0; color: var(--text-soft); }
.card h2 { margin: 0 0 .2rem; }

label, .field-group label {
  display: block;
  font-weight: 600;
  margin: .7rem 0 .35rem;
  color: var(--text);
}

input, textarea, select {
  font: inherit;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .9rem 1rem;
  background: var(--surface);
  color: var(--text);
}

textarea {
  min-height: 180px;
  resize: vertical;
}

input:focus, textarea:focus, select:focus {
  outline: 2px solid color-mix(in srgb, var(--primary) 55%, transparent);
  outline-offset: 1px;
  border-color: var(--primary);
}
.io-area {
  width: 100%;
  min-height: 180px;
  padding: .85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  resize: vertical;
  background: var(--surface-muted);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: .9rem;
  line-height: 1.5;
}
.io-area:focus { outline: 2px solid color-mix(in srgb, var(--primary) 55%, transparent); border-color: var(--primary); background: var(--surface); }

.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: .85rem 0; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: .75rem 1rem;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}
.btn-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-muted);
}
.btn-ghost {
  background: var(--surface);
  color: var(--text-soft);
  border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.message { min-height: 1.2rem; margin: .3rem 0 .45rem; font-size: .95rem; color: var(--text-soft); }
.message.is-error { color: var(--danger); }
.message.is-success { color: var(--ok); }

.ad-slot {
  border: 1px dashed color-mix(in srgb, var(--border) 75%, transparent);
  background: color-mix(in srgb, var(--surface-muted) 80%, transparent);
  color: var(--text-soft);
  border-radius: var(--radius-sm);
  min-height: 76px;
  display: grid;
  place-items: center;
  text-align: center;
  font-weight: 600;
  padding: .85rem;
  margin: 0 0 1rem;
}
.ad-slot-after-actions { margin-top: 1.75rem; }
.footer-ad { margin-top: 1.6rem; }

.related-tools { margin: 1rem 0 0; color: var(--text-soft); font-size: .95rem; }
.related-tools a { color: var(--primary-dark); font-weight: 600; text-decoration: none; }
.related-tools a:hover { text-decoration: underline; }

.site-footer { border-top: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 94%, transparent); }
.footer-grid { display: grid; grid-template-columns: 1.2fr .9fr .9fr; gap: 1rem; padding: 1.75rem 0 2rem; }
.footer-links { display: flex; flex-direction: column; gap: .35rem; }
.footer-links a { color: var(--text-soft); text-decoration: none; font-weight: 600; }
.footer-links a:hover { text-decoration: underline; color: var(--text); }
.footer-copy { margin: .35rem 0 0; color: var(--text-soft); }
.prose p { color: var(--text-soft); max-width: 78ch; margin: 0 0 .85rem; }

@media (max-width: 860px) {
  .cards.three { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 768px) {
  .mobile-nav-toggle { display: inline-flex; }
  .header-tagline { display: none; }
  .site-nav { display: none; width: 100%; flex-direction: column; margin: .5rem 0 0; }
  .site-nav.is-open { display: flex; }
  .nav-wrap { flex-wrap: wrap; padding: .5rem 0; }
  .actions { flex-direction: column; }
  .actions .btn { width: 100%; }
  .cards.three { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
}
