/* Sonalize Root Stylesheet - Neutral Surface Palette, Dual-Ring Identity & DSP Visualisations */

/* Self-Hosted Local Fonts */
@font-face {
    font-family: 'Poppins';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('fonts/poppins-600.woff2') format('woff2');
}

@font-face {
    /* one variable font covers every weight used (400, 500, 600) */
    font-family: 'Figtree';
    font-style: normal;
    font-weight: 300 900;
    font-display: swap;
    src: url('fonts/figtree.woff2') format('woff2');
}

@font-face {
    font-family: 'Cascadia Mono';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('fonts/cascadia-mono.woff2') format('woff2');
}

/* Design Tokens - Light Mode (Default) */
:root {
    --ground: #F4F4F4;
    --surface: #FFFFFF;
    --raised: #F9F9F9;
    --line: #E3E3E3;
    --line-2: #D2D2D2;
    --ink: #222222;
    --ink-2: #555555;
    --ink-3: #696969;
    --accent: #222222;
    --track-a: #0683AA;
    --track-a-text: #222222;
    --on-accent: #FFFFFF;
    --score-high: #B91C1C;
    --score-mid: #A3530D;
    --score-low: #2C6E49;
    --track-b: #C05008;
    --track-b-text: #222222;
    --status-high: #DC2626;
    --status-low: #2C6E49;
    --r-in: 4px;
    --r-ctrl: 8px;
    --r-card: 12px;
    --r-sheet: 16px;
    --ease: cubic-bezier(.2, .8, .2, 1);
    --elev-card: 0 1px 2px rgb(0 0 0 / .06), 0 10px 28px -14px rgb(0 0 0 / .22);
    --font-head: 'Poppins', system-ui, -apple-system, sans-serif;
    --font-ui: 'Figtree', system-ui, -apple-system, sans-serif;
    --font-mono: 'Cascadia Mono', 'SF Mono', Consolas, ui-monospace, monospace;

    /* Legacy mapping for backward compatibility */
    --bg-base: var(--ground);
    --bg-surface: var(--surface);
    --bg-card: var(--surface);
    --bg-card-hover: var(--raised);
    --border-subtle: var(--line);
    --border-bright: var(--line-2);
    --text-primary: var(--ink);
    --text-secondary: var(--ink-2);
    --text-muted: var(--ink-3);
}

/* Dark Mode Tokens */
:root[data-theme="dark"] {
    --ground: #141414;
    --surface: #1C1C1C;
    --raised: #222222;
    --line: #2F2F2F;
    --line-2: #3C3C3C;
    --ink: #E9E9E9;
    --ink-2: #B7B7B7;
    --ink-3: #9B9B9B;
    --accent: #E9E9E9;
    --track-a: #1490B9;
    --track-a-text: #E9E9E9;
    --on-accent: #141414;
    --score-high: #F87171;
    --score-mid: #EE8A33;
    --score-low: #7ECFA4;
    --track-b: #D2590D;
    --track-b-text: #E9E9E9;
    --status-high: #DC2626;
    --status-low: #7ECFA4;
    --elev-card: 0 1px 2px rgb(0 0 0 / .4), 0 12px 28px -12px rgb(0 0 0 / .7);

    --bg-base: var(--ground);
    --bg-surface: var(--surface);
    --bg-card: var(--surface);
    --bg-card-hover: var(--raised);
    --border-subtle: var(--line);
    --border-bright: var(--line-2);
    --text-primary: var(--ink);
    --text-secondary: var(--ink-2);
    --text-muted: var(--ink-3);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --ground: #141414;
        --surface: #1C1C1C;
        --raised: #222222;
        --line: #2F2F2F;
        --line-2: #3C3C3C;
        --ink: #E9E9E9;
        --ink-2: #B7B7B7;
        --ink-3: #9B9B9B;
        --accent: #E9E9E9;
        --track-a: #1490B9;
        --track-a-text: #E9E9E9;
        --on-accent: #141414;
        --score-high: #F87171;
        --score-mid: #EE8A33;
        --score-low: #7ECFA4;
        --track-b: #D2590D;
        --track-b-text: #E9E9E9;
        --status-high: #DC2626;
        --status-low: #7ECFA4;
        --elev-card: 0 1px 2px rgb(0 0 0 / .4), 0 12px 28px -12px rgb(0 0 0 / .7);

        --bg-base: var(--ground);
        --bg-surface: var(--surface);
        --bg-card: var(--surface);
        --bg-card-hover: var(--raised);
        --border-subtle: var(--line);
        --border-bright: var(--line-2);
        --text-primary: var(--ink);
        --text-secondary: var(--ink-2);
        --text-muted: var(--ink-3);
    }
}

/* Reset & Global Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    overflow-x: clip;
    background-color: var(--ground);
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 0.875rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* Enforce Tabular Nums for all quantitative metrics */
.tabular,
.metric-val,
.detail-val,
.gauge-number,
.progress-percentage,
.apparent-pill,
.segment-pct,
.time-val {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: clip;
}

/* Top Navigation Bar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.75rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--elev-card);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.brand-tile {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    flex-shrink: 0;
}

.brand-title {
    font-family: var(--font-head);
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--ink);
    line-height: 1.2;
}

.brand-subtitle {
    display: block;
    font-size: 0.75rem;
    color: var(--ink-2);
    font-weight: 400;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-demo {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: 32px;
    padding: 0 0.85rem;
    background: var(--raised);
    border: 1px solid var(--line);
    border-radius: var(--r-ctrl);
    color: var(--ink);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-demo:hover:not(:disabled) {
    background: var(--line);
    border-color: var(--line-2);
}

.btn-demo-distinct {
    border-color: var(--line);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--r-ctrl);
    background: var(--raised);
    border: 1px solid var(--line);
    color: var(--ink-2);
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.btn-icon:hover {
    color: var(--ink);
    background: var(--line);
}

/* Main Workspace Container */
.main-container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
}

/* Secondary Mode Switcher (Batch Folder Scan) */
.mode-tabs-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--raised);
    border: 1px solid var(--line);
    border-radius: var(--r-card);
    padding: 0.35rem 0.5rem;
}

.mode-pills {
    display: flex;
    gap: 0.35rem;
}

.mode-pill {
    padding: 0.4rem 0.9rem;
    border-radius: var(--r-ctrl);
    border: none;
    background: transparent;
    color: var(--ink-2);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.mode-pill.active {
    background: var(--surface);
    color: var(--ink);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Cards & Surfaces */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-card);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--elev-card);
}

/* Dual Dropzones Grid */
.dropzones-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.track-card {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    border-radius: var(--r-card);
}

.track-card.accent-track-a {
    border-top: 3px solid var(--track-a);
}

.track-card.accent-track-b {
    border-top: 3px solid var(--track-b);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.track-title {
    font-family: var(--font-head);
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
}

.track-subtitle {
    font-size: 0.75rem;
    color: var(--ink-2);
}

.tab-pills {
    display: flex;
    background: var(--raised);
    padding: 3px;
    border-radius: var(--r-ctrl);
    border: 1px solid var(--line);
}

.tab-pill {
    padding: 0.3rem 0.65rem;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--ink-2);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tab-pill.active {
    background: var(--surface);
    color: var(--ink);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--line-2);
    border-radius: var(--r-ctrl);
    padding: 2rem 1.25rem;
    background: var(--raised);
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
    text-align: center;
}

.dropzone:hover, .dropzone.active-drag {
    border-color: var(--accent);
    background: var(--surface);
}

.hidden-file-input {
    display: none;
}

.dropzone-icon {
    color: var(--ink-2);
    margin-bottom: 0.5rem;
}

.dropzone-text {
    font-size: 0.875rem;
    color: var(--ink-2);
}

.dropzone-prompt {
    color: var(--ink);
    font-weight: 600;
}

