:root {
  --ink: #173042;
  --muted: #60717c;
  --line: #d5dfe5;
  --paper: #f7f4ee;
  --surface: #ffffff;
  --surface-soft: #edf3f5;
  --accent: #2c6573;
  --accent-dark: #214e5a;
  --accent-soft: #dcecef;
  --warm: #b7834f;
  --success: #2d6a4f;
  --warning: #9a5c14;
  --danger: #9c3434;
  --shadow: 0 12px 32px rgba(26, 48, 61, 0.10);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); }
button, input, select { font: inherit; }
button { color: inherit; }
img { max-width: 100%; display: block; }
.shell { width: min(1440px, calc(100% - 40px)); margin-inline: auto; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(247, 244, 238, 0.93);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(43, 70, 85, 0.12);
}
.header-inner { height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-weight: 760; letter-spacing: -0.02em; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--accent); color: white; }
.brand-mark svg { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 2; }

.button { border: 0; border-radius: 12px; padding: 11px 17px; font-weight: 700; cursor: pointer; transition: transform .16s ease, background .16s ease, box-shadow .16s ease; }
.button:hover { transform: translateY(-1px); }
.button:focus-visible, .method-card:focus-visible, input:focus-visible, select:focus-visible, .count-control button:focus-visible, .unit-toggle button:focus-visible { outline: 3px solid rgba(44, 101, 115, .28); outline-offset: 2px; }
.button-primary { background: var(--accent); color: white; box-shadow: 0 7px 18px rgba(44, 101, 115, .21); }
.button-primary:hover { background: var(--accent-dark); }
.button-secondary { background: var(--accent-soft); color: var(--accent-dark); }
.button-ghost { background: transparent; color: var(--accent-dark); }
.text-button { border: 0; background: transparent; color: var(--accent); font-weight: 700; cursor: pointer; padding: 6px; }

