:root {
    --bg: #ffffff;
    --card-bg: #f8f9fa;
    --text: #1a1a1a;
    --sub-text: #555555;
    --accent: #000000;
    --btn-text: #ffffff;
    --neon: #99FF00;
    --neon-cyan: #00FFCC;
    --yellow: #ffea00;
    --border: #e9ecef;
    --chip-bg: #f0f0f0;
    --legal-text: #868e96;
    --trust-color: #2d7a00;
    --btn-shadow: rgba(0, 0, 0, 0.12);
}

body.dark-mode {
    --bg: #000000;
    --card-bg: #141416;
    --text: #EAEAEA;
    --sub-text: #A8A8A8;
    --accent: #99FF00;
    --btn-text: #000000;
    --neon: #99FF00;
    --neon-cyan: #00FFCC;
    --border: #262626;
    --chip-bg: #1A1A1A;
    --legal-text: #B0B0B0;
    --trust-color: #99FF00;
    --btn-shadow: rgba(153, 255, 0, 0.2);
}

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

html {
    overflow: hidden;
    height: 100svh;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

html::-webkit-scrollbar {
    display: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    transition: background-color 0.4s ease, color 0.4s ease;
    height: 100svh;
    display: flex;
    justify-content: center;
    overflow: hidden;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

body::-webkit-scrollbar {
    display: none;
}

.app-container {
    width: 100%;
    max-width: 420px;
    height: 100svh;
    display: flex;
    flex-direction: column;
    padding: 0 16px;
    padding-top: 0;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

/* Header */
header, .header, .site-header, .header-container {
    /* 노치/다이내믹 아일랜드 아래로 약 22px 추가 확보 */
    padding-top: calc(env(safe-area-inset-top, 0px) + 22px) !important;
    padding-bottom: 12px !important;
    padding-left: 14px !important;
    padding-right: 14px !important;
    height: auto !important;
    min-height: calc(46px + env(safe-area-inset-top, 0px) + 22px) !important;
    max-height: none !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    box-sizing: border-box !important;
    width: 100% !important;
    flex-shrink: 0 !important;
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--bg);
}

.logo, .brand, a.logo {
    font-size: 17px !important;
    letter-spacing: -0.6px !important;
    font-weight: 900 !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    margin-right: 6px !important;
    margin-left: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    height: 24px !important;
    cursor: pointer;
    color: var(--text);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), text-shadow 0.2s ease;
    transform-origin: left center;
    user-select: none;
    -webkit-user-select: none;
}

.logo:hover {
    transform: scale(1.08) translateY(-1px);
    text-shadow:
        0 0 8px rgba(153, 255, 0, 0.9),
        0 0 20px rgba(153, 255, 0, 0.5),
        0 0 40px rgba(153, 255, 0, 0.25);
    color: var(--text);
}

.controls, .nav-group, .header-right {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    height: 24px !important;
    gap: 3.5px !important;
    margin: 0 !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
}

.nav-btn, .header-btn,
header a[href="index.html"], header a[href="top10.html"], header a[href="mbti.html"], header a[href="ost.html"],
.controls a[href="index.html"], .controls a[href="top10.html"], .controls a[href="mbti.html"], .controls a[href="ost.html"],
.top10-header-btn, .mbti-header-btn, .ost-header-btn {
    width: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    height: 24px !important;
    min-height: 24px !important;
    max-height: 24px !important;
    font-size: 10px !important;
    font-weight: 800 !important;
    letter-spacing: -0.4px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 9999px !important;
    box-sizing: border-box !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
}

.icon-btn, #lang-btn, #theme-toggle, .lang-toggle, .theme-toggle {
    width: 24px !important;
    min-width: 24px !important;
    max-width: 24px !important;
    height: 24px !important;
    min-height: 24px !important;
    max-height: 24px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    line-height: 1 !important;
    font-size: 13.5px !important;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 800;
    color: var(--text);
    flex-shrink: 0 !important;
}

.top10-header-btn {
    text-decoration: none;
    color: #f3ce13;
    border: 1.5px solid #f3ce13;
    transition: all 0.2s;
    white-space: nowrap;
}