.dropzone-formats {
    font-size: 0.75rem;
    color: var(--ink-3);
    margin-top: 0.35rem;
    font-family: var(--font-mono);
}

.url-input-box {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.85rem 0;
}

.url-input-row {
    display: flex;
    gap: 0.5rem;
}

.url-input {
    flex: 1;
    background: var(--raised);
    border: 1px solid var(--line-2);
    border-radius: var(--r-ctrl);
    padding: 0.5rem 0.85rem;
    color: var(--ink);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.15s ease;
}

.url-input:focus {
    border-color: var(--accent);
}

.btn-fetch {
    background: var(--accent);
    color: var(--on-accent);
    border: none;
    border-radius: var(--r-ctrl);
    padding: 0 1.1rem;
    font-weight: 600;
    font-size: 0.8125rem;
    cursor: pointer;
    height: 34px;
}

.btn-fetch:hover:not(:disabled) {
    opacity: 0.92;
}

.btn-fetch:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Songs found from a pasted link or name, each with its Apple Music link (Apple's preview terms) */
.preview-matches {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
    display: grid;
    /* One column that may shrink below the longest title (titles end in an ellipsis instead of widening the page) */
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
}

.preview-match {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    background: var(--bg-card);
}

.preview-match img {
    border-radius: 6px;
    flex: none;
}

.preview-match-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.preview-match-text .track-name,
.preview-match-text .track-subtitle {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.track-source-kind.preview-kind {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
}

.preview-note {
    margin: 8px 0 0;
    padding: 8px 10px;
    border-left: 3px solid var(--accent);
    background: var(--bg-surface);
    font-size: 0.9rem;
}

/* Apple's official badge, unaltered (their identity guidelines), linking to the song */
.store-link {
    display: inline-block;
    margin-top: 4px;
    padding: 3px 0;
    line-height: 0;
}

.store-link img {
    display: block;
}

.lookup-error {
    margin-top: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.selected-track-box {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    background: var(--raised);
    border: 1px solid var(--line);
    border-radius: var(--r-ctrl);
    padding: 0.85rem 1rem;
}

.track-icon-wrapper {
    color: var(--accent);
    background: var(--surface);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: 1px solid var(--line);
    flex-shrink: 0;
}

.track-details {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.track-source-kind {
    font-size: 0.75rem;
    color: var(--ink-3);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.track-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-clear {
    background: transparent;
    border: none;
    color: var(--ink-3);
    cursor: pointer;
    padding: 0.35rem;
    border-radius: var(--r-in);
}

.btn-clear:hover {
    color: var(--status-high);
}

/* 4-Stem Melody / Bass Isolation Selector */
.stem-selector-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.6rem 1rem;
    background: var(--raised);
    border: 1px solid var(--line);
    border-radius: var(--r-ctrl);
    margin-top: 0.25rem;
}

.stem-label {
    font-size: 0.75rem;
    color: var(--ink-2);
    font-weight: 600;
}

.stem-pills {
    display: flex;
    gap: 0.35rem;
}

.stem-chip {
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    border: 1px solid var(--line-2);
    background: var(--surface);
    color: var(--ink-2);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.stem-chip:hover {
    border-color: var(--accent);
    color: var(--ink);
}

.stem-chip.active {
    background: var(--accent);
    color: var(--on-accent);
    border-color: var(--accent);
    font-weight: 600;
}

/* Action Controls (Verb-First Buttons, Solid Flat Fills) */
.action-controls-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.85rem;
    margin: 0.25rem 0;
}

.btn-analyze {
    background: var(--accent);
    color: var(--on-accent);
    border: none;
    border-radius: var(--r-ctrl);
    padding: 0.65rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    min-height: 40px;
    transition: opacity 0.15s ease;
}

.btn-analyze:hover:not(:disabled) {
    opacity: 0.92;
}

.btn-analyze:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--raised);
    color: var(--ink-2);
    border: 1px solid var(--line-2);
    border-radius: var(--r-ctrl);
    padding: 0.65rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    min-height: 40px;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.btn-secondary:hover:not(:disabled) {
    background: var(--line);
    color: var(--ink);
}

/* Error Banner */
.error-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(220, 38, 38, 0.08);
    border: 1px solid var(--status-high);
    border-radius: var(--r-ctrl);
    padding: 0.85rem 1.15rem;
    color: var(--status-high);
    font-size: 0.875rem;
}

/* Live DSP Processing Card & Active Spinner */
.progress-card {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    background: var(--surface);
    border-color: var(--line);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.progress-title-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.progress-title {
    font-family: var(--font-head);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink);
}

.progress-percentage {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent);
}

.progress-track {
    width: 100%;
    height: 6px;
    background: var(--line);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 999px;
    transition: width 0.3s var(--ease);
}

.progress-ticker {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    background: var(--raised);
    padding: 0.45rem 0.75rem;
    border-radius: var(--r-in);
    border-left: 3px solid var(--accent);
    color: var(--ink-2);
}

.stage-pills-row {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.2rem;
}

.stage-pill {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.55rem;
    background: var(--raised);
    border: 1px solid var(--line);
    border-radius: var(--r-in);
    font-size: 0.75rem;
    color: var(--ink-3);
}

.stage-pill.active {
    border-color: var(--accent);
    color: var(--ink);
    background: var(--surface);
    font-weight: 600;
}

.stage-pill.completed {
    border-color: var(--status-low);
    color: var(--status-low);
}

/* Active DSP Processing Spinner Animation */
@keyframes spin-cw { to { transform: rotate(360deg); } }
@keyframes spin-ccw { to { transform: rotate(-360deg); } }

/* the woven waves (icons/weave-spinner.svg): one period is 24 units; paused at rest, running while analysing (the
   running rule wins over the inline style snapSpinner leaves) */
.sonalize-spinner { display: inline-flex; line-height: 0; }
.sonalize-spinner .wv { fill: none; stroke-width: 3; stroke-linecap: round; }
.sonalize-spinner .wv-a { stroke: var(--track-a); }
.sonalize-spinner .wv-b { stroke: var(--track-b); }
.sonalize-spinner .wv-gap { fill: none; stroke: var(--surface); stroke-width: 5.6; stroke-linecap: butt; }
@keyframes weave-run { from { transform: translateX(0); } to { transform: translateX(-24px); } }
.sonalize-spinner .weave-run { animation: weave-run 1.3s linear infinite paused; }
.sonalize-spinner[data-running="true"] .weave-run { animation: weave-run 1.3s linear infinite running !important; }
@media (prefers-reduced-motion: reduce) {
    .sonalize-spinner .weave-run, .sonalize-spinner[data-running="true"] .weave-run { animation: none !important; }
}

/* Results Dashboard */
.results-dashboard {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Hero Score Card */
.hero-score-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.75rem 2rem;
    background: var(--surface);
    border: 1px solid var(--line);
    position: relative;
}

.hero-left {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    max-width: 62%;
}

.hero-subheading {
    font-family: var(--font-head);
    font-size: 0.75rem;
    color: var(--ink-3);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.hero-heading {
    font-family: var(--font-head);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.2;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 600;
    width: fit-content;
    background: var(--raised);
    border: 1px solid var(--line-2);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.hero-description {
    font-size: 0.875rem;
    color: var(--ink-2);
    line-height: 1.45;
}

.hero-gauge-wrapper {
    position: relative;
    width: 160px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.gauge-bg-circle {
    stroke: var(--line);
}

.gauge-progress-circle {
    transition: stroke-dashoffset 0.8s var(--ease);
}

.gauge-value-overlay {
    position: absolute;
    display: flex;
    align-items: baseline;
    justify-content: center;
}

.gauge-number {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.gauge-pct {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--ink-2);
    margin-left: 2px;
}

/* Share or save: one button opening a panel of options */
.btn-share-open {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    height: 34px;
    padding: 0 0.9rem;
    margin-top: 0.25rem;
    align-self: flex-start;
    background: var(--raised);
    border: 1px solid var(--line-2);
    border-radius: var(--r-ctrl);
    color: var(--ink);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.btn-share-open:hover {
    border-color: var(--accent);
}

.btn-share-open:focus-visible,
.share-option:focus-visible,
.share-sheet-close:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

dialog.share-sheet {
    width: min(480px, calc(100vw - 32px));
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    margin: auto; /* the page's reset removes the browser's centring margin */
    padding: 0;
    border-radius: var(--r-sheet);
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--elev-card);
    outline: none;
}

dialog.share-sheet::backdrop {
    background: rgb(0 0 0 / 0.30);
}

@media (prefers-color-scheme: dark) {
    dialog.share-sheet::backdrop {
        background: rgb(0 0 0 / 0.50);
    }
}

dialog.share-sheet[open] { animation: share-in 160ms var(--ease); }
dialog.share-sheet[open]::backdrop { animation: about-fade 160ms ease-out; }

.share-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 12px 8px 20px;
}

.share-sheet-head h3 {
    margin: 0;
    font: 600 1rem/1.3 var(--font-head);
    color: var(--ink);
}

.share-sheet-close {
    width: 32px;
    height: 32px;
    border: 0;
    background: transparent;
    color: var(--ink-2);
    border-radius: var(--r-ctrl);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-sheet-close:hover {
    color: var(--ink);
    background: var(--raised);
}

/* The card that Copy and Download share, shown as it will look */
.share-card-preview {
    margin: 4px 20px 8px;
}

.share-card-preview img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1200 / 630;
    border-radius: 10px;
    border: 1px solid var(--line);
}

/* Direct links to each site's share page */
.share-social {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 4px 20px 6px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.share-social-link {
    display: inline-flex;
    align-items: center;
    height: 30px;
    padding: 0 11px;
    border: 1px solid var(--line-2);
    border-radius: 999px;
    background: var(--raised);
    color: var(--ink);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
}

.share-social-link:hover {
    border-color: var(--accent);
}

.share-social-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Until the proof link is ready (a moment after opening) */
.share-social-link.pending {
    opacity: 0.5;
    pointer-events: none;
}

.share-options {
    list-style: none;
    margin: 0;
    padding: 4px 8px 12px;
    display: grid;
    gap: 2px;
}

.share-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 12px;
    border: 0;
    border-radius: var(--r-ctrl);
    background: transparent;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
    font: inherit;
}

.share-option:hover {
    background: var(--raised);
}

.share-option > svg {
    flex: none;
    color: var(--ink-2);
}

.share-option-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.share-option-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    font-weight: 600;
}

.share-option-desc {
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--ink-2);
}

.share-option-pro {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 1px 6px;
    border: 1px solid var(--line-2);
    border-radius: 999px;
    color: var(--ink-2);
}

/* Phones: the panel rises from the bottom edge, within thumb reach */
@media (max-width: 600px) {
    dialog.share-sheet {
        width: 100vw;
        max-width: 100vw;
        margin: auto 0 0;
        border-radius: var(--r-sheet) var(--r-sheet) 0 0;
        border-bottom: 0;
        padding-bottom: env(safe-area-inset-bottom);
    }
    dialog.share-sheet[open] { animation: share-up 200ms var(--ease); }
    .share-option {
        padding: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    dialog.share-sheet[open], dialog.share-sheet[open]::backdrop { animation: none; }
}

.btn-proof-action {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 28px;
    padding: 0 0.65rem;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--r-in);
    color: var(--ink);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-proof-action:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Sub-scores Grid */
.sub-scores-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.15rem;
}

@media (max-width: 1280px) {
    .sub-scores-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.sample-banner {
    border-left: 3px solid var(--status-high, var(--accent));
    margin-bottom: 1.15rem;
}

.sample-text {
    font-size: 0.875rem;
    color: var(--ink-2, var(--ink));
    line-height: 1.5;
}

.sub-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    border-top: 3px solid var(--line-2);
}

.sub-card.sub-harmonic { border-top-color: var(--track-a); }
.sub-card.sub-melody { border-top-color: var(--accent); }
.sub-card.sub-timbre { border-top-color: var(--track-b); }
.sub-card.sub-groove { border-top-color: var(--status-low); }

.sub-card-top {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sub-card-badge-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sub-weight-badge {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--ink-3);
    background: var(--raised);
    padding: 0.15rem 0.45rem;
    border-radius: var(--r-in);
    border: 1px solid var(--line);
}

.sub-metric-pct {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ink);
}

