:root {
    color-scheme: light;
    --bg: #f5f7fb;
    --ink: #172033;
    --muted: #667085;
    --line: #d9e1ec;
    --panel: #ffffff;
    --accent: #e33d55;
    --accent-dark: #b8223a;
    --green: #177e55;
    --blue: #255fae;
    --shadow: 0 24px 70px rgba(25, 42, 70, 0.14);
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        linear-gradient(135deg, rgba(227, 61, 85, 0.12), transparent 28%),
        linear-gradient(315deg, rgba(37, 95, 174, 0.14), transparent 30%),
        var(--bg);
}

button,
a,
input {
    font: inherit;
}

.shell {
    display: grid;
    min-height: 100vh;
    padding: 16px;
    place-items: center;
}

.studio-panel {
    width: min(100%, 560px);
    padding: clamp(14px, 3vw, 28px);
    border: 1px solid rgba(217, 225, 236, 0.9);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
}

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

.eyebrow {
    margin: 0 0 5px;
    color: var(--blue);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1 {
    max-width: 520px;
    margin: 0;
    font-size: clamp(1.65rem, 5.6vw, 3.1rem);
    line-height: 1;
    letter-spacing: 0;
}

.level-pill {
    flex: 0 0 auto;
    min-width: 94px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--green);
    font-size: 0.86rem;
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
}

.recorder {
    display: grid;
    margin: 14px 0 14px;
    place-items: center;
    text-align: center;
}

.mic-panel {
    display: grid;
    width: 100%;
    gap: 6px;
    margin-bottom: 12px;
    text-align: left;
}

.mic-select-label {
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 900;
}

select {
    width: 100%;
    min-height: 36px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    background: #ffffff;
    font: inherit;
    font-weight: 750;
}

.meter {
    height: 8px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #eef2f7;
}

.meter span {
    display: block;
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--green), #f4b740, var(--accent));
    transition: width 80ms linear;
}

.mic-name {
    min-height: 18px;
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.35;
}

.record-button {
    display: grid;
    width: min(34vw, 132px);
    aspect-ratio: 1;
    padding: 12px;
    border: 0;
    border-radius: 50%;
    color: #ffffff;
    background: radial-gradient(circle at 35% 25%, #ff7a8c, var(--accent) 62%, var(--accent-dark));
    box-shadow: 0 14px 30px rgba(227, 61, 85, 0.32);
    cursor: pointer;
    place-items: center;
    touch-action: manipulation;
}

.record-button:disabled {
    cursor: progress;
    filter: saturate(0.75);
}

.record-button.is-recording {
    animation: pulse 1.15s ease-in-out infinite;
    background: radial-gradient(circle at 35% 25%, #ff4d4d, #c6192f 64%, #8d1424);
}

.mic-ring {
    display: grid;
    width: 64%;
    aspect-ratio: 1;
    border: 3px solid rgba(255, 255, 255, 0.62);
    border-radius: 50%;
    place-items: center;
}

.mic-icon {
    width: 60%;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 7;
}

.record-text {
    display: block;
    margin-top: 7px;
    color: var(--accent-dark);
    font-size: 0.94rem;
    font-weight: 900;
}

.status {
    min-height: 26px;
    max-width: 440px;
    margin: 9px 0 1px;
    color: var(--muted);
    font-size: 0.94rem;
    line-height: 1.45;
}

.timer {
    margin: 0;
    color: var(--ink);
    font-size: 1.6rem;
    font-weight: 900;
}

.controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.control {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 800;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--blue);
}

input[type="text"] {
    width: 100%;
    min-height: 36px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    background: #ffffff;
    font-weight: 750;
}

.file-name-control {
    grid-column: 1 / -1;
}

.result {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.tool-grid {
    display: grid;
    gap: 12px;
    margin-top: 24px;
}

.tool-card {
    display: grid;
    gap: 7px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    background: #ffffff;
    text-decoration: none;
}

.tool-card strong {
    font-size: 1rem;
}

.tool-card span {
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.4;
}

.tool-card.is-disabled {
    background: #f8fafc;
    opacity: 0.76;
}

audio {
    width: 100%;
}

.actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.secondary-button,
.mobile-download-button,
.download-button {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    padding: 8px 10px;
    border-radius: 8px;
    font-weight: 900;
    text-decoration: none;
}

.secondary-button {
    border: 1px solid var(--line);
    color: var(--ink);
    background: #ffffff;
    cursor: pointer;
}

.mobile-download-button {
    border: 1px solid var(--green);
    color: #ffffff;
    background: var(--green);
}

.mobile-download-button[aria-disabled="true"] {
    cursor: progress;
    opacity: 0.72;
    pointer-events: none;
}

.download-button {
    border: 1px solid var(--blue);
    color: #ffffff;
    background: var(--blue);
}

@keyframes pulse {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.035);
    }
}

@media (max-width: 560px) {
    .shell {
        padding: 0;
        place-items: stretch;
    }

    .studio-panel {
        min-height: auto;
        padding: 14px;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .title-row {
        display: grid;
    }

    .level-pill {
        justify-self: start;
    }

}

@media (max-width: 420px) {
    .eyebrow {
        margin-bottom: 6px;
        font-size: 0.74rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    .level-pill {
        min-width: 74px;
        padding: 7px 10px;
        font-size: 0.78rem;
    }

    .recorder {
        margin: 12px 0;
    }

    .mic-panel {
        gap: 6px;
        margin-bottom: 12px;
    }

    select {
        min-height: 38px;
        padding: 8px 10px;
        font-size: 0.86rem;
    }

    input[type="text"] {
        min-height: 38px;
        padding: 8px 10px;
        font-size: 0.86rem;
    }

    .record-button {
        width: min(31vw, 116px);
        padding: 10px;
    }

    .record-text {
        margin-top: 5px;
        font-size: 0.86rem;
    }

    .status {
        min-height: 24px;
        margin-top: 7px;
        font-size: 0.78rem;
    }

    .timer {
        font-size: 1.32rem;
    }

    .controls {
        gap: 8px;
        padding: 10px;
    }

    .result {
        gap: 8px;
        margin-top: 8px;
    }

    .secondary-button,
    .mobile-download-button,
    .download-button {
        min-height: 38px;
        padding: 8px 9px;
        font-size: 0.82rem;
    }
}

@media (max-height: 760px) and (max-width: 560px) {
    .studio-panel {
        padding: 10px 14px;
    }

    h1 {
        font-size: 1.36rem;
    }

    .record-button {
        width: min(28vw, 104px);
    }

    .mic-panel {
        margin-bottom: 9px;
    }

    .status {
        min-height: auto;
        margin: 10px 0 2px;
    }

    .timer {
        font-size: 1.2rem;
    }

    audio {
        height: 36px;
    }
}

@media (max-width: 340px) {
    .controls,
    .actions {
        grid-template-columns: 1fr;
    }

    .download-button {
        grid-column: auto;
    }
}
