* { box-sizing: border-box; }

body.youtube-trends-static {
    background: var(--bg);
    color: var(--text);
}

body.youtube-trends-static [hidden] { display: none !important; }

.youtube-tool {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 56px;
    color: var(--text);
}

.youtube-tool button,
.youtube-tool input,
.youtube-tool select { font: inherit; }

.youtube-tool button { cursor: pointer; }

.youtube-tool-breadcrumb {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 26px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 800;
}

.youtube-tool-breadcrumb a { color: var(--text-secondary); text-decoration: none; }
.youtube-tool-breadcrumb a:hover { color: #fff200; }

.youtube-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(285px, .7fr);
    gap: 26px;
    align-items: stretch;
    margin-bottom: 26px;
}

.youtube-eyebrow,
.youtube-workspace-heading p,
.youtube-results-heading p,
.youtube-guide-heading p {
    margin: 0 0 7px;
    color: #fff200;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .11em;
}

.youtube-hero h1 {
    max-width: 760px;
    margin: 0;
    color: var(--text);
    font-size: clamp(34px, 5vw, 58px);
    font-weight: 900;
    letter-spacing: -.045em;
    line-height: .98;
}

.youtube-hero h1 em { color: #fff200; font-style: normal; }

.youtube-hero-copy > p:not(.youtube-eyebrow) {
    max-width: 720px;
    margin: 16px 0 0;
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1.7;
}

.youtube-trust-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.youtube-trust-list span,
.youtube-research-meta span,
.youtube-chip {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    padding: 0 9px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #090909;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 800;
}

.youtube-hero-card {
    display: grid;
    align-content: start;
    gap: 14px;
    padding: 22px;
    border: 1px solid rgba(255, 242, 0, .56);
    border-radius: 14px;
    background: linear-gradient(155deg, rgba(255, 242, 0, .11), rgba(18, 18, 18, .95) 42%, #101010);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}

.youtube-hero-card-label {
    color: #fff200;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .1em;
}

.youtube-hero-card strong {
    color: var(--text);
    font-size: 18px;
    line-height: 1.42;
}

.youtube-hero-card-note {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.6;
}

.youtube-ad-break { margin: 0 0 18px; }
.youtube-ad-break--middle { margin-top: 18px; }
.youtube-ad-break--bottom { margin: 20px 0 0; }

.youtube-workspace,
.youtube-results-section,
.youtube-guide {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-card);
}

.youtube-workspace { padding: 22px; }

.youtube-workspace-heading,
.youtube-results-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
}

.youtube-workspace-heading h2,
.youtube-results-heading h2,
.youtube-guide h2 {
    margin: 0;
    color: var(--text);
    font-size: 25px;
    font-weight: 900;
    letter-spacing: -.025em;
    line-height: 1.2;
}

.youtube-status-pill {
    display: inline-flex;
    min-height: 31px;
    align-items: center;
    justify-content: center;
    padding: 0 11px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 900;
    white-space: nowrap;
}

.youtube-status-pill.is-ready { border-color: rgba(255, 242, 0, .65); color: #fff200; }
.youtube-status-pill.is-loading { border-color: rgba(47, 210, 255, .65); color: #78e7ff; }
.youtube-status-pill.is-error { border-color: rgba(255, 92, 105, .65); color: #ff9aa3; }

.youtube-notice {
    margin-top: 16px;
    padding: 11px 13px;
    border: 1px solid rgba(47, 210, 255, .38);
    border-radius: 9px;
    background: rgba(47, 210, 255, .08);
    color: #b8efff;
    font-size: 13px;
    font-weight: 750;
    line-height: 1.55;
}

.youtube-notice.is-warning { border-color: rgba(255, 193, 88, .48); background: rgba(255, 193, 88, .08); color: #ffdc9e; }
.youtube-notice.is-error { border-color: rgba(255, 92, 105, .5); background: rgba(255, 92, 105, .08); color: #ffabb2; }

.youtube-api-panel {
    display: grid;
    grid-template-columns: minmax(200px, .72fr) minmax(360px, 1.28fr);
    gap: 18px;
    margin-top: 18px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #101010;
}

.youtube-api-copy strong { color: var(--text); font-size: 15px; }
.youtube-api-copy p,
.youtube-setup-help,
.youtube-field small,
.youtube-quota-hint { color: var(--text-secondary); font-size: 12px; font-weight: 700; line-height: 1.55; }
.youtube-api-copy p { margin: 7px 0 0; }

.youtube-api-controls { display: grid; gap: 10px; }
.youtube-button-row,
.youtube-action-row,
.youtube-export-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.youtube-consent-field {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.55;
}

.youtube-consent-field input { width: 16px; height: 16px; margin: 1px 0 0; flex: 0 0 auto; accent-color: #fff200; }
.youtube-consent-field a { color: #aeeaff; font-weight: 850; }
.youtube-data-attribution { grid-column: 1 / -1; margin: 0; color: var(--text-secondary); font-size: 11px; font-weight: 700; line-height: 1.55; }
.youtube-data-attribution span { color: #ff3030; font-size: 14px; }

.youtube-field { display: grid; min-width: 0; gap: 7px; }
.youtube-field > span,
.youtube-inline-field > span { color: var(--text-secondary); font-size: 11px; font-weight: 850; }
.youtube-field small { font-size: 10px; }

.youtube-field input,
.youtube-field select,
.youtube-inline-field select {
    width: 100%;
    min-height: 43px;
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
    background: #070707;
    color: var(--text);
    padding: 0 12px;
}

.youtube-field input:focus,
.youtube-field select:focus,
.youtube-inline-field select:focus { border-color: #fff200; box-shadow: 0 0 0 3px rgba(255, 242, 0, .1); }

.youtube-button {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    padding: 0 13px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #151515;
    color: var(--text);
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    transition: transform .15s ease, border-color .15s ease, background .15s ease, color .15s ease;
}

.youtube-button:hover:not(:disabled),
.youtube-button:focus-visible:not(:disabled) { border-color: #fff200; color: #fff200; outline: none; transform: translateY(-1px); }
.youtube-button--primary { border-color: #fff200; background: #fff200; color: #080808; }
.youtube-button--primary:hover:not(:disabled),
.youtube-button--primary:focus-visible:not(:disabled) { border-color: #fff86f; background: #fff86f; color: #080808; }
.youtube-button--quiet { background: #0a0a0a; color: var(--text-secondary); }
.youtube-button:disabled { cursor: not-allowed; opacity: .46; }
.youtube-run-button { min-width: 142px; }

.youtube-setup-help { grid-column: 1 / -1; margin: 0; }
.youtube-setup-help summary { cursor: pointer; color: var(--text-secondary); font-size: 12px; font-weight: 850; }
.youtube-setup-help summary:hover { color: #fff200; }
.youtube-setup-help ol { margin: 10px 0 6px 18px; padding: 0; }
.youtube-setup-help li { margin: 5px 0; }
.youtube-setup-help code { color: #fff200; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.youtube-setup-help p { display: flex; gap: 14px; flex-wrap: wrap; margin: 8px 0 0; }
.youtube-setup-help a { color: #9bdeff; font-weight: 800; }

.youtube-mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 18px 0; }
.youtube-mode-option { position: relative; display: block; cursor: pointer; }
.youtube-mode-option input { position: absolute; opacity: 0; pointer-events: none; }
.youtube-mode-option span { display: grid; min-height: 92px; gap: 7px; padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: #0d0d0d; transition: border-color .15s ease, background .15s ease; }
.youtube-mode-option strong { color: var(--text); font-size: 14px; }
.youtube-mode-option small { color: var(--text-secondary); font-size: 12px; font-weight: 700; line-height: 1.5; }
.youtube-mode-option input:checked + span { border-color: #fff200; background: rgba(255, 242, 0, .08); }
.youtube-mode-option input:focus-visible + span { box-shadow: 0 0 0 3px rgba(255, 242, 0, .13); }

.youtube-filter-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.youtube-filter-grid #keywordField { grid-column: span 2; }

.youtube-action-row { margin-top: 16px; }
.youtube-quota-hint { flex: 1 1 260px; padding: 0 2px; }

.youtube-results-section { margin-top: 18px; padding: 22px; }
.youtube-export-actions { justify-content: flex-end; }

.youtube-research-meta { display: flex; gap: 7px; flex-wrap: wrap; margin: 14px 0 0; }
.youtube-research-meta span { color: #cfcfcf; }

.youtube-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 16px 0; }
.youtube-metrics article { min-width: 0; padding: 15px; border: 1px solid var(--border); border-radius: 10px; background: #101010; }
.youtube-metrics span { display: block; margin-bottom: 6px; color: var(--text-secondary); font-size: 11px; font-weight: 850; }
.youtube-metrics strong { display: block; overflow-wrap: anywhere; color: var(--text); font-size: 21px; font-weight: 900; line-height: 1.2; }

.youtube-insights { display: grid; grid-template-columns: 1.1fr .9fr 1fr; gap: 10px; margin: 0 0 16px; }
.youtube-insights article { min-width: 0; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: #101010; }
.youtube-insights article > span { display: block; margin-bottom: 9px; color: #fff200; font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.youtube-insights p { margin: 0; color: var(--text-secondary); font-size: 12px; font-weight: 700; line-height: 1.6; }
.youtube-chip-cloud { display: flex; gap: 6px; flex-wrap: wrap; }
.youtube-chip { max-width: 100%; overflow: hidden; color: #dedede; text-overflow: ellipsis; white-space: nowrap; }

.youtube-result-toolbar { display: flex; align-items: end; gap: 9px; flex-wrap: wrap; margin-bottom: 14px; }
.youtube-search-field { flex: 1 1 260px; }
.youtube-inline-field { display: grid; min-width: 140px; gap: 7px; }
.youtube-check-field { display: inline-flex; min-height: 43px; align-items: center; gap: 7px; padding: 0 11px; border: 1px solid var(--border); border-radius: 8px; background: #080808; color: var(--text-secondary); font-size: 12px; font-weight: 800; }
.youtube-check-field input { width: 16px; height: 16px; accent-color: #fff200; }

.youtube-empty-state { padding: 42px 18px; border: 1px dashed rgba(255,255,255,.18); border-radius: 10px; color: var(--text-secondary); font-size: 14px; font-weight: 750; line-height: 1.6; text-align: center; }
.youtube-video-list { display: grid; gap: 10px; }

.youtube-video-card { display: grid; grid-template-columns: 208px minmax(0, 1fr); gap: 14px; padding: 12px; border: 1px solid var(--border); border-radius: 11px; background: #101010; }
.youtube-video-thumb { position: relative; overflow: hidden; border-radius: 8px; aspect-ratio: 16 / 9; background: #060606; }
.youtube-video-thumb img { width: 100%; height: 100%; object-fit: cover; }
.youtube-video-rank,
.youtube-video-duration { position: absolute; display: inline-flex; min-height: 25px; align-items: center; padding: 0 8px; border-radius: 999px; background: rgba(0,0,0,.8); font-size: 11px; font-weight: 900; }
.youtube-video-rank { top: 8px; left: 8px; color: #fff200; }
.youtube-video-duration { right: 8px; bottom: 8px; color: #fff; }
.youtube-video-body { min-width: 0; }
.youtube-video-title { margin: 0; font-size: 17px; font-weight: 900; line-height: 1.36; }
.youtube-video-title a { color: var(--text); text-decoration: none; }
.youtube-video-title a:hover { color: #fff200; }
.youtube-video-channel { margin: 6px 0 0; color: var(--text-secondary); font-size: 12px; font-weight: 750; }
.youtube-video-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.youtube-video-tags span { display: inline-flex; min-height: 25px; align-items: center; padding: 0 8px; border: 1px solid var(--border); border-radius: 999px; background: #090909; color: #cecece; font-size: 11px; font-weight: 800; }
.youtube-video-tags .is-signal { border-color: rgba(255,242,0,.42); color: #fff200; }
.youtube-video-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.youtube-video-stats div { min-width: 0; padding: 9px; border: 1px solid rgba(255,255,255,.09); border-radius: 7px; background: #0a0a0a; }
.youtube-video-stats span { display: block; overflow: hidden; color: var(--text-secondary); font-size: 10px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.youtube-video-stats strong { display: block; overflow: hidden; margin-top: 3px; color: var(--text); font-size: 13px; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.youtube-video-note { margin: 10px 0 0; color: var(--text-secondary); font-size: 11px; font-weight: 700; line-height: 1.55; }

.youtube-guide { margin-top: 18px; padding: 24px; }
.youtube-guide-heading { max-width: 700px; }
.youtube-guide-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.youtube-guide-grid article { padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: #101010; }
.youtube-guide-grid h3 { margin: 0; color: var(--text); font-size: 15px; }
.youtube-guide-grid p { margin: 8px 0 0; color: var(--text-secondary); font-size: 12px; font-weight: 700; line-height: 1.65; }
.youtube-faq { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--border); }
.youtube-faq h2 { font-size: 19px; }
.youtube-faq details { padding: 14px 0; border-bottom: 1px solid var(--border); }
.youtube-faq summary { cursor: pointer; color: var(--text); font-size: 14px; font-weight: 850; }
.youtube-faq summary:hover { color: #fff200; }
.youtube-faq p { margin: 9px 0 0; color: var(--text-secondary); font-size: 12px; font-weight: 700; line-height: 1.65; }

@media (max-width: 980px) {
    .youtube-hero,
    .youtube-api-panel { grid-template-columns: 1fr; }
    .youtube-filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .youtube-filter-grid #keywordField { grid-column: span 2; }
    .youtube-insights { grid-template-columns: 1fr 1fr; }
    .youtube-insights article:last-child { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
    .youtube-tool { width: min(100% - 24px, 1180px); padding-top: 20px; }
    .youtube-hero { gap: 18px; }
    .youtube-hero h1 { font-size: clamp(34px, 12vw, 48px); }
    .youtube-workspace,
    .youtube-results-section,
    .youtube-guide { padding: 16px; border-radius: 11px; }
    .youtube-workspace-heading,
    .youtube-results-heading { align-items: start; flex-direction: column; }
    .youtube-export-actions { justify-content: flex-start; }
    .youtube-mode-grid,
    .youtube-filter-grid,
    .youtube-metrics,
    .youtube-insights,
    .youtube-guide-grid { grid-template-columns: 1fr; }
    .youtube-filter-grid #keywordField,
    .youtube-insights article:last-child { grid-column: auto; }
    .youtube-video-card { grid-template-columns: 1fr; }
    .youtube-video-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .youtube-result-toolbar { align-items: stretch; }
    .youtube-inline-field { width: 100%; }
    .youtube-check-field { flex: 1 1 150px; }
}

@media (prefers-reduced-motion: reduce) {
    .youtube-tool *,
    .youtube-tool *::before,
    .youtube-tool *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