.sub-title {
    font-family: var(--font-head);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink);
}

.sub-bar-track {
    width: 100%;
    height: 5px;
    background: var(--line);
    border-radius: 999px;
    overflow: hidden;
}

.sub-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--accent);
    transition: width 0.4s var(--ease);
}

.sub-details-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.75rem;
    padding-top: 0.35rem;
    border-top: 1px solid var(--line);
}

.sub-detail-item {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

.detail-label {
    color: var(--ink-2);
    flex-shrink: 0;
}

.detail-val {
    color: var(--ink);
    font-weight: 500;
    text-align: right;
    min-width: 0;
    overflow-wrap: anywhere;
}

/* Theory Card */
.theory-card {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.section-title {
    font-family: var(--font-head);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--ink);
}

.section-subtitle {
    font-size: 0.75rem;
    color: var(--ink-2);
}

/* Candidate Overlap Windows (Top-3 Chips) */
.candidate-windows-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.4rem 0.6rem;
    background: var(--raised);
    border: 1px solid var(--line);
    border-radius: var(--r-ctrl);
}

.candidate-window-chip {
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--line-2);
    color: var(--ink-2);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.candidate-window-chip:hover {
    border-color: var(--accent);
    color: var(--ink);
}

.candidate-window-chip.active {
    background: var(--accent);
    color: var(--on-accent);
    border-color: var(--accent);
    font-weight: 600;
}

/* Commonplace Cadence Chip */
.cadence-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    background: var(--raised);
    border: 1px solid var(--line-2);
    color: var(--ink-2);
    font-size: 0.75rem;
    font-weight: 500;
}

/* Synchronised Overlap Crossfader Studio */
.overlap-player-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-card);
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: var(--elev-card);
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.player-title {
    font-family: var(--font-head);
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 0.2rem;
}

.player-desc {
    font-size: 0.75rem;
    color: var(--ink-2);
    line-height: 1.4;
    max-width: 620px;
}

/* Superimposed Waveform & Transient Canvas */
.waveform-transient-container {
    width: 100%;
    height: 90px;
    background: var(--raised);
    border: 1px solid var(--line);
    border-radius: var(--r-ctrl);
    position: relative;
    overflow: hidden;
}

.waveform-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.waveform-legend {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--ink-2);
    padding: 0.2rem 0.4rem;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.legend-swatch {
    width: 10px;
    height: 3px;
    border-radius: 2px;
}

.swatch-track-a { background: var(--track-a); }
.swatch-track-b { background: var(--track-b); }
.swatch-transient { background: var(--status-low); }

/* Tonal Strategy Buttons */
.key-strategy-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    background: var(--raised);
    border: 1px solid var(--line);
    border-radius: var(--r-ctrl);
    padding: 0.5rem 0.75rem;
}

.strategy-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ink-2);
}

.key-mode-group {
    display: flex;
    gap: 0.4rem;
}

.btn-key-mode {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: 28px;
    padding: 0 0.65rem;
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--r-ctrl);
    color: var(--ink-2);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-key-mode:hover {
    color: var(--ink);
    border-color: var(--accent);
}

.btn-key-mode.active {
    background: var(--accent);
    color: var(--on-accent);
    border-color: var(--accent);
    font-weight: 600;
}

