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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #ec4899;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --dark: #1f2937;
    --light: #f9fafb;
    --white: #ffffff;
    --gray: #6b7280;
    --gray-light: #e5e7eb;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 0;
    margin: 0;
    color: var(--dark);
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    box-sizing: border-box;
}

/* Mobile First - Base styles are for mobile */
@media (min-width: 768px) {
    body {
        padding: 20px;
        align-items: center;
    }
}

.container {
    max-width: 98%;
    width: 100%;
    margin: 15px auto;
    background: var(--white);
    border-radius: 20px;
    padding: 25px 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(10px);
    box-sizing: border-box;
}

/* Extra small mobile - make even bigger */
@media (max-width: 480px) {
    .container {
        max-width: 96%;
        padding: 22px 18px;
        margin: 10px auto;
        border-radius: 18px;
    }
}

/* Tablet and Desktop */
@media (min-width: 768px) {
    .container {
        max-width: 1200px;
        width: 100%;
        border-radius: 24px;
        padding: 40px;
        margin: 20px auto;
    }
}

header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 3px solid var(--gray-light);
}

@media (min-width: 768px) {
    header {
        margin-bottom: 40px;
        padding-bottom: 30px;
    }
}

header h1 {
    font-size: 2em;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    font-weight: 900;
    letter-spacing: -1px;
    text-align: center;
    position: relative;
    display: inline-block;
    width: 100%;
}

header h1::before {
    content: "🎤";
    display: block;
    font-size: 0.5em;
    margin-bottom: 8px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    opacity: 0.9;
}

@media (min-width: 768px) {
    header h1 {
        font-size: 3.5em;
        letter-spacing: -2px;
    }

    header h1::before {
        font-size: 0.4em;
        margin-bottom: 10px;
    }
}

header p {
    color: var(--gray);
    font-size: 1.2em;
    font-weight: 500;
}

.scripts-header-section {
    margin-bottom: 30px;
}

.scripts-container h2 {
    margin-bottom: 15px;
    color: var(--dark);
    font-size: 1.6em;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
}