body:not(.dark-mode) .top10-header-btn,
body.light-mode .top10-header-btn,
body.light-theme .top10-header-btn {
    color: #1a1a1a;
    background-color: #FFE066;
    border-color: #eab308;
}

.top10-header-btn:hover {
    background-color: #f3ce13;
    color: #000;
}

.top10-header-btn:active {
    transform: scale(0.95);
}

.mbti-header-btn {
    text-decoration: none;
    color: var(--neon);
    border: 1.5px solid var(--neon);
    transition: all 0.2s;
    white-space: nowrap;
}

.mbti-header-btn:hover {
    background-color: var(--neon);
    color: #000;
}

.mbti-header-btn:active {
    transform: scale(0.95);
}

body:not(.dark-mode) .mbti-header-btn,
body.light-mode .mbti-header-btn,
body.light-theme .mbti-header-btn {
    color: #1a1a1a;
    background-color: #d4ff33;
    border-color: #7acc00;
}

body:not(.dark-mode) .mbti-header-btn:hover,
body.light-mode .mbti-header-btn:hover,
body.light-theme .mbti-header-btn:hover {
    background-color: #99FF00;
    color: #000;
}

.ost-header-btn {
    text-decoration: none;
    color: #00e5ff;
    border: 1.5px solid #00e5ff;
    transition: all 0.2s;
    white-space: nowrap;
}

.ost-header-btn:hover {
    background-color: #00e5ff;
    color: #000;
}

.ost-header-btn:active {
    transform: scale(0.95);
}

body:not(.dark-mode) .ost-header-btn,
body.light-mode .ost-header-btn,
body.light-theme .ost-header-btn {
    color: #006064;
    background-color: #e0f7fa;
    border-color: #00acc1;
}

body:not(.dark-mode) .ost-header-btn:hover,
body.light-mode .ost-header-btn:hover,
body.light-theme .ost-header-btn:hover {
    background-color: #00e5ff;
    color: #000;
}

/* Language Dropdown */
.lang-dropdown {
    position: relative;
    display: inline-block;
}

.lang-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--card-bg);
    min-width: 160px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    border-radius: 16px;
    z-index: 1000;
    margin-top: 10px;
    border: 1px solid var(--border);
    animation: dropdownFade 0.2s ease;
}

.lang-menu::-webkit-scrollbar {
    display: none;
}

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

.lang-menu.show {
    display: block;
}

.lang-item {
    padding: 6px 16px !important;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.lang-item span {
    font-size: 20px;
}

.lang-item:hover {
    background-color: rgba(153, 255, 0, 0.08);
    color: var(--accent);
}

.lang-item.active {
    color: var(--accent);
    background-color: rgba(153, 255, 0, 0.1);
}

body.dark-mode .lang-item.active {
    background-color: rgba(153, 255, 0, 0.05);
}

/* Main Area */
.mbti-main {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 8px 0 20px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.mbti-main::-webkit-scrollbar {
    display: none;
}

/* Card Containers */
.mbti-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    animation: fadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.mbti-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 26px 20px;
    width: 100%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

body.dark-mode .mbti-card {
    background: #141416;
    border: 1px solid #262626;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.6);
}

body:not(.dark-mode) .mbti-card,
body.light-mode .mbti-card,
body.light-theme .mbti-card {
    background: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.06) !important;
}

/* Intro Section */
.intro-badge-icon {
    font-size: 54px;
    margin-bottom: 12px;
    display: inline-block;
    filter: drop-shadow(0 4px 12px rgba(153, 255, 0, 0.35));
    animation: pulseGlow 2.5s infinite ease-in-out;
}

.intro-title {
    font-size: 22px;
    font-weight: 900;
    line-height: 1.25;
    margin-bottom: 8px;
    text-align: center;
    color: var(--text);
    letter-spacing: -0.5px;
}

.intro-subtitle {
    font-size: 13.5px;
    color: var(--sub-text);
    line-height: 1.45;
    text-align: center;
    margin-bottom: 16px;
}

.intro-trust-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(153, 255, 0, 0.1);
    color: var(--trust-color);
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 24px;
    border: 1px solid rgba(153, 255, 0, 0.2);
}

