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

:root {
    --bg-primary: #1a1028;
    --bg-secondary: #241538;
    --bg-header: rgba(26, 16, 40, 0.92);
    --bg-footer: #140c20;
    --bg-card: #2a1a42;
    --text-primary: #f0e8ff;
    --text-secondary: #a090c0;
    --accent: #c77dff;
    --accent-light: #e0aaff;
    --accent-dark: #9d4edd;
    --accent-glow: rgba(199, 125, 255, 0.25);
    --border-color: rgba(199, 125, 255, 0.25);
    --primitive-color: #ff6b35;
    --primitive-bg: rgba(255, 107, 53, 0.12);
    --modern-color: #00d4aa;
    --modern-bg: rgba(0, 212, 170, 0.12);
}

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

body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

.hidden { display: none !important; }

/* ── Floating Background Emojis ── */
.bg-deco {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.float-emoji {
    position: absolute;
    font-size: 2.5em;
    opacity: 0.07;
    animation: floatAround 20s infinite ease-in-out;
}

.e1 { top: 10%; left: 5%; animation-delay: 0s; }
.e2 { top: 20%; right: 8%; animation-delay: -3s; }
.e3 { top: 50%; left: 10%; animation-delay: -7s; }
.e4 { top: 60%; right: 5%; animation-delay: -10s; }
.e5 { top: 80%; left: 15%; animation-delay: -14s; }
.e6 { top: 85%; right: 12%; animation-delay: -17s; }

@keyframes floatAround {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-20px) rotate(5deg); }
    50% { transform: translateY(10px) rotate(-3deg); }
    75% { transform: translateY(-15px) rotate(4deg); }
}

/* ── Header ── */
header {
    padding: 16px 40px;
    background-color: var(--bg-header);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    text-align: center;
}

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

.logo h1 {
    font-size: 1.5em;
    font-weight: 900;
    color: var(--accent);
}

.logo-emoji {
    font-size: 1.6em;
}

/* ── Hero ── */
#hero {
    padding: 80px 40px 40px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.hero-badge {
    display: inline-block;
    background: var(--accent-dark);
    color: #fff;
    padding: 6px 20px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 20px;
}

