* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(99, 102, 241, 0.22), transparent 28%),
        radial-gradient(circle at top right, rgba(16, 185, 129, 0.14), transparent 24%),
        radial-gradient(circle at bottom center, rgba(59, 130, 246, 0.18), transparent 26%),
        linear-gradient(160deg, #060816 0%, #0b1020 45%, #111827 100%);
    min-height: 100vh;
    padding: 20px;
    color: #e5e7eb;
}

.container {
    max-width: 980px;
    margin: 0 auto;
}

.header {
    background: rgba(15, 23, 42, 0.78);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(148, 163, 184, 0.16);
    box-shadow: 0 20px 50px rgba(2, 6, 23, 0.35);
    backdrop-filter: blur(16px);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo h1 {
    font-size: 24px;
    color: #f8fafc;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(30, 41, 59, 0.92);
    border-radius: 20px;
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9ca3af;
    animation: pulse 2s infinite;
}

.status.online .status-dot {
    background: #10b981;
}

.status.offline .status-dot {
    background: #ef4444;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    font-size: 14px;
    color: #cbd5e1;
    font-weight: 500;
}

.card {
    background: rgba(15, 23, 42, 0.82);
    border-radius: 16px;
    padding: 32px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    box-shadow: 0 20px 50px rgba(2, 6, 23, 0.32);
    backdrop-filter: blur(18px);
    margin-bottom: 24px;
}

.card-main {
    margin-bottom: 24px;
}

.card h2 {
    font-size: 28px;
    color: #f8fafc;
    margin-bottom: 8px;
}

.description {
    color: #94a3b8;
    margin-bottom: 20px;
    font-size: 15px;
    line-height: 1.7;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 8px;
    font-size: 14px;
}

textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
    background: rgba(15, 23, 42, 0.86);
    color: #f8fafc;
}

textarea:focus {
    outline: none;
    border-color: #818cf8;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.16);
    background: rgba(15, 23, 42, 0.96);
}

textarea::placeholder {
    color: #64748b;
}

input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
    background: rgba(15, 23, 42, 0.86);
    color: #f8fafc;
}

input[type="text"]:focus {
    outline: none;
    border-color: #818cf8;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.16);
    background: rgba(15, 23, 42, 0.96);
}

input[type="text"]::placeholder {
    color: #64748b;
}

input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg, rgba(79, 70, 229, 0.9), rgba(59, 130, 246, 0.85));
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #f8fafc;
    border: 3px solid #4f46e5;
    cursor: pointer;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.18);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #f8fafc;
    cursor: pointer;
    border: 3px solid #4f46e5;
}

.file-upload {
    position: relative;
}

.file-upload input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.file-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: rgba(15, 23, 42, 0.76);
    border: 1px dashed rgba(129, 140, 248, 0.42);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.file-label:hover {
    background: rgba(30, 41, 59, 0.96);
    border-color: #818cf8;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.file-icon {
    font-size: 24px;
}

.file-text {
    color: #cbd5e1;
    font-weight: 500;
}

.record-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0;
    color: #64748b;
    font-size: 13px;
}

.record-divider::before,
.record-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(148, 163, 184, 0.14);
}

.recorder-panel {
    padding: 16px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(15, 23, 42, 0.58);
}

.recorder-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.recorder-title {
    font-size: 15px;
    font-weight: 700;
    color: #f8fafc;
}

.recorder-timer {
    min-width: 58px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.12);
    color: #cbd5e1;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.recorder-tip {
    color: #94a3b8;
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 16px;
}

.recorder-meter {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    align-items: end;
    gap: 6px;
    height: 48px;
    margin-bottom: 16px;
}

.recorder-meter span {
    display: block;
    height: 12px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.95), rgba(56, 189, 248, 0.55));
    opacity: 0.32;
    transform-origin: center bottom;
    animation: equalize 1.1s ease-in-out infinite;
    animation-play-state: paused;
}

.recorder-meter span:nth-child(2n) {
    animation-duration: 0.95s;
}

.recorder-meter span:nth-child(3n) {
    animation-duration: 1.25s;
}

.recorder-meter span:nth-child(4n) {
    animation-duration: 0.8s;
}

.recorder-panel[data-state="recording"] .recorder-meter span {
    animation-play-state: running;
    opacity: 0.95;
}

.recorder-panel[data-state="ready"] .recorder-meter span {
    opacity: 0.7;
}

.recorder-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.recorder-status {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(30, 41, 59, 0.64);
    border: 1px solid rgba(148, 163, 184, 0.1);
    color: #cbd5e1;
    font-size: 14px;
}

.recorder-guidance {
    margin-top: 10px;
    color: #94a3b8;
    font-size: 13px;
    line-height: 1.6;
}

.recorder-panel[data-state="recording"] .recorder-status {
    color: #fde68a;
    border-color: rgba(250, 204, 21, 0.22);
    background: rgba(113, 63, 18, 0.18);
}