body:not(.dark-mode) .intro-trust-badge {
    background: rgba(45, 122, 0, 0.08);
    color: #246300;
    border-color: rgba(45, 122, 0, 0.2);
}

/* Primary / Secondary Buttons */
.mbti-btn-primary {
    width: 100%;
    background: var(--neon);
    color: #000000;
    border: none;
    border-radius: 100px;
    padding: 15px 24px;
    font-size: 16px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(153, 255, 0, 0.35);
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mbti-btn-primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 24px rgba(153, 255, 0, 0.5);
}

.mbti-btn-primary:active {
    transform: scale(0.97);
}

.mbti-btn-secondary {
    width: 100%;
    background: transparent;
    color: var(--text);
    border: 1.5px solid var(--border);
    border-radius: 100px;
    padding: 13px 24px;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mbti-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text);
}

body:not(.dark-mode) .mbti-btn-secondary:hover {
    background: #f1f3f5;
}

/* Quiz Section */
.quiz-header {
    width: 100%;
    margin-bottom: 18px;
}

.quiz-step-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 800;
    color: var(--neon);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

body:not(.dark-mode) .quiz-step-row {
    color: #2d7a00;
}

.progress-track {
    width: 100%;
    height: 7px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 100px;
    overflow: hidden;
    position: relative;
}

body:not(.dark-mode) .progress-track {
    background: #e9ecef;
}

/* Neon Gradient Progress Bar */
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--neon) 0%, var(--neon-cyan) 100%);
    width: 8.33%;
    border-radius: 100px;
    transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 0 0 10px rgba(153, 255, 0, 0.6);
}

/* Card Body Transition Wrapper */
.quiz-card-body {
    width: 100%;
    transform-origin: center top;
}

.quiz-card-body.card-anim-out {
    animation: cardSlideOut 0.16s cubic-bezier(0.4, 0, 1, 1) forwards;
}

