/* ============================================================================
   YouTube Growth & SEO Toolkit — interface styles
   1. Design tokens (light + dark)   2. Base & typography   3. App shell
   4. Components (cards, forms, buttons, stats, tables…)   5. Tool-specific
   6. Responsive   7. Print
   ============================================================================ */

/* ---------- 1. Design tokens */
:root {
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", "Noto Sans Devanagari", sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface-2: #f3f4f8;
  --surface-3: #e8eaf1;
  --field: #ffffff;
  --border: #e3e6ee;
  --border-strong: #cdd2de;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64708a;

  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef0ff;
  --accent-ring: rgba(79, 70, 229, .22);
  --on-accent: #ffffff;
  --glow-2: #06b6d4;

  --pass: #15803d; --pass-soft: #e6f6ec;
  --warn: #b45309; --warn-soft: #fdf1dc;
  --fail: #dc2626; --fail-soft: #fdeaea;
  --info: #475569; --info-soft: #eceff5;

  --serp-title: #1a0dab; --serp-url: #202124; --serp-desc: #4d5156;
  --chart-line: #4f46e5;

  --radius-sm: 8px; --radius: 12px; --radius-lg: 18px;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 14px rgba(15, 23, 42, .06);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, .16), 0 2px 8px rgba(15, 23, 42, .08);
  --topbar-h: 60px;
  --sidebar-w: 272px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b0d13;
  --surface: #11141c;
  --surface-2: #181c27;
  --surface-3: #202534;
  --field: #0d1017;
  --border: #212737;
  --border-strong: #303848;
  --text: #e8ebf3;
  --text-2: #c4cad8;
  --muted: #8c96ad;

  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-soft: #1c2142;
  --accent-ring: rgba(129, 140, 248, .3);
  --on-accent: #0b0d13;
  --glow-2: #22d3ee;

  --pass: #4ade80; --pass-soft: #10291c;
  --warn: #fbbf24; --warn-soft: #2d2410;
  --fail: #f87171; --fail-soft: #32181a;
  --info: #a9b3c7; --info-soft: #1e2432;

  --serp-title: #8ab4f8; --serp-url: #dadce0; --serp-desc: #bdc1c6;
  --chart-line: #818cf8;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 4px 16px rgba(0, 0, 0, .35);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .6), 0 2px 8px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

/* ---------- 2. Base & typography */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body {
  font: 15px/1.55 var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -.022em; line-height: 1.2; margin: 0 0 .4rem; }
h2 { font-size: 1.05rem; font-weight: 650; letter-spacing: -.01em; margin: 0 0 .8rem; }
h3 { font-size: .9rem; font-weight: 650; margin: 1.1rem 0 .5rem; color: var(--text-2); }
p { margin: 0 0 .75rem; }
.lead { color: var(--muted); font-size: .98rem; line-height: 1.6; margin: 0 0 1.5rem; max-width: 76ch; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .45rem;
  font-size: .7rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--accent); margin-bottom: .55rem;
}
.eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.page-title { display: flex; align-items: center; gap: 12px; }
.h1-ico {
  display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 12px;
  background: var(--accent-soft); font-size: 1.3rem; line-height: 1;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 16%, transparent);
}
.skip-link {
  position: fixed; top: 8px; left: 8px; z-index: 100; transform: translateY(-200%);
  padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; box-shadow: var(--shadow-lg); cursor: pointer;
}
.skip-link:focus-visible { transform: none; outline: 2px solid var(--accent); outline-offset: 2px; }
kbd {
  font: 600 .68rem/1 var(--font); padding: 3px 6px; border-radius: 6px;
  border: 1px solid var(--border); border-bottom-width: 2px; background: var(--surface); color: var(--muted);
}
::selection { background: var(--accent-soft); color: var(--text); }

