:root {
    color-scheme: dark;
    --bg: #070a12;
    --panel: #0d111d;
    --panel-raised: #111725;
    --line: rgba(159, 176, 205, 0.14);
    --line-strong: rgba(159, 176, 205, 0.24);
    --text: #eef3fb;
    --muted: #8693aa;
    --blue: #2588ff;
    --yellow: #f4df22;
    --red: #ff4f72;
    --green: #5ee7a7;
    --radius: 18px;
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI',
        'Microsoft YaHei', sans-serif;
    font-synthesis: none;
}

* {
    box-sizing: border-box;
}

html,
body,
#app {
    min-width: 320px;
    min-height: 100%;
    margin: 0;
}

body {
    background: radial-gradient(circle at 35% -20%, rgba(71, 69, 177, 0.16), transparent 38%),
        var(--bg);
    color: var(--text);
}

button,
input,
select {
    font: inherit;
}

button {
    color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

.app-shell {
    min-height: 100vh;
}

.topbar {
    position: sticky;
    z-index: 30;
    top: 0;
    display: grid;
    grid-template-columns: auto minmax(200px, 1fr) auto auto;
    align-items: center;
    min-height: 76px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--line);
    background: rgba(7, 10, 18, 0.86);
    backdrop-filter: blur(22px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 13px;
    min-width: 196px;
}

.brand > div {
    display: flex;
    align-items: baseline;
    gap: 7px;
}

.brand strong {
    font-size: 20px;
    letter-spacing: -0.04em;
}

.brand span {
    color: #8291a9;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.18em;
}

.brand-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: 39px;
    height: 39px;
    border: 1px solid rgba(91, 154, 255, 0.28);
    border-radius: 11px;
    background: linear-gradient(145deg, rgba(37, 136, 255, 0.21), rgba(92, 50, 200, 0.08));
    box-shadow: 0 8px 24px rgba(20, 80, 210, 0.14);
}

.brand-mark i {
    width: 2px;
    border-radius: 4px;
    background: linear-gradient(#45d8e7, #5179ff);
    box-shadow: 0 0 6px #2588ff;
}

.brand-mark i:nth-child(1),
.brand-mark i:nth-child(5) {
    height: 9px;
}

.brand-mark i:nth-child(2),
.brand-mark i:nth-child(4) {
    height: 20px;
}

.brand-mark i:nth-child(3) {
    height: 29px;
}

.source-status {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    padding-left: 16px;
}

.source-status div {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.source-status strong,
.source-status span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.source-status strong {
    font-size: 13px;
    font-weight: 650;
}

.source-status span {
    color: var(--muted);
    font-size: 11px;
}

.status-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #687285;
    box-shadow: 0 0 0 4px rgba(104, 114, 133, 0.1);
}

.status-dot.playing {
    background: var(--green);
    box-shadow: 0 0 0 4px rgba(94, 231, 167, 0.1), 0 0 12px rgba(94, 231, 167, 0.5);
    animation: pulse 1.8s ease-in-out infinite;
}

.status-dot.loading-file,
.status-dot.loading-mic {
    background: var(--yellow);
}

@keyframes pulse {
    50% {
        opacity: 0.55;
    }
}

.session-clock {
    display: grid;
    justify-items: end;
    gap: 2px;
    min-width: 94px;
    padding: 0 20px;
    border-right: 1px solid var(--line);
}

.session-clock span {
    color: var(--muted);
    font-size: 10px;
}

.session-clock strong {
    font-variant-numeric: tabular-nums;
    font-size: 14px;
    letter-spacing: 0.05em;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 18px;
}

.button,
.icon-button,
.view-actions button,
.panel-actions button {
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.025);
    cursor: pointer;
    transition: 150ms ease;
}

.button {
    min-height: 39px;
    padding: 0 15px;
    font-size: 12px;
    font-weight: 650;
}

.button:hover,
.icon-button:hover,
.view-actions button:hover,
.panel-actions button:hover {
    border-color: rgba(122, 158, 220, 0.48);
    background: rgba(255, 255, 255, 0.07);
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.35;
}

