/* StockSpy — design tokens. Dark is the default; light overrides the same tokens. */
:root {
    color-scheme: dark;
    --font: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    --bg: #0b0d12;
    --bg-glow-a: #27cabb14;
    --bg-glow-b: #8f6bff12;
    --surface: #12151c;
    --surface-2: #171b24;
    --surface-3: #1e2330;
    --border: #252b38;
    --border-strong: #343c4e;
    --text: #eef1f6;
    --text-2: #c3cad7;
    --muted: #8e97a9;
    --accent: #4bdcce;
    --accent-2: #a385fc;
    --accent-grad: linear-gradient(110deg, #4bdcce, #7fb2ff 52%, #a385fc);
    --on-accent: #07121f;
    --focus: #8cc4ff;
    --ai: #9a8cff;
    --ai-bg: #6c61ff1f;
    --non-ai: #3fd3ae;
    --non-ai-bg: #10b9811f;
    --warn: #ffcf7a;
    --danger: #ff8fa3;
    --shadow-sm: 0 1px 2px #0006;
    --shadow: 0 10px 30px -12px #000a;
    --shadow-lg: 0 30px 80px -20px #000c;
    --radius: 16px;
    --radius-sm: 10px;
    --sidebar: 264px;
    --ease: cubic-bezier(.2, .7, .2, 1);
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-text-size-adjust: 100%;
}
html[data-theme="light"] {
    color-scheme: light;
    --bg: #f5f7fb;
    --bg-glow-a: #2bccba14;
    --bg-glow-b: #8654da10;
    --surface: #ffffff;
    --surface-2: #f7f9fc;
    --surface-3: #eef2f7;
    --border: #e2e7ef;
    --border-strong: #cfd7e3;
    --text: #141824;
    --text-2: #3a4356;
    --muted: #5f6b80;
    --accent: #0a978d;
    --accent-2: #7b4fd6;
    --accent-grad: linear-gradient(110deg, #0fa89c, #3f76da 52%, #8654da);
    --on-accent: #ffffff;
    --focus: #2f6fdb;
    --ai: #5141b8;
    --ai-bg: #5141b814;
    --non-ai: #08775c;
    --non-ai-bg: #08775c14;
    --warn: #8a5a00;
    --danger: #b4234a;
    --shadow-sm: 0 1px 2px #1018280f;
    --shadow: 0 12px 30px -16px #10182833;
    --shadow-lg: 0 30px 80px -24px #10182859;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(900px 500px at 15% -10%, var(--bg-glow-a), transparent 60%),
        radial-gradient(900px 600px at 100% 0%, var(--bg-glow-b), transparent 60%),
        var(--bg);
    background-attachment: fixed;
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -100px; left: 12px; z-index: 100; padding: 12px 16px; border-radius: 10px; background: var(--text); color: var(--bg); font-weight: 700; }
.skip-link:focus { top: 12px; }
kbd { display: inline-block; min-width: 20px; padding: 1px 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); font: 600 11px/16px var(--font); text-align: center; }
.icon { width: 16px; height: 16px; flex-shrink: 0; }

/* Base controls */
input, button, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-3); padding: 10px 16px; transition: background-color .15s, border-color .15s, color .15s, transform .15s var(--ease), box-shadow .15s; }
button:hover:not(:disabled) { border-color: var(--muted); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; }
:is(button, a, input, select, summary):focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.ghost-button { background: transparent; border-color: var(--border); color: var(--text-2); }
.ghost-button:hover:not(:disabled) { background: var(--surface-3); }
.link-button { padding: 2px 4px; border: 0; background: none; color: var(--muted); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.link-button:hover:not(:disabled) { color: var(--text); }
select {
    appearance: none; -webkit-appearance: none;
    width: 100%; min-width: 0; padding: 11px 36px 11px 12px; font-size: 13px;
    background: linear-gradient(45deg, transparent 50%, var(--muted) 50%) no-repeat calc(100% - 18px) 50% / 5px 5px, linear-gradient(135deg, var(--muted) 50%, transparent 50%) no-repeat calc(100% - 13px) 50% / 5px 5px, var(--surface-2);
    border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer;
    transition: border-color .15s;
}
select:hover:not(:disabled) { border-color: var(--border-strong); }
select:disabled { opacity: .5; cursor: not-allowed; }

/* Sidebar */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 40; display: flex; flex-direction: column; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-right: 1px solid var(--border); }
.sidebar-brand { min-height: 76px; display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; text-decoration: none; }
.brand small { font-size: 10px; color: var(--muted); letter-spacing: .02em; }
.stockspy-logo { display: block; width: 172px; max-width: 100%; }
.stockspy-logo img { display: block; width: 100%; height: auto; }
.stockspy-logo .logo-light { display: none; }
html[data-theme="light"] .stockspy-logo .logo-dark { display: none; }
html[data-theme="light"] .stockspy-logo .logo-light { display: block; }
#menu-toggle { display: none; align-items: center; gap: 8px; padding: 8px 12px; font-size: 12px; font-weight: 600; }
.sidebar-content { display: flex; flex: 1; flex-direction: column; gap: 18px; padding: 20px 14px 14px; overflow-y: auto; min-height: 0; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-label { margin: 0 12px 8px; text-transform: uppercase; letter-spacing: .1em; font-size: 10px; font-weight: 700; color: var(--muted); }
.sidebar-nav :is(a, .nav-button) { display: flex; width: 100%; border: 0; background: transparent; text-align: left; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; text-decoration: none; font-size: 13px; font-weight: 600; color: var(--muted); transition: background-color .15s, color .15s; }
.sidebar-nav :is(a, .nav-button):hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.sidebar-nav .nav-active { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); position: relative; }
.sidebar-nav .nav-active::before { content: ""; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent-grad); }
.sidebar-nav .nav-active .icon { color: var(--accent); }
.sidebar-tip { padding: 14px; border: 1px dashed var(--border-strong); border-radius: 14px; font-size: 12px; color: var(--muted); }
.sidebar-tip strong { display: block; color: var(--text-2); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; }
.sidebar-tip p { margin: 0; line-height: 1.7; }
.sidebar-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.sidebar-actions { display: grid; gap: 6px; }
.sidebar-actions button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 12px; font-size: 12px; font-weight: 600; text-align: left; }
.profile { padding: 10px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface-2); }
#profile-member { display: flex; align-items: center; gap: 11px; min-width: 0; text-decoration: none; border-radius: 10px; }
#profile-member:hover .profile-limit-hint { color: var(--text); }
.avatar { display: grid; place-items: center; flex: 0 0 38px; height: 38px; border-radius: 12px; background: var(--accent-grad); color: var(--on-accent); font-size: 13px; font-weight: 800; letter-spacing: .02em; }
html[data-theme="light"] .avatar { color: #fff; }
.profile-identity { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.profile-identity strong { display: block; max-width: 100%; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-limit-hint { font-size: 10px; color: var(--muted); transition: color .15s; }
.plan-badge { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 3px 8px; border: 1px solid var(--plan-border, #697386); border-radius: 7px; color: var(--plan-text, #c4cfdf); background: var(--plan-bg, #26303c); font-size: 10px; font-weight: 750; line-height: 14px; letter-spacing: .03em; }
.plan-badge .icon { width: 12px; height: 12px; }
.plan-badge span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-free { --plan-text: #c4cfdf; --plan-border: #647184; --plan-bg: #26303c; }
.plan-basic { --plan-text: #a5d3ff; --plan-border: #427bb8; --plan-bg: #182f4a; }
.plan-standard { --plan-text: #8fe4cc; --plan-border: #308a76; --plan-bg: #143b32; }
.plan-pro { --plan-text: #ffdc8c; --plan-border: #b88735; --plan-bg: #40301a; }
.plan-elite { --plan-text: #d9bcff; --plan-border: #9470c6; --plan-bg: #342448; }
html[data-theme="light"] .plan-badge { --plan-text: #445264; --plan-border: #a6b2c3; --plan-bg: #edf1f6; }
html[data-theme="light"] .plan-basic { --plan-text: #235a93; --plan-border: #8fb6e2; --plan-bg: #eaf3ff; }
html[data-theme="light"] .plan-standard { --plan-text: #17674f; --plan-border: #83c6b4; --plan-bg: #e3f6ed; }
html[data-theme="light"] .plan-pro { --plan-text: #805016; --plan-border: #d8b36b; --plan-bg: #fff3d4; }
html[data-theme="light"] .plan-elite { --plan-text: #673793; --plan-border: #c2a1e6; --plan-bg: #f2e8ff; }
.sidebar-scrim { display: none; }

/* Main */
main { margin-left: var(--sidebar); padding: 28px clamp(16px, 3vw, 40px) 24px; min-width: 0; max-width: calc(1680px + var(--sidebar)); }
main:focus { outline: none; }

/* Hero */
.research-hero { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 270px; align-items: stretch; gap: 28px; padding: clamp(18px, 2.4vw, 34px); border: 1px solid var(--border); border-radius: 26px; background: radial-gradient(ellipse at top left, #27cabb1a, transparent 55%), radial-gradient(ellipse at bottom right, #8f6bff14, transparent 55%), var(--surface); box-shadow: var(--shadow); overflow: hidden; isolation: isolate; }
.research-hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px); background-size: 36px 36px; opacity: .35; mask-image: radial-gradient(ellipse at 20% 0%, #000 0%, transparent 65%); -webkit-mask-image: radial-gradient(ellipse at 20% 0%, #000 0%, transparent 65%); }
.research-tools { min-width: 0; }
.page-heading { margin-bottom: 22px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border-strong); border-radius: 20px; background: var(--surface-2); padding: 5px 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); margin-bottom: 14px; }
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); animation: pulse 2.4s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
h1 { margin: 0; }
.research-heading { font-size: clamp(28px, 3.2vw, 46px); font-weight: 800; line-height: 1.1; letter-spacing: -.04em; }
.research-heading span { background: var(--accent-grad); background-clip: text; -webkit-background-clip: text; color: transparent; -webkit-text-fill-color: transparent; }
@media (forced-colors: active) { .research-heading span { background: none; color: CanvasText; -webkit-text-fill-color: CanvasText; } }
.intro { max-width: 640px; font-size: 14px; line-height: 1.65; margin: 12px 0 0; color: var(--muted); }

/* Search form */
.search-mode { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); margin-bottom: 16px; max-width: 100%; }
.search-mode button { display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 650; }
.search-mode button:hover:not(:disabled) { color: var(--text); background: var(--surface-3); }
.search-mode button[aria-pressed="true"] { background: var(--text); color: var(--bg); box-shadow: var(--shadow-sm); }
#market-analysis { color: #d9c8ff; background: #7c5bbc26; }
#market-analysis:hover:not(:disabled) { background: #7c5bbc40; color: #fff; }
html[data-theme="light"] #market-analysis { color: #603388; background: #f1e8fc; }
.search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.search-input { position: relative; display: flex; align-items: center; gap: 10px; min-width: 0; padding: 0 12px 0 16px; border: 1px solid var(--border-strong); border-radius: 14px; background: var(--bg); transition: border-color .15s, box-shadow .15s; }
html[data-theme="light"] .search-input { background: var(--surface-2); }
.search-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.search-input.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 16%, transparent); }
.search-magnifier { width: 18px; height: 18px; flex: 0 0 18px; color: var(--accent); }
.search-input input { flex: 1; min-width: 0; height: 54px; padding: 0; border: 0; background: transparent; font-size: 14px; outline: none; }
.search-input input::placeholder { color: var(--muted); opacity: .85; }
.search-input input::-webkit-search-cancel-button { cursor: pointer; }
.search-kbd { flex-shrink: 0; }
.search-input:focus-within .search-kbd { display: none; }
#search { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-width: 136px; min-height: 56px; padding: 12px 22px; border: 0; border-radius: 14px; background: var(--accent-grad); color: var(--on-accent); font-size: 14px; font-weight: 800; letter-spacing: .01em; white-space: nowrap; box-shadow: 0 10px 24px -10px color-mix(in srgb, var(--accent) 70%, transparent); }
html[data-theme="light"] #search { color: #fff; }
#search:hover:not(:disabled) { filter: brightness(1.06); box-shadow: 0 14px 30px -10px color-mix(in srgb, var(--accent) 80%, transparent); }
#search:disabled { opacity: .85; }
#search.is-dirty::after { content: ""; position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 2px var(--surface); }
.field-error { margin: 8px 2px 0; color: var(--danger); font-size: 12px; font-weight: 600; }
.search-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.search-filters label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.filter-help { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 14px 0 0; }
.filter-help.is-dirty { color: var(--warn); }

/* Usage card */
.usage-card { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 24px 18px 14px; border: 1px solid var(--border); border-radius: 20px; background: color-mix(in srgb, var(--surface-2) 80%, transparent); min-width: 0; }
.usage-ring { position: relative; width: 128px; height: 128px; margin: 0 auto 16px; }
.usage-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.usage-ring circle { fill: none; stroke-width: 9; }
.ring-track { stroke: var(--surface-3); }
.ring-fill { stroke: url(#ring-gradient); stroke-linecap: round; transition: stroke-dashoffset .8s var(--ease); }
.ring-stop-a { stop-color: #4bdcce; }
.ring-stop-b { stop-color: #a385fc; }
.usage-card.is-low .ring-stop-a, .usage-card.is-low .ring-stop-b { stop-color: #ffb454; }
.usage-card.is-empty .ring-stop-a, .usage-card.is-empty .ring-stop-b { stop-color: #ff6b86; }
.ring-caption { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.ring-caption strong { font-size: 32px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.ring-caption span { font-size: 11px; color: var(--muted); }
.allowance-plan { display: inline-block; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 20px; padding: 5px 11px; }
#allowance-summary, #allowance-reset { margin: 8px 0 0; font-size: 12px; line-height: 1.5; color: var(--muted); }
#allowance-reset { margin-top: 2px; font-size: 11px; }
.upgrade-link { display: inline-flex; align-items: center; justify-content: center; margin-top: 14px; padding: 10px 14px; border-radius: 12px; background: var(--accent-grad); color: var(--on-accent); text-decoration: none; font-size: 13px; font-weight: 750; transition: filter .15s; }
html[data-theme="light"] .upgrade-link { color: #fff; }
.upgrade-link:hover { filter: brightness(1.07); }
.usage-card .upgrade-link { align-self: stretch; margin-top: auto; }
.usage-card #allowance-reset { margin-bottom: 14px; }
.usage-details-button { margin-top: 6px; border: 0; background: transparent; color: var(--muted); padding: 8px; font-size: 12px; }
.usage-details-button:hover:not(:disabled) { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

/* Status */
.status { min-height: 22px; margin: 18px 2px 0; color: var(--muted); font-size: 13px; }
.status.is-error { color: var(--danger); font-weight: 600; }
.login-link { display: inline-flex; margin: 8px 0 12px; padding: 10px 16px; border-radius: 12px; background: var(--text); color: var(--bg); font-weight: 700; text-decoration: none; }

/* Summary + toolbar */
.summary { margin: 18px 0 18px; }
.summary-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.summary h2 { font-size: 22px; letter-spacing: -.02em; margin: 0 0 10px; overflow-wrap: anywhere; }
.totals { display: flex; gap: 8px; flex-wrap: wrap; }
.totals span { border: 1px solid var(--border); border-radius: 20px; padding: 4px 11px; font-size: 12px; font-weight: 650; background: var(--surface); font-variant-numeric: tabular-nums; }
.totals .ai { border-color: color-mix(in srgb, var(--ai) 35%, transparent); color: var(--ai); background: var(--ai-bg); }
.totals .non-ai { border-color: color-mix(in srgb, var(--non-ai) 35%, transparent); color: var(--non-ai); background: var(--non-ai-bg); }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.toolbar-select { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 12px; color: var(--muted); font-weight: 600; }
.toolbar-select select { width: auto; min-width: 150px; padding-top: 9px; padding-bottom: 9px; }
.view-toggle { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.view-toggle button { display: grid; place-items: center; padding: 7px 9px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); }
.view-toggle button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }
.download-menu { position: relative; }
.download-menu summary { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; padding: 9px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); font-size: 13px; font-weight: 650; list-style: none; user-select: none; }
.download-menu summary:hover { border-color: var(--border-strong); }
.download-menu summary::after { content: ""; width: 7px; height: 7px; margin-left: 4px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-2px) rotate(45deg); transition: transform .15s; }
.download-menu[open] summary::after { transform: translateY(1px) rotate(-135deg); }
.download-menu summary::-webkit-details-marker { display: none; }
.download-options { position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: 260px; padding: 6px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow-lg); animation: pop .14s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.download-options p { color: var(--muted); font-size: 11px; margin: 6px 10px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.download-options button { width: 100%; padding: 10px; border: 0; background: transparent; text-align: left; font-size: 13px; }
.download-options button:hover:not(:disabled) { background: var(--surface-3); }

/* Insights */
.insights { margin-top: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.insights > summary { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 14px 18px; cursor: pointer; list-style: none; font-weight: 750; }
.insights > summary::-webkit-details-marker { display: none; }
.insights > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; align-self: center; }
.insights[open] > summary::before { transform: rotate(45deg); }
.insights > summary small { color: var(--muted); font-weight: 500; font-size: 12px; }
.insights-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 16px; padding: 0 18px 18px; }
.insight-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; align-content: start; }
.insight-stats > div { padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); min-width: 0; }
.insight-stats dt { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.insight-stats dd { margin: 6px 0 0; font-size: 22px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.insight-stats dd small { display: block; margin-top: 2px; font-size: 11px; font-weight: 500; letter-spacing: 0; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.insight-stats .wide { grid-column: 1 / -1; }
.insight-stats .wide dd { font-size: 14px; white-space: normal; }
.insight-stats .wide button { padding: 0; border: 0; background: none; font-weight: 700; text-align: left; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; overflow-wrap: anywhere; }
.split-bar { display: flex; height: 8px; margin-top: 10px; border-radius: 8px; overflow: hidden; background: var(--surface-3); }
.split-bar span { display: block; height: 100%; width: var(--w, 0%); transition: width .6s var(--ease); }
.split-bar .is-non-ai { background: var(--non-ai); }
.split-bar .is-ai { background: var(--ai); }
.insight-keywords { min-width: 0; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.insight-keywords-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.insight-keywords h3 { margin: 0; font-size: 13px; }
.chip-button { padding: 5px 11px; border-radius: 20px; font-size: 12px; font-weight: 650; background: var(--surface); }
.keyword-bars { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 14px; margin: 0; padding: 0; list-style: none; }
.keyword-bars li { min-width: 0; }
.keyword-bars button { position: relative; display: flex; justify-content: space-between; gap: 8px; width: 100%; padding: 6px 8px; border: 0; border-radius: 8px; background: transparent; font-size: 12px; text-align: left; overflow: hidden; isolation: isolate; }
.keyword-bars button::before { content: ""; position: absolute; inset: 0 auto 0 0; z-index: -1; width: var(--w, 0%); border-radius: 8px; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 22%, transparent), color-mix(in srgb, var(--accent-2) 16%, transparent)); transition: width .6s var(--ease); }
.keyword-bars button:hover:not(:disabled) { background: var(--surface-3); }
.keyword-bars .kw { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.keyword-bars .count { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 700; }

/* Loading */
.search-loading { padding: 20px 0; }
.loading-heading { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); margin-bottom: 20px; }
.loading-heading strong { font-size: 15px; }
.loading-heading p { font-size: 12px; line-height: 1.5; color: var(--muted); margin: 4px 0 0; }
.loading-spinner, .button-spinner { display: inline-block; border: 3px solid color-mix(in srgb, var(--accent) 22%, transparent); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; flex-shrink: 0; }
.loading-spinner { width: 32px; height: 32px; }
.button-spinner { width: 16px; height: 16px; border-width: 2px; border-color: #0002; border-top-color: currentColor; }
.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
.skeleton-card { height: 440px; border: 1px solid var(--border); border-radius: var(--radius); background: linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--text) 6%, transparent) 50%, transparent 80%), var(--surface); background-size: 200% 100%; animation: shimmer 1.5s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* Empty state */
.empty-state { margin: 28px 0 8px; padding: clamp(24px, 4vw, 48px); border: 1px dashed var(--border-strong); border-radius: 22px; text-align: center; color: var(--muted); }
.empty-art { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 18px; background: var(--surface-2); border: 1px solid var(--border); color: var(--accent); }
.empty-art svg { width: 30px; height: 30px; }
.empty-state h2 { margin: 0 0 8px; color: var(--text); font-size: 20px; }
.empty-state p { max-width: 560px; margin: 0 auto; line-height: 1.65; }
.steps { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 22px 0 0; padding: 0; list-style: none; }
.steps li { display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border: 1px solid var(--border); border-radius: 30px; background: var(--surface); font-size: 13px; color: var(--text-2); }
.steps strong { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-grad); color: var(--on-accent); font-size: 12px; }
html[data-theme="light"] .steps strong { color: #fff; }

/* Results: grid view */
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; align-items: stretch; }
.card { display: flex; flex-direction: column; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); transition: border-color .2s, box-shadow .25s var(--ease), transform .25s var(--ease); content-visibility: auto; contain-intrinsic-size: auto 470px; animation: card-in .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 25ms); }
@keyframes card-in { from { opacity: 0; transform: translateY(8px); } }
.card:hover { border-color: color-mix(in srgb, var(--accent-2) 55%, var(--border)); box-shadow: var(--shadow); transform: translateY(-2px); }
.preview { position: relative; display: block; width: 100%; aspect-ratio: 3 / 2; padding: 0; border: 0; border-radius: 0; background: var(--surface-3); cursor: zoom-in; overflow: hidden; }
.preview:focus-visible { outline-offset: -3px; }
.preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: transform .45s var(--ease), opacity .3s; opacity: 0; }
.preview img.is-loaded { opacity: 1; }
@media (prefers-reduced-motion: no-preference) { .card:hover .preview img { transform: scale(1.035); } }
.placeholder { display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.preview .placeholder { position: absolute; inset: 0; }
.dialog-image .placeholder { min-height: 260px; }
.badges { position: absolute; top: 10px; left: 10px; display: flex; flex-wrap: wrap; gap: 5px; max-width: calc(100% - 20px); }
.badge { padding: 3px 9px; border-radius: 20px; background: #0b0f17d9; color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .02em; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.badge.ai { background: #6c5ce7e6; }
.badge.non-ai { background: #0c9c76e6; }
.preview-bar { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; justify-content: space-between; gap: 8px; }
.preview-bar .badge.hint { opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .2s; }
.card:hover .preview-bar .badge.hint, .preview:focus-visible .preview-bar .badge.hint { opacity: 1; transform: none; }
@media (hover: none) { .preview-bar .badge.hint { opacity: 1; transform: none; } }
.rank { position: absolute; top: 10px; right: 10px; display: grid; place-items: center; min-width: 28px; height: 28px; padding: 0 7px; border-radius: 9px; background: #0b0f17d9; color: #fff; font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.card-details { display: flex; flex-direction: column; gap: 10px; flex: 1; padding: 16px 16px 14px; min-width: 0; }
.card h2 { margin: 0; min-width: 0; font-size: inherit; }
.card-title { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; width: 100%; min-height: 42px; padding: 0; border: 0; border-radius: 0; background: none; font-size: 14px; font-weight: 700; line-height: 1.5; text-align: left; overflow-wrap: anywhere; }
.card-title:hover:not(:disabled) { color: var(--accent); }
.card-meta { display: grid; gap: 6px; }
.creator, .category { display: flex; align-items: center; gap: 8px; min-width: 0; margin: 0; font-size: 12.5px; line-height: 20px; color: var(--muted); white-space: nowrap; }
.creator > span, .category > span { overflow: hidden; text-overflow: ellipsis; }
.creator-search { min-width: 0; padding: 0; border: 0; border-radius: 3px; background: transparent; font: inherit; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.creator-search:hover:not(:disabled) { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.keywords { display: flex; flex-wrap: wrap; gap: 5px; margin: 0; }
.keyword { padding: 3px 9px; border: 1px solid transparent; border-radius: 20px; background: var(--surface-3); color: var(--text-2); font-size: 11px; line-height: 16px; overflow-wrap: anywhere; max-width: 100%; }
button.keyword { cursor: pointer; }
button.keyword:hover:not(:disabled) { border-color: var(--accent); color: var(--text); }
.card .keywords { height: 50px; overflow: hidden; align-content: flex-start; }
.more-keywords { border-color: var(--border-strong); background: transparent; color: var(--text); font-weight: 650; }
.asset-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.stat { min-width: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.stat dt { margin: 0 0 4px; color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.stat dd { display: flex; align-items: center; gap: 7px; margin: 0; font-size: 14px; font-weight: 750; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.card .stat .icon { width: 15px; height: 15px; }
.card .stat:first-child .icon { color: var(--accent-2); }
.card .stat:nth-child(2) .icon { color: var(--accent); }
.card .asset-stats { margin-top: auto; }
.card-actions { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); background: var(--surface-2); min-width: 0; }
.open-link { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 8px; color: var(--text-2); font-size: 12px; font-weight: 650; text-decoration: none; white-space: nowrap; }
.open-link:hover { background: var(--surface-3); color: var(--text); }
.open-link .icon { width: 13px; height: 13px; }
.copy-actions { display: flex; gap: 6px; margin-left: auto; min-width: 0; }
.copy-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; height: 32px; padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text-2); font-size: 12px; font-weight: 650; white-space: nowrap; }
.copy-button .icon { width: 14px; height: 14px; }
.copy-button:hover:not(:disabled) { border-color: var(--accent-2); color: var(--text); }
.copy-button.is-copied { background: var(--non-ai-bg); border-color: var(--non-ai); color: var(--non-ai); opacity: 1; }
.copy-button.copy-failed { border-color: var(--danger); color: var(--danger); opacity: 1; }

/* Results: list view */
.results.is-list { grid-template-columns: minmax(0, 1fr); gap: 12px; }
.results.is-list .card { display: grid; grid-template-columns: 220px minmax(0, 1fr) auto; contain-intrinsic-size: auto 170px; }
.results.is-list .card:hover { transform: none; }
.results.is-list .preview { height: 100%; aspect-ratio: auto; min-height: 150px; }
.results.is-list .card-details { display: grid; grid-template-columns: minmax(0, 1fr) 260px; grid-template-rows: auto auto 1fr; column-gap: 20px; row-gap: 8px; }
.results.is-list .card-details > h2, .results.is-list .card-meta, .results.is-list .card-details > .keywords { grid-column: 1; }
.results.is-list .card-title { min-height: 0; }
.results.is-list .card .keywords { height: auto; max-height: 52px; }
.results.is-list .card .asset-stats { grid-column: 2; grid-row: 1 / 4; align-self: center; margin: 0; }
.results.is-list .card-actions { flex-direction: column; align-items: stretch; justify-content: center; border-top: 0; border-left: 1px solid var(--border); }
.results.is-list .copy-actions { flex-direction: column; margin-left: 0; }
@media (max-width: 1200px) { .results.is-list .card-details { grid-template-columns: minmax(0, 1fr); } .results.is-list .card .asset-stats { grid-column: 1; grid-row: auto; } }
@media (max-width: 760px) { .results.is-list .card { grid-template-columns: 120px minmax(0, 1fr); } .results.is-list .card-actions { grid-column: 1 / -1; flex-direction: row; border-left: 0; border-top: 1px solid var(--border); } .results.is-list .copy-actions { flex-direction: row; margin-left: auto; } .results.is-list .card .keywords { display: none; } }

/* Pagination */
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 32px 0 8px; }
.pager-button { min-width: 130px; padding: 11px 18px; border-radius: 12px; background: var(--surface); font-weight: 700; font-size: 13px; }
.pager-button:hover:not(:disabled) { border-color: var(--accent); }
.page-indicator { min-width: 84px; padding: 9px 14px; border-radius: 20px; background: var(--surface-2); border: 1px solid var(--border); text-align: center; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Footer */
/* Public overview (also what search engines read) */
.seo-info { margin: 48px 0 0; padding: 28px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text-2); font-size: 14px; line-height: 1.65; }
.seo-info h2 { margin: 0 0 8px; color: var(--text); font-size: 20px; letter-spacing: -.01em; }
.seo-info h3 { margin: 26px 0 10px; color: var(--text); font-size: 15px; }
.seo-lead { max-width: 760px; margin: 0; }
.seo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 20px; }
.seo-grid article { padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.seo-grid h3 { margin: 0 0 6px; }
.seo-grid h3 a { color: var(--text); text-decoration: none; }
.seo-grid h3 a:hover { color: var(--accent); }
.seo-grid p { margin: 0; font-size: 13px; }
.seo-markets { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.seo-markets li { padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); font-size: 12.5px; }
.seo-faq details { border-top: 1px solid var(--border); }
.seo-faq details:last-child { border-bottom: 1px solid var(--border); }
.seo-faq summary { padding: 12px 0; color: var(--text); font-weight: 600; cursor: pointer; }
.seo-faq p { margin: 0 0 14px; }
@media (max-width: 600px) { .seo-info { padding: 20px 16px; } }
.powered-by { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 30px 0 4px; padding: 20px 0; color: var(--muted); font-size: 12px; }
.powered-by a { font-weight: 750; text-decoration: none; letter-spacing: .02em; color: var(--text-2); }
.powered-by a:hover { text-decoration: underline; }
.powered-by a span { color: var(--accent-2); }
.powered-line { width: 48px; height: 1px; background: linear-gradient(90deg, transparent, var(--border-strong)); }
.powered-line:last-child { transform: rotate(180deg); }

/* Toasts + back to top */
.toasts { position: fixed; right: 20px; bottom: 84px; z-index: 200; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; max-width: min(380px, calc(100vw - 40px)); padding: 11px 16px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 600; animation: toast-in .25s var(--ease); }
.toast::before { content: ""; flex: 0 0 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.toast.is-error::before { background: var(--danger); }
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
.to-top { position: fixed; left: calc(var(--sidebar) + 20px); bottom: 20px; z-index: 50; display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow); }

/* Dialogs */
dialog { color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 20px; padding: 0; box-shadow: var(--shadow-lg); max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; }
dialog[open] { animation: dialog-in .2s var(--ease); }
dialog::backdrop { background: #04060acc; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
#usage-dialog { width: min(460px, calc(100% - 32px)); }
#asset-dialog { width: min(1180px, calc(100% - 32px)); }
.dialog-header { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.dialog-header h2 { margin: 0; font-size: 16px; }
.dialog-nav { display: flex; align-items: center; gap: 6px; }
.asset-position { margin-right: 6px; color: var(--muted); font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; }
.dialog-step, .dialog-close { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border-radius: 10px; font-size: 15px; }
.dialog-close:hover:not(:disabled) { border-color: var(--danger); color: var(--danger); }
.usage-content { padding: 20px; }
.usage-status { margin: 0 0 14px; color: var(--warn); font-size: 13px; font-weight: 600; }
.usage-status:empty { display: none; }
.usage-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; }
.usage-stats > div { padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.usage-stats dt { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.usage-stats dd { margin: 6px 0 0; font-size: 20px; font-weight: 800; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.usage-meter { height: 8px; margin-top: 14px; border-radius: 8px; background: var(--surface-3); overflow: hidden; }
.usage-meter span { display: block; height: 100%; width: var(--w, 0%); background: var(--accent-grad); border-radius: inherit; transition: width .6s var(--ease); }
#usage-reset, .usage-help { color: var(--muted); font-size: 12px; line-height: 1.6; }
.dialog-content { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 24px; padding: 20px; }
.dialog-image { position: sticky; top: 84px; align-self: start; display: grid; place-items: center; min-width: 0; min-height: 260px; border-radius: 14px; background: var(--surface-3); overflow: hidden; }
.dialog-image img { display: block; width: 100%; max-height: 70vh; object-fit: contain; }
.dialog-information { min-width: 0; }
.dialog-information h3 { margin: 0 0 12px; font-size: 19px; line-height: 1.45; letter-spacing: -.01em; overflow-wrap: anywhere; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.dialog-actions .copy-button, .dialog-actions .open-link { height: 34px; }
.dialog-actions .open-link { border: 1px solid var(--border-strong); }
.dialog-information .asset-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dialog-information .stat dd { font-size: 13px; font-weight: 650; }
.dialog-information .stat.is-highlight { background: color-mix(in srgb, var(--accent-2) 10%, var(--surface-2)); border-color: color-mix(in srgb, var(--accent-2) 30%, var(--border)); }
.dialog-information .stat.is-highlight dd { font-size: 17px; font-weight: 800; }
.keywords-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 20px 0 10px; }
.keywords-head h4 { margin: 0; font-size: 13px; }
.keywords-head small { color: var(--muted); font-size: 11px; }
.preview-note { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 0; padding: 0 20px 20px; }
body.preview-open { overflow: hidden; }

/* Responsive */
@media (max-width: 1500px) and (min-width: 1251px) { .research-hero { grid-template-columns: minmax(0, 1fr) 240px; } }
@media (max-width: 1250px) {
    .research-hero { grid-template-columns: minmax(0, 1fr); }
    .usage-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto auto auto; column-gap: 20px; align-items: center; text-align: left; padding: 16px 20px; }
    .usage-ring { grid-row: 1 / 4; width: 96px; height: 96px; margin: 0; }
    .ring-caption strong { font-size: 24px; }
    .usage-card .allowance-plan { justify-self: start; }
    #allowance-summary { margin: 4px 0 0; }
    .usage-card #allowance-reset { margin: 0; }
    .usage-card .upgrade-link { grid-column: 3; grid-row: 1 / 3; margin: 0; align-self: end; }
    .usage-details-button { grid-column: 3; grid-row: 3; margin: 0; }
}
@media (max-width: 1100px) { .insights-body { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) {
    .sidebar { position: sticky; top: 0; width: 100%; height: auto; max-height: 100dvh; border-right: 0; border-bottom: 1px solid var(--border); }
    .sidebar-brand { min-height: 62px; padding: 10px 16px; justify-content: space-between; }
    .stockspy-logo { width: 140px; }
    .brand small { display: none; }
    #menu-toggle { display: inline-flex; }
    .sidebar-content { display: none; }
    .sidebar.is-open .sidebar-content { display: flex; max-height: calc(100dvh - 62px); }
    .sidebar.is-open + .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 30; background: #04060a99; }
    main { margin-left: 0; }
    .to-top { left: 16px; }
}
@media (max-width: 700px) {
    .search-filters { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .usage-card { grid-template-columns: auto minmax(0, 1fr); }
    .usage-card .upgrade-link { grid-column: 1 / -1; grid-row: auto; margin-top: 14px; }
    .usage-details-button { grid-column: 1 / -1; grid-row: auto; }
    .keyword-bars { grid-template-columns: minmax(0, 1fr); }
    .summary-head { align-items: stretch; flex-direction: column; }
    .toolbar { justify-content: space-between; }
    .toolbar-select span { display: none; }
}
@media (max-width: 600px) {
    main { padding: 16px 16px 24px; }
    .research-hero { border-radius: 20px; gap: 20px; }
    .search-mode { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
    .search-mode button { justify-content: center; padding: 9px 10px; }
    #market-analysis { grid-column: 1 / -1; }
    .search-row { grid-template-columns: minmax(0, 1fr); }
    #search { width: 100%; }
    .search-kbd { display: none; }
    .results { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .skeleton-grid { grid-template-columns: minmax(0, 1fr); }
    .skeleton-card:nth-child(n+2) { display: none; }
    .summary h2 { font-size: 19px; }
    .insight-stats dd { font-size: 18px; }
    .card-actions { flex-wrap: wrap; }
    .copy-actions { flex: 1 1 100%; margin-left: 0; }
    .copy-button { flex: 1; }
    .pager { gap: 8px; }
    .pager-button { min-width: 0; flex: 1; }
    .dialog-content { padding: 14px; gap: 16px; }
    .dialog-image { position: static; }
    .dialog-image img { max-height: 45vh; }
    .asset-position { display: none; }
    .toasts { left: 16px; right: 16px; bottom: 16px; align-items: stretch; }
}
@media (max-width: 800px) { .dialog-content { grid-template-columns: minmax(0, 1fr); } .dialog-image { position: static; } }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media print {
    .sidebar, .research-hero, .pager, .toolbar, .card-actions, .toasts, .to-top, .powered-by { display: none !important; }
    main { margin: 0; }
    .card { break-inside: avoid; box-shadow: none; }
}

/* ---------- v4: panels, tools, basket ---------- */
.nav-pill { margin-left: auto; padding: 1px 7px; border-radius: 20px; background: color-mix(in srgb, var(--accent-2) 18%, transparent); color: var(--accent-2); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.nav-count { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 20px; background: var(--surface-3); color: var(--text-2); font-size: 11px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.nav-count.has-items { background: var(--accent-grad); color: var(--on-accent); }
.sidebar-nav .nav-label:not(:first-child) { margin-top: 14px; }
.panel:focus { outline: none; }

/* Shared tool layout */
.tool-hero { position: relative; padding: clamp(18px, 2.4vw, 34px); border: 1px solid var(--border); border-radius: 26px; background: radial-gradient(ellipse at top left, #27cabb1a, transparent 55%), radial-gradient(ellipse at bottom right, #8f6bff14, transparent 55%), var(--surface); box-shadow: var(--shadow); }
.tool-form { display: grid; gap: 10px; max-width: 900px; }
.field-label { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 6px 0 0; font-size: 12px; font-weight: 700; color: var(--text-2); }
.field-label small { color: var(--muted); font-weight: 500; }
textarea, .text-input { width: 100%; min-width: 0; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--bg); color: var(--text); font: inherit; font-size: 14px; line-height: 1.5; transition: border-color .15s, box-shadow .15s; }
html[data-theme="light"] :is(textarea, .text-input) { background: var(--surface-2); }
textarea { resize: vertical; min-height: 56px; }
:is(textarea, .text-input):focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.niche-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 6px; padding-top: 14px; }
.tool-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.tool-note { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 46px; padding: 10px 22px; border: 0; border-radius: 12px; background: var(--accent-grad); color: var(--on-accent); font-weight: 800; box-shadow: 0 10px 24px -12px color-mix(in srgb, var(--accent) 70%, transparent); }
html[data-theme="light"] .primary-button { color: #fff; }
.primary-button:hover:not(:disabled) { filter: brightness(1.06); }
.chip-button.danger:hover:not(:disabled) { border-color: var(--danger); color: var(--danger); }
.count-pill { display: inline-block; margin-left: 6px; padding: 1px 9px; border-radius: 20px; background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 750; vertical-align: middle; font-variant-numeric: tabular-nums; }
.count-pill.is-full { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }

/* Velocity */
.badge.hot { background: #e5533de6; }
.card .stat.stat-velocity .icon { color: #ff8a5c; }
.velocity-note { color: var(--muted); font-weight: 600; font-size: 11px; }

/* Keyword chips that toggle the basket */
button.keyword[data-kw] { cursor: pointer; }
.keyword.in-basket { border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: color-mix(in srgb, var(--accent) 16%, var(--surface-3)); color: var(--text); }
.keyword.in-basket::before { content: "\2713\00a0"; color: var(--accent); font-weight: 800; }
.keyword-bars button.in-basket { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 60%, transparent); }

/* Niche finder */
.niche-results { margin-top: 18px; }
.niche-results h2, .ai-history h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -.02em; }
.table-wrap { margin-top: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow-x: auto; }
.niche-table { width: 100%; min-width: 900px; border-collapse: collapse; font-size: 13px; }
.niche-table th { padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 750; text-align: left; text-transform: uppercase; letter-spacing: .05em; vertical-align: bottom; }
.niche-table th small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.niche-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; font-variant-numeric: tabular-nums; }
.niche-table tr:last-child td { border-bottom: 0; }
.niche-table tbody tr:hover { background: var(--surface-2); }
.niche-keyword { font-weight: 750; overflow-wrap: anywhere; }
.niche-rank { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 8px; border-radius: 7px; background: var(--surface-3); font-size: 11px; font-weight: 800; }
.score { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.score strong { min-width: 28px; font-size: 16px; }
.score-bar { flex: 1; height: 8px; border-radius: 8px; background: var(--surface-3); overflow: hidden; }
.score-bar span { display: block; height: 100%; width: var(--w, 0%); border-radius: inherit; background: var(--score-color, var(--accent)); transition: width .6s var(--ease); }
.score-label { padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; background: color-mix(in srgb, var(--score-color) 16%, transparent); color: var(--score-color); }
.score.is-high { --score-color: #2fcf97; }
.score.is-medium { --score-color: #f2b64a; }
.score.is-low { --score-color: #ef6a7f; }
.niche-tags { display: flex; flex-wrap: wrap; gap: 4px; max-width: 260px; }
.niche-error { color: var(--danger); font-weight: 600; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* AI metadata */
.locked-card { max-width: 560px; padding: 20px; border: 1px dashed var(--border-strong); border-radius: 16px; background: var(--surface-2); }
.locked-card p { margin: 6px 0 0; color: var(--muted); }
.dropzone { position: relative; display: grid; place-items: center; min-height: 200px; padding: 18px; border: 2px dashed var(--border-strong); border-radius: 18px; background: var(--surface-2); color: var(--muted); text-align: center; cursor: pointer; overflow: hidden; transition: border-color .15s, background-color .15s; }
.dropzone:hover, .dropzone.is-dragging { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface-2)); }
.dropzone:focus-within { outline: 2px solid var(--focus); outline-offset: 3px; }
.dropzone img { max-width: 100%; max-height: 320px; border-radius: 10px; object-fit: contain; }
.dropzone.has-image .dropzone-text { margin-top: 10px; font-size: 12px; }
.dropzone-text strong { color: var(--text); }
.ai-result { margin-top: 18px; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.ai-result-grid { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 16px; }
.ai-field { display: grid; gap: 8px; align-content: start; }
.ai-field .field-label { margin: 0; }
.ai-result .keywords-head h3 { margin: 0; font-size: 14px; }
.editable-keywords { gap: 6px; }
.editable-keywords .keyword { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; font-size: 12px; }
.editable-keywords .keyword.is-top { border-color: color-mix(in srgb, var(--accent-2) 45%, transparent); }
.chip-remove { display: grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 11px; line-height: 1; }
.chip-remove:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.add-keyword { max-width: 420px; margin-top: 12px; }
.tool-actions.wrap { margin-top: 16px; }
.ai-history { margin-top: 26px; }
.history-list { display: grid; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.history-list li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.history-list .history-main { flex: 1; min-width: 0; }
.history-list strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-list small { color: var(--muted); }

/* Keyword basket */
.basket-fab { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: inline-flex; align-items: center; gap: 8px; padding: 11px 16px; border: 1px solid var(--border-strong); border-radius: 30px; background: var(--surface); box-shadow: var(--shadow-lg); font-weight: 700; font-size: 13px; }
.basket-fab strong { padding: 1px 8px; border-radius: 20px; background: var(--surface-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.basket-fab.has-items strong { background: var(--accent-grad); color: var(--on-accent); }
.basket-fab.bump { animation: bump .35s var(--ease); }
@keyframes bump { 40% { transform: scale(1.08); } }
dialog.drawer { margin: 0 0 0 auto; width: min(440px, 100%); height: 100dvh; max-height: 100dvh; border-radius: 20px 0 0 20px; border-right: 0; display: none; flex-direction: column; overflow: hidden; }
dialog.drawer[open] { display: flex; animation: drawer-in .25s var(--ease); }
@keyframes drawer-in { from { transform: translateX(30px); opacity: 0; } }
.drawer-body { flex: 1; padding: 16px 18px; overflow-y: auto; overscroll-behavior: contain; }
.drawer-footer { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--border); background: var(--surface-2); }
.drawer-footer .primary-button { min-height: 38px; padding: 8px 18px; }
.basket-add { display: flex; gap: 8px; margin: 12px 0 14px; }
.basket-list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; counter-reset: basket; }
.basket-list li { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); counter-increment: basket; cursor: grab; }
.basket-list li::before { content: counter(basket); min-width: 22px; color: var(--muted); font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; }
.basket-list li:nth-child(-n+10) { border-color: color-mix(in srgb, var(--accent-2) 35%, var(--border)); }
.basket-list li:nth-child(-n+10)::before { color: var(--accent-2); }
.basket-list li:nth-child(11) { margin-top: 10px; }
.basket-list li.is-dragging { opacity: .4; }
.basket-list li.drop-target { box-shadow: 0 -2px 0 var(--accent); }
.basket-list .kw { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 13px; font-weight: 600; }
.basket-list button { display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border-radius: 7px; border-color: transparent; background: transparent; color: var(--muted); font-size: 12px; }
.basket-list button:hover:not(:disabled) { background: var(--surface-3); color: var(--text); border-color: var(--border); }
.basket-empty { margin: 20px 0; text-align: center; font-size: 13px; }

@media (max-width: 900px) { .ai-result-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) {
    .niche-filters { grid-template-columns: minmax(0, 1fr); }
    .basket-fab { right: 16px; bottom: 16px; }
    .basket-fab span { display: none; }
    .toasts { bottom: 76px; }
    dialog.drawer { border-radius: 0; }
    .tool-actions .primary-button { width: 100%; }
}
@media print { .basket-fab { display: none !important; } }

/* ---------- v5: original card stats, prompt overlay, AI studio ---------- */
/* Card stats: the original Downloads / Upload date design. */
.card .asset-stats { gap: 0; border-radius: 12px; overflow: hidden; }
.card .asset-stats .stat { position: relative; display: flex; flex-direction: column-reverse; justify-content: center; gap: 3px; min-height: 60px; padding: 10px 8px 10px 52px; border: 0; border-radius: 0; background: #2a2340; }
.card .asset-stats .stat:nth-child(2) { background: #163a32; }
.card .asset-stats .stat .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; padding: 7px; border: 1px solid #9f7aea55; border-radius: 50%; background: #9f7aea22; color: #ba9bef; }
.card .asset-stats .stat:nth-child(2) .icon { border-color: #10b98155; background: #10b98122; color: #24c894; }
.card .asset-stats .stat dt { margin: 0; font-size: 9px; line-height: 11px; letter-spacing: .06em; color: #b196e1; }
.card .asset-stats .stat:nth-child(2) dt { color: #35c9a3; }
.card .asset-stats .stat dd { font-size: 15px; line-height: 19px; font-weight: 800; }
html[data-theme="light"] .card .asset-stats .stat { background: #eee7f8; }
html[data-theme="light"] .card .asset-stats .stat:nth-child(2) { background: #e3f4ed; }
html[data-theme="light"] .card .asset-stats .stat dt { color: #6b4fb3; }
html[data-theme="light"] .card .asset-stats .stat:nth-child(2) dt { color: #0d8a68; }

/* Preview overlays: Prompt (left) and upload age (right). */
.preview-wrap { position: relative; }
.prompt-button, .age-badge { position: absolute; bottom: 10px; z-index: 1; display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border: 1px solid #ffffff26; border-radius: 9px; background: #0b0f17cc; color: #fff; font-size: 12px; font-weight: 700; line-height: 16px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.prompt-button { left: 10px; }
.prompt-button:hover:not(:disabled) { border-color: var(--accent); background: #0b0f17f0; color: #fff; }
.age-badge { right: 10px; font-weight: 600; pointer-events: none; }
.prompt-button .icon, .age-badge .icon { width: 14px; height: 14px; }
.results.is-list .preview-wrap { min-height: 150px; }
.results.is-list .preview-wrap .preview { height: 100%; }

/* Prompt dialog */
#prompt-dialog { width: min(1000px, calc(100% - 32px)); }
.prompt-body { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 20px; padding: 20px; }
.prompt-image { align-self: start; display: grid; place-items: center; min-height: 200px; border-radius: 14px; background: var(--surface-3); overflow: hidden; }
.prompt-image img { display: block; width: 100%; max-height: 62vh; object-fit: contain; }
.prompt-content { min-width: 0; }
.prompt-content h3 { margin: 0 0 14px; font-size: 16px; line-height: 1.45; overflow-wrap: anywhere; }
.prompt-loading { display: flex; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.prompt-loading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.prompt-field { margin-bottom: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.prompt-field-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.prompt-text { margin: 0; font-size: 13.5px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; }
.prompt-text.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; }
.muted-text { color: var(--text-2); }
#prompt-tags { margin: 4px 0 12px; }

/* AI studio */
.ai-form { max-width: none; }
.dropzone { min-height: 150px; gap: 6px; }
.dropzone-icon { display: grid; place-items: center; width: 44px; height: 44px; margin: 0 auto; border-radius: 14px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font-size: 20px; }
.ai-settings { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 6px; }
.ai-settings label { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.ai-settings output { color: var(--text); font-weight: 800; }
input[type="range"] { width: 100%; height: 42px; margin: 0; accent-color: var(--accent); }
.primary-button.compact { min-height: 38px; padding: 8px 16px; font-size: 13px; }
.allowance-ai, .usage-ai { margin: 6px 0 0; color: var(--accent); font-size: 11px; font-weight: 700; }
.usage-ai { font-size: 12px; }
.ai-batch { margin-top: 18px; }
.ai-batch h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -.02em; }
.ai-items { display: grid; gap: 10px; margin: 14px 0 0; padding: 0; list-style: none; }
.ai-item { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.ai-item[data-status="working"] { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.ai-item[data-status="error"] { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.ai-thumb { display: grid; place-items: center; width: 84px; height: 64px; border-radius: 10px; background: var(--surface-3); overflow: hidden; }
.ai-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ai-thumb .placeholder { font-size: 10px; text-align: center; }
.ai-item-main { min-width: 0; }
.ai-item-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ai-item-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.status-pill { flex-shrink: 0; padding: 1px 8px; border-radius: 20px; background: var(--surface-3); color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.status-pill.is-done { background: var(--non-ai-bg); color: var(--non-ai); }
.status-pill.is-working { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.status-pill.is-error { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.ai-item-title { margin: 4px 0 2px; overflow: hidden; color: var(--text-2); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.ai-item[data-status="error"] .ai-item-title { color: var(--danger); white-space: normal; }
.ai-item-meta { color: var(--muted); font-size: 11px; }
.ai-item-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.ai-editor { grid-column: 1 / -1; display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.ai-editor .field-label { margin: 4px 0 0; }
.ai-categories { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 12px; }
.ai-categories > div { display: grid; gap: 6px; align-content: start; }
.ai-categories > div:last-child { grid-template-columns: 1fr 1fr; }
.ai-categories > div:last-child .field-label { grid-column: 1 / -1; }
.ai-editor .keywords-head { margin: 8px 0 2px; }
.ai-editor .keywords-head h4 { margin: 0; font-size: 13px; }

@media (max-width: 1100px) { .ai-settings { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 800px) { .prompt-body { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) {
    .ai-settings, .ai-categories { grid-template-columns: minmax(0, 1fr); }
    .ai-item { grid-template-columns: 64px minmax(0, 1fr); }
    .ai-thumb { width: 64px; height: 52px; }
    .ai-item-actions { grid-column: 1 / -1; justify-content: flex-start; }
    .prompt-body { padding: 14px; }
}

/* ---------- v6: AI studio (metadata & prompt generator) ---------- */
.studio { display: grid; grid-template-columns: 370px minmax(0, 1fr); align-items: start; gap: 20px; }
.studio-controls { position: sticky; top: 16px; display: grid; gap: 14px; max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.studio-card { padding: 16px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); }
.studio-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.studio-card-head strong { display: block; font-size: 14px; }
.studio-card-head small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.studio-icon { display: grid; place-items: center; flex: 0 0 36px; height: 36px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--text-2); }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.segmented button { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 700; }
.segmented button[aria-pressed="true"] { background: var(--text); color: var(--bg); box-shadow: var(--shadow-sm); }
.option-row { display: flex; align-items: center; gap: 10px; padding: 9px 2px; }
.option-row > .icon { color: var(--muted); }
.option-row label { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; cursor: pointer; }
.option-row label strong { display: block; font-size: 14px; }
.option-row label small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 500; }
.batch-row { padding: 0; }
.batch-row > .icon { width: 36px; height: 36px; padding: 8px; border: 1px solid color-mix(in srgb, var(--non-ai) 40%, var(--border)); border-radius: 10px; background: var(--non-ai-bg); color: var(--non-ai); }
.switch { position: relative; flex: 0 0 44px; height: 24px; }
.switch input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border: 1px solid var(--border-strong); border-radius: 20px; background: var(--surface-3); transition: background-color .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform .2s var(--ease), background-color .2s; }
.switch input:checked + span { border-color: transparent; background: var(--accent-grad); }
.switch input:checked + span::after { transform: translateX(20px); background: #fff; }
.switch input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.option-input { margin: 0 0 8px; padding: 9px 12px; font-size: 13px; }
.setting-label { display: flex; justify-content: space-between; margin: 16px 0 8px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.setting-label small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.studio-card > .setting-label:first-child { margin-top: 0; }
.platforms { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
.platforms button { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 9px 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); color: var(--text-2); font-size: 12.5px; font-weight: 600; text-align: left; }
.platforms button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.platforms button:hover:not(:disabled) { border-color: var(--border-strong); background: var(--surface-3); color: var(--text); }
.platforms button[aria-checked="true"] { border-color: var(--accent); background: var(--surface-3); color: var(--text); box-shadow: 0 0 0 1px var(--accent) inset; }
.platform-icon { width: 18px; height: 18px; border-radius: 4px; object-fit: contain; }
.setting-slider { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.setting-slider label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.setting-slider output { font-size: 12px; font-weight: 800; }
.setting-slider input { grid-column: 1 / -1; height: 28px; }
.setting-fixed { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.setting-fixed small { margin-left: auto; letter-spacing: 0; text-transform: none; font-weight: 600; }
.setting-select { margin-top: 12px; }
.setting-select label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.setting-hint { margin: 12px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.studio-main { display: grid; gap: 14px; min-width: 0; }
.upload-card .dropzone { min-height: 210px; align-content: center; gap: 10px; }
.file-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.file-chips span { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 8px; background: var(--text); color: var(--bg); font-size: 11px; font-weight: 800; }
.file-chips .icon { width: 12px; height: 12px; }
.dropzone-text strong { display: block; color: var(--text); font-size: 15px; }
.dropzone-text small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.dropzone-icon .icon { width: 22px; height: 22px; }
.studio-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px; }
.studio-progress { flex: 1 1 240px; min-width: 0; }
.progress-track { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.progress-track span { display: block; width: var(--w, 0%); height: 100%; border-radius: inherit; background: var(--accent-grad); transition: width .4s var(--ease); }
.studio-progress p { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.studio-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.studio-buttons button { display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 700; }
.danger-button { border-color: transparent; background: #c2283a; color: #fff; }
.danger-button:hover:not(:disabled) { border-color: transparent; filter: brightness(1.1); }
.chip-button { display: inline-flex; align-items: center; gap: 6px; }
.chip-button .icon { width: 14px; height: 14px; }
.studio-results { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.result-card { display: grid; grid-template-columns: minmax(220px, 340px) minmax(0, 1fr); gap: 20px; padding: 16px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); animation: card-in .35s var(--ease) both; }
.result-card[data-state="working"] { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.result-card[data-state="error"] { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.result-media { display: grid; align-content: start; gap: 3px; min-width: 0; }
.result-thumb { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; border: 1px solid var(--border); border-radius: 14px; overflow: hidden;
    background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface-3) 0 50%) 50% / 18px 18px; }
.result-thumb img, .result-thumb video { width: 100%; height: 100%; object-fit: contain; }
.result-thumb .placeholder { padding: 12px; font-size: 12px; text-align: center; }
.result-remove { position: absolute; top: 10px; right: 10px; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: #c2283ae6; color: #fff; }
.result-remove:hover:not(:disabled) { border: 0; filter: brightness(1.1); }
.result-kind { position: absolute; top: 10px; left: 10px; padding: 3px 9px; border-radius: 8px; background: #0b0f17d9; color: #fff; font-size: 10px; font-weight: 800; }
.result-name { margin-top: 8px; font-size: 12px; overflow-wrap: anywhere; }
.result-media small { color: var(--muted); font-size: 11px; }
.result-body { display: grid; align-content: start; gap: 12px; min-width: 0; }
.result-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.result-count { color: var(--muted); font-size: 11px; font-weight: 600; }
.result-field textarea { font-size: 14px; }
.keyword-editor { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--bg); }
html[data-theme="light"] .keyword-editor { background: var(--surface-2); }
.keyword-editor:focus-within { border-color: var(--accent); }
.kw-chip { display: inline-flex; align-items: center; gap: 3px; padding: 4px 4px 4px 10px; border: 1px solid transparent; border-radius: 8px; background: var(--surface-3); font-size: 12px; font-weight: 700; }
.kw-chip.is-top { border-color: color-mix(in srgb, var(--accent-2) 45%, transparent); }
.kw-chip button { display: grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 14px; line-height: 1; }
.kw-chip button:hover:not(:disabled) { border: 0; background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.keyword-input { flex: 1 1 120px; min-width: 100px; padding: 4px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 12px; outline: none; }
.result-categories { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.result-categories select { padding-top: 9px; padding-bottom: 9px; font-size: 12px; }
.result-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.result-footer .chip-button { padding: 8px 12px; border-radius: 10px; font-size: 13px; }
.result-footer .regenerate { margin-left: auto; background: var(--text); color: var(--bg); border-color: var(--text); }
.result-negative { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.result-negative:empty { display: none; }
.result-state { display: grid; justify-items: start; gap: 8px; padding: 22px; border: 1px dashed var(--border-strong); border-radius: 14px; color: var(--muted); font-size: 13px; }
.result-state strong { color: var(--text); font-size: 15px; }
.result-state .is-error { color: var(--danger); }
.result-state p { margin: 0; line-height: 1.55; }
.studio-empty { display: grid; justify-items: center; gap: 6px; padding: 60px 20px; color: var(--muted); text-align: center; }
.studio-empty .empty-icon { width: 46px; height: 46px; margin-bottom: 8px; color: var(--muted); }
.studio-empty strong { color: var(--text-2); font-size: 18px; font-weight: 600; }
@media (max-width: 1250px) { .studio { grid-template-columns: minmax(0, 1fr); } .studio-controls { position: static; max-height: none; overflow: visible; } }
@media (max-width: 800px) { .result-card { grid-template-columns: minmax(0, 1fr); } .result-categories { grid-template-columns: minmax(0, 1fr); } .result-footer .regenerate { margin-left: 0; } }
@media (max-width: 600px) { .studio-buttons button { flex: 1 1 auto; justify-content: center; } }

