/* Kruli — mobile-first dark UI (Telegram-inspired, original) */

:root {
    --bg-base: #0a0b0e;
    --bg-surface: rgba(22, 25, 33, 0.6);
    --bg-surface-hover: rgba(32, 36, 46, 0.8);
    --bg-surface-solid: #161921;

    --accent-primary: #3b82f6;
    --accent-primary-hover: #2563eb;
    --accent-glow: rgba(59, 130, 246, 0.3);
    --accent-secondary: #475569;

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;

    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-highlight: rgba(255, 255, 255, 0.12);

    --font-main: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Roboto", sans-serif;

    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.4);
    --blur-md: blur(16px);
    --blur-lg: blur(24px);

    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 28px;
    --radius-full: 9999px;

    --transition-fast: 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    --transition-smooth: 0.4s cubic-bezier(0.25, 1, 0.5, 1);

    --theme-color: #0a0b0e;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    width: 100%;
    min-height: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
    width: 100%;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

button {
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    font-family: inherit;
    outline: none;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

.ambient-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100svh;
    z-index: -1;
    background: var(--bg-base);
    overflow: hidden;
}

.ambient-bg::before,
.ambient-bg::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
}

.ambient-bg::before {
    top: -10%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(30, 58, 138, 0.4) 0%, transparent 70%);
}

.ambient-bg::after {
    bottom: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(15, 23, 42, 0.8) 0%, transparent 70%);
}

.app-container {
    max-width: 640px;
    margin: 0 auto;
    width: min(100%, 640px);
    display: flex;
    flex-direction: column;
    flex: 1;
    position: relative;
    padding-bottom: calc(108px + env(safe-area-inset-bottom, 0px));
}

header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: calc(12px + env(safe-area-inset-top, 0px)) clamp(14px, 4vw, 24px) 12px;
    background: rgba(10, 11, 14, 0.7);
    backdrop-filter: var(--blur-md);
    -webkit-backdrop-filter: var(--blur-md);
    border-bottom: 1px solid var(--border-subtle);
}

.logo {
    font-size: clamp(18px, 4.5vw, 20px);
    font-weight: 700;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    width: 24px;
    height: 24px;
    fill: var(--accent-primary);
}

.profile-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-surface);
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid var(--border-subtle);
    transition: var(--transition-fast);
    overflow: hidden;
}

.profile-btn img,
.profile-btn .avatar-initial {
    width: 100%;
    height: 100%;
    object-fit: cover;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-primary), #6366f1);
    color: #fff;
}

.profile-btn:hover {
    border-color: var(--border-highlight);
    transform: scale(1.05);
}

.hero {
    text-align: center;
    padding: clamp(18px, 5vw, 32px) clamp(14px, 4vw, 24px) 16px;
    transition: opacity 0.4s ease, max-height 0.45s ease, margin 0.45s ease, padding 0.45s ease;
    overflow: hidden;
}

.hero.hero--hidden {
    max-height: 0;
    opacity: 0;
    margin: 0;
    padding-top: 0;
    padding-bottom: 0;
    pointer-events: none;
}

.hero h1 {
    font-size: clamp(24px, 6vw, 28px);
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.hero p {
    font-size: clamp(14px, 3.8vw, 15px);
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.hero-btn {
    background: var(--text-primary);
    color: var(--bg-base);
    font-weight: 600;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-size: 15px;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-sm);
    min-height: 46px;
}

.hero-btn:active {
    transform: scale(0.96);
}

.filters {
    display: flex;
    justify-content: flex-start;
    gap: 8px;
    padding: 0 clamp(14px, 4vw, 24px) 20px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-padding-inline: 16px;
    -webkit-overflow-scrolling: touch;
}

.filters::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    flex: 0 0 auto;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    backdrop-filter: var(--blur-md);
    transition: var(--transition-fast);
}

