:root {
    --bg-color: #020617;
    --text-color: #f1f5f9;
    --card-bg: rgba(15, 23, 42, 0.6);
    --input-bg: rgba(30, 41, 59, 0.8);
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --accent-color: #38bdf8;
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    --blob-1: #1e1b4b;
    --blob-2: #020617;
    --blob-3: #1e293b;
    --green: #34d399;
    --yellow: #fbbf24;
    --red: #f87171;
    --glass-border: rgba(255, 255, 255, 0.12);
    --btn-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --btn-shadow: 0 8px 20px -4px rgba(99, 102, 241, 0.4);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

body {
    background: var(--bg-color);
    color: var(--text-color);
    font-family: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
    overflow-x: hidden;
}

/* Utils */
.hidden { display: none !important; }

/* Background Decoration */
.bg-decoration {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    overflow: hidden;
    filter: blur(120px);
}

.blob {
    position: absolute;
    border-radius: 50%;
    opacity: 0.4;
    animation: move 25s infinite alternate cubic-bezier(0.45, 0.05, 0.55, 0.95);
}

.blob-1 { width: 600px; height: 600px; background: var(--blob-1); top: -150px; left: -150px; }
.blob-2 { width: 500px; height: 500px; background: var(--blob-2); bottom: -100px; right: -100px; animation-delay: -7s; }
.blob-3 { width: 400px; height: 400px; background: var(--blob-3); top: 35%; left: 25%; animation-delay: -12s; }

@keyframes move {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(120px, 80px) scale(1.15); }
}

/* Layout Containers */
.container {
    width: 100%;
    max-width: 520px;
    background: var(--card-bg);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    padding: 3rem 2rem;
    border-radius: 2.5rem;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.8s cubic-bezier(0.22, 1, 0.36, 1);
    margin-top: 5rem;
}

/* Compliance Views Unification */
.compliance-view {
    width: 100%;
    max-width: 520px;
    margin-top: 3rem;
    padding: 2.5rem 2rem;
    background: var(--card-bg);
    border-radius: 2.5rem;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    box-shadow: var(--shadow-lg);
}

.compliance-view h1.title-small {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: var(--accent-color);
    background: none;
    -webkit-text-fill-color: initial;
    text-align: left;
}

.compliance-content {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-color);
    opacity: 0.9;
}

.compliance-content h3 {
    font-size: 1.1rem;
    margin: 1.5rem 0 0.75rem;
    color: var(--accent-color);
    font-weight: 700;
}

.compliance-content p {
    margin-bottom: 1.25rem;
}

.compliance-content ul {
    margin-bottom: 1.5rem;
    padding-left: 1.25rem;
}