.quiz-card-body.card-anim-in {
    animation: cardSlideIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.quiz-category-tag {
    font-size: 11px;
    font-weight: 700;
    color: var(--sub-text);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.quiz-question-title {
    font-size: 17px;
    font-weight: 800;
    line-height: 1.4;
    margin-bottom: 20px;
    color: var(--text);
    min-height: 48px;
}

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

/* Option Buttons with Scale Up & Neon Glow */
.option-btn {
    width: 100%;
    padding: 15px 16px;
    border-radius: 18px;
    background: var(--chip-bg);
    border: 1.5px solid var(--border);
    color: var(--text);
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.42;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                border-color 0.2s ease,
                box-shadow 0.2s ease,
                background-color 0.2s ease;
    outline: none;
    user-select: none;
}

.option-btn:hover {
    transform: scale(1.02);
    border-color: var(--neon);
    box-shadow: 0 4px 18px rgba(153, 255, 0, 0.28);
}

.option-btn:active {
    transform: scale(0.98);
}

.option-btn.selected {
    border-color: var(--neon) !important;
    background: rgba(153, 255, 0, 0.12) !important;
    box-shadow: 0 0 16px rgba(153, 255, 0, 0.35) !important;
}

.option-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12.5px;
    font-weight: 900;
    flex-shrink: 0;
    color: var(--sub-text);
    transition: all 0.2s ease;
}

body:not(.dark-mode) .option-badge {
    background: #e9ecef;
}

.option-btn:hover .option-badge {
    background: var(--neon);
    color: #000;
}

.option-btn.selected .option-badge {
    background: var(--neon);
    color: #000;
}

.option-text {
    flex: 1;
}

/* 3. Loading / Analyzing State */
.loading-card {
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.loading-ticket-icon {
    font-size: 52px;
    margin-bottom: 16px;
    display: inline-block;
    filter: drop-shadow(0 4px 14px rgba(153, 255, 0, 0.4));
    animation: ticketPulse 1.2s infinite ease-in-out;
}

.neon-spinner-wrapper {
    margin: 12px 0 20px;
}

.neon-spinner {
    width: 44px;
    height: 44px;
    border: 3.5px solid rgba(153, 255, 0, 0.18);
    border-top-color: var(--neon);
    border-right-color: var(--neon-cyan);
    border-radius: 50%;
    animation: spinnerRotate 0.85s linear infinite;
    box-shadow: 0 0 18px rgba(153, 255, 0, 0.35);
}

.loading-title {
    font-size: 19px;
    font-weight: 900;
    line-height: 1.3;
    margin-bottom: 8px;
    color: var(--text);
    letter-spacing: -0.3px;
}

.loading-sub {
    font-size: 13px;
    color: var(--sub-text);
    line-height: 1.45;
}

/* 4. Result Section */
.result-header {
    text-align: center;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.result-poster-wrapper {
    position: relative;
    width: 140px;
    height: 200px;
    margin: 4px auto 14px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.result-poster-glow {
    position: absolute;
    inset: -6px;
    background: radial-gradient(circle, rgba(153, 255, 0, 0.4) 0%, rgba(153, 255, 0, 0) 72%);
    filter: blur(14px);
    z-index: 1;
    border-radius: 20px;
    opacity: 0.85;
}

body:not(.dark-mode) .result-poster-glow {
    background: radial-gradient(circle, rgba(45, 122, 0, 0.22) 0%, rgba(45, 122, 0, 0) 72%);
}

.result-char-image {
    position: relative;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 16px;
    border: 1.5px solid rgba(153, 255, 0, 0.35);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5);
    z-index: 2;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

body:not(.dark-mode) .result-char-image {
    border: 1.5px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.result-char-image:hover {
    transform: scale(1.03) translateY(-2px);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.6), 0 0 18px rgba(153, 255, 0, 0.35);
}

.mbti-type-badge {
    display: inline-block;
    padding: 4px 16px;
    background: var(--neon);
    color: #000000;
    font-size: 14px;
    font-weight: 900;
    border-radius: 100px;
    letter-spacing: 1px;
    margin-bottom: 10px;
    box-shadow: 0 2px 10px rgba(153, 255, 0, 0.35);
}

.result-char-name {
    font-size: 21px;
    font-weight: 900;
    line-height: 1.25;
    margin-bottom: 4px;
    color: var(--text);
}

.result-movie-title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--neon);
    margin-bottom: 12px;
}

body:not(.dark-mode) .result-movie-title {
    color: #2d7a00;
}

.result-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-bottom: 16px;
}

.result-tag-chip {
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 700;
    background: var(--chip-bg);
    border: 1px solid var(--border);
    color: var(--sub-text);
}

.result-quote-box {
    background: rgba(153, 255, 0, 0.05);
    border-left: 3px solid var(--neon);
    padding: 10px 14px;
    border-radius: 4px 12px 12px 4px;
    font-size: 12.5px;
    font-style: italic;
    color: var(--text);
    margin-bottom: 14px;
    line-height: 1.4;
}

body:not(.dark-mode) .result-quote-box {
    background: rgba(45, 122, 0, 0.05);
    border-color: #2d7a00;
}

.result-desc {
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--sub-text);
    margin-bottom: 16px;
}

.result-recommend-box {
    background: var(--chip-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px 14px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.recommend-icon {
    font-size: 22px;
    flex-shrink: 0;
}

.recommend-text {
    font-size: 12px;
    color: var(--text);
    line-height: 1.4;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

/* Footer */
.footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0 16px;
    flex-shrink: 0;
}

.legal-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 100%;
}

.legal-links {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
}

.legal-links a {
    color: var(--legal-text);
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.legal-links a:hover {
    color: var(--text);
}

.copyright {
    color: var(--legal-text);
    font-size: 10px;
    opacity: 0.7;
}

/* Keyframes */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.99);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes cardSlideOut {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }
}

@keyframes cardSlideIn {
    0% {
        opacity: 0;
        transform: translateY(14px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes pulseGlow {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 4px 10px rgba(153, 255, 0, 0.3));
    }
    50% {
        transform: scale(1.06);
        filter: drop-shadow(0 6px 16px rgba(153, 255, 0, 0.6));
    }
}

@keyframes ticketPulse {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        filter: drop-shadow(0 4px 12px rgba(153, 255, 0, 0.35));
    }
    50% {
        transform: scale(1.12) rotate(-3deg);
        filter: drop-shadow(0 6px 20px rgba(153, 255, 0, 0.7));
    }
}

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