/* Two constructs, two visual identities:
   sentiment = colour from rose (negative) through slate (neutral) to teal (positive);
   activation = a violet signal meter with one to five bars. */
:root {
    --paper: #eef1f5;
    --card: #ffffff;
    --ink: #17202c;
    --muted: #5a6577;
    --line: #d5dbe4;
    --focus: #b45309;
    --ok: #0b6b3a;
    --error: #a11a1a;

    --s1: #b3304a;
    --s2: #dd6b7f;
    --s3: #8792a4;
    --s4: #2f9a7c;
    --s5: #137a62;
    --s1-tint: #fbe9ec;
    --s2-tint: #fcf0f2;
    --s3-tint: #f0f2f5;
    --s4-tint: #e8f6f1;
    --s5-tint: #ddf1ea;

    --violet: #5747c9;
    --violet-tint: #eeecfb;
    --violet-off: #d6d2f2;

    --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ---------------------------------------------------------------- top bar */

.topbar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 20px;
    background: var(--ink);
    color: #fff;
}

.brand { font-weight: 700; letter-spacing: 0.01em; margin-right: auto; }
.brand-sub { font-weight: 400; opacity: 0.7; }
.progress { font-variant-numeric: tabular-nums; opacity: 0.85; font-size: 0.9rem; }
.topbar .link-button { color: #fff; }

.progress-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -4px;
    width: 100%;
    height: 4px;
    border: 0;
    appearance: none;
    background: transparent;
}
.progress-bar::-webkit-progress-bar { background: transparent; }
.progress-bar::-webkit-progress-value { background: #aab4c3; }
.progress-bar::-moz-progress-bar { background: #aab4c3; }

/* ---------------------------------------------------------------- layout */

main {
    max-width: 760px;
    margin: 0 auto;
    padding: 28px 20px 64px;
}
main:focus { outline: none; }

h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 14px; }
h2 { font-size: 1.1rem; margin: 28px 0 10px; }
h1:focus { outline: none; }

.lede { font-size: 1.08rem; color: var(--ink); margin: 0 0 18px; }
.muted, .notice { color: var(--muted); }
.error { color: var(--error); font-weight: 600; }
.success { color: var(--ok); font-weight: 600; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px 18px;
    margin: 14px 0;
}

.eyebrow {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.part-heading { display: flex; flex-direction: column; gap: 2px; }

/* ---------------------------------------------------------------- construct vocabulary */

.construct-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }

.swatch {
    width: 28px;
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--s1), var(--s3), var(--s5));
}

.dot {
    display: inline-block;
    flex: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--s3);
}
.dot.s1 { background: var(--s1); }
.dot.s2 { background: var(--s2); }
.dot.s3 { background: var(--s3); }
.dot.s4 { background: var(--s4); }
.dot.s5 { background: var(--s5); }

.meter { display: inline-flex; align-items: flex-end; gap: 2px; height: 16px; flex: none; }
.meter i { display: block; width: 4px; border-radius: 1px; background: var(--violet-off); }
.meter i:nth-child(1) { height: 20%; }
.meter i:nth-child(2) { height: 40%; }
.meter i:nth-child(3) { height: 60%; }
.meter i:nth-child(4) { height: 80%; }
.meter i:nth-child(5) { height: 100%; }
.meter.a1 i:nth-child(-n+1),
.meter.a2 i:nth-child(-n+2),
.meter.a3 i:nth-child(-n+3),
.meter.a4 i:nth-child(-n+4),
.meter.a5 i:nth-child(-n+5) { background: var(--violet); }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: 999px;
    font-weight: 600;
    background: var(--card);
    border: 1px solid var(--line);
}
.chip-name { font-weight: 400; color: var(--muted); }
.chip-valence { border-color: #e6c9cf; }
.chip-arousal { border-color: var(--violet-off); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.part-intro .chips { margin: 4px 0 8px; }
.part-intro .chips .construct-name {
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--card);
    border: 1px solid var(--line);
}

/* ---------------------------------------------------------------- instructions */

.constructs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.construct-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 18px 16px 16px;
    position: relative;
    overflow: hidden;
}
.construct-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; }
.construct-card.valence::before { background: linear-gradient(90deg, var(--s1), var(--s3), var(--s5)); }
.construct-card.arousal::before { background: var(--violet); }
.construct-card h2 { margin: 2px 0 6px; font-size: 1.15rem; }
.construct-card p { margin: 0 0 12px; color: var(--muted); }

