:root {
  --paper: #f4efe3;
  --card: #fbf8f1;
  --ink: #22261f;
  --ink-soft: #5b6153;
  --rule: #d9d1bf;
  --lot: #a9c97a;          /* the light green Block O wears on the MYN map */
  --lot-starter: #d8e6bf;
  --lot-empty: #f6f2e8;
  --lot-active: #f2c75c;   /* a warm porch-light yellow for the house you're looking at */
  --lot-line: #3c4433;
  --ctx: #e7e0d0;
  --ctx-line: #cbc2ad;
  --road: #f4efe3;
  --accent: #3d5a2a;
  --help: #c8642b;
  --focus: #2f6fb0;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Public Sans", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #161a14; --card: #1e231b; --ink: #ece7da; --ink-soft: #a8ad9c; --rule: #343b2e;
    --lot: #6f8f48; --lot-starter: #3c4a2c; --lot-empty: #242a20; --lot-line: #c9d4b4; --lot-active: #c99a2e;
    --ctx: #20251d; --ctx-line: #2f362a; --road: #161a14; --accent: #b6d38a; --help: #f0935a; --focus: #7fb2e8;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #161a14; --card: #1e231b; --ink: #ece7da; --ink-soft: #a8ad9c; --rule: #343b2e;
  --lot: #6f8f48; --lot-starter: #3c4a2c; --lot-empty: #242a20; --lot-line: #c9d4b4; --lot-active: #c99a2e;
  --ctx: #20251d; --ctx-line: #2f362a; --road: #161a14; --accent: #b6d38a; --help: #f0935a; --focus: #7fb2e8;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 var(--sans); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; margin: 0; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.eyebrow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 6px; }

/* Gate */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.gate-card { width: 100%; max-width: 380px; }
.gate h1 { font-size: clamp(44px, 12vw, 64px); line-height: 1; margin-bottom: 12px; }
.gate-lede { color: var(--ink-soft); margin: 0 0 28px; }
.gate label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.gate input { width: 100%; padding: 12px 14px; border: 1.5px solid var(--rule); border-radius: 10px; background: var(--card); margin-bottom: 12px; font-size: 17px; }
.gate .btn { width: 100%; }
.gate-error { color: var(--help); min-height: 1.5em; margin: 8px 0 0; font-size: 14px; }
.gate-help { font-size: 14px; color: var(--ink-soft); }

/* Buttons */
.btn { border: 0; border-radius: 10px; padding: 11px 18px; font-weight: 600; cursor: pointer; }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-quiet { background: transparent; border: 1.5px solid var(--rule); }
.link { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; color: var(--ink-soft); font-size: 14px; }

/* Header */
.top { padding: 36px 0 20px; }
.top h1 { font-size: clamp(40px, 9vw, 64px); line-height: 1; }
.lede { color: var(--ink-soft); max-width: 34em; margin: 10px 0 18px; }
.radio { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 14px; }
.radio li { display: flex; align-items: center; gap: 8px; }
.radio-ch { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--lot); color: #22261f; font-weight: 600; font-size: 13px; }

/* Map */
.map-card { background: var(--card); border: 1px solid var(--rule); border-radius: 16px; padding: 10px; }
.map svg { display: block; width: 100%; height: auto; }
.map .ctx { fill: var(--ctx); stroke: var(--ctx-line); stroke-width: .5; }
.map .lot { stroke: var(--lot-line); stroke-width: .7; cursor: pointer; transition: filter .15s; }
.map .lot.done { fill: var(--lot); }
.map .lot.starter { fill: var(--lot-starter); }
.map .lot.empty { fill: var(--lot-empty); }
.map .lot { outline: none; -webkit-tap-highlight-color: transparent; }
.map .lot:hover { filter: brightness(.95); }
.map .lot:focus-visible, .map .lot.active { fill: var(--lot-active); filter: none; }
.map .num { font: 600 6px var(--sans); fill: var(--ink); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.map .addr { font: 400 4px var(--sans); fill: var(--ink-soft); text-anchor: middle; pointer-events: none; }
.map .street { font: italic 600 7px var(--serif); fill: var(--ink-soft); letter-spacing: .25em; }
.map .help { fill: var(--help); pointer-events: none; }
.legend { list-style: none; margin: 8px 6px 2px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--ink-soft); }
.legend li { display: flex; align-items: center; gap: 6px; }
.sw { width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--lot-line); }
.sw-done { background: var(--lot); } .sw-starter { background: var(--lot-starter); } .sw-empty { background: var(--lot-empty); }
.mk-help { width: 9px; height: 9px; border-radius: 50%; background: var(--help); display: inline-block; }

/* Tabs */
.tabs { display: flex; gap: 4px; margin: 28px 0 16px; border-bottom: 1px solid var(--rule); overflow-x: auto; scrollbar-width: none; }
.tabs button { background: none; border: 0; padding: 10px 12px; font-weight: 600; color: var(--ink-soft); border-bottom: 2.5px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--ink); }

