:root {
    --bg: #f4f3fb;
    --card: #ffffff;
    --text: #33334d;
    --muted: #74748c;
    --heading: #2a2a44;
    --purple: #88619a;       /* primary brand accent */
    --purple-soft: #f0eaf5;
    --agree: #4caf82;        /* green = agree */
    --disagree: #9061c2;     /* purple = disagree */
    --neutral: #b9b9cc;
    --border: #e6e5f0;
}

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

body {
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    min-height: 100vh;
    padding: 2.5rem 1rem;
}

.container { max-width: 680px; margin: 0 auto; }

/* Header */
.hero { text-align: center; margin-bottom: 2rem; }
.hero h1 {
    font-size: 2.1rem;
    color: var(--heading);
    font-weight: 700;
}
.subtitle {
    color: var(--muted);
    margin-top: .4rem;
    font-size: 1.05rem;
}

/* Cards */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 12px rgba(60, 50, 90, .05);
}
.card h2 {
    font-size: 1.2rem;
    color: var(--heading);
    margin-bottom: 1rem;
    font-weight: 600;
}

/* Intro list */
.steps { list-style: none; }
.steps li {
    padding: .45rem 0 .45rem 1.8rem;
    position: relative;
    color: var(--text);
}
.steps li::before {
    content: "";
    position: absolute;
    left: 0;
    top: .85rem;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--purple);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: .8rem 1.8rem;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    margin-top: 1.25rem;
    margin-right: .5rem;
    font-family: inherit;
    transition: background .2s, transform .1s, box-shadow .2s;
}
.btn-primary {
    background: var(--purple);
    color: #fff;
    box-shadow: 0 4px 14px rgba(136, 97, 154, .3);
}
.btn-primary:hover { background: #76548a; transform: translateY(-1px); }
.btn-ghost {
    background: transparent;
    color: var(--purple);
    border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: var(--purple-soft); }

/* Dimensions grid */
.dimensions { display: grid; grid-template-columns: repeat(2, 1fr); gap: .9rem; }
.dimensions div {
    background: var(--purple-soft);
    border-radius: 10px;
    padding: .9rem 1rem;
    display: flex;
    flex-direction: column;
}
.dimensions strong { color: var(--purple); font-size: 1.05rem; }
.dimensions span { color: var(--muted); font-size: .82rem; }

/* Questions */
.question {
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 1.6rem 0;
}
.question:last-of-type { border-bottom: none; }
.statement {
    text-align: center;
    font-size: 1.1rem;
    color: var(--heading);
    margin-bottom: 1.1rem;
    font-weight: 500;
}

/* Agree–Disagree scale */
.scale {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .7rem;
    flex-wrap: nowrap;
}
.scale-end {
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    white-space: nowrap;
}
.agree-end { color: var(--agree); }
.dis-end { color: var(--disagree); }

.opt { cursor: pointer; line-height: 0; }
.opt input { display: none; }
.dot {
    display: inline-block;
    border-radius: 50%;
    border: 2.5px solid currentColor;
    background: transparent;
    transition: background .15s, transform .1s;
}
.opt:hover .dot { transform: scale(1.12); }
.opt input:checked + .dot { background: currentColor; }

.dot.size3 { width: 42px; height: 42px; }
.dot.size2 { width: 34px; height: 34px; }
.dot.size1 { width: 28px; height: 28px; }
.dot.size0 { width: 24px; height: 24px; }

.opt.agree   { color: var(--agree); }
.opt.disagree{ color: var(--disagree); }
.opt.neutral { color: var(--neutral); }

/* Email capture */
.email-input {
    display: block;
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
    padding: .85rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text);
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    text-align: center;
}
.email-input:focus {
    outline: none;
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(136, 97, 154, .15);
}

/* Processing animation */
.processing { text-align: center; padding: 3rem 2rem; }
.spinner {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 5px solid var(--border);
    border-top-color: var(--purple);
    margin: 0 auto 1.5rem;
    animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.processing-text {
    font-size: 1.1rem;
    color: var(--heading);
    font-weight: 600;
    margin-bottom: 1.5rem;
}
.proc-bar {
    height: 8px;
    max-width: 320px;
    margin: 0 auto;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}
.proc-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--purple), var(--agree));
    transition: width 2.6s ease;
}

