:root {
    --cmc-bg: #07111f;
    --cmc-panel: #0e1c2d;
    --cmc-panel-2: #13263a;
    --cmc-border: #28445f;
    --cmc-cyan: #45d7ec;
    --cmc-amber: #f6b94a;
    --cmc-text: #edf7ff;
    --cmc-muted: #a8bfd2;
    --cmc-danger: #ff7b78;
    --cmc-success: #72e1ab;
}

body.cmc-page {
    background: radial-gradient(circle at 15% 0%, #102c45 0, var(--cmc-bg) 35rem);
    color: var(--cmc-text);
}

.cmc-shell {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 2rem 0 4rem;
}

.cmc-hero {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1.5rem;
    align-items: end;
    margin-bottom: 1.5rem;
}

.cmc-eyebrow {
    color: var(--cmc-cyan);
    font: 700 .78rem/1.2 "IBM Plex Mono", monospace;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.cmc-hero h1 {
    margin: .35rem 0 .5rem;
    font-size: clamp(2rem, 5vw, 3.6rem);
    line-height: .98;
}

.cmc-hero p {
    max-width: 58rem;
    color: var(--cmc-muted);
    font-size: 1.05rem;
}

.cmc-speed-readout {
    min-width: 10rem;
    padding: 1rem;
    border: 1px solid var(--cmc-border);
    border-radius: 14px;
    background: rgba(14, 28, 45, .9);
    text-align: right;
    font-family: "IBM Plex Mono", monospace;
}

.cmc-speed-readout strong {
    display: block;
    color: var(--cmc-amber);
    font-size: 1.45rem;
}

.cmc-steps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .5rem;
    margin: 0 0 1.25rem;
    padding: 0;
    list-style: none;
}

.cmc-steps li {
    padding: .65rem .75rem;
    border: 1px solid var(--cmc-border);
    border-radius: 10px;
    color: var(--cmc-muted);
    background: rgba(14, 28, 45, .72);
    font-size: .85rem;
}

.cmc-steps li[aria-current="step"] {
    color: #05131e;
    background: var(--cmc-cyan);
    border-color: var(--cmc-cyan);
    font-weight: 800;
}

.cmc-grid {
    display: grid;
    grid-template-columns: minmax(250px, .7fr) minmax(0, 1.3fr);
    gap: 1rem;
}

.cmc-grid > * {
    min-width: 0;
}

.cmc-card {
    padding: 1.1rem;
    border: 1px solid var(--cmc-border);
    border-radius: 16px;
    background: linear-gradient(145deg, rgba(19, 38, 58, .96), rgba(9, 24, 39, .96));
    box-shadow: 0 18px 50px rgba(0, 0, 0, .18);
}

.cmc-card h2,
.cmc-card h3 {
    margin: 0 0 .75rem;
}

.cmc-toolbar,
.cmc-actions,
.cmc-session-controls {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
    align-items: center;
}

.cmc-field {
    display: grid;
    gap: .35rem;
    margin-bottom: .85rem;
}

.cmc-field label,
.cmc-field legend {
    color: var(--cmc-muted);
    font-size: .84rem;
    font-weight: 700;
}

.cmc-field input,
.cmc-field textarea,
.cmc-field select,
.cmc-search {
    color-scheme: dark;
    width: 100%;
    min-height: 44px;
    padding: .7rem .8rem;
    border: 1px solid #42617c;
    border-radius: 9px;
    background: #071522;
    color: var(--cmc-text);
}

.cmc-field select,
.cmc-field select option {
    background-color: #071522;
    color: var(--cmc-text);
}

.cmc-field select option:checked {
    background-color: #173d59;
    color: #ffffff;
}

.cmc-field textarea {
    min-height: 16rem;
    resize: vertical;
    font-family: "IBM Plex Mono", monospace;
    line-height: 1.55;
}

.cmc-copy-input {
    min-height: 12rem !important;
    font-size: 1rem;
}

.cmc-field input:focus,
.cmc-field textarea:focus,
.cmc-field select:focus,
.cmc-button:focus-visible,
.cmc-message:focus-visible {
    outline: 3px solid var(--cmc-amber);
    outline-offset: 2px;
}

.cmc-button {
    min-height: 44px;
    padding: .65rem .95rem;
    border: 1px solid #42617c;
    border-radius: 9px;
    background: #17314a;
    color: var(--cmc-text);
    cursor: pointer;
    font-weight: 800;
}

.cmc-button:hover:not(:disabled) {
    border-color: var(--cmc-cyan);
}

.cmc-button--primary {
    color: #04131d;
    background: var(--cmc-cyan);
    border-color: var(--cmc-cyan);
}

.cmc-button--amber {
    color: #211400;
    background: var(--cmc-amber);
    border-color: var(--cmc-amber);
}

.cmc-button--danger {
    color: #210504;
    background: var(--cmc-danger);
    border-color: var(--cmc-danger);
}

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

.cmc-message-actions {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: .45rem;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    padding-block: .15rem .35rem;
}

.cmc-message-actions .cmc-button {
    display: inline-flex;
    min-height: 40px;
    min-width: 0;
    padding: .45rem .35rem;
    align-items: center;
    justify-content: center;
    font-size: .74rem;
    line-height: 1.15;
    text-align: center;
    overflow-wrap: anywhere;
    white-space: normal;
}

.cmc-message-list {
    display: grid;
    gap: .5rem;
    max-height: 32rem;
    margin: .8rem 0;
    overflow: auto;
}

.cmc-message {
    width: 100%;
    padding: .75rem;
    border: 1px solid var(--cmc-border);
    border-radius: 10px;
    background: #0a1928;
    color: var(--cmc-text);
    text-align: left;
    cursor: pointer;
}

.cmc-message[aria-current="true"] {
    border-color: var(--cmc-cyan);
    box-shadow: inset 3px 0 var(--cmc-cyan);
}

.cmc-message strong,
.cmc-message span {
    display: block;
}

.cmc-message span {
    margin-top: .3rem;
    color: var(--cmc-muted);
    font-size: .76rem;
}

.cmc-settings-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .6rem;
}