.scripts-container h2::before {
    content: "📚";
    font-size: 1.2em;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

@media (min-width: 768px) {
    .scripts-container h2 {
        margin-bottom: 20px;
        font-size: 2.2em;
        gap: 12px;
    }

    .scripts-container h2::before {
        font-size: 1.3em;
    }
}

.instruction-banner {
    background: linear-gradient(135deg, #e0f2fe 0%, #f0f9ff 100%);
    border: 2px solid var(--info);
    border-radius: 16px;
    padding: 20px 25px;
    margin-bottom: 25px;
    display: flex;
    align-items: flex-start;
    gap: 20px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
    animation: slideInDown 0.5s ease;
}

.instruction-icon {
    font-size: 2.5em;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.instruction-content {
    flex: 1;
}

.instruction-content strong {
    display: block;
    color: var(--info);
    font-size: 1.2em;
    font-weight: 700;
    margin-bottom: 8px;
}

.instruction-content p {
    color: var(--dark);
    font-size: 1.05em;
    line-height: 1.6;
    margin: 0;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

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

.scripts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.script-card {
    background: linear-gradient(135deg, var(--white) 0%, var(--light) 100%);
    border: 2px solid var(--gray-light);
    border-radius: 20px;
    padding: 30px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.script-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    background: linear-gradient(180deg, var(--primary) 0%, var(--secondary) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 20px 0 0 20px;
}

.script-card:hover {
    border-color: var(--primary);
    box-shadow: 0 12px 32px rgba(99, 102, 241, 0.25);
    transform: translateY(-6px) scale(1.02);
    background: linear-gradient(135deg, var(--white) 0%, #f8fafc 100%);
}

.script-card:hover::before {
    opacity: 1;
}

.script-card h3 {
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 1.6em;
    font-weight: 800;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 10px;
}

.script-card h3::before {
    content: "📄";
    font-size: 0.9em;
    opacity: 0.8;
}

.script-card p {
    color: var(--dark);
    margin-bottom: 18px;
    line-height: 1.7;
    font-size: 1.05em;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.script-card .date {
    color: var(--gray);
    font-size: 0.95em;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    padding-top: 12px;
    border-top: 1px solid var(--gray-light);
}

.script-card .date::before {
    content: "📅";
    font-size: 0.9em;
}

.script-view {
    margin-top: 15px;
    animation: fadeIn 0.5s ease;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: 100vh;
    overflow: hidden;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.script-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 14px;
    padding: 15px 18px;
    margin-bottom: 10px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

.script-content::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 14px 14px 0 0;
}

@media (min-width: 768px) {
    .script-content {
        padding: 15px 20px;
        margin-bottom: 10px;
    }
}

.script-content h2 {
    color: var(--primary);
    margin-bottom: 8px;
    font-size: 1.2em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

@media (min-width: 768px) {
    .script-content h2 {
        margin-bottom: 10px;
        font-size: 1.4em;
    }
}

.script-text {
    line-height: 1.5;
    font-size: 0.9em;
    color: var(--dark);
    white-space: pre-wrap;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    padding: 15px 18px;
    border-radius: 12px;
    border-left: 4px solid var(--primary);
    margin: 0;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
}

.script-text::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 12px 0 0 12px;
}

.script-text .script-paragraph {
    margin-bottom: 0;
    padding: 6px 0;
    line-height: 1.6;
    position: relative;
    padding-left: 12px;
    border-left: 2px solid transparent;
    transition: all 0.2s ease;
}

.script-text .script-paragraph:hover {
    background: rgba(99, 102, 241, 0.05);
    border-left-color: var(--primary);
    padding-left: 16px;
}

.script-text .script-paragraph+.script-paragraph {
    margin-top: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding-top: 8px;
}

@media (min-width: 768px) {
    .script-text {
        line-height: 1.55;
        font-size: 0.95em;
        padding: 18px 24px;
    }

    .script-text .script-paragraph {
        padding: 8px 0;
        padding-left: 16px;
    }

    .script-text .script-paragraph:hover {
        padding-left: 20px;
    }
}

.recording-section {
    background: var(--white);
    border-radius: 12px;
    padding: 12px 15px;
    margin-top: 8px;
    border: 1px solid var(--gray-light);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
    flex: 0 0 auto;
    position: sticky;
    bottom: 0;
    z-index: 10;
}

@media (min-width: 768px) {
    .recording-section {
        padding: 15px 20px;
    }
}

.recording-section h3 {
    color: var(--dark);
    margin-bottom: 8px;
    font-size: 1em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

@media (min-width: 768px) {
    .recording-section h3 {
        margin-bottom: 10px;
        font-size: 1.1em;
    }
}

.recording-section h3::before {
    content: "🎤";
    font-size: 1.2em;
}

.recording-info {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 3px solid var(--info);
}

.recording-info p {
    color: #1e40af;
    font-weight: 500;
    margin: 0;
    font-size: 0.85em;
    line-height: 1.4;
}

.recording-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 1.5em;
    font-weight: 700;
    color: #991b1b;
    border: 2px solid #fca5a5;
}

.timer-icon {
    font-size: 1.2em;
    animation: pulse 1.5s infinite;
}

/* Microphone Selection */
.mic-selection-container {
    margin: 0;
    padding: 8px 12px;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f0ff 100%);
    border-radius: 10px;
    border: 2px solid #c7d2fe;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
    transition: all 0.3s ease;
    width: 100%;
    justify-content: center;
}

@media (min-width: 768px) {
    .mic-selection-container {
        width: auto;
        min-width: 250px;
    }
}

.mic-selection-container:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
    transform: translateY(-1px);
}

.mic-label {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.75em;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}

.mic-label::before {
    content: "🎤";
    font-size: 1em;
}

.mic-select {
    flex: 1;
    padding: 5px 10px;
    border: 2px solid #c7d2fe;
    border-radius: 8px;
    font-size: 0.75em;
    background: white;
    color: var(--dark);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 160px;
    max-width: 250px;
    font-weight: 500;
}

.mic-select:hover {
    border-color: var(--primary);
    background: #f8f9ff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}

.mic-select:focus {
    outline: none;
    border-color: var(--primary);
    background: #f8f9ff;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Microphone Selection in Modal */
.mic-selection-container-modal {
    margin: 20px 0;
    padding: 10px 15px;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f0ff 100%);
    border-radius: 12px;
    border: 2px solid #c7d2fe;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 3px 10px rgba(99, 102, 241, 0.12);
    transition: all 0.3s ease;
    width: 100%;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.mic-selection-container-modal:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
    transform: translateY(-1px);
}

.mic-selection-container-modal .mic-label {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.85em;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 5px;
}

.mic-selection-container-modal .mic-select {
    flex: 1;
    min-width: 200px;
    max-width: 350px;
}

/* Recording Indicator */
.recording-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border-radius: 12px;
    font-size: 1.2em;
    font-weight: bold;
    margin: 20px 0;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
    animation: pulseRecording 2s infinite;
}

.recording-pulse {
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    animation: recordingPulse 1.5s infinite;
}

@keyframes recordingPulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

@keyframes pulseRecording {

    0%,
    100% {
        box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
    }

    50% {
        box-shadow: 0 4px 25px rgba(239, 68, 68, 0.6);
    }
}

#timer-display {
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
}

.recording-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 25px;
    width: 100%;
}

.recording-controls-inline {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
}

.recording-controls-inline .mic-selection-container {
    order: -1;
    /* Put mic selection first */
    width: 100%;
    margin-bottom: 8px;
}

.recording-controls-inline .btn {
    width: 100%;
    order: 0;
    /* Buttons come after mic selection */
}

.buttons-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

@media (min-width: 768px) {
    .recording-controls-inline {
        flex-direction: column;
        /* Keep column layout to ensure mic is on top */
        align-items: stretch;
        gap: 12px;
    }

    .buttons-row {
        flex-direction: row;
        gap: 15px;
    }

    .buttons-row .btn-large {
        flex: 1;
        min-width: 200px;
        width: auto;
    }

    .recording-controls-inline .mic-selection-container {
        width: 100%;
        margin-bottom: 8px;
        order: -1;
        /* Ensure mic is always first */
    }
}

.btn-large {
    padding: 16px 24px;
    font-size: 1.1em;
    width: 100%;
    min-width: unset;
    justify-content: center;
}

.recording-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    border: 2px solid #e0e7ff;
}

.recording-actions .btn {
    min-width: 150px;
    padding: 12px 20px;
    font-weight: 600;
    border-radius: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.recording-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

@media (min-width: 768px) {
    .recording-controls {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }

    .btn-large {
        padding: 18px 35px;
        font-size: 1.15em;
        min-width: 200px;
        width: auto;
    }
}

.btn-icon {
    font-size: 1.3em;
    margin-right: 8px;
}

.audio-container {
    margin-top: 25px;
    padding: 20px;
    background: var(--light);
    border-radius: 12px;
    border: 2px solid var(--gray-light);
}

.audio-container h4 {
    color: var(--dark);
    margin-bottom: 15px;
    font-size: 1.2em;
    font-weight: 600;
}

.recording-status {
    margin-top: 20px;
    padding: 18px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1.05em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.recording-status.recording {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border: 2px solid #fca5a5;
}

.recording-status.recording::before {
    content: "🔴";
    animation: pulse 1.5s infinite;
}

.recording-status.success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border: 2px solid #6ee7b7;
}

.recording-status.success::before {
    content: "✅";
}

.recording-status.error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border: 2px solid #fca5a5;
}

.recording-status.error::before {
    content: "❌";
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.btn {
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    text-align: center;
}

@media (min-width: 768px) {
    .btn {
        padding: 14px 28px;
        width: auto;
    }
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--gray) 0%, #4b5563 100%);
    color: var(--white);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #4b5563 0%, var(--gray) 100%);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: var(--white);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, var(--danger) 100%);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: var(--white);
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, var(--success) 100%);
}

.hidden {
    display: none !important;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.loading-content {
    background: var(--white);
    padding: 40px 60px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    min-width: 300px;
}

.loading-spinner {
    font-size: 48px;
    margin-bottom: 20px;
    animation: spin 1s linear infinite;
}

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

.loading-content p {
    font-size: 18px;
    font-weight: 600;
    color: var(--dark);
    margin: 0;
}

/* Metadata Collection Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    backdrop-filter: none;
    animation: fadeIn 0.3s ease;
    overflow: hidden;
    box-sizing: border-box;
}

#final-review-modal.modal {
    background: transparent !important;
    padding: 20px;
}

/* Final review modal - transparent background, no overlay */
#final-review-modal {
    background: transparent !important;
    backdrop-filter: none !important;
    overflow: visible !important;
    padding: 0 !important;
}

#final-review-modal .modal {
    background: transparent !important;
}

