.voice,
.voice-box,
.voice-public {
    --voice-modal-w: 560px;
    --voice-rec: var(--danger);
    --voice-rec-fg: #ffffff;
    --voice-mark: var(--accent);
    --voice-mark-fg: var(--accent-contrast);
    --voice-bar: 3px;
    --voice-bar-gap: 2px;
    --voice-play-lg: 56px;
    --voice-player-pad: 20px;
    --voice-wave-sm: 32px;
    --voice-wave-lg: 56px;
    --voice-ring: 128px;
    --voice-foot-h: 64px;
    --voice-gutter: 20px;
    --voice-pad: 24px;
    --voice-btn-h: 44px;
    --voice-btn-font: 14px;
}

.voice [hidden],
.voice-box [hidden] {
    display: none;
}

.voice-empty {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0 0;
    padding: 16px 18px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    font-size: 13.5px;
    color: var(--text-3);
}

.voice-empty .icon {
    flex: none;
}

.voice-public + .detail-bio,
.voice-public + .bio-tr {
    margin-top: 18px;
}

.voice-public-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-3);
}

.voice-saved {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 10px 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.voice-play {
    display: grid;
    flex: none;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-contrast);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.15s ease;
}

.voice-play-lg {
    width: var(--voice-play-lg);
    height: var(--voice-play-lg);
}

.voice-play:hover {
    background: var(--accent-hover);
}

.voice-play:active {
    transform: scale(0.95);
}

.voice-play:disabled {
    opacity: 0.6;
    cursor: progress;
}

.voice-play .icon {
    fill: currentColor;
    stroke: none;
}

.voice-play .ico-pause,
.voice-play.is-playing .ico-play {
    display: none;
}

.voice-play.is-playing .ico-pause {
    display: block;
}

.voice-wave {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: space-between;
    gap: var(--voice-bar-gap);
    min-width: 0;
    height: var(--voice-wave-sm);
    overflow: hidden;
}

.voice-wave-lg {
    height: var(--voice-wave-lg);
}

.voice-wave i {
    flex: 0 1 var(--voice-bar);
    min-width: 1px;
    height: 100%;
    border-radius: 999px;
    background: var(--text-3);
    opacity: 0.45;
    transform: scaleY(var(--lv, 0.06));
    transition: transform 0.09s linear, opacity 0.2s ease, background-color 0.2s ease;
}

.voice-wave i.is-played {
    background: var(--text);
    opacity: 1;
}

.voice-clock {
    flex: none;
    min-width: 38px;
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.voice-clock-sm {
    min-width: 0;
    font-size: 13px;
    color: var(--text-3);
}

.voice-modal {
    padding: var(--voice-gutter);
}

.voice-modal .modal {
    width: min(var(--voice-modal-w), calc(100vw - var(--voice-gutter) * 2));
    max-width: none;
    max-height: calc(calc(var(--dvh) * 100) - var(--voice-gutter) * 2);
    padding: var(--voice-pad);
    overflow-y: auto;
}

.voice-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin: 2px 0 18px;
}

.voice-steps span {
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-3);
}

.voice-steps span::before {
    content: "";
    height: 3px;
    border-radius: 999px;
    background: var(--surface-2);
    transition: background-color 0.3s ease;
}

.voice-steps span.is-on {
    color: var(--text);
}

.voice-steps span.is-on::before {
    background: var(--text);
}

.voice-intro {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.voice-lead {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
}

.voice-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius);
    background: var(--surface-2);
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--text-2);
}

.voice-notice .icon {
    margin-top: 1px;
    color: var(--text);
}

.voice-tips {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 4px 2px 0;
    list-style: none;
}

.voice-tips li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13.5px;
    color: var(--text-2);
}

.voice-tips i {
    display: grid;
    flex: none;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text);
}

.voice-prompt {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 22px 18px;
    border-radius: var(--radius);
    background: var(--surface-2);
    overflow: hidden;
}

.voice-prompt-label {
    font-size: 11.5px;
    font-weight: 650;
    color: var(--text-3);
    transition: opacity 0.3s ease;
}

.voice-script {
    margin: 0;
    font-size: 19px;
    font-weight: 560;
    line-height: 1.75;
    letter-spacing: -0.005em;
    color: var(--text);
    text-wrap: pretty;
    transition: opacity 0.35s ease, filter 0.35s ease;
}

