/* Rent Split: a fair rent split drawn as a floor plan.
 * One Page Toys tool family, self-contained, theme-aware (light/dark).
 * Light is a drafting table: vellum, graphite and blue pencil. Dark is a
 * blueprint: white lines on Prussian blue. */

@import url("https://fonts.googleapis.com/css2?family=Archivo:wdth,wght@75..125,500..800&family=Architects+Daughter&family=IBM+Plex+Mono:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap");

:root{
  --font-display: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-hand: "Architects Daughter", "Comic Sans MS", "Segoe Print", cursive;
  --ink: #1a2230;
  --bg: #eeede6;
  --surface: #fbfaf6;
  --surface-2: #f2f0e8;
  --muted: #5f6672;
  --line: #dedacd;
  --line-strong: #c6c0b0;
  --accent: #1f5fae;
  --accent-hover: #174b8b;
  --accent-soft: rgba(31, 95, 174, 0.12);
  --minus: #a5531f;
  --minus-soft: rgba(165, 83, 31, 0.12);
  --warn: #b6452c;
  --warn-soft: rgba(182, 69, 44, 0.12);
  --radius: 16px;
  --radius-sm: 11px;
  --radius-pill: 999px;
  --shadow: 0 2px 8px rgba(30, 32, 26, 0.07);
  --shadow-md: 0 10px 26px rgba(30, 32, 26, 0.11);
  /* the sheet */
  --pl-bg: #f8f6ef;
  --pl-bg-2: #efece2;
  --pl-grid: rgba(43, 96, 170, 0.075);
  --pl-grid-2: rgba(43, 96, 170, 0.15);
  --pl-ink: #18212e;
  --pl-thin: rgba(24, 33, 46, 0.6);
  --pl-faint: rgba(24, 33, 46, 0.38);
  --pl-common: rgba(43, 96, 170, 0.045);
  --pl-pad: rgba(24, 33, 46, 0.035);
  --pl-sel: rgba(31, 95, 174, 0.16);
  --pl-hover: rgba(31, 95, 174, 0.07);
  --pl-accent: #1f5fae;
  --pl-ray: rgba(205, 140, 28, 0.9);
  --pl-noise: #b6452c;
  --pl-tape: rgba(236, 222, 178, 0.82);
  --pl-shadow: 0 1px 1px rgba(30, 32, 26, 0.08), 0 14px 34px -8px rgba(30, 32, 26, 0.26);
}
:root[data-theme="dark"]{
  --ink: #e6ecf4;
  --bg: #0a101b;
  --surface: #111a28;
  --surface-2: #172234;
  --muted: #94a0b2;
  --line: #1f2a3c;
  --line-strong: #2e3b52;
  --accent: #8ab4ff;
  --accent-hover: #a9c8ff;
  --accent-soft: rgba(138, 180, 255, 0.15);
  --minus: #f0a46c;
  --minus-soft: rgba(240, 164, 108, 0.14);
  --warn: #ff9a7a;
  --warn-soft: rgba(255, 154, 122, 0.14);
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 10px 30px -6px rgba(0, 0, 0, 0.55);
  --pl-bg: #13427a;
  --pl-bg-2: #0b2c58;
  --pl-grid: rgba(255, 255, 255, 0.055);
  --pl-grid-2: rgba(255, 255, 255, 0.11);
  --pl-ink: #f0f5ff;
  --pl-thin: rgba(240, 245, 255, 0.66);
  --pl-faint: rgba(240, 245, 255, 0.4);
  --pl-common: rgba(255, 255, 255, 0.035);
  --pl-pad: rgba(255, 255, 255, 0.05);
  --pl-sel: rgba(150, 196, 255, 0.17);
  --pl-hover: rgba(255, 255, 255, 0.07);
  --pl-accent: #ffd98a;
  --pl-ray: rgba(255, 217, 138, 0.85);
  --pl-noise: #ffb59c;
  --pl-tape: rgba(222, 214, 190, 0.5);
  --pl-shadow: 0 1px 1px rgba(0, 0, 0, 0.3), 0 18px 40px -10px rgba(0, 0, 0, 0.7);
}

