/* =============================================
   MRA 360 — Design System
   Premium Dark Mode with Glassmorphism
   ============================================= */

/* ---- Reset & Base ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colors */
    --bg-primary: #08080f;
    --bg-secondary: #0f0f1a;
    --bg-surface: rgba(20, 20, 40, 0.7);
    --bg-glass: rgba(255, 255, 255, 0.04);
    --bg-glass-hover: rgba(255, 255, 255, 0.08);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glass-hover: rgba(255, 255, 255, 0.15);

    --accent-primary: #a855f7;
    --accent-secondary: #ec4899;
    --accent-gradient: linear-gradient(135deg, #a855f7, #ec4899);
    --accent-gradient-hover: linear-gradient(135deg, #c084fc, #f472b6);
    --accent-glow: rgba(168, 85, 247, 0.3);

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

    --rec-color: #ef4444;
    --rec-glow: rgba(239, 68, 68, 0.4);

    --success: #22c55e;
    --error: #ef4444;
    --warning: #eab308;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(168, 85, 247, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(236, 72, 153, 0.04) 0%, transparent 50%);
}

/* ---- Screens ---- */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-slow), visibility var(--transition-slow);
    pointer-events: none;
}

.screen.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ---- Header ---- */
.setup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    flex-shrink: 0;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.logo-text span {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.icon-btn {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.icon-btn:hover, .icon-btn:active {
    background: var(--bg-glass-hover);
    border-color: var(--border-glass-hover);
    color: var(--text-primary);
}

/* ---- Camera Preview ---- */
.camera-preview-container {
    position: relative;
    width: 100%;
    aspect-ratio: 9/16;
    max-height: 40vh;
    margin: 0 auto;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    flex-shrink: 0;
}

.camera-preview-container video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.frame-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    z-index: 2;
}

.frame-overlay.hidden {
    display: none;
}

.camera-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    color: var(--text-muted);
    cursor: pointer;
    z-index: 3;
}

.camera-placeholder.hidden {
    display: none;
}

.camera-placeholder p {
    font-size: 0.85rem;
    font-weight: 500;
}

/* ---- Controls Panel ---- */
.controls-panel {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md) var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    scrollbar-width: thin;
    scrollbar-color: var(--text-muted) transparent;
}

.controls-panel::-webkit-scrollbar {
    width: 4px;
}

.controls-panel::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 2px;
}

.control-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.control-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.required-badge {
    font-size: 0.6rem;
    background: var(--accent-gradient);
    color: white;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
}

/* ---- Time Selector ---- */
.time-selector {
    display: flex;
    gap: var(--space-sm);
}

.time-btn {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.time-btn:hover, .time-btn:active {
    background: var(--bg-glass-hover);
    border-color: var(--border-glass-hover);
    color: var(--text-primary);
}

.time-btn.active {
    background: var(--accent-gradient);
    border-color: transparent;
    color: white;
    box-shadow: 0 0 20px var(--accent-glow);
}

/* ---- Mode Selector ---- */
.mode-selector {
    display: flex;
    gap: var(--space-sm);
}

.mode-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: var(--space-sm) var(--space-xs);
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.mode-btn:hover, .mode-btn:active {
    background: var(--bg-glass-hover);
    border-color: var(--border-glass-hover);
    color: var(--text-primary);
}

.mode-btn.active {
    background: var(--accent-gradient);
    border-color: transparent;
    color: white;
    box-shadow: 0 0 20px var(--accent-glow);
}

.mode-btn svg {
    flex-shrink: 0;
}

.mode-description {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 2px;
}

/* ---- Frame Selector ---- */
.frame-selector {
    display: flex;
    gap: var(--space-sm);
    overflow-x: auto;
    padding-bottom: var(--space-sm);
    scrollbar-width: thin;
    scrollbar-color: var(--text-muted) transparent;
}

.frame-selector::-webkit-scrollbar {
    height: 3px;
}

.frame-selector::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 2px;
}

.frame-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.frame-option span {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

.frame-option.active span {
    color: var(--accent-primary);
}

.frame-thumb {
    width: 56px;
    height: 100px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border-glass);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-glass);
    transition: all var(--transition-fast);
}

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

.frame-option.active .frame-thumb {
    border-color: var(--accent-primary);
    box-shadow: 0 0 12px var(--accent-glow);
}

.no-frame {
    color: var(--text-muted);
}