.compliance-content li {
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

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

header { text-align: center; margin-bottom: 2.5rem; }

.title-small {
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: -0.05em;
    margin-bottom: 0.75rem;
    white-space: nowrap;
    background: linear-gradient(to bottom right, #fff 50%, rgba(255,255,255,0.6));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sub-title { font-size: 0.9rem; opacity: 0.6; margin-bottom: 0.5rem; white-space: nowrap; }
.disclaimer { font-size: 0.75rem; opacity: 0.4; font-weight: 400; line-height: 1.5; text-align: center; }

/* Onboarding */
.onboarding-content { 
    display: flex; 
    flex-direction: column; 
    gap: 3rem; 
    align-items: center;
    width: 100%;
}

.input-wrapper {
    position: relative;
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
}

.label-inside {
    position: absolute;
    top: -0.6rem;
    left: 1rem;
    background: #020617;
    padding: 0 0.5rem;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--accent-color);
    border-radius: 4px;
    z-index: 10;
}

.form-group {
    width: 100%;
    display: flex;
    justify-content: center;
}

.form-group input {
    width: 100%;
    max-width: 280px;
    padding: 1.25rem;
    border-radius: 1.25rem;
    border: 1px solid var(--glass-border);
    background: var(--input-bg);
    color: #fff;
    font-size: 1.75rem;
    text-align: center;
    font-weight: 900;
    transition: all 0.3s ease;
    display: block !important;
}

.form-group input::placeholder { font-size: 1rem; opacity: 0.3; font-weight: 500; }

/* Premium Buttons */
.primary-btn {
    padding: 1.25rem 2rem;
    border-radius: 1.125rem;
    background: var(--btn-gradient);
    color: #fff;
    border: none;
    font-size: 1.05rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: var(--btn-shadow);
}

.start-btn {
    margin: 0 auto;
    display: block;
    width: 100%;
    max-width: 280px;
}

.primary-btn:hover { transform: translateY(-3px); box-shadow: 0 10px 20px rgba(99, 102, 241, 0.4); }
.primary-btn:active { transform: translateY(0) scale(0.98); }

/* Test Mode Overlay */
.test-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #020617;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.test-header-refined {
    position: absolute;
    top: 0; left: 0; width: 100%;
    padding: 3rem;
    display: flex;
    justify-content: space-between;
}

.stat-label-mini { font-size: 0.85rem; font-weight: 900; opacity: 0.4; letter-spacing: 0.1em; margin-bottom: 0.5rem; }
.timer { font-size: 4.5rem; font-weight: 900; font-family: 'JetBrains Mono', monospace; line-height: 1; }
#test-counter { color: #fff; }
#test-timer { color: var(--primary-color); }

.test-instruction { 
    font-size: 0.95rem; 
    font-weight: 600; 
    opacity: 0.8;
    text-align: center;
    line-height: 1.6;
}

#test-message { margin-top: 4rem; }

.tap-btn {
    width: 280px;
    height: 280px;
    border-radius: 50%;
    border: 2px solid var(--glass-border);
    background: radial-gradient(circle, rgba(99,102,241,0.1) 0%, transparent 70%);
    color: #fff;
    font-size: 3.5rem;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.tap-btn:active {
    transform: scale(0.97);
    background: radial-gradient(circle, rgba(99,102,241,0.3) 0%, transparent 70%);
    border-color: var(--primary-color);
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.4);
}

.tap-pop {
    animation: tap-pop-anim 0.12s cubic-bezier(0.2, 0, 0.2, 1);
}

@keyframes tap-pop-anim {
    0% { transform: scale(1); }
    50% { transform: scale(0.98); }
    100% { transform: scale(1); }
}

/* Results Modal Refined */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(2, 6, 23, 0.85);
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.modal-content {
    background: var(--card-bg);
    padding: 2rem 1rem;
    border-radius: 2.5rem;
    max-width: 540px;
    width: 100%;
    height: 85vh;
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Tabs */
.modal-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.4rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 1.25rem;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.tab-btn {
    flex: 1;
    padding: 0.8rem;
    border: none;
    border-radius: 0.9rem;
    background: transparent;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.tab-btn:hover:not(.active) {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

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

.tab-pane {
    display: none;
    height: auto;
}

.tab-pane.active {
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.results-modal-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--glass-border) transparent;
    padding-right: 0.5rem;
    -webkit-overflow-scrolling: touch;
}

.results-modal-scroll::-webkit-scrollbar { width: 4px; }
.results-modal-scroll::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 10px; }

/* Analysis Content */
.result-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.15) 0%, rgba(56, 189, 248, 0.05) 100%);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 2.5rem;
    padding: 2.5rem 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.1), inset 0 0 20px rgba(56, 189, 248, 0.1);
}

.result-title-main { 
    font-size: 1.4rem; 
    font-weight: 900; 
    text-align: center; 
    margin-bottom: 1.5rem; 
    flex-shrink: 0; 
    letter-spacing: -0.02em;
}

.result-main-score { 
    font-size: 3.5rem; 
    font-weight: 900; 
    margin-bottom: 1.5rem; 
    text-align: center; 
    line-height: 1; 
    color: #fff;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

.result-main-score .unit { font-size: 1.25rem; opacity: 0.5; margin-left: 0.5rem; }

.total-score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin-top: 0.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.total-label {
    font-size: 0.85rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
    color: var(--accent-color);
    text-transform: uppercase;
    opacity: 0.8;
}

.total-value {
    font-size: 3.5rem;
    font-weight: 950;
    color: #fff;
    text-shadow: 
        0 0 10px rgba(56, 189, 248, 0.8),
        0 0 20px rgba(56, 189, 248, 0.5),
        0 0 30px rgba(56, 189, 248, 0.3);
    animation: intenseGlow 2s ease-in-out infinite alternate;
    line-height: 1;
    letter-spacing: -0.02em;
}

@keyframes intenseGlow {
    from {
        text-shadow: 
            0 0 10px rgba(56, 189, 248, 0.8),
            0 0 20px rgba(56, 189, 248, 0.5),
            0 0 30px rgba(56, 189, 248, 0.3);
        transform: scale(1);
    }
    to {
        text-shadow: 
            0 0 15px rgba(56, 189, 248, 1),
            0 0 30px rgba(56, 189, 248, 0.8),
            0 0 50px rgba(56, 189, 248, 0.6);
        transform: scale(1.05);
    }
}

/* Vertical Metrics List */
.metrics-vertical-list { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 2rem; width: 100%; }

.metric-box-v {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 1.75rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: all 0.3s ease;
    width: 100%;
}

.metric-box-v:hover { background: rgba(255, 255, 255, 0.05); border-color: rgba(99, 102, 241, 0.3); }

.metric-v-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}

