:root {
    --bg-color: oklch(95.59% .042 250.39);
    --bg-gradient: radial-gradient(circle, oklch(98.59% .042 250.39) 0%, oklch(90.59% .042 250.39) 100%);
    --container-bg: oklch(99.59% .002 250.39 / .7);
    --card-bg: oklch(100% 0 0 / .6);
    --text-color: oklch(40% .24 278);
    --text-soft: oklch(45% .15 278);
    --text-muted: oklch(55% .08 278);
    --btn-bg: oklch(65% .24 278);
    --btn-bg-secondary: oklch(80% .1 278);
    --shadow-color: oklch(0% 0 0 / .1);
    --border-color: oklch(70% .04 250 / .25);
    --bar-track: oklch(85% .04 250);
    --header-bg: oklch(99% .01 250 / .85);
    --link-color: oklch(55% .24 278);
}

body.dark-mode {
    --bg-color: oklch(20% .04 250);
    --bg-gradient: radial-gradient(circle, oklch(25% .04 250) 0%, oklch(15% .04 250) 100%);
    --container-bg: oklch(30% .04 250 / .5);
    --card-bg: oklch(28% .04 250 / .5);
    --text-color: oklch(92% .04 250);
    --text-soft: oklch(85% .04 250);
    --text-muted: oklch(70% .04 250);
    --btn-bg: oklch(60% .2 270);
    --btn-bg-secondary: oklch(40% .08 250);
    --shadow-color: oklch(0% 0 0 / .5);
    --border-color: oklch(50% .04 250 / .3);
    --bar-track: oklch(35% .04 250);
    --header-bg: oklch(22% .04 250 / .9);
    --link-color: oklch(80% .15 270);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", Roboto, Helvetica, Arial, sans-serif;
    min-height: 100vh;
    background-color: var(--bg-color);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-color);
    line-height: 1.7;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    color: var(--link-color);
    text-decoration: none;
}
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

.hidden { display: none !important; }

/* ------- i18n ------- */
html[lang="ko"] [data-lang="en"],
html[lang="en"] [data-lang="ko"] {
    display: none !important;
}

.lang-toggle {
    display: inline-flex;
    border: 1px solid var(--border-color);
    border-radius: 50px;
    overflow: hidden;
    background-color: var(--container-bg);
}

.lang-btn {
    background: none;
    border: none;
    padding: 0.3rem 0.65rem;
    font-size: 0.82rem;
    cursor: pointer;
    color: var(--text-soft);
    font-weight: 600;
    transition: background 0.2s ease, color 0.2s ease;
}

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

.lang-btn:not(.active):hover {
    background-color: var(--border-color);
    color: var(--text-color);
}

.header-tools {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ------- Header & Nav ------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--header-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
}

.nav-wrapper {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.8rem 1.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-color);
    white-space: nowrap;
}
.brand:hover { text-decoration: none; opacity: 0.85; }

.nav-links {
    display: flex;
    gap: 1.2rem;
    list-style: none;
    flex-wrap: wrap;
    align-items: center;
}

.nav-links a {
    color: var(--text-soft);
    font-size: 0.95rem;
    padding: 0.3rem 0.1rem;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s ease, color 0.2s ease;
}
.nav-links a:hover,
.nav-links a.active {
    color: var(--text-color);
    border-bottom-color: var(--btn-bg);
    text-decoration: none;
}

#theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.35rem 0.55rem;
    border-radius: 50%;
    line-height: 1;
    color: var(--text-color);
    transition: background 0.2s ease;
}
#theme-toggle:hover { background: var(--border-color); }

/* ------- Layout ------- */
main {
    max-width: 880px;
    margin: 0 auto;
    padding: 2rem 1.2rem 3rem;
}

.page-title {
    font-size: 2.1rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.page-lead {
    font-size: 1.05rem;
    color: var(--text-soft);
    margin-bottom: 2rem;
}

section {
    margin-bottom: 2.5rem;
}

h2 {
    font-size: 1.5rem;
    color: var(--text-color);
    margin-bottom: 0.8rem;
    margin-top: 0;
}

h3 {
    font-size: 1.15rem;
    color: var(--text-color);
    margin: 1.2rem 0 0.5rem;
}

p {
    color: var(--text-soft);
    margin-bottom: 0.8rem;
}

ul, ol {
    color: var(--text-soft);
    margin: 0.5rem 0 1rem 1.4rem;
}

li { margin-bottom: 0.4rem; }

.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 6px 20px var(--shadow-color);
    margin-bottom: 1.2rem;
}

.two-col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}

/* ------- Hero / Test ------- */
.hero {
    text-align: center;
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: 2.4rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.hero .subtitle {
    color: var(--text-soft);
    font-size: 1.05rem;
}

.test-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.8rem 1.5rem;
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px var(--shadow-color);
    margin-bottom: 2rem;
}