.button.primary {
    border-color: #277ee0;
    background: linear-gradient(180deg, #338eff, #176dd4);
    box-shadow: 0 8px 24px rgba(37, 136, 255, 0.18);
}

.button.danger {
    border-color: rgba(255, 79, 114, 0.55);
    color: #ff9aad;
    background: rgba(255, 79, 114, 0.11);
}

.record-icon {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 7px;
    border-radius: 50%;
    background: currentColor;
}

.icon-button {
    display: grid;
    width: 39px;
    height: 39px;
    place-items: center;
}

.sliders-icon,
.sliders-icon::before,
.sliders-icon::after {
    position: relative;
    display: block;
    width: 15px;
    height: 1px;
    background: #aeb9ca;
}

.sliders-icon::before,
.sliders-icon::after {
    position: absolute;
    content: '';
}

.sliders-icon::before {
    top: -5px;
}

.sliders-icon::after {
    top: 5px;
}

.workspace {
    position: relative;
    display: block;
    width: 100%;
    margin: 0 auto;
    padding: 0;
}

.media-panel {
    position: fixed;
    z-index: 32;
    top: 94px;
    left: 12px;
    display: grid;
    width: min(330px, calc(100vw - 24px));
    max-height: calc(100vh - 98px);
    grid-template-rows: auto auto minmax(0, 1fr);
    padding: 12px;
    border: 1px solid rgba(143, 166, 207, 0.22);
    border-radius: 14px;
    background: rgba(7, 11, 19, 0.94);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateX(calc(-100% - 20px));
    pointer-events: none;
    backdrop-filter: blur(18px);
    will-change: transform;
    transition: 180ms ease;
}

.media-panel.open {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.media-panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 4px 11px;
}

.media-panel-heading > .panel-drag-handle {
    display: grid;
    min-width: 0;
    flex: 1;
    gap: 3px;
    cursor: move;
    user-select: none;
}

.media-panel-heading strong {
    font-size: 14px;
}

.media-panel-heading strong small {
    margin-left: 7px;
    color: #718097;
    font-size: 9px;
    font-weight: 650;
}

.media-panel-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

.media-panel-heading button {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    color: #8794a8;
    background: transparent;
    cursor: pointer;
}

.media-panel-heading button.clear-playlist {
    width: auto;
    padding: 0 7px;
    font-size: 9px;
}

.media-panel-heading button:disabled {
    opacity: 0.35;
    cursor: default;
}

.media-panel.collapsed {
    width: min(210px, calc(100vw - 24px));
    max-height: 52px;
    grid-template-rows: auto;
    padding: 8px 10px;
    overflow: hidden;
}

.media-panel.collapsed .media-panel-heading {
    padding: 0;
}

.media-panel.collapsed .eyebrow,
.media-panel.collapsed .clear-playlist,
.media-panel.collapsed > .media-row,
.media-panel.collapsed .media-list {
    display: none;
}

.media-list {
    display: grid;
    align-content: start;
    gap: 6px;
    min-height: 0;
    margin-top: 8px;
    overflow: auto;
}

.media-row {
    display: flex;
    align-items: center;
    min-width: 0;
    min-height: 58px;
    gap: 9px;
    padding: 7px 9px;
    border: 1px solid rgba(126, 148, 186, 0.14);
    border-radius: 10px;
    color: #cbd5e3;
    text-align: left;
    background: rgba(255, 255, 255, 0.025);
}

button.media-row {
    width: 100%;
    cursor: pointer;
}

.media-row.active {
    border-color: rgba(37, 136, 255, 0.58);
    background: rgba(37, 136, 255, 0.11);
    box-shadow: inset 3px 0 #2588ff;
}

.media-row.microphone {
    border-color: rgba(94, 231, 167, 0.2);
}

.media-select {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1;
    gap: 9px;
    padding: 0;
    border: 0;
    color: inherit;
    text-align: left;
    background: transparent;
    cursor: pointer;
}

.media-kind {
    display: grid;
    width: 38px;
    height: 32px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 7px;
    color: #7fb5ff;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.08em;
    background: rgba(37, 136, 255, 0.1);
}

.microphone .media-kind {
    color: #77e8b2;
    background: rgba(94, 231, 167, 0.1);
}

.media-copy {
    display: grid;
    min-width: 0;
    flex: 1;
    gap: 4px;
}

.media-copy strong,
.media-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-copy strong {
    font-size: 11px;
}

.media-copy small,
.media-empty {
    color: #6f7c91;
    font-size: 8px;
}

.media-save,
.media-remove {
    padding: 6px 7px;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    color: #9eb0c8;
    font-size: 8px;
    background: transparent;
    cursor: pointer;
}

.media-remove {
    color: #a78790;
}

.media-remove:hover {
    border-color: rgba(255, 79, 114, 0.4);
    color: #ff9bad;
}

.media-empty {
    margin: 8px;
    line-height: 1.7;
}

.visualizer-card,
.metrics-panel,
.settings-panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(155deg, rgba(17, 23, 37, 0.96), rgba(10, 14, 24, 0.96));
    box-shadow: 0 20px 70px rgba(0, 0, 0, 0.2);
}