/* ---- Music Panel ---- */
.music-panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.music-dropdown {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.music-dropdown option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.music-dropdown:focus {
    border-color: var(--accent-primary);
}

/* ---- Waveform ---- */
.waveform-container {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    position: relative;
    transition: all var(--transition-normal);
}

.waveform-container.hidden {
    display: none;
}

.waveform-canvas {
    width: 100%;
    height: 80px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: block;
}

.waveform-handles {
    position: absolute;
    top: var(--space-md);
    left: var(--space-md);
    right: var(--space-md);
    height: 80px;
    pointer-events: none;
}

.waveform-selection {
    position: absolute;
    top: 0;
    height: 100%;
    background: rgba(168, 85, 247, 0.15);
    border-top: 2px solid var(--accent-primary);
    border-bottom: 2px solid var(--accent-primary);
    pointer-events: auto;
    cursor: grab;
    touch-action: none;
}

.waveform-handle {
    position: absolute;
    top: -4px;
    width: 16px;
    height: calc(100% + 8px);
    cursor: ew-resize;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 5;
    touch-action: none;
}

.handle-line {
    width: 3px;
    height: 100%;
    background: var(--accent-primary);
    border-radius: 2px;
    box-shadow: 0 0 8px var(--accent-glow);
}

.handle-time {
    position: absolute;
    bottom: -20px;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--accent-primary);
    white-space: nowrap;
    pointer-events: none;
}

.handle-start {
    transform: translateX(-50%);
}

.handle-end {
    transform: translateX(-50%);
}

.waveform-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--space-lg);
}

.btn-small {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-preview {
    background: var(--accent-gradient);
    color: white;
}

.btn-preview:hover, .btn-preview:active {
    box-shadow: 0 0 16px var(--accent-glow);
}

.btn-preview.playing {
    background: var(--rec-color);
}

.music-duration {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ---- REC Button ---- */
.rec-button-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) 0 var(--space-lg);
    flex-shrink: 0;
}

.btn-rec {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 3px solid var(--text-primary);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
}

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

.btn-rec:not(:disabled):hover, .btn-rec:not(:disabled):active {
    border-color: var(--rec-color);
    box-shadow: 0 0 30px var(--rec-glow);
}

.rec-inner {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--rec-color);
    transition: all var(--transition-normal);
}

.btn-rec:not(:disabled):hover .rec-inner {
    transform: scale(1.05);
}

.rec-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

/* ---- Recording Screen ---- */
#screen-recording {
    background: #000;
}

.recording-viewport {
    width: 100%;
    height: 100%;
    position: relative;
    background: #000;
}

.recording-viewport video {
    width: 100%;
    height: 100%;
    object-fit: contain; /* contain = mostra 100% do campo de visão da câmera, sem cortar nada */
}

.recording-timer {
    position: absolute;
    top: var(--space-lg);
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.timer-circle {
    width: 64px;
    height: 64px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timer-svg {
    position: absolute;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.15);
    stroke-width: 3;
}

.timer-progress {
    fill: none;
    stroke: var(--rec-color);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
    filter: drop-shadow(0 0 6px var(--rec-glow));
}

.timer-text {
    font-size: 1.2rem;
    font-weight: 800;
    color: white;
    text-shadow: 0 0 10px rgba(0,0,0,0.5);
    z-index: 1;
}

.rec-indicator {
    position: absolute;
    top: var(--space-md);
    left: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-full);
    z-index: 10;
}

.rec-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--rec-color);
    animation: recBlink 1s ease-in-out infinite;
}

.rec-indicator span {
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    letter-spacing: 0.1em;
}

@keyframes recBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ---- Processing Screen ---- */
#screen-processing {
    align-items: center;
    justify-content: center;
}

.processing-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-lg);
    padding: var(--space-xl);
}

.processing-animation {
    position: relative;
    width: 100px;
    height: 100px;
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid transparent;
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1.2s linear infinite;
}

.ring-2 {
    width: 75%;
    height: 75%;
    top: 12.5%;
    left: 12.5%;
    border-top-color: var(--accent-secondary);
    animation-duration: 1.8s;
    animation-direction: reverse;
}

.ring-3 {
    width: 50%;
    height: 50%;
    top: 25%;
    left: 25%;
    border-top-color: var(--text-primary);
    animation-duration: 2.4s;
}

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

#screen-processing h2 {
    font-size: 1.3rem;
    font-weight: 700;
    text-align: center;
}

.processing-step {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: center;
}

.progress-bar-container {
    width: 100%;
    max-width: 300px;
    height: 6px;
    background: var(--bg-glass);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent-gradient);
    border-radius: var(--radius-full);
    transition: width var(--transition-normal);
    box-shadow: 0 0 12px var(--accent-glow);
}

.progress-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-primary);
}

