/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette */
    --primary: #25f478;
    --primary-dark: #1dd863;
    --primary-light: #4ff68d;
    --secondary: #ec4899;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Neutrals */
    --bg-primary: #102217;
    --bg-secondary: #1a3325;
    --bg-card: #1a3325;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #25f478 0%, #1dd863 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-success: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(37, 244, 120, 0.4);

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 300ms ease;
    --transition-slow: 500ms ease;
}

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

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-primary);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    min-height: 100vh;
    background: #102217;
    /* Fallback */
    position: relative;
}

/* Global Background Image Overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('korea.png') no-repeat center center;
    background-size: cover;
    opacity: 0.25;
    /* Dimmed for readability */
    filter: brightness(0.6) grayscale(20%);
    z-index: -2;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom,
            rgba(16, 34, 23, 0.8) 0%,
            rgba(16, 34, 23, 0.95) 100%);
    z-index: -1;
}

/* App Container - Fixed Compact Width */
.app-container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Center children horizontally */
}

/* Header / Top Bar Area */
.screen-header {
    width: 100%;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: var(--spacing-md);
    position: relative;
    height: 48px;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    padding: 0.5rem;
    transition: color var(--transition-fast);
}

.back-btn:hover {
    color: var(--primary);
}

.back-btn .material-symbols-outlined {
    font-size: 1.5rem;
}

/* Screen Management */
.screen {
    min-height: 100vh;
    display: none;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: var(--spacing-lg) 0;
    animation: fadeIn var(--transition-base);
}

.screen.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Background Pattern */
.background-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 50%, rgba(37, 244, 120, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(29, 216, 99, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* Hero Wrapper */
.hero-wrapper {
    width: 100%;
    margin: 0 auto;
}

/* Hero Image Container with Overlay - Simplified for Landing as global bg handles it */
.hero-image-container {
    position: relative;
    width: 100%;
    height: 480px;
    /* Adjusted height for more compact hero */
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    background: rgba(37, 244, 120, 0.05);
    /* Slight tint */
}

.hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    opacity: 0.8;
}

/* Dark overlay for better text readability */
.image-overlay-dark {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg,
            rgba(16, 34, 23, 0.6) 0%,
            rgba(16, 34, 23, 0.8) 100%);
    pointer-events: none;
}

/* Hero Content Overlaid on Image */
.hero-content-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 90%;
    z-index: 2;
    animation: fadeInUp 0.8s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate(-50%, -40%);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* Landing Screen */
.hero-content {
    text-align: center;
    animation: slideUp 0.8s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.emoji-large {
    font-size: 6rem;
    margin-bottom: var(--spacing-md);
    animation: bounce 2s infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 900;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.highlight {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xl);
    font-weight: 500;
}

/* Buttons */
.btn {
    padding: 1rem 2.5rem;
    font-size: 1.125rem;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(37, 244, 120, 0.6);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--primary);
}

.btn-secondary:hover {
    background: var(--primary);
    transform: translateY(-2px);
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: var(--spacing-xl);
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    transition: width var(--transition-slow);
    border-radius: var(--radius-full);
}

/* Question Card */
.question-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg) var(--spacing-md);
    /* Reduced padding */
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(37, 244, 120, 0.2);
    text-align: center;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    overflow-x: hidden;
}

.question-number {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--gradient-primary);
    color: #102217;
    /* Dark background color for contrast */
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 0.875rem;
    margin-bottom: var(--spacing-md);
}

.question-title {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: var(--spacing-lg);
    text-align: center;
    /* Explicitly center titles */
    word-break: keep-all;
}

/* Options Grid (for area selection) */
.options-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--spacing-sm);
    /* Reduced gap */
    width: 100%;
}

.option-card {
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    padding: var(--spacing-md) var(--spacing-xs);
    /* Reduced padding */
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
    font-family: inherit;
    color: var(--text-primary);
    box-sizing: border-box;
}

.option-text {
    font-size: 0.875rem;
    /* Slightly smaller for better fit */
    font-weight: 700;
    text-align: center;
    word-break: normal;
    overflow-wrap: anywhere;
    line-height: 1.2;
}

.option-card:hover {
    border-color: var(--primary);
    background: rgba(37, 244, 120, 0.1);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.option-card:active {
    transform: translateY(-2px);
}

.option-emoji {
    font-size: 2.5rem;
}

.option-text {
    font-size: 1.125rem;
    font-weight: 700;
}

/* Options List (for questions) */
.options-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    width: 100%;
}

.option-btn {
    width: 100%;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    /* Center text by default */
    gap: var(--spacing-sm);
    cursor: pointer;
    transition: all var(--transition-base);
    color: var(--text-primary);
    font-size: 1.125rem;
    font-weight: 600;
    position: relative;
}

.option-btn .option-icon {
    position: absolute;
    right: 1.25rem;
    opacity: 0.5;
}

.option-btn:hover {
    transform: translateX(8px);
}

.option-btn:active {
    transform: translateX(4px);
}

.option-label {
    font-weight: 600;
}

.option-icon {
    font-size: 1.5rem;
    opacity: 0.5;
    transition: all var(--transition-base);
}

.option-btn:hover .option-icon {
    opacity: 1;
    transform: translateX(4px);
}

/* Result Card */
.result-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(37, 244, 120, 0.2);
    text-align: center;
    animation: scaleIn var(--transition-slow);
    max-height: 85vh;
    overflow-y: auto;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.result-emoji {
    font-size: 3.5rem;
    margin-bottom: var(--spacing-sm);
    animation: bounce 2s infinite;
}