.loading {
    color: var(--text-soft);
    padding: 2rem;
    text-align: center;
    font-size: 1rem;
}

.mode-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.mode-btn {
    padding: 0.55rem 1.1rem;
    background-color: var(--btn-bg-secondary);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.mode-btn.active {
    background-color: var(--btn-bg);
    color: white;
    border-color: transparent;
}

.input-section { margin-bottom: 1.2rem; }

.upload-area {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 220px;
    overflow: hidden;
    background-color: var(--container-bg);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--btn-bg);
    transform: translateY(-2px);
}

.upload-placeholder { color: var(--text-soft); text-align: center; }
.upload-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.upload-hint { font-size: 0.85rem; margin-top: 0.3rem; opacity: 0.7; }

#preview-img {
    max-width: 100%;
    max-height: 320px;
    border-radius: 8px;
    object-fit: contain;
}

#webcam-container {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
    min-height: 200px;
}

#webcam-container canvas {
    border-radius: 12px;
    max-width: 100%;
}

#webcam-section { text-align: center; }

.webcam-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
    margin-top: 1rem;
}

.action-btn {
    padding: 0.75rem 1.4rem;
    font-size: 1rem;
    color: white;
    background-color: var(--btn-bg);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 5px 15px var(--shadow-color);
}

.action-btn:hover { transform: translateY(-2px); opacity: 0.95; }

.result-section {
    padding: 1.2rem;
    background-color: var(--container-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-top: 1rem;
}

#verdict {
    font-size: 1.4rem;
    color: var(--text-color);
    margin-bottom: 1rem;
    line-height: 1.6;
    text-align: center;
}

.verdict-desc {
    font-size: 0.95rem;
    opacity: 0.85;
    font-weight: normal;
    color: var(--text-soft);
}

.result-bars { display: flex; flex-direction: column; gap: 0.7rem; }

.result-bar-label {
    display: flex;
    justify-content: space-between;
    color: var(--text-soft);
    font-size: 0.95rem;
    margin-bottom: 0.3rem;
}

.result-bar-pct { font-weight: bold; color: var(--text-color); }

.result-bar-track {
    width: 100%;
    height: 10px;
    background-color: var(--bar-track);
    border-radius: 5px;
    overflow: hidden;
}

.result-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--btn-bg), oklch(70% .2 320));
    border-radius: 5px;
    transition: width 0.4s ease;
}

/* ------- Share buttons ------- */
.share-section {
    margin-top: 1.4rem;
    padding-top: 1.2rem;
    border-top: 1px dashed var(--border-color);
    text-align: center;
}

.share-title {
    font-size: 0.95rem;
    color: var(--text-soft);
    margin-bottom: 0.8rem;
    font-weight: 600;
}

.share-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.share-btn {
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
    color: var(--text-color);
    background-color: var(--container-bg);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.share-btn:hover {
    transform: translateY(-1px);
    border-color: var(--btn-bg);
    color: var(--btn-bg);
}

.share-twitter:hover { color: #1d9bf0; border-color: #1d9bf0; }
.share-facebook:hover { color: #1877f2; border-color: #1877f2; }

.share-toast {
    margin-top: 0.9rem;
    padding: 0.55rem 1rem;
    background-color: var(--btn-bg);
    color: white;
    border-radius: 30px;
    font-size: 0.9rem;
    display: inline-block;
    animation: toast-fade 2.2s ease;
}

@keyframes toast-fade {
    0% { opacity: 0; transform: translateY(6px); }
    15%, 85% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-4px); }
}

/* ------- Feature lists ------- */
.feature-list {
    list-style: none;
    margin-left: 0;
}
.feature-list li {
    padding: 0.6rem 0 0.6rem 1.6rem;
    position: relative;
    color: var(--text-soft);
    border-bottom: 1px dashed var(--border-color);
}
.feature-list li:last-child { border-bottom: none; }
.feature-list li::before {
    content: "✦";
    position: absolute;
    left: 0;
    color: var(--btn-bg);
    font-weight: bold;
}

/* ------- FAQ ------- */
.faq-item {
    border-bottom: 1px solid var(--border-color);
    padding: 0.8rem 0;
}
.faq-item summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--text-color);
    list-style: none;
    padding: 0.4rem 0;
    position: relative;
    padding-right: 1.5rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
    content: "+";
    position: absolute;
    right: 0.2rem;
    top: 0.4rem;
    font-size: 1.2rem;
    color: var(--btn-bg);
    transition: transform 0.2s ease;
}
.faq-item[open] summary::after {
    content: "−";
}
.faq-item p {
    margin-top: 0.5rem;
    color: var(--text-soft);
}

/* ------- Contact form ------- */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    max-width: 460px;
}
.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--container-bg);
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.95rem;
}
.contact-form textarea { height: 110px; resize: vertical; }
.contact-form button {
    align-self: flex-start;
    padding: 0.7rem 1.3rem;
    background-color: var(--btn-bg);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}