/* ---------- 3. App shell: top bar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  height: var(--topbar-h); padding: 0 20px;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1rem; letter-spacing: -.012em; color: var(--text); text-decoration: none; }
.brand:hover { color: var(--text); }
.brand-mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
  box-shadow: 0 2px 8px var(--accent-ring), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.brand-mark svg { width: 18px; height: 18px; }
.brand em { font-style: normal; font-weight: 500; color: var(--muted); }
.search-btn {
  margin-left: auto; display: inline-flex; align-items: center; gap: 10px;
  height: 36px; width: min(440px, 36vw); padding: 0 8px 0 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2);
  color: var(--muted); font: inherit; font-size: .86rem; cursor: pointer; transition: border-color .15s, color .15s, background .15s;
}
.search-btn:hover { border-color: var(--border-strong); color: var(--text); background: var(--surface); }
.search-btn svg { width: 16px; height: 16px; flex: none; }
.search-btn span { flex: 1; text-align: left; }
.search-btn kbd { opacity: .9; }
.top-actions { display: flex; align-items: center; gap: 4px; }
.icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer; text-decoration: none;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
.menu-btn { display: none; place-items: center; width: 36px; height: 36px; margin-left: -8px; border-radius: 10px; border: 0; background: none; color: var(--text); cursor: pointer; }
.menu-btn svg { width: 20px; height: 20px; }

/* ---------- 3. App shell: layout & sidebar */
.layout { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: calc(100vh - var(--topbar-h)); }
.sidebar {
  position: sticky; top: var(--topbar-h); align-self: start; height: calc(100vh - var(--topbar-h)); overflow-y: auto;
  padding: 14px 12px 28px; border-right: 1px solid var(--border); background: var(--surface);
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
}
.sidebar a {
  position: relative; display: flex; align-items: center; gap: 10px;
  min-height: 34px; padding: 6px 10px; margin: 1px 0; border-radius: 8px;
  color: var(--text-2); text-decoration: none; font-size: .88rem; font-weight: 500;
  transition: background .12s, color .12s;
}
.sidebar a:hover { background: var(--surface-2); color: var(--text); }
.sidebar a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidebar a[aria-current="page"]::before {
  content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent);
}
.sidebar .ico { width: 22px; flex: none; text-align: center; font-size: 15px; line-height: 1; }
.sidebar .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-top { padding-bottom: 8px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.nav-group { margin-top: 10px; }
.nav-group summary {
  list-style: none; display: flex; align-items: center; gap: 6px;
  padding: 6px 8px 6px 6px; border-radius: 8px; cursor: pointer; user-select: none;
  font-size: .69rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted);
}
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary:hover { color: var(--text); background: var(--surface-2); }
.nav-group summary .chev { width: 12px; height: 12px; flex: none; transition: transform .15s; }
.nav-group[open] summary .chev { transform: rotate(90deg); }
.nav-group summary .count {
  margin-left: auto; font-size: .66rem; font-weight: 600; letter-spacing: 0;
  color: var(--muted); background: var(--surface-2); padding: 1px 7px; border-radius: 999px;
}
.nav-group summary:hover .count { background: var(--surface-3); }
.nav-links { padding-top: 2px; }
.backdrop { display: none; }

main { width: 100%; max-width: 1240px; margin: 0 auto; padding: 32px 40px 88px; outline: none; }
main.enter { animation: page-in .22s ease-out both; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- 3. App shell: command palette */
.palette {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: start center;
  padding: 12vh 16px 16px; background: rgba(5, 8, 20, .5);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.palette[hidden] { display: none; }
.palette-box {
  width: 100%; max-width: 640px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg);
  animation: pop .16s ease-out both;
}
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.985); } to { opacity: 1; transform: none; } }
.palette-head { display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.palette-head svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.palette-box input[type=search] { border: 0; border-radius: 0; min-height: 56px; padding: 0; font-size: 1.02rem; background: transparent; }
.palette-box input[type=search]:focus { box-shadow: none; }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: 52vh; overflow-y: auto; }
.palette-list li { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 9px; cursor: pointer; }
.palette-list li[aria-selected="true"], .palette-list li:hover { background: var(--accent-soft); }
.palette-list .ico { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: var(--surface-2); font-size: 15px; flex: none; }
.palette-list li[aria-selected="true"] .ico { background: var(--surface); }
.palette-list .t { display: block; font-weight: 600; font-size: .9rem; }
.palette-list .g { display: block; font-size: .74rem; color: var(--muted); }
.palette-list .go { margin-left: auto; color: var(--muted); opacity: 0; font-size: .74rem; }
.palette-list li[aria-selected="true"] .go { opacity: 1; }
.palette-empty { padding: 24px; text-align: center; color: var(--muted); cursor: default; }
.palette-foot { display: flex; gap: 16px; padding: 9px 14px; border-top: 1px solid var(--border); font-size: .74rem; color: var(--muted); }
.palette-foot kbd { margin-right: 4px; }

