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

body {
    overflow-x: hidden;
    min-height: 100vh;
}

.app-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: var(--spacing-xl);
    min-height: 100vh;
}

.top-bar {
    display: grid;
    grid-template-columns: 360px 1fr 360px;
    gap: var(--spacing-lg);
    align-items: center;
    margin-bottom: var(--spacing-xl);
    position: relative;
}

@media (max-width: 1400px) {
    .top-bar {
        grid-template-columns: 320px 1fr 320px;
        gap: var(--spacing-md);
    }
}

.top-bar .btn-login {
    grid-column: 3;
    justify-self: start;
}

.main-grid {
    display: grid;
    grid-template-columns: 360px 1fr 360px;
    gap: var(--spacing-lg);
    align-items: start;
}

@media (max-width: 1400px) {
    .main-grid {
        grid-template-columns: 320px 1fr 320px;
        gap: var(--spacing-md);
    }
}

@media (max-width: 1200px) {
    .main-grid {
        grid-template-columns: 1fr;
    }

    .left-column,
    .right-column {
        max-width: 600px;
        margin: 0 auto;
    }

    .plans-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: var(--spacing-md);
    }

    .presets-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .iphone-frame {
        width: 280px;
        height: 570px;
    }

    .registration-form {
        flex-direction: column;
    }
}

.left-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
    justify-content: flex-start !important;
}

.drag-drop-zone {
    text-align: center;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 57px;
    padding: 0 var(--spacing-lg);
    width: 100%;
    position: relative;
    border: none;
}

.upload-icon {
    margin-bottom: var(--spacing-xs);
    width: 32px;
    height: 32px;
    margin: 0 auto var(--spacing-xs);
}

.presets-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-sm);
}

.preset-card {
    padding: var(--spacing-md);
    text-align: center;
    cursor: pointer;
}

.introduction-card {
    grid-column: span 2;
}

.audio-library {
    padding: 20px;
    display: flex;
    flex-direction: column;
    min-height: 650px;
    width: 100% !important;
    overflow: hidden !important;
}

.audio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.audio-browser {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin-bottom: 8px;
    overflow: hidden !important;
    /* LOCK BROWSER SCROLL */
}

.audio-browser-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 100% !important;
    overflow: hidden !important;
}

.category-list-minimalist {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-shrink: 0;
    overflow: hidden !important;
}

.quality-toggle-container {
    width: 100% !important;
    flex-shrink: 0;
    margin-bottom: 24px !important;
}

