:root {
    /* --- 8 Core Palette (Brainysis Design System) --- */
    --deep-indigo: #0B1F3B;
    --royal-blue: #2563EB;
    --electric-cyan: #00E5FF;
    --neon-mint: #2EE6A6;
    --dark-slate: #0F172A;
    --slate-gray: #475569;
    --light-gray: #E2E8F0;
    --pure-white: #FFFFFF;

    /* --- Status / badge tones (section 6 of style guide) --- */
    --success-bg: #D1FAE5;  --success-text: #065F46;
    --info-bg:    #E0F2FE;  --info-text:    #0369A1;
    --primary-bg: #DBEAFE;  --primary-text: #1E40AF;
    --gold-bg:    #FEF3C7;  --gold-text:    #92400E;
    --danger-bg:  #FEE2E2;  --danger-text:  #991B1B;
    --danger: #DC2626;

    /* --- Typography --- */
    --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-heading: 'Outfit', sans-serif;

    /* --- Radius scale --- */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    /* --- Shadow scale --- */
    --shadow-sm: 0 1px 3px rgba(11, 31, 59, 0.06);
    --shadow-md: 0 4px 14px -2px rgba(11, 31, 59, 0.1);
    --shadow-lg: 0 12px 32px -4px rgba(11, 31, 59, 0.14);
    --shadow-glow: 0 0 25px rgba(37, 99, 235, 0.22);

    /* --- Surface / page --- */
    --page-bg: #F8FAFC;
    --card-border: var(--light-gray);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--page-bg);
    color: var(--slate-gray);
    font-family: var(--font-main);
    line-height: 1.6;
}

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    color: var(--dark-slate);
    margin: 0 0 8px;
}
legend { font-family: var(--font-heading); }

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

/* --- Glassmorphism app header --- */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 32px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--light-gray);
    position: sticky;
    top: 0;
    z-index: 100;
}
.site-header .brand img { height: 32px; display: block; }
.site-nav { display: flex; align-items: center; gap: 20px; }
.site-nav a { color: var(--slate-gray); text-decoration: none; font-size: 14px; font-weight: 500; }
.site-nav a:hover { color: var(--royal-blue); }
.site-nav .nav-user { color: var(--slate-gray); font-size: 13px; }

main { max-width: 900px; margin: 0 auto; padding: 40px 20px 80px; }

.site-footer {
    text-align: center;
    padding: 24px;
    color: var(--slate-gray);
    font-size: 13px;
    border-top: 1px solid var(--light-gray);
}

/* --- Tagline pill badge --- */
.brand-tagline-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 229, 255, 0.12);
    border: 1px solid rgba(0, 229, 255, 0.4);
    color: var(--deep-indigo);
    padding: 4px 14px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 14px;
}

/* --- Hero / landing --- */
.hero { text-align: center; }
.hero-logo { height: 64px; margin-bottom: 12px; }
.hero h1 { font-size: 32px; font-weight: 700; }
.hero h1 span { color: var(--royal-blue); }
.tagline { color: var(--slate-gray); max-width: 520px; margin: 12px auto 0; }
.hint { color: var(--slate-gray); font-size: 13px; max-width: 480px; margin: 20px auto 0; }
.hint code { background: var(--light-gray); padding: 2px 6px; border-radius: 4px; }

.start-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 360px;
    margin: 32px auto 0;
    text-align: left;
}
.start-form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--dark-slate); font-weight: 500; }
.start-form input {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--light-gray);
    background: var(--pure-white);
    color: var(--dark-slate);
    font-size: 15px;
    font-family: inherit;
}
.start-form input:focus { outline: none; border-color: var(--royal-blue); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }

/* --- Primary button (exact spec) --- */
.start-form button,
.print-btn,
#submit-btn {
    background: linear-gradient(135deg, var(--deep-indigo) 0%, var(--royal-blue) 60%, var(--electric-cyan) 100%);
    color: var(--pure-white);
    border: none;
    border-radius: var(--radius-md);
    padding: 0.875rem 1.75rem;
    font-weight: 600;
    font-family: var(--font-main);
    font-size: 15px;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
    transition: all 0.25s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.start-form button:hover,
.print-btn:hover,
#submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
}

.link-btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--light-gray);
    background: var(--pure-white);
    color: var(--dark-slate);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}
.link-btn:hover { border-color: var(--royal-blue); color: var(--royal-blue); text-decoration: none; }
.link-btn.small { padding: 6px 12px; font-size: 13px; }

/* --- Quiz --- */
.quiz-head { margin-bottom: 24px; }
.quiz-head p { color: var(--slate-gray); font-size: 14px; max-width: 640px; }

.progress {
    height: 8px;
    background: var(--light-gray);
    border-radius: 999px;
    margin: 16px 0 4px;
    overflow: hidden;
}
.progress-bar {
    height: 100%; width: 0;
    background: linear-gradient(90deg, var(--deep-indigo), var(--royal-blue), var(--electric-cyan));
    border-radius: 999px;
    transition: width .2s ease;
}