.player-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.player-buttons-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-player-play {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: 32px;
    padding: 0 1rem;
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 600;
    font-size: 0.8125rem;
    border-radius: var(--r-ctrl);
    border: none;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.btn-player-play:hover {
    opacity: 0.92;
}

.btn-player-play.is-playing {
    background: var(--status-high);
}

/* Polarity Null Test Button (Ø) */
.btn-null-test {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 32px;
    padding: 0 0.75rem;
    background: var(--raised);
    border: 1px solid var(--line-2);
    border-radius: var(--r-ctrl);
    color: var(--ink-2);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-null-test:hover {
    color: var(--ink);
    border-color: var(--accent);
}

.btn-null-test.active {
    background: var(--status-high);
    color: #FFFFFF;
    border-color: var(--status-high);
}

.btn-export-clip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: 32px;
    padding: 0 0.85rem;
    background: var(--raised);
    border: 1px solid var(--line-2);
    border-radius: var(--r-ctrl);
    color: var(--ink);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-export-clip:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Crossfader Range Control */
.crossfader-container {
    background: var(--raised);
    border: 1px solid var(--line);
    border-radius: var(--r-ctrl);
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.crossfader-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.crossfader-label-a { color: var(--track-a-text); }
.crossfader-label-mix {
    font-family: var(--font-mono);
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    padding: 0.15rem 0.5rem;
    border-radius: var(--r-in);
}
.crossfader-label-b { color: var(--track-b-text); }

.crossfader-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: var(--line-2);
    outline: none;
    cursor: pointer;
}

.crossfader-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid var(--surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.preset-buttons-row {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

.preset-btn {
    flex: 1;
    height: 28px;
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--ink-2);
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--r-in);
    cursor: pointer;
    transition: all 0.15s ease;
}

.preset-btn:hover {
    color: var(--ink);
    border-color: var(--line-2);
}

.preset-btn.active-a {
    color: var(--track-a-text);
    border-color: var(--track-a);
    font-weight: 600;
}

.preset-btn.active-mix {
    color: var(--accent);
    border-color: var(--accent);
    font-weight: 600;
}

.preset-btn.active-b {
    color: var(--track-b-text);
    border-color: var(--track-b);
    font-weight: 600;
}

/* Visualisations Grid: Polar Radar, DTW Heatmap, MFCC Contour */
.visualisations-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.15rem;
    margin-top: 0.5rem;
}

.vis-card {
    background: var(--raised);
    border: 1px solid var(--line);
    border-radius: var(--r-ctrl);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.vis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.vis-title {
    font-family: var(--font-head);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink);
}

.vis-canvas-container {
    width: 100%;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Theory Table */
.table-container {
    overflow-x: auto;
}

.theory-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.theory-table th, .theory-table td {
    padding: 0.75rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid var(--line);
}

.theory-table th {
    background: var(--raised);
    color: var(--ink-2);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
}

.col-track-a { color: var(--track-a-text) !important; }
.col-track-b { color: var(--track-b-text) !important; }

.param-name {
    color: var(--ink-2);
    font-weight: 600;
    width: 28%;
}

.key-pill {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    background: var(--raised);
    border: 1px solid var(--line-2);
    border-radius: var(--r-in);
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--ink);
}

.apparent-pill {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    background: var(--raised);
    color: var(--status-low);
    font-weight: 600;
    border-radius: var(--r-in);
    border: 1px solid var(--line-2);
}

/* Structured 2-Column HTML Rows for Forensic Narrative */
.narrative-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.narrative-grid {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: var(--r-ctrl);
    overflow: hidden;
}

.narrative-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.narrative-row:last-child {
    border-bottom: none;
}

.narrative-label {
    padding: 0.75rem 1rem;
    background: var(--raised);
    border-right: 1px solid var(--line);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--ink-2);
}

.narrative-value {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--ink);
    line-height: 1.5;
}

/* Exact About Modal Spec (Section 6 & 7) */
dialog.ontiqo-about {
    width: 360px;
    padding: 28px 24px 24px;
    border-radius: var(--r-sheet);
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    text-align: center;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: var(--elev-card);
    outline: none;
}

dialog.ontiqo-about::backdrop {
    background: rgb(0 0 0 / 0.30);
}

@media (prefers-color-scheme: dark) {
    dialog.ontiqo-about::backdrop {
        background: rgb(0 0 0 / 0.50);
    }
}

.ontiqo-about .about-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border: 0;
    background: transparent;
    color: var(--ink-2);
    border-radius: var(--r-ctrl);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ontiqo-about .about-close:hover {
    color: var(--ink);
    background: var(--raised);
}

.ontiqo-about .about-icon-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 4px;
}

.ontiqo-about .about-name {
    margin-top: 12px;
    font: 600 20px/1.2 var(--font-head);
    color: var(--ink);
}

.ontiqo-about .about-ver {
    margin-top: 2px;
    font-size: 0.8125rem;
    color: var(--ink-2);
}

.ontiqo-about .about-desc {
    margin-top: 12px;
    font-size: 0.875rem;
    line-height: 1.45;
    color: var(--ink-2);
}

.ontiqo-about .about-links {
    margin-top: 16px;
    font-size: 0.8125rem;
    color: var(--ink-2);
    display: flex;
    justify-content: center;
    gap: 8px;
}

.ontiqo-about .about-links a {
    color: var(--accent);
    text-decoration: none;
}

.ontiqo-about .about-links a:hover {
    text-decoration: underline;
}

.ontiqo-about .about-company {
    margin-top: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--ink-2);
}

/* Calm Point-of-Need Unlock Modal Sheet (380px wide, 16px radius) */
dialog.unlock-sheet {
    width: 380px;
    max-width: calc(100vw - 32px);
    padding: 24px;
    border-radius: var(--r-sheet);
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: var(--elev-card);
    outline: none;
}

dialog.unlock-sheet::backdrop {
    background: rgb(0 0 0 / 0.35);
}

.unlock-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.unlock-title {
    font-family: var(--font-head);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--ink);
}

.unlock-desc {
    font-size: 0.875rem;
    color: var(--ink-2);
    line-height: 1.45;
    margin-bottom: 16px;
}

.unlock-dev-box {
    background: var(--raised);
    border: 1px solid var(--line);
    border-radius: var(--r-ctrl);
    padding: 12px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.unlock-dev-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ink-2);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.unlock-dev-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    color: var(--ink);
    cursor: pointer;
}

.unlock-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Settings Modal Dialog */
dialog.settings-modal, dialog.unlock-sheet {
    width: 440px;
    max-width: calc(100vw - 32px);
    padding: 24px;
    border-radius: var(--r-sheet);
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: var(--elev-card);
    outline: none;
}

dialog.settings-modal::backdrop {
    background: rgb(0 0 0 / 0.35);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.settings-title {
    font-family: var(--font-head);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--ink);
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}

.settings-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--ink);
}

.theme-options {
    display: flex;
    background: var(--raised);
    padding: 3px;
    border-radius: var(--r-ctrl);
    border: 1px solid var(--line);
}

