/* =====================================================================
   UTubSEO — Design system
   Dark / Light themes · RTL / LTR (logical properties) · Responsive
   ===================================================================== */

:root {
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --container: 1240px;
  /* same type system as the AABIDECOM platform */
  --font-ui: "Plus Jakarta Sans", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-ar: "Cairo", "Tajawal", "Segoe UI", Tahoma, sans-serif;
  --font-brand: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
  --brand: #ff0033;
  --brand-2: #ff2d55;
  --brand-3: #ff7a3d;
  --brand-grad: linear-gradient(135deg, #ff0033 0%, #ff2d55 48%, #ff7a3d 100%);
  --gold: #ffd400;
  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --info: #3b82f6;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0a0f;
  --bg-2: #0f0f15;
  --surface: rgba(22, 22, 30, .78);
  --surface-solid: #16161e;
  --surface-2: #1c1c26;
  --surface-3: #252532;
  --hover: rgba(255, 255, 255, .05);
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .16);
  --text: #f5f5f8;
  --text-2: #b9b9c8;
  --text-3: #80808f;
  --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 24px 60px -24px rgba(0, 0, 0, .75);
  --shadow-sm: 0 8px 24px -12px rgba(0, 0, 0, .6);
  --aura-opacity: .55;
  --grid-color: rgba(255, 255, 255, .035);
  --input-bg: rgba(10, 10, 16, .6);
  --yt-bg: #0f0f0f;
  --yt-text: #f1f1f1;
  --yt-text-2: #aaaaaa;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f6f9;
  --bg-2: #ffffff;
  --surface: rgba(255, 255, 255, .86);
  --surface-solid: #ffffff;
  --surface-2: #f3f3f7;
  --surface-3: #e8e8ef;
  --hover: rgba(15, 15, 30, .04);
  --border: rgba(15, 15, 35, .08);
  --border-strong: rgba(15, 15, 35, .16);
  --text: #0e0e14;
  --text-2: #4a4a5c;
  --text-3: #85859a;
  --shadow: 0 1px 0 rgba(255, 255, 255, .9) inset, 0 24px 60px -28px rgba(30, 20, 60, .28);
  --shadow-sm: 0 8px 24px -14px rgba(30, 20, 60, .3);
  --aura-opacity: .32;
  --grid-color: rgba(15, 15, 35, .045);
  --input-bg: rgba(255, 255, 255, .9);
  --yt-bg: #ffffff;
  --yt-text: #0f0f0f;
  --yt-text-2: #606060;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
/* one professional face per script; Latin glyphs stay on the AABIDECOM type */
html[lang="ar"] { --font-ui: var(--font-ar); }
html[lang="fa"] { --font-ui: "Vazirmatn", var(--font-ar); }
html[lang="ur"] { --font-ui: "Noto Naskh Arabic", var(--font-ar); }
html[lang="ru"], html[lang="uk"] { --font-ui: "Manrope", "Segoe UI", Roboto, sans-serif; --font-brand: "Plus Jakarta Sans", "Manrope", sans-serif; }
html[lang="vi"] { --font-ui: "Be Vietnam Pro", "Segoe UI", Roboto, sans-serif; }
html[lang="hi"] { --font-ui: "Plus Jakarta Sans", "Noto Sans Devanagari", "Nirmala UI", sans-serif; }
html[lang="bn"] { --font-ui: "Plus Jakarta Sans", "Hind Siliguri", "Nirmala UI", sans-serif; }
html[lang="th"] { --font-ui: "Plus Jakarta Sans", "Noto Sans Thai", "Leelawadee UI", sans-serif; }
html[lang="ja"] { --font-ui: "Plus Jakarta Sans", "Noto Sans JP", "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif; }
html[lang="ko"] { --font-ui: "Plus Jakarta Sans", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; }
html[lang="zh"] { --font-ui: "Plus Jakarta Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background .35s var(--ease), color .35s var(--ease);
}
img, svg, canvas { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
::selection { background: rgba(255, 0, 51, .35); }

.container { width: min(var(--container), 100% - 40px); margin-inline: auto; }
.muted { color: var(--text-3); }
.err { color: var(--bad); font-weight: 600; }
.ltr { direction: ltr; unicode-bidi: isolate; }

/* ---------------- Background aura ---------------- */
.aura { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.aura .blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: var(--aura-opacity); animation: float 22s ease-in-out infinite; }
.aura .b1 { width: 560px; height: 560px; background: #ff0033; top: -220px; inset-inline-start: -120px; }
.aura .b2 { width: 460px; height: 460px; background: #ff7a3d; top: 120px; inset-inline-end: -160px; animation-delay: -7s; opacity: calc(var(--aura-opacity) * .7); }
.aura .b3 { width: 520px; height: 520px; background: #7c3aed; bottom: -260px; left: 30%; animation-delay: -13s; opacity: calc(var(--aura-opacity) * .45); }
.aura .grid-lines {
  position: absolute; inset: 0;
  background-image: linear-gradient(var(--grid-color) 1px, transparent 1px), linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%);
}
@keyframes float { 0%, 100% { transform: translate(0, 0) scale(1); } 33% { transform: translate(40px, 30px) scale(1.06); } 66% { transform: translate(-30px, 20px) scale(.96); } }

/* ---------------- Header ---------------- */
.app-header {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 66px; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-logo { width: 40px; height: 40px; filter: drop-shadow(0 6px 16px rgba(255, 0, 51, .45)); }
.brand-name { font-family: var(--font-brand); font-weight: 800; font-size: 23px; letter-spacing: -.04em; direction: ltr; }
.brand-name b { margin-inline-start: 2px; padding: 1px 8px; border-radius: 8px; background: var(--brand-grad); color: #fff; font-weight: 800; letter-spacing: -.02em; }
.brand-name.small { font-size: 16px; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  transition: transform .2s var(--ease), background .2s, border-color .2s;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border-strong); transform: translateY(-1px); }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lang-btn { font-weight: 800; font-size: 13px; width: auto; padding-inline: 11px; }
:root[data-theme="dark"] .ico-moon, :root[data-theme="light"] .ico-sun { display: none; }

.status-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding-inline: 12px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  font-size: 12.5px; font-weight: 600; color: var(--text-2); white-space: nowrap;
}
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.status-pill[data-state="full"] .dot { background: var(--ok); box-shadow: 0 0 0 4px rgba(34, 197, 94, .18); }
.status-pill[data-state="partial"] .dot { background: var(--warn); box-shadow: 0 0 0 4px rgba(245, 158, 11, .18); }
.status-pill[data-state="offline"] .dot { background: var(--bad); box-shadow: 0 0 0 4px rgba(239, 68, 68, .18); }
.status-pill[data-state="checking"] .dot { animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }

/* ---------------- Hero ---------------- */
.hero { padding: 56px 0 30px; text-align: center; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 10px; padding: 7px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); font-size: 13px; font-weight: 600; color: var(--text-2);
  box-shadow: var(--shadow-sm);
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 0 rgba(255, 0, 51, .6); animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(255, 0, 51, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 0, 51, 0); } }
.hero-title {
  margin: 20px auto 12px; max-width: 900px;
  font-size: clamp(36px, 5.2vw, 62px); line-height: 1.1; letter-spacing: -.035em; font-weight: 800;
}
html[data-script="arabic"] .hero-title { letter-spacing: 0; line-height: 1.4; font-weight: 900; }
html[data-script="indic"] .hero-title, html[data-script="thai"] .hero-title { letter-spacing: 0; line-height: 1.35; }
html[data-script="cjk"] .hero-title { letter-spacing: 0; line-height: 1.25; font-weight: 900; }
html[data-script="cjk"] body, html[data-script="indic"] body, html[data-script="thai"] body { letter-spacing: 0; }
html[data-script="indic"] .hero-sub, html[data-script="thai"] .hero-sub, html[data-script="cjk"] .hero-sub { line-height: 1.8; }
.gradient-text { background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { margin: 0 auto 34px; max-width: 680px; font-size: clamp(15px, 1.7vw, 18px); color: var(--text-2); }

/* ---------------- Composer ---------------- */
.composer {
  position: relative; text-align: start; padding: 22px; border-radius: var(--radius-xl);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.composer::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 0, 51, .55), transparent 35%, transparent 65%, rgba(255, 122, 61, .45));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.composer-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 22px; }
.field-label { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-weight: 700; font-size: 14.5px; }
.step-num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; background: var(--brand-grad); color: #fff; font-size: 12.5px; font-weight: 800; }

.dropzone {
  position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius-lg); overflow: hidden;
  border: 1.5px dashed var(--border-strong); background: var(--input-bg);
  display: grid; place-items: center; cursor: pointer; outline: none;
  transition: border-color .2s, background .2s, transform .2s var(--ease);
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 5%, var(--input-bg)); }
.dropzone.drag { border-color: var(--brand); transform: scale(1.01); box-shadow: 0 0 0 6px rgba(255, 0, 51, .12); }
.dz-empty { display: grid; justify-items: center; gap: 6px; padding: 20px; text-align: center; }
.dz-icon { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 18px; background: var(--brand-grad); box-shadow: 0 12px 30px -10px rgba(255, 0, 51, .7); margin-bottom: 6px; }
.dz-icon svg { width: 26px; height: 26px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dz-specs { margin-top: 6px; font-size: 12px; color: var(--text-3); padding: 4px 10px; border-radius: 999px; background: var(--hover); }
.dz-preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; }
.dz-bar {
  position: absolute; inset-inline: 10px; bottom: 10px; display: none; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 6px 6px 12px; border-radius: 12px; background: rgba(0, 0, 0, .62); color: #fff; font-size: 12px; backdrop-filter: blur(8px);
}
.dropzone.has-image { border-style: solid; border-color: var(--border); }
.dropzone.has-image .dz-empty { display: none; }
.dropzone.has-image .dz-preview { display: block; }
.dropzone.has-image .dz-bar { display: flex; }
.dz-meta { direction: ltr; font-variant-numeric: tabular-nums; }
.chip-btn { border: 0; border-radius: 9px; padding: 5px 11px; font-size: 12px; font-weight: 700; background: rgba(255, 255, 255, .16); color: #fff; }
.chip-btn:hover { background: rgba(255, 255, 255, .26); }

.title-wrap { position: relative; border-radius: var(--radius-lg); background: var(--input-bg); border: 1.5px solid var(--border-strong); transition: border-color .2s, box-shadow .2s; }
.title-wrap:focus-within { border-color: var(--brand); box-shadow: 0 0 0 5px rgba(255, 0, 51, .12); }
#titleInput { display: block; width: 100%; min-height: 112px; resize: vertical; border: 0; outline: 0; background: transparent; padding: 16px 16px 6px; font-size: 18px; font-weight: 600; line-height: 1.45; }
#titleInput::placeholder { color: var(--text-3); font-weight: 500; }
.title-foot { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px 10px; gap: 8px; }
.counter { font-size: 12.5px; font-weight: 700; color: var(--text-3); font-variant-numeric: tabular-nums; direction: ltr; }
.counter.warn { color: var(--warn); }
.counter.bad { color: var(--bad); }
.live-score { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.live-score .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--text-3)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c, transparent) 22%, transparent); }
.live-score b { color: var(--c, var(--text)); font-size: 14px; font-variant-numeric: tabular-nums; }
.live-hints { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; min-height: 8px; }
.live-hints li { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--hover); color: var(--text-2); border: 1px solid var(--border); }
.live-hints li.pass { color: var(--ok); }
.live-hints li.warn { color: var(--warn); }
.live-hints li.fail { color: var(--bad); }