.voice-word {
    border-radius: 5px;
    transition: color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.voice-box[data-state="recording"] .voice-prompt-label,
.voice-box[data-state="countdown"] .voice-prompt-label {
    opacity: 0;
}

.voice-box[data-state="recording"] .voice-word {
    color: var(--text-3);
}

.voice-box[data-state="recording"] .voice-word.is-read {
    color: var(--text);
}

.voice-box[data-state="recording"] .voice-word.is-current {
    background: var(--voice-mark);
    box-shadow: 0 0 0 3px var(--voice-mark);
    color: var(--voice-mark-fg);
}

.voice-count {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.voice-box[data-state="countdown"] .voice-count {
    opacity: 1;
}

.voice-box[data-state="countdown"] .voice-script {
    opacity: 0.12;
    filter: blur(2px);
}

.voice-ring {
    position: relative;
    display: grid;
    place-items: center;
    width: var(--voice-ring);
    height: var(--voice-ring);
}

.voice-ring svg {
    position: absolute;
    inset: 0;
    transform: rotate(-90deg);
}

.voice-ring circle {
    fill: none;
    stroke-width: 4;
}

.voice-ring-track {
    stroke: color-mix(in srgb, var(--text) 10%, transparent);
}

.voice-ring-bar {
    stroke: var(--voice-rec);
    stroke-linecap: round;
    stroke-dasharray: 364.4;
    stroke-dashoffset: 364.4;
}

.voice-ring.is-run .voice-ring-bar {
    animation: voice-ring 1s linear forwards;
}

.voice-num {
    font-family: var(--font-mono);
    font-size: 52px;
    font-weight: 500;
    line-height: 1;
    color: var(--text);
}

.voice-num.is-tick {
    animation: voice-tick 0.45s var(--dialog-settle) both;
}

.voice-player {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: var(--voice-player-pad);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.voice-player-row {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.voice-player-meta {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
    color: var(--text-3);
}

.voice-review-note {
    margin: 14px 0 0;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--text-2);
}

.voice-alert {
    margin: 14px 0 0;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.voice-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: var(--voice-foot-h);
    margin-top: 18px;
}

.voice-foot > .btn {
    flex: 1;
    min-height: var(--voice-btn-h);
    font-size: var(--voice-btn-font);
    white-space: nowrap;
}

.voice-foot-note {
    flex: 1;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-3);
}

.voice-foot-note:not([hidden]) ~ .btn {
    flex: none;
}

.voice-btn-rec {
    background: var(--voice-rec);
    color: var(--voice-rec-fg);
}

.voice-btn-rec:hover {
    background: color-mix(in srgb, var(--voice-rec) 88%, #000000);
}

.voice-btn-rec.is-busy::after {
    border-color: var(--voice-rec-fg);
    border-top-color: transparent;
}

.voice-recbar {
    display: flex;
    flex: 1;
    min-width: 0;
    align-items: center;
    gap: 14px;
    height: var(--voice-foot-h);
    padding: 0 10px 0 18px;
    border: 1px solid color-mix(in srgb, var(--voice-rec) 28%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--voice-rec) 10%, var(--surface));
}

.voice-recdot {
    flex: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--voice-rec);
    animation: voice-blink 1.2s ease-in-out infinite;
}

.voice-wave-live i {
    background: var(--voice-rec);
    opacity: 1;
}

.voice-stop {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 16px 0 14px;
    border: 0;
    border-radius: 999px;
    background: var(--voice-rec);
    color: var(--voice-rec-fg);
    font: inherit;
    font-size: 14px;
    font-weight: 650;
    cursor: pointer;
}

.voice-stop b {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    background: currentColor;
}

.voice-box-inline .voice-notice {
    margin: 0 0 14px;
}

.voice-box-inline.is-started .voice-notice {
    display: none;
}

.voice-box-inline .voice-foot {
    justify-content: center;
    min-height: 0;
    margin-top: 14px;
}

.voice-box-inline .voice-foot > .btn {
    flex: none;
}

@keyframes voice-ring {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes voice-tick {
    from {
        opacity: 0;
        transform: scale(1.35);
    }
}

@keyframes voice-blink {
    50% {
        opacity: 0.25;
    }
}

@media (max-width: 560px) {
    .voice,
    .voice-box {
        --voice-gutter: 10px;
        --voice-pad: 16px;
        --voice-btn-h: 40px;
        --voice-btn-font: 13.5px;
        --voice-foot-h: 52px;
        --voice-ring: 104px;
        --voice-bar-gap: 1px;
        --voice-play-lg: 48px;
        --voice-player-pad: 14px;
    }

    .voice-player-row {
        gap: 12px;
    }

    .voice-modal .modal-header {
        margin-bottom: 10px;
    }

    .voice-steps {
        margin-bottom: 14px;
    }

    .voice-script {
        font-size: 16px;
        line-height: 1.7;
    }

    .voice-prompt {
        padding: 12px 14px 14px;
    }

    .voice-foot {
        justify-content: flex-end;
        gap: 8px;
        margin-top: 14px;
    }

    .voice-foot > .btn {
        flex: none;
        padding-inline: 14px;
    }

    .voice-foot-note {
        font-size: 12.5px;
    }

    .voice-num {
        font-size: 42px;
    }

    .voice-recbar {
        gap: 8px;
        padding: 0 6px 0 12px;
    }

    .voice-stop {
        height: 40px;
        padding: 0 12px 0 11px;
        font-size: 13.5px;
    }

    .voice-saved {
        gap: 10px;
    }

    .voice-foot:has(.voice-foot-note:not([hidden])) {
        flex-wrap: wrap;
    }

    .voice-foot-note:not([hidden]) {
        flex-basis: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .voice-wave i,
    .voice-word,
    .voice-play,
    .voice-script {
        transition: none;
    }

    .voice-recdot,
    .voice-ring.is-run .voice-ring-bar,
    .voice-num.is-tick {
        animation: none;
    }
}
