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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.container {
    width: 100%;
    max-width: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 90vh;
    max-height: 800px;
}

/* Camera Section */
.camera-section {
    position: relative;
    width: 100%;
    flex: 0 0 38%;
    background: #000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#cameraPreview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

/* Recording Indicator */
.recording-indicator {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(255, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    display: none;
    align-items: center;
    gap: 8px;
    z-index: 10;
}

.recording-indicator.active {
    display: flex;
    animation: pulse 1s infinite;
}

.recording-dot {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: blink 0.7s infinite;
}

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

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Teleprompter Section */
.teleprompter-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    overflow: hidden;
    gap: 12px;
}

.teleprompter-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #444;
}

.speed-control label {
    font-weight: 600;
}

.speed-control input[type="range"] {
    flex: 1;
}

#teleprompterText {
    flex: 1;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    line-height: 1.6;
    resize: none;
    font-family: inherit;
    background: white;
    transition: border-color 0.3s;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#teleprompterText:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.char-count {
    font-size: 12px;
    color: #999;
    text-align: right;
}

/* Controls Section */
.controls-section {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e0e0e0;
    flex-wrap: wrap;
}

.btn {
    flex: 1;
    min-width: 80px;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-danger {
    background: #f5365c;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #ec0c38;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 54, 92, 0.4);
}

.btn-success {
    background: #2dce89;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #1fa872;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(45, 206, 137, 0.4);
}

.btn-secondary {
    background: #ccc;
    color: #333;
}

.btn-secondary:hover:not(:disabled) {
    background: #bbb;
    transform: translateY(-2px);
}

/* Status Message */
.status-message {
    padding: 12px 16px;
    text-align: center;
    font-size: 14px;
    color: #666;
    min-height: 20px;
}

.status-message.error {
    background: #ffe0e0;
    color: #d32f2f;
}

.status-message.success {
    background: #e0ffe0;
    color: #2d7a2d;
}

.status-message.info {
    background: #e0f2ff;
    color: #0066cc;
}

/* Permission Prompt */
.permission-prompt {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.permission-content {
    background: white;
    padding: 32px 24px;
    border-radius: 16px;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.permission-content h2 {
    margin-bottom: 12px;
    color: #333;
}

.permission-content p {
    color: #666;
    margin-bottom: 24px;
    line-height: 1.5;
}

.permission-content .btn {
    width: 100%;
    margin-bottom: 10px;
}

/* Mobile Optimizations */
@media (max-width: 600px) {
    .container {
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .controls-section {
        flex-direction: row;
    }

    .btn {
        flex: 1 1 calc(50% - 4px);
    }
}