/* ---- QR Code Screen ---- */
#screen-qrcode {
    align-items: center;
    justify-content: center;
}

.qrcode-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-lg);
    padding: var(--space-xl);
    position: relative;
}

.qr-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    filter: blur(40px);
    pointer-events: none;
    animation: qrPulse 3s ease-in-out infinite;
}

@keyframes qrPulse {
    0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.1); }
}

.qr-title {
    font-size: 1.5rem;
    font-weight: 800;
    text-align: center;
    z-index: 1;
}

.qr-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-align: center;
    z-index: 1;
}

.qr-image-container {
    width: 260px;
    height: 260px;
    padding: var(--space-md);
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 0 40px var(--accent-glow), 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.qr-divider {
    z-index: 1;
}

.qr-divider-icon {
    font-size: 2rem;
    animation: phoneBounce 2s ease-in-out infinite;
}

@keyframes phoneBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 14px 28px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
    z-index: 1;
}

.btn-primary:hover, .btn-primary:active {
    background: var(--accent-gradient-hover);
    box-shadow: 0 0 24px var(--accent-glow);
    transform: translateY(-1px);
}

.btn-new-recording {
    width: 100%;
    max-width: 300px;
}

/* ---- Modal ---- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    transition: all var(--transition-slow);
}

.modal.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    border: 1px solid var(--border-glass);
    border-bottom: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideUp var(--transition-slow) ease-out;
}

@keyframes modalSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal.hidden .modal-content {
    transform: translateY(100%);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-glass);
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

/* ---- Settings ---- */
.setting-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.setting-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.setting-help {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.setting-input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--transition-fast);
}

.setting-input:focus {
    border-color: var(--accent-primary);
}

.setting-input::placeholder {
    color: var(--text-muted);
}

.btn-save-settings {
    align-self: flex-start;
    padding: 10px 20px;
    font-size: 0.85rem;
}

/* ---- Upload Area ---- */
.upload-area {
    border: 2px dashed var(--border-glass);
    border-radius: var(--radius-md);
    padding: var(--space-xl);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.upload-area:hover, .upload-area.dragover {
    border-color: var(--accent-primary);
    background: rgba(168, 85, 247, 0.05);
}

.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-muted);
    pointer-events: none;
}

.upload-label span {
    font-size: 0.85rem;
    font-weight: 500;
}

/* ---- Music List ---- */
.music-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.music-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
}

.music-item-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.music-item-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.music-item-delete:hover {
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

/* ---- Error Modal ---- */
.modal-error-content {
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    margin: auto var(--space-lg);
    max-height: none;
}

.error-icon {
    color: var(--error);
}

.modal-error-content h3 {
    font-size: 1.2rem;
    font-weight: 700;
}

.modal-error-content p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.modal-error-content .btn-primary {
    margin-top: var(--space-sm);
}

/* ---- Utility ---- */
.hidden {
    display: none !important;
}

/* ---- Responsive ---- */
@media (min-width: 768px) {
    .camera-preview-container {
        max-height: 50vh;
        max-width: 320px;
    }

    .controls-panel {
        max-width: 500px;
        margin: 0 auto;
    }

    .modal-content {
        border-radius: var(--radius-xl);
        margin: auto;
        max-height: 80vh;
        border-bottom: 1px solid var(--border-glass);
    }

    .qrcode-content {
        gap: var(--space-xl);
    }

    .qr-image-container {
        width: 320px;
        height: 320px;
    }
}

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

.fade-in {
    animation: fadeIn var(--transition-slow) ease-out;
}

/* ---- Loading dots ---- */
.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(3, end) infinite;
}

@keyframes dots {
    0% { content: ''; }
    33% { content: '.'; }
    66% { content: '..'; }
    100% { content: '...'; }
}

/* Notch safe area */
@supports (padding-top: env(safe-area-inset-top)) {
    .setup-header {
        padding-top: calc(var(--space-md) + env(safe-area-inset-top));
    }

    .rec-button-container {
        padding-bottom: calc(var(--space-lg) + env(safe-area-inset-bottom));
    }

    .rec-indicator {
        top: calc(var(--space-md) + env(safe-area-inset-top));
    }
}
  
/* Pre-Recording Countdown */  
.pre-recording-countdown { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.6); z-index: 50; backdrop-filter: blur(4px); }  
.pre-recording-countdown span { font-size: 8rem; font-weight: 800; color: white; text-shadow: 0 0 20px rgba(0,0,0,0.5); animation: pulse 1s infinite alternate; }  
@keyframes pulse { 0%% { transform: scale(1); opacity: 1; } 100%% { transform: scale(1.2); opacity: 0.8; } } 
