:root {
    color-scheme: dark;
    --bg: #07070b;
    --card: rgba(255, 255, 255, 0.075);
    --card-strong: rgba(255, 255, 255, 0.11);
    --border: rgba(255, 255, 255, 0.16);
    --text: #f5f7fb;
    --muted: #aeb4c2;
    --muted-2: #788093;
    --accent: #8b5cf6;
    --accent-2: #06b6d4;
    --danger: #fb7185;
    --success: #34d399;
    --shadow: 0 24px 90px rgba(0, 0, 0, 0.45);
    --radius: 24px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(139, 92, 246, 0.28), transparent 34rem),
        radial-gradient(circle at top right, rgba(6, 182, 212, 0.18), transparent 30rem),
        linear-gradient(135deg, #07070b 0%, #10111a 55%, #08080d 100%);
}

button,
input,
select {
    font: inherit;
}

.app-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 40px 0 64px;
}

.glass-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.hero {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 24px;
    align-items: start;
    padding: clamp(24px, 4vw, 44px);
    margin-bottom: 20px;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--accent-2);
    font-size: 0.82rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 700;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    max-width: 850px;
    margin-bottom: 14px;
    font-size: clamp(2rem, 6vw, 4.6rem);
    line-height: 0.96;
    letter-spacing: -0.07em;
}

h2 {
    margin-bottom: 10px;
    font-size: 1.08rem;
    letter-spacing: -0.02em;
}

.subtext,
.panel p,
.action-panel p,
.progress-panel p,
.small-note {
    color: var(--muted);
    line-height: 1.6;
}

.subtext {
    max-width: 720px;
    margin-bottom: 0;
    font-size: 1.04rem;
}

.status-pill {
    justify-self: end;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.09);
    color: var(--muted);
    border: 1px solid var(--border);
    white-space: nowrap;
    font-size: 0.9rem;
}

.status-pill.ok {
    color: var(--success);
}

.status-pill.warn {
    color: #fbbf24;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.panel,
.action-panel,
.progress-panel,
.results-panel {
    padding: 24px;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.primary-button,
.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 18px;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 160ms ease, opacity 160ms ease, background 160ms ease;
    user-select: none;
}

.primary-button {
    color: white;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    font-weight: 750;
}

.secondary-button {
    color: var(--text);
    background: var(--card-strong);
    border: 1px solid var(--border);
}

.primary-button:hover,
.secondary-button:hover {
    transform: translateY(-1px);
}

.primary-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    transform: none;
}

.file-label input {
    display: none;
}

.small-note {
    margin-top: 12px;
    font-size: 0.86rem;
}

.option-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 14px 0;
    color: var(--muted);
}

.option-row input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.field-label {
    display: block;
    margin: 18px 0 8px;
    color: var(--muted);
    font-size: 0.92rem;
}

.mode-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.mode-option {
    cursor: pointer;
}

.mode-option input {
    display: none;
}

.mode-card {
    display: flex;
    flex-direction: column;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    transition: all 160ms ease;
    height: 100%;
}

.mode-option input:checked + .mode-card {
    border-color: var(--accent);
    background: rgba(139, 92, 246, 0.12);
    box-shadow: 0 0 0 1px var(--accent);
}

.mode-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 4px;
}

.mode-desc {
    font-size: 0.78rem;
    color: var(--muted-2);
    line-height: 1.3;
}

.hidden {
    display: none !important;
}

select,
input[type="number"] {
    width: 100%;
    min-height: 44px;
    color: var(--text);
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0 12px;
    outline: none;
}

.action-panel {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    margin-bottom: 20px;
}

.progress-panel {
    margin-bottom: 20px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: start;
}

#progressText {
    color: var(--muted);
    white-space: nowrap;
}

.progress-track {
    width: 100%;
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
}

.progress-bar {
    height: 100%;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    transition: width 240ms ease;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border-radius: 18px;
    border: 1px solid var(--border);
}

table {
    width: 100%;
    min-width: 780px;
    border-collapse: collapse;
}

th,
td {
    padding: 14px 16px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

th {
    color: var(--muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: rgba(255, 255, 255, 0.06);
}

td {
    color: #e9ecf5;
    font-size: 0.95rem;
}

tr:last-child td {
    border-bottom: 0;
}

.empty-cell {
    color: var(--muted-2);
    text-align: center;
}

.status-ok {
    color: var(--success);
}

.status-error {
    color: var(--danger);
}

.status-warn {
    color: #fbbf24;
}

.speech-cell {
    position: relative;
    padding-right: 54px !important;
}

.speech-text {
    max-width: 450px;
    white-space: normal;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: all 200ms ease;
}

.speech-text:hover {
    -webkit-line-clamp: 200;
}

.copy-mini-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--muted);
    cursor: pointer;
    transition: all 160ms ease;
    z-index: 2;
}

.copy-mini-btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--muted);
    transform: translateY(-1px);
}

.copy-mini-btn:active {
    transform: translateY(0);
}

.copy-mini-btn.copied {
    border-color: var(--success);
    background: rgba(52, 211, 153, 0.1);
}

@media (max-width: 820px) {
    .app-shell {
        width: min(100% - 22px, 1180px);
        padding-top: 22px;
    }

    .hero,
    .controls-grid,
    .action-panel {
        grid-template-columns: 1fr;
    }

    .hero {
        display: block;
    }

    .status-pill {
        display: inline-flex;
        margin-top: 20px;
        white-space: normal;
    }

    .controls-grid {
        display: grid;
    }

    .action-panel {
        display: grid;
    }

    .button-row {
        width: 100%;
    }

    .primary-button,
    .secondary-button,
    .file-label {
        width: 100%;
    }

    h1 {
        letter-spacing: -0.05em;
    }
}

@media (max-width: 420px) {
    .app-shell {
        width: calc(100% - 16px);
    }

    .hero,
    .panel,
    .action-panel,
    .progress-panel,
    .results-panel {
        padding: 18px;
        border-radius: 20px;
    }

    h1 {
        font-size: 2.1rem;
    }

    .subtext {
        font-size: 0.95rem;
    }

    table {
        min-width: 680px;
    }
}