/* Questionnaire runner styles; used by the participant app and the dashboard emulator.
   Expects the host page to define: --bg --surface --surface-2 --text --muted --border --accent --accent-text --danger --ok */

[hidden] { display: none !important; }

.q-page { display: flex; flex-direction: column; gap: 18px; padding: 18px 16px 24px; max-width: 640px; margin: 0 auto; }
.q-progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.q-progress > div { height: 100%; background: var(--accent); transition: width .3s; }
.q-deadline { font-variant-numeric: tabular-nums; color: var(--muted); text-align: right; min-height: 1em; font-size: .9rem; }
.q-deadline:empty { display: none; }
.q-item { display: flex; flex-direction: column; gap: 12px; }
.q-text { font-size: 1.1rem; line-height: 1.5; overflow-wrap: anywhere; }
.q-text img, .q-media img, .q-media video { max-width: 100%; border-radius: 10px; }
.q-text h1, .q-text h2, .q-text h3 { margin: 0 0 .4em; line-height: 1.25; }
.q-text p { margin: 0 0 .6em; }
.q-text details { background: var(--surface-2); border-radius: 8px; padding: 8px 12px; }
.q-text a { color: var(--accent); }
.q-media { display: flex; flex-direction: column; gap: 10px; }
.q-media audio { width: 100%; }
.q-error { color: var(--danger); font-size: .92rem; min-height: 0; }
.q-error:empty { display: none; }
.q-nav { display: flex; gap: 10px; align-items: center; margin-top: 6px; position: sticky; bottom: 0; padding: 10px 0 4px; background: linear-gradient(transparent, var(--bg) 30%); }
.q-nav .spacer { flex: 1; }
.q-done { display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; padding: 48px 20px; max-width: 520px; margin: 0 auto; }
.q-done-icon { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; font-size: 2.2rem; background: var(--accent); color: var(--accent-text); }

.q-page input[type=text], .q-page input[type=number], .q-page input[type=time], .q-page input[type=date], .q-page input[type=search], .q-page textarea, .q-page select {
  width: 100%; font: inherit; font-size: 1.05rem; padding: 12px 14px; border-radius: 10px; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text); box-sizing: border-box;
}
.q-page input:focus-visible, .q-page textarea:focus-visible, .q-page select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.choices { display: flex; flex-direction: column; gap: 8px; }
.choices.row { flex-direction: row; }
.choices.row .choice { flex: 1; text-align: center; }
.choice {
  font: inherit; font-size: 1.02rem; text-align: left; padding: 13px 16px; border-radius: 12px; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; transition: background .12s, border-color .12s;
}
.choice:hover { border-color: var(--accent); }
.choice.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.other-input { margin-top: 8px; }

.choices.likert { flex-direction: row; gap: 4px; }
.choices.likert .choice { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 2px; border: none; background: none; text-align: center; font-size: .85rem; }
.choices.likert .choice .dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border); background: var(--surface); }
.choices.likert .choice.on { background: none; color: var(--text); }
.choices.likert .choice.on .dot { background: var(--accent); border-color: var(--accent); }
.choices.likert .lk-label { overflow-wrap: anywhere; }

.emotion-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.emotion-grid .choice { text-align: center; }

.slider { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.slider input[type=range] { width: 100%; accent-color: var(--accent); height: 32px; }
.slider.untouched input[type=range]::-webkit-slider-thumb { opacity: 0; }
.slider.untouched input[type=range]::-moz-range-thumb { opacity: 0; }
.slider.vas input[type=range]::-webkit-slider-thumb { opacity: 1; }
.slider-labels { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: .9rem; }
.slider-labels span:last-child { text-align: right; }
.slider-value { align-self: center; font-size: 1.6rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.slider.vas .slider-value { display: none; }
.smiley { width: 120px; height: 120px; align-self: center; }
.smiley .face { fill: #e0e0e0; transition: fill .15s; }
.smiley .eye { fill: #333; }
.smiley .mouth { fill: none; stroke: #333; stroke-width: 5; stroke-linecap: round; }
.slider.untouched .smiley .face { fill: var(--surface-2); }

.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.img-choice { border: 3px solid transparent; border-radius: 12px; padding: 0; overflow: hidden; background: var(--surface); cursor: pointer; display: flex; flex-direction: column; color: var(--text); font: inherit; }
.img-choice img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.img-choice span { padding: 6px; font-size: .9rem; }
.img-choice.on { border-color: var(--accent); }

.order-list { list-style: none; counter-reset: ord; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.order-list li { counter-increment: ord; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 10px; background: var(--surface); }
.order-list li::before { content: counter(ord); font-weight: 700; color: var(--accent); min-width: 1.4em; }
.order-text { flex: 1; }
.icon-btn { border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 8px; width: 36px; height: 36px; cursor: pointer; font-size: .85rem; }
.icon-btn:disabled { opacity: .35; cursor: default; }

.body-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.body-map { width: 220px; max-width: 70vw; }
.body-map .part { fill: var(--surface-2); stroke: var(--border); stroke-width: 1.5; cursor: pointer; transition: fill .12s; }
.body-map .part:hover { fill: color-mix(in srgb, var(--accent) 30%, var(--surface-2)); }
.body-map .part.on { fill: var(--accent); }
.body-map .part:focus-visible { outline: none; stroke: var(--accent); stroke-width: 3; }
.body-chosen { text-align: center; }

.capture { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.capture audio { width: 100%; }
.photo-preview { max-width: 100%; max-height: 50vh; border-radius: 10px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.cog { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 10px 0; }
.cog-stage { font-size: 3.4rem; font-weight: 700; min-height: 90px; display: grid; place-items: center; font-variant-numeric: tabular-nums; text-align: center; }
.cog-controls { display: flex; gap: 10px; }
.cog-btn { min-width: 160px; min-height: 64px; font-size: 1.2rem; justify-content: center; }
.cog-btn.pressed { filter: brightness(.8); }
.rt-target { width: 150px; height: 150px; border-radius: 50%; border: none; background: var(--surface-2); cursor: pointer; transition: background .05s; }
.rt-target.wait { background: #c0392b; }
.rt-target.go { background: #27ae60; }

.consent { display: flex; flex-direction: column; gap: 16px; }
.consent .choices { gap: 10px; }
.q-consent ~ .q-nav .q-next { display: none; }