.theme-btn {
    flex: 1;
    height: 30px;
    border: none;
    background: transparent;
    border-radius: 6px;
    color: var(--ink-2);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.theme-btn.active {
    background: var(--surface);
    color: var(--ink);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.licence-status-box {
    background: var(--raised);
    border: 1px solid var(--line);
    border-radius: var(--r-ctrl);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.licence-status-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--ink);
}

.licence-status-desc {
    font-size: 0.75rem;
    color: var(--ink-2);
    line-height: 1.4;
}

/* Footer & Legal Line */
.app-footer {
    margin-top: auto;
    padding: 1.5rem 1.25rem;
    border-top: 1px solid var(--line);
    background: var(--surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    text-align: center;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.8125rem;
}

.footer-links a {
    color: var(--ink-2);
    text-decoration: none;
    transition: color 0.15s ease;
}

.footer-links a:hover {
    color: var(--accent);
}

.footer-legal-row {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.75rem;
    color: var(--ink-3);
}

/* Responsive Breakpoints */
@media (max-width: 900px) {
    .dropzones-grid {
        grid-template-columns: minmax(0, 1fr);
    }
    .sub-scores-grid {
        grid-template-columns: minmax(0, 1fr);
    }
    .visualisations-grid {
        grid-template-columns: minmax(0, 1fr);
    }
    .hero-score-card {
        flex-direction: column;
        gap: 1.25rem;
        align-items: flex-start;
        padding: 1.25rem;
    }
    .hero-left {
        max-width: 100%;
    }
    .hero-gauge-wrapper {
        align-self: center;
    }
    .narrative-row {
        grid-template-columns: minmax(0, 1fr);
    }
    .narrative-label {
        border-right: none;
        border-bottom: 1px solid var(--line);
    }
}

@media (max-width: 600px) {
    .navbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
    }
    .navbar-actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        row-gap: 0.5rem;
    }
    .main-container {
        padding: 1rem 0.75rem 2rem;
    }
    .action-controls-row {
        flex-direction: column;
        width: 100%;
    }
    .btn-analyze, .btn-secondary {
        width: 100%;
    }
    .theory-table th, .theory-table td {
        padding: 0.5rem 0.4rem;
        font-size: 0.75rem;
    }
}

/* Sonalize Clearance Radar & Redacted Teaser Styles (Blueprint Page 4, 8 & 9) */
.catalogue-container {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
}

.catalogue-intro-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-card);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.catalogue-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(41, 171, 226, 0.12);
    color: var(--ink-2);
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    width: fit-content;
}

.catalogue-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--ink);
}

.catalogue-desc {
    font-size: 0.875rem;
    color: var(--ink-2);
    line-height: 1.5;
}

.skip-id-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    color: var(--ink-2);
}





/* Redacted Teaser Result Card (Page 9) */
.teaser-result-card {
    background: var(--surface);
    border: 1.5px solid var(--score-mid);
    border-radius: var(--r-card);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    box-shadow: 0 8px 24px rgba(238, 138, 51, 0.12);
}

.teaser-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.teaser-alert-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(238, 138, 51, 0.15);
    color: var(--score-mid);
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 700;
}

.teaser-peak-metric {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ink);
}

.teaser-candidates-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.teaser-candidate-row {
    background: var(--raised);
    border: 1px solid var(--line);
    border-radius: var(--r-ctrl);
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.redacted-block {
    display: inline-block;
    background: #3A3D40;
    color: #3A3D40;
    user-select: none;
    border-radius: 4px;
    padding: 0.1rem 0.5rem;
    font-family: monospace;
    letter-spacing: 0.1em;
}

.candidate-meta-tags {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.75rem;
    color: var(--ink-2);
}

.candidate-score-badge {
    background: rgba(238, 138, 51, 0.12);
    color: var(--score-mid);
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

/* Unlock CTA Box (Pricing Tiers) */
.unlock-cta-box {
    background: var(--raised);
    border: 1px solid var(--line-2);
    border-radius: var(--r-ctrl);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.unlock-cta-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink);
}

.pricing-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.85rem;
}

.pricing-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-ctrl);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
    transition: border-color 0.15s ease;
}

.pricing-card:hover {
    border-color: var(--accent);
}

.pricing-card-popular {
    border-color: var(--accent);
    background: rgba(238, 138, 51, 0.04);
}

.pricing-title {
    font-size: 0.8125rem;
    color: var(--ink-2);
    font-weight: 600;
}

.pricing-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ink);
}

.pricing-sub {
    font-size: 0.75rem;
    color: var(--ink-3);
}

