/* Magic Palm Reader Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comic Sans MS', cursive, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.palm-reader-app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    background: rgba(255, 255, 255, 0.95);
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.app-header h1 {
    font-size: 2.5rem;
    color: #6b46c1;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    animation: sparkle 2s ease-in-out infinite alternate;
}

.subtitle {
    color: #8b5cf6;
    font-size: 1.2rem;
    margin-top: 0.5rem;
}

@keyframes sparkle {
    0% { text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1); }
    100% { text-shadow: 2px 2px 8px rgba(107, 70, 193, 0.3); }
}

/* Container */
.container {
    flex: 1;
    padding: 2rem;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

/* Screen Management */
.screen {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.screen.active {
    display: block;
}

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

/* Welcome Screen */
.welcome-content {
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    padding: 3rem 2rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.magic-circle {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: rotate 3s linear infinite;
}

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

.welcome-content h2 {
    color: #6b46c1;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.welcome-content p {
    color: #666;
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

/* Setup Screen */
.setup-content {
    background: rgba(255, 255, 255, 0.9);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.setup-content h2 {
    color: #6b46c1;
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.8rem;
}

.input-group {
    margin-bottom: 2rem;
}

.input-group label {
    display: block;
    color: #6b46c1;
    font-weight: bold;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.input-group input[type="text"] {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    border: 3px solid #e0e7ff;
    border-radius: 15px;
    font-family: 'Comic Sans MS', cursive, sans-serif;
    transition: border-color 0.3s ease;
}

.input-group input[type="text"]:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
}

.age-slider {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.age-slider input[type="range"] {
    flex: 1;
    height: 8px;
    background: #e0e7ff;
    border-radius: 5px;
    outline: none;
}

.age-slider input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 25px;
    height: 25px;
    background: #8b5cf6;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.age-slider #ageDisplay {
    font-size: 1.5rem;
    font-weight: bold;
    color: #6b46c1;
    min-width: 30px;
}

.hand-selection {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.hand-btn {
    flex: 1;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.8);
    border: 3px solid #e0e7ff;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Comic Sans MS', cursive, sans-serif;
    font-size: 1rem;
}

.hand-btn:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: #8b5cf6;
    transform: translateY(-2px);
}

.hand-btn.selected {
    background: rgba(139, 92, 246, 0.2);
    border-color: #6b46c1;
    box-shadow: 0 5px 15px rgba(107, 70, 193, 0.3);
}

.hand-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.hand-btn span {
    display: block;
    color: #6b46c1;
    font-weight: bold;
}

/* Buttons */
.magic-btn {
    background: linear-gradient(135deg, #8b5cf6 0%, #6b46c1 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Comic Sans MS', cursive, sans-serif;
    box-shadow: 0 5px 15px rgba(139, 92, 246, 0.4);
    display: block;
    margin: 0 auto;
}

.magic-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(139, 92, 246, 0.5);
}

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

.magic-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 3px 10px rgba(139, 92, 246, 0.2);
}

.magic-btn.secondary {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    box-shadow: 0 5px 15px rgba(100, 116, 139, 0.4);
}

.magic-btn.secondary:hover:not(:disabled) {
    box-shadow: 0 7px 20px rgba(100, 116, 139, 0.5);
}

/* Photo Screen */
.photo-content {
    background: rgba(255, 255, 255, 0.9);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.photo-content h2 {
    color: #6b46c1;
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.photo-content p {
    color: #666;
    margin-bottom: 2rem;
}

#selectedHandText {
    color: #8b5cf6;
    font-weight: bold;
}

.camera-container {
    position: relative;
    display: inline-block;
    margin-bottom: 2rem;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 15px;
    overflow: hidden;
    max-width: 100%;
}

#cameraVideo {
    width: 100%;
    max-width: 400px;
    height: auto;
    display: block;
    border-radius: 15px;
}

#photoPreview {
    position: relative;
}

#capturedImage {
    width: 100%;
    max-width: 400px;
    height: auto;
    border-radius: 15px;
    border: 3px solid #8b5cf6;
    box-shadow: 0 5px 15px rgba(139, 92, 246, 0.3);
}

.camera-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.camera-controls .magic-btn {
    margin: 0;
}

.photo-instructions {
    background: rgba(139, 92, 246, 0.1);
    border-radius: 15px;
    padding: 1.5rem;
    margin-top: 1rem;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}

.instruction-item:last-child {
    margin-bottom: 0;
}

.instruction-icon {
    font-size: 1.5rem;
    width: 2rem;
    text-align: center;
}

.instruction-item span:last-child {
    color: #6b46c1;
    font-weight: bold;
    flex: 1;
    text-align: left;
}

/* File Upload Option */
.file-upload-container {
    text-align: center;
    padding: 2rem;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 15px;
    border: 2px dashed #8b5cf6;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.file-upload-container h3 {
    color: #6b46c1;
    margin-bottom: 0.5rem;
}

.file-upload-container p {
    color: #666;
    margin-bottom: 1.5rem;
}

/* Hand Detection Feedback */
.hand-not-detected, .skip-detection-confirm {
    text-align: center;
    padding: 2rem;
    background: rgba(255, 107, 107, 0.1);
    border: 2px solid #ff6b6b;
    border-radius: 15px;
}

.skip-detection-confirm {
    background: rgba(139, 92, 246, 0.1);
    border-color: #8b5cf6;
}

.warning-icon, .info-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hand-not-detected h3, .skip-detection-confirm h3 {
    color: #dc2626;
    margin-bottom: 1rem;
}

.skip-detection-confirm h3 {
    color: #6b46c1;
}

.hand-not-detected p, .skip-detection-confirm p {
    color: #666;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.hand-not-detected ul {
    text-align: left;
    max-width: 300px;
    margin: 0 auto 1.5rem;
    color: #666;
}

.hand-not-detected li {
    margin-bottom: 0.5rem;
}

.hand-detection-buttons, .skip-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.hand-detection-buttons .magic-btn, .skip-buttons .magic-btn {
    margin: 0;
}

/* Reading Screen */
.reading-content {
    background: rgba(255, 255, 255, 0.9);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

#readingTitle {
    color: #6b46c1;
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2rem;
}

.reading-card {
    background: linear-gradient(135deg, #fef3c7 0%, #fcd34d 100%);
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 2rem;
    box-shadow: 0 5px 15px rgba(252, 211, 77, 0.3);
}

.card-header {
    background: rgba(245, 158, 11, 0.2);
    padding: 1rem;
    text-align: center;
}

.card-header h3 {
    color: #92400e;
    font-size: 1.5rem;
}

.card-content {
    padding: 1.5rem;
}

.reading-main-text {
    font-size: 1.3rem;
    line-height: 1.6;
    color: #92400e;
    text-align: center;
    font-weight: bold;
}

.additional-predictions {
    margin-bottom: 2rem;
}

.prediction-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 10px;
    margin-bottom: 1rem;
}

.prediction-icon {
    font-size: 1.5rem;
}

.prediction-item span:last-child {
    color: #6b46c1;
    font-weight: bold;
    flex: 1;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Share Screen */
.share-content {
    background: rgba(255, 255, 255, 0.9);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.share-content h2 {
    color: #6b46c1;
    margin-bottom: 2rem;
    font-size: 1.8rem;
}

.share-card {
    background: white;
    border: 3px solid #e0e7ff;
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.share-header h3 {
    color: #6b46c1;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.share-text {
    color: #666;
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.share-footer {
    color: #8b5cf6;
    font-weight: bold;
    border-top: 2px solid #e0e7ff;
    padding-top: 1rem;
}

.share-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .app-header h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .hand-selection {
        flex-direction: column;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .magic-btn {
        width: 100%;
        max-width: 300px;
    }
    
    .share-buttons {
        flex-direction: column;
        align-items: center;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(139, 92, 246, 0.3);
    border-radius: 50%;
    border-top-color: #8b5cf6;
    animation: spin 1s ease-in-out infinite;
}

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