.hero { overflow: hidden; background: linear-gradient(135deg, #eef4f4 0%, #f7f4ee 52%, #eee5da 100%); border-bottom: 1px solid var(--line); }
.hero-grid { min-height: 520px; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(440px, .95fr); align-items: center; gap: 70px; padding-block: 72px; }
.eyebrow { margin: 0 0 9px; color: var(--accent); font-size: .78rem; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3, p { text-wrap: pretty; }
h1 { margin: 0; max-width: 760px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.65rem, 5vw, 5.35rem); line-height: .98; letter-spacing: -.045em; font-weight: 600; }
.hero-lead { max-width: 700px; margin: 26px 0 0; color: var(--muted); font-size: 1.14rem; line-height: 1.65; }
.hero-actions { margin-top: 30px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.hero-note { max-width: 310px; color: var(--muted); font-size: .9rem; }
.hero-art { position: relative; height: 390px; }
.hero-frame { position: absolute; padding: 12px; background: #40362d; box-shadow: 0 22px 55px rgba(28, 39, 44, .26); }
.hero-frame img { width: 100%; height: 100%; object-fit: cover; border: 6px solid #e8ddc6; }
.hero-frame-wide { width: 62%; height: 61%; left: 1%; top: 16%; transform: rotate(-2deg); }
.hero-frame-tall { width: 42%; height: 74%; right: 3%; top: 5%; transform: rotate(2.2deg); }
.hero-frame-tall img { object-position: 50% 52%; }
.hero-level { position: absolute; left: 0; right: 0; top: 49%; display: flex; align-items: center; gap: 10px; color: var(--accent-dark); font-size: .77rem; text-transform: uppercase; letter-spacing: .08em; }
.hero-level span { height: 1px; flex: 1; background: currentColor; opacity: .55; }
.hero-level b { padding: 5px 8px; background: rgba(247,244,238,.85); border-radius: 6px; }

.method-section, .guide-section, .credits-section { padding-block: 82px; }
.section-heading { max-width: 820px; margin-bottom: 30px; }
.section-heading h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 3.5vw, 3.35rem); line-height: 1.06; font-weight: 600; letter-spacing: -.035em; }
.section-heading > p:last-child { margin: 13px 0 0; color: var(--muted); line-height: 1.6; }
.method-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.method-card { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 0; overflow: hidden; text-align: left; cursor: pointer; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.method-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.method-card.is-selected { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(44, 101, 115, .14), var(--shadow); }
.method-image { display: block; position: relative; height: 180px; overflow: hidden; background: #e3e9e8; }
.method-image > img { width: 100%; height: 100%; object-fit: cover; }
.method-line { position: absolute; left: 7%; right: 7%; height: 2px; background: white; box-shadow: 0 0 0 1px rgba(23,48,66,.25); }
.method-line::after { content: ""; position: absolute; right: 0; top: -4px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.method-line-centre { top: 50%; }
.method-line-top { top: 18%; }
.method-image-pair { display: grid; grid-template-columns: 1.25fr .75fr; gap: 10px; align-items: start; padding: 32px 20px 18px; }
.method-image-pair > span { display: block; height: 110px; padding: 5px; background: #45382e; }
.method-image-pair > span:nth-child(2) { height: 135px; }
.method-image-pair img { width: 100%; height: 100%; object-fit: cover; }
.portrait-crop img { object-position: 50% 40%; }
.furniture-example { padding: 20px 36px 0; }
.furniture-example img { height: 98px; border: 7px solid #45382e; object-fit: cover; }
.mini-sideboard { display: block; position: absolute; left: 24px; right: 24px; bottom: 0; height: 42px; border-radius: 3px 3px 0 0; background: #9a7657; box-shadow: inset 0 7px rgba(255,255,255,.14); }
.mini-sideboard::before, .mini-sideboard::after { content:""; position:absolute; bottom:-10px; width:6px; height:15px; background:#765439; }
.mini-sideboard::before { left:16px; } .mini-sideboard::after { right:16px; }
.free-example { position: relative; }
.free-frame { position: absolute; display: block; border: 7px solid #47392d; background: #9db7b0; box-shadow: 0 6px 10px rgba(0,0,0,.14); }
.free-a { width: 43%; height: 45%; left: 8%; top: 15%; transform: rotate(-3deg); }
.free-b { width: 29%; height: 62%; right: 10%; top: 10%; transform: rotate(2deg); background:#d0b18d; }
.free-c { width: 35%; height: 31%; left: 24%; bottom: 8%; transform: rotate(1deg); background:#8298aa; }
.method-body { display: block; padding: 18px; }
.method-body strong { display: block; font-size: 1.05rem; }
.method-body small { display: block; margin-top: 6px; color: var(--muted); line-height: 1.45; font-size: .88rem; }

.planner-section { padding-block: 82px; background: #eaf0f1; border-block: 1px solid var(--line); }
.planner-heading { margin-bottom: 28px; }
.planner-layout { display: grid; grid-template-columns: minmax(390px, .82fr) minmax(580px, 1.35fr); gap: 24px; align-items: start; }
.controls-column { display: grid; gap: 18px; }
.control-card, .results-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: 0 8px 22px rgba(25,48,63,.055); }
.card-heading, .results-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.card-heading > div, .results-heading > div:first-child { display: flex; align-items: center; gap: 10px; }
.card-heading h3, .results-heading h3, .preview-toolbar h3 { margin: 0; font-size: 1.12rem; }
.step-number { display: inline-grid; place-items: center; min-width: 29px; height: 29px; border-radius: 50%; background: var(--accent); color: white; font-weight: 800; font-size: .84rem; }
.mini-help { color: var(--muted); font-size: .78rem; text-align: right; }
.field-grid { display: grid; gap: 13px; }
.two-columns { grid-template-columns: repeat(2, minmax(0,1fr)); }
.three-columns { grid-template-columns: repeat(3, minmax(0,1fr)); }
.compact-top { margin-top: 14px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field > span, .measurement-field > label > span { color: #425965; font-size: .82rem; font-weight: 750; }
.field input, .field select, .measurement-control input, .measurement-control select { width: 100%; min-width: 0; border: 1px solid #c8d4da; background: #fbfcfc; color: var(--ink); border-radius: 10px; padding: 10px 11px; }
.measurement-field > label { display: grid; gap: 7px; }
.measurement-control { display: grid; grid-template-columns: minmax(0, 1fr) 64px; }
.measurement-control input { border-radius: 10px 0 0 10px; }
.measurement-control select { border-left: 0; border-radius: 0 10px 10px 0; padding-inline: 8px; background: #edf3f5; font-weight: 700; }
.count-control { display: grid; grid-template-columns: 40px minmax(0,1fr) 40px; }
.count-control button { border: 1px solid #c8d4da; background: #edf3f5; cursor: pointer; font-size: 1.2rem; font-weight: 800; }
.count-control button:first-child { border-radius: 10px 0 0 10px; }
.count-control button:last-child { border-radius: 0 10px 10px 0; }
.count-control input { border-radius: 0; text-align: center; border-inline: 0; }
.method-fields, .furniture-fields { padding-top: 15px; border-top: 1px dashed var(--line); margin-top: 15px; }
.furniture-fields { display: grid; gap: 13px; }
.wire-guide { display: grid; grid-template-columns: 180px 1fr; gap: 15px; align-items: center; border-radius: 13px; background: var(--surface-soft); padding: 12px; margin-bottom: 14px; }
.wire-guide svg { width: 100%; height: 88px; fill: none; stroke: var(--accent-dark); stroke-width: 2; }
.wire-guide text { fill: var(--accent-dark); stroke: none; font-size: 12px; font-weight: 700; }
.wire-guide p { margin: 0; color: var(--muted); font-size: .84rem; line-height: 1.5; }
.frame-inputs { display: grid; gap: 10px; }
.frame-input-card { border: 1px solid var(--line); border-radius: 13px; overflow: hidden; }
.frame-input-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; background: #f5f7f7; }
.frame-input-header strong { font-size: .9rem; }
.frame-orientation { color: var(--muted); font-size: .73rem; }
.frame-input-body { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; padding: 11px; }
.frame-input-body .measurement-control { grid-template-columns: minmax(0,1fr) 52px; }
.frame-input-body .measurement-control input, .frame-input-body .measurement-control select { padding: 8px; font-size: .88rem; }
.frame-input-body .measurement-field > label > span { font-size: .72rem; }

.preview-column { min-width: 0; }
.preview-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 13px; }
.preview-toolbar p { margin: 5px 0 0; color: var(--muted); font-size: .86rem; }
.toolbar-actions { display: flex; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.status-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 13px; color: var(--muted); font-size: .82rem; }
.status-badge { display: inline-flex; padding: 6px 9px; border-radius: 999px; background: #dcefe5; color: var(--success); font-weight: 800; }
.status-badge.is-warning { background: #f5e8d6; color: var(--warning); }
.status-badge.is-danger { background: #f4dddd; color: var(--danger); }
.wall-stage-wrap { position: relative; padding: 29px 15px 14px 42px; border: 1px solid #ccd7dc; border-radius: var(--radius); background: #dce5e7; overflow: hidden; }
.wall-stage { display: block; width: 100%; height: auto; max-height: 670px; background: white; touch-action: none; user-select: none; box-shadow: 0 14px 30px rgba(25,48,63,.12); }
#wallBackground { fill: #fcfbf8; stroke: #889ba4; stroke-width: 2; }
#wallGrid { color: #59717c; }
#floorLine { stroke: #566b75; stroke-width: 3; }
.guide-line { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 9 7; opacity: .72; }
.guide-label-bg { fill: rgba(255,255,255,.92); stroke: var(--accent); stroke-width: 1; }
.guide-label { fill: var(--accent-dark); font-size: 13px; font-weight: 800; }
.furniture-shape { fill: #a98464; stroke: #6d523c; stroke-width: 2; }
.furniture-detail { stroke: #765841; stroke-width: 2; opacity: .65; }
.frame-group { cursor: grab; }
.frame-group:active { cursor: grabbing; }
.frame-border { fill: #46392f; stroke: #2d241f; stroke-width: 1.5; filter: url(#frameShadow); }
.frame-mat { fill: #eee4d1; }
.frame-art { stroke: rgba(23,48,66,.35); stroke-width: 1; }
.frame-art.art-1 { fill: #7fa2a5; }
.frame-art.art-2 { fill: #c4a47f; }
.frame-art.art-3 { fill: #758f78; }
.frame-art.art-4 { fill: #9d86a1; }
.frame-art.art-5 { fill: #a0a9bc; }
.frame-art-stroke { stroke: rgba(255,255,255,.38); stroke-width: 5; fill: none; stroke-linecap: round; }
.frame-label-bg { fill: rgba(255,255,255,.92); stroke: rgba(23,48,66,.22); stroke-width: 1; }
.frame-label { fill: var(--ink); font-size: 12px; font-weight: 800; text-anchor: middle; pointer-events: none; }
.nail-dot { fill: #b13f3f; stroke: white; stroke-width: 2; pointer-events: none; }
.nail-cross { stroke: #7d2525; stroke-width: 1.5; pointer-events: none; }
.wall-ruler { position: absolute; color: #5e737d; font-size: .68rem; }
.wall-ruler-top { top: 7px; left: 42px; right: 15px; display: flex; justify-content: space-between; }
.wall-ruler-side { top: 29px; bottom: 14px; left: 8px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; }
.drag-tip { position: absolute; right: 24px; bottom: 24px; pointer-events: none; border-radius: 999px; padding: 7px 10px; background: rgba(23,48,66,.86); color: white; font-size: .75rem; transition: opacity .2s ease; }
.drag-tip.is-hidden { opacity: 0; }
.results-panel { margin-top: 16px; }
.results-note { margin: -4px 0 14px; color: var(--muted); font-size: .84rem; }
.unit-toggle { display: inline-grid !important; grid-template-columns: 1fr 1fr; gap: 0 !important; border: 1px solid #c6d2d8; border-radius: 9px; overflow: hidden; }
.unit-toggle button { border: 0; background: white; padding: 7px 10px; cursor: pointer; font-size: .78rem; font-weight: 800; }
.unit-toggle button.is-active { background: var(--accent); color: white; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .84rem; }
th { padding: 9px 10px; color: #4d626d; background: #eef3f4; text-align: left; white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid #e2e8eb; white-space: nowrap; }
td:first-child { font-weight: 800; }
.warnings { display: grid; gap: 8px; margin-top: 12px; }
.warning-item { border-left: 4px solid var(--warning); border-radius: 7px; padding: 9px 11px; background: #fbf1e4; color: #744712; font-size: .82rem; line-height: 1.45; }
.warning-item.danger { border-left-color: var(--danger); background: #f8e8e8; color: #7f2929; }

.guide-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }
.guide-grid article { padding: 24px; border-top: 3px solid var(--accent); background: rgba(255,255,255,.56); }
.guide-grid article > span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark); font-weight: 850; }
.guide-grid h3 { margin: 17px 0 7px; }
.guide-grid p { margin: 0; color: var(--muted); line-height: 1.6; }
.credits-section { padding-top: 0; }
details { border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.58); }
summary { cursor: pointer; padding: 16px 18px; font-weight: 750; }
.credits-copy { padding: 0 18px 18px; color: var(--muted); font-size: .87rem; line-height: 1.6; }
.credits-copy ul { margin-block: 8px; }
footer { background: var(--ink); color: rgba(255,255,255,.76); }
.footer-inner { min-height: 92px; display: flex; justify-content: space-between; gap: 30px; align-items: center; font-size: .78rem; }
.footer-inner span:last-child { max-width: 650px; text-align: right; }

@media (max-width: 1180px) {
  .hero-grid { grid-template-columns: 1fr .85fr; gap: 34px; }
  .method-grid { grid-template-columns: repeat(2,1fr); }
  .planner-layout { grid-template-columns: 1fr; }
  .controls-column { grid-template-columns: repeat(2,minmax(0,1fr)); align-items: start; }
  .preview-column { grid-column: 1 / -1; }
}

@media (max-width: 820px) {
  .shell { width: min(100% - 26px, 1440px); }
  .header-help { display: none; }
  .hero-grid { min-height: auto; grid-template-columns: 1fr; padding-block: 54px 38px; }
  .hero-art { height: 320px; max-width: 590px; width: 100%; margin-inline: auto; }
  .method-section, .guide-section, .credits-section, .planner-section { padding-block: 58px; }
  .controls-column { grid-template-columns: 1fr; }
  .preview-toolbar { align-items: flex-start; flex-direction: column; }
  .toolbar-actions { width: 100%; justify-content: stretch; }
  .toolbar-actions .button { flex: 1; }
  .guide-grid { grid-template-columns: 1fr; }
  .footer-inner { padding-block: 22px; flex-direction: column; align-items: flex-start; }
  .footer-inner span:last-child { text-align: left; }
}

@media (max-width: 590px) {
  .brand { font-size: .92rem; }
  .hero-art { height: 255px; }
  .hero-frame { padding: 7px; }
  .hero-frame img { border-width: 4px; }
  .hero-level b { font-size: .6rem; }
  .method-grid { grid-template-columns: 1fr; }
  .method-image { height: 160px; }
  .two-columns, .three-columns { grid-template-columns: 1fr; }
  .frame-input-body { grid-template-columns: 1fr; }
  .wire-guide { grid-template-columns: 115px 1fr; }
  .wall-stage-wrap { padding: 24px 8px 9px 32px; border-radius: 13px; }
  .wall-ruler-top { left: 32px; right: 8px; }
  .wall-ruler-side { top: 24px; bottom: 9px; left: 5px; }
  .drag-tip { right: 15px; bottom: 16px; font-size: .66rem; }
  .control-card, .results-panel { padding: 16px; }
  .card-heading { align-items: flex-start; }
  .mini-help { max-width: 135px; }
  h1 { font-size: 2.55rem; }
}

@media print {
  .site-header, .hero, .method-section, .controls-column, .preview-toolbar, .guide-section, .credits-section, footer, .drag-tip, .button { display: none !important; }
  body, .planner-section { background: white; }
  .planner-section { padding: 0; border: 0; }
  .planner-heading { display: none; }
  .shell { width: 100%; }
  .planner-layout { display: block; }
  .wall-stage-wrap, .results-panel { break-inside: avoid; box-shadow: none; }
}
.landing-choice-bar {
  margin: 0 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255,255,255,.62);
  padding: 14px 16px;
}
.landing-choice-bar > div:first-child { display: grid; gap: 3px; }
.landing-choice-bar strong { font-size: .95rem; }
.landing-choice-bar span { color: var(--muted); font-size: .8rem; }
.landing-count-control { width: 180px; flex: 0 0 auto; }
@media (max-width: 590px) {
  .landing-choice-bar { align-items: stretch; flex-direction: column; }
  .landing-count-control { width: 100%; }
}
