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

*, *::before, *::after {
    box-sizing: border-box;
}

/* --- Animation Keyframes --- */
@keyframes spinner {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

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

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

/* General Body Styles */
body {
    font-family: 'Noto Sans KR', sans-serif;
    margin: 0;
    background: #141E30;
    background: -webkit-linear-gradient(to right, #243B55, #141E30);
    background: linear-gradient(to right, #243B55, #141E30);
    color: white;
    display: flex;
    flex-direction: column; /* Changed from row to column */
    align-items: center;
    min-height: 100vh;
    box-sizing: border-box;
    animation: fadeIn 0.8s ease-in-out;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 800px;
    text-align: center;
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.header h1 {
    font-size: 2.8em;
    font-weight: 700;
    margin-bottom: 10px;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    animation: slideUpFadeIn 0.6s ease-out;
}

.header p {
    font-size: 1.3em;
    margin-bottom: 30px;
    color: #eee;
    animation: slideUpFadeIn 0.6s ease-out 0.2s;
    animation-fill-mode: backwards;
}

.akilamp img {
    width: 220px;
    margin-bottom: 40px;
    filter: drop-shadow(0 0 15px #FFD700);
    animation: slideUpFadeIn 0.6s ease-out 0.4s;
    animation-fill-mode: backwards;
}

.play-button-container {
    text-align: center;
    margin-top: 20px;
    animation: slideUpFadeIn 0.6s ease-out 0.6s;
    animation-fill-mode: backwards;
}

.play-button {
    display: inline-block;
    background: #FFD700;
    color: #141E30;
    font-size: 1.6em;
    font-weight: bold;
    padding: 15px 45px;
    border-radius: 50px;
    text-decoration: none;
    box-shadow: 0 5px 15px rgba(0,0,0,0.4);
    transition: all 0.2s ease;
}

.play-button:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0,0,0,0.5);
    background: #ffc700;
}

/* Google Login Button */
.google-login-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: bold;
    color: #444;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 25px;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.3s, box-shadow 0.3s;
    width: 100%;
    box-sizing: border-box;
}

.google-login-btn:hover {
    background-color: #f7f7f7;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.google-login-btn::before {
    content: '';
    display: block;
    width: 20px;
    height: 20px;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2048%2048%22%20width%3D%2248px%22%20height%3D%2248px%22%3E%3Cpath%20fill%3D%22%23FFC107%22%20d%3D%22M43.611%2C20.083H42V20H24v8h11.303c-1.649%2C4.657-6.08%2C8-11.303%2C8c-6.627%2C0-12-5.373-12-12s5.373-12%2C12-12c3.059%2C0%2C5.842%2C1.154%2C7.961%2C3.039l5.657-5.657C34.046%2C6.053%2C29.268%2C4%2C24%2C4C12.955%2C4%2C4%2C12.955%2C4%2C24s8.955%2C20%2C20%2C20s20-8.955%2C20-20C44%2C22.659%2C43.862%2C21.35%2C43.611%2C20.083z%22/%3E%3Cpath%20fill%3D%22%23FF3D00%22%20d%3D%22M6.306%2C14.691l6.571%2C4.819C14.655%2C15.108%2C18.961%2C12%2C24%2C12c3.059%2C0%2C5.842%2C1.154%2C7.961%2C3.039l5.657-5.657C34.046%2C6.053%2C29.268%2C4%2C24%2C4C16.318%2C4%2C9.656%2C8.337%2C6.306%2C14.691z%22/%3E%3Cpath%20fill%3D%22%234CAF50%22%20d%3D%22M24%2C44c5.166%2C0%2C9.86-1.977%2C13.409-5.192l-6.19-5.238C29.211%2C35.091%2C26.715%2C36%2C24%2C36c-5.202%2C0-9.619-3.317-11.283-7.946l-6.522%2C5.025C9.505%2C39.556%2C16.227%2C44%2C24%2C44z%22/%3E%3Cpath%20fill%3D%22%231976D2%22%20d%3D%22M43.611%2C20.083H42V20H24v8h11.303c-0.792%2C2.237-2.231%2C4.166-4.087%2C5.574l6.19%2C5.238C42.012%2C35.836%2C44%2C30.138%2C44%2C24C44%2C22.659%2C43.862%2C21.35%2C43.611%2C20.083z%22/%3E%3C/svg%3E');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.links {
    margin-top: 20px;
    font-size: 0.9em;
}
.links a {
    color: #FFD700;
    text-decoration: none;
}

/* Game & Result Pages */
.top-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    padding: 10px 20px;
    text-align: left;
    box-sizing: border-box;
}

.home-button {
    font-size: 1.5em;
    color: #FFD700;
    text-decoration: none;
    font-weight: bold;
}

.game-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    width: 100%;
    flex: 1;
    padding: 20px; /* Add padding here */
}