.cmc-settings-grid .cmc-field {
    gap: .25rem;
    margin: 0;
}

.cmc-settings-grid .cmc-field input,
.cmc-settings-grid .cmc-field select {
    min-height: 38px;
    padding: .45rem .6rem;
    font-size: .84rem;
}

.cmc-settings-grid .cmc-field input[type="range"] {
    padding-inline: .1rem;
}

.cmc-configure-actions {
    justify-content: center;
    margin-top: 1rem;
}

.cmc-metrics {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: .45rem;
}

.cmc-validation {
    margin: .85rem 0;
    padding: .8rem;
    border: 1px solid rgba(246, 185, 74, .55);
    border-radius: 8px;
    background: rgba(246, 185, 74, .08);
}

.cmc-validation[data-valid="true"] {
    border-color: var(--cmc-success);
    background: rgba(114, 225, 171, .08);
}

.cmc-live-overview {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: .45rem;
    align-items: stretch;
    width: min(100%, 60rem);
    margin-inline: auto;
}

.cmc-live-overview > * {
    box-sizing: border-box;
}

.cmc-live-source-shield {
    display: grid;
    min-height: 4rem;
    padding: .48rem .55rem;
    place-items: center;
    border: 1px dashed var(--cmc-border);
    border-radius: 12px;
    color: var(--cmc-muted);
    background: #06111d;
    text-align: center;
}

.cmc-live-source-shield span {
    font-size: .75rem;
}

.cmc-stat,
.cmc-metric {
    padding: .48rem .55rem;
    border: 1px solid var(--cmc-border);
    border-radius: 10px;
    background: #091827;
}

.cmc-stat {
    display: grid;
    min-height: 4rem;
    place-content: center;
    text-align: center;
}

.cmc-stat span,
.cmc-metric span {
    display: block;
    color: var(--cmc-muted);
    font-size: .74rem;
}

.cmc-stat strong,
.cmc-metric strong {
    display: block;
    margin-top: .12rem;
    font: 800 .92rem/1.2 "IBM Plex Mono", monospace;
}

.cmc-metric {
    display: grid;
    min-height: 3.15rem;
    place-content: center;
    text-align: center;
}

.cmc-progress {
    width: 100%;
    height: .55rem;
    margin: .55rem 0 .7rem;
    accent-color: var(--cmc-cyan);
}

.cmc-score {
    display: flex;
    gap: .75rem;
    align-items: center;
    justify-content: center;
    margin: 0 0 .7rem;
    text-align: center;
}

.cmc-score-ring {
    display: grid;
    width: 4rem;
    height: 4rem;
    place-items: center;
    border: 4px solid var(--cmc-cyan);
    border-radius: 50%;
    font: 900 1.25rem/1 "IBM Plex Mono", monospace;
}

