/* DataQuince Cosine Similarity — inherits the theme font; blue accent to match the site. */
.dqcs {
	--dqcs-accent: #0066cc;
	--dqcs-a: #0066cc;
	--dqcs-b: #d9480f;
	--dqcs-ink: #14213d;
	--dqcs-muted: #5b6475;
	--dqcs-line: #dfe4ec;
	--dqcs-soft: #f5f8fc;
	--dqcs-card: #ffffff;
	--dqcs-good: #1b7f4b;
	--dqcs-bad: #b42318;
	--dqcs-radius: 12px;
	color: var(--dqcs-ink);
	margin: 2rem 0;
	line-height: 1.55;
	font-size: 16px;
}
.dqcs *, .dqcs *::before, .dqcs *::after { box-sizing: border-box; }
.dqcs-fallback { border: 1px solid var(--dqcs-line); border-radius: var(--dqcs-radius); padding: 1rem 1.25rem; background: var(--dqcs-soft); }
.dqcs-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.dqcs-head { margin-bottom: 1rem; }
.dqcs-eyebrow { margin: 0; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--dqcs-accent); font-weight: 700; }
.dqcs .dqcs-title { margin: .2rem 0 .3rem; font-size: clamp(1.6rem, 3.5vw, 2.2rem); line-height: 1.15; }
.dqcs-sub { margin: 0; color: var(--dqcs-muted); max-width: 44rem; }

/* Cards */
.dqcs-card { background: var(--dqcs-card); border: 1px solid var(--dqcs-line); border-radius: var(--dqcs-radius); padding: 1.1rem 1.25rem; margin-bottom: 1rem; }
.dqcs .dqcs-h { margin: 0 0 .6rem; font-size: 1.05rem; line-height: 1.3; }
.dqcs-muted { color: var(--dqcs-muted); }
.dqcs-small { font-size: .85rem; margin: .5rem 0 0; }
.dqcs p { margin: .35rem 0; }