.character-container img {
    width: 200px;
    filter: drop-shadow(0 0 15px #FFD700);
}

.question-area {
    flex-grow: 1;
    max-width: 600px;
}

.question-bubble {
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #FFD700;
    border-radius: 20px;
    padding: 20px 30px;
    margin-bottom: 30px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: opacity 0.3s ease-in-out;
}

.question-bubble.is-changing {
    opacity: 0;
}

#question-title {
    font-size: 1.2em;
    color: #ccc;
    margin: 0 0 10px 0;
}

#question-text {
    font-size: 1.8em;
    font-weight: bold;
    margin: 0;
    color: #FFD700;
}

.answer-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}

.answer-buttons button {
    background: #FFD700;
    color: #141E30;
    border: none;
    border-radius: 30px;
    padding: 15px 30px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    min-width: 150px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.answer-buttons button:hover {
    background: #ffc700;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.4);
}

/* Result Page */
#result-container {
    background: rgba(0,0,0,0.5);
    padding: 40px;
    border-radius: 20px;
    border: 2px solid #FFD700;
    text-align: center;
    margin-bottom: 30px;
    animation: slideUpFadeIn 0.6s ease-out;
}

#person-name {
    font-size: 3em;
    color: #FFD700;
    text-shadow: 2px 2px 2px #000;
}

.result-button {
    display: inline-block;
    background: #FFD700;
    color: #141E30 !important; /* Ensure this color is applied */
    font-size: 1.2em;
    font-weight: bold;
    padding: 15px 35px;
    border-radius: 30px;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
    border: none;
    font-family: inherit;
    cursor: pointer;
}

.result-button:hover {
    background: #ffc700;
    transform: translateY(-2px);
    text-align: center;
}

/* Explanation Box on Register Page */
.explanation-box {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid #FFD700;
    border-radius: 15px;
    padding: 20px 30px;
    margin-bottom: 30px;
    text-align: center;
}

.explanation-box h2 {
    margin-top: 0;
    color: #FFD700;
}

.agreement-box {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid #FFD700;
    border-radius: 15px;
    padding: 20px 30px;
    margin-bottom: 30px;
    text-align: center;
}

.agreement-box label {
    font-size: 1.1em;
}

.agreement-box a {
    color: #FFD700;
    text-decoration: underline;
}

/* --- Custom Checkbox Styles --- */
.agreement-box label {
    position: relative;
    padding-left: 25px; /* Space for the custom checkbox */
    cursor: pointer;
    display: inline-block;
    line-height: 18px; /* Match checkbox height */
    vertical-align: middle;
}

/* Hide the default checkbox */
.agreement-box input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* Create the custom checkbox box */
.agreement-box label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 16px;
    height: 16px;
    border: 1px solid #FFD700;
    background-color: transparent;
    border-radius: 3px;
}

/* Create the checkmark (hidden by default) */
.agreement-box label::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid #FFD700;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    display: none; /* Hide it */
}

/* Show the checkmark when the checkbox is checked */
.agreement-box input[type="checkbox"]:checked + label::after {
    display: block;
}

/* Optional: slightly change box on hover */
.agreement-box label:hover::before {
    background-color: rgba(255, 215, 0, 0.1);
}

/* Register & Admin Pages */
.question-container, .admin-container {
    background: rgba(0, 0, 0, 0.3);
    padding: 30px;
    border-radius: 15px;
    width: 100%;
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
    text-align: left;
}

.question-item {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #444;
}
.question-item:last-child {
    border-bottom: none;
}

/* Register Page Answer Buttons */
#answer-options {
    display: flex;
    flex-direction: column; /* Align items vertically */
    align-items: center; /* Center items horizontally */
    gap: 15px;
    margin-top: 20px;
}

#answer-options input[type="radio"] {
    display: none; /* Hide the actual radio button */
}

#answer-options .radio-option {
    display: flex;
    gap: 10px;
}

#answer-options label {
    background: transparent;
    color: #FFD700;
    border: 2px solid #FFD700;
    border-radius: 30px;
    padding: 10px 25px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    min-width: 90px;
    text-align: center;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

#answer-options label:hover {
    background: rgba(255, 215, 0, 0.1);
    transform: translateY(-2px);
}

#answer-options input[type="radio"]:checked + label {
    background: #FFD700;
    color: #141E30;
    box-shadow: 0 6px 15px rgba(0,0,0,0.4);
}

