:root {
  --jade: #1f3b33;
  --jade-deep: #0f1f1b;
  --gold: #d9b26a;
  --gold-soft: #e9d9b0;
  --cream: #f3ead3;
  --paper: #f4efe6;
  --ink: #0b0d0c;
  --muted: #5a625d;
  --peach: #e8a87c;
  --alta: #c2410c;
  --media: #b7791f;
  --baja: #4f7a6a;
  --info: #5a625d;
  --display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --body: "Jost", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--body);
  color: var(--ink);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  font-size: 15px;
  line-height: 1.45;
}

.top {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .6rem 1.2rem;
  background: var(--jade-deep);
  color: var(--cream);
}
.brand { font-family: var(--display); font-size: 1.5rem; color: var(--gold); text-decoration: none; letter-spacing: .04em; }
.top h1 { font-family: var(--display); font-weight: 500; font-size: 1.35rem; margin: 0; flex: 1; }
.beta { font-size: .75rem; border: 1px solid var(--gold); color: var(--gold); border-radius: 99px; padding: .1rem .6rem; }

.layout { flex: 1; display: grid; grid-template-columns: 360px 1fr; min-height: 0; }

.panel {
  background: #fffdf8;
  border-right: 1px solid #e4dccb;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.steps { list-style: none; margin: 0; padding: .5rem; overflow-y: auto; flex: 1; }
.step { border-radius: 10px; margin-bottom: .25rem; }
.step-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: .6rem;
  background: none;
  border: 0;
  padding: .55rem .6rem;
  font: 500 1rem var(--body);
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  border-radius: 10px;
}
.step-head:hover { background: #f5efe2; }
.step .n {
  width: 1.7rem; height: 1.7rem; border-radius: 50%;
  display: grid; place-items: center;
  background: #ece4d2; color: var(--jade); font-weight: 600; font-size: .9rem;
}
.step.done .n { background: var(--baja); color: #fff; }
.step.active { background: #f7f1e4; }
.step.active .step-head { color: var(--jade); }
.step.active .n { background: var(--jade); color: var(--gold-soft); }
.step-body { display: none; padding: 0 .8rem .9rem 2.9rem; }
.step.active .step-body { display: block; }
.step-body p { margin: .2rem 0 .7rem; }
.note { font-size: .82rem; color: var(--muted); }
.hook { border: 1.5px solid #d9b26a; background: linear-gradient(135deg, #fff8e6, #fdf3dc); border-radius: 12px; padding: .8rem .9rem; display: grid; gap: .45rem; }
.hook-title { margin: 0; font-weight: 600; color: #6b4e12; font-size: .98rem; }
.hook-text { margin: 0; font-size: .86rem; line-height: 1.45; color: #5a4a2a; }
.aviso { margin: 0 0 .8rem; padding: .6rem .75rem; border-left: 3px solid #b8860b; background: #fbf6ea; border-radius: 0 8px 8px 0; font-size: .84rem; line-height: 1.45; color: #4a4033; }
.legal-note { font-size: .75rem; line-height: 1.45; margin-top: .6rem; }
.legal-note a { color: var(--jade); }

.drop {
  display: flex; flex-direction: column; align-items: center; gap: .2rem;
  border: 2px dashed var(--gold); border-radius: 12px;
  padding: 1.1rem; cursor: pointer; background: #fffaf0;
  transition: background .15s;
}
.drop:hover, .drop.over { background: var(--cream); }
.drop strong { color: var(--jade); }
.drop span { font-size: .85rem; color: var(--muted); }

.tools { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
button { font-family: inherit; }
.tool, .icon {
  border: 1px solid #d8cdb5; background: #fff; border-radius: 99px;
  padding: .38rem .8rem; cursor: pointer; font-size: .9rem; color: var(--ink);
}
.tool:hover, .icon:hover { border-color: var(--jade); }
.tool[aria-pressed="true"] { background: var(--jade); color: var(--cream); border-color: var(--jade); }
.tool:focus-visible, .icon:focus-visible, .btn:focus-visible, .step-head:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.link { background: none; border: 0; color: var(--jade); text-decoration: underline; cursor: pointer; padding: .6rem 0 .2rem; font-size: .92rem; }
.more summary { cursor: pointer; color: var(--jade); font-size: .92rem; margin: .4rem 0; }
kbd { border: 1px solid #ccc; border-bottom-width: 2px; border-radius: 4px; padding: 0 .3rem; font-size: .8em; background: #fff; }

.range { display: flex; align-items: center; gap: .6rem; }
.range input { flex: 1; accent-color: var(--jade); }
.range output { min-width: 3rem; font-weight: 600; color: var(--jade); }

.nav { display: flex; justify-content: space-between; gap: .5rem; padding: .7rem; border-top: 1px solid #e4dccb; }
.btn {
  border: 0; background: var(--jade); color: var(--cream);
  padding: .55rem 1.2rem; border-radius: 99px; cursor: pointer; font-size: .95rem; font-weight: 500;
}
.btn:hover { background: var(--jade-deep); }
.btn.ghost { background: transparent; color: var(--jade); border: 1px solid var(--jade); }
.btn:disabled { opacity: .4; cursor: default; }

.stage { position: relative; background: #ebe4d4; overflow: hidden; min-height: 0; }
.stage svg { width: 100%; height: 100%; display: block; touch-action: none; user-select: none; }
/* The svg is redrawn on every touch: its children must never be the event target, or phones lose the finger when they are replaced. */
.stage svg * { pointer-events: none; }
.stage { -webkit-touch-callout: none; -webkit-user-select: none; }
.stage svg.tool-pan { cursor: grab; }
.stage svg.panning { cursor: grabbing; }
.stage svg.tool-draw { cursor: crosshair; }
.stage svg.tool-erase { cursor: not-allowed; }
.stage svg.tool-north { cursor: grab; }

.toolbar {
  position: absolute; top: .7rem; left: .7rem; z-index: 2;
  display: flex; gap: .3rem; background: rgba(255,253,248,.92);
  padding: .3rem; border-radius: 99px; box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.toolbar .icon, .toolbar .tool { padding: .3rem .55rem; border-color: transparent; }

.compass {
  position: absolute; top: .7rem; right: .7rem; z-index: 2;
  width: 86px; height: 86px; border-radius: 50%;
  background: rgba(255,253,248,.95); border: 2px solid var(--gold);
  box-shadow: 0 2px 10px rgba(0,0,0,.12); cursor: grab; touch-action: none;
}
.needle { position: absolute; inset: 0; transition: transform .05s linear; }
.needle::before {
  content: ""; position: absolute; left: 50%; top: 12px; bottom: 50%;
  width: 0; border-left: 7px solid transparent; border-right: 7px solid transparent;
  border-bottom: 30px solid var(--alta); transform: translateX(-50%);
}
.needle::after {
  content: ""; position: absolute; left: 50%; top: 50%; bottom: 12px;
  width: 0; border-left: 7px solid transparent; border-right: 7px solid transparent;
  border-top: 30px solid var(--jade); transform: translateX(-50%);
}
.needle span {
  position: absolute; top: -2px; left: 50%; transform: translateX(-50%);
  font: 700 .8rem var(--body); color: var(--alta);
}

/* Instructions: a slim strip along the bottom edge, so it does not cover the plan (fit() leaves room for it). */
.hint {
  position: absolute; bottom: 0; left: 0; right: 0;
  margin: 0; background: rgba(15,31,27,.82); color: var(--cream);
  padding: .3rem .8rem; font-size: .8rem; line-height: 1.35; pointer-events: none; text-align: center;
}
.hint:empty { display: none; }
#toggle-plan[aria-pressed="false"] { opacity: .45; text-decoration: line-through; }
.empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-family: var(--display); font-size: 1.6rem; pointer-events: none; }
.empty[hidden] { display: none; }

.layers { display: grid; grid-template-columns: 1fr 1fr; gap: .2rem .6rem; font-size: .85rem; margin-bottom: .8rem; }
.layers input { accent-color: var(--jade); }
.summary { font-size: .9rem; color: var(--muted); margin-bottom: .5rem; }
.findings { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .5rem; }
.finding {
  border: 1px solid #e4dccb; border-left: 4px solid var(--info); border-radius: 8px;
  padding: .55rem .7rem; background: #fff; cursor: pointer;
}
.finding:hover, .finding.hl { box-shadow: 0 0 0 2px var(--gold-soft); }
.finding.alta { border-left-color: var(--alta); }
.finding.media { border-left-color: var(--media); }
.finding.baja { border-left-color: var(--baja); }
.finding h3 { margin: 0 0 .2rem; font-size: .95rem; font-weight: 600; }
.finding p { margin: 0 0 .25rem; font-size: .86rem; }
.finding .tip { color: var(--jade); }
.harm { display: flex; gap: .6rem; border: 1px solid #e4dccb; border-radius: 8px; padding: .55rem .7rem; background: #fff; cursor: pointer; }
.harm:hover, .harm:focus { box-shadow: 0 0 0 2px var(--gold-soft); outline: none; }
.harm-legend { border: 1px solid #e4dccb; border-radius: 10px; background: #fffaf0; padding: .5rem .6rem; margin-bottom: .8rem; display: grid; gap: .15rem; }
.lg-row { display: grid; grid-template-columns: auto 1.6rem 1fr auto; align-items: center; gap: .4rem; font-size: .88rem; cursor: pointer; }
.lg-row input, .hcb { accent-color: var(--jade); }
.lg-row.off { opacity: .5; }
.lg-ic { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; background: #fff4d6; border: 1.5px dashed #b8860b; transform: rotate(45deg); font-size: .8rem; }
.lg-ic > span { transform: rotate(-45deg); line-height: 1; }
.lg-n { font-size: .78rem; color: var(--muted); background: #efe6d2; border-radius: 99px; padding: 0 .45rem; }
.lg-bar { display: flex; gap: 1rem; padding-top: .2rem; }
.lg-bar .link { padding: .2rem 0; font-size: .85rem; }
.harm.off { opacity: .5; }
.hcb { margin-top: .35rem; flex: none; }
.legend { font-size: .82rem; color: var(--muted); margin: .2rem 0 .6rem; }
.lg-harm { color: #b8860b; font-size: 1.1rem; }
.lg-item { color: #9aa0a6; }
.harm .hn { flex: none; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--alta); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.harm h3 { margin: 0 0 .2rem; font-size: .95rem; font-weight: 600; }
.harm p { margin: 0 0 .25rem; font-size: .86rem; }
.harm .fixes { font-size: .76rem; color: var(--muted); }
.group-head { margin-top: .6rem; }
.group-head:first-child { margin-top: 0; }
.group-head h4 { margin: 0 0 .2rem; font-family: var(--display); font-size: 1.15rem; font-weight: 600; color: var(--jade); border-bottom: 1px solid var(--gold-soft); padding-bottom: .15rem; }
.group-head p { margin: .2rem 0 0; font-size: .8rem; color: var(--muted); }
.finding .tag { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

.cta { background: var(--jade); color: var(--cream); border-radius: 12px; padding: .9rem 1rem; margin-bottom: .8rem; }
.cta h3 { font-family: var(--display); font-weight: 500; font-size: 1.3rem; margin: 0 0 .3rem; color: var(--gold-soft); }
.cta p { margin: 0 0 .6rem; font-size: .88rem; }
.cta a { display: inline-block; background: var(--gold); color: var(--jade-deep); padding: .45rem 1rem; border-radius: 99px; text-decoration: none; font-weight: 600; }

dialog { border: 0; border-radius: 14px; padding: 1.2rem 1.4rem; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(15,31,27,.4); }
dialog input { width: 100%; font-size: 1.1rem; padding: .4rem .6rem; border: 1px solid #ccc; border-radius: 8px; }
dialog menu { display: flex; justify-content: flex-end; gap: .5rem; padding: 0; margin: 1rem 0 0; }

/* SVG styles */
.wall { stroke: var(--jade-deep); stroke-width: 5; stroke-linecap: round; }
.wall-pt { fill: var(--jade-deep); }
.op-door { stroke: var(--peach); stroke-width: 8; stroke-linecap: butt; }
.op-main { stroke: var(--alta); stroke-width: 9; stroke-linecap: butt; }
.op-window { stroke: #5aa6c9; stroke-width: 8; stroke-linecap: butt; }
.preview { stroke: var(--gold); stroke-width: 3; stroke-dasharray: 6 5; fill: none; }
.snap { fill: none; stroke: var(--alta); stroke-width: 2; }
.measure { stroke: #7c3aed; stroke-width: 2; stroke-dasharray: 4 3; }
.item-bg { fill: #fff; stroke: var(--jade); stroke-width: 1.5; }
.column { fill: #6b6b6b; stroke: var(--jade-deep); stroke-width: 1; }
.align { stroke: var(--alta); stroke-opacity: .28; }
.align.media { stroke: var(--media); }
.align.baja { stroke: var(--baja); }
.align-line { stroke: var(--alta); stroke-width: 2; stroke-dasharray: 8 6; }
.corner-ray { fill: var(--alta); fill-opacity: .18; stroke: var(--alta); stroke-width: 1.5; }
.corner-ray.baja { fill: var(--media); fill-opacity: .12; stroke: var(--media); }
.corner-dot { fill: var(--alta); }
.corner-dot.baja { fill: var(--media); }
.flow { stroke: var(--gold); stroke-width: 3; fill: none; stroke-opacity: .85; stroke-linejoin: round; }
.bagua line { stroke: var(--jade); stroke-width: 1; stroke-dasharray: 3 6; stroke-opacity: .55; }
.bagua text { fill: var(--jade); font: 600 13px var(--body); paint-order: stroke; stroke: #fffdf8; stroke-width: 4; }
.bagua text.sub { font-weight: 400; font-size: 11px; }
.hl-target { filter: drop-shadow(0 0 6px var(--gold)); }
.dimmed { opacity: .25; }

@media (max-width: 820px) {
  /* Phone: plan on top, the current step below, each with its own scroll; the page itself never scrolls. */
  body:not(.gate-body) { height: 100dvh; overflow: hidden; }
  .layout { grid-template-columns: 1fr; grid-template-rows: minmax(0, 52dvh) minmax(0, 1fr); }
  .stage { order: -1; }
  .panel { border-right: 0; border-top: 1px solid #e4dccb; min-height: 0; }
  .top { padding: .35rem .8rem; gap: .6rem; }
  .brand { font-size: 1.15rem; }
  .top h1 { font-size: .95rem; line-height: 1.2; }
  .compass { width: 54px; height: 54px; top: .45rem; right: .45rem; }
  .needle span { font-size: .7rem; }
  /* toolbar: smaller buttons, wraps before reaching the compass */
  .toolbar { top: .45rem; left: .45rem; max-width: calc(100% - 72px); flex-wrap: wrap; gap: .15rem; padding: .2rem; }
  .toolbar .icon, .toolbar .tool { width: 34px; height: 34px; padding: 0; font-size: .95rem; }
  .hint { font-size: .72rem; padding: .25rem .6rem; }
  /* only the current step is shown; Atrás / Siguiente move between them */
  .step:not(.active) { display: none; }
  .steps { padding: .35rem .45rem; }
  .step-head { padding: .45rem .5rem; }
  .step-body { padding: 0 .6rem .8rem; }
  .tools { gap: .35rem; }
  .tool:not(.icon) { padding: .4rem .65rem; font-size: .88rem; }
  .nav { padding: .45rem .6rem; }
}

/* Email gate (served by index.php on naturzen.es) */
body.gate-body { display: block; min-height: 100%; background: var(--paper); }
.gate { max-width: 560px; margin: 0 auto; padding: 2.2rem 1.3rem 3rem; }
.gate .brand { color: var(--jade); font-size: 1.7rem; }
.gate h1 { font-family: var(--display); font-weight: 500; font-size: 2.2rem; line-height: 1.1; margin: .8rem 0 .7rem; color: var(--jade-deep); }
.gate h2 { font-family: var(--display); font-weight: 500; color: var(--jade); }
.gate .lead { font-size: 1.05rem; }
.gate-points { padding-left: 1.1rem; color: var(--muted); font-size: .92rem; }
#gate-form { background: #fffdf8; border: 1px solid #e4dccb; border-radius: 14px; padding: 1.2rem; margin-top: 1.2rem; display: grid; gap: .7rem; }
#gate-form label[for="email"] { font-weight: 600; color: var(--jade); }
#gate-form input[type="email"] { font: inherit; font-size: 1.05rem; padding: .6rem .8rem; border: 1px solid #cdbf9f; border-radius: 10px; }
#gate-form input[type="email"]:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.check { display: flex; gap: .55rem; align-items: flex-start; font-size: .9rem; }
.check input { margin-top: .25rem; accent-color: var(--jade); width: 1.05rem; height: 1.05rem; flex: none; }
.check a { color: var(--jade); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.gate-msg { margin: 0; font-size: .92rem; min-height: 1.2em; }
.gate-msg.err { color: var(--alta); }
.gate .btn { justify-self: start; text-decoration: none; display: inline-block; }
