:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --bg-color: #F3F4F6;
    --card-bg: #FFFFFF;
    --text-main: #1F2937;
    --text-muted: #6B7280;
}
body {
    font-family: 'Pretendard', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}
.container {
    background-color: var(--card-bg);
    width: 100%;
    max-width: 500px;
    min-height: 600px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}
.header {
    padding: 24px;
    text-align: center;
    border-bottom: 1px solid #E5E7EB;
}
.content {
    padding: 32px 24px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
h1 { font-size: 1.5rem; margin: 0; color: var(--text-main); }
h2 { font-size: 1.25rem; line-height: 1.5; margin-bottom: 24px; text-align: center; }
p { color: var(--text-muted); line-height: 1.6; }

/* Cleaned up classes from inline styling */
.start-desc {
    margin-top: 16px;
    margin-bottom: 20px;
}
.preview-section {
    margin-top: 8px;
}
.preview-desc {
    margin-bottom: 12px;
    font-size: 0.95rem;
}
#preview-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.btn {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 100%;
    margin-bottom: 12px;
    box-sizing: border-box;
}
.btn:hover { background-color: var(--primary-hover); }

/* Remove margin for modal close button */
.modal-card .btn {
    margin-bottom: 0;
}

.option-btn {
    background-color: #F9FAFB;
    color: var(--text-main);
    border: 2px solid #E5E7EB;
    padding: 16px;
    border-radius: 12px;
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 12px;
    width: 100%;
    line-height: 1.4;
    box-sizing: border-box;
}
.option-btn:hover {
    border-color: var(--primary);
    background-color: #EEF2FF;
}

.progress-bar {
    height: 6px;
    background-color: #E5E7EB;
    width: 100%;
}
.progress-fill {
    height: 100%;
    background-color: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
}

.hidden { display: none !important; }
.text-center { text-align: center; }

.result-emoji { font-size: 4rem; margin-bottom: 16px; }
.preview-btn {
    background-color: #FFFFFF;
    color: var(--text-main);
    border: 1px solid #D1D5DB;
    padding: 12px;
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.preview-btn:hover {
    border-color: var(--primary);
    background-color: #EEF2FF;
}
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
}
.modal-card {
    width: 100%;
    max-width: 520px;
    background: #FFFFFF;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.18);
    padding: 24px;
    text-align: left;
    max-height: 85vh;
    max-height: 85dvh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.modal-header-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}
#modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
}
#modal-subtitle.modal-meta {
    margin-bottom: 0;
}
.modal-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.modal-close {
    background: #F3F4F6;
    border: none;
    border-radius: 999px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-meta {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.modal-box {
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
    line-height: 1.55;
    font-size: 0.95rem;
}
.modal-fact { background-color: #FEF2F2; color: #991B1B; }
.modal-cheer { background-color: #ECFDF5; color: #065F46; }
.result-title { font-size: 1.5rem; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.result-subtitle { font-size: 1.1rem; font-weight: 600; margin-bottom: 24px; }
.fact-bomb { background-color: #FEF2F2; color: #991B1B; padding: 16px; border-radius: 12px; margin-bottom: 16px; text-align: left; font-size: 0.95rem; }
.cheer-up { background-color: #ECFDF5; color: #065F46; padding: 16px; border-radius: 12px; margin-bottom: 32px; text-align: left; font-size: 0.95rem; }

/* ---------------------------------------------------- */
/* Responsive Design (Tablet & Mobile Optimizations)     */
/* ---------------------------------------------------- */

/* Tablet Optimization (Max Width: 768px) */
@media (max-width: 768px) {
    body {
        padding: 20px;
        min-height: calc(100vh - 40px);
    }
    .container {
        max-width: 480px;
        min-height: 580px;
    }
}

/* Mobile Small & Standard Optimization (Max Width: 480px) */
@media (max-width: 480px) {
    body {
        padding: 0;
        min-height: 100vh;
        min-height: 100dvh;
        background-color: var(--card-bg); /* Native app-like seamless full screen */
    }
    .container {
        width: 100%;
        max-width: 100%;
        min-height: 100vh;
        min-height: 100dvh;
        border-radius: 0;
        box-shadow: none;
    }
    .content {
        padding: 24px 16px;
    }
    .header {
        padding: 16px;
    }
    h1 {
        font-size: 1.35rem;
    }
    h2 {
        font-size: 1.15rem;
        margin-bottom: 20px;
    }
    .btn, .option-btn {
        padding: 14px;
        font-size: 0.95rem;
    }
    .option-btn {
        font-size: 0.9rem;
        margin-bottom: 10px;
    }
    .result-emoji {
        font-size: 3.5rem;
        margin-bottom: 12px;
    }
    .result-title {
        font-size: 1.35rem;
    }
    .result-subtitle {
        font-size: 1rem;
        margin-bottom: 16px;
    }
    .fact-bomb, .cheer-up {
        padding: 14px;
        font-size: 0.9rem;
        margin-bottom: 12px;
    }
    .cheer-up {
        margin-bottom: 24px;
    }
    .modal-overlay {
        padding: 12px;
    }
    .modal-card {
        padding: 20px;
        border-radius: 12px;
        max-height: 90vh;
        max-height: 90dvh;
    }
    #preview-buttons {
        grid-template-columns: 1fr; /* Single column on narrow screens to prevent cramped text */
        gap: 8px;
    }
}

/* Landscape / Extremely short vertical viewport optimization */
@media (max-height: 580px) {
    body {
        align-items: flex-start;
        padding-top: 10px;
        padding-bottom: 10px;
    }
    .container {
        min-height: auto;
    }
}