/* ---------- 4. Cards & grids */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: var(--shadow-xs); margin-bottom: 20px;
}
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.grid-2 > .card { margin-bottom: 0; min-width: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.grid-3 > .card { margin-bottom: 0; min-width: 0; }
.output-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .7rem; }
.output-head h2 { margin: 0; }

/* ---------- 4. Forms */
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.fields .full { grid-column: 1 / -1; }
label { display: block; font-size: .82rem; font-weight: 600; color: var(--text-2); margin-bottom: .35rem; }
.help { display: block; font-weight: 400; color: var(--muted); font-size: .78rem; line-height: 1.45; margin-top: .25rem; }
input[type=text], input[type=url], input[type=date], input[type=number], input[type=search], input[type=email], input[type=password], select, textarea {
  width: 100%; min-height: 40px; padding: .5rem .8rem; font: inherit; font-size: .92rem; color: var(--text);
  background: var(--field); border: 1px solid var(--border-strong); border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
textarea.code, pre.code { font-family: var(--mono); font-size: .8rem; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .65; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
button:focus-visible, a:focus-visible, summary:focus-visible, label.btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%238c96ad' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 14px;
}
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
input[type=range] { accent-color: var(--accent); }
.check { display: flex; align-items: center; gap: .55rem; font-weight: 400; font-size: .9rem; color: var(--text); margin: 0; }
.checks-inline { display: flex; flex-wrap: wrap; gap: .6rem 1.4rem; }
.counter { float: right; font-weight: 600; font-size: .74rem; font-variant-numeric: tabular-nums; }
.counter.ok { color: var(--pass); } .counter.warn { color: var(--warn); } .counter.bad { color: var(--fail); }
input[type=search].tool-search {
  max-width: 460px; padding-left: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238c96ad' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 12px center; background-size: 17px;
}

/* ---------- 4. Buttons */
.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: 16px; }
button.btn, a.btn, label.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 0 15px; margin: 0;
  font: inherit; font-size: .88rem; font-weight: 600; line-height: 1.2; white-space: nowrap;
  color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px;
  cursor: pointer; text-decoration: none; box-shadow: var(--shadow-xs);
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 1px 2px var(--accent-ring), inset 0 1px 0 rgba(255, 255, 255, .14); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn.small { min-height: 30px; padding: 0 10px; font-size: .78rem; border-radius: 8px; }
label.btn.file-btn { position: relative; }
label.btn.file-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.tabs { display: flex; gap: .4rem; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); border-color: transparent; box-shadow: none; }

/* ---------- 4. Code, notices, misc blocks */
pre.code {
  margin: 0; padding: 14px 16px; overflow: auto; max-height: 460px; white-space: pre; line-height: 1.55;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
}
.notice {
  display: flow-root; padding: 11px 14px; margin-top: 12px; border-radius: 10px; font-size: .88rem; line-height: 1.5;
  background: var(--warn-soft); color: var(--warn); border: 1px solid color-mix(in srgb, currentColor 16%, transparent);
}
.notice.ok { background: var(--pass-soft); color: var(--pass); }
.slug-out { font-family: var(--mono); font-size: 1rem; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; overflow-wrap: anywhere; min-height: 48px; }
details.yt-key { border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px; padding: 10px 14px; margin-top: 14px; }
details.yt-key summary { cursor: pointer; font-weight: 600; font-size: .86rem; }
details.yt-key[open] summary { margin-bottom: 8px; }
.progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: var(--pass); transition: width .3s ease; }