.visualizer-card {
    min-width: 0;
    min-height: calc(100vh - 76px);
    border: 0;
    border-radius: 0;
    overflow: hidden;
    background: #05070d;
    box-shadow: none;
}

.visualizer-toolbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    min-height: 67px;
    gap: 18px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
}

.toolbar-center {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    gap: 14px;
    flex-wrap: wrap;
}

.mode-switch {
    display: flex;
    gap: 3px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(3, 5, 11, 0.54);
}

.mode-switch button {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 39px;
    padding: 0 12px;
    border: 0;
    border-radius: 8px;
    color: #99a6ba;
    background: transparent;
    cursor: pointer;
}

.mode-switch button.active {
    color: #f5f8fd;
    background: #1b2435;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.mode-switch strong {
    font-size: 12px;
}

.mode-switch span {
    color: #748198;
    font-size: 9px;
    font-weight: 600;
}

.overlay-toggles {
    display: flex;
    align-items: center;
    gap: 11px;
}

.overlay-toggles button {
    padding: 5px 2px;
    border: 0;
    color: #69768c;
    font-size: 11px;
    background: transparent;
    cursor: pointer;
}

.overlay-toggles button.on {
    color: #d5ddea;
}

.overlay-toggles i {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 4px;
    border-radius: 50%;
    background: currentColor;
}

.overlay-toggles .on.pitch i {
    color: var(--blue);
    box-shadow: 0 0 8px var(--blue);
}

.overlay-toggles .on.formants i {
    color: var(--red);
    box-shadow: 0 0 8px var(--red);
}

.overlay-toggles .on.intensity i {
    color: var(--yellow);
    box-shadow: 0 0 8px var(--yellow);
}

.view-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.view-actions button {
    min-width: 28px;
    height: 30px;
}

.view-actions span {
    min-width: 38px;
    color: #8e9bb0;
    text-align: center;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}

.view-actions .export-button {
    min-width: auto;
    margin-left: 6px;
    padding: 0 10px;
    color: #bcc7d8;
    font-size: 10px;
}

.view-actions .icon-action,
.transport-control {
    display: grid;
    padding: 0;
    place-items: center;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    color: #b9c6d9;
    background: rgba(255, 255, 255, 0.035);
    cursor: pointer;
}

.view-actions .icon-action svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.view-actions button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.view-actions button:disabled:hover {
    border-color: var(--line-strong);
    background: rgba(255, 255, 255, 0.025);
}

.transport-control {
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    border-radius: 50%;
}

.transport-control svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.transport-control.play {
    border-color: rgba(61, 211, 137, 0.5);
    color: #70edae;
    background: rgba(42, 184, 112, 0.13);
}

.transport-control.pause {
    border-color: rgba(255, 79, 114, 0.55);
    color: #ff718c;
    background: rgba(255, 79, 114, 0.13);
}

.reset-tab-button {
    min-height: 30px;
    padding: 0 9px;
    border: 1px solid rgba(105, 174, 255, 0.28);
    border-radius: 7px;
    color: #a9cdfc;
    font-size: 10px;
    background: rgba(37, 136, 255, 0.07);
    cursor: pointer;
}

