/* ---- Colours screen ---- */
.colours-screen h1 { margin-bottom: 10px; }
.colours-top { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.colours-right { min-width: 0; }
.colours-lower { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.colours-screen .card h2 { margin-bottom: 10px; }

/* wheel and lightness */
.wheel { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-bottom: 4px; }
.wheel-wrap { position: relative; width: min(100%, 280px); aspect-ratio: 1; }
.wheel-canvas {
  width: 100%; height: 100%; display: block; border-radius: 50%; touch-action: none; cursor: crosshair;
  box-shadow: 0 0 0 1px var(--border), 0 4px 14px rgba(0, 0, 0, 0.12);
}
.wheel-overlay { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.wheel-line-shadow { stroke: rgba(0, 0, 0, 0.5); stroke-width: 1.6; stroke-linecap: round; stroke-dasharray: 0.01 2.6; }
.wheel-line { stroke: #fff; stroke-width: 1; stroke-linecap: round; stroke-dasharray: 0.01 2.6; }
.wheel-dot-halo, .wheel-base-halo { fill: rgba(0, 0, 0, 0.32); }
.wheel-dot-fill { stroke: #fff; stroke-width: 1; }
.wheel-base { stroke: #fff; stroke-width: 1.5; }
.wheel-house-halo { fill: rgba(0, 0, 0, 0.55); }
.wheel-house-fill { stroke: #fff; stroke-width: 0.9; }
.wheel-house-num { font: 700 5.2px/1 system-ui, sans-serif; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.wheel-legend { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 2px 6px; margin: 2px 0 6px; font-size: 0.8rem; }
.lg-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--muted); }
.lg-sq { display: inline-block; width: 10px; height: 10px; margin-left: 6px; background: var(--muted); outline: 2px solid var(--surface); box-shadow: 0 0 0 3px var(--muted); }
.lg-sq[hidden], .lg-house[hidden] { display: none; }

.lightness { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 0 10px; width: 100%; } /* D214: "Lightness" and the % above, so the slider takes the card's full width */
.lightness > label { grid-column: 1; grid-row: 1; line-height: 1.2; }
.lightness > output { grid-column: 2; grid-row: 1; text-align: right; line-height: 1.2; }
.lightness > input { grid-column: 1 / -1; grid-row: 2; margin: -10px 0 0; } /* the 44 px touch area overlaps the label line, so the track sits close under the text */
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; margin: 0; background: transparent; cursor: pointer; }
.range::-webkit-slider-runnable-track { box-sizing: border-box; height: 14px; border-radius: 7px; border: 1px solid var(--border); background: linear-gradient(90deg, #000, #fff); }
.range::-webkit-slider-thumb {
  -webkit-appearance: none; box-sizing: border-box; width: 28px; height: 28px; margin-top: -8px; border-radius: 50%;
  background: #fff; border: 4px solid var(--accent); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.range::-moz-range-track { box-sizing: border-box; height: 14px; border-radius: 7px; border: 1px solid var(--border); background: linear-gradient(90deg, #000, #fff); }
.range::-moz-range-thumb { box-sizing: border-box; width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 4px solid var(--accent); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); }

.inputs { display: flex; gap: 16px; align-items: end; flex-wrap: wrap; margin-bottom: 0; }
.pick .inputs { justify-content: center; } /* D128 */
.hex-in { width: 9em; font-family: ui-monospace, Consolas, monospace; text-transform: uppercase; }
.native-in { display: block; width: 64px; height: 44px; padding: 2px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); cursor: pointer; }

/* description */
.desc-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 8px; }
.desc-head .desc-titles { flex: 1 1 0; min-width: 8.5em; } /* D137: Paint matches sits top right, wraps below on narrow phones */
.desc-suggest { flex: none; margin-left: auto; align-self: flex-start; }
@media (max-width: 699px) { .desc-suggest { align-self: center; padding: 0 10px; min-height: 44px; } .desc-head { gap: 8px; } }
.desc-chip { width: 44px; height: 44px; flex: none; border-radius: 12px; border: 1px solid rgba(0, 0, 0, 0.18); }
.desc-titles { min-width: 0; }
.describe .desc-titles h2 { margin: 0; font-size: 0.95rem; font-weight: 600; color: var(--muted); }
.showing-name { color: var(--text); font-weight: 700; }
.hexline { margin: 0; font-size: 1.15rem; line-height: 1.3; }
.summary { font-weight: 600; margin-bottom: 4px; }
.desc-extra p { margin: 0 0 4px; font-size: 0.92rem; }
/* D137, D219: one guidance paragraph is always reserved; it stacks every paragraph that can occur invisibly so it is as tall as the longest */
.guidance-box { margin: 0 0 6px; }
.guidance-slot { display: grid; margin: 0 0 2px; font-size: 0.92rem; }
.guidance-slot > * { grid-area: 1 / 1; margin: 0; }
.guidance-sizer { visibility: hidden; pointer-events: none; }
.guidance-slot.is-empty .guidance { visibility: hidden; }
.describe .field-label { margin-top: 2px; margin-bottom: 2px; }
.near-paint { margin: 0 0 8px; }
.summary .info-btn.inline, .undertone .info-btn.inline { vertical-align: middle; }
.summary .colour-tag { vertical-align: middle; font-weight: 600; } /* D240: the tag chips stand where the strength word was */
.block-head { padding-right: 36px; } /* D201: room for the Use as base corner button on the shown suggestion, on every block so wrapping never changes */
.block-use-base {
  position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: none; color: inherit; cursor: pointer; padding: 0;
}
/* D203: a smaller visible circle (28 px laptop, 30 px phone) inside the full tap area */
.use-dot { width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid currentColor; border-radius: 50%; background: rgba(0, 0, 0, 0.16); }
.block[data-ink="dark"] .use-dot { background: rgba(255, 255, 255, 0.38); }
.block-use-base:focus-visible { outline: 3px solid currentColor; outline-offset: 2px; }
.block-use-base[hidden] { display: none; }
@media (max-width: 699px) {
  .block-use-base { width: 44px; height: 44px; top: 0; right: 0; } .use-dot { width: 30px; height: 30px; } .block-head { padding-right: 40px; }
  /* D203: the Showing tag has its own line in every block (kept when hidden), so all hex lines align and selecting never changes heights */
  .block-head { flex-direction: column; align-items: flex-start; gap: 2px; }
}
.formats { display: grid; grid-template-columns: 6.2em minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; margin: 0 0 8px; }
.formats dt { font-weight: 600; color: var(--muted); font-size: 0.9rem; }
.formats dd { margin: 0; }
.fmt-val { font-family: ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }
.copy-btn { min-width: 76px; }

.scheme-card .controls { margin-bottom: 4px; }
/* D195: Colour suggestions card: title with a Settings button, then Colour scheme, Lightness and Strength in one row (stacked on a phone) */
.scheme-card .card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.scheme-card .card-head h2 { margin: 0; }
.suggest-settings-btn { display: inline-flex; align-items: center; gap: 6px; flex: none; }
@media (min-width: 700px) { .suggest-settings-btn { min-height: 34px; padding-block: 4px; } }
.scheme-card .controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5em, 1fr)); gap: 8px 16px; align-items: end; }
.scheme-card .ctl { min-width: 0; }
.scheme-card .controls .select { width: 100%; min-width: 0; }
.scheme-card .label-row { display: flex; align-items: center; gap: 4px; }
.scheme-card .label-row .field-label { margin: 0; }
.scheme-card .suggest-summary { margin: 6px 0 0; }
.scheme-card .sel-row { display: flex; gap: 6px; align-items: stretch; }
.scheme-card .sel-row .select { flex: 1; min-width: 0; }
.swap-btn { flex: none; min-width: 44px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; }
/* D248: the half-light, half-dark circle; the dark half is filled with currentColor (so forced colours keep both halves apart) */
.icon-lightdark .ld-l, .icon-lightdark .ld-r { fill: none; }
.icon-lightdark[data-dark="right"] .ld-r, .icon-lightdark[data-dark="left"] .ld-l { fill: currentColor; }
@media (forced-colors: active) { .swap-btn:disabled { opacity: 1; color: GrayText; border-color: GrayText; } }
.swap-btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
@media (min-width: 700px) { .swap-btn { min-height: 34px; min-width: 34px; padding: 0; } }
.scheme-card .lightness-note { margin: 4px 0 0; }
.scheme-card select:disabled { opacity: 0.55; cursor: not-allowed; }
@media (max-width: 699px) { .scheme-card .controls { grid-template-columns: minmax(0, 1fr); } }
.scheme-card p { margin: 0; }

/* scheme strip */
.strip-card { padding: 0; overflow: hidden; }
.strip-blocks {
  list-style: none; margin: 0; padding: 0; display: grid;
  grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr));
}
.block { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 112px; }
/* D157: no outline on the selected block; a band in the BASE colour runs along the top of the whole strip, joined to the base block (the card clips its top corners). */
.strip-band { grid-column: 1 / -1; height: 14px; list-style: none; }
.block-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 8px; }
.block-showing { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.03em; padding: 0 6px; border-radius: 6px; background: rgba(0, 0, 0, 0.22); }
.block[data-ink="dark"] .block-showing { background: rgba(255, 255, 255, 0.45); }
.block-showing.is-off { visibility: hidden; } /* D201: keeps its space */
.block-main {
  flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 12px 12px 6px;
  background: transparent; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; min-width: 0;
}
.block-main:focus-visible { outline: 3px solid currentColor; outline-offset: -6px; }
.block-tag { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.85; font-weight: 600; }
.block-hex { font: 700 1.1rem/1.3 ui-monospace, Consolas, monospace; }
/* D216: a real paint: its name is the title, brand and hex a smaller second line */
.block-title { display: none; font-weight: 700; font-size: 1.05rem; line-height: 1.35; }
.block-title-text { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-bottom: 1px; }
/* D217, D223: one line for the name, tall enough for descenders, long names end in "…" (full name on hover and in the description panel);
   the line is kept while paints load, so a new paint never changes the block height */
