/* The ward comparison has its own visual layer; other rooms keep their styles. */
.ward-stage {
    --ward-ink: #332e25;
    --ward-soft: #6a604f;
    --ward-line: #d6c8af;
    --ward-green: #315e45;
    --ward-paper: #fffaf0;
    color: var(--ward-ink);
}

.ward-stage::after { background: linear-gradient(rgba(30,27,20,.17), rgba(30,27,20,.3)); }
.ward-stage .scene-heading { top: 18px; left: 24px; width: min(470px, calc(100vw - 280px)); padding: 11px 16px; }
.ward-stage .scene-heading h1 { font-size: clamp(21px, 2.1vw, 29px); }
.ward-stage .scene-heading .scene-eyebrow { font-size: 10px; }
.ward-stage .scene-actions { top: 18px; }
.ward-stage .back-button { min-height: 46px; padding: 6px 12px 6px 7px; font-size: 15px; }
.ward-stage .back-button .nav-arrow { width: 28px; height: 28px; flex-basis: 28px; }

.ward-workspace {
    position: absolute;
    z-index: 8;
    top: 158px;
    bottom: 20px;
    left: 50%;
    width: min(1140px, calc(100vw - 48px));
    transform: translateX(-50%);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #b6a88e #f2eadb;
    scrollbar-gutter: stable;
    border: 1px solid #cdbb9e;
    border-radius: 20px;
    color: var(--ward-ink);
    background: var(--ward-paper);
    box-shadow: 0 20px 60px rgba(22,20,15,.32), 0 0 0 5px rgba(61,48,30,.13);
    text-align: left;
}