*, *::before, *::after{ box-sizing: border-box; }
html, body{ -webkit-tap-highlight-color: transparent; }
body{
  margin: 0; min-height: 100vh;
  display: flex; flex-direction: column;
  font-family: var(--font-sans); color: var(--ink);
  background:
    radial-gradient(70% 40% at 50% 0%, var(--accent-soft), transparent 70%),
    var(--bg);
  overflow-x: hidden; -webkit-font-smoothing: antialiased;
}
button, input, select{ font: inherit; color: inherit; }
.visually-hidden{ position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Top bar (family chrome) ---------- */
.topbar{
  position: relative; z-index: 3;
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  padding: 14px clamp(16px, 4vw, 30px);
  padding-top: max(14px, env(safe-area-inset-top));
  padding-left: max(clamp(16px, 4vw, 30px), env(safe-area-inset-left));
  padding-right: max(clamp(16px, 4vw, 30px), env(safe-area-inset-right));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.brand{ display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 0.86rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink); text-decoration: none; }
.brand__mark{ width: 1.1em; height: 1.1em; border: 1.5px solid var(--ink); border-radius: 6px; background: linear-gradient(90deg, var(--ink) 0 50%, var(--surface) 50% 100%); }
.topbar__right{ display: inline-flex; align-items: center; gap: 10px; }
.topbar__tag{ font-family: var(--font-display); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.iconbtn{ appearance: none; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0; font-size: 1rem; line-height: 1; border: 1.5px solid var(--line-strong); border-radius: var(--radius-pill); background: var(--surface); color: var(--ink); cursor: pointer; box-shadow: var(--shadow); transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease; }
.iconbtn:hover{ transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--ink); }
.iconbtn:focus-visible{ outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 5px var(--accent); }
.iconbtn svg{ width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#soundBtn .snd-off{ display: none; }
#soundBtn[aria-pressed="false"] .snd-on{ display: none; }
#soundBtn[aria-pressed="false"] .snd-off{ display: inline; }
.theme-toggle__sun, .theme-toggle__moon, .theme-toggle__auto{ display: none; }
:root[data-theme-mode="system"] .theme-toggle__auto{ display: inline; }
:root[data-theme-mode="light"] .theme-toggle__sun{ display: inline; }
:root[data-theme-mode="dark"] .theme-toggle__moon{ display: inline; }

/* ---------- Stage ---------- */
.stage{
  position: relative; z-index: 2; flex: 1 0 auto;
  display: flex; flex-direction: column; align-items: center;
  gap: 26px;
  padding: clamp(22px, 4vw, 44px) 16px clamp(48px, 6vw, 72px);
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  padding-bottom: max(clamp(56px, 7vw, 80px), calc(env(safe-area-inset-bottom) + 40px));
}

/* ---------- Hero ---------- */
.hero{ width: 100%; max-width: 720px; text-align: center; }
.eyebrow{ margin: 0 0 8px; font-family: var(--font-display); font-size: 0.74rem; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent); }
.headline{ margin: 0 0 12px; font-family: var(--font-display); font-weight: 800; font-stretch: 88%; font-variation-settings: "wdth" 88; font-size: clamp(2rem, 6.8vw, 3.35rem); line-height: 1.0; letter-spacing: -0.025em; text-wrap: balance; }
.lede{ margin: 0 auto; max-width: 600px; font-size: clamp(0.95rem, 2.6vw, 1.05rem); line-height: 1.55; color: var(--muted); text-wrap: pretty; }
.hero__actions{ margin-top: 20px; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.loadnote{ margin: 14px auto 0; max-width: 520px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); font-size: 0.88rem; font-weight: 600; }
.loadnote[hidden]{ display: none; }

/* ---------- Buttons ---------- */
.btn{
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 11px 22px;
  font-family: var(--font-display); font-size: 0.95rem; font-weight: 700; letter-spacing: -0.005em;
  border-radius: var(--radius-pill); border: 1.5px solid var(--line-strong);
  background: var(--surface); color: var(--ink); cursor: pointer; box-shadow: var(--shadow);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease, color 160ms ease;
}
.btn:hover{ transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn:active{ transform: translateY(0) scale(0.98); }
.btn:focus-visible{ outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 5px var(--accent); }
.btn--primary{ background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-theme="dark"] .btn--primary{ color: #081426; }
.btn--primary:hover{ background: var(--accent-hover); border-color: var(--accent-hover); }
.btn--ink{ background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn--ghost{ background: transparent; }
.btn--sm{ min-height: 44px; padding: 9px 18px; font-size: 0.88rem; }
.btn[hidden]{ display: none; }
.btn:disabled{ opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn--add{ width: 100%; margin-top: 12px; border-style: dashed; box-shadow: none; }
.linkbtn{ appearance: none; border: 0; background: transparent; padding: 10px 6px; min-height: 44px; font-weight: 600; font-size: 0.84rem; color: var(--accent); cursor: pointer; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; border-radius: 8px; }
.linkbtn:hover{ color: var(--accent-hover); }
.linkbtn:focus-visible{ outline: 2px solid var(--accent); outline-offset: 1px; }
.linkbtn[hidden]{ display: none; }

/* ---------- Layout ---------- */
.layout{ width: 100%; max-width: 1200px; display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
.col{ display: contents; }
.card--rent{ order: 1; }
.drafting{ order: 2; }
.card--rooms{ order: 3; }
.card--rules{ order: 4; }
.card--who{ order: 5; }
.linkcard{ order: 6; }
@media (min-width: 980px){
  .layout{ grid-template-columns: minmax(0, 430px) minmax(0, 1fr); gap: 28px; align-items: start; }
  .col{ display: flex; flex-direction: column; gap: 22px; min-width: 0; }
}

/* ---------- Cards ---------- */
.card{
  position: relative; min-width: 0;
  padding: clamp(16px, 3.6vw, 22px);
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
}
.card[hidden]{ display: none; }
.card__head{ display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card__title{ margin: 0; display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 1.22rem; font-weight: 800; letter-spacing: -0.015em; }
.card__count{ font-family: var(--font-mono); font-size: 0.76rem; font-weight: 500; color: var(--muted); }
.step{ display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--bg); font-family: var(--font-display); font-size: 0.8rem; font-weight: 800; }
.card__tip{ margin: 10px 0 0; font-size: 0.82rem; line-height: 1.5; color: var(--muted); }

/* fields */
.field{ display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field--grow{ flex: 1 1 auto; }
.field__k{ font-family: var(--font-display); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.opt-k{ font-family: var(--font-sans); font-weight: 500; letter-spacing: 0; text-transform: none; font-size: 0.74rem; opacity: 0.8; }
.field input[type="text"], .amt, .room__name{
  min-width: 0; min-height: 46px; padding: 10px 14px;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--ink); font-size: 1rem;
  outline: none; transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}
.field input[type="text"]:focus, .amt:focus-within, .room__name:focus{ border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
input::placeholder{ color: color-mix(in srgb, var(--muted) 72%, transparent); }
.amt{ display: flex; align-items: center; gap: 6px; padding: 0 12px; }
.amt input, .amt input:focus, .field .amt input[type="text"], .field .amt input[type="text"]:focus{ flex: 1; min-width: 0; width: 100%; min-height: 43px; border: 0; border-radius: 0; background: transparent; box-shadow: none; outline: none; padding: 0; font-family: var(--font-mono); font-weight: 600; font-size: 1.02rem; color: var(--ink); }
.amt__sym, .amt__unit{ flex: 0 0 auto; font-family: var(--font-mono); font-weight: 600; font-size: 0.9rem; color: var(--muted); }
.amt--big{ min-height: 56px; }
.amt--big input, .field .amt--big input[type="text"]{ font-size: 1.45rem; min-height: 53px; font-weight: 700; }
.amt--big .amt__sym{ font-size: 1.2rem; }
[aria-invalid="true"]{ color: var(--warn) !important; }
.amt:has(input[aria-invalid="true"]){ border-color: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.err{ margin: 8px 0 0; font-size: 0.86rem; font-weight: 600; color: var(--warn); }
.err:empty{ display: none; }

.rentrow{ display: flex; align-items: flex-end; gap: 10px; }
.rentrow--2{ margin-top: 14px; }
.field--area{ flex: 0 0 150px; }

/* currency */
.cur{ position: relative; flex: 0 0 auto; display: inline-flex; flex-direction: column; justify-content: center; gap: 1px; min-height: 56px; padding: 6px 30px 6px 14px; border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; transition: border-color 140ms ease; }
.cur:hover{ border-color: var(--ink); }
.cur::after{ content: ""; position: absolute; right: 13px; top: 50%; width: 6px; height: 6px; margin-top: -5px; border-right: 1.8px solid currentColor; border-bottom: 1.8px solid currentColor; transform: rotate(45deg); pointer-events: none; }
.cur__k{ font-family: var(--font-display); font-size: 0.6rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.cur__v{ font-family: var(--font-mono); font-weight: 700; font-size: 0.95rem; }
.cur select{ position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 16px; border: 0; }
.cur select option{ color: #111; background: #fff; }
.cur:focus-within{ border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* segmented */
.seg{ display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--radius-pill); background: var(--surface-2); border: 1px solid var(--line); }
.seg button{ appearance: none; border: 0; background: transparent; min-height: 40px; min-width: 56px; padding: 6px 14px; border-radius: var(--radius-pill); font-family: var(--font-mono); font-size: 0.82rem; font-weight: 600; color: var(--muted); cursor: pointer; transition: background 140ms ease, color 140ms ease; }
.seg button[aria-pressed="true"]{ background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg button:focus-visible{ outline: 2px solid var(--accent); }

/* ---------- Rooms ---------- */
.rooms{ list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.room{
  position: relative; padding: 12px 12px 14px;
  border: 1.5px solid var(--line); border-radius: 14px;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.room.is-sel{ border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.room.is-new{ animation: room-in 420ms cubic-bezier(.2, 1.2, .4, 1) both; }
.room.is-flash{ animation: room-flash 900ms ease both; }
@keyframes room-in{ from{ opacity: 0; transform: translateY(-8px) scale(0.98); } to{ opacity: 1; transform: none; } }
@keyframes room-flash{ 0%{ box-shadow: 0 0 0 0 var(--accent-soft); } 30%{ box-shadow: 0 0 0 8px var(--accent-soft); } 100%{ box-shadow: 0 0 0 3px var(--accent-soft); } }
.room__head{ display: flex; align-items: center; gap: 10px; }
.rtag{ flex: 0 0 auto; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 1.6px solid currentColor; font-family: var(--font-mono); font-weight: 700; font-size: 0.82rem; color: var(--accent); }
.room__name{ flex: 1 1 auto; width: 100%; font-family: var(--font-hand); font-size: 1.12rem; padding: 8px 12px; min-height: 44px; }
.room__x{ flex: 0 0 auto; width: 44px; height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 1.35rem; line-height: 1; cursor: pointer; }
.room__x:hover{ color: var(--warn); background: var(--warn-soft); }
.room__x:focus-visible{ outline: 2px solid var(--accent); }
.room__x:disabled{ opacity: 0.25; cursor: not-allowed; background: none; }
.room__row{ margin-top: 10px; display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.room__row .field--area{ flex: 1 1 130px; max-width: 200px; }
.stepper{ display: inline-flex; align-items: center; gap: 2px; align-self: flex-start; padding: 0 2px; min-height: 46px; border: 1.5px solid var(--line-strong); border-radius: var(--radius-pill); background: var(--surface); }
.stepper__b{ width: 42px; height: 42px; border: 0; border-radius: 50%; background: transparent; font-size: 1.2rem; font-weight: 700; cursor: pointer; transition: background 120ms ease; }
.stepper__b:hover{ background: var(--surface-2); }
.stepper__b:focus-visible{ outline: 2px solid var(--accent); }
.stepper__b:disabled{ opacity: 0.3; cursor: not-allowed; }
.stepper output{ min-width: 22px; text-align: center; font-family: var(--font-mono); font-weight: 700; font-size: 1rem; }

.feats{ margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.feat{
  appearance: none; display: inline-flex; align-items: center; gap: 7px;
  min-height: 44px; padding: 6px 13px; max-width: 100%;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-pill); background: var(--surface);
  font-size: 0.84rem; font-weight: 600; color: var(--muted); cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}
.feat__p{ font-family: var(--font-mono); font-size: 0.74rem; font-weight: 600; opacity: 0.75; }
.feat__p:empty{ display: none; }
.feat::before{ content: ""; width: 9px; height: 9px; border-radius: 2px; border: 1.5px solid currentColor; opacity: 0.6; transition: background 140ms ease; }
.feat[aria-pressed="true"]{ border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.feat[aria-pressed="true"]::before{ background: var(--accent); border-color: var(--accent); opacity: 1; }
.feat[aria-pressed="true"] .feat__p{ color: var(--accent); opacity: 1; }
.feat--minus[aria-pressed="true"]{ border-color: var(--minus); background: var(--minus-soft); }
.feat--minus[aria-pressed="true"]::before{ background: var(--minus); border-color: var(--minus); }
.feat--minus[aria-pressed="true"] .feat__p{ color: var(--minus); }
.feat:hover{ border-color: var(--ink); color: var(--ink); }
.feat:active{ transform: scale(0.97); }
.feat:focus-visible{ outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 5px var(--accent); }

/* ---------- Rules ---------- */
.ratio{ display: grid; gap: 10px; }
.ratio__bar{ position: relative; height: 12px; border-radius: 999px; overflow: hidden; background: repeating-linear-gradient(-45deg, var(--surface-2) 0 5px, var(--line) 5px 6px); border: 1px solid var(--line-strong); }
.ratio__bar i{ position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-right: 2px solid var(--surface); transition: width 200ms ease; }
.ratio__label{ font-size: 0.95rem; color: var(--muted); }
.ratio__label b{ font-family: var(--font-mono); color: var(--ink); }
.ratio input[type="range"]{ width: 100%; margin: 0; height: 44px; background: transparent; accent-color: var(--accent); cursor: pointer; }
.ratio input[type="range"]:focus-visible{ outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.presets{ display: flex; flex-wrap: wrap; gap: 6px; }
.preset{ appearance: none; min-height: 40px; padding: 6px 14px; border: 1.5px solid var(--line-strong); border-radius: var(--radius-pill); background: var(--surface); font-size: 0.82rem; font-weight: 600; color: var(--muted); cursor: pointer; transition: border-color 140ms ease, color 140ms ease, background 140ms ease; }
.preset:hover{ border-color: var(--ink); color: var(--ink); }
.preset[aria-pressed="true"]{ border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }
.preset:focus-visible{ outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 5px var(--accent); }
.preset[hidden]{ display: none; }
.ratio__why{ margin: 2px 0 0; font-size: 0.86rem; line-height: 1.5; color: var(--muted); }

.prices{ margin-top: 20px; padding-top: 16px; border-top: 1px dashed var(--line-strong); }
.prices__k{ margin: 0 0 8px; font-family: var(--font-display); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.prices__list{ list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.price{ display: grid; grid-template-columns: minmax(0, 1fr) 128px 46px; align-items: center; gap: 8px; padding: 4px 0; }
.price__label{ display: flex; flex-direction: column; min-width: 0; }
.price__name{ font-size: 0.9rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.price__used{ font-family: var(--font-mono); font-size: 0.7rem; color: var(--accent); }
.price--minus .price__used{ color: var(--minus); }
.price__used:empty{ display: none; }
.price:not(.is-used) .price__name{ color: var(--muted); }
.amt--price{ min-height: 42px; padding: 0 10px; gap: 2px; }
.amt--price input, .amt--price input:focus{ min-height: 39px; font-size: 0.92rem; text-align: right; }
.price__sign{ color: var(--accent); }
.price--minus .price__sign{ color: var(--minus); }
.price__auto{ justify-self: center; font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.price__auto[hidden]{ display: none; }
.price__reset{ justify-self: center; padding: 6px 2px; font-size: 0.78rem; }
.price.is-custom .amt{ border-color: color-mix(in srgb, var(--accent) 55%, var(--line-strong)); }

/* ---------- The sheet ---------- */
.drafting{
  position: relative; min-width: 0;
  padding: 0;
  border-radius: 4px;
  background:
    linear-gradient(var(--pl-grid-2) 1px, transparent 1px) 0 0 / 100px 100px,
    linear-gradient(90deg, var(--pl-grid-2) 1px, transparent 1px) 0 0 / 100px 100px,
    linear-gradient(var(--pl-grid) 1px, transparent 1px) 0 0 / 20px 20px,
    linear-gradient(90deg, var(--pl-grid) 1px, transparent 1px) 0 0 / 20px 20px,
    radial-gradient(120% 90% at 40% 30%, var(--pl-bg), var(--pl-bg-2));
  box-shadow: var(--pl-shadow);
  color: var(--pl-ink);
}
.drafting::before, .drafting::after{
  content: ""; position: absolute; top: -9px; width: 74px; height: 22px; pointer-events: none; z-index: 1;
  background: var(--pl-tape);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  mix-blend-mode: multiply;
}
:root[data-theme="dark"] .drafting::before, :root[data-theme="dark"] .drafting::after{ mix-blend-mode: normal; }
.drafting::before{ left: 18px; transform: rotate(-4deg); }
.drafting::after{ right: 18px; transform: rotate(3deg); }
.drafting__svg{ display: block; width: 100%; height: auto; overflow: visible; }

.pl text{ fill: var(--pl-ink); }
.pl-frame{ fill: none; stroke: var(--pl-ink); }
.pl-head{ font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: 0.16em; fill: var(--pl-ink); }
.pl-head--r{ fill: var(--pl-thin) !important; }
.pl-tiny{ font-family: var(--font-mono); font-size: 8px; font-weight: 700; letter-spacing: 0.08em; }
.pl-thin{ fill: none; stroke: var(--pl-thin); stroke-linecap: round; stroke-linejoin: round; }
.pl-ink{ fill: none; stroke: var(--pl-ink); stroke-linecap: round; }
.pl-fillink{ fill: var(--pl-ink); }
.pl-dash{ fill: none; stroke: var(--pl-thin); stroke-dasharray: 3 2.5; }
.pl-dash--long{ stroke-dasharray: 7 3 1.5 3; stroke: var(--pl-accent); }
.pl-ray{ fill: none; stroke: var(--pl-ray); stroke-dasharray: 2 3; stroke-linecap: round; }
.pl-light{ fill: var(--pl-ray); opacity: 0.1; }
.pl-noise{ fill: none; stroke: var(--pl-noise); stroke-linecap: round; }
.pl-balc{ fill: var(--pl-common); stroke: var(--pl-ink); }
.pl-counter{ fill: var(--pl-pad); stroke: var(--pl-ink); }
.pl-furn{ fill: none; stroke: var(--pl-faint); }
.pl-fixt{ fill: var(--pl-bg); stroke: var(--pl-thin); }
.pl-wall{ stroke: var(--pl-ink); }
.pl-room{ fill: transparent; transition: fill 160ms ease; }
.pl-room--common{ fill: var(--pl-common); }
.pl-room--pad{ fill: var(--pl-pad); }
.pl-room.is-sel{ fill: var(--pl-sel); }
.pl-lbl{ font-family: var(--font-mono); font-weight: 600; letter-spacing: 0.14em; fill: var(--pl-thin) !important; }
.pl-sub{ font-family: var(--font-mono); font-weight: 500; letter-spacing: 0.06em; fill: var(--pl-thin) !important; }
.pl-name{ font-family: var(--font-hand); font-size: 15px; }
.pl-rent{ font-family: var(--font-mono); font-weight: 700; letter-spacing: -0.01em; }
.pl-rent.is-bump{ animation: pl-bump 700ms ease both; }
@keyframes pl-bump{ 0%{ fill: var(--pl-accent); } 100%{ fill: var(--pl-ink); } }
.pl-tag{ fill: none; stroke: var(--pl-accent); }
.pl-tagt{ font-family: var(--font-mono); font-weight: 700; fill: var(--pl-accent) !important; }
.pl-note{ font-family: var(--font-mono); font-size: 8.5px; font-weight: 500; letter-spacing: 0.12em; fill: var(--pl-thin) !important; }
.pl-tbk{ font-family: var(--font-mono); font-size: 7.5px; font-weight: 600; letter-spacing: 0.18em; fill: var(--pl-thin) !important; }
.pl-tbv{ font-family: var(--font-mono); font-weight: 700; letter-spacing: 0.02em; }
.pl-tbv--hand{ font-family: var(--font-hand); font-weight: 400; letter-spacing: 0; }
.pl-hit{ fill: transparent; cursor: pointer; outline: none; transition: fill 140ms ease; }
.pl-hit.is-hover, .pl-hit:hover{ fill: var(--pl-hover); }
.pl-hit:focus-visible{ fill: var(--pl-hover); stroke: var(--pl-accent); stroke-width: 2; stroke-dasharray: 5 3; }
.pl-cell.is-new{ animation: pl-in 700ms ease both; }
@keyframes pl-in{ from{ opacity: 0; } to{ opacity: 1; } }

/* ---------- Who pays what ---------- */
.verdict{ margin: 0 0 14px; font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; line-height: 1.35; text-wrap: pretty; }
.verdict:empty{ display: none; }
.verdict.is-warn{ color: var(--warn); }
.who{ list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.whoi{ padding: 12px 14px 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); cursor: pointer; transition: border-color 160ms ease, box-shadow 160ms ease; }
.whoi.is-sel{ border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.whoi__top{ display: flex; align-items: center; gap: 10px; }
.whoi__name{ flex: 1 1 auto; min-width: 0; font-family: var(--font-hand); font-size: 1.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whoi__amt{ flex: 0 0 auto; font-family: var(--font-mono); font-weight: 700; font-size: 1.25rem; letter-spacing: -0.01em; }
.whoi__each{ margin: 2px 0 0 40px; font-family: var(--font-mono); font-size: 0.8rem; font-weight: 600; color: var(--accent); text-align: right; }
.whoi__why{ margin: 8px 0 0; font-size: 0.88rem; line-height: 1.5; color: var(--ink); }
.whoi__math{ margin: 8px 0 0; padding: 8px 0 0; border-top: 1px dashed var(--line-strong); display: grid; gap: 3px; font-family: var(--font-mono); font-size: 0.76rem; }
.whoi__math div{ display: flex; align-items: baseline; gap: 8px; }
.whoi__math dt{ flex: 1 1 auto; min-width: 0; color: var(--muted); display: flex; gap: 6px; }
.whoi__math dt::after{ content: ""; flex: 1 1 auto; min-width: 12px; border-bottom: 1px dotted var(--line-strong); transform: translateY(-4px); }
.whoi__math dd{ margin: 0; flex: 0 0 auto; font-weight: 600; }
.whoi__math .is-plus dd{ color: var(--accent); }
.whoi__math .is-minus dd{ color: var(--minus); }
.whoi__vs{ margin: 8px 0 0; font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.whoi__vs.is-more{ color: var(--accent); }
.whoi__vs.is-less{ color: var(--minus); }
.check{ margin: 14px 0 0; display: flex; align-items: center; gap: 10px; font-size: 0.88rem; font-weight: 600; }
.check[hidden]{ display: none; }
.check__mark{ display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--surface); font-size: 0.8rem; font-weight: 800; }

/* ---------- Link + summary ---------- */
.linkbar{ margin-top: 14px; display: flex; flex-wrap: wrap; gap: 10px; }
.linknote{ margin: 12px 0 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 0.82rem; line-height: 1.5; color: var(--muted); }
.linknote[hidden]{ display: none; }
.summary{ margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line-strong); }
.summary__k{ margin: 0 0 8px; font-family: var(--font-display); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.summary__text{
  margin: 0 0 12px; padding: 12px 14px; max-height: 240px; overflow: auto;
  border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere;
  color: var(--ink);
}
.summary__text:focus-visible{ outline: 2px solid var(--accent); }

/* ---------- Toast ---------- */
.toast{
  position: fixed; z-index: 2147483100; left: 50%; bottom: max(18px, calc(env(safe-area-inset-bottom) + 12px));
  transform: translate(-50%, 20px); opacity: 0;
  display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px);
  padding: 8px 8px 8px 18px; min-height: 48px;
  border-radius: var(--radius-pill); background: #18202c; color: #eef2f7;
  box-shadow: 0 14px 34px rgba(0,0,0,0.3); font-size: 0.9rem; font-weight: 600;
  transition: transform 240ms cubic-bezier(.2, 1.2, .4, 1), opacity 200ms ease;
}
:root[data-theme="dark"] .toast{ background: #e6ecf4; color: #0e1522; }
.toast[hidden]{ display: none; }
.toast.is-on{ transform: translate(-50%, 0); opacity: 1; }
.toast__undo{ min-height: 36px; padding: 6px 14px; border: 0; border-radius: var(--radius-pill); background: rgba(255,255,255,0.14); color: inherit; font-weight: 800; cursor: pointer; }
:root[data-theme="dark"] .toast__undo{ background: rgba(0,0,0,0.1); }
.toast__undo[hidden]{ display: none; }
.toast__undo:focus-visible{ outline: 2px solid currentColor; }

.backlink{ font-family: var(--font-display); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); text-decoration: none; border-bottom: 1px solid transparent; padding: 10px 0; transition: color 140ms ease, border-color 140ms ease; }
.backlink:hover{ color: var(--ink); border-bottom-color: var(--accent); }
.backlink:focus-visible{ outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 520px){
  .rentrow{ flex-wrap: wrap; }
  .rentrow .field--grow{ flex: 1 1 100%; }
  .rentrow--2 .field--area{ flex: 1 1 100%; }
  .rentrow .cur{ min-height: 50px; }
  .rentrow--1{ flex-wrap: nowrap !important; }
  .rentrow--1 .field--grow{ flex: 1 1 auto !important; }
  .price{ grid-template-columns: minmax(0, 1fr) 112px 42px; gap: 6px; }
  .feats{ display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; }
  .feat{ display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; justify-items: start; column-gap: 8px; row-gap: 1px; padding: 6px 10px; border-radius: 12px; font-size: 0.8rem; text-align: left; line-height: 1.2; }
  .feat::before{ grid-row: 1 / span 2; }
  .feat__name{ min-width: 0; }
  .feat__p{ grid-column: 2; }
  .whoi__amt{ font-size: 1.1rem; }
  .whoi__math{ font-size: 0.72rem; }
  .drafting::before, .drafting::after{ width: 56px; height: 18px; top: -7px; }
}
@media (prefers-reduced-motion: reduce){
  .room.is-new, .room.is-flash, .pl-rent.is-bump, .pl-cell.is-new{ animation: none !important; }
  .btn, .iconbtn, .feat, .preset, .toast, .ratio__bar i, .pl-room, .pl-hit{ transition: none; }
}

/* the brand mark is the app icon's sculpted split square (owner, 2026-10-24: every use of the logo the same) */
.brand__mark{ width: 1.35em !important; height: 1.35em !important; border: 0 !important; border-radius: 0 !important;
  background: url("../../assets/brand-mark-64.png") center / contain no-repeat !important; }