.text-answer, .select-answer {
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #555;
    background-color: #333;
    color: white;
    font-size: 1em;
    width: 80%;
    max-width: 400px;
}


.question-item label {
    display: block;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.question-item .answers {
    display: flex;
    gap: 15px;
}

.question-item input[type="radio"] {
    display: none;
}

.question-item input[type="radio"] + label {
    padding: 8px 15px;
    border: 1px solid #FFD700;
    border-radius: 20px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.question-item input[type="radio"]:checked + label {
    background: #FFD700;
    color: #141E30;
    font-weight: bold;
}

/* Admin Table */
#user-count {
    text-align: center;
    margin-bottom: 20px;
}
.user-list-container {
    overflow-x: auto;
}
#user-table {
    width: 100%;
    border-collapse: collapse;
}
#user-table th, #user-table td {
    padding: 12px 15px;
    border: 1px solid #444;
    text-align: center;
}
#user-table th {
    background-color: #FFD700;
    color: #141E30;
}
#user-table .detail-btn {
    background: #FFD700;
    color: #141E30;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.7);
}
.modal-content {
    background-color: #243B55;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #FFD700;
    width: 80%;
    max-width: 500px;
    border-radius: 10px;
    color: #fff;
}
.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}
.close-button:hover, .close-button:focus {
    color: #FFD700;
    text-decoration: none;
    cursor: pointer;
}
#modal-user-answers ul {
    list-style-type: none;
    padding: 0;
}
#modal-user-answers li {
    padding: 8px 0;
    border-bottom: 1px solid #444;
}
#modal-user-answers li:last-child {
    border-bottom: none;
}

/* Responsive Styles */
@media (max-width: 768px) {
    body {
        padding: 10px;
        font-size: 11px; /* Further reduce base font size for mobile */
    }
    .header h1 { font-size: 2.5em; }
    .header p { font-size: 1.1em; }
    .play-button { font-size: 1.5em; padding: 15px 40px; }
    #person-name { font-size: 2.2em; }

    .game-container {
        flex-direction: column;
    }
    .character-container {
        margin-bottom: 15px;
    }
    .character-container img {
        width: 120px;
    }
    .question-area {
        width: 100%;
    }
    #question-text { font-size: 1.5em; }

    .links {
        flex-direction: column;
        align-items: center;
        width: 100%;
    }
    .result-button {
        width: 80%;
        text-align: center;
    }
}

/* Admin Page Status & Actions */
.status-approved {
    color: #4CAF50; /* Green */
    font-weight: bold;
}

.status-pending {
    color: #FFC107; /* Amber */
    font-weight: bold;
}

.action-cell {
    display: flex;
    justify-content: center;
    gap: 10px;
}

#user-table .approve-btn {
    background: #4CAF50; /* Green */
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

#user-table .approve-btn:hover {
    background: #45a049;
}

/* Add Question Form */
.add-question-container {
    margin-top: 40px;
}

#add-question-form {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

#add-question-form input[type="text"] {
    flex-grow: 1;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #555;
    background-color: #333;
    color: white;
    font-size: 1em;
}

#add-question-form button {
    background: #FFD700;
    color: #141E30;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s;
}

#add-question-form button:hover {
    background: #ffc700;
}
/* Result Page Feedback */
#feedback-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid #444;
}

.feedback-question {
    font-size: 1.4em;
    color: #eee;
    margin-bottom: 20px;
}

#thank-you-message {
    font-size: 1.5em;
    color: #4CAF50;
    font-weight: bold;
    margin-top: 30px;
}
/* Register Page Question Note */
.question-note {
    background-color: rgba(0, 0, 0, 0.2);
    border-left: 4px solid #FFD700;
    padding: 10px 15px;
    margin: 15px 0;
    color: #eee;
    font-style: italic;
    text-align: left;
    border-radius: 4px;
}
/* Admin Modal - Add Question to Person */
.add-question-to-person-container {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #444;
}

#add-person-question-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

#add-person-question-form input,
#add-person-question-form select {
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #555;
    background-color: #333;
    color: white;
    font-size: 0.9em;
}

#add-person-question-form button {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s;
}

#add-person-question-form button:hover {
    background: #45a049;
}
/* Auth Forms (Login & Signup) */
.auth-container {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.divider {
    margin: 20px 0;
    text-align: center;
    color: #888;
    position: relative;
}

.divider::before, .divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background-color: #444;
}

.divider::before {
    left: 0;
}

.divider::after {
    right: 0;
}