.scale-preview { display: flex; justify-content: space-between; align-items: center; min-height: 40px; }
.prev {
    display: block;
    width: var(--d, 26px);
    height: var(--d, 26px);
    border-radius: 50%;
    border: 2px solid var(--c);
}
.ends {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.85rem;
    color: var(--muted);
}

.rule {
    margin: 18px 0 0;
    padding: 12px 16px;
    border-left: 4px solid var(--ink);
    background: var(--card);
    border-radius: 0 10px 10px 0;
}

.examples, .parts { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.example {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 16px;
}

.example-text, .item-text {
    margin: 0;
    font-family: var(--serif);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.example-text { font-size: 1.12rem; margin-bottom: 10px; }
.example-text, .item-text { quotes: "\201C" "\201D"; }
.example-text:lang(de), .item-text:lang(de) { quotes: "\201E" "\201C"; }
.example-text::before, .item-text::before { content: open-quote; }
.example-text::after, .item-text::after { content: close-quote; }

.parts { counter-reset: part; }
.parts li {
    display: grid;
    gap: 2px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 16px;
}
.parts li span { color: var(--muted); }

/* ---------------------------------------------------------------- item screens */

.ad {
    margin: 6px 0 18px;
    padding: 18px 22px 22px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 1px 0 rgba(23, 32, 44, 0.04), 0 8px 24px -16px rgba(23, 32, 44, 0.35);
}
.ad .eyebrow { margin-bottom: 8px; }
.item-text { font-size: 1.45rem; line-height: 1.4; }

/* the survey grid: one row per construct, answer points in shared columns */
.grid {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 4px 20px;
}
.grid.is-off .row { opacity: 0.4; }
.grid-caption { margin: 12px 0 2px; font-weight: 600; }

.row {
    display: grid;
    grid-template-columns: 9.5rem minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    column-gap: 14px;
    padding: 14px 0;
}
.row + .row { border-top: 1px solid var(--line); }
.row-label { font-size: 1rem; }

.anchor { font-size: 0.92rem; color: var(--muted); line-height: 1.2; }
.anchor.left { text-align: right; }

.points { display: flex; }
.pt { position: relative; }
.pt input { position: absolute; opacity: 0; width: 1px; height: 1px; }

.points label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    cursor: pointer;
}
.points label::before {
    content: "";
    display: block;
    width: var(--d, 30px);
    height: var(--d, 30px);
    border-radius: 50%;
    border: 2px solid var(--c);
    background: var(--card);
    transition: background-color 120ms, transform 120ms;
}
.pt input:not(:disabled) + label:hover::before { transform: scale(1.1); }
.pt input:checked + label::before { background: var(--c); box-shadow: inset 0 0 0 3px var(--card); }
.pt input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: -2px; border-radius: 50%; }
.pt input:disabled + label { cursor: not-allowed; }

/* sentiment points carry the colour scale; activation points grow with intensity */
.valence .p1 { --c: var(--s1); }
.valence .p2 { --c: var(--s2); }
.valence .p3 { --c: var(--s3); }
.valence .p4 { --c: var(--s4); }
.valence .p5 { --c: var(--s5); }
.arousal .p1, .arousal .p2, .arousal .p3, .arousal .p4, .arousal .p5 { --c: var(--violet); }
.arousal .p1 { --d: 20px; }
.arousal .p2 { --d: 25px; }
.arousal .p3 { --d: 30px; }
.arousal .p4 { --d: 35px; }
.arousal .p5 { --d: 40px; }