/* House list */
.houses { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.side-head { grid-column: 1 / -1; font: 600 13px var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); margin: 10px 0 0; }
.house { text-align: left; background: var(--card); border: 1px solid var(--rule); border-radius: 14px; padding: 14px 16px; cursor: pointer; display: grid; grid-template-columns: 14px 1fr; gap: 12px; align-items: start; }
.house:hover { border-color: var(--lot-line); }
.badge { width: 14px; height: 14px; border-radius: 4px; margin-top: 4px; border: 1px solid var(--lot-line); }
.badge.done { background: var(--lot); } .badge.starter { background: var(--lot-starter); color: var(--ink); } .badge.empty { background: var(--lot-empty); color: var(--ink); }
.house h3 { font: 600 16px var(--sans); }
.house .who { margin: 2px 0 0; color: var(--ink-soft); font-size: 14px; }
.house .chips { margin-top: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 3px 8px; border-radius: 999px; background: var(--paper); border: 1px solid var(--rule); }
.chip.help { border-color: var(--help); color: var(--help); }
.chip.starter { border-style: dashed; }

/* Gear & skills, check-on-first */
.share { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.share-item { background: var(--card); border: 1px solid var(--rule); border-radius: 12px; padding: 12px 14px; }
.share-item h3 { font: 600 15px var(--sans); }
.share-item p { margin: 4px 0 0; font-size: 14px; color: var(--ink-soft); }
.share-item.none { opacity: .55; }
.share-item.none h3 { font-weight: 500; }
.panel h2 { font-size: 24px; margin: 18px 0 4px; }
.panel .sub { color: var(--ink-soft); margin: 0 0 14px; font-size: 15px; }
.house-link { background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; color: var(--ink); font-size: 14px; }

.progress { margin: 32px 0 0; padding: 16px; border-radius: 14px; background: var(--card); border: 1px solid var(--rule); font-size: 15px; }
.bar { height: 8px; border-radius: 999px; background: var(--lot-empty); border: 1px solid var(--rule); overflow: hidden; margin-top: 10px; }
.bar span { display: block; height: 100%; background: var(--lot); }

.foot { display: flex; flex-wrap: wrap; gap: 10px 22px; padding-top: 28px; padding-bottom: 48px; }
.fine { width: 100%; margin: 6px 0 0; font-size: 13px; color: var(--ink-soft); }

/* Sheet (house detail / edit) */
.sheet { border: 0; padding: 0; width: min(620px, 100%); max-height: 92dvh; border-radius: 18px; background: var(--card); color: var(--ink); }
.sheet::backdrop { background: rgba(20, 24, 18, .5); }
@media (max-width: 640px) {
  .sheet { margin: auto 0 0; width: 100%; max-width: 100%; border-radius: 18px 18px 0 0; max-height: 94dvh; }
}
.sheet-inner { padding: 22px 20px 28px; }
.sheet-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 14px; }
.sheet-head h2 { font-size: 28px; line-height: 1.1; }
.close { background: none; border: 0; font-size: 26px; line-height: 1; cursor: pointer; color: var(--ink-soft); padding: 4px 8px; }
.notice { background: var(--paper); border: 1px dashed var(--lot-line); border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-bottom: 16px; }
.notice .actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.notice .btn { padding: 8px 14px; font-size: 14px; }
.facts { margin: 0; display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; }
.facts dt { color: var(--ink-soft); font-size: 14px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) { .facts { grid-template-columns: 1fr; gap: 0; } .facts dd { margin-bottom: 10px; } }
.empty-note { color: var(--ink-soft); }
.sheet-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.meta { font-size: 13px; color: var(--ink-soft); margin-top: 14px; }

form.edit fieldset { border: 0; padding: 0; margin: 0 0 20px; }
form.edit legend { font: 600 18px var(--serif); margin-bottom: 8px; padding: 0; }
form.edit label { display: block; font-size: 14px; font-weight: 600; margin: 12px 0 4px; }
form.edit .hint { font-weight: 400; color: var(--ink-soft); }
form.edit input[type=text], form.edit input[type=tel], form.edit input[type=email], form.edit textarea, form.edit select {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--rule); border-radius: 10px; background: var(--paper); font-size: 16px;
}
form.edit textarea { min-height: 70px; resize: vertical; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; margin-top: 6px; }
.checks label { display: flex; gap: 8px; align-items: center; font-weight: 400; margin: 0; padding: 7px 10px; border: 1px solid var(--rule); border-radius: 10px; cursor: pointer; }
.checks input { accent-color: var(--accent); width: 18px; height: 18px; }
.save-bar { position: sticky; bottom: -28px; background: var(--card); padding: 12px 0 4px; border-top: 1px solid var(--rule); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.save-msg { font-size: 14px; color: var(--help); }

.person { border: 1px solid var(--rule); border-radius: 12px; padding: 4px 14px 12px; margin-bottom: 10px; }
.person-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
@media (max-width: 480px) { .person-row { grid-template-columns: 1fr; } }
.remove-person { margin-top: 10px; font-size: 13px; }
.person:only-child .remove-person { display: none; }
.add-person { margin: 2px 0 6px; font-size: 14px; padding: 8px 14px; }

.hist { list-style: none; padding: 0; margin: 0; }
.hist li { border-top: 1px solid var(--rule); padding: 12px 0; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.hist .when { font-size: 13px; color: var(--ink-soft); }
.group-label { font-size: 14px; font-weight: 600; margin: 16px 0 4px; }
.kid { border-bottom: 1px solid var(--rule); padding-bottom: 8px; margin-bottom: 4px; align-items: end; grid-template-columns: 1fr 120px auto; }
.kid label { margin-top: 6px !important; }
.kid .remove-person { margin: 0 0 12px; }
@media (max-width: 480px) { .kid { grid-template-columns: 1fr 110px; } .kid .remove-person { grid-column: 1 / -1; margin-top: 4px; } }
.person + .person .hint { display: none; }