/* Buttons */
.dqcs button { font: inherit; cursor: pointer; }
.dqcs-btn { background: var(--dqcs-accent); color: #fff; border: 0; border-radius: 8px; padding: .55rem 1rem; font-weight: 600; }
.dqcs-btn:hover { filter: brightness(1.08); }
.dqcs-btn:disabled { opacity: .45; cursor: not-allowed; }
.dqcs-btn-small { padding: .3rem .7rem; font-size: .85rem; }
.dqcs-btn-ghost { background: transparent; color: var(--dqcs-accent); border: 1px solid var(--dqcs-accent); }
.dqcs-chip { background: var(--dqcs-soft); border: 1px solid var(--dqcs-line); border-radius: 999px; padding: .3rem .8rem; font-size: .85rem; color: var(--dqcs-ink); }
.dqcs-chip:hover { border-color: var(--dqcs-accent); color: var(--dqcs-accent); }
.dqcs-link { background: none; border: 0; padding: 0; color: var(--dqcs-accent); text-decoration: underline; font-size: .85rem; }
.dqcs button:focus-visible, .dqcs input:focus-visible, .dqcs summary:focus-visible, .dqcs-handle:focus-visible { outline: 3px solid #ffbf47; outline-offset: 2px; }

/* Dimension bar + presets */
.dqcs-dimbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: .5rem; }
.dqcs-tabs { display: inline-flex; border: 1px solid var(--dqcs-line); border-radius: 8px; overflow: hidden; }
.dqcs-tab { background: #fff; border: 0; border-right: 1px solid var(--dqcs-line); padding: .4rem .9rem; color: var(--dqcs-ink); }
.dqcs-tab:last-child { border-right: 0; }
.dqcs-tab.is-active { background: var(--dqcs-accent); color: #fff; }
.dqcs-custom input { width: 4.5rem; margin-left: .3rem; }
.dqcs-dimnote { color: var(--dqcs-ink); background: #eef5ff; border-left: 3px solid var(--dqcs-accent); padding: .5rem .8rem; border-radius: 4px; }
.dqcs-dimnote:empty { display: none; }
.dqcs-presets { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: 1rem; }
.dqcs-presets[hidden] { display: none; }
.dqcs-presets-label { font-size: .85rem; color: var(--dqcs-muted); margin-right: .2rem; }

/* Main grid */
.dqcs-main { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr); gap: 1rem; }
.dqcs-main > .dqcs-card { margin-bottom: 0; }
.dqcs-main + * { margin-top: 1rem; }
@media (max-width: 760px) { .dqcs-main { grid-template-columns: 1fr; } }

/* Inputs */
.dqcs-vecin { border: 0; margin: 0 0 1rem; padding: 0 0 0 .75rem; border-left: 4px solid var(--dqcs-a); }
.dqcs-vecin-b { border-left-color: var(--dqcs-b); }
.dqcs-vecin legend { font-weight: 700; padding: 0; margin-bottom: .35rem; }
.dqcs-vecin-a legend { color: var(--dqcs-a); }
.dqcs-vecin-b legend { color: var(--dqcs-b); }
.dqcs-vecrow { display: flex; gap: .6rem; flex-wrap: wrap; }
.dqcs-field { display: flex; flex-direction: column; font-size: .8rem; color: var(--dqcs-muted); }
.dqcs-field input { width: 5.2rem; padding: .45rem .5rem; font-size: 1.05rem; border: 1px solid var(--dqcs-line); border-radius: 8px; color: var(--dqcs-ink); background: #fff; font-variant-numeric: tabular-nums; }
.dqcs-vecrow.is-many .dqcs-field input { width: 4.2rem; font-size: .95rem; }

/* Graph */
.dqcs-graph-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.dqcs-toggle { font-size: .85rem; color: var(--dqcs-muted); }
.dqcs-graph-host { max-width: 460px; margin: 0 auto; touch-action: none; }
.dqcs-graph-host[hidden] { display: none; }
.dqcs-svg { width: 100%; height: auto; display: block; user-select: none; }
.dqcs-grid line { stroke: #e9edf3; stroke-width: 1; }
.dqcs-grid line.minor { stroke: #f3f5f9; }
.dqcs-axes line.axis { stroke: #9aa4b5; stroke-width: 1.5; }
.dqcs-axes text { font-size: 11px; fill: #8a93a3; }
.dqcs-axes text.axis-name { font-size: 13px; font-style: italic; fill: var(--dqcs-muted); }
.dqcs-origin { fill: var(--dqcs-ink); }
.dqcs-vec line { stroke-width: 3.5; stroke-linecap: round; }
.dqcs-vec-a line, .dqcs-head-a { stroke: var(--dqcs-a); fill: var(--dqcs-a); }
.dqcs-vec-b line, .dqcs-head-b { stroke: var(--dqcs-b); fill: var(--dqcs-b); }
.dqcs-head-a, .dqcs-head-b { stroke: none; }
.dqcs-vec-label { font-weight: 700; font-size: 16px; }
.dqcs-vec-a .dqcs-vec-label, .dqcs-vec-a .dqcs-len-label { fill: var(--dqcs-a); }
.dqcs-vec-b .dqcs-vec-label, .dqcs-vec-b .dqcs-len-label { fill: var(--dqcs-b); }
.dqcs-len-label { font-size: 11px; font-weight: 600; paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.dqcs-handle { fill: #fff; stroke-width: 3; cursor: grab; transition: r .15s; }
.dqcs-vec-a .dqcs-handle { stroke: var(--dqcs-a); }
.dqcs-vec-b .dqcs-handle { stroke: var(--dqcs-b); }
.dqcs-handle-hit { fill: transparent; cursor: grab; }
.dqcs-vec.is-dragging .dqcs-handle { r: 9; cursor: grabbing; }
.dqcs-arc { fill: rgba(20, 33, 61, .06); stroke: var(--dqcs-ink); stroke-width: 1.5; stroke-dasharray: 3 3; }
.dqcs-arc-label { font-size: 13px; font-weight: 700; fill: var(--dqcs-ink); paint-order: stroke; stroke: #fff; stroke-width: 4px; }

/* Relationship */
.dqcs-rel { margin-top: .75rem; display: grid; gap: .25rem; }
.dqcs-rel p { margin: 0; padding: .3rem .6rem; border-radius: 6px; font-size: .88rem; color: var(--dqcs-muted); }
.dqcs-rel p.is-active { background: #eef5ff; color: var(--dqcs-ink); box-shadow: inset 3px 0 0 var(--dqcs-accent); }

/* n-D table */
.dqcs-nd[hidden] { display: none; }
.dqcs-tablewrap { overflow-x: auto; }
.dqcs-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .92rem; }
.dqcs-table th, .dqcs-table td { padding: .35rem .5rem; border-bottom: 1px solid var(--dqcs-line); text-align: right; }
.dqcs-table th:first-child, .dqcs-table tfoot th { text-align: left; }
.dqcs-barcell { width: 38%; min-width: 120px; }
.dqcs-bar { position: relative; display: block; height: 7px; margin: 3px 0; background: linear-gradient(to right, transparent calc(50% - .5px), #c5ccd8 calc(50% - .5px), #c5ccd8 calc(50% + .5px), transparent calc(50% + .5px)); }
.dqcs-bar > span { position: absolute; top: 0; height: 100%; border-radius: 3px; }
.dqcs-bar-a { background: var(--dqcs-a); }
.dqcs-bar-b { background: var(--dqcs-b); }

/* Results */
.dqcs-results { display: grid; grid-template-columns: auto auto 1fr; gap: .75rem 1.5rem; align-items: center; border-top: 4px solid var(--dqcs-line); }
.dqcs-results.is-pos { border-top-color: var(--dqcs-good); }
.dqcs-results.is-neg { border-top-color: var(--dqcs-bad); }
.dqcs-stat { display: flex; flex-direction: column; }
.dqcs-stat-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--dqcs-muted); }
.dqcs-stat-val { font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.dqcs-stat-main .dqcs-stat-val { font-size: 2.2rem; color: var(--dqcs-accent); }
.dqcs-verdict { grid-column: 1 / -1; font-weight: 600; margin: 0; }
.dqcs-scale { min-width: 220px; padding-top: 1.4rem; }
.dqcs-scale-track { position: relative; height: 10px; border-radius: 5px; background: linear-gradient(to right, #f4c7c3, #eceff4 50%, #bfe3cf); }
.dqcs-scale-mid { position: absolute; left: 50%; top: -3px; width: 2px; height: 16px; background: #9aa4b5; }
.dqcs-scale-marker { position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: var(--dqcs-accent); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); transition: left .3s ease; }
.dqcs-scale-marker span { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); font-size: .78rem; font-weight: 700; white-space: nowrap; color: var(--dqcs-ink); }
.dqcs-scale-labels { display: flex; justify-content: space-between; font-size: .72rem; color: var(--dqcs-muted); margin-top: .35rem; line-height: 1.25; }
.dqcs-scale-labels span:nth-child(2) { text-align: center; }
.dqcs-scale-labels span:last-child { text-align: right; }
@media (max-width: 640px) {
	.dqcs-results { grid-template-columns: 1fr 1fr; }
	.dqcs-scale { grid-column: 1 / -1; }
}

/* Formula */
.dqcs-formula-core { font-size: 1.15rem; font-weight: 600; }
.dqcs-formula-live { font-size: 1.02rem; font-variant-numeric: tabular-nums; overflow-x: auto; }
.dqcs-formula-live p { margin: .55rem 0; white-space: nowrap; }
.dqcs-formula-result { font-size: 1.3rem; color: var(--dqcs-accent); }
.dqcs-frac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; margin: 0 .2rem; }
.dqcs-frac > span { padding: 0 .35rem; }
.dqcs-frac > span:first-child { border-bottom: 1.5px solid currentColor; padding-bottom: .1rem; }
.dqcs-frac > span:last-child { padding-top: .1rem; }
.dqcs-ta { color: var(--dqcs-a); font-weight: 700; }
.dqcs-tb { color: var(--dqcs-b); font-weight: 700; }

/* Pipeline */
.dqcs-stage { border: 1px solid var(--dqcs-line); border-radius: 8px; margin: .4rem 0; background: #fff; }
.dqcs-stage summary { display: flex; align-items: center; gap: .7rem; padding: .55rem .8rem; cursor: pointer; list-style: none; }
.dqcs-stage summary::-webkit-details-marker { display: none; }
.dqcs-stage summary::after { content: '+'; margin-left: .4rem; color: var(--dqcs-muted); font-weight: 700; }
.dqcs-stage[open] summary::after { content: '−'; }
.dqcs-stage-n { width: 1.6rem; height: 1.6rem; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--dqcs-soft); border: 1px solid var(--dqcs-line); font-size: .8rem; font-weight: 700; }
.dqcs-stage-name { font-weight: 600; }
.dqcs-stage-val { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--dqcs-accent); font-weight: 700; text-align: right; }
.dqcs-stage-body { padding: 0 .9rem .8rem 3.1rem; font-size: .95rem; }
.dqcs-terms { margin: .3rem 0; padding-left: 1.1rem; font-variant-numeric: tabular-nums; }
.dqcs-flow { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .4rem 0; }
.dqcs-flow > span { display: flex; flex-direction: column; align-items: center; font-size: .78rem; color: var(--dqcs-muted); }
.dqcs-flow > span b { font-size: 1rem; color: var(--dqcs-ink); background: var(--dqcs-soft); border: 1px solid var(--dqcs-line); border-radius: 6px; padding: .2rem .55rem; margin-top: .15rem; }

/* Learning */
.dqcs-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.dqcs-steplist { margin: .5rem 0; padding-left: 1.3rem; }
.dqcs-step { margin: .4rem 0; padding: .6rem .75rem; border-radius: 8px; border: 1px solid var(--dqcs-line); }
.dqcs-step[hidden] { display: none; }
.dqcs-step.is-current { border-color: var(--dqcs-accent); background: #f5f9ff; }
.dqcs-step.is-done { opacity: .9; }
.dqcs-step.is-done .dqcs-btn-small { display: none; }
.dqcs-step-ask { display: inline; margin-right: .6rem; }
.dqcs-step-result { margin-top: .35rem; font-size: .92rem; }
.dqcs-step-result:empty { display: none; }
.dqcs-tick { color: var(--dqcs-good); font-weight: 700; }
.dqcs-summary { background: #eef9f2; border-radius: 6px; padding: .5rem .7rem; }
.dqcs-choices { border: 0; padding: 0; margin: .5rem 0 .8rem; display: grid; gap: .3rem; }
.dqcs-choice { display: flex; gap: .4rem; align-items: center; padding: .4rem .6rem; border: 1px solid var(--dqcs-line); border-radius: 8px; cursor: pointer; }
.dqcs-choice:has(input:checked) { border-color: var(--dqcs-accent); background: #f5f9ff; }
.dqcs-good { color: var(--dqcs-good); }
.dqcs-bad { color: var(--dqcs-bad); }
.dqcs-predict-out p { color: var(--dqcs-ink); }
.dqcs-predict-out b { color: inherit; }
.dqcs-predict-out .dqcs-good b { color: var(--dqcs-good); }
.dqcs-predict-out .dqcs-bad b { color: var(--dqcs-bad); }
.dqcs-chlist { list-style: none; margin: .5rem 0; padding: 0; }
.dqcs-ch { display: flex; gap: .6rem; align-items: flex-start; padding: .55rem .2rem; border-bottom: 1px solid var(--dqcs-line); }
.dqcs-ch-box { flex: none; width: 1.3rem; height: 1.3rem; margin-top: .1rem; border: 2px solid #b7c0cf; border-radius: 5px; display: grid; place-items: center; }
.dqcs-ch.is-done .dqcs-ch-box { background: var(--dqcs-good); border-color: var(--dqcs-good); }
.dqcs-ch.is-done .dqcs-ch-box::after { content: '✓'; color: #fff; font-size: .8rem; font-weight: 700; }
.dqcs-hint { color: var(--dqcs-muted); font-size: .9rem; }
.dqcs-chscore { font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
	.dqcs-scale-marker, .dqcs-handle { transition: none; }
}