.cmc-score h3,
.cmc-score p {
    margin: .1rem 0;
}

.cmc-alignment {
    display: grid;
    gap: .55rem;
    max-height: 22rem;
    overflow: auto;
    font-family: "IBM Plex Mono", monospace;
}

.cmc-result-text,
.cmc-inline-diff {
    min-height: 4rem;
    max-height: 12rem;
    padding: .8rem;
    overflow: auto;
    border: 1px solid var(--cmc-border);
    border-radius: 9px;
    background: #06131f;
    color: var(--cmc-text);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-family: "IBM Plex Mono", monospace;
}

.cmc-inline-diff > span:not(.correct) {
    display: inline-block;
    margin: 0 .04rem;
    padding: .06rem .12rem;
    border-radius: 4px;
}

.cmc-inline-diff .correct {
    color: var(--cmc-muted);
}
.cmc-inline-diff .substitution { background: rgba(246, 185, 74, .18); border-bottom: 2px solid var(--cmc-amber); }
.cmc-inline-diff .omission { color: #ffd0cf; background: rgba(255, 123, 120, .18); border-bottom: 2px solid var(--cmc-danger); text-decoration: line-through; }
.cmc-inline-diff .insertion { background: rgba(180, 156, 255, .18); border-bottom: 2px solid #b49cff; }

.cmc-diff-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem 1rem;
    margin: -.35rem 0 .55rem;
    color: var(--cmc-muted);
    font-size: .76rem;
}

.cmc-diff-legend span {
    display: inline-flex;
    gap: .35rem;
    align-items: center;
}

.cmc-legend-swatch {
    width: .75rem;
    height: .35rem;
    border-radius: 2px;
}

.cmc-legend-swatch.substitution { background: var(--cmc-amber); }
.cmc-legend-swatch.omission { background: var(--cmc-danger); }
.cmc-legend-swatch.insertion { background: #b49cff; }

.cmc-recording-note {
    margin: .45rem 0 .75rem;
    color: var(--cmc-muted);
    font-size: .82rem;
    text-align: center;
}

.cmc-alignment-row {
    display: grid;
    grid-template-columns: 7rem 1fr;
    gap: .65rem;
    padding: .65rem;
    border-radius: 8px;
    background: #081724;
}

.cmc-diff-substitution { border: 1px solid rgba(246, 185, 74, .5); }
.cmc-diff-omission { border: 1px solid rgba(255, 123, 120, .5); }
.cmc-diff-insertion { border: 1px solid rgba(180, 156, 255, .5); }

.cmc-table-wrap {
    max-height: 24rem;
    overflow: auto;
}

.cmc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .82rem;
}

.cmc-table th,
.cmc-table td {
    padding: .6rem;
    border-bottom: 1px solid var(--cmc-border);
    text-align: left;
}

.cmc-status {
    min-height: 1.5rem;
    margin: .75rem 0 0;
    color: var(--cmc-muted);
}

.cmc-status[data-tone="error"] { color: var(--cmc-danger); }
.cmc-status[data-tone="success"] { color: var(--cmc-success); }
.cmc-hidden { display: none !important; }

.cmc-review-actions {
    display: grid;
    grid-template-columns: repeat(7, minmax(max-content, 1fr));
    gap: .45rem;
    align-items: stretch;
    overflow-x: auto;
    padding-block: .15rem .35rem;
}

.cmc-review-actions .cmc-button {
    display: inline-flex;
    min-height: 40px;
    padding: .5rem .6rem;
    align-items: center;
    justify-content: center;
    font-size: .78rem;
    line-height: 1.15;
    text-align: center;
    white-space: nowrap;
}

@media (max-width: 820px) {
    .cmc-hero,
    .cmc-grid {
        grid-template-columns: 1fr;
    }
    .cmc-speed-readout { text-align: left; }
    .cmc-settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cmc-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .cmc-live-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cmc-live-source-shield { grid-column: 1 / -1; }
}

@media (max-width: 520px) {
    .cmc-shell { width: min(100% - 1rem, 1180px); padding-top: 1rem; }
    .cmc-steps { grid-template-columns: 1fr 1fr; }
    .cmc-settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cmc-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cmc-score { flex-direction: column; }
    .cmc-alignment-row { grid-template-columns: 1fr; }
}

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