.quiz-row {
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 16px;
    background: var(--pure-white);
    box-shadow: var(--shadow-sm);
    transition: box-shadow .15s ease;
}
.quiz-row:focus-within,
.quiz-row:hover { box-shadow: var(--shadow-md); }

.quiz-row legend {
    padding: 4px 12px;
    font-weight: 700;
    font-size: 12px;
    background: var(--dark-slate);
    color: var(--pure-white);
    border-radius: 999px;
    letter-spacing: .03em;
}
.quiz-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.quiz-table th {
    text-align: left;
    font-size: 12px;
    color: var(--slate-gray);
    font-weight: 600;
    padding-bottom: 8px;
}
.quiz-table th.letter, .quiz-table td.letter { width: 24px; }
.quiz-table th.col-head { text-align: center; font-weight: 700; font-size: 12px; }
.quiz-table th.col-head.mirip { color: var(--royal-blue); }
.quiz-table th.col-head.tidak-mirip { color: var(--dark-slate); }
.quiz-table td { padding: 7px 4px; font-size: 0.95rem; font-weight: 500; vertical-align: middle; color: #334155; }
.quiz-table td.letter { color: var(--royal-blue); font-weight: 700; font-family: var(--font-heading); }
.quiz-table td.radio-cell { width: 56px; text-align: center; }

/* Input radio asli disembunyikan secara visual (tetap accessible lewat label/for),
   diganti tampilan lingkaran custom dengan tanda centang (Mirip) / silang (Tidak Mirip),
   mengikuti semantik warna "selected state" pada style guide. */
.quiz-table input[type="radio"] {
    position: absolute;
    width: 1px; height: 1px;
    opacity: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
}
.choice-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1.5px solid var(--light-gray);
    background: #F8FAFC;
    cursor: pointer;
    position: relative;
    transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .1s ease;
}
.choice-mark::after {
    content: "";
    font-size: 14px;
    line-height: 1;
    font-weight: 700;
    color: var(--pure-white);
    opacity: 0;
    transition: opacity .1s ease;
}
.choice-mark.mirip::after { content: "\2713"; } /* ✓ */
.choice-mark.tidak-mirip::after { content: "\2715"; } /* ✕ */

.choice-mark:hover { background: #EFF6FF; border-color: #93C5FD; transform: translateY(-1px); }

.quiz-table input[type="radio"]:checked + .choice-mark.mirip {
    background: var(--royal-blue);
    border-color: var(--royal-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.22);
}
.quiz-table input[type="radio"]:checked + .choice-mark.tidak-mirip {
    background: var(--dark-slate);
    border-color: var(--dark-slate);
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.16);
}
.quiz-table input[type="radio"]:checked + .choice-mark::after { opacity: 1; }
.quiz-table input[type="radio"]:focus-visible + .choice-mark { outline: 2px solid var(--electric-cyan); outline-offset: 2px; }

.row-warning { color: var(--danger-text); font-size: 13px; margin: 8px 0 0; font-weight: 600; }
.form-error { color: var(--danger-text); text-align: center; font-size: 14px; margin: 12px 0 0; }

#submit-btn { width: 100%; margin-top: 8px; font-size: 16px; }

/* --- Banner: jumlah soal belum terisi --- */
.unanswered-banner {
    display: none;
    align-items: center;
    gap: 10px;
    background: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid rgba(153,27,27,0.25);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    position: sticky;
    top: 70px;
    z-index: 50;
}
.unanswered-banner.show { display: flex; }

/* --- Fullscreen processing overlay --- */
.processing-overlay {
    position: fixed;
    inset: 0;
    background: rgba(248, 250, 252, 0.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 1000;
    text-align: center;
    padding: 20px;
}
.processing-overlay.show { display: flex; }
.processing-spinner {
    width: 44px; height: 44px;
    border-radius: 50%;
    border: 4px solid var(--light-gray);
    border-top-color: var(--royal-blue);
    animation: brainysis-spin 0.8s linear infinite;
}
.processing-overlay p { color: var(--dark-slate); font-weight: 600; max-width: 320px; }
@keyframes brainysis-spin { to { transform: rotate(360deg); } }

/* --- Result --- */
.result-head p { color: var(--slate-gray); }

/* Kop surat / letterhead laporan */
.letterhead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 3px solid var(--deep-indigo);
    padding-bottom: 16px;
    margin-bottom: 24px;
}
.letterhead img { height: 34px; }
.letterhead .letterhead-title { text-align: right; }
.letterhead .letterhead-title h1 { font-size: 16px; margin: 0; letter-spacing: .02em; }
.letterhead .letterhead-title span { font-size: 12px; color: var(--slate-gray); }

.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 20px 0; }
.profile-card {
    background: var(--pure-white);
    border: 1px solid var(--card-border);
    border-left: 4px solid var(--royal-blue);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 22px;
}
.profile-card.secondary { border-left-color: var(--electric-cyan); }
.archetype-label { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--slate-gray); display: block; margin-top: 12px; font-weight: 600; }
.profile-card h3 { margin-top: 4px; }
.profile-card p { color: var(--slate-gray); }
.profile-card .code { color: var(--slate-gray); font-size: 13px; margin-top: 10px; font-family: monospace; display: flex; align-items: center; gap: 6px; }