.recorder-panel[data-state="ready"] .recorder-status {
    color: #bbf7d0;
    border-color: rgba(74, 222, 128, 0.2);
    background: rgba(20, 83, 45, 0.22);
}

.recorder-panel[data-state="error"] .recorder-status {
    color: #fecaca;
    border-color: rgba(248, 113, 113, 0.24);
    background: rgba(127, 29, 29, 0.22);
}

.recorder-preview {
    margin-top: 14px;
}

.recorder-preview audio {
    width: 100%;
}

#preset-save {
    width: 100%;
    justify-content: center;
}

@keyframes equalize {
    0%, 100% {
        transform: scaleY(0.35);
    }
    50% {
        transform: scaleY(1);
    }
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 8px;
}

.section-tip {
    color: #94a3b8;
    font-size: 13px;
}

.voice-mode-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 10px;
    padding: 10px;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.82), rgba(15, 23, 42, 0.64));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.voice-mode-btn {
    min-height: 72px;
    padding: 14px 16px;
    border: 1px solid rgba(129, 140, 248, 0.16);
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.18);
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.voice-mode-btn::after {
    content: "";
    position: absolute;
    inset: auto auto 0 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, rgba(99, 102, 241, 0), rgba(99, 102, 241, 0.9), rgba(56, 189, 248, 0));
    opacity: 0;
    transition: opacity 0.25s ease;
}

.voice-mode-label {
    font-size: 15px;
    font-weight: 700;
    color: inherit;
}

.voice-mode-meta {
    font-size: 12px;
    line-height: 1.5;
    color: #94a3b8;
    transition: color 0.25s ease;
}

.voice-mode-btn:hover {
    border-color: rgba(129, 140, 248, 0.62);
    transform: translateY(-1px);
    background: rgba(30, 41, 59, 0.32);
}

.voice-mode-btn.active {
    color: #fff;
    border-color: rgba(99, 102, 241, 0.95);
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.86), rgba(37, 99, 235, 0.88));
    box-shadow: 0 14px 30px rgba(79, 70, 229, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.voice-mode-btn.active::after {
    opacity: 1;
}

.voice-mode-btn.active .voice-mode-meta {
    color: rgba(224, 231, 255, 0.88);
}

.clone-preset-panel {
    margin-top: 16px;
    padding: 16px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(15, 23, 42, 0.5);
}

.clone-preset-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.clone-preset-title {
    color: #e2e8f0;
    font-size: 14px;
    font-weight: 700;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.preset-card {
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 14px;
    padding: 12px;
    background: rgba(15, 23, 42, 0.74);
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.preset-card:hover {
    border-color: rgba(129, 140, 248, 0.72);
    transform: translateY(-2px);
    box-shadow: 0 18px 35px rgba(2, 6, 23, 0.34);
}

.preset-card.active {
    border-color: rgba(99, 102, 241, 0.95);
    background: linear-gradient(180deg, rgba(49, 46, 129, 0.34), rgba(15, 23, 42, 0.92));
    box-shadow: 0 18px 38px rgba(79, 70, 229, 0.18);
}

.preset-select {
    border: none;
    background: transparent;
    text-align: left;
    padding: 0;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.preset-name {
    font-size: 14px;
    font-weight: 700;
    color: #f8fafc;
}

.preset-mode {
    font-size: 11px;
    font-weight: 600;
    color: #a5b4fc;
    letter-spacing: 0.04em;
}

.preset-desc {
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.5;
}

.preset-preview {
    width: 100%;
    filter: saturate(0.92) brightness(0.94);
}

.audio-preview-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.audio-preview-wrap-compact {
    gap: 6px;
}

.audio-preview-element {
    width: 100%;
    filter: saturate(0.92) brightness(0.94);
}

.audio-preview-element-hidden {
    display: none;
}

.audio-preview-toggle {
    width: 32px;
    height: 32px;
    padding: 0;
    position: relative;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border-radius: 999px;
    align-self: center;
    flex-shrink: 0;
    color: #f8fafc;
    border: 1px solid rgba(129, 140, 248, 0.42);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.94), rgba(37, 99, 235, 0.9));
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.14);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.audio-preview-toggle::before {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.02));
    opacity: 0.9;
    pointer-events: none;
}

