:root {
  --bg: #0b1020;
  --bg-2: #11182f;
  --panel: #151d36;
  --panel-2: #1b2745;
  --border: #28335a;
  --border-soft: #1f2a4a;
  --text: #e8edf9;
  --text-dim: #9aa6c8;
  --text-faint: #6b779c;
  --accent: #5b8cff;
  --accent-2: #38e0c4;
  --accent-grad: linear-gradient(120deg, #5b8cff, #38e0c4);
  --good: #3ddc84;
  --warn: #ffb648;
  --bad: #ff6b6b;
  --radius: 14px;
  --radius-sm: 9px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --display: "Sora", var(--sans);
  --shadow: 0 16px 40px -18px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(1100px 600px at 12% -8%, rgba(91, 140, 255, 0.16), transparent 60%),
    radial-gradient(900px 500px at 95% 0%, rgba(56, 224, 196, 0.10), transparent 55%),
    var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: 20px; }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--accent); color: #061026; padding: 10px 16px; border-radius: 0 0 8px 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

/* HEADER */
.site-header {
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: blur(10px);
  background: rgba(11, 16, 32, 0.78);
  border-bottom: 1px solid var(--border-soft);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  font-family: var(--mono); font-weight: 500; font-size: 15px;
  background: var(--accent-grad); color: #061026;
  padding: 5px 9px; border-radius: 8px;
}
.brand-name { font-family: var(--display); font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
.header-cta { color: var(--text-dim); text-decoration: none; font-size: 14px; font-weight: 500; }
.header-cta:hover { color: var(--text); }

/* HERO */
.hero { padding: 46px 20px 26px; }
.hero h1 {
  font-family: var(--display); font-weight: 700; font-size: clamp(28px, 4.6vw, 46px);
  line-height: 1.08; letter-spacing: -0.025em; margin: 0 0 14px;
  background: linear-gradient(110deg, #fff 30%, #b9c6ee);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lede { color: var(--text-dim); font-size: clamp(15px, 1.6vw, 17px); max-width: 760px; margin: 0; }
.lede code {
  font-family: var(--mono); font-size: 0.86em; background: var(--panel-2);
  padding: 1px 6px; border-radius: 6px; color: var(--accent-2);
}

/* LAYOUT */
.layout {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  gap: 24px; padding-bottom: 60px; align-items: start;
}
@media (max-width: 940px) { .layout { grid-template-columns: 1fr; } }

.form-panel { position: sticky; top: 78px; }
@media (max-width: 940px) { .form-panel { position: static; } }

.panel {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; margin-bottom: 22px; box-shadow: var(--shadow);
}
.output-col .panel:last-child { margin-bottom: 0; }
.panel-title {
  font-family: var(--display); font-weight: 600; font-size: 15px;
  margin: 0 0 18px; letter-spacing: -0.01em; color: var(--text);
}

/* FIELDS */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.hint { font-weight: 400; color: var(--text-faint); font-size: 12px; }

input[type="text"], input[type="url"], textarea, select {
  width: 100%; font-family: var(--sans); font-size: 14px;
  color: var(--text); background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 70px; }
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.22);
}
select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%239aa6c8' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px;
}
input[type="color"] { padding: 4px; height: 42px; cursor: pointer; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 480px) { .grid-2 { grid-template-columns: 1fr; } }

.checkbox-field { display: flex; align-items: center; gap: 9px; }
.checkbox-field input { width: 17px; height: 17px; accent-color: var(--accent); }
.checkbox-field label { margin: 0; font-weight: 500; }

.advanced { margin-top: 6px; border-top: 1px solid var(--border-soft); padding-top: 14px; }
.advanced summary {
  cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent);
  list-style: none; user-select: none;
}
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::before { content: "+ "; font-family: var(--mono); }
.advanced[open] summary::before { content: "− "; }
.advanced-body { padding-top: 16px; }

/* METER */
.meter {
  margin-top: 6px; font-size: 12px; color: var(--text-faint);
  display: flex; align-items: center; gap: 8px;
}
.meter .bar { flex: 1; height: 4px; border-radius: 4px; background: var(--border); overflow: hidden; }
.meter .bar > span { display: block; height: 100%; width: 0; border-radius: 4px; transition: width .2s, background .2s; }
.meter .count { font-family: var(--mono); white-space: nowrap; }
.meter.is-good .count { color: var(--good); } .meter.is-good .bar > span { background: var(--good); }
.meter.is-warn .count { color: var(--warn); } .meter.is-warn .bar > span { background: var(--warn); }
.meter.is-bad .count  { color: var(--bad); }  .meter.is-bad .bar > span  { background: var(--bad); }

/* FORM ACTIONS */
.form-actions { display: flex; gap: 10px; margin-top: 20px; }

