:root {
    --bg: #0f1115;
    --surface: #181a22;
    --surface-2: #1f222b;
    --border: #2a2e3a;
    --text: #f1f1f4;
    --muted: #8b8f9a;
    --accent: #5b8cff;
    --accent-2: #8f5bff;
    --success: #22c98c;
    --danger: #ff5f7b;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    --radius: 16px;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #f5f6fb;
        --surface: #ffffff;
        --surface-2: #f0f2f8;
        --border: #e4e6ee;
        --text: #1a1c22;
        --muted: #6e7280;
        --shadow: 0 8px 24px rgba(60, 70, 110, 0.12);
    }
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto,
        Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
}

.browser-block {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(1200px 600px at 50% -10%, rgba(91, 140, 255, 0.18), transparent 60%),
        radial-gradient(800px 400px at 50% 110%, rgba(143, 91, 255, 0.18), transparent 60%),
        var(--bg);
    padding: 24px;
    z-index: 9999;
}

.bb-card {
    max-width: 420px;
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 36px 28px;
    text-align: center;
    box-shadow: var(--shadow);
}

.bb-icon {
    font-size: 64px;
    margin-bottom: 14px;
    filter: drop-shadow(0 4px 16px rgba(91, 140, 255, 0.35));
}

.bb-title {
    margin: 0 0 8px;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}

.bb-text {
    margin: 0 0 24px;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.5;
}

.bb-btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    font-size: 15px;
    transition: transform 0.12s ease, filter 0.12s ease;
}

.bb-btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.bb-btn:active { transform: translateY(0); }

.app {
    max-width: 720px;
    margin: 0 auto;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom)) 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 4px 4px;
}

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

.logo {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 22px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: var(--shadow);
}

.title {
    font-size: 18px;
    margin: 0;
    font-weight: 700;
}

.subtitle {
    font-size: 12px;
    margin: 2px 0 0;
    color: var(--muted);
}

.hidden {
    display: none !important;
}

.visible {
    display: block;
}

.picker .dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 36px 18px;
    background: var(--surface);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s;
}

.picker .dropzone.dragover {
    border-color: var(--accent);
    transform: scale(1.01);
}

.picker .dropzone input[type="file"] {
    display: none;
}

.dz-icon {
    font-size: 42px;
}

.dz-title {
    font-size: 18px;
    font-weight: 600;
}

.dz-hint {
    color: var(--muted);
    font-size: 13px;
}

.dz-formats {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.dz-formats span {
    background: var(--surface-2);
    color: var(--muted);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

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

.file-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    color: var(--muted);
}

.file-meta b {
    color: var(--text);
}

.player-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.player {
    width: 100%;
    max-height: 50vh;
    background: #000;
    display: block;
}

.audio-card {
    padding: 32px 16px 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.audio-icon {
    font-size: 64px;
    width: 100px;
    height: 100px;
    border-radius: 24px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: var(--shadow);
}

.audio-name {
    font-weight: 600;
    color: var(--text);
    word-break: break-word;
}

.audio-player {
    width: 100%;
    max-width: 480px;
}

.timeline-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.timeline {
    position: relative;
    height: 36px;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.track {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    right: 0;
    height: 8px;
    background: var(--surface-2);
    border-radius: 4px;
}

.range {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 8px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    border-radius: 4px;
    left: 0%;
    right: 0%;
}

.handle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 22px;
    height: 36px;
    border-radius: 8px;
    background: var(--text);
    box-shadow: var(--shadow);
    cursor: grab;
    display: grid;
    place-items: center;
}

.handle:active {
    cursor: grabbing;
}

.handle::after {
    content: "";
    width: 4px;
    height: 18px;
    border-left: 2px solid var(--accent);
    border-right: 2px solid var(--accent);
}

.handle-start {
    left: 0%;
}

.handle-end {
    left: 100%;
}

.playhead {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 28px;
    background: var(--danger);
    border-radius: 2px;
    pointer-events: none;
    left: 0%;
    opacity: 0.85;
}

.timeline-labels {
    display: flex;
    justify-content: space-between;
    font-variant-numeric: tabular-nums;
    font-size: 13px;
    font-weight: 600;
}

.time-label.muted {
    color: var(--muted);
    font-weight: 500;
}

.length {
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

.actions {
    display: flex;
    gap: 10px;
}

.btn {
    flex: 1;
    border: none;
    border-radius: 12px;
    padding: 14px 18px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.08s, opacity 0.15s, background 0.15s;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: white;
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
}

.progress, .success, .error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
}

.spinner {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 4px solid var(--surface-2);
    border-top-color: var(--accent);
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.progress-text {
    color: var(--muted);
    font-size: 14px;
}

.success-emoji, .error-emoji {
    font-size: 56px;
}

.success-title, .error-title {
    font-size: 20px;
    font-weight: 700;
}

.success-text, .error-text {
    color: var(--muted);
    font-size: 14px;
    max-width: 320px;
}

.error-text {
    word-break: break-word;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    background: var(--surface-2);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
}