.result-title {
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: var(--spacing-xs);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
    font-weight: 500;
}

.result-section {
    text-align: left;
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-sm);
    background: rgba(37, 244, 120, 0.05);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary);
}

.section-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
    color: var(--primary-light);
}

.section-content {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.result-list {
    list-style: none;
    padding: 0;
}

.result-list li {
    padding: var(--spacing-xs) 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Result Enrichment Styles */
.result-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm);
    margin: var(--spacing-md) 0;
}

.stat-box {
    background: rgba(255, 255, 255, 0.05);
    padding: var(--spacing-sm);
    border-radius: var(--radius-md);
    border: 1px solid rgba(37, 244, 120, 0.1);
    text-align: center;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    display: block;
    margin-bottom: 2px;
}

.stat-value {
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--primary);
}

.style-badge {
    display: inline-block;
    padding: 4px 12px;
    background: var(--gradient-primary);
    color: #102217;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        padding: 0 var(--spacing-sm);
        /* Reduced from var(--spacing-lg) */
    }

    .hero-image-container {
        height: 500px;
    }

    .hero-title {
        font-size: 1.75rem;
    }

    .emoji-large {
        font-size: 3.5rem;
    }

    .question-title {
        font-size: 1.5rem;
    }

    .result-title {
        font-size: 1.75rem;
    }

    .result-emoji {
        font-size: 3.5rem;
    }

    .options-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--spacing-xs);
    }
}

@media (max-width: 480px) {
    .hero-image-container {
        height: 450px;
    }

    .hero-title {
        font-size: 1.5rem;
    }

    .emoji-large {
        font-size: 3rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus Styles */
button:focus-visible,
.option-card:focus-visible,
.option-btn:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

/* Language Toggle */
.language-toggle {
    position: fixed;
    top: var(--spacing-md);
    right: var(--spacing-md);
    z-index: 1000;
    display: flex;
    gap: var(--spacing-xs);
    background: var(--bg-card);
    padding: var(--spacing-xs);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-md);
}

.lang-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: inherit;
    background: transparent;
    color: var(--text-secondary);
}

.lang-btn.active {
    background: var(--gradient-primary);
    color: white;
}

.lang-btn:hover:not(.active) {
    background: rgba(37, 244, 120, 0.1);
    color: var(--text-primary);
}

/* Expanded Grid for More Areas - Keep 2 columns but ensure fit */
.options-grid.expanded {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--spacing-sm);
}

/* Question Description */
.question-description {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: var(--spacing-lg);
    text-align: center;
}

/* Place Input */
.place-input-container {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.place-input {
    flex: 1;
    padding: var(--spacing-md);
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: all var(--transition-base);
}

.place-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(37, 244, 120, 0.05);
}

.place-input::placeholder {
    color: var(--text-muted);
}

.btn-add-place {
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: inherit;
}

.btn-add-place:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

/* Places List */
.places-list {
    margin-bottom: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.place-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    background: rgba(37, 244, 120, 0.1);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
}

.place-name {
    color: var(--text-primary);
    font-weight: 600;
}

.btn-remove-place {
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.25rem 0.5rem;
    transition: all var(--transition-fast);
}

.btn-remove-place:hover {
    transform: scale(1.2);
}

/* Map Container */
.map-container {
    width: 100%;
    height: 300px;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: var(--spacing-lg);
    border: 2px solid rgba(37, 244, 120, 0.2);
}

/* Button Group */
.button-group {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
}

.button-group .btn {
    flex: 1;
}

/* Share Button */
.btn-share {
    background: var(--gradient-secondary);
    color: white;
    padding: 1rem 2.5rem;
    font-size: 1.125rem;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.btn-share:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(236, 72, 153, 0.6);
}

.btn-share::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-share:hover::before {
    width: 300px;
    height: 300px;
}

/* Download Button */
.btn-download {
    background: var(--gradient-success);
    color: white;
    padding: 1rem 2.5rem;
    font-size: 1.125rem;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.6);
}

.btn-download::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-download:hover::before {
    width: 300px;
    height: 300px;
}

.btn-share:disabled,
.btn-download:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Result Actions */
.result-actions {
    margin-top: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.result-actions .btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* Watermark */
.watermark {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-md);
    border-top: 1px solid rgba(37, 244, 120, 0.2);
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
}

/* Loading State */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: var(--spacing-lg);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    animation: slideUpFade 0.3s ease;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* Mobile Responsive Updates */
@media (max-width: 768px) {
    .language-toggle {
        top: var(--spacing-sm);
        right: var(--spacing-sm);
    }

    .lang-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem;
    }

    .options-grid.expanded {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        /* Keep 2 cols on mobile too if compact enough */
        gap: var(--spacing-xs);
    }

    .place-input-container {
        flex-direction: column;
    }

    .button-group {
        flex-direction: column;
    }

    .map-container {
        height: 250px;
    }
}

/* Footer Styles */
.site-footer {
    padding: var(--spacing-xl) 0;
    background: rgba(16, 34, 23, 0.95);
    border-top: 1px solid rgba(37, 244, 120, 0.1);
    margin-top: var(--spacing-xl);
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color var(--transition-base);
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-copy {
    color: var(--text-muted);
    font-size: 0.75rem;
    opacity: 0.7;
}

@media (max-width: 480px) {
    .footer-links {
        gap: var(--spacing-sm);
    }
}