:root {
  --navy: #061d29;
  --navy-2: #0b2b38;
  --gold: #d39a35;
  --sand: #ead8b2;
  --paper: #f5f0e5;
  --ink: #172730;
  --green: #799b1b;
  --line: rgba(211,154,53,.48);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Arial, Helvetica, sans-serif;
  color: var(--paper);
  background:
    radial-gradient(circle at 15% 10%, rgba(211,154,53,.13), transparent 28rem),
    linear-gradient(145deg, #04131c, var(--navy) 55%, #031018);
}
button, input, select { font: inherit; }
button { cursor: pointer; }

.screen { display: none; min-height: 100vh; padding: 28px 22px 112px; }
.screen.active { display: block; animation: reveal .25s ease; }
@keyframes reveal { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.hero, .room-head, .workbench, .document {
  width: min(1080px, 100%);
  margin-inline: auto;
}
.hero { min-height: 80vh; display: grid; align-content: center; gap: 24px; text-align: center; }
.hero-logo { width: min(390px, 82vw); max-height: 260px; object-fit: contain; margin: 0 auto 4px; filter: drop-shadow(0 15px 24px #0008); }
.eyebrow { margin: 0; color: var(--gold); text-transform: uppercase; letter-spacing: .18em; font-weight: 700; font-size: .78rem; }
h1, h2, h3 { font-family: Georgia, 'Times New Roman', serif; }
h1 { margin: 0; font-size: clamp(2.4rem, 8vw, 5rem); line-height: .98; }
h2 { margin: 4px 0 8px; font-size: clamp(2rem, 6vw, 3.8rem); }
h3 { margin: 0 0 12px; color: var(--gold); font-size: 1.2rem; }
.lead { max-width: 720px; margin: 0 auto; color: #d9e0df; line-height: 1.55; font-size: 1.05rem; }

.portal-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; width: min(880px,100%); margin: 10px auto 0; }
.portal {
  border: 1px solid var(--line); border-radius: 22px; padding: 25px 22px; min-height: 150px;
  color: white; text-align: left; background: linear-gradient(145deg, rgba(255,255,255,.10), rgba(255,255,255,.025));
  box-shadow: inset 0 1px #fff2, 0 14px 35px #0004; backdrop-filter: blur(8px);
  display: grid; grid-template-columns: auto minmax(0,1fr); grid-template-rows: auto auto;
  align-content: center; column-gap: 20px; row-gap: 7px;
}
.portal span {
  grid-row: 1 / 3; align-self: stretch; display: flex; align-items: center;
  padding-right: 18px; border-right: 1px solid rgba(234,216,178,.42);
  color: var(--gold); font-weight: 800; font-size: 1.05rem; letter-spacing: .12em;
}
.portal b { color: var(--sand); font-family: Georgia, serif; font-size: 1.65rem; line-height: 1.12; }
.portal small { color: #c9d3d3; line-height: 1.45; font-size: .92rem; }
.portal:not(.construction):not(.finishes) {
  grid-template-columns: minmax(0,1fr);
  grid-template-rows: auto auto;
  align-content: center;
  row-gap: 12px;
}
.portal:not(.construction):not(.finishes) b,
.portal:not(.construction):not(.finishes) small {
  grid-column: 1;
}
.portal:hover, .portal:focus-visible { transform: translateY(-2px); border-color: var(--gold); }
.portal.construction { background: linear-gradient(145deg, rgba(35,77,91,.88), rgba(7,29,41,.88)); }
.portal.finishes { background: linear-gradient(145deg, rgba(112,74,35,.66), rgba(7,29,41,.88)); }
.legal-link { border: 0; background: transparent; color: #b9c3c2; text-decoration: underline; }
.install-panel { width: min(880px,100%); margin: 22px auto 12px; padding: 20px; border: 1px solid #84672f; border-radius: 18px; background: rgba(255,255,255,.055); text-align: center; }
.install-panel h2 { margin: 0 0 8px; font: 700 1.35rem Georgia,serif; color: var(--sand); }
.install-panel p { margin: 0 0 15px; color: #c9d0cf; line-height: 1.45; }
.install-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.install-actions button { min-height: 48px; }
.install-actions .secondary { border: 1px solid #b4873a; border-radius: 12px; padding: 13px 18px; color: white; background: #173746; font-weight: 800; }
.install-help { margin-top: 15px; padding: 14px; border-radius: 12px; background: #fffaf0; color: #18303b; line-height: 1.5; text-align: left; }
.native-app .install-panel { display: none; }

.room-head { padding: 28px 0 18px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.room-head p { max-width: 780px; color: #ccd6d5; line-height: 1.5; }
.workbench, .document {
  background: linear-gradient(150deg, rgba(247,242,231,.98), rgba(229,220,201,.96));
  color: var(--ink); border: 1px solid #f4dfb5; border-radius: 24px; padding: 24px;
  box-shadow: 0 24px 55px #0007, inset 0 1px white;
}
.two-col { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(280px,.85fr); gap: 22px; }
.fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.field { display: grid; gap: 7px; }
.field label, label.field { font-weight: 700; color: #30414a; }
input, select {
  width: 100%; min-height: 48px; padding: 11px 13px; border: 1px solid #b8b3a7;
  border-radius: 11px; color: #152832; background: #fffefa;
}
input:focus, select:focus { outline: 3px solid rgba(211,154,53,.22); border-color: var(--gold); }
.emphasis { background: #fffaf0; border-left: 5px solid var(--gold); padding: 16px; border-radius: 12px; }
.explain { line-height: 1.55; color: #36464e; }
.explain strong { color: #102a37; }
.primary {
  border: 0; border-radius: 12px; padding: 14px 19px; color: white; font-weight: 800;
  background: linear-gradient(135deg, #98651d, var(--gold)); box-shadow: 0 7px 18px #8b5a2140;
}
.field-note { color: #657177; font-size: .88rem; line-height: 1.45; }
.document { line-height: 1.65; }

.results { display: grid; grid-template-columns: repeat(auto-fit,minmax(175px,1fr)); gap: 12px; margin-top: 18px; }
.result { background: #fffdf7; border: 1px solid #d5c7aa; border-radius: 14px; padding: 15px; }
.result strong { display: block; color: #8b5e1e; font-size: 1.35rem; margin-top: 5px; }
.results li span { margin-right: 4px; }
.results li b { margin-left: 0; }
.simple-result { grid-column: 1 / -1; display: grid; gap: 12px; }
.simple-result h3 { margin: 0; color: #b97817; }
.simple-result ul { list-style: none; display: grid; gap: 0; margin: 0; padding: 0; }
.simple-result li { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: baseline; gap: 18px; padding: 9px 0; border-bottom: 1px solid #ded3bb; }
.simple-result li:last-child { border-bottom: 0; }
.simple-result li b { white-space: nowrap; text-align: right; color: #152832; }
.simple-result .warning { margin: 0; padding-top: 10px; border-top: 1px solid #ded3bb; line-height: 1.45; }

.shape-picker { display: grid; grid-template-columns: repeat(auto-fit,minmax(120px,1fr)); gap: 10px; margin-bottom: 18px; }
.shape-picker button { min-height: 112px; display: grid; grid-template-rows: 48px auto; place-items: center; gap: 12px; border: 1px solid #bca77d; border-radius: 14px; padding: 14px 10px; background: #fffaf0; color: #263740; box-shadow: 0 5px 14px rgba(23,39,48,.10); }
.shape-picker button i { width: 58px; height: 48px; display: grid; place-items: center; color: #1c4b5d; }
.shape-picker button span { display: block; line-height: 1.18; text-align: center; font-weight: 700; }
.shape-picker button:hover,.shape-picker button:focus-visible { border-color: var(--gold); transform: translateY(-2px); }
.shape-picker button.selected { color: white; background: var(--navy-2); border-color: var(--gold); box-shadow: 0 7px 20px rgba(0,0,0,.25); }
.shape-picker button.selected i { color: var(--sand); }
.shape-icon { width: 100%; height: 100%; overflow: visible; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.shape-icon .icon-fill { fill: currentColor; fill-opacity: .13; }
.drawing { min-height: 280px; display: grid; place-items: center; border-radius: 16px; border: 1px dashed #b99a63; background: #efe7d7; padding: 14px 18px; margin-bottom: 16px; color: #34454d; }
.shape-visual { display: grid; justify-items: center; gap: 10px; text-align: center; }
.shape-visual { width: min(620px,100%); }
.shape-visual strong { width: 100%; height: auto; display: block; color: #1c4b5d; }
.shape-visual span { font: 700 1.25rem Georgia,serif; }
.shape-visual small { color: #657177; }
.engineering-diagram { width: 100%; max-height: 310px; display: block; overflow: visible; }
.engineering-diagram .object { fill: none; stroke: #263f4b; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.engineering-diagram .object-fill { fill: #3c9aae18; stroke: #263f4b; stroke-width: 2.4; }
.engineering-diagram .stair-side { fill: #d8ddd4; stroke: #263f4b; stroke-width: 2.4; stroke-linejoin: round; }
.engineering-diagram .stair-tread { fill: #faf4e8; stroke: #263f4b; stroke-width: 2.2; stroke-linejoin: round; }
.engineering-diagram .stair-riser { fill: #c7d0ca; stroke: #263f4b; stroke-width: 2.2; stroke-linejoin: round; }
.engineering-diagram .stair-landing { fill: #faf4e8; stroke: #263f4b; stroke-width: 2.4; stroke-linejoin: round; }
.engineering-diagram .stair-underside { fill: #aebbb5; stroke: #263f4b; stroke-width: 2.4; stroke-linejoin: round; }
.engineering-diagram .cutout { fill: #efe7d7; stroke: #263f4b; stroke-width: 2.2; }
.engineering-diagram .hidden { fill: none; stroke: #6e7d83; stroke-width: 1.7; stroke-dasharray: 7 6; }
.engineering-diagram .dimension { fill: none; stroke: #2c78a0; stroke-width: 2; marker-start: url(#arrow); marker-end: url(#arrow); }
.engineering-diagram .dimension-guide { fill: none; stroke: #2c78a0; stroke-width: 1.4; stroke-linecap: round; }
.engineering-diagram .dimension.secondary { stroke: #a46d21; }
.engineering-diagram .extension { display: none; }
.engineering-diagram .arrow-head { fill: #2c78a0; stroke: none; }
.engineering-diagram text { fill: #176b94; font: 800 17px Arial,sans-serif; text-anchor: middle; paint-order: stroke; stroke: #efe7d7; stroke-width: 4px; }
.dimension-key { width: 100%; display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin-top: 4px; }
.dimension-key span { padding: 6px 9px; border: 1px solid #c9b88f; border-radius: 999px; color: #52636b; background: #fffaf0; font: 600 .78rem Arial,sans-serif; }
.dimension-key b { margin-right: 4px; color: #176b94; }

.app-nav {
  position: fixed; z-index: 20; left: 50%; bottom: 16px; transform: translateX(-50%);
  display: flex; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 18px;
  background: rgba(5,25,35,.92); box-shadow: 0 10px 28px #0008; backdrop-filter: blur(12px);
}
.app-nav button { border: 1px solid #84672f; border-radius: 11px; padding: 11px 16px; color: white; background: rgba(255,255,255,.05); }
.app-nav button:hover { background: rgba(211,154,53,.2); }
.back-nav {
  position: fixed; z-index: 21; top: max(16px, env(safe-area-inset-top)); left: 16px;
  width: 48px; height: 48px; padding: 0; border: 1px solid #84672f; border-radius: 14px;
  color: white; background: rgba(5,25,35,.92); box-shadow: 0 8px 24px #0006;
  backdrop-filter: blur(12px); font-size: 1.25rem;
}
.back-nav:hover { background: rgba(44,73,84,.96); }
.back-nav[hidden] { display: none; }

@media (max-width: 720px) {
  .screen { padding: 18px 14px 102px; }
  .portal-grid, .two-col, .fields { grid-template-columns: 1fr; }
  .hero { min-height: auto; padding-top: 28px; }
  .install-actions { display: grid; }
  .portal { min-height: 125px; }
  .workbench, .document { padding: 17px; border-radius: 18px; }
  .room-head { padding-top: 18px; }
  .app-nav { width: auto; justify-content: center; }
  .app-nav button { flex: none; padding-inline: 16px; }
}