.auth-form-container {
    background: rgba(0, 0, 0, 0.2);
    padding: 30px;
    border-radius: 15px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group input {
    width: 100%;
    padding: 12px;
    box-sizing: border-box;
    border-radius: 5px;
    border: 1px solid #555;
    background-color: #333;
    color: white;
    font-size: 1em;
}

.form-group button {
    width: 100%;
    padding: 12px;
    background: #FFD700;
    color: #141E30;
    border: none;
    border-radius: 5px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.form-group button:hover {
    background: #ffc700;
}

.error-message {
    color: #ff4d4d;
    font-size: 0.9em;
    min-height: 1.2em;
}


/* --- Auth Page (Dark Mode) --- */

body.auth-page {
    justify-content: flex-start;
    padding-top: 5%;
}

.auth-page .container {
    max-width: 450px;
    padding: 0;
    background: none;
    box-shadow: none;
}

.auth-page .header {
    text-align: center;
    margin-bottom: 24px;
}

.auth-page .header h1 {
    font-size: 24px; /* Adjusted size */
    font-weight: 400;
    text-shadow: none;
    color: #eee; /* Lighter color for dark mode */
}

.auth-page .header p {
    font-size: 16px; /* Adjusted size */
    color: #ccc; /* Lighter color for dark mode */
}

.auth-page .auth-form-container {
    background: rgba(0, 0, 0, 0.3); /* Dark, semi-transparent background */
    border: 1px solid #444;
    border-radius: 8px;
    padding: 48px 40px 36px;
}

.auth-page .form-group {
    margin-bottom: 24px;
}

.auth-page .form-group input {
    background-color: #333;
    border: 1px solid #555;
    color: white;
    height: 50px;
    padding: 0 15px;
    font-size: 16px;
    width: 100%;
    border-radius: 4px;
    transition: border-color 0.2s;
}

.auth-page .form-group input:focus {
    outline: none;
    border-color: #FFD700; /* Accent color on focus */
    box-shadow: 0 0 0 1px #FFD700;
}

.auth-page .form-group button {
    background: #FFD700; /* Accent color */
    color: #141E30; /* Dark text for contrast */
    font-weight: 500;
    height: 40px;
    font-size: 14px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.auth-page .form-group button:hover {
    background: #ffc700;
}

.auth-page .google-login-btn {
    background-color: transparent;
    color: #eee;
    border: 1px solid #555;
    font-weight: 500;
    height: 40px;
    font-size: 14px;
    border-radius: 4px;
    transition: border-color 0.2s, background-color 0.2s;
}

.auth-page .google-login-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: #777;
}

.auth-page .divider {
    color: #888;
}

.auth-page .divider::before, .auth-page .divider::after {
    background-color: #444;
}

.auth-page .links {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
}

.auth-page .links a {
    color: #FFD700; /* Accent color */
    font-weight: 500;
}

/* Footer styles */
footer {
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
    border-top: 1px solid #ddd;
}

.footer-links a {
    margin: 0 15px;
    text-decoration: none;
    color: #ffffff;
}

body.policy-page {
    overflow-x: auto;
}

/* --- Policy Page Styles --- */
.policy-content {
    background: rgba(0, 0, 0, 0.3);
    padding: 30px 40px;
    border-radius: 15px;
    text-align: left;
    line-height: 1.8;
    color: #eee;
    word-wrap: break-word; /* Ensure long words don't overflow */
    overflow-wrap: break-word;
    white-space: normal; /* Override pre-like behavior */
}

.policy-content h2 {
    font-size: 1.5em;
    color: #FFD700;
    margin-top: 2em;
    margin-bottom: 1em;
    padding-bottom: 0.5em;
    border-bottom: 1px solid #444;
}

.policy-content h2:first-of-type {
    margin-top: 0;
}

.policy-content p {
    margin-bottom: 1em;
    color: #ccc;
}

/* Spinner and Loading Styles */
.spinner {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(20, 30, 48, 0.3); /* Darker, semi-transparent ring */
    border-top-color: #141E30; /* Darker spinner head */
    border-radius: 50%;
    animation: spinner 0.8s linear infinite;
}

.auth-page .form-group button,
.auth-page .google-login-btn {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.auth-page .form-group button.loading .spinner,
.auth-page .google-login-btn.loading .spinner {
    display: block;
}

/* Hide text and Google icon when loading */
.auth-page .form-group button.loading .button-text,
.auth-page .google-login-btn.loading .button-text,
.auth-page .google-login-btn.loading::before {
    visibility: hidden;
}

/* Share Button Icon */
#share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