.ward-header { padding: 24px 30px 19px; background: #f5ecdc; }
.ward-eyebrow { display: block; color: #78633f; font-size: 11px; line-height: 1.4; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.ward-header h2 { margin: 7px 0 0; font: 700 clamp(25px, 2.4vw, 34px)/1.13 Georgia, "Times New Roman", serif; letter-spacing: -.02em; }
.ward-steps { display: flex; align-items: center; gap: 25px; margin: 0; padding: 13px 30px; border-block: 1px solid #dfd1b9; list-style: none; background: #f5ecdc; }
.ward-steps li { display: flex; align-items: center; gap: 8px; color: #746a59; font-size: 14px; line-height: 1.25; }
.ward-steps li > span:first-child { display: grid; place-items: center; flex: 0 0 25px; width: 25px; height: 25px; border: 1px solid #bcb096; border-radius: 50%; font-size: 12px; font-weight: 800; }
.ward-steps li.is-current { color: #355039; font-weight: 800; }
.ward-steps li.is-current > span:first-child { color: #fff; border-color: #3e5a43; background: #3e5a43; }
.ward-steps li.is-done { color: var(--ward-green); }
.ward-steps li.is-done > span:first-child { border-color: #9aab89; background: #e3eada; }
.ward-paper { padding: 26px 30px 30px; background: linear-gradient(110deg, #fffaf0, #faf3e5); }
.ward-lead { max-width: 850px; margin: 0 0 22px; color: var(--ward-soft); font-size: 17px; line-height: 1.55; }

.ward-feature-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.ward-feature { display: flex; align-items: center; gap: 13px; min-height: 66px; padding: 13px 17px; border: 1px solid #c9b999; border-radius: 12px; color: #4a412f; background: #fffdf7; text-align: left; font-size: 16px; font-weight: 800; cursor: pointer; transition: background .16s ease, border-color .16s ease; }
.ward-feature:hover { border-color: #819372; background: #f0f2e6; }
.ward-feature[aria-pressed="true"] { border-color: #66825d; color: #2f4e34; background: #e6eddd; box-shadow: inset 0 0 0 1px #66825d; }
.ward-feature-number { display: grid; place-items: center; flex: 0 0 31px; width: 31px; height: 31px; border: 1px solid #c6b698; border-radius: 9px; color: #82683e; background: #f4ecd9; font-size: 13px; }
.ward-feature[aria-pressed="true"] .ward-feature-number { color: #fff; border-color: #55744f; background: #55744f; }
.ward-feature small { display: block; margin-top: 4px; color: #686450; font-size: 12px; line-height: 1.3; font-weight: 500; }

.ward-specimens { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.ward-specimen { min-width: 0; overflow: hidden; border: 1px solid #d1c0a2; border-radius: 15px; background: #f5eddf; }
.ward-specimen.is-after { border-color: #b6c2a6; background: #edf1e6; }
.ward-specimen-heading { padding: 17px 20px 0; }
.ward-specimen-era { display: block; color: #827154; font-size: 11px; font-weight: 800; line-height: 1.3; letter-spacing: .09em; text-transform: uppercase; }
.ward-specimen.is-after .ward-specimen-era { color: #536b45; }
.ward-specimen-heading h3 { margin: 6px 0 0; color: #40382c; font: 700 23px/1.2 Georgia, "Times New Roman", serif; }
.ward-specimen.is-after .ward-specimen-heading h3 { color: #344c35; }
.ward-object { display: grid; place-items: center; padding: 3px 12px 0; }
.ward-shackles { display: block; width: 100%; height: clamp(150px, 18vw, 225px); overflow: visible; }
.ward-shadow { fill: #4a3a27; opacity: .1; }
.ward-chain, .ward-cuff { fill: none; stroke: #6c6c61; stroke-linecap: round; stroke-linejoin: round; transition: stroke .18s ease, filter .18s ease; }
.ward-cuff-inner { fill: none; stroke: #8b897b; transition: stroke .18s ease, filter .18s ease; }
.ward-lining { fill: none; stroke: #9e7048; stroke-linecap: round; transition: stroke .18s ease, filter .18s ease; }
.ward-rivet { fill: #d6cfbd; stroke: #55584f; stroke-width: 2px; }
.ward-highlight-path { fill: none; stroke: #b18b43; stroke-width: 2px; stroke-dasharray: 5 5; opacity: 0; }
.ward-shackles.focus-weight .ward-chain,
.ward-shackles.focus-weight .ward-cuff { stroke: #77613c; filter: drop-shadow(0 0 4px rgba(185,143,60,.33)); }
.ward-shackles.focus-lining .ward-cuff-inner { stroke: #a47742; filter: drop-shadow(0 0 4px rgba(185,143,60,.28)); }
.ward-shackles.focus-lining .ward-lining { stroke: #966030; filter: drop-shadow(0 0 4px rgba(185,143,60,.3)); }
.ward-shackles.focus-weight .ward-highlight-path,
.ward-shackles.focus-lining .ward-highlight-path { opacity: 1; }
.ward-object-caption { min-height: 115px; padding: 16px 20px 19px; border-top: 1px solid rgba(175,155,120,.3); background: rgba(255,253,246,.65); }
.ward-object-caption h4 { margin: 0 0 6px; color: #4c402d; font-size: 16px; line-height: 1.3; }
.ward-object-caption p { margin: 0; color: #685b46; font-size: 15px; line-height: 1.5; }
.ward-diagram-note { margin: 10px 0 21px; color: #7a6d58; font-size: 12px; line-height: 1.45; }

.ward-observation { padding: 21px 23px; border: 1px solid #bdc5ab; border-left: 4px solid #67825a; border-radius: 12px; background: #eff2e6; }
.ward-observation h3 { margin: 7px 0 9px; color: #344c35; font: 700 23px/1.2 Georgia, "Times New Roman", serif; }
.ward-observation p { margin: 0; color: #536049; font-size: 16px; line-height: 1.55; }
.ward-observation.is-placeholder { border-color: #d2c4a7; border-left-color: #b8a57d; background: #f6efdf; }
.ward-observation.is-placeholder h3 { color: #625233; }
.ward-observation.is-placeholder p { color: #706047; }
.ward-cause-chain { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 15px; }
.ward-cause-chain > span:not(.ward-chain-arrow) { padding: 7px 11px; border: 1px solid #c0c9ae; border-radius: 8px; color: #4a5f3d; background: #fcfcf4; font-size: 13px; line-height: 1.4; }
.ward-chain-arrow { color: #748b5a; font-size: 18px; }
.ward-compare-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 23px; padding-top: 20px; border-top: 1px solid var(--ward-line); }
.ward-progress { max-width: 530px; margin: 0; color: #665b45; font-size: 14px; line-height: 1.45; }

.ward-stage .primary-button { min-height: 50px; border-radius: 12px; color: #fff; background: var(--ward-green); box-shadow: 0 5px 12px rgba(37,76,50,.16); font-size: 16px; }
.ward-stage .primary-button:hover:not(:disabled) { background: #244d35; }
.ward-stage .primary-button:disabled { color: #606a54; background: #d9ddcf; opacity: 1; box-shadow: none; cursor: default; }
.ward-stage .secondary-button { min-height: 48px; padding: 11px 17px; border-color: #c4b18e; border-radius: 12px; color: #4d412e; background: #fffaf0; font-size: 15px; }

.ward-task { max-width: 990px; margin: 0 auto; }
.ward-problems { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 20px; }
.ward-problem { min-width: 0; padding: 22px; border: 1px solid #cfbd9d; border-radius: 14px; background: #f8f0e1; }
.ward-problem h3 { margin: 0 0 10px; color: #473e2c; font: 700 24px/1.2 Georgia, "Times New Roman", serif; }
.ward-problem-hint { margin: 0 0 19px; color: #6b5e49; font-size: 15px; line-height: 1.5; }
.ward-measures { display: grid; gap: 10px; }
.ward-measure { display: flex; align-items: flex-start; gap: 11px; width: 100%; min-height: 54px; padding: 13px 14px; border: 1px solid #cbbc9e; border-radius: 10px; color: #40382b; background: #fffdf7; text-align: left; font-size: 15px; line-height: 1.45; cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.ward-measure:hover:not(:disabled) { border-color: #778d64; background: #f0f3e7; }
.ward-choice-mark { display: block; flex: 0 0 19px; width: 19px; height: 19px; margin-top: 1px; border: 1px solid #b7a57f; border-radius: 50%; background: #faf5e9; font-size: 0; line-height: 0; }
.ward-measure[aria-pressed="true"] { border-color: #65815a; color: #2c4a32; background: #e9efdf; box-shadow: inset 0 0 0 1px #65815a; }
.ward-measure[aria-pressed="true"] .ward-choice-mark { border: 5px solid #55754e; background: #fffdf7; }
.ward-measure:disabled { cursor: default; }
.ward-problem.is-correct { border-color: #91a67c; background: #eef2e4; }
.ward-problem.is-incorrect { border-color: #c3a17a; background: #f6ead7; }
.ward-problem.is-incorrect .ward-measure[aria-pressed="true"] { border-color: #ac8658; color: #634627; background: #f4e3c9; box-shadow: inset 0 0 0 1px #ac8658; }
.ward-problem.is-incorrect .ward-measure[aria-pressed="true"] .ward-choice-mark { border-color: #ac8658; }
.ward-problem-feedback { margin: 17px 0 0; padding-top: 13px; border-top: 1px solid #cbb993; color: #6b4f30; font-size: 14px; line-height: 1.5; }
.ward-problem.is-correct .ward-problem-feedback { border-color: #bdc9a9; color: #4b6340; }
.ward-task-footer { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 22px; }
.ward-feedback { margin-top: 23px; padding: 22px 24px; border: 1px solid #b5c39f; border-radius: 13px; background: #eaf0df; }
.ward-feedback.is-incorrect { border-color: #d1b28b; background: #f7eddd; }
.ward-feedback h3 { margin: 0 0 9px; color: #3f5334; font: 700 24px/1.2 Georgia, "Times New Roman", serif; }
.ward-feedback.is-incorrect h3 { color: #715431; }
.ward-feedback p { margin: 0; color: #5c5a42; font-size: 16px; line-height: 1.55; }
.ward-feedback button { margin-top: 17px; }
.ward-text-button { display: inline-block; min-height: 44px; margin-top: 13px; padding: 9px 0; border: 0; color: #4b6344; background: transparent; text-decoration: underline; text-underline-offset: 4px; font-size: 14px; font-weight: 700; cursor: pointer; }
.ward-text-button:hover { color: #243f25; }

.ward-result { max-width: 820px; margin: 0 auto; text-align: center; }
.ward-stamp { display: inline-block; padding: 8px 17px; border: 2px solid #5b7850; border-radius: 5px; color: #436b41; font-size: 13px; font-weight: 800; line-height: 1.4; letter-spacing: .11em; text-transform: uppercase; transform: rotate(-2deg); }
.ward-result-title { margin: 21px 0 12px; font: 700 clamp(27px, 2.5vw, 35px)/1.15 Georgia, "Times New Roman", serif; }
.ward-result-copy { max-width: 640px; margin: 0 auto 24px; color: #655943; font-size: 17px; line-height: 1.55; }
.ward-finding { padding: 23px 27px; border: 1px solid #bdc6a8; border-left: 5px solid #67825a; border-radius: 13px; background: linear-gradient(110deg, #e8eedf, #f4f3e5); text-align: left; }
.ward-finding .ward-eyebrow { color: #526c43; }
.ward-finding h3 { margin: 7px 0 8px; color: #304b32; font: 700 27px/1.2 Georgia, "Times New Roman", serif; }
.ward-finding p { margin: 0; color: #4e5c43; font-size: 16px; line-height: 1.5; }
.ward-history { margin-top: 21px; padding: 20px 24px; border: 1px solid #d9c7a7; border-radius: 12px; background: #f7efde; text-align: left; }
.ward-history h3 { margin: 0 0 8px; color: #655232; font-size: 16px; line-height: 1.3; }
.ward-history p { margin: 0; color: #62543f; font-size: 15px; line-height: 1.55; }
.ward-source { display: inline-block; margin-top: 10px; padding: 5px 0; color: #3b6344; text-decoration: underline; text-underline-offset: 3px; font-size: 13px; line-height: 1.5; }
.ward-result-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px; margin-top: 24px; }
.ward-result-actions .ward-text-button { margin: 0; }
.ward-persistence-note { margin: 20px 0 0; padding-top: 14px; border-top: 1px dashed #cebea0; color: #776b55; font-size: 12px; line-height: 1.5; }
.ward-keepsake { margin-top: 12px; padding: 12px 14px; border-left: 3px solid #7f8b63; border-radius: 0 8px 8px 0; color: #4b5839; background: #eef0e2; font-size: 14px; line-height: 1.45; }
.ward-keepsake strong { display: block; margin-bottom: 3px; }
.ward-sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

.ward-stage [hidden] { display: none; }
.ward-stage button:focus-visible,
.ward-source:focus-visible { outline: 3px solid #a27629; outline-offset: 4px; }
.ward-stage [tabindex="-1"]:focus { outline: 2px solid #9b814c; outline-offset: 5px; border-radius: 4px; }

@media (max-width: 1024px) {
    .ward-stage .scene-heading { top: 12px; left: 12px; width: min(470px, calc(100vw - 240px)); padding: 10px 12px; }
    .ward-stage .scene-heading h1 { font-size: 21px; }
    .ward-stage .scene-actions { top: 12px; right: 12px; }
    .ward-stage .back-button { left: 12px; }
    .ward-workspace { top: 137px; bottom: 14px; width: calc(100vw - 28px); }
    .ward-header { padding: 22px 24px 18px; }
    .ward-steps { padding-inline: 24px; }
    .ward-paper { padding: 24px; }
    .ward-specimens, .ward-problems { gap: 16px; }
    .ward-specimen-heading { padding-inline: 17px; }
    .ward-object-caption { padding-inline: 17px; }
    .ward-problem { padding: 19px; }
}

@media (max-width: 700px) {
    .ward-stage .scene-heading { width: calc(100vw - 122px); padding: 9px 11px; }
    .ward-stage .scene-heading h1 { font-size: 17px; }
    .ward-stage .scene-heading .scene-eyebrow { display: none; }
    .ward-stage .back-button { min-height: 44px; font-size: 14px; }
    .ward-workspace { top: 118px; bottom: 10px; width: calc(100vw - 20px); border-radius: 15px; }
    .ward-header { padding: 18px 17px 16px; }
    .ward-header h2 { font-size: 26px; }
    .ward-header .ward-eyebrow { font-size: 10px; letter-spacing: .06em; }
    .ward-steps { gap: 12px; justify-content: space-between; padding: 12px 17px; }
    .ward-steps li { gap: 6px; font-size: 12px; }
    .ward-steps li > span:first-child { flex-basis: 22px; width: 22px; height: 22px; font-size: 11px; }
    .ward-paper { padding: 20px 17px 23px; }
    .ward-lead { font-size: 16px; margin-bottom: 18px; }
    .ward-feature { gap: 9px; padding: 12px; font-size: 14px; }
    .ward-feature-number { flex-basis: 27px; width: 27px; height: 27px; }
    .ward-feature small { font-size: 11px; }
    .ward-specimen-heading h3 { font-size: 21px; }
    .ward-object-caption { min-height: 123px; padding: 14px; }
    .ward-object-caption h4 { font-size: 15px; }
    .ward-object-caption p { font-size: 14px; }
    .ward-observation { padding: 18px; }
    .ward-observation h3 { font-size: 22px; }
    .ward-observation p { font-size: 15px; }
    .ward-compare-footer { flex-direction: column; align-items: stretch; gap: 13px; margin-top: 20px; }
    .ward-compare-footer .primary-button { width: 100%; }
    .ward-problems { grid-template-columns: 1fr; }
    .ward-task-footer { flex-direction: column; align-items: stretch; gap: 13px; }
    .ward-problem h3 { font-size: 23px; }
    .ward-feedback { padding: 19px; }
    .ward-feedback h3 { font-size: 22px; }
    .ward-feedback p { font-size: 15px; }
    .ward-task-footer .primary-button,
    .ward-feedback button { width: 100%; }
    .ward-result-copy { font-size: 16px; }
    .ward-finding { padding: 20px 18px; }
    .ward-finding h3 { font-size: 25px; }
    .ward-history { padding: 18px; }
    .ward-result-actions { flex-direction: column; align-items: stretch; }
    .ward-result-actions .primary-button { width: 100%; }
}

@media (max-width: 600px) {
    .ward-specimens { grid-template-columns: 1fr; gap: 14px; }
    .ward-specimen-heading { padding: 15px 17px 0; }
    .ward-shackles { height: clamp(155px, 38vw, 185px); }
    .ward-object-caption { min-height: 0; padding: 14px 17px 16px; }
    .ward-feature-controls { gap: 9px; }
    .ward-feature { align-items: flex-start; }
    .ward-feature-number { flex-basis: 24px; width: 24px; height: 24px; font-size: 11px; }
    .ward-cause-chain { gap: 6px; }
    .ward-cause-chain > span:not(.ward-chain-arrow) { padding: 6px 9px; font-size: 12px; }
}

@media (max-width: 390px) {
    .ward-header h2 { font-size: 24px; }
    .ward-steps { gap: 6px; padding-inline: 14px; }
    .ward-steps li { gap: 5px; font-size: 11px; }
    .ward-feature { gap: 7px; padding: 11px 9px; font-size: 13px; }
    .ward-feature small { font-size: 10px; }
    .ward-problem { padding: 17px; }
    .ward-measure { padding: 12px; font-size: 14px; }
}

@media (max-height: 600px) and (min-width: 701px) {
    .ward-stage .scene-heading { top: 10px; left: 12px; padding: 8px 12px; }
    .ward-stage .scene-heading h1 { font-size: 20px; }
    .ward-stage .scene-heading .scene-eyebrow { display: none; }
    .ward-stage .scene-actions { top: 10px; right: 12px; }
    .ward-stage .back-button { left: 12px; min-height: 42px; }
    .ward-workspace { top: 112px; bottom: 10px; }
    .ward-header { padding-block: 15px; }
    .ward-header h2 { font-size: 26px; }
    .ward-shackles { height: 165px; }
}

@media (prefers-reduced-motion: reduce) {
    .ward-feature, .ward-measure, .ward-chain, .ward-cuff, .ward-cuff-inner, .ward-lining { transition: none; }
}

/* Give the comparison controls and their explanations a full phone-width row. */
@media (max-width: 800px), (max-width: 1100px) and (max-height: 500px) {
    .ward-workspace { overflow-wrap: anywhere; scrollbar-gutter: auto; }
    .ward-header { padding: 18px 14px 16px; }
    .ward-eyebrow, .ward-header .ward-eyebrow { font-size: 14px; letter-spacing: .03em; }
    .ward-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 12px 14px; align-items: start; }
    .ward-steps li { min-width: 0; flex-direction: column; align-items: flex-start; gap: 6px; font-size: 14px; line-height: 1.35; }
    .ward-steps li > span:first-child { flex-basis: 24px; width: 24px; height: 24px; font-size: 13px; }
    .ward-paper { padding: 20px 14px 24px; }
    .ward-feature-controls, .ward-problems { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .ward-feature { min-width: 0; gap: 12px; padding: 13px 14px; font-size: 16px; line-height: 1.4; }
    .ward-feature > span:last-child, .ward-measure > span:last-child { min-width: 0; }
    .ward-feature-number { flex-basis: 28px; width: 28px; height: 28px; font-size: 14px; }
    .ward-feature small, .ward-specimen-era, .ward-diagram-note,
    .ward-persistence-note, .ward-source { font-size: 14px; line-height: 1.5; }
    .ward-object-caption p, .ward-observation p, .ward-problem-hint,
    .ward-measure, .ward-problem-feedback, .ward-feedback p,
    .ward-history p { font-size: 16px; line-height: 1.55; }
    .ward-object-caption h4 { font-size: 16px; }
    .ward-problem { padding: 17px 14px; }
    .ward-measure { min-width: 0; padding: 13px 12px; }
    .ward-cause-chain { flex-direction: column; align-items: stretch; }
    .ward-cause-chain > span:not(.ward-chain-arrow) { min-width: 0; max-width: 100%; font-size: 14px; }
    .ward-chain-arrow { align-self: center; transform: rotate(90deg); }
    .ward-stamp { max-width: 100%; font-size: 14px; letter-spacing: .05em; transform: none; }
    .ward-source { min-height: 44px; padding-block: 12px; }
    .ward-compare-footer, .ward-task-footer, .ward-result-actions { flex-direction: column; align-items: stretch; }
    .ward-workspace button { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
    .ward-workspace .primary-button, .ward-workspace .secondary-button { width: 100%; }
}