.audio-preview-toggle:hover {
    transform: translateY(-1px) scale(1.03);
    border-color: rgba(167, 180, 255, 0.7);
    box-shadow: 0 12px 22px rgba(37, 99, 235, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.audio-preview-toggle:active {
    transform: scale(0.96);
}

.audio-preview-toggle[data-state="playing"] {
    border-color: rgba(34, 197, 94, 0.55);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.96), rgba(14, 165, 233, 0.88));
    box-shadow: 0 10px 20px rgba(16, 185, 129, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.audio-preview-icon {
    position: relative;
    width: 12px;
    height: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    filter: drop-shadow(0 1px 1px rgba(15, 23, 42, 0.16));
}

.audio-preview-icon-play,
.audio-preview-icon-pause {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.audio-preview-icon-play::before {
    content: "";
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 9px solid currentColor;
    margin-left: 2px;
}

.audio-preview-icon-pause {
    gap: 3px;
    opacity: 0;
    transform: scale(0.85);
}

.audio-preview-icon-pause span {
    width: 3px;
    height: 12px;
    border-radius: 999px;
    background: currentColor;
}

.audio-preview-toggle[data-state="playing"] .audio-preview-icon-play {
    opacity: 0;
    transform: scale(0.85);
}

.audio-preview-toggle[data-state="playing"] .audio-preview-icon-pause {
    opacity: 1;
    transform: scale(1);
}

.audio-preview-hint {
    font-size: 11px;
    color: #94a3b8;
    line-height: 1.5;
    text-align: center;
}

.preset-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.preset-action-btn {
    padding: 8px 12px;
    border: 1px solid rgba(129, 140, 248, 0.42);
    border-radius: 8px;
    background: rgba(49, 46, 129, 0.26);
    color: #c7d2fe;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-action-btn:hover {
    background: #4f46e5;
    border-color: #6366f1;
    color: #fff;
}

.preset-action-btn.danger {
    border-color: rgba(248, 113, 113, 0.34);
    background: rgba(127, 29, 29, 0.18);
    color: #fca5a5;
}

.preset-action-btn.danger:hover {
    border-color: #dc2626;
    background: #dc2626;
    color: #fff;
}

.selected-preset {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 14px;
    background: rgba(30, 41, 59, 0.88);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 10px;
    color: #e2e8f0;
    font-weight: 600;
}

.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 12px 30px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #1d4ed8 100%);
    transform: translateY(-2px);
    box-shadow: 0 16px 34px rgba(79, 70, 229, 0.32);
}

.btn-primary:disabled {
    background: linear-gradient(135deg, #475569 0%, #64748b 100%);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-icon {
    font-size: 18px;
}

.result {
    margin-top: 24px;
}

.audio-player {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.audio-meta {
    color: #cbd5e1;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}

.audio-player audio {
    width: 100%;
    margin-bottom: 12px;
}

.result-audio {
    margin-bottom: 12px;
}

.audio-actions {
    display: flex;
    gap: 12px;
}

.btn-secondary {
    padding: 10px 20px;
    background: rgba(30, 41, 59, 0.92);
    color: #c7d2fe;
    border: 1px solid rgba(129, 140, 248, 0.4);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: #4f46e5;
    color: white;
    border-color: #6366f1;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #cbd5e1;
}

.spinner {
    border: 3px solid rgba(148, 163, 184, 0.16);
    border-top: 3px solid #818cf8;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    background: rgba(127, 29, 29, 0.34);
    color: #fecaca;
    border: 1px solid rgba(248, 113, 113, 0.28);
    padding: 16px;
    border-radius: 8px;
    margin-top: 16px;
}

.success {
    background: rgba(20, 83, 45, 0.36);
    color: #bbf7d0;
    border: 1px solid rgba(74, 222, 128, 0.24);
    padding: 16px;
    border-radius: 8px;
    margin-top: 16px;
}

.empty-state,
.loading-inline {
    padding: 20px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.72);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.12);
    text-align: center;
}

@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    .header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .card {
        padding: 20px;
    }

    .section-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .voice-mode-switch {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        padding: 8px;
    }

    .voice-mode-btn {
        min-height: 64px;
        padding: 12px;
    }

    .voice-mode-label {
        font-size: 14px;
    }

    .voice-mode-meta {
        font-size: 11px;
        line-height: 1.4;
    }

    .clone-preset-panel {
        margin-top: 12px;
        padding: 12px;
    }

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

    .preset-card {
        padding: 10px;
    }

    .preset-name {
        font-size: 12px;
    }

    .preset-mode {
        font-size: 10px;
    }

    .preset-desc {
        font-size: 11px;
    }

    .audio-preview-toggle {
        width: 28px;
        height: 28px;
    }

    .audio-preview-icon {
        width: 10px;
        height: 10px;
    }

    .audio-preview-icon-play::before {
        border-top-width: 5px;
        border-bottom-width: 5px;
        border-left-width: 8px;
        margin-left: 2px;
    }

    .audio-preview-icon-pause span {
        width: 3px;
        height: 10px;
    }

    .audio-preview-hint {
        font-size: 10px;
    }

    .preset-actions {
        gap: 8px;
    }

    .preset-action-btn {
        width: 100%;
        justify-content: center;
        padding: 8px 10px;
        font-size: 12px;
    }

}