.praat-view {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) 96px;
    min-height: calc(100vh - 143px);
    background: #05070d;
}

.plot-stack {
    display: grid;
    grid-template-rows: minmax(500px, calc(100vh - 208px)) 32px 18px;
    min-width: 0;
    padding-top: 15px;
}

.spectrogram-stage {
    position: relative;
    min-height: 500px;
    overflow: hidden;
    border: 1px solid rgba(175, 191, 220, 0.2);
    background: #03050b;
    cursor: crosshair;
}

.spectrogram-stage canvas,
.plot-grid {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

#spectrogramCanvas {
    background: #02040a;
}

#analysisOverlay {
    z-index: 3;
}

.plot-grid {
    z-index: 2;
    display: grid;
    grid-template-rows: repeat(4, 1fr);
    pointer-events: none;
}

.plot-grid i {
    border-bottom: 1px solid rgba(194, 207, 231, 0.075);
}

.plot-grid::after {
    position: absolute;
    inset: 0;
    content: '';
    background-image: linear-gradient(
        90deg,
        transparent calc(25% - 0.5px),
        rgba(194, 207, 231, 0.055) 25%,
        transparent calc(25% + 0.5px),
        transparent calc(50% - 0.5px),
        rgba(194, 207, 231, 0.055) 50%,
        transparent calc(50% + 0.5px),
        transparent calc(75% - 0.5px),
        rgba(194, 207, 231, 0.055) 75%,
        transparent calc(75% + 0.5px)
    );
}

.cursor-tooltip {
    position: absolute;
    z-index: 5;
    display: grid;
    min-width: 126px;
    gap: 3px;
    padding: 9px 11px;
    border: 1px solid rgba(162, 180, 211, 0.25);
    border-radius: 8px;
    color: #cbd5e4;
    background: rgba(5, 8, 15, 0.9);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    backdrop-filter: blur(10px);
}

.cursor-tooltip strong {
    color: #fff;
    font-size: 13px;
}

.cursor-tooltip span {
    font-size: 11px;
}

.cursor-tooltip .tooltip-selection {
    margin-top: 3px;
    padding-top: 5px;
    border-top: 1px solid rgba(105, 174, 255, 0.3);
    color: #8fc0ff;
    font-weight: 700;
}

.cursor-time-mark {
    position: absolute;
    z-index: 6;
    bottom: 5px;
    padding: 3px 6px;
    border: 1px solid rgba(255, 79, 114, 0.5);
    border-radius: 5px;
    color: #ff9bad;
    font-size: 8px;
    font-variant-numeric: tabular-nums;
    background: rgba(9, 12, 20, 0.9);
    transform: translateX(-50%);
    pointer-events: none;
}

.selection-reading {
    position: absolute;
    z-index: 6;
    top: 12px;
    left: 50%;
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 6px 9px;
    border: 1px solid rgba(105, 174, 255, 0.4);
    border-radius: 7px;
    color: #88bcff;
    font-size: 8px;
    font-variant-numeric: tabular-nums;
    background: rgba(6, 13, 25, 0.88);
    transform: translateX(-50%);
    pointer-events: none;
}

.selection-reading strong {
    color: #ffffff;
    font-size: 11px;
}

.timeline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #758299;
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.history-slider {
    width: 100%;
    height: 2px;
    margin: 0;
    opacity: 0.5;
    accent-color: var(--blue);
}

.zoom-scrollbar {
    position: relative;
    width: 100%;
    height: 14px;
    margin: 2px 0 0;
    padding: 2px;
    box-sizing: border-box;
    border: 1px solid rgba(137, 156, 188, 0.22);
    border-radius: 3px;
    opacity: 0.88;
    background: #090d16;
    background: #111827;
    touch-action: none;
    cursor: pointer;
}

.zoom-scrollbar-thumb {
    position: absolute;
    top: 2px;
    bottom: 2px;
    min-width: 18px;
    border: 1px solid #6f7f98;
    box-sizing: border-box;
    border-radius: 2px;
    background: #536078;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    cursor: grab;
    pointer-events: none;
}

.zoom-scrollbar:active .zoom-scrollbar-thumb {
    border-color: #98a9c2;
    background: #65738c;
    cursor: grabbing;
}