.filter-btn.active {
    background: var(--accent-primary);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.filter-btn:not(.active):hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.viewer-section {
    padding: 0 clamp(14px, 4vw, 24px);
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    width: 100%;
}

.content-card {
    width: 100%;
    max-width: min(400px, 100%);
    min-height: clamp(260px, min(52svh, 52dvh), 400px);
    background: var(--bg-surface);
    backdrop-filter: var(--blur-lg);
    -webkit-backdrop-filter: var(--blur-lg);
    border: 1px solid var(--border-subtle);
    border-radius: clamp(20px, 5vw, 28px);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    padding: clamp(16px, 4.5vw, 24px);
}

.content-inner {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 1;
    transform: scale(1);
    transition: var(--transition-smooth);
}

.content-inner.fade-out {
    opacity: 0;
    transform: scale(0.95);
}

.state-block {
    text-align: center;
    padding: 24px 12px;
    max-width: 280px;
}

.state-block h3 {
    font-size: 17px;
    margin-bottom: 8px;
}

.state-block p {
    font-size: 14px;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    margin: 0 auto 16px;
}

.video-wrapper {
    position: relative;
    width: clamp(160px, min(58vw, 58vmin), 220px);
    height: clamp(160px, min(58vw, 58vmin), 220px);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

.video-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(from 0deg, var(--accent-primary), transparent, var(--text-secondary), transparent);
    animation: spin 4s linear infinite;
    opacity: 0.5;
}

.video-circle {
    width: calc(100% - 16px);
    height: calc(100% - 16px);
    border-radius: 50%;
    background: var(--bg-surface-solid);
    z-index: 1;
    overflow: hidden;
    position: relative;
    border: 2px solid var(--bg-base);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
    touch-action: manipulation;
    -webkit-touch-callout: none;
}

.video-circle video,
.video-placeholder {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
    cursor: pointer;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    transition: var(--transition-fast);
}

.play-overlay--paused {
    background: rgba(0, 0, 0, 0.38);
}

.play-overlay--playing {
    background: rgba(0, 0, 0, 0.14);
}

.play-overlay.is-hidden {
    opacity: 0;
    pointer-events: none;
}

.play-icon-large,
.pause-icon-large {
    width: 48px;
    height: 48px;
    fill: white;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

.meta-info {
    text-align: center;
}

.meta-author {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.meta-desc {
    font-size: 14px;
    color: var(--text-secondary);
}

.meta-badge {
    font-size: 11px;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    font-variant-numeric: tabular-nums;
}

.voice-bubble-wrapper {
    width: 100%;
    max-width: min(320px, 100%);
    margin: 12px 0 0;
}

.voice-bubble {
    background: #1e222d;
    border-radius: 24px 24px 24px 8px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
}

.voice-play-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

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

.voice-play-btn svg {
    width: 16px;
    height: 16px;
    fill: white;
    margin-left: 2px;
}

.voice-play-btn.playing svg {
    margin-left: 0;
}

.waveform-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 2px;
    height: 24px;
    overflow: hidden;
}

.wave-bar {
    width: 3px;
    background: var(--text-secondary);
    border-radius: 2px;
    height: 4px;
    transition: height 0.1s ease;
}

.wave-bar.active {
    background: var(--accent-primary);
}

.voice-duration {
    font-size: 12px;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
}

.action-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    padding-bottom: 16px;
    width: 100%;
    flex-wrap: wrap;
}

.action-icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition-fast);
    backdrop-filter: var(--blur-md);
    color: var(--text-secondary);
}

.action-icon-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.action-icon-btn:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.action-icon-btn:active {
    transform: scale(0.9);
}

.action-icon-btn.active-state {
    color: #ef4444;
}

.action-icon-btn.saved-state {
    color: var(--accent-primary);
}

.next-btn {
    background: var(--text-primary);
    color: var(--bg-base);
    padding: 0 24px;
    min-width: min(220px, 100%);
    height: 48px;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-fast);
    box-shadow: 0 4px 16px rgba(255, 255, 255, 0.1);
}

.next-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.next-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.15);
}

.next-btn:active {
    transform: scale(0.96);
}

.fab {
    position: fixed;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    right: max(16px, env(safe-area-inset-right, 0px));
    z-index: 90;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), #6366f1);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
    transition: var(--transition-fast);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.fab svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.fab:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 12px 28px rgba(59, 130, 246, 0.5);
}

