@import url('https://fonts.googleapis.com/css2?family=Gothic+A1:wght@700&family=Noto+Sans+KR:wght@400;700&display=swap');

:root {
    --primary-color: #333;
    --background-color: #eef2ff; /* Light indigo background */
    --card-bg-color: #ffffff;
    --btn-color: #6366f1; /* Indigo button */
    --btn-hover-color: #4f46e5;
    --btn-text-color: #ffffff;
    --font-gothic: 'Gothic A1', sans-serif;
    --font-noto: 'Noto Sans KR', sans-serif;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--background-color);
    font-family: var(--font-noto);
    color: var(--text-primary);
}

.app-container {
    width: 100%;
    max-width: 420px; /* A bit wider for comfort */
    height: 100vh;
    max-height: 840px; /* Maintain aspect ratio */
    background-color: #f9fafb; /* Slightly off-white */
    border-radius: 20px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.page {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 25px;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.page.active {
    display: flex;
    opacity: 1;
}

/* Part 1: Start Page */
#start-page .title {
    font-family: var(--font-gothic);
    font-size: 2.8rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 20px;
    position: absolute;
    top: 22%;
    color: var(--text-primary);
}

#start-image-placeholder {
    width: 160px;
    height: 160px;
    background-color: #e5e7eb;
    border-radius: 50%;
    position: absolute;
    top: 45%;
    transform: translateY(-50%);
    border: 5px solid white;
}

#start-btn {
    position: absolute;
    top: 70%;
}

#visitor-count {
    position: absolute;
    top: 82%;
    font-size: 1rem;
    color: var(--text-secondary);
}

/* Common elements */
.btn {
    padding: 15px 35px;
    font-size: 1.2rem;
    font-weight: 700;
    background-color: var(--btn-color);
    color: var(--btn-text-color);
    border: none;
    border-radius: 50px; /* Pill shape */
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.btn:hover {
    background-color: var(--btn-hover-color);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.btn:disabled {
    background-color: #d1d5db;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Part 2: Test Page */
#test-page {
    justify-content: flex-start;
    padding-top: 15px;
}

.test-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    margin-bottom: 25px;
}

.nav-btn {
    padding: 10px 20px;
    font-size: 1rem;
    box-shadow: none;
    background-color: transparent;
    color: var(--btn-color);
}

.nav-btn:hover {
    background-color: #eef2ff;
}

#question-title {
    font-family: var(--font-gothic);
    font-size: 1.6rem;
    text-align: center;
    margin-bottom: 15px;
    line-height: 1.5;
}

.image-placeholder.small {
    width: 100px;
    height: 100px;
    background-color: #e5e7eb;
    border-radius: 15px;
    margin-bottom: 20px;
}

.card-container {
    width: 95%;
    max-width: 340px;
    aspect-ratio: 4 / 6.5;
    perspective: 1200px;
}

.choice-card {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.76, 0, 0.24, 1);
}

.choice-card.is-flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    background: var(--card-bg-color);
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.card-face-back {
    transform: rotateY(180deg);
}

.card-title {
    font-family: var(--font-gothic);
    font-size: 1.4rem;
    color: var(--btn-color);
    margin-bottom: 15px;
}

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

.choice-btn {
    width: 100%;
    padding: 16px;
    font-size: 0.95rem;
    font-family: var(--font-noto);
    text-align: left;
    line-height: 1.4;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.choice-btn.selected {
    background-color: var(--btn-color);
    color: white;
    border-color: var(--btn-color);
    transform: scale(1.03);
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

/* Part 3: Loading Page */
#loading-page p {
    font-size: 1.2rem;
    color: var(--text-secondary);
}
.loader {
    border: 6px solid #e5e7eb;
    border-top: 6px solid var(--btn-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 25px;
}

#edit-answers-btn {
    margin-top: 30px;
    background: none;
    box-shadow: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 0;
}
#edit-answers-btn:hover {
    color: var(--text-primary);
}


@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Part 4: Result Page */
#result-page {
    text-align: center;
}

#result-capture {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
}

#result-summary-text {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 20px;
}

#result-card {
    width: 90%;
    max-width: 320px;
    aspect-ratio: 4/6;
    border-radius: 20px;
    margin-bottom: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

#result-outer-type, #result-inner-type {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-family: var(--font-gothic);
    font-weight: 700;
    color: white;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.2);
}

#result-persona-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

#result-persona-desc {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
    max-width: 90%;
}

.modal {
    display: none; 
    position: fixed; 
    z-index: 100; 
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
    background-color: #fefefe;
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 20px;
    padding-bottom: 40px;
    border-radius: 20px 20px 0 0;
    text-align: center;
    animation: slideUp 0.4s;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.modal-content p {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.modal-content button {
    display: block;
    width: 100%;
    margin-bottom: 10px;
    padding: 15px;
    border-radius: 12px;
    font-size: 1rem;
}

.close-btn {
    display: none; /* Hide X, users close by tapping outside or after action */
}

/* Part 5: Tips Page */
#tips-page {
    justify-content: flex-start;
    overflow-y: auto;
}
#tips-page::-webkit-scrollbar { display: none; } /* Hide scrollbar */

.tips-content {
    width: 100%;
    padding-bottom: 80px; /* space for restart button */
}

#tips-title {
    font-family: var(--font-gothic);
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.tips-content h3 {
    font-family: var(--font-gothic);
    font-size: 1.3rem;
    margin: 30px 0 15px;
    border-bottom: 2px solid #eef2ff;
    padding-bottom: 10px;
}

.chart-container {
    display: flex;
    justify-content: space-around;
    width: 100%;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.chart-container > div {
    width: 30%;
}

#tips-by-situation h4 {
    margin: 20px 0 8px;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--btn-color);
}
#tips-by-situation p {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
}

#restart-btn {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    max-width: 340px;
}