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

:root {
    --blue:       #142850;
    --blue-deep:  #0b1830;
    --blue-soft:  rgba(20,40,80,0.08);
    --red:        #d7263d;
    --red-soft:   rgba(215,38,61,0.09);
    --text:       #15171c;
    --muted:      #6b7280;
    --border:     #e6e7eb;
    --bg:         rgb(19,29,57);
    --scale-accent: #3a4150;
    --ease:       cubic-bezier(.22,.61,.36,1);
    --font-display: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --font-body:    'Helvetica Neue', Helvetica, Arial, sans-serif;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- Content area ---- */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 16px;
}

.logo-zone {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70px;
}

.bottom-zone { flex: 1; }

.brand-logo {
    height: 64px;
    width: auto;
    user-select: none;
}

.card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05), 0 14px 40px rgba(15,23,42,0.09);
    padding: clamp(36px, 6vw, 56px) clamp(28px, 6vw, 52px);
    width: 100%;
    max-width: 600px;
}

/* ---- Screen transitions ---- */
.screen { display: none; }

.screen.active {
    display: block;
    animation: screenIn .42s var(--ease) both;
}

.screen.leaving {
    display: block;
    animation: screenOut .3s var(--ease) both;
    pointer-events: none;
}

@keyframes screenIn {
    from { opacity: 0; transform: translateY(16px) scale(.985); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes screenOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to   { opacity: 0; transform: translateY(-10px) scale(.99); }
}

/* ---- Typography ---- */
.screen-title {
    font-family: var(--font-display);
    font-size: clamp(23px, 4vw, 28px);
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
    margin-bottom: 8px;
    text-align: center;
}

.screen-title .accent { color: var(--blue); }

.screen-subtitle {
    font-size: 14.5px;
    color: var(--muted);
    line-height: 1.6;
    margin: 0 auto 38px;
    max-width: 46ch;
    text-align: center;
}

.load-error {
    font-size: 13px;
    color: var(--red);
    background: var(--red-soft);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.field-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: .02em;
    color: #374151;
    margin-bottom: 9px;
}

/* ---- Inputs ---- */
.text-input {
    width: 100%;
    padding: 13px 16px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text);
    outline: none;
    transition: border-color .18s, box-shadow .18s, background .18s;
    background: #fff;
}

.text-input:hover { border-color: #c8cad1; }

.text-input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3.5px var(--blue-soft);
}

textarea.text-input {
    resize: none;
    height: 112px;
    line-height: 1.55;
}

.char-counter {
    font-size: 12px;
    color: #9ca3af;
    text-align: right;
    margin-top: 5px;
    transition: color .2s;
}

.char-counter.warn { color: var(--red); }

/* ---- Progress bar ---- */
.progress-track {
    height: 3px;
    background: #eef0f2;
    border-radius: 2px;
    margin-bottom: 42px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--red), var(--blue));
    border-radius: 2px;
    transition: width .45s var(--ease);
}

/* ---- Question header ---- */
.q-body { position: relative; }

.q-body > * {
    transition: opacity .28s var(--ease), transform .28s var(--ease);
}

.q-body > *:nth-child(1) { transition-delay: 0ms; }
.q-body > *:nth-child(2) { transition-delay: 30ms; }
.q-body > *:nth-child(3) { transition-delay: 60ms; }
.q-body > *:nth-child(4) { transition-delay: 90ms; }

.q-body.leave-next > * { opacity: 0; transform: translate(-22px, -3px) scale(.98); }
.q-body.leave-prev > * { opacity: 0; transform: translate(22px, -3px) scale(.98); }
.q-body.enter-next > * { opacity: 0; transform: translate(26px, 0) scale(.98); }
.q-body.enter-prev > * { opacity: 0; transform: translate(-26px, 0) scale(.98); }

.q-tag {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--red);
    margin-bottom: 12px;
}

.q-tag::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--red);
    flex-shrink: 0;
}

.q-text {
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 600;
    line-height: 1.42;
    color: var(--text);
    margin-bottom: 10px;
    text-align: center;
}

.q-desc {
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    line-height: 1.5;
    text-align: center;
    max-width: 50ch;
    margin: 0 auto 32px;
}

/* ---- Scale control (rail / slider) ---- */
.scale-root { display: flex; flex-direction: column; }

.rail-outer {
    position: relative;
    height: 48px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    touch-action: none;
    cursor: pointer;
}