.fineprint { margin: 10px 0 0; font-size: 12px; color: var(--text-3); text-align: center; }

/* ---------------- Buttons ---------------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding-inline: 18px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface-2); font-weight: 800; font-size: 14.5px; white-space: nowrap; overflow: hidden;
  transition: transform .2s var(--ease), box-shadow .2s, background .2s, border-color .2s, opacity .2s;
}
.btn:hover { transform: translateY(-1px); border-color: var(--border-strong); }
.btn:active { transform: translateY(0) scale(.99); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.btn-primary { border: 0; color: #fff; background: var(--brand-grad); box-shadow: 0 14px 34px -14px rgba(255, 0, 51, .85), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn-primary::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%); transform: translateX(-120%); transition: transform .8s var(--ease); }
.btn-primary:hover::after { transform: translateX(120%); }
.btn-primary svg { stroke: #fff; }
.btn-ghost { background: transparent; }
.btn-xl { width: 100%; height: 58px; margin-top: 14px; font-size: 17px; border-radius: 16px; }
.btn-sm { height: 34px; padding-inline: 12px; font-size: 13px; border-radius: 10px; }
.btn.loading { pointer-events: none; }
.btn.loading::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; animation: spin .8s linear infinite; }
.btn.loading svg { display: none; }

.copy-btn { gap: 6px; }
.copy-btn.done { background: color-mix(in srgb, var(--ok) 18%, var(--surface-2)); border-color: color-mix(in srgb, var(--ok) 45%, transparent); color: var(--ok); }

/* ---------------- Trust row ---------------- */
.trust-row { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; padding: 0; margin: 22px 0 0; }
.trust-row li { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; font-weight: 600; color: var(--text-2); }
.ti { width: 18px; height: 18px; border-radius: 6px; background: var(--brand-grad); -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; }
.ti-live { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 12h4l3-8 4 16 3-8h4' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.ti-ai { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='9' fill='none' stroke='%23000' stroke-width='2.4'/%3E%3Ccircle cx='12' cy='12' r='4.5' fill='none' stroke='%23000' stroke-width='2.4'/%3E%3Ccircle cx='12' cy='12' r='1.6'/%3E%3C/svg%3E"); }
.ti-tags { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 12V4a1 1 0 0 1 1-1h8l9 9-9 9zm5-5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3z'/%3E%3C/svg%3E"); }
.ti-face { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zM8.5 9a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3zm7 0a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3zM7 14h10a5 5 0 0 1-10 0z'/%3E%3C/svg%3E"); }

/* ---------------- Cards ---------------- */
.card {
  position: relative; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0; flex-wrap: wrap; }
.card-title { display: flex; align-items: center; gap: 12px; margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.card-title .ico { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); flex: none; }
.card-title .ico svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.card-sub { margin: 2px 0 0; font-size: 12.5px; font-weight: 500; color: var(--text-3); }
.card-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-body { padding: 16px 20px 20px; }
.section-title { font-size: clamp(25px, 3vw, 34px); font-weight: 800; letter-spacing: -.02em; line-height: 1.3; text-align: center; margin: 0 0 22px; }

/* Arabic typography (as on AABIDECOM): Cairo, no tracking, roomier lines */
html[data-script="arabic"] .section-title, html[data-script="arabic"] .card-title, html[data-script="arabic"] .kw-hero .kw-main,
html[data-script="arabic"] .summary-main .lbl, html[data-script="arabic"] .t-tag, html[data-script="arabic"] .fold-preview .lbl,
html[data-script="arabic"] .kw-table th, html[data-script="arabic"] .ring .val small { letter-spacing: 0; }
html[data-script="arabic"] .summary-main .lbl, html[data-script="arabic"] .kw-table th { font-size: 13px; }
html[data-script="arabic"] .hero-sub { line-height: 1.8; }
html[data-script="arabic"] .card-title { font-weight: 800; }
html:is([data-script="indic"], [data-script="thai"], [data-script="cjk"]) :is(.section-title, .card-title, .kw-hero .kw-main, .summary-main .lbl, .t-tag, .fold-preview .lbl, .kw-table th, .ring .val small, .hero-badge) { letter-spacing: 0; }
html[data-script="cjk"] .card-title { font-weight: 700; }

/* ---------------- Language menu ---------------- */
.lang-menu { position: relative; }
.lang-btn { display: inline-flex; align-items: center; gap: 7px; }
.lang-btn svg { width: 17px; height: 17px; }
.lang-btn .lang-code { font-family: var(--font-brand); font-weight: 800; font-size: 12.5px; letter-spacing: .02em; text-transform: uppercase; }
.lang-pop {
  position: absolute; inset-inline-end: 0; top: calc(100% + 8px); z-index: 60;
  width: min(330px, calc(100vw - 24px)); max-height: min(70vh, 520px); overflow: auto;
  padding: 8px; border-radius: 18px; border: 1px solid var(--border-strong);
  background: var(--surface-solid); box-shadow: var(--shadow);
}
.lang-pop[hidden] { display: none; }
.lang-pop .lp-head { padding: 6px 10px 8px; font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.lang-pop .lp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.lang-pop button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0; width: 100%;
  padding: 8px 10px; border: 0; border-radius: 11px; background: transparent; color: var(--text);
  text-align: start; cursor: pointer; transition: background .15s;
}
.lang-pop button:hover, .lang-pop button:focus-visible { background: var(--hover); outline: none; }
.lang-pop button[aria-checked="true"] { background: color-mix(in srgb, var(--brand) 12%, transparent); }
.lang-pop button .ln { font-weight: 700; font-size: 14px; line-height: 1.35; }
.lang-pop button .le { font-size: 11.5px; color: var(--text-3); line-height: 1.3; font-family: var(--font-brand); }
.lang-pop .lp-sep { grid-column: 1 / -1; height: 1px; margin: 6px 4px; background: var(--border); }
@media (max-width: 600px) {
  .lang-pop { position: fixed; top: 72px; left: 12px; right: 12px; inset-inline: 12px; width: auto; max-height: calc(100vh - 90px); }
}
.banner.ok { border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: color-mix(in srgb, var(--ok) 9%, var(--surface)); }
.detected-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; color: var(--text-2); }
.detected-line b { color: var(--text); font-weight: 700; }

/* ---------------- Progress ---------------- */
.progress-wrap { margin-top: 26px; }
.progress-card { padding: 22px; }
.progress-head { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.progress-head h2 { margin: 0; font-size: 18px; }
.progress-head p { margin: 2px 0 0; font-size: 13px; }
.spinner { width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--brand); animation: spin .9s linear infinite; flex: none; }
.progress-card.done .spinner { animation: none; border-color: var(--ok); }
@keyframes spin { to { transform: rotate(360deg); } }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.step { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--hover); color: var(--text-3); font-size: 14px; font-weight: 600; transition: all .3s var(--ease); }
.step .s-ico { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--border-strong); flex: none; font-size: 12px; }
.step .s-note { margin-inline-start: auto; font-size: 12px; font-weight: 500; color: var(--text-3); text-align: end; }
.step.active { color: var(--text); background: color-mix(in srgb, var(--brand) 9%, transparent); }
.step.active .s-ico { border-color: var(--brand); border-top-color: transparent; animation: spin .8s linear infinite; }
.step.done { color: var(--text-2); }
.step.done .s-ico { border-color: var(--ok); background: var(--ok); color: #fff; }
.step.done .s-ico::after { content: "✓"; }
.step.skipped .s-ico { border-style: dashed; }
.step.skipped .s-ico::after { content: "–"; }
.step.error { color: var(--bad); }
.step.error .s-ico { border-color: var(--bad); background: var(--bad); color: #fff; }
.step.error .s-ico::after { content: "!"; font-weight: 900; }

/* ---------------- Results layout ---------------- */
.results { margin-top: 26px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.results > *, .res-grid > * { min-width: 0; }
.res-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.span-2 { grid-column: 1 / -1; }
.banner { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); font-size: 13.5px; }
.banner.warn { border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 9%, var(--surface)); }
.banner.info { border-color: color-mix(in srgb, var(--info) 40%, transparent); background: color-mix(in srgb, var(--info) 8%, var(--surface)); }
.banner.bad { border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: color-mix(in srgb, var(--bad) 9%, var(--surface)); }
.banner b { display: block; margin-bottom: 2px; }
.banner code { font-size: 12.5px; padding: 1px 6px; border-radius: 6px; background: var(--hover); direction: ltr; unicode-bidi: isolate; }

/* Sticky results navigation */
.res-nav { position: sticky; top: 74px; z-index: 30; }
.res-nav-inner {
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding: 5px; border-radius: 14px;
  background: color-mix(in srgb, var(--surface-solid) 86%, transparent); border: 1px solid var(--border);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: var(--shadow-sm);
}
.res-nav-inner::-webkit-scrollbar { display: none; }
.res-nav a { flex: none; padding: 7px 13px; border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--text-2); text-decoration: none; white-space: nowrap; transition: background .2s, color .2s; }
.res-nav a:hover { background: var(--hover); color: var(--text); }
.res-nav a.on { background: var(--text); color: var(--bg); }
[id^="sec-"] { scroll-margin-top: 136px; }
.cell-sub { font-size: 11.5px; color: var(--text-3); margin-top: 3px; font-variant-numeric: tabular-nums; }
.cell-sub.good { color: var(--ok); font-weight: 700; }