#final-review-modal:not(.hidden) {
    display: flex !important;
    visibility: visible !important;
}

#submission-success-modal {
    background: rgba(0, 0, 0, 0.7) !important;
    backdrop-filter: blur(8px);
}

#submission-success-modal:not(.hidden) {
    display: flex !important;
}

.modal.hidden {
    display: none;
}

@media (min-width: 768px) {
    .modal {
        padding: 20px;
    }

    #final-review-modal,
    #submission-success-modal {
        backdrop-filter: blur(10px);
    }
}

/* Mobile First - Metadata Modal */
.metadata-modal {
    background: var(--white);
    border-radius: 20px;
    padding: 20px 18px;
    max-width: calc(100% - 20px);
    width: 100%;
    max-height: 95vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
    animation: fadeInUp 0.4s ease;
    margin: auto;
    box-sizing: border-box;
}

#metadata-step-6 {
    min-height: auto;
    padding-bottom: 20px;
}

/* Tablet */
@media (min-width: 768px) {
    .metadata-modal {
        padding: 30px 35px;
        max-width: 650px;
        border-radius: 24px;
        margin: auto;
    }

    .final-review-modal {
        max-width: 650px;
        padding: 35px 30px;
    }

    .success-modal {
        max-width: 500px;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .metadata-modal {
        padding: 40px;
        max-width: 700px;
        border-radius: 28px;
    }
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--gray-light);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8em;
    color: var(--dark);
    transition: all 0.3s ease;
    z-index: 10;
    line-height: 1;
    padding: 0;
}

.modal-close:hover {
    background: var(--danger);
    color: var(--white);
    transform: rotate(90deg) scale(1.1);
}

.modal-close:active {
    transform: rotate(90deg) scale(0.95);
}

/* Mobile First - Progress */
.metadata-progress {
    margin-bottom: 25px;
}

@media (min-width: 768px) {
    .metadata-progress {
        margin-bottom: 30px;
    }
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--gray-light);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

@media (min-width: 768px) {
    .progress-bar {
        height: 8px;
    }
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    display: block;
    text-align: center;
    color: var(--gray);
    font-weight: 600;
    font-size: 0.85em;
}

@media (min-width: 768px) {
    .progress-text {
        font-size: 0.9em;
    }
}

.metadata-step {
    animation: fadeIn 0.3s ease;
}

/* Mobile First - Step Heading */
.metadata-step h2 {
    color: var(--primary);
    margin-bottom: 12px;
    font-size: 1.4em;
    font-weight: 800;
    line-height: 1.3;
}

@media (min-width: 768px) {
    .metadata-step h2 {
        font-size: 1.7em;
        margin-bottom: 15px;
    }
}

@media (min-width: 1024px) {
    .metadata-step h2 {
        font-size: 1.8em;
    }
}

/* Mobile First - Metadata Description */
.metadata-description {
    color: var(--gray);
    margin-bottom: 20px;
    font-size: 0.95em;
    line-height: 1.6;
}

@media (min-width: 768px) {
    .metadata-description {
        margin-bottom: 25px;
        font-size: 1.05em;
    }
}

.speaker-id-container {
    margin: 30px 0;
    padding: 0;
}

.speaker-id-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--dark);
    font-weight: 600;
    font-size: 1.1em;
}

.label-icon {
    font-size: 1.3em;
}

.speaker-id-display {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    color: var(--white);
    padding: 30px 40px;
    border-radius: 16px;
    font-size: 2.5em;
    font-weight: 800;
    text-align: center;
    letter-spacing: 4px;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    border: 3px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.speaker-id-display::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: rotate(45deg);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }

    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

.speaker-id-display:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.5);
}

.speaker-id-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.6em;
    font-weight: 500;
    letter-spacing: 1px;
}