.archetype-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.35), transparent 60%), linear-gradient(135deg, var(--royal-blue), var(--electric-cyan));
    box-shadow: var(--shadow-glow);
    color: var(--pure-white);
}
.badge-icon { display: flex; }

.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 24px 0; }
.chart-card {
    background: var(--pure-white);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 18px;
}
.chart-card h3 { font-size: 15px; }
.chart-card h3 span { color: var(--slate-gray); font-size: 12px; font-weight: 400; display: block; }
.chart-card.full { margin: 24px 0; }

.score-table {
    background: var(--pure-white);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 6px 16px;
}
.score-table table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.score-table th, .score-table td { padding: 10px; border-bottom: 1px solid var(--light-gray); text-align: left; font-size: 14px; }
.score-table th { color: var(--slate-gray); font-size: 12px; }
.score-table td.high { background: var(--success-bg); color: var(--success-text); font-weight: 700; border-radius: var(--radius-sm); }

.actions { display: flex; gap: 12px; margin-top: 24px; }

/* --- Icons --- */
.icon { display: inline-block; vertical-align: -3px; }

/* --- Interpretasi per dimensi --- */
.section-title { margin: 32px 0 14px; font-size: 18px; }
.section-title span { color: var(--slate-gray); font-size: 13px; font-weight: 400; display: inline-block; margin-left: 6px; }

.dim-list { display: flex; flex-direction: column; gap: 14px; }
.dim-row {
    display: flex;
    gap: 16px;
    background: var(--pure-white);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 16px 18px;
}
.dim-icon {
    flex: none;
    width: 44px; height: 44px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--dark-slate);
}
.dim-icon.high { background: var(--success-bg); }
.dim-icon.low  { background: var(--light-gray); }
.dim-body { flex: 1; }
.dim-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.dim-top strong { font-family: var(--font-heading); color: var(--dark-slate); font-size: 15px; }
.dim-pct { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.dim-pct.high { background: var(--success-bg); color: var(--success-text); }
.dim-pct.low  { background: var(--light-gray); color: var(--slate-gray); }
.dim-body p { margin: 8px 0 0; font-size: 14px; color: var(--slate-gray); }

.bar-track { height: 8px; background: var(--light-gray); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; }
.bar-fill.high { background: linear-gradient(90deg, var(--royal-blue), var(--neon-mint)); }
.bar-fill.low  { background: var(--slate-gray); }

/* --- Kekuatan & area pengembangan --- */
.sw-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.sw-card {
    background: var(--pure-white);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 18px 20px;
    border-left: 4px solid var(--light-gray);
}
.sw-card.strengths { border-left-color: var(--neon-mint); }
.sw-card.watchouts { border-left-color: #F59E0B; }
.sw-card h4 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 15px; }
.sw-card.strengths h4 { color: var(--success-text); }
.sw-card.watchouts h4 { color: var(--gold-text); }
.sw-card ul { margin: 0; padding-left: 18px; font-size: 14px; color: var(--slate-gray); }
.sw-card li { margin-bottom: 6px; }

.tip-box {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: var(--primary-bg);
    border: 1px solid rgba(37,99,235,.25);
    border-left: 4px solid var(--royal-blue);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    margin: 20px 0;
    color: var(--primary-text);
}
.tip-box .icon { color: var(--royal-blue); flex: none; margin-top: 2px; }
.tip-box p { margin: 0; font-size: 14px; color: var(--dark-slate); }

.disclaimer { font-size: 12px; color: var(--slate-gray); margin: 24px 0; font-style: italic; }

/* --- Admin / history --- */
.admin-table {
    width: 100%; border-collapse: collapse; margin-top: 16px;
    background: var(--pure-white); border: 1px solid var(--card-border);
    border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm);
}
.admin-table th, .admin-table td { padding: 10px 14px; border-bottom: 1px solid var(--light-gray); font-size: 14px; text-align: left; }
.admin-table th { color: var(--slate-gray); font-size: 12px; }
.admin-table td.mono { font-family: monospace; color: var(--slate-gray); }

@media (max-width: 640px) {
    .result-grid { grid-template-columns: 1fr; }
    .profile-grid { grid-template-columns: 1fr; }
    .sw-grid { grid-template-columns: 1fr; }
    .site-header { padding: 12px 16px; }
    main { padding: 24px 14px 60px; }
    .letterhead { flex-direction: column; align-items: flex-start; gap: 8px; }
    .letterhead .letterhead-title { text-align: left; }
}

@media print {
    .site-header, .no-print, .site-footer, .unanswered-banner, .processing-overlay { display: none !important; }
    body { background: #fff; color: #0F172A; }
    main { padding: 0; max-width: none; }
    .chart-card, .profile-card, .dim-row, .sw-card, .tip-box, .score-table, .admin-table {
        box-shadow: none; border: 1px solid #ccc;
    }
    a { color: #0F172A; text-decoration: none; }
}
