:root {
    --primary-color: #5A67D8;
    --secondary-color: #9F7AEA;
    --text-color-light: #2D3748;
    --text-color-dark: #E2E8F0;
    --container-bg-light: rgba(255, 255, 255, 0.25);
    --container-bg-dark: rgba(45, 55, 72, 0.5);
    --light-gray: #EDF2F7;
    --dark-gray: #4A5568;
}

* {
    box-sizing: border-box;
}

@keyframes moveGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    color: var(--text-color-light);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: moveGradient 15s ease infinite;
    transition: color 0.3s ease;
}

body.dark-mode {
    color: var(--text-color-dark);
}

.container {
    width: 100%;
    max-width: 600px;
    background-color: var(--container-bg-light);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    padding: 40px;
    text-align: center;
    transition: background-color 0.3s ease;
}

body.dark-mode .container {
    background-color: var(--container-bg-dark);
    border-color: rgba(255, 255, 255, 0.1);
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

/* --- Language & Theme Switchers --- */
.language-selector-wrapper, .theme-switch-wrapper {
    flex-shrink: 0;
}

#language-selector {
    padding: 8px 12px;
    border-radius: 8px;
    border: none;
    background-color: rgba(255, 255, 255, 0.2);
    color: var(--text-color-light);
    font-weight: 700;
    cursor: pointer;
    backdrop-filter: blur(5px);
}

body.dark-mode #language-selector {
    background-color: rgba(0, 0, 0, 0.2);
    color: var(--text-color-dark);
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.theme-switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.2);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px; width: 18px;
    left: 4px; bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }

/* --- Page Content --- */
.page { display: none; animation: fadeIn 0.5s ease-in-out; }
#start-page {
    position: relative; /* For positioning graphics */
    display: block;
}

.start-page-graphics svg {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 200px;
    transform: translate(-50%, -50%);
    opacity: 0.1;
    z-index: -1;
}

.start-page-graphics .egen-svg {
    transform: translate(-120%, -100%);
}

.start-page-graphics .teto-svg {
    transform: translate(20%, 0%);
}

#result-graphic {
    width: 120px;
    height: 120px;
    margin: 0 auto 15px auto;
    animation: zoomIn 0.5s cubic-bezier(0.390, 0.575, 0.565, 1.000) both;
}

#result-graphic svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

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

.page h1 {
    font-size: 3rem;
    font-weight: 700;
    color: inherit; /* Inherit from body */
    margin-bottom: 15px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.page p {
    font-size: 1.2rem;
    color: inherit;
    margin-bottom: 40px;
    opacity: 0.9;
}

.gender-selection {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.gender-btn, .answer-btn, #retry-btn, #share-btn {
    width: 100%;
    padding: 18px;
    font-size: 1.1rem;
    font-weight: 700;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.gender-btn {
    background-color: rgba(255, 255, 255, 0.3);
    color: var(--text-color-light);
}

body.dark-mode .gender-btn {
    background-color: rgba(0, 0, 0, 0.2);
    color: var(--text-color-dark);
}

.gender-btn:hover {
    background-color: rgba(255, 255, 255, 0.7);
    transform: translateY(-3px);
}

body.dark-mode .gender-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.answer-buttons { display: flex; flex-direction: column; gap: 15px; }

.answer-btn {
    background-color: var(--light-gray);
    color: var(--text-color-light);
    text-align: left;
    padding-left: 25px;
}

body.dark-mode .answer-btn {
    background-color: var(--dark-gray);
    color: var(--text-color-dark);
}

.answer-btn:hover {
    border-color: var(--primary-color);
    background-color: #EBF4FF;
}

body.dark-mode .answer-btn:hover {
    border-color: var(--primary-color);
    background-color: #5A667A;
    color: #FFFFFF;
}

#question-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 40px; line-height: 1.6; }
.question-counter { font-size: 1rem; font-weight: 700; color: var(--primary-color); margin-bottom: 15px; }

.progress-bar-container { width: 100%; height: 8px; background-color: rgba(0,0,0,0.1); border-radius: 4px; margin-bottom: 40px; overflow: hidden; }
.progress-bar { width: 0%; height: 100%; background: linear-gradient(90deg, var(--primary-color), var(--secondary-color)); border-radius: 4px; transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1); }

#result-title { font-size: 2.8rem; font-weight: 700; color: inherit; margin-bottom: 20px; }

#result-description { font-size: 1.05rem; text-align: left; line-height: 1.8; margin-bottom: 40px; }
#result-description strong {
    display: block;
    margin-top: 15px;
    margin-bottom: 5px;
    color: inherit;
    opacity: 0.8;
    font-size: 1.1rem;
}

.result-buttons-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 30px;
}

#retry-btn, #share-btn {
    background-color: var(--primary-color);
    color: white;
}

#retry-btn:hover, #share-btn:hover {
    filter: brightness(110%);
    transform: translateY(-2px);
}

/* Responsive Design */
@media (max-width: 640px) {
    body { padding: 0; }
    .container { border-radius: 0; min-height: 100vh; padding: 30px 20px; border: none; }
    .page h1 { font-size: 2.5rem; }
    #result-title { font-size: 2.2rem; }
    .gender-selection { grid-template-columns: 1fr; }
}

/* RTL Support */
[dir="rtl"] .answer-btn { text-align: right; padding-left: 15px; padding-right: 25px; }
[dir="rtl"] .top-bar { flex-direction: row-reverse; }

/* --- Option Styling for Select --- */
#language-selector option {
    background-color: #ffffff;
    color: #2D3748;
}

body.dark-mode #language-selector option {
    background-color: var(--dark-gray);
    color: var(--text-color-dark);
}