.hero-content h2 {
    font-size: 3.2em;
    font-weight: 900;
    line-height: 1.25;
    margin-bottom: 0.3em;
    background: linear-gradient(135deg, var(--primitive-color), var(--accent), var(--modern-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-desc {
    font-size: 1.15em;
    color: var(--text-secondary);
    font-weight: 300;
}

/* ── Detector ── */
#detector {
    padding: 30px 20px 80px;
    display: flex;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.detector-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 28px;
    padding: 36px;
    max-width: 480px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 60px var(--accent-glow);
}

/* ── Upload Area ── */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 20px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s;
    background: rgba(199, 125, 255, 0.04);
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.upload-area:hover {
    border-color: var(--accent);
    background: rgba(199, 125, 255, 0.08);
}

.upload-area.dragover {
    border-color: var(--accent-light);
    background: rgba(199, 125, 255, 0.12);
    transform: scale(1.02);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.upload-icon {
    font-size: 3.5em;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.upload-text {
    color: var(--text-secondary);
    font-size: 1em;
    line-height: 1.6;
}

.upload-hint {
    color: var(--text-secondary);
    font-size: 0.8em;
    opacity: 0.6;
}

.preview-image {
    width: 100%;
    max-height: 350px;
    object-fit: contain;
    border-radius: 12px;
}

/* ── Buttons ── */
.btn {
    display: inline-block;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    padding: 16px 40px;
    border: none;
    border-radius: 14px;
    font-size: 1.15em;
    font-weight: 700;
    font-family: 'Noto Sans KR', sans-serif;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 6px 25px var(--accent-glow);
    margin-top: 8px;
}

.btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 35px var(--accent-glow);
}

.btn-secondary {
    background: transparent;
    border: 2px solid var(--border-color);
    box-shadow: none;
    font-size: 1em;
    padding: 12px 30px;
    color: var(--text-secondary);
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: none;
}

/* ── Loading ── */
.loading {
    margin-top: 30px;
}

.loading p {
    color: var(--text-secondary);
    margin-top: 16px;
    font-size: 1.05em;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 0.8s linear infinite;
}

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

/* ── Results ── */
#result-container {
    margin-top: 30px;
    animation: fadeUp 0.6s ease-out;
}

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

.result-emoji {
    font-size: 5em;
    margin-bottom: 10px;
    animation: popIn 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

@keyframes popIn {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

.result-title {
    font-size: 1.8em;
    font-weight: 900;
    margin-bottom: 12px;
}

.result-title.primitive { color: var(--primitive-color); }
.result-title.modern { color: var(--modern-color); }

.result-desc {
    font-size: 1.05em;
    color: var(--text-secondary);
    line-height: 1.8;
    padding: 16px 20px;
    border-radius: 16px;
    margin-bottom: 24px;
    font-weight: 400;
    word-break: keep-all;
}

.result-desc.primitive {
    background: var(--primitive-bg);
    border: 1px solid rgba(255, 107, 53, 0.2);
    color: #ffb899;
}

.result-desc.modern {
    background: var(--modern-bg);
    border: 1px solid rgba(0, 212, 170, 0.2);
    color: #80eed5;
}

/* ── Share Section ── */
.share-section {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.share-label {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 700;
}

.share-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.share-btn {
    padding: 10px 18px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    font-size: 0.88em;
    font-weight: 700;
    font-family: 'Noto Sans KR', sans-serif;
    cursor: pointer;
    transition: all 0.3s;
}

.share-btn:hover {
    transform: translateY(-2px);
}

.share-btn.insta-btn {
    border-color: rgba(225, 48, 108, 0.4);
    background: linear-gradient(135deg, rgba(131, 58, 180, 0.15), rgba(225, 48, 108, 0.15), rgba(252, 175, 69, 0.15));
    color: #e1306c;
}

.share-btn.insta-btn:hover {
    background: linear-gradient(135deg, rgba(131, 58, 180, 0.3), rgba(225, 48, 108, 0.3), rgba(252, 175, 69, 0.3));
    box-shadow: 0 4px 15px rgba(225, 48, 108, 0.2);
}

.share-btn.kakao {
    border-color: rgba(254, 229, 0, 0.4);
    background: rgba(254, 229, 0, 0.08);
    color: #fee500;
}

.share-btn.kakao:hover {
    background: rgba(254, 229, 0, 0.18);
    box-shadow: 0 4px 15px rgba(254, 229, 0, 0.15);
}

.share-btn.link-btn {
    border-color: rgba(199, 125, 255, 0.3);
    background: rgba(199, 125, 255, 0.06);
    color: var(--accent-light);
}

.share-btn.link-btn:hover {
    background: rgba(199, 125, 255, 0.15);
    box-shadow: 0 4px 15px var(--accent-glow);
}

.share-toast {
    margin-top: 10px;
    padding: 8px 16px;
    background: var(--accent-dark);
    color: #fff;
    border-radius: 8px;
    font-size: 0.85em;
    font-weight: 700;
    display: inline-block;
    animation: fadeUp 0.3s ease-out;
}

.bars-wrapper {
    margin-top: 8px;
}

#label-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.prediction-bar { text-align: left; }

.prediction-bar .label-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.9em;
    font-weight: 700;
}

.prediction-bar .bar-bg {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    height: 14px;
    overflow: hidden;
}

.prediction-bar .bar-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.6s ease;
}

.prediction-bar.primitive .bar-fill {
    background: linear-gradient(90deg, var(--primitive-color), #ff9f75);
}

.prediction-bar.modern .bar-fill {
    background: linear-gradient(90deg, var(--modern-color), #40ffd0);
}

/* ── Info Section ── */
#info {
    padding: 80px 40px;
    text-align: center;
    background: var(--bg-secondary);
    position: relative;
    z-index: 1;
}

#info h2 {
    font-size: 2.2em;
    font-weight: 900;
    margin-bottom: 1em;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    max-width: 800px;
    margin: 0 auto;
}

.info-item {
    padding: 28px 18px;
    border-radius: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    transition: transform 0.3s;
}

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

.info-icon { font-size: 2.5em; margin-bottom: 0.4em; }

.info-item h3 {
    font-size: 1.05em;
    font-weight: 700;
    margin-bottom: 0.4em;
}

.info-item p {
    color: var(--text-secondary);
    font-size: 0.88em;
    font-weight: 300;
    line-height: 1.6;
}

/* ── Footer ── */
footer {
    text-align: center;
    padding: 24px 40px;
    background-color: var(--bg-footer);
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    font-size: 0.85em;
    position: relative;
    z-index: 1;
}

footer p { margin: 4px 0; }

.footer-link {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.3s;
}

.footer-link:hover { color: var(--accent-light); }

/* ── Responsive ── */
@media (max-width: 768px) {
    header { padding: 12px 16px; }
    .logo h1 { font-size: 1.1em; }
    .logo-emoji { font-size: 1.2em; }
    .logo { gap: 8px; }

    #hero { padding: 50px 16px 24px; }
    .hero-content h2 { font-size: 2em; }
    .hero-desc { font-size: 0.95em; }
    .hero-badge { font-size: 0.78em; padding: 5px 14px; margin-bottom: 14px; }

    #detector { padding: 20px 12px 60px; }
    .detector-card {
        padding: 20px 14px;
        margin: 0;
        border-radius: 20px;
        max-width: 100%;
    }

    .upload-area { min-height: 200px; border-radius: 14px; }
    .upload-icon { font-size: 2.8em; }
    .upload-text { font-size: 0.9em; }
    .preview-image { max-height: 280px; }

    .btn { padding: 14px 28px; font-size: 1em; border-radius: 12px; width: 100%; }
    .btn-secondary { width: 100%; }

    .result-emoji { font-size: 3.2em; }
    .result-title { font-size: 1.3em; }
    .result-desc { font-size: 0.92em; padding: 14px 16px; line-height: 1.7; }

    .prediction-bar .label-row { font-size: 0.82em; }
    .prediction-bar .bar-bg { height: 10px; }

    .share-buttons { gap: 8px; }
    .share-btn { padding: 9px 12px; font-size: 0.8em; flex: 1 1 calc(50% - 8px); min-width: 0; }

    .info-grid {
        grid-template-columns: 1fr;
        gap: 14px;
        padding: 0;
    }

    #info { padding: 50px 16px; }
    #info h2 { font-size: 1.6em; }
    .info-item { padding: 22px 16px; }
    .info-icon { font-size: 2em; }

    footer { padding: 20px 16px; font-size: 0.8em; }

    .float-emoji { font-size: 1.8em; }
}

@media (max-width: 380px) {
    .hero-content h2 { font-size: 1.7em; }
    .logo h1 { font-size: 0.95em; }
    .detector-card { padding: 16px 12px; }
    .result-emoji { font-size: 2.8em; }
    .result-title { font-size: 1.15em; }
}
