:root {
    --primary-color: #ff6b6b;
    --secondary-color: #4ecdc4;
    --accent-color: #ffe66d;
    --text-color: #2d3436;
    --bg-gradient: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%);
    --card-bg: rgba(255, 255, 255, 0.95);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    --font-main: 'Noto Sans KR', sans-serif;
    --detail-card-bg: #f8f9fa;
}

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

body {
    font-family: var(--font-main);
    background: var(--bg-gradient);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center; /* Changed from just center to facilitate scrolling if content is long */
    flex-direction: column; /* Ensure vertical stacking */
    color: var(--text-color);
    padding: 20px;
}

/* Allow scrolling for long content */
@media (min-height: 800px) {
    body {
        justify-content: center;
    }
}

.app-container {
    width: 100%;
    max-width: 700px; 
    text-align: center;
    position: relative;
    margin: 20px auto;
}

/* Lang Selector */
.lang-container {
    position: absolute;
    top: -40px;
    right: 0;
    display: flex;
    justify-content: flex-end;
}

select#lang-selector {
    padding: 8px 12px;
    border-radius: 20px;
    border: none;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
    color: white;
    font-weight: bold;
    cursor: pointer;
    font-family: var(--font-main);
    outline: none;
    transition: background 0.3s;
}

select#lang-selector:hover {
    background: rgba(255, 255, 255, 0.5);
}

select#lang-selector option {
    background: white;
    color: #333;
}

header {
    margin-bottom: 30px;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 5px; 
}

.card {
    background: var(--card-bg);
    padding: 50px 40px; 
    border-radius: 24px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
    width: 100%;
    margin-bottom: 40px; /* Space for info section */
}

.card:hover {
    transform: translateY(-5px);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
    width: 100%;
}

.input-wrapper {
    display: flex;
    flex-direction: column;
    text-align: left;
    flex: 1; 
    min-width: 0; 
}

.input-wrapper label {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: #636e72;
}

.input-wrapper input {
    padding: 15px;
    border: 2px solid #dfe6e9;
    border-radius: 12px;
    font-size: 1.1rem;
    transition: border-color 0.3s ease;
    outline: none;
    font-family: var(--font-main);
    width: 100%;
}

.input-wrapper input:focus {
    border-color: var(--primary-color);
}

.icon-divider {
    font-size: 1.5rem;
    animation: pulse 1.5s infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
}

button#analyze-btn {
    width: 100%;
    padding: 18px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    margin-bottom: 10px; 
}

button#analyze-btn:hover {
    background: #ff5252;
    transform: scale(1.02);
}

button#analyze-btn:active {
    transform: scale(0.98);
}

.result-area {
    margin-top: 30px;
    min-height: 200px; 
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.hidden {
    display: none !important;
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

/* Result Content */
.score-circle {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 20px;
    color: white;
    font-size: 2.5rem;
    font-weight: 800;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.score-circle span {
    font-size: 3rem;
}

#result-title {
    font-size: 1.8rem;
    color: var(--text-color);
    margin-bottom: 10px;
}

.result-summary {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #636e72;
    margin-bottom: 30px;
    padding: 0 10px;
}

/* Detailed Results Grid */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    width: 100%;
    text-align: left;
    margin-bottom: 30px;
}

.detail-card {
    background: var(--detail-card-bg);
    padding: 20px;
    border-radius: 16px;
    border-left: 5px solid var(--secondary-color);
    transition: transform 0.2s;
}

.detail-card:hover {
    transform: translateX(5px);
}

.detail-card h4 {
    color: var(--text-color);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
}

.detail-card p {
    font-size: 0.95rem;
    color: #636e72;
    line-height: 1.5;
}

/* Back to Main Button */
.back-button {
    width: auto;
    padding: 12px 25px;
    background: #6c757d; 
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    margin-top: 20px; 
}

.back-button:hover {
    background: #5a6268;
    transform: scale(1.02);
}

/* Info Section (SEO Content) */
.info-section {
    margin-top: 20px;
    width: 100%;
}

.info-card {
    background: rgba(255, 255, 255, 0.9);
    padding: 30px;
    border-radius: 20px;
    text-align: left;
    color: #444;
    line-height: 1.7;
}

.info-card h2 {
    font-size: 1.3rem;
    color: var(--text-color);
    margin-top: 20px;
    margin-bottom: 10px;
    border-left: 4px solid var(--primary-color);
    padding-left: 10px;
}

.info-card h2:first-child {
    margin-top: 0;
}

.info-card p {
    margin-bottom: 15px;
    font-size: 0.95rem;
}

.info-card ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.info-card li {
    margin-bottom: 5px;
}

footer {
    margin-top: 40px;
    color: rgba(255,255,255,0.8);
    font-size: 0.8rem;
    padding-bottom: 20px;
}

.footer-links {
    margin-bottom: 10px;
}

.footer-links a {
    color: white;
    text-decoration: none;
    font-weight: bold;
    transition: opacity 0.2s;
}

.footer-links a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.separator {
    margin: 0 10px;
    opacity: 0.5;
}

.disclaimer {
    opacity: 0.6;
    margin-top: 5px;
    font-size: 0.75rem;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

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

/* Responsive */
@media (min-width: 600px) {
    .input-group {
        flex-direction: row;
        align-items: stretch; 
    }
    
    .input-wrapper {
        flex: 1;
    }
    
    .icon-divider {
        margin-bottom: 0; 
    }

    .detail-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Adjust lang selector for larger screens */
    .lang-container {
        top: 20px;
        right: 20px;
    }
}