.speaker-id-loading .spinner {
    animation: spin 1s linear infinite;
    font-size: 1.2em;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.speaker-id-value {
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    animation: fadeInScale 0.5s ease;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.speaker-id-ready {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    }

    50% {
        box-shadow: 0 8px 32px rgba(102, 126, 234, 0.6);
    }
}

.speaker-id-error {
    color: var(--white);
    font-size: 0.5em;
    font-weight: 500;
    letter-spacing: 1px;
}

.speaker-id-note {
    margin-top: 15px;
    text-align: center;
    color: var(--gray);
    font-size: 0.9em;
    font-style: italic;
    padding: 0 20px;
    line-height: 1.5;
}

.button-container {
    margin-top: 40px;
    display: flex;
    justify-content: center;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.button-container .btn {
    min-width: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 24px;
    font-weight: 600;
    font-size: 1em;
    border-radius: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.button-container .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.button-container .btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.button-container .btn-secondary {
    min-width: 140px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    border: 2px solid #4f46e5;
}

.button-container .btn-secondary:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    border-color: #4338ca;
    color: white;
}

.button-container .btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
}

.btn-arrow {
    font-size: 1.2em;
    transition: transform 0.3s ease;
}

.btn:hover .btn-arrow {
    transform: translateX(5px);
}

.option-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.country-select-container {
    margin: 20px 0;
}

.country-select {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--gray-light);
    border-radius: 12px;
    font-size: 1em;
    background: var(--white);
    color: var(--dark);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236366f1' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 18px center;
    padding-right: 45px;
}

.country-select:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}

.country-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.option-btn {
    padding: 18px 24px;
    border: 2px solid var(--gray-light);
    border-radius: 12px;
    background: var(--white);
    color: var(--dark);
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.option-btn:hover {
    border-color: var(--primary);
    background: var(--light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.option-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.form-input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--gray-light);
    border-radius: 12px;
    font-size: 1em;
    font-family: inherit;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Mobile First - Summary */
.metadata-summary {
    background: var(--light);
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 20px;
    border: 2px solid var(--gray-light);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (min-width: 768px) {
    .metadata-summary {
        padding: 22px;
        margin-bottom: 25px;
        border-radius: 16px;
        grid-template-columns: 1fr;
        gap: 0;
    }
}

@media (min-width: 1024px) {
    .metadata-summary {
        padding: 25px;
    }
}

.summary-item {
    padding: 12px;
    border: 1px solid var(--gray-light);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
    background: var(--white);
}

.summary-item:last-child {
    border-bottom: 1px solid var(--gray-light);
}

@media (min-width: 768px) {
    .summary-item {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 0;
        padding: 12px 0;
        border: none;
        border-bottom: 1px solid var(--gray-light);
        border-radius: 0;
        background: transparent;
    }

    .summary-item:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }
}

.summary-item strong {
    color: var(--dark);
    font-size: 0.85em;
    font-weight: 700;
    margin-bottom: 4px;
    display: block;
}

.summary-value {
    color: var(--dark);
    font-size: 0.9em;
    word-break: break-word;
    text-align: left;
    display: block;
}

@media (min-width: 768px) {
    .summary-item strong {
        min-width: 140px;
        margin-bottom: 0;
        font-size: 1em;
        display: inline;
    }

    .summary-value {
        text-align: right;
        font-size: 1em;
        display: inline;
    }
}

/* Mobile First - Consent Box */
.consent-box {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px solid var(--info);
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

@media (min-width: 768px) {
    .consent-box {
        padding: 22px;
        margin-bottom: 25px;
        border-radius: 16px;
    }
}

@media (min-width: 1024px) {
    .consent-box {
        padding: 25px;
    }
}

.consent-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-size: 0.95em;
    line-height: 1.6;
    color: var(--dark);
}

@media (min-width: 768px) {
    .consent-label {
        font-size: 1.05em;
        gap: 14px;
    }
}

.consent-label input[type="checkbox"] {
    width: 22px;
    height: 22px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: var(--primary);
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .consent-label input[type="checkbox"] {
        width: 24px;
        height: 24px;
        margin-top: 3px;
    }
}

.consent-label span {
    flex: 1;
    word-wrap: break-word;
}

.required-indicator {
    color: var(--danger);
    font-weight: 700;
    font-size: 1.1em;
    margin-right: 4px;
}

@media (min-width: 768px) {
    .required-indicator {
        font-size: 1.2em;
    }
}

.required-note {
    margin-top: 12px;
    font-size: 0.85em;
    color: var(--danger);
    font-weight: 600;
    font-style: italic;
    padding-left: 34px;
}

@media (min-width: 768px) {
    .required-note {
        font-size: 0.9em;
        padding-left: 38px;
    }
}

/* Mobile First - Button Group */
.button-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 25px;
}

@media (min-width: 768px) {
    .button-group {
        flex-direction: row;
        gap: 20px;
        justify-content: space-between;
        margin-top: 30px;
    }
}

.button-group .btn {
    flex: 1;
    padding: 16px 20px;
    font-weight: 700;
    font-size: 0.95em;
    border-radius: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    width: 100%;
    text-align: center;
}

@media (min-width: 768px) {
    .button-group .btn {
        padding: 14px 24px;
        font-size: 1em;
        width: auto;
    }
}

.button-group .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.button-group .btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.button-group .btn-secondary {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    border: 2px solid #4f46e5;
}

.button-group .btn-secondary:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    border-color: #4338ca;
    color: white;
}

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

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

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

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

/* Pulse animation for consent box highlight */
@keyframes consentPulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
}

/* Success Modal */
.success-modal {
    max-width: calc(100% - 20px);
    width: 100%;
    padding: 50px 40px;
    text-align: center;
    background: #ffffff !important;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    margin: auto;
    box-sizing: border-box;
}