/* What wins in this niche (measured from the top 20) */
.pattern { margin: 0 0 16px; padding: 14px 16px; border-radius: 14px; background: color-mix(in srgb, var(--brand) 5%, var(--hover)); border: 1px solid color-mix(in srgb, var(--brand) 22%, var(--border)); }
.pattern-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px; margin-bottom: 10px; font-size: 14px; }
.pattern-head .muted { font-size: 12px; }
.pattern-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.pat { padding: 9px 11px; border-radius: 11px; background: var(--surface-solid); border: 1px solid var(--border); display: grid; gap: 2px; }
.pat span { font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.pat b { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pat.hi b { color: var(--ok); }
.pat.warn b { color: var(--warn); }
.pattern-outliers { margin-top: 12px; display: grid; gap: 6px; font-size: 13px; }
.po { display: flex; gap: 8px; align-items: baseline; }
.po-x { flex: none; font-size: 11.5px; font-weight: 800; padding: 1px 7px; border-radius: 6px; background: var(--gold); color: #111; }
@media (max-width: 900px) { .pattern-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.comp-meta.strong { color: var(--text-2); font-weight: 700; }
.safe-note svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Summary */
.summary { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 26px; padding: 22px; align-items: center; overflow: hidden; }
.summary::after { content: ""; position: absolute; inset-inline-end: -120px; top: -120px; width: 320px; height: 320px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 0, 51, .22), transparent 65%); pointer-events: none; }
.summary-main { display: grid; justify-items: center; gap: 6px; }
.summary-main .lbl { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.summary-side { display: grid; gap: 14px; min-width: 0; }
.mini-scores { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.mini { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--hover); border: 1px solid var(--border); text-decoration: none; transition: border-color .2s, transform .2s var(--ease); }
.mini:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.mini .m-lbl { font-size: 12px; color: var(--text-3); font-weight: 600; }
.mini .m-val { font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--c); line-height: 1.1; }
.kw-hero { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.kw-hero .kw-main { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.source-badges { display: flex; flex-wrap: wrap; gap: 6px; }

/* Score ring */
.ring { position: relative; display: inline-grid; place-items: center; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring .track { stroke: var(--surface-3); }
.ring .bar { stroke: var(--c); stroke-linecap: round; transition: stroke-dashoffset 1.2s var(--ease), stroke .4s; }
:root[data-theme="dark"] .ring svg { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--c) 45%, transparent)); }
.ring .val { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; line-height: 1; }
.ring .val b { display: block; font-size: var(--fs, 24px); font-weight: 900; font-variant-numeric: tabular-nums; color: var(--text); }
.ring .val small { display: block; margin-top: 3px; font-size: 10.5px; font-weight: 700; color: var(--text-3); letter-spacing: .04em; }

/* Badges & chips */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; border: 1px solid var(--border); background: var(--hover); color: var(--text-2); white-space: nowrap; }
.badge i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.badge.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); background: color-mix(in srgb, var(--bad) 10%, transparent); }
.badge.brand { color: #fff; border: 0; background: var(--brand-grad); }
.badge.info { color: var(--info); border-color: color-mix(in srgb, var(--info) 40%, transparent); background: color-mix(in srgb, var(--info) 10%, transparent); }

.verdict { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; margin-bottom: 14px; font-size: 14px; font-weight: 600; }
.verdict .v-ico { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; color: #fff; font-weight: 900; flex: none; }
.verdict.keep { background: color-mix(in srgb, var(--ok) 11%, transparent); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); }
.verdict.keep .v-ico { background: var(--ok); }
.verdict.improve { background: color-mix(in srgb, var(--warn) 11%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
.verdict.improve .v-ico { background: var(--warn); }

/* Title options */
.title-options { display: grid; gap: 10px; }
.t-opt {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 14px; border-radius: 16px; border: 1.5px solid var(--border); background: var(--hover); cursor: pointer;
  transition: border-color .2s, background .2s, transform .2s var(--ease);
}
.t-opt:hover { border-color: var(--border-strong); }
.t-opt.selected { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 7%, transparent); box-shadow: 0 0 0 4px rgba(255, 0, 51, .08); }
.t-opt .radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; }
.t-opt.selected .radio { border-color: var(--brand); }
.t-opt.selected .radio::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.t-text { font-size: 16px; font-weight: 700; line-height: 1.45; word-break: break-word; }
.t-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; color: var(--text-3); }
.t-why { margin-top: 6px; font-size: 12.5px; color: var(--text-2); }
.t-tag { font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); }
.t-tag.orig { background: color-mix(in srgb, var(--info) 18%, transparent); color: var(--info); }
.t-tag.best { background: var(--brand-grad); color: #fff; }
.t-side { display: flex; align-items: center; gap: 8px; }

.kw-mark { background: color-mix(in srgb, var(--gold) 26%, transparent); color: inherit; border-radius: 4px; padding: 0 2px; }
.trunc-cut { opacity: .38; }

/* Checks */
details.checks-wrap { margin-top: 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--hover); }
details.checks-wrap > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 14px; font-weight: 700; font-size: 13.5px; }
details.checks-wrap > summary::-webkit-details-marker { display: none; }
details.checks-wrap > summary::after { content: "▾"; color: var(--text-3); transition: transform .2s; }
details.checks-wrap[open] > summary::after { transform: rotate(180deg); }
.checks { list-style: none; margin: 0; padding: 0 10px 10px; display: grid; gap: 6px; }
.check { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 9px 10px; border-radius: 10px; background: var(--surface-solid); font-size: 13px; }
.check .c-ico { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 900; color: #fff; margin-top: 1px; }
.check.pass .c-ico { background: var(--ok); }
.check.warn .c-ico { background: var(--warn); }
.check.fail .c-ico { background: var(--bad); }
.check.info .c-ico { background: var(--text-3); }
.check .c-lbl { font-weight: 700; }
.check .c-tip { color: var(--text-3); font-size: 12.5px; margin-top: 1px; }
.check .c-val { font-size: 12px; font-weight: 700; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.check-counts { display: inline-flex; gap: 6px; }

/* Description */
.desc-area {
  width: 100%; min-height: 320px; resize: vertical; padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--border);
  background: var(--input-bg); outline: none; font-size: 14px; line-height: 1.7; white-space: pre-wrap;
}
.desc-area:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(255, 0, 51, .1); }
.meters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.meter { padding: 10px 12px; border-radius: 12px; background: var(--hover); border: 1px solid var(--border); }
.meter .m-top { display: flex; justify-content: space-between; gap: 6px; font-size: 12px; color: var(--text-3); font-weight: 600; }
.meter .m-top b { color: var(--text); font-variant-numeric: tabular-nums; direction: ltr; }
.bar-track { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 8px; }
.bar-fill { height: 100%; border-radius: inherit; background: var(--c, var(--brand)); width: 0; transition: width .8s var(--ease); }
.fold-preview { margin-top: 12px; padding: 12px 14px; border-radius: 12px; border: 1px dashed var(--border-strong); font-size: 13px; color: var(--text-2); }
.fold-preview .lbl { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); display: block; margin-bottom: 4px; }