.metric-v-title-wrap { display: flex; flex-direction: column; gap: 0.2rem; }
.m-v-label-ko { font-size: 1rem; font-weight: 800; color: #fff; }
.m-v-label-en { font-size: 0.7rem; font-weight: 700; opacity: 0.4; letter-spacing: 0.05em; color: var(--accent-color); }

.m-v-score {
    font-size: 2rem;
    font-weight: 900;
    color: var(--accent-color);
    font-family: 'JetBrains Mono', monospace;
    line-height: 1;
}

.m-v-data-row { display: flex; justify-content: space-between; align-items: flex-end; width: 100%; }
.m-v-sub-info { display: flex; align-items: baseline; gap: 0.5rem; }
.m-v-sub-label { font-size: 0.85rem; font-weight: 600; opacity: 0.6; }

.m-v-diff { font-size: 0.8rem; font-weight: 800; }
.diff-plus { color: var(--green); }
.diff-minus { color: var(--red); }

.formula-text {
    font-size: 0.65rem;
    font-weight: 500;
    opacity: 0.35;
    letter-spacing: 0.02em;
    font-style: italic;
    margin-top: 0.5rem;
}

.chart-container-v {
    width: 100%;
    height: 150px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 1rem;
    padding: 0.5rem;
    margin-top: 0.25rem;
    position: relative;
}

.chart-container-v canvas { width: 100% !important; height: 100% !important; }

.modal-footer-static { padding-top: 1.5rem; flex-shrink: 0; }

/* PB Card */
.pb-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 2rem;
    padding: 2rem;
    text-align: center;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px -10px rgba(168, 85, 247, 0.3);
}

.pb-label {
    font-size: 0.75rem;
    font-weight: 900;
    letter-spacing: 0.2em;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
    display: block;
}

.pb-value-row {
    display: flex;
    justify-content: center;
    align-items: baseline; gap: 0.5rem; margin-bottom: 0.5rem;
}

.pb-value { font-size: 4rem; font-weight: 900; color: #fff; text-shadow: 0 0 20px rgba(168, 85, 247, 0.5); }
.pb-unit { font-size: 1.25rem; font-weight: 700; opacity: 0.5; }
.pb-desc { font-size: 0.85rem; opacity: 0.6; font-weight: 500; }

/* History List */
.history-list { display: flex; flex-direction: column; gap: 1rem; }
.history-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 1.25rem;
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}
.history-item:hover { background: rgba(255, 255, 255, 0.05); transform: translateX(5px); }
.history-date { display: flex; flex-direction: column; }
.date-main { font-size: 1rem; font-weight: 800; color: #fff; }
.date-sub { font-size: 0.75rem; opacity: 0.4; margin-top: 0.2rem; }
.history-score-wrap { text-align: right; }
.history-score { font-size: 1.5rem; font-weight: 900; color: var(--accent-color); }
.history-unit { font-size: 0.8rem; opacity: 0.4; margin-left: 0.2rem; }

.modal-footer-static { padding-top: 2rem; }

/* Level Colors */
.level-high { color: var(--green) !important; }
.level-moderate { color: var(--yellow) !important; }
.level-low { color: var(--red) !important; }

/* Navigation & Site Complete Layout */
.nav-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
    font-size: 0.85rem;
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.nav-links a:hover { opacity: 1; }

.info-section {
    width: 100%;
    max-width: 520px;
    margin-top: 3rem;
    padding: 2rem;
    background: var(--card-bg);
    border-radius: 2rem;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(30px);
}

.info-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--accent-color);
    font-weight: 800;
}

.info-section p {
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 1.25rem;
    opacity: 0.8;
}

.info-section ul {
    margin-bottom: 1.25rem;
    padding-left: 1.25rem;
}

.info-section li {
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 0.5rem;
    opacity: 0.7;
}

/* Footer Links & Email */
.footer-links {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    font-size: 0.7rem;
    opacity: 0.4;
}

.footer-links a {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.3s;
}

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

.footer-email {
    margin-top: 0.5rem;
    text-align: center;
    font-size: 0.7rem;
    opacity: 0.4;
}

.footer-email a {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.3s;
}

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

/* Transitions */
.view-transition {
    animation: fadeInScale 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes fadeInScale {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

footer { 
    margin-top: 3rem;
    margin-bottom: 2rem;
    text-align: center; 
    font-size: 0.65rem; 
    opacity: 0.25; 
    width: 100%;
}

/* Analysis Final Message */
.res-msg {
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.8;
    color: var(--text-color);
    text-align: center;
    letter-spacing: -0.01em;
    word-break: keep-all;
    padding: 1.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.01);
    margin: 0 auto;
    max-width: 95%;
}

@media (max-width: 640px) {
    .test-header-refined { padding: 2rem 1.5rem; }
    .timer { font-size: 3rem; }
    .tap-btn { width: 220px; height: 220px; font-size: 2.75rem; }
}