.success-content {
    animation: fadeInScale 0.4s ease;
}

.success-icon {
    font-size: 5em;
    margin-bottom: 20px;
    animation: bounceIn 0.6s ease;
}

.success-content h2 {
    color: var(--success);
    font-size: 2.5em;
    font-weight: 900;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.success-message {
    color: var(--dark);
    font-size: 1.3em;
    margin-bottom: 40px;
    line-height: 1.8;
    font-weight: 500;
    padding: 0 20px;
}

.success-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.success-actions .btn {
    min-width: 180px;
    padding: 16px 32px;
    font-size: 1.1em;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3) rotate(-180deg);
    }

    50% {
        opacity: 1;
        transform: scale(1.1) rotate(10deg);
    }

    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Paragraph-by-Paragraph Recording Styles */
.script-paragraph {
    margin-bottom: 0;
    padding: 4px 0;
    border-radius: 0;
    transition: all 0.3s ease;
    line-height: 1.4;
}

.script-paragraph.active-paragraph {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    border: 2px solid var(--primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
    transform: translateX(5px);
}

/* Paragraph Recording Section - Regular page section, not modal */
.paragraph-recording-section {
    display: block !important;
    width: 98%;
    max-width: 1200px;
    margin: 15px auto;
    background: var(--white);
    border-radius: 20px;
    padding: 25px 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    box-sizing: border-box;
    position: relative;
    z-index: 100;
}

.paragraph-recording-section.hidden {
    display: none !important;
}

/* Hide container content when paragraph recording is active */
body.paragraph-recording-active .container>header,
body.paragraph-recording-active .container>#scripts-list,
body.paragraph-recording-active .container>#script-view,
body.paragraph-recording-active .container>#metadata-modal {
    display: none !important;
}

body.paragraph-recording-active .container {
    padding: 0;
    background: transparent;
    box-shadow: none;
    max-width: 100%;
}

/* Extra small mobile */
@media (max-width: 480px) {
    .paragraph-recording-section {
        width: 96%;
        padding: 22px 18px;
        margin: 10px auto;
        border-radius: 18px;
    }
}

/* Tablet and Desktop */
@media (min-width: 768px) {
    .paragraph-recording-section {
        padding: 40px;
        margin: 20px auto;
        border-radius: 24px;
    }
}

/* Hide header when paragraph recording section is visible */
body.paragraph-recording-active header,
body.paragraph-recording-active>.container>header {
    display: none !important;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

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

/* Removed decorative top bar */

/* Styles moved to media queries above */

/* Mobile First - Header - Match main page header */
.paragraph-recording-header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 3px solid var(--gray-light);
}

.paragraph-recording-header h2 {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    font-size: 2em;
    font-weight: 900;
    letter-spacing: -1px;
    text-align: center;
    position: relative;
    display: inline-block;
    width: 100%;
}

.paragraph-recording-header h2::before {
    content: "📝";
    display: block;
    font-size: 0.5em;
    margin-bottom: 8px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    opacity: 0.9;
}

@keyframes gradientShift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

@media (min-width: 768px) {
    .paragraph-recording-header {
        margin-bottom: 40px;
        padding-bottom: 30px;
    }

    .paragraph-recording-header h2 {
        font-size: 3.5em;
        letter-spacing: -2px;
    }

    .paragraph-recording-header h2::before {
        font-size: 0.4em;
        margin-bottom: 10px;
    }
}

.paragraph-progress {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    width: 100%;
}

.paragraph-progress span {
    font-weight: 800;
    color: var(--dark);
    font-size: 1em;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 0.85em;
}

@media (min-width: 768px) {
    .paragraph-progress span {
        font-size: 0.95em;
    }
}

.progress-bar-small {
    width: 100%;
    max-width: 500px;
    height: 6px;
    background: #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

@media (min-width: 768px) {
    .progress-bar-small {
        height: 10px;
        max-width: 600px;
    }
}

.progress-fill-small {
    height: 100%;
    background: var(--primary);
    border-radius: 8px;
    transition: width 0.3s ease;
    width: 0%;
    position: relative;
    overflow: hidden;
    animation: progressGlow 2s ease-in-out infinite;
}

@keyframes progressGlow {

    0%,
    100% {
        box-shadow: 0 2px 12px rgba(99, 102, 241, 0.5),
            0 0 20px rgba(99, 102, 241, 0.3);
    }

    50% {
        box-shadow: 0 2px 16px rgba(99, 102, 241, 0.7),
            0 0 30px rgba(99, 102, 241, 0.5);
    }
}

.progress-fill-small::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

/* Mobile First - Body */
.paragraph-recording-body {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

@media (min-width: 768px) {
    .paragraph-recording-body {
        gap: 30px;
    }
}

@media (min-width: 1024px) {
    .paragraph-recording-body {
        gap: 35px;
    }
}

.current-paragraph-section {
    margin-bottom: 20px;
    padding: 15px;
    background: var(--light);
    border: 2px solid var(--gray-light);
    border-radius: 12px;
}

.paragraph-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

.current-paragraph-section h3 {
    color: var(--primary);
    margin-bottom: 0;
    font-size: 1.1em;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (min-width: 768px) {
    .current-paragraph-section h3 {
        font-size: 1.2em;
        gap: 10px;
    }
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85em;
    border-radius: 8px;
    min-width: auto;
}

.current-paragraph-section h3::before {
    content: '📄';
    font-size: 1.2em;
}

.current-paragraph-text {
    font-size: 0.9em;
    line-height: 1.5;
    color: var(--dark);
    padding: 15px 18px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 12px;
    border-left: 4px solid var(--primary);
    white-space: pre-wrap;
    margin-top: 12px;
    min-height: 80px;
    margin-bottom: 0;
    position: relative;
    max-height: 150px;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
}

/* Removed decorative left border and hover effects */

@media (min-width: 768px) {
    .current-paragraph-text {
        font-size: 1.1em;
        padding: 22px 20px;
        max-height: 160px;
        line-height: 1.9;
    }
}

@media (min-width: 1024px) {
    .current-paragraph-text {
        font-size: 1.15em;
        padding: 24px 22px;
        max-height: 180px;
    }
}

.paragraph-recording-controls {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 3px solid var(--gray-light);
}

#paragraph-recording-controls-row {
    background: #f9fafb;
    padding: 15px 18px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (min-width: 768px) {
    #paragraph-recording-controls-row {
        flex-direction: row;
        align-items: center;
        padding: 18px 22px;
        gap: 15px;
    }
}

#paragraph-recording-controls-row .recording-timer {
    background: #ffffff;
    padding: 12px 18px;
    border-radius: 8px;
    border: 1px solid var(--primary);
    font-weight: 600;
    font-size: 1.1em;
    color: var(--primary);
    letter-spacing: 1px;
    flex: 0 0 auto;
}

@media (min-width: 768px) {
    #paragraph-recording-controls-row .recording-timer {
        padding: 14px 22px;
        font-size: 1.2em;
    }
}