/* BUTTONS */
.btn {
  font-family: var(--sans); font-weight: 600; font-size: 13.5px; cursor: pointer;
  border-radius: var(--radius-sm); padding: 10px 16px; border: 1px solid transparent;
  transition: transform .12s, filter .15s, background .15s; text-decoration: none; display: inline-block;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.btn-primary { background: var(--accent-grad); color: #061026; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: var(--panel-2); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: #fff; }

/* PREVIEWS */
.preview-block { margin-bottom: 20px; }
.preview-block:last-child { margin-bottom: 0; }
.preview-label {
  font-size: 12px; font-weight: 600; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.g-icon { width: 14px; height: 14px; color: var(--text-dim); }
.img-ph { color: #8a93b0; font-size: 12px; padding: 8px 14px; text-align: center; font-family: var(--sans); }

/* Google */
.g-preview { background: #fff; border-radius: 10px; padding: 14px 16px; color: #202124; font-family: arial, sans-serif; }
.g-line { display: flex; align-items: center; gap: 10px; margin-bottom: 3px; }
.g-fav { width: 22px; height: 22px; border-radius: 50%; background: #e8eaed; flex: none; background-size: cover; background-position: center; }
.g-urls { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.g-site { font-size: 14px; color: #202124; }
.g-url { font-size: 12px; color: #4d5156; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-title { color: #1a0dab; font-size: 20px; line-height: 1.3; margin: 2px 0 3px; }
.g-desc { color: #4d5156; font-size: 14px; line-height: 1.45; }

/* Facebook */
.fb-card { border: 1px solid #dadde1; border-radius: 8px; overflow: hidden; background: #fff; color: #1c1e21; font-family: Helvetica, Arial, sans-serif; }
.fb-img { aspect-ratio: 1200/630; background: #e9ebee; display: flex; align-items: center; justify-content: center; background-size: cover; background-position: center; }
.fb-body { padding: 10px 12px; background: #f2f3f5; border-top: 1px solid #dadde1; }
.fb-domain { font-size: 11px; color: #606770; text-transform: uppercase; letter-spacing: 0.02em; margin-bottom: 3px; }
.fb-title { font-size: 16px; font-weight: 600; line-height: 1.3; color: #1d2129; }
.fb-desc { font-size: 13px; color: #606770; line-height: 1.4; margin-top: 3px; }

/* Twitter */
.tw-card { border: 1px solid #cfd9de; border-radius: 16px; overflow: hidden; background: #fff; color: #0f1419; font-family: Helvetica, Arial, sans-serif; }
.tw-img { aspect-ratio: 2/1; background: #e1e8ed; display: flex; align-items: center; justify-content: center; background-size: cover; background-position: center; }
.tw-body { padding: 11px 14px; }
.tw-title { font-size: 15px; font-weight: 700; line-height: 1.3; color: #0f1419; }
.tw-desc { font-size: 14px; color: #536471; line-height: 1.4; margin-top: 2px; }
.tw-domain { font-size: 13px; color: #536471; margin-top: 6px; }
.tw-card[data-card="summary"] { display: flex; align-items: stretch; }
.tw-card[data-card="summary"] .tw-img { aspect-ratio: 1/1; width: 120px; flex: none; border-right: 1px solid #cfd9de; }
.tw-card[data-card="summary"] .tw-body { display: flex; flex-direction: column; justify-content: center; }

/* SNIPPET */
.snip-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.snip-header .panel-title { margin: 0; }
.snip-actions { display: flex; gap: 8px; }
.code-wrap {
  margin: 0; background: #070b18; border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm); padding: 16px; overflow-x: auto;
  max-height: 460px; overflow-y: auto;
}
.code-wrap code {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.7;
  color: #c6d2f5; white-space: pre; display: block;
}
.tok-tag { color: #5b8cff; }
.tok-attr { color: #38e0c4; }
.tok-str { color: #e9b66b; }
.tok-comment { color: #5b6a8f; font-style: italic; }

/* CTA */
.cta-panel { background: linear-gradient(150deg, #16234a, #102a3e); border-color: #2b5478; }
.cta-h { font-family: var(--display); font-weight: 700; font-size: 21px; margin: 0 0 10px; letter-spacing: -0.02em; }
.cta-panel p { color: var(--text-dim); margin: 0 0 16px; font-size: 14.5px; }
.cta-btn { font-size: 15px; padding: 12px 22px; }
.cross-link { margin: 14px 0 0; font-size: 13px; color: var(--text-faint); }
.cross-link a { color: var(--accent-2); text-decoration: none; }
.cross-link a:hover { text-decoration: underline; }

/* FOOTER */
.site-footer { border-top: 1px solid var(--border-soft); background: rgba(7, 11, 24, 0.6); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 22px 20px; flex-wrap: wrap; font-size: 13.5px; color: var(--text-faint); }
.footer-inner a { color: var(--text-dim); text-decoration: none; font-weight: 500; }
.footer-inner a:hover { color: var(--accent-2); }

/* TOAST */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--good); color: #052012; font-weight: 600; font-size: 14px;
  padding: 11px 20px; border-radius: 10px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 60;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