.waveform-player {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.play-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.waveform {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 3px;
    height: 40px;
}

.wave-bar {
    flex: 1;
}

.music-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

.music-track {
    cursor: pointer;
}

.track-cover {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.track-info {
    flex: 1;
}

.audio-search {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.center-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    position: relative;
}

.iphone-mockup {
    position: relative;
    margin: 0;
    padding: 0;
}

.iphone-frame {
    width: 320px;
    height: 650px;
    padding: 2px;
    position: relative;
    margin: 0;
}

.phone-controls {
    margin-top: 0;
    gap: 10px;
    z-index: 100;
    position: relative;
}

.center-column.landscape .phone-controls {
    transform: translateY(-150px);
    transition-delay: 0.2s;
}

.slot-queue-container {
    width: 650px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 10px;
    padding-bottom: 60px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 10;
}

.center-column.landscape .slot-queue-container {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-155px);
}

.landscape-media-card {
    position: relative;
    width: 100%;
    height: 120px;
    display: grid;
    grid-template-rows: 75px 1fr;
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(25px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.landscape-media-card.focused {
    border-color: #A78BFA;
    box-shadow: 0 8px 32px rgba(167, 139, 250, 0.2);
    background: rgba(255, 255, 255, 0.7);
    transform: scale(1.02);
}

.slot-index-tag {
    position: absolute;
    top: -8px;
    left: -8px;
    background: #A78BFA;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(167, 139, 250, 0.3);
    z-index: 5;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.landscape-media-card.focused .slot-index-tag {
    background: #FF6B9D;
    box-shadow: 0 4px 15px rgba(255, 107, 157, 0.5);
    transform: scale(1.1);
}

.media-main-row {
    display: grid;
    grid-template-columns: 2fr 2fr 80px;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.media-row-status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px;
    background: rgba(255, 255, 255, 0.05);
}

.status-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-tertiary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
}

.status-chip svg {
    opacity: 0.5;
    transition: opacity 0.3s;
}

.status-chip.active {
    background: rgba(167, 139, 250, 0.1);
    border-color: rgba(167, 139, 250, 0.2);
    color: var(--text-primary);
}

.status-chip.active svg {
    opacity: 1;
    color: #C084FC;
}

.status-chip .chip-label {
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-chip .chip-value {
    color: var(--text-secondary);
}

.status-chip.active .chip-value {
    color: var(--text-primary);
}

.status-chip.placeholder {
    opacity: 0.4;
    filter: grayscale(1);
    border-style: dashed;
}

.media-column {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}

.media-column.media-actions {
    justify-content: flex-end;
    gap: 16px;
    border-left: 1px solid rgba(0, 0, 0, 0.05);
    padding-left: 10px;
}

.media-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.media-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.media-label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-tertiary);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.media-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-icon-danger {
    color: #ef4444;
    opacity: 0.7;
    transition: 0.2s;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-danger:hover {
    opacity: 1;
    transform: scale(1.1);
}

.landscape-media-card .custom-checkbox {
    width: 20px;
    height: 20px;
}

.iphone-notch {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 28px;
    z-index: 10;
}

.iphone-screen {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.video-preview {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.video-preview img,
.video-preview video {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-save {
    position: absolute;
    top: 50px;
    right: 16px;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    z-index: 100;
}

.preview-strip {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    margin-left: auto;
    margin-right: auto;
    width: calc(100% - 20px);
    height: 64px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm);
    overflow: visible;
    box-sizing: border-box;
}

.preview-thumb {
    width: 48px;
    height: 48px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    pointer-events: auto;
}

.preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ADR-011 #9: Адаптация preview-strip для landscape режима */
.iphone-mockup.rotated .preview-strip {
    flex-direction: column;
    width: auto;
    height: calc(100% - 40px);
    top: 20px;
    bottom: 20px;
    left: auto;
    right: 8px;
    margin: 0;
    justify-content: center;
    padding: 8px;
}

.iphone-mockup.rotated .preview-thumb {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.registration-section {
    text-align: center;
    width: 100%;
    max-width: 500px;
}

.registration-form {
    display: flex;
    gap: var(--spacing-sm);
}

.email-input {
    flex: 1;
    padding: var(--spacing-md) var(--spacing-lg);
}

.right-column {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.action-buttons-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.caption-styles {
    padding: var(--spacing-sm);
}

.card-header {
    display: none;
}

.style-section {
    margin-bottom: var(--spacing-xs);
}

.style-section:last-child {
    margin-bottom: 0;
}

.font-grid,
.animation-grid,
.format-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-xs);
}

.font-option,
.animation-option,
.format-option {
    padding: var(--spacing-md);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.font-preview {
    font-size: 24px;
}

.format-selection {
    padding: var(--spacing-lg);
}

.settings-panel {
    padding: var(--spacing-lg);
    margin-top: 10px;
    animation: settingsReveal 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#btnSettings.active {
    background: var(--accent-gradient) !important;
    border: none !important;
    box-shadow: 0 10px 25px -5px var(--accent-glow) !important;
}

#btnSettings.active .preset-name {
    color: white !important;
}

@keyframes settingsReveal {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
        filter: blur(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

.setting-group {
    margin-bottom: var(--spacing-lg);
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.slider {
    width: 100%;
    height: 6px;
    outline: none;
    margin-bottom: var(--spacing-xs);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
}

.quality-toggle {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-xs);
    padding: 4px;
}

.quality-btn {
    padding: var(--spacing-sm);
}

.generate-glow {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease-in-out;
    pointer-events: none;
}

.btn-ai-chat {
    position: fixed;
    bottom: var(--spacing-xl);
    right: var(--spacing-xl);
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.modal-content {
    position: relative;
    max-width: 500px;
    width: 100%;
    padding: var(--spacing-xl);
    z-index: 10000;
}

.modal-wide {
    max-width: 900px;
}

.modal-chat {
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-close {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-video-preview {
    width: 100%;
    height: 300px;
    margin-bottom: var(--spacing-lg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.billing-toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-toggle {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.slider-toggle:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 3.5px;
}

.plans-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-xl);
}

.plan-card {
    padding: var(--spacing-xl);
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
}

.plan-badge-top {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 20px;
}

.plan-header {
    margin-bottom: var(--spacing-md);
}

.plan-icon-wrapper {
    margin-bottom: 8px;
}

.plan-features {
    list-style: none;
    margin-bottom: var(--spacing-xl);
    text-align: left;
    padding: 0;
    flex-grow: 1;
}

.plan-features li {
    padding: 10px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-plan {
    width: 100%;
    padding: 14px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md);
}

.chat-message {
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    max-width: 80%;
}

.chat-input-container {
    display: flex;
    gap: var(--spacing-sm);
}

.btn-microphone {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-input {
    flex: 1;
    padding: var(--spacing-md);
}

.ai-caption-block {
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    flex: 1;
}

.caption-input-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.caption-textarea {
    width: 100%;
    padding: var(--spacing-md);
    resize: vertical;
    min-height: 100px;
}

.audio-visualizer-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.premium-waveform {
    position: relative;
    width: 100%;
    height: 120px;
    padding: var(--spacing-md);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.waveform-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.waveform-bars {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 60px;
    z-index: 1;
}

.waveform-bars .bar {
    width: 4px;
    height: calc(var(--height) * 60px);
}

.caption-style-options {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.style-buttons {
    display: flex;
    gap: var(--spacing-sm);
}

.style-btn {
    flex: 1;
    padding: var(--spacing-sm) var(--spacing-md);
}

/* ADR-011 #13: Crop Preview Overlay */
.crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.crop-overlay-inner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 80%;
    border: 3px solid rgba(192, 132, 252, 0.7);
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(192, 132, 252, 0.3), inset 0 0 30px rgba(192, 132, 252, 0.1);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Smart mode: CSS pulse animation */
.crop-overlay.crop-smart .crop-overlay-inner {
    animation: cropPulseSmart 2s ease-in-out infinite;
}

@keyframes cropPulseSmart {

    0%,
    100% {
        width: 60%;
        height: 80%;
        border-color: rgba(192, 132, 252, 0.5);
        box-shadow: 0 0 20px rgba(192, 132, 252, 0.2), inset 0 0 20px rgba(192, 132, 252, 0.05);
    }

    50% {
        width: 70%;
        height: 85%;
        border-color: rgba(192, 132, 252, 0.8);
        box-shadow: 0 0 40px rgba(192, 132, 252, 0.4), inset 0 0 40px rgba(192, 132, 252, 0.15);
    }
}

/* Video preview placeholder — убираем старый фон чтобы видео было видно */
#cropModalAnimation {
    background: #000;
    position: relative;
    overflow: hidden;
}

#cropModalAnimation .video-preview-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

#cropModalAnimation .crop-preview-video {
    z-index: 0;
}