.btn-unlock-tier {
    margin-top: 0.5rem;
    background: var(--accent);
    color: var(--on-accent);
    border: none;
    border-radius: 6px;
    padding: 0.5rem 0.85rem;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.btn-unlock-tier:hover {
    opacity: 0.9;
}

.btn-unlock-popular {
    background: var(--accent);
}

/* 20-File Local Folder Cap Notification */
.folder-cap-notice {
    background: rgba(41, 171, 226, 0.08);
    border: 1px solid rgba(41, 171, 226, 0.3);
    border-radius: var(--r-ctrl);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8125rem;
    color: var(--ink);
    gap: 1rem;
}


/* Placeholder for features that are not built yet */
.coming-soon-text { margin-top: 12px; color: var(--ink-2); line-height: 1.5; }

/* Catalogue check (components/catalogue.rs) */
.catalogue-container { display: flex; flex-direction: column; gap: 1.25rem; width: 100%; max-width: 760px; margin: 0 auto; }
.catalogue-card, .catalogue-results { padding: 24px; }
.catalogue-lead { margin-top: 8px; color: var(--ink-2); line-height: 1.5; }
.account-signin, .account-line { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.account-signin h3 { font-size: 1rem; font-weight: 600; }
.account-note { color: var(--ink-3); font-size: 0.875rem; margin: 4px 0 10px; }
.account-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.account-row .url-input { min-width: 0; flex: 1 1 220px; }
.account-providers { display: flex; flex-direction: column; gap: 0.5rem; max-width: 360px; }
.btn-provider { display: flex; align-items: center; justify-content: center; gap: 0.6rem; width: 100%; min-height: 42px; padding: 0 1rem; border-radius: var(--r-ctrl); border: 1px solid var(--line-2); background: var(--raised); color: var(--ink); font-weight: 500; font-size: 0.9rem; cursor: pointer; }
.btn-provider:hover:not(:disabled) { background: var(--line); }
.btn-provider:disabled { opacity: 0.5; cursor: not-allowed; }
.provider-mark { width: 18px; height: 18px; background-size: contain; background-repeat: no-repeat; background-position: center; }
.provider-google .provider-mark { background-image: url("icons/providers/google.svg"); }
.provider-apple .provider-mark { background-image: url("icons/providers/apple.svg"); }
:root[data-theme="dark"] .provider-apple .provider-mark { filter: invert(1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .provider-apple .provider-mark { filter: invert(1); } }
.provider-microsoft .provider-mark { background-image: url("icons/providers/microsoft.svg"); }
.account-links { display: flex; gap: 1.25rem; flex-wrap: wrap; margin-top: 6px; }
.account-col { display: flex; flex-direction: column; gap: 0.5rem; max-width: 360px; }
.account-line { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; color: var(--ink-2); font-size: 0.875rem; }
.btn-link { background: none; border: none; padding: 4px 0; color: var(--ink-2); text-decoration: underline; cursor: pointer; font-size: 0.875rem; }
.btn-link:hover { color: var(--ink); }
.form-error { margin-top: 10px; color: var(--track-b); font-size: 0.875rem; }
.catalogue-song { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.catalogue-song.disabled { opacity: 0.5; pointer-events: none; }
.file-pick { display: inline-flex; align-items: center; }
.file-name { color: var(--ink-2); font-size: 0.875rem; min-width: 0; overflow-wrap: anywhere; }
.own-title { display: flex; flex-direction: column; gap: 4px; width: 100%; font-size: 0.8125rem; color: var(--ink-3); }
.catalogue-stage { margin-top: 12px; color: var(--ink-2); font-size: 0.875rem; }
.catalogue-list { list-style: none; margin-top: 14px; padding: 0; display: flex; flex-direction: column; }
.catalogue-more { display: block; margin: 14px auto 0; }
.catalogue-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.5rem 1rem; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.catalogue-item-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.catalogue-title { font-weight: 600; overflow-wrap: anywhere; }
.catalogue-artist { color: var(--ink-2); font-size: 0.875rem; }
.catalogue-also { color: var(--ink-3); font-size: 0.8125rem; }
.catalogue-item-actions { grid-column: 1 / -1; display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.catalogue-item-actions .store-link img { height: 32px; }
.strength-badge { font-size: 0.75rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line-2); white-space: nowrap; }
.strength-high { background: var(--track-a); color: #FFFFFF; border-color: transparent; }
.strength-mid { color: var(--track-a); border-color: var(--track-a); }
.strength-low { color: var(--ink-3); }

.candidate-windows-label { font-size: 0.75rem; font-weight: 600; color: var(--ink-2); margin-right: 4px; }

/* Check a folder */
.batch-results { overflow-x: auto; }
.batch-table { min-width: 640px; }
.batch-flag { color: var(--score-high); font-weight: 600; font-size: 0.75rem; }
.batch-verdict { color: var(--ink-2); font-size: 0.75rem; }

/* Recent comparisons */
.recent-cases { padding: 0.9rem 1.15rem; }
.recent-cases-title { cursor: pointer; font-weight: 600; color: var(--ink); }
.recent-cases-note { font-size: 0.8125rem; color: var(--ink-2); margin: 0.5rem 0; }
.recent-cases-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.recent-case { display: flex; gap: 0.5rem; align-items: center; }
.recent-case-open { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-ctrl); padding: 0.5rem 0.75rem; color: var(--ink); cursor: pointer; }
.recent-case-open:hover { border-color: var(--accent); }
.recent-case-names { font-size: 0.875rem; font-weight: 600; overflow-wrap: anywhere; }
.recent-case-meta { font-size: 0.75rem; color: var(--ink-2); }

/* About: fade in with the backdrop */
dialog.ontiqo-about[open] { animation: about-in 160ms var(--ease); }
dialog.ontiqo-about[open]::backdrop { animation: about-fade 160ms ease-out; }
@keyframes about-in { from { opacity: 0; transform: translate(-50%, -48%); } to { opacity: 1; transform: translate(-50%, -50%); } }
@keyframes about-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes share-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes share-up { from { transform: translateY(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) {
    dialog.ontiqo-about[open], dialog.ontiqo-about[open]::backdrop { animation: none; }
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Shared result (proof link) */
.shared-result { display: flex; flex-direction: column; gap: 0.75rem; overflow-x: auto; }
.shared-note { font-size: 0.875rem; color: var(--ink-2); line-height: 1.5; }
.shared-score strong { font-size: 1.5rem; color: var(--ink); }
.shared-score span { color: var(--ink-2); }
.receipt-pill { border-radius: 999px; padding: 0.45rem 0.9rem; font-size: 0.875rem; font-weight: 600; border: 1px solid var(--line-2); }
.receipt-pill.ok { color: var(--score-low); border-color: var(--score-low); }
.receipt-pill.mismatch { color: var(--score-high); border-color: var(--score-high); }

/* Hero lockup (empty state) */
.hero-lockup { display: flex; align-items: center; gap: 1.25rem; padding: 0.5rem 0.25rem; color: var(--ink); }
.hero-mark { flex-shrink: 0; color: var(--ink); line-height: 0; }
.hero-mark svg { height: 120px; width: auto; display: block; }
.hero-headline { font-family: var(--font-head); font-size: 1.5rem; font-weight: 600; color: var(--ink); margin: 0 0 0.25rem; }
.hero-sub { font-size: 1rem; color: var(--ink-2); margin: 0; line-height: 1.5; }
@media (max-width: 600px) {
    .hero-lockup { flex-direction: column; text-align: center; }
}

/* Printed / PDF report: the result only, in light colours whatever the theme */
.print-watermark { display: none; }
@media print {
    :root, :root[data-theme="dark"], :root:not([data-theme="light"]) {
        --ground: #FFFFFF !important; --surface: #FFFFFF !important; --raised: #F9F9F9 !important;
        --line: #DDDDDD !important; --line-2: #CCCCCC !important;
        --ink: #111111 !important; --ink-2: #444444 !important; --ink-3: #555555 !important;
        --accent: #222222 !important; --track-a-text: #222222 !important; --track-b-text: #222222 !important;
        --score-high: #B91C1C !important; --score-mid: #A3530D !important; --score-low: #2C6E49 !important;
        --elev-card: none !important;
    }
    body { background: #FFFFFF !important; }
    .navbar, .mode-tabs-bar, .dropzones-grid, .action-controls-row, .recent-cases, .hero-lockup,
    .progress-card, .btn-share-open, .feedback-toast, .overlap-player-card, .btn-proof-action, .app-footer, .error-banner, dialog { display: none !important; }
    .card { break-inside: avoid; box-shadow: none !important; }
    .print-watermark { display: block; text-align: center; font-size: 0.75rem; color: #555555; margin: 1rem 0; }
    .print-appendix { display: block !important; break-before: page; font-size: 0.85rem; color: #111111; }
    a { color: inherit; text-decoration: none; }
}

/* Opt-in closer melody check (vocal separation) under the Analyse button */
.closer-melody {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-top: 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
}

.closer-melody input {
    margin-top: 3px;
    flex: none;
}

.progress-elapsed {
    flex: none;
    color: var(--ink-3);
    font-variant-numeric: tabular-nums;
}

/* Shown by index.html until the app has loaded, then removed */
#boot-splash {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    font-family: system-ui, sans-serif;
    color: var(--ink-2, #555);
}

#boot-splash .boot-bar {
    width: 180px;
    height: 4px;
    border-radius: 2px;
    background: var(--line, #ddd);
    overflow: hidden;
}

#boot-splash .boot-bar::after {
    content: "";
    display: block;
    width: 40%;
    height: 100%;
    background: var(--accent, #222222);
    animation: boot-slide 1.2s ease-in-out infinite;
}

@keyframes boot-slide {
    from { transform: translateX(-100%); }
    to { transform: translateX(250%); }
}

@media (prefers-reduced-motion: reduce) {
    #boot-splash .boot-bar::after { animation: none; width: 100%; opacity: 0.5; }
}

/* "Beta" beside the name while Sonalize is in its free beta */
.alpha-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    border: 1px solid var(--accent);
    border-radius: 999px;
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    vertical-align: middle;
    text-transform: uppercase;
}

/* Song identification (components/identified.rs) */
.identified-tracks { padding: 10px 16px; border: 1px solid var(--line); border-radius: var(--r-ctrl); color: var(--ink-2); font-size: 0.9rem; display: flex; flex-direction: column; gap: 4px; }
.identified-note { color: var(--ink-3); font-size: 0.8125rem; }

/* ---- The desktop app's window frame (sonalize_app.js). Signature title bar: the web's own top bar, 44 px. ---- */
:root[data-frame] .navbar { height: 44px; padding-top: 0; padding-bottom: 0; user-select: none; -webkit-user-select: none; }
:root[data-frame="drawn"] .navbar { padding-right: 0; }
/* The title bar spans the window and the page scrolls beneath it, so the scrollbar starts under the bar */
:root[data-frame], :root[data-frame] body { height: 100%; overflow: hidden; }
:root[data-frame] .app-layout { position: fixed; top: 44px; right: 0; bottom: 0; left: 0; min-height: 0; overflow-y: auto; }
:root[data-frame] .navbar { position: fixed; top: 0; left: 0; right: 0; }
/* the page's own buttons stay at the right, beside the window's, as on the web */
:root[data-frame] .navbar-actions { margin-left: auto; }
:root[data-frame="mac"] .navbar { padding-left: 84px; } /* room for the traffic lights */
.winctl { display: flex; align-self: stretch; margin-left: 0.5rem; }
.win-btn {
    width: 46px; align-self: stretch; display: grid; place-items: center;
    border: 0; border-radius: 0; background: none; color: var(--ink-2); cursor: default;
    transition: background 0.12s, color 0.12s;
}
.win-btn svg { width: 10px; height: 10px; overflow: visible; fill: none; stroke: currentColor; stroke-width: 1.1; stroke-linecap: square; }
.win-btn:hover { background: var(--raised); color: var(--ink); }
.win-btn:active { background: var(--line); }
/* Windows' own red for close: an accent-coloured close button would read as a feature */
.win-btn.danger:hover { background: #c42b1c; color: #fff; }
.win-btn .restore { display: none; }
.win-btn.is-max .restore { display: inline; }
.win-btn.is-max .square { x: 2.7px; y: 0.5px; width: 6.8px; height: 6.8px; }

/* Phones (the Sonalize app, and the web app saved to a home screen): the page runs under the status bar and
   around the camera cutout, so the top bar and the page keep clear of them */
.navbar { padding-top: max(0.75rem, env(safe-area-inset-top)); padding-left: max(1.75rem, env(safe-area-inset-left)); padding-right: max(1.75rem, env(safe-area-inset-right)); }
:root[data-frame] .navbar { padding-top: 0; }

/* "Unreleased" under each track card: the explanation is in its tooltip */
.track-col { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.track-col > .track-card { flex: 1; }
.unreleased { display: inline-flex; align-items: center; gap: 0.4rem; align-self: flex-start; font-size: 0.8125rem; color: var(--ink-2); cursor: pointer; padding-left: 0.25rem; }
.unreleased input { margin: 0; }
.info-dot { display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--ink-3); color: var(--ink-3); font: 600 9px var(--font-ui); font-style: italic; }

/* Listen mode (dropzone.rs Record) */
.record-box { display: flex; flex-direction: column; gap: 0.6rem; padding: 0.5rem 0; }
.record-start { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: stretch; }
.record-start button { height: 36px; display: inline-flex; align-items: center; }
.record-live { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--status-high); animation: rec-pulse 1.2s ease-in-out infinite; }
@keyframes rec-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } }
.rec-time { font-family: var(--font-mono); font-size: 0.875rem; color: var(--ink); min-width: 9.5em; }
.rec-meter { flex: 1; min-width: 80px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.rec-meter > span { display: block; height: 100%; background: var(--ink-2); transition: width 0.1s linear; }

/* The mode buttons stay on one line; on a narrow card they move under the title */
.tab-pill { white-space: nowrap; }
.card-header { flex-wrap: wrap; }
@media (max-width: 560px) { .card-header .tab-pills { width: 100%; } .card-header .tab-pill { flex: 1; } }

/* The desktop or phone app's sign-in, run on sonalize.app in the system browser (sonalize_account.js appSignIn) */
.app-signin { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; background: color-mix(in srgb, var(--ground) 88%, transparent); padding: 16px; }
.app-signin-card { max-width: 380px; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sheet); padding: 24px; display: grid; gap: 12px; justify-items: start; box-shadow: var(--elev-card); }
.app-signin-card h2 { font-family: var(--font-head); font-size: 1.25rem; margin: 0; color: var(--ink); }
.app-signin-card p { margin: 0; color: var(--ink-2); }
.app-signin-card button { width: 100%; }
.app-signin-error:empty { display: none; }
.app-signin-error { color: var(--status-high); }

/* "Email me about major updates to Sonalize", under the account line (catalogue.rs UpdateEmails) */
.update-emails { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.8125rem; color: var(--ink-2); margin: 0.25rem 0 0.5rem; cursor: pointer; }
.update-emails input { margin: 0; }

/* Creator and Studio (plans.rs): offers at the point of need, the wait while paying, the account's plan line */
.plan-offers { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.plan-period { display: inline-flex; align-self: flex-start; border: 1px solid var(--border-bright); border-radius: 8px; overflow: hidden; }
.plan-period button { background: none; border: 0; padding: 6px 14px; font: inherit; color: var(--text-muted); cursor: pointer; }
.plan-period button.active { background: var(--bg-surface); color: inherit; font-weight: 600; box-shadow: inset 0 0 0 1px var(--border-bright); }
.plan-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.plan-card { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--border-subtle); border-radius: 10px; background: var(--bg-card); }
.plan-tier { font-weight: 600; }
.plan-price { font-size: 1.1em; }
.plan-what { color: var(--text-muted); font-size: 0.88em; flex: 1; }
.plan-note { color: var(--text-muted); font-size: 0.85em; margin: 0; }
.plan-wait { display: flex; gap: 12px; align-items: center; margin-top: 12px; }
.plan-done { margin-top: 12px; font-weight: 600; }
.plan-line { margin-top: 4px; }

/* The card's setup in the share panel: size, and what shows */
.share-card-setup { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 0 0 10px; }
.share-card-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 0.9em; cursor: pointer; }
.share-card-preview.portrait { display: flex; justify-content: center; }
.share-card-preview.portrait img { width: auto; max-width: 100%; max-height: 340px; aspect-ratio: auto; }

/* The automatic close check under each of the closest catalogue results (catalogue.rs) */
.catalogue-close { font-size: 0.85em; color: var(--text-muted); white-space: nowrap; }

/* The method appendix (appendix.rs): printed only */
.print-appendix { display: none; }
.print-appendix h2 { font-size: 1.2rem; margin: 0 0 8px; }
.print-appendix h3 { font-size: 0.95rem; margin: 14px 0 4px; }
.appendix-table { border-collapse: collapse; }
.appendix-table th, .appendix-table td { text-align: left; padding: 2px 12px 2px 0; vertical-align: top; }
.appendix-hash { font-family: "Cascadia Mono", monospace; font-size: 0.75rem; word-break: break-all; }
.appendix-note { margin-top: 12px; font-style: italic; }

/* The other-version check (cover_check.rs) */
.cover-check .cover-warning { color: var(--text-muted); font-size: 0.9em; }
.cover-check .cover-note { color: var(--text-muted); font-size: 0.85em; }

/* The browser's own parts (scrollbars, form controls) follow the theme, as in the house (house.css) */
:root { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark; } }

/* Settings › Updates: the desktop app's website editions (components/updates.rs) */
.update-choices {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.update-choice {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    color: var(--ink);
    cursor: pointer;
}

.update-choice input {
    margin: 0;
    accent-color: var(--accent, currentColor);
}

.update-line {
    margin: 2px 0 0;
    font-size: 0.8125rem;
    color: var(--ink-2);
    line-height: 1.4;
}

.ontiqo-about .update-line {
    margin: 4px 0 8px;
    text-align: center;
}

.update-error {
    color: var(--ink);
}

.update-now {
    border: none;
    background: none;
    padding: 0;
    font: inherit;
    font-weight: 600;
    color: var(--ink);
    text-decoration: underline;
    cursor: pointer;
}

/* ===================================================================================================================
   Design language v2 (19 Nov 2026), the house's (ontiqo-company DESIGN_SYSTEM.md), so the app matches sonalize.app and
   the site's drawings of it: four stepped grey surfaces, 1px hairlines with a lit top edge, soft light in the product's
   ice behind the top of the page, one product colour for the main action, the score and the bars, and mono for facts.
   Track A stays ice and Track B ember. The same page is the web app and every OS app.
   =================================================================================================================== */
:root {
    --e0: #F4F4F4; --e1: #FFFFFF; --e2: #F7F7F7; --e3: rgb(255 255 255 / .78);
    --ground: var(--e0); --surface: var(--e1); --raised: var(--e2);
    --line: rgb(0 0 0 / .08); --line-2: rgb(0 0 0 / .15);
    --hi: inset 0 1px 0 0 rgb(255 255 255 / .9);
    --shadow-1: 0 1px 2px rgb(0 0 0 / .05);
    --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 12px 32px -14px rgb(0 0 0 / .2);
    --elev-card: var(--hi), var(--shadow-1);
    --ink: #1B1B1B; --ink-2: #525252; --ink-3: #6B6B6B;
    --product: #017A9E; --product-ink: #017A9E; --on-product: #FFFFFF; --product-wash: #E3F2F9;
    --accent: var(--product); --on-accent: var(--on-product);
    --glow-strength: 16%;
    --r-card: 16px;
}
:root[data-theme="dark"] {
    --e0: #0E0E0E; --e1: #161616; --e2: #1E1E1E; --e3: rgb(22 22 22 / .72);
    --ground: var(--e0); --surface: var(--e1); --raised: var(--e2);
    --line: rgb(255 255 255 / .08); --line-2: rgb(255 255 255 / .15);
    --hi: inset 0 1px 0 0 rgb(255 255 255 / .1);
    --shadow-1: 0 1px 2px rgb(0 0 0 / .5);
    --shadow: 0 1px 2px rgb(0 0 0 / .5), 0 14px 34px -14px rgb(0 0 0 / .8);
    --elev-card: var(--hi), var(--shadow-1);
    --ink: #EDEDED; --ink-2: #B4B4B4; --ink-3: #8F8F8F;
    --product: #01A2C5; --product-ink: #01A2C5; --on-product: #0B1622; --product-wash: #0B2833;
    --accent: var(--product); --on-accent: var(--on-product);
    --glow-strength: 30%;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --e0: #0E0E0E; --e1: #161616; --e2: #1E1E1E; --e3: rgb(22 22 22 / .72);
        --ground: var(--e0); --surface: var(--e1); --raised: var(--e2);
        --line: rgb(255 255 255 / .08); --line-2: rgb(255 255 255 / .15);
        --hi: inset 0 1px 0 0 rgb(255 255 255 / .1);
        --shadow-1: 0 1px 2px rgb(0 0 0 / .5);
        --shadow: 0 1px 2px rgb(0 0 0 / .5), 0 14px 34px -14px rgb(0 0 0 / .8);
        --elev-card: var(--hi), var(--shadow-1);
        --ink: #EDEDED; --ink-2: #B4B4B4; --ink-3: #8F8F8F;
        --product: #01A2C5; --product-ink: #01A2C5; --on-product: #0B1622; --product-wash: #0B2833;
        --accent: var(--product); --on-accent: var(--on-product);
        --glow-strength: 30%;
    }
}

/* light and a dot matrix behind the top of the page, faded out down and to the sides (never behind running text at
   full strength) */
.app-layout { position: relative; isolation: isolate; }
.app-layout::before {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 760px; z-index: -1; pointer-events: none;
    background:
        radial-gradient(60% 70% at 50% 0%, color-mix(in srgb, var(--product) calc(var(--glow-strength) * 1.2), transparent), transparent 70%),
        radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--ink) 16%, transparent) 1px, transparent 1.4px) 0 0 / 22px 22px;
    -webkit-mask-image: radial-gradient(70% 90% at 50% 0%, #000 30%, transparent 78%);
    mask-image: radial-gradient(70% 90% at 50% 0%, #000 30%, transparent 78%);
}

/* the header: floating glass, as the site's */
.navbar {
    background: var(--e3);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    backdrop-filter: saturate(1.4) blur(14px);
    border-bottom: 1px solid var(--line);
    box-shadow: none;
}
.btn-demo, .btn-icon { background: var(--e1); border-color: var(--line-2); box-shadow: var(--hi), var(--shadow-1); }
.btn-demo:hover:not(:disabled), .btn-icon:hover { background: var(--e2); border-color: var(--line-2); }

/* surfaces: hairline, lit top edge, a resting shadow */
.card { border-color: var(--line); box-shadow: var(--elev-card); }
.mode-tabs-bar { background: var(--e2); border-color: var(--line); border-radius: 12px; box-shadow: inset 0 1px 2px rgb(0 0 0 / .04); }
.mode-pill.active { background: var(--e1); box-shadow: var(--hi), 0 1px 2px rgb(0 0 0 / .12); }

/* the main action in the product's colour, as on the site */
.btn-analyze { background: var(--product); color: var(--on-product); box-shadow: var(--hi), 0 1px 2px rgb(0 0 0 / .12), 0 6px 18px -8px color-mix(in srgb, var(--product) 70%, transparent); }
.btn-analyze:hover:not(:disabled) { opacity: 1; filter: brightness(1.06); }
.btn-secondary { background: var(--e1); border-color: var(--line-2); box-shadow: var(--hi), var(--shadow-1); }
.btn-secondary:hover:not(:disabled) { background: var(--e2); }

/* the analysis steps: quiet until active, a product mark once done */
.stage-pill { background: var(--e2); border-color: var(--line); }
.stage-pill.active { border-color: var(--product); color: var(--ink); background: var(--e1); }
.stage-pill.completed { border-color: color-mix(in srgb, var(--product) 45%, var(--line)); color: var(--ink-2); }
.progress-ticker { background: var(--e2); border-left-color: var(--product); }

/* the score: one ring in the product's colour (the band says how alike in words, with its own dot), lit like the
   site's score panel */
.hero-gauge-wrapper::before {
    content: ""; position: absolute; inset: -18px; border-radius: 50%; z-index: 0; pointer-events: none;
    background: radial-gradient(closest-side, color-mix(in srgb, var(--product) calc(var(--glow-strength) * 1.1), transparent), transparent);
}
.hero-gauge-wrapper > svg { position: relative; z-index: 1; }
.hero-gauge-wrapper > .gauge-value-overlay { z-index: 2; }

/* the four measures: one family, the bars in the product's colour (no colour per measure) */
.sub-card { border-top: 1px solid var(--line); }
.sub-card.sub-harmonic, .sub-card.sub-melody, .sub-card.sub-timbre, .sub-card.sub-groove { border-top-color: var(--line); }
.sub-weight-badge { background: var(--e2); border-color: var(--line); }
.sub-bar-fill { background: var(--product); }

/* the eyebrow above a card's title: mono capitals with the product's square, as the site's */
.hero-subheading {
    font-family: var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--product-ink);
}
/* the band, as the site draws it: a mono tag in the product's wash, its dot in the band's own colour */
.status-pill { font-family: var(--font-mono); font-size: .75rem; background: var(--product-wash); border: 1px solid color-mix(in srgb, var(--product) 40%, transparent); color: var(--product-ink); }

/* sheets: a floating window, as the site's, with the page dimmed behind (the settings sheet is opened without
   showModal, so it has no ::backdrop of its own: a wide shadow does it) */
dialog.settings-modal, dialog.unlock-sheet {
    border-color: var(--line-2);
    box-shadow: 0 0 0 100vmax rgb(0 0 0 / .35), var(--hi), 0 2px 6px rgb(0 0 0 / .1), 0 30px 70px -24px rgb(0 0 0 / .45);
    z-index: 100;
}
dialog.share-sheet, dialog.about-dialog { border-color: var(--line-2); box-shadow: var(--hi), 0 2px 6px rgb(0 0 0 / .1), 0 30px 70px -24px rgb(0 0 0 / .45); }

/* the empty state: the mark at the size the site's eyebrow and headline give it, not a poster */
.hero-mark svg { height: 64px; }
.hero-headline { font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.1rem); letter-spacing: -0.025em; line-height: 1.15; }

/* phones: the brand and the settings and About buttons on one row, the two demo pairs side by side under it (was
   three rows); the analysis steps two by two */
@media (max-width: 600px) {
    :root:not([data-frame]) .navbar { flex-direction: row; flex-wrap: wrap; align-items: center; row-gap: 0.6rem; column-gap: 0.5rem; }
    :root:not([data-frame]) .navbar-actions { display: contents; }
    :root:not([data-frame]) .navbar .btn-icon { order: 1; }
    :root:not([data-frame]) .navbar .navbar-brand { order: 0; margin-right: auto; }
    :root:not([data-frame]) .navbar .btn-demo { order: 2; flex: 1 1 40%; min-width: 0; justify-content: center; padding: 0 0.5rem; }
    :root:not([data-frame]) .navbar .btn-demo span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .stage-pills-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* the demo pairs are a test fixture: hidden for everyone but local copies and the self-test (app.rs show_demo) */
.btn-demo[hidden] { display: none !important; }