.fab:active {
    transform: scale(0.95);
}

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-smooth);
}

.overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    position: fixed;
    left: 50%;
    width: calc(100% - 12px);
    max-width: 480px;
    max-height: min(82svh, 82dvh, 720px);
    overflow-y: auto;
    background: var(--bg-surface-solid);
    border: 1px solid var(--border-subtle);
    z-index: 1001;
    padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.35s ease, bottom 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    display: flex;
    flex-direction: column;
    -webkit-overflow-scrolling: touch;
}

.modal--sheet {
    bottom: -100%;
    transform: translateX(-50%);
    border-radius: 24px 24px 0 0;
}

.modal--sheet.modal--visible {
    bottom: 0;
}

.modal--center {
    top: 50%;
    bottom: auto;
    transform: translate(-50%, -50%) scale(0.96);
    opacity: 0;
    pointer-events: none;
    border-radius: 24px;
}

.modal--center.modal--visible {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

@media (min-width: 600px) {
    .modal--sheet {
        bottom: auto;
        top: 50%;
        transform: translate(-50%, -50%) scale(0.96);
        border-radius: 24px;
        opacity: 0;
        pointer-events: none;
        width: min(92vw, 480px);
    }

    .modal--sheet.modal--visible {
        bottom: auto;
        opacity: 1;
        pointer-events: auto;
        transform: translate(-50%, -50%) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

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

.close-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-surface);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.close-btn:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.close-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.tabs {
    display: flex;
    background: var(--bg-base);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 24px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.tab-btn.active {
    background: var(--bg-surface-solid);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.tab-content {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.tab-content.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.record-ui {
    width: 100%;
    aspect-ratio: 1;
    max-height: 240px;
    background: #0f1115;
    border-radius: 16px;
    border: 1px dashed var(--border-subtle);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
}

.publish-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 10px;
    text-align: center;
}

.publish-lead {
    text-align: center;
    max-width: 38ch;
    margin-inline: auto;
}

.publish-status {
    width: 100%;
    text-align: center;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
}

.record-ui video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.record-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition-fast);
    padding: 4px;
    margin-inline: auto;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
    align-self: center;
}


.record-inner {
    width: 100%;
    height: 100%;
    background: #ef4444;
    border-radius: 50%;
    transition: var(--transition-fast);
}

.record-btn:active .record-inner {
    transform: scale(0.85);
    border-radius: 10px;
}

.record-btn.recording .record-inner {
    animation: pulseRecord 1.5s infinite;
}


.record-limit {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 12px;
    text-align: center;
}

.file-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 0;
    width: 100%;
}

.file-row--compact {
    width: auto;
    margin-inline: auto;
}

.file-btn {
    padding: 10px 16px;
    border-radius: var(--radius-full);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    font-size: 14px;
    color: var(--text-primary);
}

.file-btn:active {
    transform: scale(0.97);
}

.side-panel {
    position: fixed;
    top: 0;
    right: -100%;
    width: min(100%, 360px);
    max-width: 360px;
    height: 100vh;
    height: 100svh;
    height: 100dvh;
    background: var(--bg-surface-solid);
    z-index: 1001;
    border-left: 1px solid var(--border-subtle);
    transition: right 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    padding: calc(16px + env(safe-area-inset-top, 0px)) 18px calc(20px + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.side-panel.active {
    right: 0;
}

.profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
    margin-top: 16px;
}

.profile-avatar-wrap {
    position: relative;
    width: 80px;
    height: 80px;
    margin-bottom: 12px;
}

.profile-avatar-upload {
    margin-bottom: 16px;
    display: flex;
    justify-content: center;
}

.profile-avatar-wrap img.profile-avatar:not(.hidden) {
    position: absolute;
    inset: 0;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-subtle);
    background: var(--bg-base);
}

.profile-name {
    font-size: 18px;
    font-weight: 600;
}

.profile-handle {
    font-size: 14px;
    color: var(--text-secondary);
}

.profile-edit-card {
    background: var(--bg-base);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.profile-edit-card h3 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 12px;
}

.profile-edit-label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.profile-edit-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.profile-name-input {
    flex: 1;
    min-width: 0;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 14px;
    outline: none;
}

.profile-name-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.profile-save-btn {
    flex: 0 0 auto;
    padding-inline: 18px;
}

.profile-edit-hint {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-tertiary);
}