#paragraph-recording-controls-row .btn {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

#paragraph-recording-controls-row .btn:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.paragraph-action-buttons {
    margin-top: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.paragraph-action-buttons .btn-large {
    padding: 16px 24px;
    font-size: 1.05em;
    font-weight: 800;
    border-radius: 14px;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3),
        0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.3px;
    text-transform: uppercase;
    font-size: 0.9em;
}

.paragraph-action-buttons .btn-large:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.5),
        0 4px 15px rgba(0, 0, 0, 0.15);
}

@media (min-width: 768px) {
    .paragraph-action-buttons {
        gap: 18px;
    }

    .paragraph-action-buttons .btn-large {
        padding: 18px 28px;
        font-size: 0.95em;
        border-radius: 16px;
    }
}

@media (min-width: 1024px) {
    .paragraph-action-buttons .btn-large {
        padding: 20px 32px;
        font-size: 1em;
    }
}

.paragraph-playback-section {
    margin-top: 15px;
    padding: 18px;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 50%, #f0fdf4 100%);
    border-radius: 16px;
    border: 2px solid #86efac;
    position: relative;
    z-index: 5;
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.2),
        0 0 0 1px rgba(34, 197, 94, 0.1);
    animation: fadeInUp 0.4s ease;
    position: relative;
    overflow: hidden;
}

.paragraph-playback-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--success) 0%, #059669 100%);
    border-radius: 16px 0 0 16px;
}

.paragraph-playback-section audio {
    display: none;
}

@media (min-width: 768px) {
    .paragraph-playback-section {
        padding: 22px;
        margin-top: 18px;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.paragraph-playback-section audio {
    display: none;
}

.paragraph-playback-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 0;
}

.paragraph-playback-actions .btn {
    width: 100%;
    padding: 14px 20px;
    font-size: 0.95em;
    font-weight: 700;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    transition: all 0.3s ease;
    cursor: pointer;
    pointer-events: auto;
    z-index: 10;
    position: relative;
}

.paragraph-playback-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.paragraph-playback-actions #play-audio-bottom-btn {
    order: 1;
    background: linear-gradient(135deg, var(--info) 0%, #2563eb 100%);
    color: var(--white);
    margin-bottom: 8px;
}

.paragraph-playback-actions #play-audio-bottom-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, var(--info) 100%);
}

.paragraph-playback-actions #confirm-correct-btn {
    order: 2;
}

.paragraph-playback-actions #rerecord-paragraph-btn {
    order: 3;
}

@media (min-width: 768px) {
    .paragraph-playback-actions {
        flex-direction: row;
        gap: 12px;
        flex-wrap: wrap;
    }

    .paragraph-playback-actions .btn {
        flex: 1;
        min-width: 150px;
        padding: 12px 18px;
        font-size: 0.9em;
    }

    .paragraph-playback-actions #play-audio-bottom-btn {
        order: 1;
        flex: 0 0 100%;
        margin-bottom: 0;
    }

    .paragraph-playback-actions #confirm-correct-btn {
        order: 2;
    }

    .paragraph-playback-actions #rerecord-paragraph-btn {
        order: 3;
    }
}

.btn-info {
    background: linear-gradient(135deg, var(--info) 0%, #2563eb 100%);
    color: var(--white);
}

.btn-info:hover {
    background: linear-gradient(135deg, #2563eb 0%, var(--info) 100%);
}

/* Final Review Modal content styling */

.final-review-modal {
    max-width: calc(100% - 40px);
    width: 100%;
    max-width: 650px;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 2px solid #86efac;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border-radius: 20px;
    padding: 30px 25px;
    display: block;
    visibility: visible;
    opacity: 1;
    position: relative;
    margin: auto;
    box-sizing: border-box;
    overflow: visible;
    min-height: auto;
}

/* Desktop - Make modal bigger */
@media (min-width: 1024px) {
    .final-review-modal {
        max-width: 900px;
        padding: 50px 45px;
    }

    .final-review-header h2 {
        font-size: 3em;
        margin-bottom: 15px;
    }

    .final-review-header p {
        font-size: 1.2em;
    }

    .combined-audio-section {
        padding: 30px;
        margin-bottom: 35px;
    }

    .combined-audio-section h3 {
        font-size: 1.6em;
        margin-bottom: 20px;
    }

    .combined-audio-section audio {
        height: 50px;
    }

    .final-review-actions {
        gap: 25px;
        margin-top: 20px;
    }

    .final-review-actions .btn {
        padding: 20px 40px;
        font-size: 1.2em;
        min-width: 250px;
    }
}

/* Large Desktop - Even bigger */
@media (min-width: 1440px) {
    .final-review-modal {
        max-width: 1000px;
        padding: 60px 50px;
    }

    .final-review-header h2 {
        font-size: 3.5em;
    }

    .final-review-actions .btn {
        padding: 22px 45px;
        font-size: 1.3em;
        min-width: 280px;
    }
}

.final-review-header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--gray-light);
}

