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

body {
    font-family: 'Inter', 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.container {
    max-width: 420px;
    margin: 0 auto;
    padding: 24px 16px;
    min-height: 100dvh;
    /* Let page/body handle scrolling; do not fix container height */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: visible;
}

.card {
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
    animation: fadeIn 0.6s ease-out;
    /* Let the card grow naturally; page will scroll */
}

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

.header { margin-bottom: 30px; }

.title {
    font-size: 2.2rem;
    color: #4a5568;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    color: #718096;
    font-size: 1rem;
    line-height: 1.5;
}

.progress-bar {
    width: 100%;
    height: 5px;
    background: #e2e8f0;
    border-radius: 3px;
    margin: 12px 0 16px 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 3px;
    transition: width 0.5s ease;
    width: 0%;
}

.question-container { display: none; animation: slideIn 0.5s ease-out; }
.question-container.active { display: block; }

@keyframes slideIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

.question {
    font-size: 1.1rem;
    color: #2d3748;
    margin-bottom: 16px;
    font-weight: 600;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.option {
    padding: 12px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    color: #4a5568;
    text-align: left;
}

.option:hover, .option:focus-visible {
    border-color: #667eea;
    background: #f7fafc;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.start-btn, .next-btn, .restart-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #ffffff;
    border: none;
    padding: 12px 22px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 14px;
}

.start-btn:hover, .next-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.result-container { display: none; text-align: center; }
.result-container { overflow: visible; }

html {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

/* Polished Result Card */
.result-card {
    position: relative;
    background: #ffffff;
    border-radius: 20px;
    padding: 18px;
    margin: 8px 0 12px 0;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
    /* Avoid clipping content; allow page to grow and scroll */
    overflow: visible;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.result-card-border {
    position: absolute;
    inset: 0;
    padding: 2px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(102,126,234,0.6), rgba(118,75,162,0.6));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
            mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    pointer-events: none;
}

/* Export-friendly styling to improve canvas fidelity */
.result-card.export-mode { 
    background: #ffffff; 
    border: 2px solid #e2e8f0; 
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}
.result-card.export-mode .result-card-border { display: none; }

.result-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.gemstone-icon { font-size: 3.4rem; margin: 14px 0; animation: sparkle 2s infinite; }

@keyframes sparkle {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.1) rotate(5deg); }
}

.gemstone-name {
    font-size: 1.6rem;
    color: #2d3748;
    margin-bottom: 8px;
    font-weight: 700;
}

.gemstone-description {
    color: #4a5568;
    line-height: 1.45;
    margin-bottom: 12px;
}

.benefits {
    background: #f7fafc;
    padding: 14px;
    border-radius: 12px;
    margin: 12px 0;
    text-align: left;
}

.benefits h3 { color: #2d3748; margin-bottom: 10px; font-size: 1.1rem; }

.benefits ul { list-style: none; padding: 0; }

.benefits li {
    color: #4a5568;
    margin-bottom: 4px;
    padding-left: 18px;
    position: relative;
}

.benefits li:before { content: "✨"; position: absolute; left: 0; }

.restart-btn {
    background: transparent;
    border: 2px solid #667eea;
    color: #667eea;
    padding: 12px 25px;
    border-radius: 20px;
    font-size: 1rem;
}

.restart-btn:hover { background: #667eea; color: #ffffff; }

.hidden { display: none !important; }

.save-image-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #ffffff;
    border: none;
    padding: 10px 18px;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 8px;
}

.save-image-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

/* Recommendations */
.recommendations {
    background: #f7fafc;
    padding: 12px;
    border-radius: 12px;
    margin-top: 10px;
    text-align: left;
}

.recommendations h3 {
    color: #2d3748;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.recommendations ul { list-style: none; padding: 0; margin: 0; }

.recommendations li {
    color: #4a5568;
    margin-bottom: 4px;
    padding-left: 18px;
    position: relative;
}

.recommendations li:before { content: "💠"; position: absolute; left: 0; }

@media (max-width: 480px) {
    .container { padding: 10px; }
    .card { padding: 14px; }
    .title { font-size: 1.6rem; }
    .gemstone-icon { font-size: 3.2rem; margin: 12px 0; }
    .result-card { padding: 14px; border-radius: 16px; }
    .result-card-border { border-radius: 16px; }
    .benefits, .recommendations { border-radius: 10px; }
}