.profile-telegram-status {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.profile-link-code {
    flex: 1;
    min-width: 0;
    border-radius: 12px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px dashed var(--border-highlight);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-align: center;
}

.stats-row {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    width: 100%;
}

.stat-box {
    flex: 1;
    background: var(--bg-base);
    padding: 12px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--border-subtle);
}

.stat-num {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 12px;
    color: var(--text-tertiary);
}

.settings-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 24px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.setting-label {
    font-size: 15px;
    color: var(--text-primary);
}

.toggle {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--bg-base);
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: background 0.3s;
}

.toggle::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: transform 0.3s, background 0.3s;
}

.toggle.on {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.toggle.on::after {
    transform: translateX(20px);
    background: white;
}

.saved-section h3 {
    font-size: 15px;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.saved-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: min(40vh, 320px);
    overflow-y: auto;
}

.saved-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-base);
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    font-size: 14px;
}

.saved-item button {
    margin-left: auto;
    color: var(--accent-primary);
    font-size: 13px;
}

.saved-item-actions {
    margin-left: auto;
    display: flex;
    gap: 10px;
    align-items: center;
}

.saved-item-actions button[data-delete-id] {
    color: #f87171;
}

.toast {
    position: fixed;
    bottom: calc(86px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(22, 25, 33, 0.92);
    backdrop-filter: var(--blur-md);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 2000;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
    max-width: calc(100vw - 24px);
    text-align: center;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.hidden {
    display: none !important;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulseRecord {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(239, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

@media (max-width: 480px) {
    .profile-btn {
        width: 34px;
        height: 34px;
    }

    .action-row {
        gap: 10px;
    }

    .action-icon-btn {
        width: 42px;
        height: 42px;
    }

    .next-btn {
        width: 100%;
        order: -1;
    }

    .fab {
        width: 54px;
        height: 54px;
    }
}

@media (max-width: 360px) {
    .hero:not(.hero--hidden) {
        padding-top: 16px;
    }

    .filters {
        gap: 6px;
    }

    .filter-btn {
        padding: 8px 14px;
        font-size: 13px;
    }

    .content-card {
        min-height: 260px;
    }

    .voice-bubble {
        padding: 10px 12px;
        gap: 10px;
    }

    .voice-duration {
        font-size: 11px;
    }
}

@media (max-height: 740px) {
    .hero:not(.hero--hidden) {
        padding-bottom: 12px;
    }

    .filters {
        padding-bottom: 14px;
    }

    .content-card {
        min-height: clamp(240px, 46svh, 340px);
    }

    .video-wrapper {
        width: clamp(150px, min(50vw, 50vmin), 200px);
        height: clamp(150px, min(50vw, 50vmin), 200px);
        margin-bottom: 16px;
    }
}

/* --- Обрезка длинного видео для кружочка --- */
.trim-video-modal.modal {
    z-index: 1002;
}

.trim-lead {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.45;
    margin-bottom: 16px;
}

.trim-preview-wrap,
.trim-preview {
    border-radius: clamp(16px, 4vw, 22px);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    background: #0f1115;
    aspect-ratio: 1 / 1;
    width: 100%;
    max-height: min(260px, 56vw);
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

#trim-preview-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.trim-controls {
    margin-bottom: 8px;
}

.trim-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.trim-range {
    width: 100%;
    height: 10px;
    border-radius: 6px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.trim-times {
    font-size: 14px;
    color: var(--text-primary);
    margin-top: 12px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    padding: 10px 12px;
    background: var(--bg-base);
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
}

.trim-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 8px;
}

.trim-video-modal .publish-actions {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
}

.trim-confirm-btn {
    min-height: 46px;
    padding-left: 20px;
    padding-right: 20px;
}
