.tool-wrap { width: min(68rem, 100% - 2.5rem); margin-inline: auto; }
.tool-header { border-bottom: 1px solid var(--line); }
.tool-header .tool-wrap, .tool-footer { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; padding-block: 1rem; }
.tool-brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 750; }
.tool-brand img { border-radius: .25rem; }
.tool-nav { display: flex; flex-wrap: wrap; gap: 1.25rem; font-weight: 600; font-size: .92rem; }
.tool-nav a, .tool-footer a, .tool-note a { text-decoration: underline; text-underline-offset: .2em; }
.tool-main { padding-block: clamp(2rem, 6vw, 4rem); }
.tool-intro { max-width: 46rem; margin-bottom: 2rem; }
.tool-intro h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(2.65rem, 6vw, 4.5rem); line-height: .98; margin: .35rem 0 .7rem; }
.tool-intro > p:last-child { font-size: 1.08rem; color: var(--muted); }

.contrast-lab { display: grid; grid-template-columns: 1.1fr .9fr; gap: 1.4rem; margin-bottom: 1.5rem; }
.contrast-controls, .contrast-preview-col, .contrast-challenge { min-width: 0; border: 1px solid var(--line); border-radius: .5rem; background: #fffdf8; padding: clamp(1.1rem, 3vw, 2rem); }
.contrast-controls h2, .contrast-challenge h2, .tool-next h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(1.9rem, 3vw, 2.6rem); line-height: 1.05; margin-bottom: .75rem; }
.color-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.color-field label { display: block; font-weight: 700; font-size: .92rem; margin-bottom: .4rem; }
.color-inputs { display: flex; align-items: center; gap: .55rem; }
.color-inputs input[type="color"] { width: 3rem; height: 2.75rem; padding: .2rem; border: 1px solid var(--control); border-radius: .3rem; background: #fff; cursor: pointer; flex: none; }
.color-inputs input[type="text"] { width: 100%; min-width: 0; border: 1px solid var(--control); border-radius: .3rem; padding: .55rem .7rem; font-family: monospace; font-size: 1rem; text-transform: uppercase; background: #fff; color: var(--ink); }
.lab-actions { display: flex; flex-wrap: wrap; gap: .65rem; margin-bottom: .8rem; }
.ratio-box { margin: 1rem 0; padding: .9rem 1rem; border-radius: .4rem; background: #eef1e7; display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
.ratio-label { font-weight: 700; font-size: .92rem; color: var(--muted); }
.ratio-value { font-size: clamp(2rem, 4vw, 2.75rem); font-weight: 750; line-height: 1; color: var(--forest); }
.wcag-results { display: grid; gap: .5rem; margin: 0; }
.wcag-results > div { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding-block: .45rem; border-top: 1px solid var(--line); font-size: .92rem; }
.wcag-results dd { margin: 0; font-weight: 700; padding: .2rem .6rem; border-radius: .25rem; white-space: nowrap; }
.wcag-results dd[data-pass="true"] { background: #dcebd7; color: #173d24; }
.wcag-results dd[data-pass="false"] { background: #f6dada; color: #6e1c1f; }

.contrast-preview-col { display: flex; flex-direction: column; justify-content: space-between; gap: 1rem; }
.contrast-preview { padding: clamp(1.3rem, 3vw, 2rem); border-radius: .45rem; border: 1px solid var(--line); min-height: 15rem; display: flex; flex-direction: column; justify-content: center; gap: .85rem; }
.preview-large { font-size: 1.75rem; font-weight: 700; line-height: 1.15; }
.preview-normal { font-size: 1rem; line-height: 1.5; }
.preview-control { display: inline-block; width: fit-content; padding: .5rem 1rem; border: 2px solid currentColor; border-radius: .3rem; font-weight: 700; font-size: .92rem; }
.tool-note { font-size: .88rem; color: var(--muted); margin-top: .4rem; }

.contrast-challenge { margin-bottom: 1.5rem; }
.challenge-prompt { background: #eef1e7; border-left: .22rem solid #5a7859; padding: .9rem 1rem; margin: 1rem 0; font-weight: 600; }
.challenge-actions { margin-bottom: 1rem; }
.contrast-challenge fieldset { border: 1px solid var(--line); border-radius: .4rem; padding: 1rem; margin: 0 0 1rem; }
.contrast-challenge legend { font-weight: 700; padding: 0 .35rem; }
.challenge-option { display: flex; align-items: start; gap: .6rem; padding: .45rem 0; cursor: pointer; font-weight: 400; margin: 0; }
.challenge-option input { margin-top: .3rem; flex: none; }
.challenge-submit { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.challenge-feedback { min-height: 1.5em; margin-top: .85rem; font-weight: 650; color: #1f4830; }
.challenge-feedback[data-outcome="retry"] { color: #6e1c1f; }

.tool-next { display: flex; justify-content: space-between; align-items: center; gap: 1.25rem; padding: clamp(1.1rem, 3vw, 2rem); background: #e5ebdc; border-radius: .5rem; }
.tool-next p { margin: 0; color: var(--muted); }
.tool-next a { flex-shrink: 0; }
.tool-footer { border-top: 1px solid var(--line); margin-top: 2rem; }

@media (max-width: 52rem) {
  .contrast-lab, .color-row { grid-template-columns: 1fr; }
  .tool-next { flex-direction: column; align-items: start; }
}
