* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    margin: 0;
    background: #fffaf2;
    color: #302018;
    font: 1rem/1.65 "Nirmala UI", Mangal, "Noto Sans Devanagari", sans-serif;
}

.site-width { width: min(100% - 2rem, 48rem); margin-inline: auto; }
.site-header { background: #593226; color: #fff8ec; padding-block: .75rem; font-weight: 700; }
main { padding-block: 1.25rem 2.5rem; }
h1 { margin: .25rem 0 .75rem; font-size: clamp(1.5rem, 4vw, 2.5rem); line-height: 1.3; }
p { margin: 0 0 1rem; }
a, .context { color: #853514; }
.context { font-weight: 600; }
.back-link { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: .5rem; }
:focus-visible { outline: 3px solid #853514; outline-offset: 3px; }

.topic-layout { display: grid; gap: 1.5rem; align-items: center; }
.topic-select {
    display: block;
    width: 100%;
    max-width: 24rem;
    min-height: 46px;
    margin: .35rem 0 .75rem;
    padding: .4rem .7rem;
    border: 1px solid #a78b77;
    border-radius: 8px;
    background: #fffdf9;
    color: inherit;
    font: inherit;
}
.portrait { display: block; width: auto; max-width: 100%; max-height: 13rem; margin-inline: auto; border-radius: 12px; }
footer { margin-top: 1.5rem; }
.topic-notice { padding: .85rem 1rem; border-left: 4px solid #853514; background: #f8e6d6; }
.topic-notice p { margin-bottom: .25rem; }
.topic-notice a { display: inline-flex; align-items: center; min-height: 44px; }

.primary, .secondary {
    min-height: 44px;
    padding: .45rem .9rem;
    border: 1px solid #853514;
    border-radius: 8px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.primary { background: #853514; color: #fff; }
.secondary { background: #fffaf2; color: #853514; }

.questionnaire { width: 100%; table-layout: fixed; border-collapse: collapse; }
.questionnaire td { padding: 0; border-bottom: 1px solid #ebd9c7; }
.questionnaire tr:first-child td { border-top: 1px solid #ebd9c7; }
.question { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; background: #fffdf9; }
.question:has(input:checked) { background: #f8e6d6; }
.question input { width: 1.15rem; height: 1.15rem; margin: .95rem .75rem 0; accent-color: #853514; }
.question label { display: block; min-height: 48px; padding: .7rem .75rem .7rem 0; overflow-wrap: anywhere; cursor: pointer; white-space: pre-line; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1rem; }
.question-tools { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem 1rem; }
.question-tools p { margin-bottom: .45rem; }
.question-tools label { max-width: 100%; }
.statement-number { color: #853514; margin-inline-end: .4rem; }
#selectedStatements { padding-inline-start: 1.6rem; }
#selectedStatements li { padding: .5rem 0; border-bottom: 1px solid #ebd9c7; overflow-wrap: anywhere; }
.statement-edit { display: block; min-height: 44px; padding: 0; border: 0; background: transparent; color: #853514; font: inherit; text-decoration: underline; cursor: pointer; }
.result { padding: 1rem; border-left: 4px solid #853514; background: #f8e6d6; }

@media (min-width: 40rem) {
    .topic-layout { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 2rem; padding-block: 2rem; }
    .topic-layout h1 { font-size: clamp(1.75rem, 3.4vw, 2.25rem); }
    .portrait { width: 100%; max-height: none; }
}

@media (max-width: 30rem) {
    .topic-layout .primary { width: 100%; }
    .portrait { max-height: 9rem; }
}
