:root {
  color-scheme: light dark;
  --accent: #2456e6;
  --line: #8884;
  --danger: #c53030;
  --ring: #2456e6;
  --accent-text: #2456e6;
  --hint: color-mix(in srgb, CanvasText 72%, Canvas);
}
@media (prefers-color-scheme: dark) {
  :root { --danger: #ff8a8a; --ring: #9bb4ff; --accent-text: #9bb4ff; }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 17px/1.6 system-ui, sans-serif;
}
header, main, footer {
  max-width: 44rem;
  margin: 0 auto;
  padding: 16px 20px;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
/* Header links are standalone targets: at least 44px tall (WCAG 2.5.8, Lighthouse target-size). */
.brand, header nav a { display: inline-block; min-height: 44px; padding: 10px 4px; line-height: 24px; }
.brand { font-weight: 700; text-decoration: none; color: inherit; }
h1 { font-size: clamp(1.7rem, 5vw, 2.4rem); line-height: 1.15; margin: 12px 0; text-wrap: balance; }
h2 { margin-top: 2.2rem; }
h3 { margin-bottom: 0; font-size: 1rem; }
.lede { font-size: 1.1rem; }
.button {
  padding: 6px 14px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}
/* The ad slot keeps its height whatever fills it (or nothing), so the page never shifts. */
.ad-slot { height: 250px; overflow: hidden; contain: strict; margin: 36px 0; padding: 12px; border: 1px dashed var(--line); border-radius: 12px; }
.ads-off .ad-slot { display: none; }
/* No card to show (empty house.json): keep the height so nothing shifts, but drop the empty dashed box. */
.ad-slot:empty { border-color: transparent; }
.ad-label { display: block; opacity: .65; font-size: .75rem; margin-bottom: 8px; }
.house-card { display: block; padding: 14px 16px; border-radius: 10px; background: #2456e612; color: inherit; text-decoration: none; }
.house-card strong { display: block; color: var(--accent-text); }
.house-card span { display: block; margin-top: 4px; font-size: .95rem; }
.consent { position: fixed; inset: auto 12px 12px 12px; max-width: 44rem; margin: 0 auto; padding: 14px 16px; border-radius: 12px; background: Canvas; color: CanvasText; border: 1px solid var(--line); box-shadow: 0 6px 24px #0004; z-index: 10; }
.consent div { display: flex; gap: 10px; flex-wrap: wrap; }
.consent button { flex: 1; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--accent); background: transparent; color: inherit; font: inherit; cursor: pointer; }
footer { margin-top: 40px; color: var(--hint); font-size: .9rem; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }

/* Acl Trace tool */
#acl, #match, #shadows { font: 15px/1.5 ui-monospace, "Cascadia Code", "Segoe UI Mono", Menlo, Consolas, monospace; }
.field { margin-top: 16px; }
.field label, legend { display: block; margin-bottom: 6px; font-weight: 700; }
legend { padding: 0; }
fieldset { border: 0; padding: 0; margin: 20px 0 0; min-width: 0; }
input[type="text"], select, textarea {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid #767676;
  border-radius: 6px;
  background: Canvas;
  color: CanvasText;
  font: inherit;
}
#acl { min-height: 12rem; max-height: 32rem; resize: vertical; }
.hint { margin: 6px 0 0; font-size: .9rem; color: var(--hint); }
.check-row { display: flex; align-items: flex-start; gap: 10px; margin-top: 16px; min-height: 44px; }
.check-row input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.check-row label { font-weight: 400; }
[hidden] { display: none !important; }
#check { display: inline-block; min-height: 44px; margin-top: 20px; padding: 8px 22px; border: 0; font: inherit; font-weight: 600; cursor: pointer; }
.results { margin-top: 20px; }
#error { color: var(--danger); font-weight: 600; }
#error, #match, #shadows { margin: 0 0 12px; overflow-wrap: anywhere; white-space: pre-wrap; }
#match { padding: 14px 16px; border-radius: 12px; border-left: 4px solid var(--accent); background: #2456e61a; }
#shadows { padding: 14px 16px; border-radius: 12px; border: 1px solid #767676; }
#error:empty, #match:empty, #shadows:empty {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
}
@media (min-width: 640px) {
  .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
}