.contact-form button:hover { opacity: 0.9; }

/* ------- Footer ------- */
.site-footer {
    border-top: 1px solid var(--border-color);
    background-color: var(--header-bg);
    padding: 1.5rem 1.2rem;
    margin-top: 2rem;
}
.footer-wrapper {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.88rem;
}
.footer-links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
}
.footer-links a { color: var(--text-soft); }

/* ------- Disclaimer ------- */
.disclaimer {
    background-color: oklch(95% .05 80 / .4);
    border-left: 4px solid oklch(75% .15 80);
    padding: 0.8rem 1rem;
    border-radius: 6px;
    color: var(--text-soft);
    font-size: 0.92rem;
    margin: 1rem 0;
}
body.dark-mode .disclaimer {
    background-color: oklch(35% .04 80 / .4);
    border-left-color: oklch(70% .15 80);
}

/* ------- Mobile ------- */
@media (max-width: 768px) {
    .nav-wrapper {
        padding: 0.7rem 0.9rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .brand { font-size: 1.05rem; flex: 1; }
    .nav-links {
        order: 3;
        width: 100%;
        justify-content: center;
        gap: 0.9rem;
        padding-top: 0.3rem;
        border-top: 1px dashed var(--border-color);
        margin-top: 0.2rem;
    }
    .nav-links a { font-size: 0.88rem; padding: 0.35rem 0.2rem; }
    .header-tools { gap: 0.4rem; }
    #theme-toggle { padding: 0.3rem 0.5rem; font-size: 1rem; }

    main { padding: 1.3rem 0.9rem 2rem; }
    section { margin-bottom: 1.8rem; }

    .hero { margin-bottom: 1.5rem; }
    .hero h1 { font-size: 1.7rem; line-height: 1.3; }
    .hero .subtitle { font-size: 0.95rem; line-height: 1.5; }
    .page-title { font-size: 1.55rem; }
    .page-lead { font-size: 0.95rem; }

    h2 { font-size: 1.3rem; }
    h3 { font-size: 1.05rem; }

    .test-card { padding: 1.2rem 0.9rem; border-radius: 14px; }

    .mode-buttons { gap: 0.4rem; }
    .mode-btn {
        flex: 1;
        max-width: 200px;
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
        min-height: 44px;
    }

    .upload-area {
        min-height: 180px;
        padding: 1.2rem 0.8rem;
    }
    .upload-icon { font-size: 2.4rem; }
    .upload-placeholder p { font-size: 0.95rem; }

    #preview-img { max-height: 260px; }

    #webcam-container { min-height: 0; }
    #webcam-container canvas {
        width: 100%;
        max-width: 320px;
        height: auto;
    }

    .webcam-buttons { flex-direction: column; align-items: stretch; }
    .action-btn {
        padding: 0.8rem 1.2rem;
        font-size: 0.95rem;
        width: 100%;
        min-height: 44px;
    }

    .result-section { padding: 1rem 0.9rem; }
    #verdict { font-size: 1.2rem; line-height: 1.5; }
    .verdict-desc { font-size: 0.9rem; }
    .result-bar-label { font-size: 0.88rem; }

    .share-section { margin-top: 1.2rem; padding-top: 1rem; }
    .share-title { font-size: 0.9rem; }
    .share-buttons { gap: 0.4rem; }
    .share-btn {
        padding: 0.55rem 0.85rem;
        font-size: 0.85rem;
        min-height: 40px;
    }

    .card { padding: 1.1rem; }
    .two-col { grid-template-columns: 1fr; gap: 0.8rem; }

    .faq-item summary { font-size: 0.95rem; }
    .faq-item p { font-size: 0.92rem; }

    .contact-form input,
    .contact-form textarea { font-size: 1rem; }
    .contact-form button { width: 100%; padding: 0.85rem; min-height: 44px; }

    .site-footer { padding: 1.2rem 0.9rem; }
    .footer-wrapper {
        flex-direction: column;
        text-align: center;
        gap: 0.7rem;
    }
    .footer-links { justify-content: center; gap: 0.8rem 1rem; }
}

@media (max-width: 400px) {
    .nav-links { gap: 0.6rem; }
    .nav-links a { font-size: 0.83rem; }
    .lang-btn { padding: 0.3rem 0.55rem; font-size: 0.78rem; }
    .hero h1 { font-size: 1.5rem; }
    .hero .subtitle { font-size: 0.9rem; }
    h2 { font-size: 1.2rem; }
    .test-card { padding: 1rem 0.7rem; }
    .mode-btn { padding: 0.55rem 0.6rem; font-size: 0.85rem; }
    #verdict { font-size: 1.1rem; }
    .share-btn { padding: 0.5rem 0.7rem; font-size: 0.82rem; }
    .disclaimer { font-size: 0.85rem; padding: 0.7rem 0.85rem; }
}