/* Section heading + navigation */
.section-title {
    text-align: center;
    color: var(--purple);
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
}
.nav-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
}
.nav-row #back { margin-right: auto; }
.nav-row .btn { margin-right: 0; }

/* Progress + validation */
.progress-bar {
    position: sticky;
    bottom: 0;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    margin: 1.8rem 0 .5rem;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    width: 0;
    background: var(--purple);
    transition: width .3s ease;
}
.warn { color: #d05a6e; margin-top: .5rem; font-size: .9rem; }

/* Result */
.type-code {
    font-size: 3.4rem;
    letter-spacing: .25rem;
    color: var(--purple);
    font-weight: 800;
}
.type-name {
    font-size: 2.6rem;
    color: var(--purple);
    font-weight: 800;
}
.type-title {
    font-size: 1.25rem;
    color: var(--muted);
    margin-bottom: 1rem;
    font-weight: 600;
}
.description { font-size: 1.08rem; margin-bottom: 1.75rem; }

.bars { display: flex; flex-direction: column; gap: 1.1rem; margin-bottom: 1rem; }
.bar-row { display: grid; grid-template-columns: 1fr 2fr 1fr; align-items: center; gap: .75rem; }
.bar-label { font-size: .82rem; color: var(--muted); white-space: nowrap; }
.bar-label.active { color: var(--heading); font-weight: 700; }
.bar-label:last-child { text-align: right; }
.bar-track { height: 9px; background: var(--border); border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--purple); }

/* Result detail sections */
.section h3 {
    font-size: 1.15rem;
    color: var(--heading);
    margin-bottom: .9rem;
    font-weight: 700;
}
.section p { color: var(--text); }

.sw-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.sw-col h4 { font-size: .95rem; margin-bottom: .6rem; font-weight: 700; }
.sw-col.str h4 { color: var(--agree); }
.sw-col.weak h4 { color: var(--disagree); }
.traits { list-style: none; }
.traits li {
    position: relative;
    padding: .3rem 0 .3rem 1.4rem;
    color: var(--text);
    font-size: .95rem;
}
.traits li::before {
    position: absolute;
    left: 0;
    font-weight: 700;
}
.sw-col.str .traits li::before { content: "+"; color: var(--agree); }
.sw-col.weak .traits li::before { content: "–"; color: var(--disagree); }

/* Type gallery */
.type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: .8rem;
}
.type-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .15rem;
    background: var(--purple-soft);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    cursor: pointer;
    text-align: left;
    text-decoration: none;
    font-family: inherit;
    transition: border-color .15s, transform .1s, box-shadow .2s;
}
.type-card:hover {
    border-color: var(--purple);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(136, 97, 154, .15);
}
.type-card-title { font-size: 1.05rem; color: var(--purple); font-weight: 700; }

.chips { display: flex; flex-wrap: wrap; gap: .55rem; }
.chip {
    background: var(--purple-soft);
    color: var(--purple);
    border-radius: 999px;
    padding: .45rem 1rem;
    font-size: .9rem;
    font-weight: 600;
}
.chip.city {
    background: #e6f5ee;
    color: var(--agree);
}
.chip.fiction {
    background: #e8edfb;
    color: #4a63b8;
}

.footer { text-align: center; color: var(--muted); font-size: .82rem; margin-top: 1.5rem; }

@media (max-width: 540px) {
    .hero h1 { font-size: 1.7rem; }
    .type-code { font-size: 2.7rem; }
    .type-name { font-size: 2rem; }
    .card { padding: 1.4rem; }
    .dimensions { grid-template-columns: 1fr; }
    .scale { gap: .4rem; }
    .scale-end { font-size: .65rem; }
    .dot.size3 { width: 34px; height: 34px; }
    .dot.size2 { width: 28px; height: 28px; }
    .dot.size1 { width: 24px; height: 24px; }
    .dot.size0 { width: 21px; height: 21px; }
    .bar-row { grid-template-columns: 1fr; gap: .3rem; }
    .bar-label:last-child { text-align: left; }
    .sw-grid { grid-template-columns: 1fr; gap: 1rem; }
}