.zoom-scrollbar:focus-visible {
    outline: 1px solid var(--blue);
    outline-offset: 1px;
}

.file-transport {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    min-width: 0;
    color: #8491a5;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.file-transport .history-slider {
    width: 100%;
    height: 4px;
    opacity: 0.72;
}

.file-transport span {
    position: absolute;
    top: 16px;
    padding: 1px 4px;
    border-radius: 4px;
    color: #9ba8bc;
    font-size: 10px;
    background: rgba(5, 7, 13, 0.82);
    pointer-events: none;
}

.file-transport .transport-current {
    left: 2px;
}

.file-transport .transport-duration {
    right: 2px;
}

.axis {
    position: relative;
    min-width: 0;
    color: #adb8c9;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.axis span {
    position: absolute;
    white-space: nowrap;
}

.axis-title {
    top: 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.axis-left {
    margin-top: 15px;
    border-right: 1px solid var(--line);
    text-align: right;
}

.axis-left .axis-title {
    right: 10px;
}

.axis-left .top,
.axis-left .mid,
.axis-left .bottom,
.axis-left .spectral-pitch-mark {
    right: 10px;
}

.axis-left .top {
    top: 20px;
}

.axis-left .mid {
    top: calc(50% - 4px);
}

.axis-left .bottom {
    bottom: 79px;
}

.spectral-pitch-mark {
    transform: translateY(8px);
}

.axis-right {
    margin-top: 15px;
    border-left: 1px solid var(--line);
}

.axis-right .axis-title,
.axis-right .top,
.axis-right .bottom {
    left: 10px;
}

.axis-right .intensity-axis-title {
    right: auto;
    left: -10px;
    transform: translateX(-100%);
}

.axis-right .frequency-axis-title {
    left: 10px;
}

.axis-right .top {
    top: 20px;
}

.axis-right .bottom {
    bottom: 79px;
}

.axis-right .spl-top,
.axis-right .spl-mid,
.axis-right .spl-bottom {
    right: auto;
    left: -10px;
    transform: translateX(-100%);
}

.axis-right .spl-top {
    top: 20px;
}

.axis-right .spl-mid {
    top: calc(50% - 4px);
}

.axis-right .spl-bottom {
    bottom: 79px;
}

.axis-cursor-value {
    z-index: 4;
    padding: 3px 5px;
    border-radius: 4px;
    font-weight: 750;
    font-size: 12px;
    background: #111827;
    transform: translateY(-50%);
}

.axis-left .axis-cursor-value {
    right: 4px;
}

.axis-left .axis-cursor-value.pitch {
    color: #d9ebff;
    border-right: 2px solid #3696ff;
}

.axis-right .axis-cursor-value {
    left: 4px;
}

.axis-right .axis-cursor-value.frequency {
    color: #ffd8df;
    border-left: 2px solid #ff4f72;
}

.pitch-color {
    color: #3696ff !important;
}

.intensity-color {
    color: #dcea46 !important;
}

.metrics-panel {
    position: fixed;
    z-index: 18;
    top: 94px;
    right: 20px;
    display: flex;
    width: 296px;
    min-width: 258px;
    min-height: 470px;
    max-width: min(520px, calc(100vw - 40px));
    max-height: calc(100vh - 112px);
    flex-direction: column;
    padding: 20px;
    overflow: auto;
    resize: both;
    background: linear-gradient(155deg, rgba(17, 23, 37, 0.88), rgba(10, 14, 24, 0.92));
    backdrop-filter: blur(22px);
    will-change: transform;
    transition: width 180ms ease, min-height 180ms ease, border-radius 180ms ease,
        padding 180ms ease;
}

.metrics-drag-handle {
    flex: 1;
    cursor: move;
    user-select: none;
}

.media-panel.dragging,
.metrics-panel.dragging,
.media-panel.dragging *,
.metrics-panel.dragging * {
    cursor: grabbing !important;
}

.metrics-panel.bubble {
    top: 98px;
    width: 92px !important;
    min-width: 92px;
    height: 92px !important;
    min-height: 92px;
    max-height: 92px;
    padding: 0;
    overflow: hidden;
    resize: none;
    border-color: rgba(37, 136, 255, 0.35);
    border-radius: 50%;
    background: radial-gradient(circle at 38% 30%, rgba(71, 139, 255, 0.26), transparent 48%),
        rgba(10, 15, 27, 0.9);
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.36), 0 0 34px rgba(37, 136, 255, 0.13);
    cursor: move;
    user-select: none;
}