/* Tags */
.tag-budget { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.tag-budget .bar-track { flex: 1; height: 10px; margin: 0; }
.tag-budget b { font-variant-numeric: tabular-nums; font-size: 14px; direction: ltr; white-space: nowrap; }
.tags-box { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--input-bg); min-height: 64px; }
.tag-chip {
  --h: 120;
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 6px 6px 11px; border-radius: 10px; font-size: 13px; font-weight: 600;
  background: hsla(var(--h), 80%, 48%, .12); border: 1px solid hsla(var(--h), 80%, 48%, .38); color: var(--text);
  animation: pop .35s var(--ease) both;
}
html[dir="rtl"] .tag-chip { padding: 6px 11px 6px 6px; }
.tag-chip .cdot { width: 8px; height: 8px; border-radius: 50%; background: hsl(var(--h), 80%, 46%); flex: none; }
.tag-chip .cval { font-size: 11px; font-weight: 800; color: hsl(var(--h), 75%, 42%); font-variant-numeric: tabular-nums; }
:root[data-theme="dark"] .tag-chip .cval { color: hsl(var(--h), 85%, 62%); }
.tag-chip.primary { box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 55%, transparent); }
.tag-chip.unknown { --h: 220; filter: saturate(.2); }
.tag-chip button { border: 0; background: transparent; width: 22px; height: 22px; border-radius: 7px; color: var(--text-3); display: grid; place-items: center; font-size: 14px; line-height: 1; }
.tag-chip button:hover { background: var(--hover); color: var(--bad); }
.tag-chip.excluded { opacity: .45; text-decoration: line-through; }
@keyframes pop { from { opacity: 0; transform: scale(.85); } }
.tag-add { display: flex; gap: 8px; margin-top: 10px; }
.tag-add input { flex: 1; height: 40px; padding-inline: 12px; border-radius: 11px; border: 1px solid var(--border-strong); background: var(--input-bg); outline: none; }
.tag-add input:focus { border-color: var(--brand); }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 10px; font-size: 12px; color: var(--text-3); }
.legend .grad { width: 120px; height: 8px; border-radius: 99px; background: linear-gradient(90deg, hsl(120, 75%, 45%), hsl(60, 85%, 50%), hsl(0, 80%, 52%)); }
html[dir="rtl"] .legend .grad { background: linear-gradient(-90deg, hsl(120, 75%, 45%), hsl(60, 85%, 50%), hsl(0, 80%, 52%)); }
.hashtags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: center; }
.hashtag { padding: 5px 12px; border-radius: 999px; font-weight: 700; font-size: 13px; color: #3ea6ff; background: rgba(62, 166, 255, .1); border: 1px solid rgba(62, 166, 255, .3); }

/* Keyword table */
.table-wrap { overflow-x: auto; border-radius: 14px; border: 1px solid var(--border); }
.kw-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 640px; }
.kw-table th { text-align: start; font-size: 11.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); padding: 11px 12px; background: var(--hover); border-bottom: 1px solid var(--border); white-space: nowrap; cursor: pointer; user-select: none; }
.kw-table th.sorted::after { content: " ↓"; }
.kw-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.kw-table tr:last-child td { border-bottom: 0; }
.kw-table tr:hover td { background: var(--hover); }
.kw-table .kw { font-weight: 700; }
.kw-table .kw .badge { margin-inline-start: 6px; padding: 1px 7px; font-size: 10.5px; }
.cell-bar { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.cell-bar .bar-track { flex: 1; margin: 0; height: 7px; }
.cell-bar b { width: 26px; font-variant-numeric: tabular-nums; font-size: 12.5px; text-align: end; }
.score-pill { display: inline-grid; place-items: center; min-width: 40px; height: 26px; padding-inline: 8px; border-radius: 8px; font-weight: 900; font-size: 13px; color: #fff; background: var(--c); font-variant-numeric: tabular-nums; }
.links { display: flex; gap: 6px; }
.links a { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--border); text-decoration: none; font-size: 12px; font-weight: 800; color: var(--text-2); }
.links a:hover { border-color: var(--brand); color: var(--brand); }
.src { font-size: 11px; font-weight: 700; color: var(--text-3); }
.src.measured { color: var(--info); }

/* Competitors */
.serp-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { padding: 12px; border-radius: 14px; background: var(--hover); border: 1px solid var(--border); }
.stat .s-lbl { font-size: 11.5px; color: var(--text-3); font-weight: 700; }
.stat .s-val { font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums; margin-top: 2px; }
.comp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.comp { text-decoration: none; border-radius: 14px; overflow: hidden; background: var(--hover); border: 1px solid var(--border); transition: transform .2s var(--ease), border-color .2s; display: flex; flex-direction: column; }
.comp:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.comp-thumb { position: relative; aspect-ratio: 16 / 9; background: var(--surface-3); }
.comp-thumb img { width: 100%; height: 100%; object-fit: cover; }
.comp-thumb .rank { position: absolute; top: 8px; inset-inline-start: 8px; background: rgba(0, 0, 0, .75); color: #fff; font-size: 11.5px; font-weight: 800; padding: 2px 8px; border-radius: 7px; }
.comp-thumb .dur { position: absolute; bottom: 8px; inset-inline-end: 8px; background: rgba(0, 0, 0, .8); color: #fff; font-size: 11.5px; font-weight: 700; padding: 1px 6px; border-radius: 5px; direction: ltr; }
.comp-thumb .outlier { position: absolute; top: 8px; inset-inline-end: 8px; font-size: 11.5px; font-weight: 900; padding: 2px 8px; border-radius: 7px; color: #111; background: var(--gold); box-shadow: 0 4px 14px -4px rgba(255, 212, 0, .7); }
.comp-body { padding: 10px 12px 12px; display: grid; gap: 4px; }
.comp-title { font-size: 13.5px; font-weight: 700; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.comp-meta { font-size: 12px; color: var(--text-3); }

/* Thumbnail */
.thumb-top { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; }
.thumb-frame { position: relative; border-radius: 14px; overflow: hidden; aspect-ratio: 16 / 9; background: var(--surface-3); }
.thumb-frame img, .thumb-frame canvas { width: 100%; height: 100%; object-fit: cover; }
.overlay-zone { position: absolute; inset-inline-end: 0; bottom: 0; width: 22%; height: 18%; border: 2px dashed rgba(255, 212, 0, .8); border-radius: 8px 0 0 0; pointer-events: none; display: grid; place-items: center; font-size: 10px; font-weight: 800; color: var(--gold); background: rgba(0, 0, 0, .35); }
html[dir="rtl"] .overlay-zone { inset-inline-end: auto; right: 0; }
.face-box { position: absolute; border: 2px solid #22c55e; border-radius: 6px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0); pointer-events: none; }
.palette { display: flex; gap: 6px; margin-top: 10px; }
.palette span { flex: 1; height: 26px; border-radius: 8px; border: 1px solid var(--border); }
.ai-notes { display: grid; gap: 8px; margin-top: 12px; }
.ai-note { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; padding: 9px 12px; border-radius: 12px; background: var(--hover); }
.ai-note .n-k { font-weight: 800; color: var(--text-3); min-width: 92px; font-size: 12px; }
.list-plain { margin: 6px 0 0; padding-inline-start: 18px; font-size: 13px; color: var(--text-2); }
.list-plain li { margin: 3px 0; }

.studio { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.studio-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.studio-head h3 { margin: 0; font-size: 16px; }
.variant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.variant { position: relative; border-radius: 14px; overflow: hidden; border: 2px solid var(--border); background: var(--surface-3); cursor: pointer; transition: transform .2s var(--ease), border-color .2s, box-shadow .2s; text-align: start; padding: 0; }
.variant:hover { transform: translateY(-3px); }
.variant.selected { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(255, 0, 51, .15); }
.variant canvas, .variant img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.variant .v-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 8px 10px; background: var(--surface-solid); font-size: 12.5px; font-weight: 700; }
.variant .v-score { font-weight: 900; color: var(--c); font-variant-numeric: tabular-nums; }
.variant .v-delta { font-size: 11px; font-weight: 800; color: var(--ok); }
.variant .v-flag { position: absolute; top: 8px; inset-inline-start: 8px; font-size: 10.5px; font-weight: 800; padding: 2px 8px; border-radius: 6px; background: rgba(0, 0, 0, .7); color: #fff; }
.studio-controls { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; margin-top: 14px; padding: 14px; border-radius: 14px; background: var(--hover); border: 1px solid var(--border); }
.ctrl { display: grid; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.ctrl input[type="text"] { height: 40px; padding-inline: 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--input-bg); outline: none; font-weight: 700; }
.ctrl input[type="text"]:focus { border-color: var(--brand); }
.suggest-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.suggest-chips button { border: 1px solid var(--border-strong); background: var(--surface-solid); border-radius: 999px; padding: 4px 11px; font-size: 12.5px; font-weight: 700; }
.suggest-chips button:hover { border-color: var(--brand); color: var(--brand); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.swatch { width: 28px; height: 28px; border-radius: 9px; border: 2px solid var(--border-strong); cursor: pointer; padding: 0; }
.swatch.selected { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--brand); }
.swatches input[type="color"] { width: 32px; height: 30px; border: 0; padding: 0; background: none; cursor: pointer; }
.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-3); gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 11px; border-radius: 8px; font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.seg button.on { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow-sm); }
.studio-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.safe-note { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--ok); font-weight: 600; margin-top: 10px; }

/* Before / after compare */
.compare { position: relative; border-radius: 14px; overflow: hidden; aspect-ratio: 16 / 9; margin-top: 14px; user-select: none; touch-action: pan-y; }
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.compare .after { clip-path: inset(0 0 0 var(--pos, 50%)); }
.compare .handle { position: absolute; top: 0; bottom: 0; left: var(--pos, 50%); width: 3px; background: #fff; box-shadow: 0 0 12px rgba(0, 0, 0, .5); transform: translateX(-50%); pointer-events: none; }
.compare .handle::after { content: "⇆"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 36px; height: 36px; border-radius: 50%; background: #fff; color: #111; display: grid; place-items: center; font-weight: 900; }
.compare input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; direction: ltr; }
.compare .tagl, .compare .tagr { position: absolute; top: 10px; font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 6px; background: rgba(0, 0, 0, .7); color: #fff; }
.compare .tagl { left: 10px; }
.compare .tagr { right: 10px; }

/* YouTube preview */
.yt-modes { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; margin-bottom: 14px; }
.yt-stage { border-radius: 16px; padding: 22px; background: var(--yt-bg); color: var(--yt-text); border: 1px solid var(--border); transition: background .3s; font-family: Roboto, Arial, "Cairo", sans-serif; overflow: hidden; }
.yt-stage.light { --yt-bg: #ffffff; --yt-text: #0f0f0f; --yt-text-2: #606060; }
.yt-stage.dark { --yt-bg: #0f0f0f; --yt-text: #f1f1f1; --yt-text-2: #aaaaaa; }
.yt-card { display: grid; gap: 12px; width: min(380px, 100%); margin-inline: auto; }
.yt-thumb { position: relative; border-radius: 12px; overflow: hidden; aspect-ratio: 16 / 9; background: #222; }
.yt-thumb img { width: 100%; height: 100%; object-fit: cover; }
.yt-dur { position: absolute; bottom: 6px; right: 6px; background: rgba(0, 0, 0, .8); color: #fff; font-size: 12px; font-weight: 600; padding: 1px 5px; border-radius: 4px; direction: ltr; }
.yt-info { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; }
.yt-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-grad); display: grid; place-items: center; color: #fff; font-weight: 800; }
.yt-title { margin: 0; font-size: 16px; font-weight: 600; line-height: 22px; color: var(--yt-text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.yt-sub { font-size: 14px; color: var(--yt-text-2); line-height: 20px; margin-top: 4px; }
.yt-stage.search .yt-card { grid-template-columns: minmax(0, 360px) minmax(0, 1fr); width: 100%; align-items: start; gap: 16px; }
.yt-stage.search .yt-info { grid-template-columns: 1fr; }
.yt-stage.search .yt-avatar { display: none; }
.yt-stage.search .yt-title { font-size: 18px; line-height: 26px; }
.yt-stage.search .yt-desc { display: -webkit-box; }
.yt-desc { display: none; font-size: 12px; color: var(--yt-text-2); margin-top: 8px; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.yt-stage.mobile .yt-card { width: 360px; max-width: 100%; }
.yt-stage.mobile .yt-thumb { border-radius: 0; }
.yt-stage.mobile .yt-title { font-size: 14px; line-height: 20px; }
.yt-stage.mobile .yt-sub { font-size: 12px; }
.yt-stage.side .yt-card { grid-template-columns: 168px minmax(0, 1fr); width: min(420px, 100%); gap: 8px; align-items: start; }
.yt-stage.side .yt-thumb { border-radius: 8px; }
.yt-stage.side .yt-info { grid-template-columns: 1fr; }
.yt-stage.side .yt-avatar { display: none; }
.yt-stage.side .yt-title { font-size: 14px; line-height: 20px; }
.yt-stage.side .yt-sub { font-size: 12px; line-height: 18px; }
.yt-stage .yt-dir { direction: var(--yt-dir, ltr); text-align: start; }

/* Checklist & extras */
.checklist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.checklist label { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--hover); border: 1px solid var(--border); cursor: pointer; font-size: 13.5px; }
.checklist input { accent-color: var(--brand); margin-top: 4px; width: 16px; height: 16px; flex: none; }
.checklist small { display: block; color: var(--text-3); font-size: 12px; margin-top: 2px; }
.quote-box { padding: 14px 16px; border-radius: 14px; background: var(--hover); border: 1px solid var(--border); font-size: 14px; white-space: pre-wrap; }
.export-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; }
.export-bar h3 { margin: 0; font-size: 16px; }

/* How it works */
.how { padding: 70px 0 40px; }
.how-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.how-card { padding: 20px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.how-card h3 { margin: 10px 0 6px; font-size: 16px; }
.how-card p { margin: 0; font-size: 13.5px; color: var(--text-2); }
.how-n { font-family: var(--font-brand); font-weight: 800; font-size: 13px; background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; letter-spacing: .08em; }

/* Footer */
.app-footer { border-top: 1px solid var(--border); margin-top: 40px; }
.footer-inner { display: grid; grid-template-columns: 1fr auto; gap: 14px 24px; align-items: center; padding: 26px 0 32px; font-size: 13px; }
.footer-brand { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a, .linklike { color: var(--text-2); text-decoration: none; font-weight: 600; background: none; border: 0; padding: 0; font-size: 13px; }
.footer-links a:hover, .linklike:hover { color: var(--text); }
.footer-legal { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 12px; }
@media (max-width: 640px) { .footer-inner { grid-template-columns: 1fr; } .res-nav { top: 64px; } }

/* Modal */
.modal { border: 0; padding: 0; border-radius: var(--radius-xl); background: var(--surface-solid); color: var(--text); width: min(520px, calc(100% - 28px)); box-shadow: 0 40px 100px -30px rgba(0, 0, 0, .7); }
.modal::backdrop { background: rgba(5, 5, 10, .55); backdrop-filter: blur(6px); }
.modal[open] { animation: modalIn .3s var(--ease); }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.modal-body { padding: 22px; display: grid; gap: 14px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { margin: 0; font-size: 19px; }
.form-row { display: grid; gap: 6px; font-weight: 700; font-size: 13.5px; }
.form-row select, .form-row input { height: 44px; padding-inline: 12px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--input-bg); outline: none; font-weight: 600; }
.form-row select:focus, .form-row input:focus { border-color: var(--brand); }
.form-row small { font-weight: 500; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* Toasts */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 14px; background: #15151c; color: #fff; font-size: 13.5px; font-weight: 600; box-shadow: 0 20px 50px -14px rgba(0, 0, 0, .6); border: 1px solid rgba(255, 255, 255, .1); animation: toastIn .35s var(--ease); }
.toast.ok::before { content: "✓"; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--ok); font-size: 12px; }
.toast.err::before { content: "!"; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--bad); font-weight: 900; font-size: 12px; }
.toast.out { opacity: 0; transform: translateY(8px); transition: all .3s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }

.fade-up { animation: fadeUp .6s var(--ease) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } }

/* ---------------- Responsive ---------------- */
@media (max-width: 1080px) {
  .how-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mini-scores { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .serp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .composer-grid, .res-grid, .thumb-top, .studio-controls { grid-template-columns: minmax(0, 1fr); }
  .summary { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
  .summary-side { width: 100%; }
  .kw-hero { justify-content: center; }
  .source-badges { justify-content: center; }
  .yt-stage.search .yt-card { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .container { width: min(var(--container), 100% - 24px); }
  .header-inner { height: 58px; }
  .brand-name { font-size: 19px; }
  .brand-logo { width: 34px; height: 34px; }
  .status-pill .status-text { display: none; }
  .status-pill { padding-inline: 11px; }
  .icon-btn { width: 36px; height: 36px; }
  .hero { padding-top: 34px; }
  .composer { padding: 14px; border-radius: 22px; }
  #titleInput { font-size: 16px; min-height: 96px; }
  .card-head { padding: 16px 14px 0; }
  .card-body { padding: 14px; }
  .meters { grid-template-columns: minmax(0, 1fr); }
  .how-grid, .checklist { grid-template-columns: minmax(0, 1fr); }
  .t-opt { grid-template-columns: auto minmax(0, 1fr); }
  .t-opt .t-side { grid-column: 1 / -1; justify-content: flex-end; }
  .t-text { font-size: 15px; }
  .variant-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .comp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .yt-stage { padding: 14px; }
  .yt-stage.side .yt-card { grid-template-columns: 140px minmax(0, 1fr); }
  .trust-row li { font-size: 12px; padding: 7px 11px; }
}
@media (max-width: 420px) {
  .variant-grid, .comp-grid { grid-template-columns: minmax(0, 1fr); }
  .mini-scores { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media print {
  .app-header, .aura, .hero, .how, .app-footer, .card-actions, .studio, .toasts { display: none !important; }
  .card { box-shadow: none; backdrop-filter: none; }
}