.final-review-header h2 {
    color: var(--success);
    font-size: 2em;
    margin-bottom: 10px;
    font-weight: 700;
}

.final-review-header p {
    color: var(--gray);
    font-size: 1em;
    margin: 0;
}

.combined-audio-section {
    margin-bottom: 25px;
    padding: 20px;
    background: var(--white);
    border-radius: 12px;
    border: 2px solid var(--gray-light);
}

.combined-audio-section h3 {
    color: var(--success);
    margin-bottom: 15px;
    font-size: 1.3em;
    font-weight: 600;
}

.combined-audio-section audio {
    width: 100%;
}

.final-review-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.final-review-actions .btn {
    flex: 1;
    min-width: 200px;
    cursor: pointer;
    pointer-events: auto;
    z-index: 10;
    position: relative;
    border: none;
    transition: all 0.3s ease;
}

.final-review-actions .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.final-review-actions .btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning) 0%, #f59e0b 100%);
    color: var(--white);
}

.btn-warning:hover {
    background: linear-gradient(135deg, #f59e0b 0%, var(--warning) 100%);
}

/* Mobile specific adjustments */
@media (max-width: 767px) {
    .paragraph-recording-modal {
        max-width: 96%;
        padding: 22px 18px;
        margin: 10px auto;
        border-radius: 18px;
    }

    .paragraph-recording-header {
        margin-bottom: 20px;
        padding-bottom: 15px;
    }

    .paragraph-recording-header h2 {
        font-size: 1.8em;
        flex-direction: column;
        gap: 8px;
    }

    .paragraph-recording-header h2::before {
        font-size: 0.6em;
        margin-bottom: 6px;
    }

    .paragraph-recording-body {
        gap: 18px;
    }

    .current-paragraph-text {
        padding: 18px 16px;
        font-size: 0.95em;
        line-height: 1.7;
        min-height: 100px;
    }

    .paragraph-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .paragraph-header-row .btn-small {
        width: 100%;
    }

    .paragraph-action-buttons .btn-large {
        padding: 16px 20px;
        font-size: 0.85em;
    }

    .paragraph-playback-section {
        padding: 18px;
    }

    .paragraph-playback-actions,
    .final-review-actions {
        flex-direction: column;
        gap: 12px;
    }

    .paragraph-playback-actions .btn,
    .final-review-actions .btn {
        width: 100%;
        min-width: unset;
    }

    #paragraph-recording-controls-row {
        padding: 12px;
        flex-direction: column;
        gap: 12px;
    }

    #paragraph-recording-controls-row .recording-timer {
        width: 100%;
        text-align: center;
    }

    #paragraph-recording-controls-row .btn {
        width: 100%;
    }

    .paragraph-recording-controls {
        margin-left: -18px;
        margin-right: -18px;
        padding-left: 18px;
        padding-right: 18px;
    }
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .container {
        padding: 20px 18px;
        border-radius: 18px;
        max-width: 95%;
        margin: 12px auto;
    }

    header {
        margin-bottom: 20px;
        padding-bottom: 15px;
    }

    header h1 {
        font-size: 1.8em;
        flex-direction: column;
        gap: 8px;
    }

    header h1::before {
        font-size: 1em;
        margin-bottom: 5px;
    }

    header p {
        font-size: 0.95em;
    }

    .scripts-container h2 {
        font-size: 1.4em;
        margin-bottom: 15px;
    }

    .instruction-banner {
        flex-direction: column;
        padding: 15px;
        gap: 12px;
        margin-bottom: 20px;
    }

    .instruction-icon {
        font-size: 1.8em;
        text-align: center;
    }

    .instruction-content strong {
        font-size: 1.1em;
    }

    .instruction-content p {
        font-size: 0.95em;
    }

    .scripts-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .script-card {
        padding: 18px;
    }

    .script-card h3 {
        font-size: 1.3em;
        margin-bottom: 12px;
    }

    .script-card p {
        font-size: 0.95em;
        margin-bottom: 12px;
    }

    /* Mobile styles are now in base styles above */
    .success-modal {
        padding: 30px 20px;
    }

    .success-icon {
        font-size: 3.5em;
    }

    .success-content h2 {
        font-size: 1.6em;
    }

    .success-message {
        font-size: 1.1em;
    }

    .success-actions {
        flex-direction: column;
        gap: 12px;
    }

    .success-actions .btn {
        width: 100%;
    }

    .modal-close {
        top: 10px;
        right: 10px;
        width: 32px;
        height: 32px;
        font-size: 1.4em;
    }

    .metadata-description {
        font-size: 0.95em;
        margin-bottom: 20px;
    }

    .speaker-id-display {
        padding: 20px 15px;
        font-size: 1.8em;
        min-height: 70px;
        letter-spacing: 2px;
    }

    .option-group {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .option-btn {
        padding: 14px 18px;
        font-size: 0.9em;
    }

    .recording-info {
        padding: 12px 15px;
        margin-bottom: 15px;
    }

    .recording-info p {
        font-size: 0.9em;
    }

    .recording-timer {
        padding: 12px;
        font-size: 1.2em;
        margin-bottom: 15px;
    }

    .recording-status {
        padding: 14px;
        font-size: 0.95em;
    }

    .audio-container {
        padding: 15px;
        margin-top: 15px;
    }

    .audio-container h4 {
        font-size: 1.1em;
        margin-bottom: 12px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 15px;
    }

    header h1 {
        font-size: 1.8em;
    }

    header h1::before {
        font-size: 0.6em;
        margin-bottom: 6px;
    }

    .scripts-container h2 {
        font-size: 1.4em;
    }

    /* Extra small mobile adjustments */
    .metadata-modal {
        padding: 18px 15px;
        margin: auto;
        max-width: calc(100% - 10px);
    }

    .speaker-id-display {
        font-size: 1.6em;
        padding: 18px 12px;
        letter-spacing: 1px;
    }

    .metadata-step h2 {
        font-size: 1.3em;
    }

    .metadata-description {
        font-size: 0.95em;
    }

    .metadata-summary {
        padding: 15px;
    }

    .consent-box {
        padding: 15px;
    }

    .consent-label {
        font-size: 0.88em;
        gap: 10px;
    }

    .consent-label input[type="checkbox"] {
        width: 20px;
        height: 20px;
        margin-top: 1px;
    }

    .required-note {
        font-size: 0.85em;
        margin-top: 10px;
    }

    .summary-item {
        padding: 12px 0;
        gap: 4px;
    }

    .summary-item strong {
        font-size: 0.85em;
    }

    .summary-item span:not(strong) {
        font-size: 0.85em;
    }

    .button-group {
        flex-direction: column;
        gap: 12px;
        margin-top: 20px;
        position: relative;
        z-index: 10;
    }

    .button-group .btn {
        padding: 16px 20px;
        font-size: 1em;
        width: 100%;
        display: block;
        visibility: visible;
        opacity: 1;
        position: relative;
        z-index: 10;
    }

    /* Step 6 specific improvements */
    #metadata-step-6 {
        display: flex;
        flex-direction: column;
        min-height: auto;
        overflow: visible;
        padding-bottom: 20px;
    }

    #metadata-step-6 h2 {
        font-size: 1.4em;
        margin-bottom: 15px;
    }

    #metadata-step-6 .metadata-summary {
        padding: 12px;
        margin-bottom: 16px;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        display: grid;
        overflow: visible;
    }

    #metadata-step-6 .summary-item {
        padding: 10px;
        font-size: 0.85em;
        min-height: 60px;
        display: flex;
        flex-direction: column;
    }

    #metadata-step-6 .summary-item strong {
        font-size: 0.8em;
        display: block;
        margin-bottom: 4px;
    }

    #metadata-step-6 .summary-value {
        font-size: 0.9em;
        word-break: break-word;
        display: block;
    }

    #metadata-step-6 .consent-box {
        padding: 14px;
        margin-bottom: 16px;
    }

    #metadata-step-6 .consent-label {
        font-size: 0.88em;
    }

    #metadata-step-6 .button-group {
        margin-top: 20px;
        margin-bottom: 10px;
        position: relative;
        z-index: 10;
        width: 100%;
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    #metadata-step-6 .button-group .btn {
        width: 100% !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative;
        z-index: 10;
        flex: 1;
    }

    /* Final Review Modal mobile improvements */
    .final-review-modal {
        padding: 18px 15px;
        max-width: calc(100% - 20px);
        border-radius: 16px;
    }

    .final-review-header {
        margin-bottom: 15px;
        padding-bottom: 10px;
    }

    .final-review-header h2 {
        font-size: 1.5em;
        margin-bottom: 6px;
    }

    .final-review-header p {
        font-size: 0.9em;
    }

    .combined-audio-section {
        padding: 12px;
        margin-bottom: 15px;
    }

    .combined-audio-section h3 {
        font-size: 1.1em;
        margin-bottom: 10px;
    }

    .final-review-actions {
        flex-direction: column;
        gap: 10px;
        margin-top: 0;
    }

    .final-review-actions .btn {
        width: 100%;
        padding: 14px 18px;
        font-size: 0.9em;
    }
}

.message {
    position: fixed;
    top: 30px;
    right: 30px;
    padding: 18px 28px;
    border-radius: 14px;
    color: var(--white);
    font-weight: 600;
    z-index: 1000;
    animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.05em;
}

.message.success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
}

.message.error {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

audio {
    width: 100%;
    margin-top: 20px;
    border-radius: 12px;
}

#audio-playback {
    display: block;
}

#back-btn {
    margin-bottom: 0;
}

@media (min-width: 768px) {
    #back-btn {
        margin-bottom: 0;
    }
}

/* Ensure script view is scrollable on mobile */
.script-view {
    margin-top: 30px;
    animation: fadeIn 0.5s ease;
    padding-bottom: 20px;
}

/* Sticky recording controls on mobile for better visibility */
@media (max-width: 767px) {
    .recording-section {
        position: relative;
        margin-bottom: 20px;
    }

    .recording-controls {
        position: sticky;
        bottom: 0;
        background: linear-gradient(135deg, var(--light) 0%, var(--white) 100%);
        padding-top: 15px;
        margin-top: 15px;
        border-top: 2px solid var(--gray-light);
        z-index: 10;
    }
}