/* part 2 rows: label, the model's reading, then agree / disagree / unsure */
.row.judge { grid-template-columns: 9.5rem auto minmax(0, 1fr); }
.row.judge .seg { justify-self: end; }
.reading .chip { font-size: 1rem; }

.seg { display: flex; border: 2px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg .pt + .pt { border-left: 2px solid var(--line); }
.seg label {
    display: block;
    min-width: 6rem;
    padding: 10px 12px;
    text-align: center;
    cursor: pointer;
    background: var(--card);
}
.seg label:hover { background: var(--paper); }
.seg input:checked + label { background: var(--ink); color: #fff; font-weight: 700; }
.seg input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: -3px; }

.item-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 16px;
}
.item-foot.end { justify-content: flex-end; }

.cant-judge { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); font-size: 0.92rem; }
.cant-judge input { width: 18px; height: 18px; margin-top: 2px; flex: none; }

.comment-label { display: block; margin: 16px 0 6px; color: var(--muted); font-size: 0.92rem; }

textarea {
    width: 100%;
    padding: 10px;
    font: inherit;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--card);
    resize: vertical;
}

/* ---------------------------------------------------------------- buttons */

button, .button {
    font: inherit;
    font-weight: 600;
    min-height: 48px;
    padding: 10px 28px;
    border: 0;
    border-radius: 10px;
    background: var(--ink);
    color: #fff;
    cursor: pointer;
}

button:disabled { background: #a7b0bd; cursor: not-allowed; }
button:focus-visible, .link-button:focus-visible, textarea:focus-visible, input:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

button.secondary { background: var(--card); color: var(--ink); border: 2px solid var(--ink); }
.link-button { background: none; color: var(--ink); min-height: 40px; padding: 4px 8px; font-weight: 400; text-decoration: underline; }

.agree-row { display: flex; gap: 10px; align-items: flex-start; margin: 16px 0; }
.agree-row input { width: 22px; height: 22px; margin-top: 3px; }

.actions { margin-top: 22px; display: flex; gap: 12px; justify-content: flex-end; }

@media (max-width: 600px) {
    body { font-size: 16px; }
    main { padding: 20px 14px 48px; }
    .topbar { padding: 10px 14px; gap: 10px; white-space: nowrap; }
    .brand-sub { display: none; }
    .constructs { grid-template-columns: 1fr; }
    .item-text { font-size: 1.25rem; }
    .grid { padding: 4px 12px; }
    .row:not(.judge) {
        grid-template-columns: 1fr 1fr;
        grid-template-areas: "label label" "points points" "left right";
        row-gap: 4px;
    }
    .row-label { grid-area: label; margin-bottom: 4px; }
    .row:not(.judge) .points { grid-area: points; justify-self: center; }
    .anchor { font-size: 0.8rem; }
    .anchor.left { grid-area: left; text-align: left; }
    .anchor.right { grid-area: right; text-align: right; }
    .points label { width: 44px; height: 44px; }
    .arousal .p1 { --d: 18px; }
    .arousal .p2 { --d: 22px; }
    .arousal .p3 { --d: 27px; }
    .arousal .p4 { --d: 32px; }
    .arousal .p5 { --d: 36px; }
    .item-foot { flex-direction: column; align-items: stretch; }
    .item-foot button { width: 100%; }
    .actions button { width: 100%; }
}

/* part 2 rows stack the answer control below the reading on narrower screens */
@media (max-width: 760px) {
    .row.judge { grid-template-columns: auto minmax(0, 1fr); row-gap: 10px; }
    .row.judge .row-label { grid-area: auto; margin-bottom: 0; }
    .row.judge .seg { grid-column: 1 / -1; justify-self: stretch; }
    .seg .pt { flex: 1; }
    .seg label { min-width: 0; padding: 12px 4px; }
}

@media (prefers-reduced-motion: reduce) {
    .points label::before { transition: none; }
}
.topbar .link-button:focus-visible { outline-color: #fbbf24; }