.block.is-paint .block-title, .strip-blocks.reserve-paint .block:not(.is-base) .block-title { display: block; min-height: 1.35em; }
.block.is-stale .block-title, .block.is-stale .block-sub { opacity: 0.55; }
.block-brand:empty { display: none; }
.block-brand::after { content: " · "; }
.block.is-paint .block-hex { font: 600 0.82rem/1.3 ui-monospace, Consolas, monospace; }
.block.is-paint .block-sub { font-size: 0.82rem; }
.block-name { font-size: 0.85rem; line-height: 1.3; overflow-wrap: anywhere; }
.add-house {
  margin: 0 10px 10px; min-height: 44px; padding: 0 8px; font: inherit; font-size: 0.88rem; color: inherit; cursor: pointer;
  background: rgba(0, 0, 0, 0.16); border: 1.5px solid currentColor; border-radius: 10px; max-width: calc(100% - 20px);
}
.block[data-ink="dark"] .add-house { background: rgba(255, 255, 255, 0.38); }
.add-house:focus-visible { outline: 3px solid currentColor; outline-offset: 2px; }


/* D194: the nearest real paint under a suggestion. The text keeps a fixed height (2 lines, 3 on a phone, longer names are cut with an
   ellipsis; the full name is in the accessible name and Paint matches), so the strip never changes height as the wheel moves. */