.metrics-panel.bubble > *:not(.collapsed-reading) {
    display: none;
}

.collapsed-reading {
    display: none;
}

.metrics-panel.bubble .collapsed-reading {
    display: grid;
    width: 100%;
    height: 100%;
    padding: 15px 8px 12px;
    place-content: center;
    place-items: center;
    border: 0;
    color: #eef6ff;
    background: transparent;
    cursor: move;
}

.collapsed-reading span,
.collapsed-reading em {
    color: #6fb0ff;
    font-size: 8px;
    font-style: normal;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.collapsed-reading strong {
    max-width: 75px;
    overflow: hidden;
    font-size: 23px;
    font-weight: 560;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.06em;
    text-overflow: ellipsis;
}

.metrics-heading,
.settings-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.metrics-heading-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.metrics-heading-actions button {
    display: grid;
    width: 25px;
    height: 25px;
    padding: 0;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: #95a3b8;
    background: rgba(255, 255, 255, 0.025);
    cursor: pointer;
}

.eyebrow,
.section-label {
    color: #74829a;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.metrics-heading h2,
.settings-header h2 {
    margin: 5px 0 0;
    font-size: 17px;
    letter-spacing: -0.035em;
}

.sample-rate {
    padding: 5px 7px;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: #8e9bb0;
    font-size: 9px;
}

.playhead-time {
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.primary-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 21px;
}

.primary-metrics article {
    min-width: 0;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.025);
}

.metric-label {
    display: block;
    margin-bottom: 8px;
    font-size: 9px;
    font-weight: 700;
}

.primary-metrics strong {
    color: #f8fbff;
    font-size: clamp(25px, 2.2vw, 33px);
    font-weight: 540;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.06em;
}

.primary-metrics em,
.formant-metrics em {
    margin-left: 4px;
    color: #8290a6;
    font-size: 9px;
    font-style: normal;
}

.primary-metrics small {
    display: block;
    overflow: hidden;
    margin-top: 8px;
    color: #657289;
    font-size: 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.formant-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 8px;
}

.formant-metrics article {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.018);
}

.formant-metrics span {
    display: block;
    margin-bottom: 5px;
    color: var(--red);
    font-size: 9px;
    font-weight: 700;
}

.formant-metrics strong {
    font-size: 15px;
    font-weight: 570;
    font-variant-numeric: tabular-nums;
}

.statistics {
    margin-top: 23px;
    padding-top: 17px;
    border-top: 1px solid var(--line);
}

.statistics dl {
    margin: 12px 0 0;
}

.statistics dl div {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(159, 176, 205, 0.08);
}

.statistics dt {
    color: #7d899d;
    font-size: 10px;
}

.statistics dd {
    margin: 0;
    color: #d6dfed;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}

.calibration-note {
    margin: 18px 0 0;
    color: #5f6c81;
    font-size: 8px;
    line-height: 1.6;
}

.panel-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    margin-top: auto;
    padding-top: 20px;
}

.panel-actions button {
    min-height: 35px;
    color: #9da9bb;
    font-size: 9px;
}

.settings-panel {
    position: fixed;
    z-index: 60;
    top: 88px;
    right: 18px;
    display: grid;
    width: min(390px, calc(100vw - 36px));
    max-height: calc(100vh - 106px);
    gap: 17px;
    padding: 22px;
    overflow-y: auto;
    transform: translateX(calc(100% + 30px));
    opacity: 0;
    transition: 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.settings-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 3px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(3, 6, 12, 0.55);
}

.settings-tabs button {
    min-width: 0;
    height: 33px;
    padding: 0 4px;
    border: 0;
    border-radius: 7px;
    color: #6f7d93;
    font-size: 11px;
    font-weight: 650;
    background: transparent;
    cursor: pointer;
}