/* ---------- 4. Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat {
  display: flex; flex-direction: column; gap: 3px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-xs);
}
.stat .k { order: -1; color: var(--muted); font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.stat .v { font-size: 1.45rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* ---------- 4. Score ring, pills, badges, check list */
.score-wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.score-ring {
  --p: 0; --c: var(--accent); width: 120px; height: 120px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-3) 0);
  box-shadow: inset 0 0 0 1px var(--border);
}
.score-ring > div { width: 94px; height: 94px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; text-align: center; box-shadow: var(--shadow-xs); }
.score-ring strong { font-size: 2rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.score-ring small { color: var(--muted); font-size: .66rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.pills { display: flex; gap: .5rem; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 600; line-height: 1.5;
  padding: 2px 9px; border-radius: 999px; white-space: nowrap;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 16%, transparent);
}
.pill.pass, .badge.pass { background: var(--pass-soft); color: var(--pass); }
.pill.warn, .badge.warn { background: var(--warn-soft); color: var(--warn); }
.pill.fail, .badge.fail { background: var(--fail-soft); color: var(--fail); }
.pill.info, .badge.info { background: var(--info-soft); color: var(--info); }
.badge { font-size: .66rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; text-align: center; padding: 3px 0; border-radius: 6px; height: fit-content; }
.check-list { list-style: none; margin: 0; padding: 0; }
.check-list li { display: grid; grid-template-columns: 68px minmax(0, 1fr); gap: 14px; padding: 11px 0; border-top: 1px solid var(--border); }
.check-list li:first-child { border-top: 0; }
.check-list .lbl { font-weight: 600; }
.check-list .msg { color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }
.outline { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.outline li { padding: 3px 0; overflow-wrap: anywhere; }
.outline .tag { display: inline-block; min-width: 2.2rem; font-family: var(--mono); font-size: .74rem; color: var(--accent); font-weight: 700; }

/* ---------- 4. Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.table-wrap table { font-size: .86rem; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .88rem; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th {
  position: sticky; top: 0; z-index: 1; background: var(--surface-2);
  font-size: .69rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 65%, transparent); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
th button.sort { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
td.url { overflow-wrap: anywhere; min-width: 140px; max-width: 260px; font-size: .82rem; }
.meta-table td { vertical-align: top; }
.meta-table td:nth-child(3), .meta-table td:nth-child(4) { min-width: 220px; }
.meta-table .counter { float: none; }
.bar { height: 6px; border-radius: 3px; background: var(--accent); opacity: .8; min-width: 2px; }
tr.yt-mine td, tbody tr.yt-mine:hover td { background: var(--accent-soft); }

/* ---------- 4. SERP & social previews */
.serp { font-family: Arial, sans-serif; max-width: 600px; }
.serp .site { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.serp .fav { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; font-size: 12px; color: var(--muted); }
.serp .name { font-size: 14px; color: var(--serp-url); line-height: 1.3; }
.serp .crumb { font-size: 12px; color: var(--serp-desc); line-height: 1.3; overflow-wrap: anywhere; }
.serp .t { font-size: 20px; line-height: 1.3; color: var(--serp-title); margin: 2px 0 3px; overflow-wrap: anywhere; }
.serp .d { font-size: 14px; line-height: 1.58; color: var(--serp-desc); overflow-wrap: anywhere; }
.serp.mobile { max-width: 380px; }
.social { max-width: 500px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.social .img { aspect-ratio: 1.91 / 1; background: var(--surface-2) center / cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: .85rem; }
.social .body { padding: 10px 12px; border-top: 1px solid var(--border); }
.social .dom { font-size: .75rem; color: var(--muted); text-transform: uppercase; }
.social .st { font-weight: 600; margin: 2px 0; overflow-wrap: anywhere; }
.social .sd { font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- 4. Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; z-index: 70; transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: .6rem 1rem; border-radius: 10px;
  font-size: .86rem; font-weight: 500; box-shadow: var(--shadow-lg); transition: .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 4. Home: hero & tiles */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 32px; align-items: center;
  padding: 40px 44px; margin-bottom: 28px;
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow);
}
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(640px 280px at 88% -30%, color-mix(in srgb, var(--accent) 24%, transparent), transparent 70%),
    radial-gradient(420px 220px at -8% 115%, color-mix(in srgb, var(--glow-2) 16%, transparent), transparent 70%);
}
.hero h1 { font-size: 2.15rem; max-width: 22ch; margin-bottom: .6rem; }
.hero .lead { margin-bottom: 1.4rem; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.hero-stats .stat { background: color-mix(in srgb, var(--surface) 72%, transparent); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.home-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 2px; }
.home-toolbar .tool-search { flex: 1 1 280px; }
.tile-group { display: flex; align-items: center; gap: 10px; margin: 1.9rem 0 .85rem; font-size: 1rem; }
.tile-group .count { font-size: .72rem; font-weight: 600; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); padding: 0 8px; border-radius: 999px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.tile {
  display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 12px; row-gap: 2px; align-content: start;
  padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface);
  color: var(--text); text-decoration: none; box-shadow: var(--shadow-xs);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.tile:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); transform: translateY(-2px); box-shadow: var(--shadow); }
.tile .ico { grid-row: span 2; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: var(--accent-soft); font-size: 1.15rem; }
.tile strong { display: block; margin: 0; font-size: .92rem; font-weight: 650; letter-spacing: -.005em; }
.tile span { color: var(--muted); font-size: .8rem; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- 5. Content & planning tools (js/tools/content.js) */
.sim-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .9rem; max-height: 420px; overflow: auto; }
mark.shared { background: var(--warn-soft); color: inherit; border-radius: 3px; padding: 0 1px; }
.todo { list-style: none; margin: 0; padding: 0; }
.todo li { padding: 9px 0; border-top: 1px solid var(--border); }
.todo li:first-child { border-top: 0; }
.todo .check { align-items: flex-start; }
.todo input[type=checkbox] { margin-top: .3rem; flex: none; }
.todo .check > span { display: block; }
.plain-list { margin: 0; padding-left: 1.1rem; font-size: .9rem; }
.plain-list li { padding: 3px 0; overflow-wrap: anywhere; }

/* ---------- 5. YouTube tools (js/tools/youtube.js) */
.yt-cols { columns: 2 220px; }
.yt-result { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.yt-thumb {
  position: relative; flex: none; width: 100%; max-width: 320px; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden;
  background: var(--surface-2) center / cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: .85rem;
}
.yt-dur { position: absolute; right: 6px; bottom: 6px; background: rgba(0, 0, 0, .8); color: #fff; font-size: 11px; font-weight: 600; padding: 1px 4px; border-radius: 4px; }
.yt-meta { flex: 1; min-width: 220px; font-family: Roboto, Arial, sans-serif; }
.yt-tags { color: #065fd4; font-size: 12px; margin-bottom: 2px; }
.yt-title { font-size: 18px; line-height: 1.35; font-weight: 500; overflow-wrap: anywhere; }
.yt-sub, .yt-desc { color: var(--muted); font-size: 12px; margin-top: 4px; overflow-wrap: anywhere; }
.yt-prev-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.yt-prev { max-width: 100%; padding: 10px; border-radius: 10px; font-family: Roboto, Arial, sans-serif; }
.yt-prev .yt-thumb { max-width: none; }
.yt-prev.light { background: #fff; color: #0f0f0f; }
.yt-prev.dark { background: #0f0f0f; color: #f1f1f1; }
.yt-prev-t { font-size: 14px; font-weight: 500; line-height: 1.35; margin-top: 8px; overflow-wrap: anywhere; }
.yt-prev-s { font-size: 12px; opacity: .7; margin-top: 2px; }

/* ---------- 5. YouTube growth tools (js/tools/youtube-growth.js) */
.gx-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 28px; align-items: center; }
.gx-score { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.gx-score .score-ring { width: 144px; height: 144px; }
.gx-score .score-ring > div { width: 114px; height: 114px; }
.gx-score .score-ring strong { font-size: 2.5rem; }
.gx-meters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 22px; }
.gx-meter-top { display: flex; justify-content: space-between; align-items: baseline; font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; }
.gx-meter-top strong { font-size: 1rem; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.gx-meter .help { margin-top: 4px; }
.gx-big { font-size: 2.6rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; margin: 0 0 .3rem; font-variant-numeric: tabular-nums; }
.gx-copy { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; font-weight: 600; overflow-wrap: anywhere; }
.gx-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 8px; padding: 0; margin: 14px 0 0; }
.gx-steps li { font-size: .78rem; font-weight: 500; color: var(--muted); padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.gx-steps li.done { color: var(--pass); background: var(--pass-soft); border-color: transparent; }
.gx-steps li.active { color: var(--accent); background: var(--accent-soft); border-color: transparent; font-weight: 600; }
.gx-today { border-left: 4px solid var(--pass); }
.gx-opt h2 { font-size: 1rem; }
.gx-apply { margin-top: 12px; padding: 14px; border: 1px dashed color-mix(in srgb, var(--accent) 60%, var(--border)); background: var(--accent-soft); border-radius: 10px; }
.gx-apply .help { color: var(--text-2); }

/* ---------- 5. Growth tracking tools (js/tools/youtube-intel.js) */
.ix-grid-charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 20px; }
.ix-grid-charts > .card { margin-bottom: 0; min-width: 0; }
.ix-chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.ix-chart-head .pill { white-space: nowrap; }
.ix-chart-title { font-size: .74rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.ix-chart-value { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.ix-plot { position: relative; margin-top: 8px; touch-action: pan-y; }
.ix-plot svg { display: block; width: 100%; height: auto; overflow: visible; }
.ix-grid { stroke: var(--border); stroke-width: 1; }
.ix-tick { fill: var(--muted); font-size: 10px; font-family: inherit; }
.ix-line { fill: none; stroke: var(--chart-line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ix-area { fill: var(--chart-line); opacity: .1; }
.ix-dot, .ix-hover { fill: var(--chart-line); stroke: var(--surface); stroke-width: 2; }
.ix-cross { stroke: var(--muted); stroke-width: 1; }
.ix-tip { position: absolute; top: -6px; width: 104px; padding: 4px 8px; font-size: .76rem; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); pointer-events: none; }
.ix-table summary, .gx-apply summary { cursor: pointer; font-size: .8rem; color: var(--muted); margin-top: 6px; }
.ix-idea h2 { font-size: 1.05rem; }

/* ---------- 6. Responsive */
@media (max-width: 1100px) {
  main { padding: 28px 28px 72px; }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .gx-hero { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .hero { grid-template-columns: minmax(0, 1fr); padding: 30px 28px; }
  .hero-stats .stat { padding: 12px 14px; }
}
@media (max-width: 760px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .menu-btn { display: grid; margin-left: 0; }
  .brand-name em { display: none; }
  /* Phone tap targets: 44px minimum (topbar buttons, sidebar links, buttons). */
  .menu-btn, .icon-btn, .search-btn { width: 44px; height: 44px; flex: none; }
  .search-btn { padding: 0; justify-content: center; }
  .search-btn span, .search-btn kbd { display: none; }
  .top-actions { gap: 0; }
  .sidebar a { min-height: 44px; padding: 8px 10px; }
  .btn { min-height: 44px; }
  .btn.small { min-height: 40px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; top: var(--topbar-h); left: 0; z-index: 25; width: min(300px, 86vw);
    transform: translateX(-100%); transition: transform .22s ease;
  }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .backdrop.show { display: block; position: fixed; inset: var(--topbar-h) 0 0; z-index: 24; background: rgba(5, 8, 20, .45); }
  main { padding: 20px 16px 64px; }
  .fields { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 16px; }
  h1 { font-size: 1.4rem; }
  .hero h1 { font-size: 1.6rem; }
  .page-title { gap: 10px; }
  .h1-ico { width: 38px; height: 38px; font-size: 1.1rem; border-radius: 10px; }
  .hero-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .hero-stats .stat .v { font-size: 1.2rem; }
  .palette { padding-top: 8vh; }
}
@media (max-width: 520px) {
  .gx-meters { grid-template-columns: minmax(0, 1fr); }
  .hero-stats { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- 7. Print / PDF reports: just the report content. */
@media print {
  .topbar, .sidebar, .backdrop, .palette, .btn-row, details.yt-key, .toast, .eyebrow, .h1-ico, .skip-link { display: none !important; }
  .layout { display: block; }
  main { padding: 0; max-width: none; animation: none; }
  .card { box-shadow: none; break-inside: avoid; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  body { background: #fff; color: #000; }
  main > h1 + .lead + .card { display: none !important; }
}