.strip-blocks.has-paint .block-main, .strip-blocks.reserve-paint .block-main { flex: 0 0 auto; }
.strip-blocks.has-paint .add-house, .strip-blocks.reserve-paint .add-house { margin-top: auto; }

@media (min-width: 700px) {
  .strip-blocks { grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); }
  .strip-band { height: 18px; }
}
/* Phone: more than three blocks wrap onto a second row (D193: 3 to 6 blocks: 3 one row, 4 two by two, 5 three then two, 6 three then three). */
@media (max-width: 699px) {
  .strip-blocks { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .strip-blocks[data-count="2"], .strip-blocks[data-count="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strip-blocks[data-count="5"] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .strip-blocks[data-count="5"] .block { grid-column: span 2; }
  .strip-blocks[data-count="5"] .block:nth-child(n + 5) { grid-column: span 3; }
  .block { min-height: 118px; }
  .block-name { min-height: 4.1em; } /* three lines kept (D203; D240: a grey or off-white names its undertone, which can wrap before the chips), so a new colour does not change the strip height; D233: no clamp, the tag chips follow the text and may wrap */
  /* D185: when the strip wraps onto two rows, the base colour also runs under the first row
     (the strip's background is the base; first-row suggestions sit 14 px short of it, the band's height). Children: 1 = band, then the blocks. */
  .strip-blocks[data-count="4"], .strip-blocks[data-count="5"], .strip-blocks[data-count="6"] { background: var(--strip-base, transparent); }
  .strip-blocks[data-count="4"] .block:nth-child(-n + 3):not(.is-base),
  .strip-blocks[data-count="5"] .block:nth-child(-n + 4):not(.is-base),
  .strip-blocks[data-count="6"] .block:nth-child(-n + 4):not(.is-base) { margin-bottom: 14px; } /* same as the phone .strip-band height */
  .strip-blocks[data-count="4"] .block.is-base:nth-child(-n + 3),
  .strip-blocks[data-count="5"] .block.is-base:nth-child(-n + 4),
  .strip-blocks[data-count="6"] .block.is-base:nth-child(-n + 4) { padding-bottom: 14px; } /* keeps its Add button level with the row */
}

@media (min-width: 900px) {
  .colours-top { grid-template-columns: minmax(0, 332px) minmax(0, 1fr); gap: 0 16px; align-items: start; }
  .colours-lower { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 16px; align-items: start; }
  .formats { grid-template-columns: 5.5em minmax(0, 1fr) auto 5.5em minmax(0, 1fr) auto; }
}

/* ---- house palette ---- */
.house-count { margin: 0 0 8px; font-weight: 600; }
.house-card h3 { margin: 8px 0 2px; font-size: 1rem; }
.house-tiles { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); }
.house-tile { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); display: flex; flex-direction: column; min-width: 0; }
.tile-swatch { height: 56px; display: flex; align-items: flex-end; padding: 6px 8px; border-radius: 11px 11px 0 0; }
.tile-hex { font: 700 1rem/1.2 ui-monospace, Consolas, monospace; }
.tile-hex { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-hex.tile-title { font-family: inherit; }
.tile-hex.long { font-size: 0.88rem; }
.tile-hex.xlong { font-size: 0.78rem; }
.tile-title-input { min-height: 32px; width: 100%; padding: 2px 6px; font-size: 0.9rem; }
.tile-body { padding: 8px; display: grid; gap: 3px; grid-template-columns: minmax(0, 1fr); }
.tile-label { width: 100%; min-height: 36px; font-size: 0.92rem; }
.tile-meta { margin: 0; font-size: 0.82rem; line-height: 1.35; }
.tile-actions { display: flex; gap: 6px; margin-top: 4px; }
.tile-btn { min-height: 36px; min-width: 36px; padding: 0 8px; font-size: 0.85rem; }
.suggest-btn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.tile-remove { flex: none; padding: 0; width: 36px; display: inline-flex; color: var(--muted); }
.tile-setbase { flex: none; padding: 0; width: 36px; display: inline-flex; color: var(--muted); }
.tile-setbase:hover { color: var(--accent); border-color: var(--accent); }
.tile-remove:hover { color: var(--danger); border-color: var(--danger); }
@media (max-width: 699px) { .tile-btn, .tile-remove { min-height: 44px; } .tile-remove, .tile-setbase { width: 44px; } .tile-label { min-height: 44px; } }
.link-btn { border: 0; background: transparent; padding: 0; font: inherit; font-size: 0.82rem; color: var(--accent); text-decoration: underline; cursor: pointer; min-height: 28px; }
@media (max-width: 699px) { .link-btn { min-height: 44px; } }
.tile-btn[disabled] { opacity: 0.4; cursor: default; }
.tile-empty { margin: 0 0 8px; }
.house-checks { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 3px; } /* D235: tighter strips */
.check-note { display: flex; align-items: center; gap: 8px; border-left: 4px solid var(--clay); background: var(--bg); border-radius: 0 10px 10px 0; padding: 4px 2px 4px 10px; }
.check-note p { flex: 1; margin: 0; font-size: 0.95rem; line-height: 1.35; }
.check-icon { color: var(--clay); flex: none; }
/* D232: status icons (cross = problem, exclamation = advice, tick = works well) in a round badge; shape as well as colour */
.check-icon { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; color: var(--lvl-ink); background: var(--lvl-advice); }
.check-icon.lvl-problem { background: var(--lvl-problem); }
.check-icon.lvl-good { background: var(--lvl-good); }
.check-note.lvl-problem { border-left-color: var(--lvl-problem); }
.check-note.lvl-advice { border-left-color: var(--lvl-advice); }
.check-note.lvl-good { border-left-color: var(--lvl-good); }
.check-icon .visually-hidden { left: 0; }
/* D235: laptop: the ⓘ is a 36 px target (WCAG 2.2 minimum is 24 px) whose negative margin leaves a 24 px row, so a one-line strip is about 32 px; the overhang falls in the strip padding and gap.
   Phone keeps 44 px (D46), with -4 px margins so the strip is the button plus its padding. */
.check-note .info-btn { width: 36px; height: 36px; margin: -6px 0; }
.check-note .info-btn svg { width: 20px; height: 20px; }
@media (max-width: 699px) { .check-note .info-btn { width: 44px; height: 44px; margin: -4px 0; } .check-note .info-btn svg { width: 22px; height: 22px; } }
.hidden-tag { font-weight: 700; color: var(--muted); }
.check-note.is-hidden p { color: var(--muted); }
.show-again { flex: none; }
.hidden-line { margin: 6px 0 0; }
.hidden-line .link-btn { font-size: inherit; min-height: 28px; }
.house-ok { margin: 12px 0 0; }
.house-preview { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.prev-controls { display: grid; gap: 4px; }
.prev-controls .select { width: 100%; }
.prev-floor { margin-top: 4px; }
.floor-row { display: flex; align-items: flex-end; gap: 12px; }
.floor-row .floor-type { flex: 1; min-width: 0; }
.floor-row .select { width: 100%; }
.floor-body { margin-top: 8px; }
.floor-body p { margin: 0; }
.floor-picker .colour-row { margin-bottom: 0; }
@media (min-width: 900px) {
  .house-preview { grid-template-columns: minmax(0, 300px) minmax(0, 1fr); }
}

/* ---- house tiles: grip handle, menu, drag (Phase 9) ---- */
.tile-swatch { position: relative; }
.tile-actions { position: relative; }
.tile-paint { overflow-wrap: anywhere; }
.tile-badges { position: absolute; top: 6px; left: 8px; display: flex; align-items: center; gap: 6px; }
.tile-num { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; padding: 0 4px; box-sizing: border-box; height: 28px; border-radius: 14px; background: rgba(255, 255, 255, 0.9); color: #111; border: 1px solid rgba(0, 0, 0, 0.35); font: 700 0.95rem/1 system-ui, sans-serif; }
.tile-paint-badge { padding: 3px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.9); color: #111; border: 1px solid rgba(0, 0, 0, 0.35); font-size: 0.78rem; font-weight: 700; }
.house-tile.paint-mode { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.tile-exact { font-weight: 600; overflow-wrap: anywhere; }
.paint-colour-btn { justify-self: start; }
.ratio-explain { margin: 8px 0 0; }
.prev-pickers { display: grid; gap: 4px; }
.prev-save { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.prev-suggest { margin-top: 12px; }
ul.house-tiles.empty { min-height: 72px; border: 2px dashed var(--border); border-radius: 12px; display: flex; align-items: center; justify-content: center; padding: 8px; }
ul.house-tiles.empty::before { content: attr(data-empty); color: var(--muted); font-size: 0.9rem; text-align: center; }
.house-tile.drag-source { display: none; }
.tile-placeholder { list-style: none; border: 2px dashed var(--accent); border-radius: 12px; background: var(--accent-soft); min-height: 64px; }
.house-tile.drag-ghost { position: fixed; z-index: 1000; pointer-events: none; margin: 0; opacity: 0.92; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35); transform: rotate(1.5deg); }
.house-tile.drag-ghost.lifted { transform: scale(1.04) rotate(1.5deg); box-shadow: 0 16px 36px rgba(0, 0, 0, 0.42); } /* D61: tile lifts when the hold arms */
body.dragging-tile { user-select: none; cursor: grabbing; }
ul.house-tiles.empty .tile-placeholder { flex: 1; }

/* ---- Phase 11 ---- */
.describe .hexline { display: flex; align-items: center; gap: 2px; }
.describe .hexline .info-btn.inline { margin: -10px 0; top: 0; }
.dlg-colour { width: min(600px, calc(100vw - 32px)); }
.dlg-h { margin: 12px 0 6px; font-size: 1rem; }
.dlg-h:first-child { margin-top: 0; }
.ratio-title { margin: 8px 0 0; font-size: 0.85rem; font-weight: 600; }
.ratio { margin-top: 4px; }
.ratio-note { margin: 4px 0; font-weight: 600; }
.area-line { margin: 4px 0; }
.ratio-explain { margin: 4px 0 0; }
.near-paint { margin: 0 0 6px; }
.base-paint { color: var(--text); }

/* saved house palettes: compact cards in a wrapping grid (D41) */
.saved-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 700px) { .saved-list { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .saved-list { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.saved { padding: 8px; display: grid; gap: 6px; align-content: start; min-width: 0; }
.saved-name { font-size: 0.9rem; line-height: 1.25; overflow-wrap: anywhere; margin: 0; }
.saved-dots { display: flex; gap: 3px; flex-wrap: wrap; }
.saved-dots span { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.25); }
.saved-actions { display: flex; gap: 4px; }
.saved-btn { min-height: 36px; padding: 0 8px; font-size: 0.85rem; }
.saved-btn.saved-icon { width: 36px; padding: 0; }
@media (max-width: 699px) { .saved-btn { min-height: 44px; } .saved-btn.saved-icon { width: 44px; } .saved-actions { gap: 4px; flex-wrap: wrap; } .saved-btn:not(.saved-icon) { flex: 1 1 100%; } }
#saved-box { margin-top: 6px; }
.suggestion { padding: 8px; gap: 6px; }
.suggestion[hidden] { display: none; } /* D63 */
.more-combos { margin-top: 8px; }
.suggestions { gap: 8px; margin-top: 6px; }
.suggest-details > summary { min-height: 36px; display: flex; align-items: center; }
.prev-pickers { gap: 0; }
.prev-pickers .field, .prev-side .field { margin-bottom: 6px; }

/* ---- Phase 11b ---- */
/* D55: shorter hex and picker boxes on laptop; the hit area stays 44 px on phone */
.inputs .hex-in { height: 36px; min-height: 36px; }
@media (max-width: 699px) { .inputs .hex-in { height: 44px; min-height: 44px; } }

/* D56: colour formats, one value per row, small icon copy buttons, two columns on laptop */
.formats { grid-template-columns: 6.2em minmax(0, 1fr) auto; gap: 2px 8px; }
.formats dt { font-size: 0.85rem; white-space: nowrap; }
.fmt-val { white-space: nowrap; overflow-wrap: normal; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; }
.copy-btn { min-width: 0; width: 32px; height: 32px; min-height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.copy-btn.copied { color: var(--accent-text); background: var(--accent); border-color: var(--accent); }
.copy-btn.failed { color: var(--danger); border-color: var(--danger); }
@media (min-width: 640px) {
  .dlg-colour { width: min(760px, calc(100vw - 32px)); }
  .formats { grid-template-columns: 6.2em minmax(0, 1fr) auto 6.2em minmax(0, 1fr) auto; column-gap: 8px; }
}
@media (min-width: 900px) { .formats { grid-template-columns: 6.2em minmax(0, 1fr) auto 6.2em minmax(0, 1fr) auto; } }
@media (max-width: 639px) { .copy-btn { width: 44px; height: 36px; } }

/* D57: tile title bar is the drag handle; lighter badges */
.tile-swatch { cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; } /* D61: no touch-action: none, so touch can scroll until the hold arms the drag */
.tile-swatch:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.tile-swatch[aria-pressed="true"] { outline: 3px solid var(--focus); outline-offset: -3px; }
.tile-badges { gap: 4px; top: 5px; left: 6px; }
.tile-num { min-width: 22px; height: 22px; font-size: 0.8rem; }
.tile-paint-badge { padding: 1px 6px; font-size: 0.68rem; line-height: 1.3; }
.tile-base-badge { padding: 1px 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.9); color: #111; border: 1px solid rgba(0, 0, 0, 0.35); font-size: 0.68rem; font-weight: 700; line-height: 1.3; }
.tile-base-badge[hidden] { display: none; }
/* D84: the paint button takes its own row (shrinks, then ellipsis); the icon buttons are fixed size and may wrap */
.tile-actions { flex-wrap: wrap; align-items: center; }
.tile-actions .suggest-btn { flex: 1 1 100%; min-width: 0; }
.tile-icons { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.house-head-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.from-paints { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 10px; font-size: 0.88rem; }
@media (max-width: 699px) { .from-paints { min-height: 44px; } }
.tile-swatch { cursor: pointer; }
.house-tile.is-base { box-shadow: 0 0 0 2px var(--accent); }
.tile-actions .suggest-btn { min-width: 0; overflow: hidden; }
.suggest-text { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.suggest-btn.long { font-size: 0.75rem; }
.suggest-btn.xlong { font-size: 0.68rem; }
.tile-brand { display: block; }

/* D58: open saved palette named beside the heading */
.house-open { font-weight: 400; font-size: 0.9rem; color: var(--muted); }
.house-open .unsaved { font-style: italic; }

/* D59: painted-area bar */
.area-wrap { margin-top: 6px; }
.area-note { margin: 0; }
.area-key { margin: 6px 0 2px; }

/* ---- Phase 12: light and window direction (D67-D71) ---- */
.prev-main { display: grid; gap: 8px; min-width: 0; }
.prev-light { display: grid; gap: 4px; }
.light-row { display: grid; gap: 8px 12px; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); align-items: start; }
.light-ctl { display: grid; gap: 4px; min-width: 0; }
.light-ctl .field-label { margin: 0; }
.light-ctl .seg { margin: 0; }
.light-ctl .seg-opt span { min-height: 40px; padding: 0 4px; font-size: 0.9rem; }
.light-ctl.is-off .seg { opacity: 0.45; }
.light-ctl.is-off .seg-in { cursor: not-allowed; }
.light-off-note { margin-left: 6px; font-weight: 400; }
.light-side { display: flex; align-items: flex-start; gap: 4px; }
.light-side .info-btn { align-self: center; }
.light-side .seg { flex: 1; }
.light-table-wrap { overflow-x: auto; }
.light-table { border-collapse: collapse; font-size: 0.85rem; }
.light-table th, .light-table td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; vertical-align: top; min-width: 9rem; }
.light-table thead th { background: var(--surface-2, transparent); }
.light-explain { margin: 0; }
.light-note { margin: 0; }
.light-list dt { font-weight: 600; margin-top: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.light-list dd { margin: 2px 0 0; }
.prev-orient { margin-top: 4px; }
.orient { border: 0; padding: 0; margin: 0 0 8px; min-width: 0; }
.orient legend { padding: 0; margin-bottom: 4px; }
.orient .seg { margin: 0; }
/* D111: arrow (or ?) behind each Window faces letter */
.orient-seg .seg-opt span { position: relative; overflow: hidden; }
.orient-seg .seg-opt:first-child { flex: 2.2 1 0; }
.orient-seg .orient-l { position: relative; font-weight: 700; white-space: nowrap; }
.orient-mark { position: absolute; top: 50%; left: 50%; width: min(36px, 86%); height: min(36px, 86%); max-height: calc(100% - 4px); transform: translate(-50%, -50%); opacity: 0.2; pointer-events: none; }
.orient-seg .orient-q { width: 34px; height: 34px; opacity: 0.2; }
.orient-seg .seg-in:checked + span .orient-mark { opacity: 0.35; }
.orient-seg .seg-in:checked + span .orient-l { font-weight: 800; }
.room-orient { margin-top: 12px; }
@media (max-width: 640px) {
  .light-row { grid-template-columns: minmax(0, 1fr); }
  .light-ctl .seg-opt span { min-height: 44px; }
}
/* D81: Reset on the House palette header */
.house-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.house-head h2 { margin: 0; }
.reset-house { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 10px; font-size: 0.88rem; color: var(--danger); border-color: var(--danger); }
.reset-house[disabled] { opacity: 0.4; color: var(--muted); border-color: var(--border); }
@media (max-width: 699px) { .reset-house { min-height: 44px; } }
.tile-wheel-badge { padding: 1px 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.9); color: #111; border: 1px dashed rgba(0, 0, 0, 0.45); font-size: 0.68rem; font-weight: 700; line-height: 1.3; }

/* D96: scheme tips dialog */
.scheme-tips { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.scheme-tip { padding: 8px 10px; border: 1px solid var(--border, currentColor); border-radius: 8px; }
.scheme-tip.selected { border-width: 2px; background: var(--bg); }
.scheme-tip .badge { margin-left: 8px; }
.scheme-tip[role="radio"] { cursor: pointer; min-height: 44px; }
.scheme-tip[role="radio"]:hover { border-color: var(--accent, currentColor); }
.scheme-tip.chosen { border: 2px solid var(--accent, currentColor); background: var(--accent-soft, var(--bg)); } /* D184: the scheme picked in the dialog */
.scheme-tip[role="radio"]:focus-visible { outline: 3px solid var(--focus, currentColor); outline-offset: 2px; }

/* D117: compact tiles. One meta line on phone, one action row (Paint matches + bin), Revert link only when a paint is selected. */
.tile-actions { flex-wrap: nowrap; }
.tile-actions .suggest-btn { flex: 1 1 0; min-width: 0; }
.tile-actions .tile-remove { margin-left: 0; }
.tile-revert { justify-self: start; text-align: left; min-height: 32px; }
@media (max-width: 699px) { .tile-revert { min-height: 44px; } }
/* D231: strength and depth tags */
.tile-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tile-tags:empty { display: none; }
.colour-tag { position: relative; font-size: 0.7rem; line-height: 1.25; padding: 0 7px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); color: var(--muted); white-space: nowrap; cursor: help; }
.colour-tag.tag-strong, .colour-tag.tag-deep { color: var(--text); font-weight: 600; background: var(--accent-soft); border-color: var(--accent); }
.meta-full { display: none; }
.meta-brand { display: block; font-weight: 600; } /* D138 */
.meta-hue { display: block; }
@media (min-width: 700px) { .meta-short { display: none; } .meta-full { display: inline; } }
@media (max-width: 699px) {
  .house-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .tile-swatch { height: 50px; padding: 4px 8px; }
  .tile-body { padding: 6px; gap: 2px; }
  .tile-meta { line-height: 1.3; overflow-wrap: anywhere; } /* D240: an off-white's undertone can make the name wrap; the brand line stays on one line */
  .meta-brand { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tile-actions { margin-top: 2px; gap: 4px; }
  .tile-btn.suggest-btn { padding: 0 4px; font-size: 0.8rem; }
}

/* D121: static two-line guide (compact, natural width, no grid) */
.house-guide { list-style: none; margin: 0 0 6px; padding: 0; display: block; }
.guide-row { display: block; font-size: 0.88rem; line-height: 1.4; padding: 2px 0; }

/* D116/D124: Enter exact colour button and dialog */
.specific-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; max-width: 100%; }
@media (max-width: 699px) { .specific-btn { min-height: 44px; } }
.specific-dlg { width: min(340px, calc(100vw - 32px)); }
@media (min-width: 700px) { .specific-dlg { width: 300px; } } /* D133 */
.specific-dlg .dlg-body { display: flex; flex-direction: column; gap: 12px; }
.specific-dlg .hex-in { height: 44px; }
/* D125: preview swatch beside Hex, RGB and HSL triplets on one compact row each */
.specific-dlg .hex-row { display: flex; gap: 8px; align-items: center; }
.specific-dlg .hex-row { justify-content: flex-start; }
.specific-dlg .hex-row .hex-in.input { flex: none; width: 7.8ch; box-sizing: content-box; min-width: 0; padding-left: 12px; padding-right: 10px; } /* D133: sized for 7 characters */
.specific-preview { flex: none; width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--border); }
.specific-dlg fieldset.triple { border: 0; padding: 0; margin: 0; min-width: 0; }
.specific-dlg .triple legend { padding: 0; }
.specific-dlg .triple-row { display: flex; flex-wrap: nowrap; gap: 8px; }
.specific-dlg .num-field { display: flex; align-items: center; gap: 4px; min-width: 0; flex: none; }
.specific-dlg .num-label { flex: none; font-size: 0.85rem; color: var(--muted); }
.specific-dlg .num-in.input { flex: none; min-width: 0; width: 4.4ch; box-sizing: content-box; height: 44px; padding-left: 6px; padding-right: 6px; text-align: center; } /* D133: three digits */
@media (min-width: 700px) { .specific-dlg .hex-in, .specific-dlg .num-in { height: 38px; } .specific-preview { width: 38px; height: 38px; } }
/* D124: the visually-hidden hex hint sat at the right edge of the body (static position after a 100% wide input) and added 1px of horizontal scroll */
.specific-dlg .visually-hidden { left: 0; }
#pick-h:focus { outline: none; }

/* D134: inline saturation/brightness square and hue strip */
.sv-picker { display: grid; gap: 12px; }
.sv-square {
  position: relative; width: 100%; height: 150px; border-radius: 10px; border: 1px solid var(--border); touch-action: none; cursor: crosshair; user-select: none; -webkit-user-select: none;
  background: linear-gradient(to top, #000, rgba(0, 0, 0, 0)), linear-gradient(to right, #fff, rgba(255, 255, 255, 0)), var(--sv-hue, red);
}
.sv-thumb, .sv-hue-thumb {
  position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; box-sizing: border-box; border-radius: 50%;
  border: 3px solid #fff; box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.6), 0 1px 4px rgba(0, 0, 0, 0.4); pointer-events: none;
}
.sv-hue {
  position: relative; height: 22px; border-radius: 11px; border: 1px solid var(--border); touch-action: none; cursor: pointer; user-select: none; -webkit-user-select: none;
  background: linear-gradient(to right, #f00 0%, #ff0 16.67%, #0f0 33.33%, #0ff 50%, #00f 66.67%, #f0f 83.33%, #f00 100%);
}
.sv-hue .sv-hue-thumb { top: 50%; }
.sv-square:focus-visible, .sv-hue:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (max-width: 699px) { .sv-square { height: 140px; } .sv-hue { height: 32px; border-radius: 16px; } .sv-hue .sv-hue-thumb { width: 28px; height: 28px; margin: -14px 0 0 -14px; } }

/* D136: saved house palettes card about half the height: no empty status line, tighter gaps */
.saved-card h2 { margin-bottom: 6px; }
.saved-card .saved-row { margin-bottom: 0; }
.saved-card .saved-status { min-height: 0; }
.saved-card .saved-status:not(:empty) { margin-top: 6px; }
.saved-card #saved-box { margin-top: 6px; }
.saved-card .saved-list { gap: 6px; }
.saved-card { padding-bottom: 8px; }

/* D137: on a phone the lines that can wrap reserve two lines, so the panel height stays put while a colour is moved or a tile is tapped */
@media (max-width: 699px) {
  .describe .desc-head { min-height: 70px; }
  .describe .desc-titles h2 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
  .describe .summary { min-height: 4.5em; } /* D240: three lines: an off-white names its undertone and the tag chips follow */
  .describe .near-paint { min-height: 2.9em; }
}

/* Paint matches buttons stand out (17/10/2026): solid in the base colour panel, tinted on house tiles */
.btn.desc-suggest { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.btn.desc-suggest:hover { background: var(--accent); filter: brightness(1.08); }
.btn.suggest-btn, .btn.more-combos, .btn#edit-dimensions, .btn.save-new, .btn.start-btn { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); font-weight: 600; } /* D215: Help me choose looks like Paint matches on the tiles */
.btn.suggest-btn:hover, .btn.more-combos:hover, .btn#edit-dimensions:hover, .btn.save-new:hover, .btn.start-btn:hover { background: var(--accent); color: var(--accent-text); }

/* D208: the message after Add; fixed, so it never moves the page */
.add-toast {
  position: fixed; z-index: 30; left: var(--gutter); right: var(--gutter); bottom: calc(12px + env(safe-area-inset-bottom)); margin-inline: auto; width: fit-content; max-width: min(34rem, calc(100vw - 2 * var(--gutter)));
  display: flex; flex-wrap: wrap; align-items: center; gap: 0 14px; padding: 6px 14px; border-radius: 12px; box-shadow: var(--shadow);
  background: var(--accent); color: var(--accent-text);
}
.add-toast[hidden] { display: none; }
.add-toast-msg { padding: 6px 0; }
.add-toast-link { color: inherit; font-weight: 600; text-decoration: underline; display: inline-flex; align-items: center; min-height: 44px; }
@media (min-width: 700px) { .add-toast-link { min-height: 34px; } }
#house-h { scroll-margin-top: calc(var(--bar-h) + var(--jump-h, 0px) + 12px); } /* D208: View house palette lands below the sticky bar */

/* D215: beginner's start */
.start-choices { display: flex; gap: 8px; flex-wrap: wrap; }
.pick-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.pick-head h2 { margin: 0; white-space: nowrap; } /* D215: one line, so the card stays short */
.start-btn { min-height: 32px; padding: 0 10px; font-size: 0.85rem; white-space: nowrap; flex: none; margin: -4px 0; } /* the 32 px target overlaps the row's spacing */
@media (max-width: 699px) { .start-btn { min-height: 44px; margin: -6px 0 0; } } /* 44 px tap target, no taller row */
.start-why { margin: 0 0 8px; }
.start-why .link-btn { font-size: inherit; }
.dlg.dlg-start { width: min(480px, calc(100vw - 24px)); }
.start-q .start-count { margin: 0 0 4px; }
.start-h { margin: 0 0 12px; font-size: 1.15rem; }
.start-note { margin: -6px 0 10px; } /* D249 */
.start-h:focus { outline: none; }
.start-h:focus-visible { outline: 3px solid var(--focus, var(--accent)); outline-offset: 2px; }
.start-answers { display: grid; gap: 8px; }
.start-answer { justify-content: flex-start; text-align: left; min-height: 48px; font-size: 1rem; }
.start-answer[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.start-foot { display: flex; justify-content: space-between; gap: 8px; width: 100%; }
.start-foot .btn:disabled { opacity: 0.5; cursor: default; }
@media (min-width: 700px) { .start-answers { grid-template-columns: 1fr 1fr; } }

/* D226: cues on the Help me choose answers */
.start-answer { display: flex; align-items: center; gap: 10px; }
.start-swatch { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.25); }
.start-arrow { flex: none; width: 18px; text-align: center; font-weight: 700; color: var(--accent); }
.start-cue-gap { flex: none; width: 18px; }

/* D227: the Help me choose result step */
.start-result { display: flex; align-items: center; gap: 14px; margin: 6px 0 10px; }
.start-result-swatch { flex: none; width: 72px; height: 72px; border-radius: 12px; border: 1px solid rgba(0, 0, 0, 0.2); }
.start-result-text p { margin: 0 0 2px; }
.start-result-name { font-size: 1.05rem; }
.start-result-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.start-result-why { margin: 0 0 6px; }
.start-next { margin: 8px 0 0; }
.start-foot-end { display: inline-flex; gap: 8px; }
/* D233: the tags follow the description on the same line; the chips wrap onto the next line rather than cut anything */
.block-tags .colour-tag { display: inline-block; margin: 1px 4px 1px 0; vertical-align: baseline; }
.block-tags .colour-tag:first-child { margin-left: 2px; }

/* D250: collapsible cards and the phone jump bar */
.card-head-row { display: flex; align-items: center; gap: 4px; margin-bottom: 10px; }
.colours-screen .card .card-head-row h2 { margin: 0; }
.house-head { justify-content: flex-start; }
.house-head h2 { margin-right: auto; }
.card-toggle { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; margin: -4px 2px -4px -6px; padding: 0; background: transparent; color: inherit; border: 1px solid transparent; border-radius: 8px; cursor: pointer; }
.card-toggle:hover { background: var(--accent-soft); }
.card-toggle .icon { transition: transform 0.15s; }
.card-toggle[aria-expanded="false"] .icon { transform: rotate(-90deg); }
@media (prefers-reduced-motion: reduce) { .card-toggle .icon { transition: none; } }
@media (max-width: 699px) { .card-toggle { width: 44px; height: 44px; margin: -8px 2px -8px -10px; } }
.card-body[hidden] { display: none; }
.card.is-collapsed .card-head-row { margin-bottom: 0; }
.house-card.is-collapsed .house-head-btns { display: none; }
.card.is-collapsed { padding-bottom: 12px; }
.saved-card.is-collapsed { padding-bottom: 8px; }
.jump-bar { display: none; }
.pick-section, #house-card, #preview-card { scroll-margin-top: calc(var(--bar-h) + var(--jump-h, 0px) + 8px); }
@media (max-width: 699px) {
  .colours-screen { --jump-h: 52px; }
  .jump-bar {
    display: flex; gap: 6px; position: sticky; top: var(--bar-h); z-index: 8; box-sizing: border-box; height: var(--jump-h);
    margin: 0 calc(var(--gutter) * -1) 10px; padding: 4px var(--gutter); align-items: center;
    background: var(--bg, var(--surface)); border-bottom: 1px solid var(--border);
  }
  .jump-link {
    flex: 1 1 0; min-width: 0; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 6px; text-align: center;
    font-size: 0.88rem; font-weight: 600; line-height: 1.15; color: var(--text); text-decoration: none; border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  }
  .jump-link[aria-current="location"] { background: var(--accent-soft); border-color: var(--accent); box-shadow: inset 0 -3px 0 var(--accent); }
}
@media (forced-colors: active) { .jump-link[aria-current="location"] { border-width: 3px; } }