.settings-tabs button.active {
    color: #e5edf8;
    background: #1a2333;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.settings-tab-content {
    display: grid;
    gap: 18px;
}

.reset-tab-button {
    justify-self: end;
    color: #9fbde4;
    font-size: 11px;
}

.settings-panel.open {
    transform: translateX(0);
    opacity: 1;
}

.settings-header button {
    width: 31px;
    height: 31px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: #9ba7ba;
    font-size: 19px;
    background: transparent;
    cursor: pointer;
}

.setting {
    display: grid;
    gap: 11px;
}

.setting > span {
    display: flex;
    justify-content: space-between;
    color: #9aa6b9;
    font-size: 12px;
}

.setting em {
    color: #d5dce8;
    font-style: normal;
    font-variant-numeric: tabular-nums;
}

.setting input,
.history-slider {
    accent-color: var(--blue);
}

.setting input {
    width: 100%;
}

.select-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.select-row.one {
    grid-template-columns: 1fr;
}

.select-row label {
    color: #8895aa;
    font-size: 11px;
}

.select-row select {
    width: 100%;
    height: 36px;
    margin-top: 7px;
    padding: 0 8px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    color: #d4ddea;
    background: #0c111d;
}

.palette-setting > span {
    color: #8895aa;
    font-size: 11px;
}

.palette-setting > div {
    display: flex;
    gap: 9px;
    margin-top: 10px;
}

.palette-setting button {
    width: 35px;
    height: 35px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 9px;
    cursor: pointer;
}

.palette-setting button.active {
    border-color: #e9f0fb;
    box-shadow: 0 0 0 2px rgba(37, 136, 255, 0.45);
}

.palette-setting small {
    display: block;
    margin-top: 7px;
    color: #68758a;
    font-size: 10px;
}

.mode-explainer {
    padding: 14px;
    border: 1px solid rgba(37, 136, 255, 0.18);
    border-radius: 11px;
    background: rgba(37, 136, 255, 0.055);
}

.setting-help {
    margin: -2px 0 0;
    padding: 11px 12px;
    border-left: 2px solid rgba(37, 136, 255, 0.45);
    color: #6d7b90;
    font-size: 11px;
    line-height: 1.65;
    background: rgba(37, 136, 255, 0.035);
}

.mode-explainer strong {
    color: #bcd8ff;
    font-size: 12px;
}

.mode-explainer p {
    margin: 7px 0 0;
    color: #79879c;
    font-size: 11px;
    line-height: 1.65;
}

.settings-backdrop {
    position: fixed;
    z-index: 50;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: rgba(0, 0, 0, 0.35);
    cursor: default;
}

@media (max-width: 1100px) {
    .topbar {
        grid-template-columns: auto 1fr auto;
    }

    .session-clock {
        display: none;
    }

    .metrics-panel {
        top: 86px;
        right: 12px;
    }

    .primary-metrics,
    .statistics dl {
        max-width: none;
    }
}

@media (max-width: 760px) {
    .topbar {
        grid-template-columns: 1fr auto;
        min-height: 66px;
        padding: 10px 13px;
    }

    .source-status {
        display: none;
    }

    .brand {
        min-width: 0;
    }

    .top-actions {
        padding-left: 0;
    }

    .top-actions .button.secondary {
        display: none;
    }

    .workspace {
        padding: 0;
    }

    .visualizer-toolbar {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .mode-switch {
        grid-column: 1 / -1;
        width: 100%;
    }

    .toolbar-center {
        justify-content: flex-start;
    }

    .mode-switch button {
        flex: 1;
        justify-content: center;
    }

    .praat-view {
        grid-template-columns: 44px minmax(0, 1fr) 65px;
        min-height: calc(100vh - 175px);
    }

    .plot-stack {
        grid-template-rows: minmax(400px, calc(100vh - 238px)) 28px 18px;
    }

    .spectrogram-stage {
        min-height: 400px;
    }

    .axis-right .spl-top,
    .axis-right .spl-mid,
    .axis-right .spl-bottom {
        display: none;
    }

    .axis-title {
        display: none;
    }

    .primary-metrics strong {
        font-size: 26px;
    }
}