.rail-line {
    position: absolute;
    left: 14px;
    right: 14px;
    top: 50%;
    height: 6px;
    transform: translateY(-50%);
    border-radius: 999px;
    overflow: hidden;
}

.rail-base {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #e2e4e9;
}

.rail-fill {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 0%;
    border-radius: 999px;
    background: var(--scale-accent);
    transition: width .22s var(--ease);
}

.rail-steps {
    position: absolute;
    left: 14px;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    height: 0;
}

.step {
    position: absolute;
    top: 0;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #d6d8dd;
    transform: translate(-50%, -50%);
    transition: transform .15s var(--ease), border-color .15s, background .15s;
    cursor: pointer;
    padding: 0;
}

.step:nth-of-type(1) { left: 0%; }
.step:nth-of-type(2) { left: 25%; }
.step:nth-of-type(3) { left: 50%; }
.step:nth-of-type(4) { left: 75%; }
.step:nth-of-type(5) { left: 100%; }

.step.passed { background: var(--scale-accent); border-color: var(--scale-accent); }
.step:hover { transform: translate(-50%, -50%) scale(1.35); border-color: var(--scale-accent); }

.handle {
    position: absolute;
    top: 50%;
    left: 0%;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #d6d8dd;
    box-shadow: 0 2px 6px rgba(15,23,42,0.12);
    transform: translate(-50%, -50%);
    transition: left .22s var(--ease), transform .15s var(--ease), box-shadow .15s var(--ease), border-color .15s;
    cursor: grab;
    z-index: 2;
}

.rail-outer:not(.untouched) .handle {
    border-color: var(--scale-accent);
    box-shadow: 0 0 0 4px rgba(58,65,80,0.16), 0 2px 6px rgba(15,23,42,0.15);
}

.handle:hover { transform: translate(-50%, -50%) scale(1.08); }

.handle.dragging {
    transition: transform .15s var(--ease), box-shadow .15s var(--ease), border-color .15s;
    transform: translate(-50%, -50%) scale(1.2);
    cursor: grabbing;
}

.handle:focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 4px;
}

.labels-row {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
}

.scale-lbl {
    font-size: 11.5px;
    color: #9ca3af;
    font-weight: 600;
    letter-spacing: .02em;
}

.scale-value-label {
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    color: var(--muted);
    min-height: 24px;
    margin-top: 18px;
    transition: color .2s;
}

.scale-value-label.answered { color: var(--text); }

/* ---- Buttons ---- */
.actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 42px;
}

.btn {
    padding: 12px 28px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .01em;
    cursor: pointer;
    border: none;
    transition: background .18s, box-shadow .18s, transform .12s, color .18s;
    font-family: inherit;
}

.btn:focus-visible {
    outline: 3px solid var(--blue-soft);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--blue);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--blue-deep);
    box-shadow: 0 4px 14px rgba(20,40,80,0.3);
    transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) { transform: translateY(0) scale(.98); }

.btn-primary:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-ghost {
    background: transparent;
    color: #9ca3af;
    padding-left: 4px;
}

.btn-ghost:hover { color: var(--text); }
.btn-ghost:active { transform: scale(.98); }
.btn-ghost.hidden { visibility: hidden; pointer-events: none; }

/* ---- Thanks screen ---- */
.thanks-wrap { text-align: center; padding: 8px 0; }

.check-circle {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue), #1f3d73);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 28px;
}

.check-circle svg { width: 34px; height: 34px; }

.thanks-title {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
}

.thanks-body {
    font-size: 15px;
    color: var(--muted);
    line-height: 1.65;
}

.thanks-body strong { color: var(--text); }

/* ---- Footer ---- */
footer {
    text-align: center;
    padding: 20px;
    font-size: 12px;
    color: #9ca3af;
}

@media (max-width: 480px) {
    .content { padding: 32px 30px; }
    .card { padding: 28px 22px; }
    .progress-track { margin-bottom: 30px; }
    .q-text { margin-bottom: 8px; }
    .q-desc { margin-bottom: 26px; }
    .actions { margin-top: 30px; }
    .handle { width: 30px; height: 30px; }
    .rail-outer { height: 52px; }
}

@media (prefers-reduced-motion: reduce) {
    .screen.active, .screen.leaving { animation: none !important; }
    .q-body > * { transition: none !important; }
    .handle, .rail-fill, .step { transition: none !important; }
    .btn { transition: none !important; }
}
