:root {
  --bg: #f5f2ec;
  --card: #ffffff;
  --ink: #1f2421;
  --ink-soft: #5d645f;
  --line: #e4ded4;
  --accent: #2f6f5e;
  --accent-ink: #ffffff;
  --gutter: 20px;
  --radius: 18px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
a { color: inherit; }
button { font: inherit; color: inherit; }

/* ---------- landing ---------- */

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: calc(28px + var(--safe-t)) calc(var(--gutter) + var(--safe-r)) calc(56px + var(--safe-b)) calc(var(--gutter) + var(--safe-l));
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand img { width: 34px; height: 34px; display: block; }

.hero { padding: 56px 0 44px; max-width: 640px; }
.hero h1 {
  font-size: clamp(34px, 8.6vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0 0 20px;
}
.hero p { font-size: 18px; line-height: 1.55; color: var(--ink-soft); margin: 0; }

.section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 18px;
}

.flats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 720px) { .flats { grid-template-columns: 1fr 1fr; gap: 24px; } }

.flat-card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.flat-card:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(31, 36, 33, 0.08); }
.flat-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.flat-plan {
  background: #faf8f4;
  padding: 24px;
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--line);
}
.flat-plan svg { width: 100%; height: 100%; display: block; }
.flat-body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 6px; }
.flat-name { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
.flat-sub { font-size: 15px; font-style: italic; color: var(--ink-soft); margin: 0 0 6px; }
.flat-facts { font-size: 15px; color: var(--ink-soft); margin: 0; }
.flat-go {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--accent);
  font-size: 16px;
}

.how {
  margin: 64px 0 0;
  padding: 28px 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.how ol { margin: 0; padding: 0 0 0 22px; display: grid; gap: 12px; font-size: 16px; line-height: 1.5; }
.how h2 { font-size: 18px; margin: 0 0 16px; }

.foot { margin-top: 48px; font-size: 14px; color: var(--ink-soft); line-height: 1.5; }

/* ---------- viewer ---------- */

body.viewer { overflow: hidden; position: fixed; inset: 0; overscroll-behavior: none; }
#app { position: fixed; inset: 0; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; -webkit-tap-highlight-color: transparent; }
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

.room-label {
  position: absolute;
  left: 0; top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  white-space: nowrap;
  will-change: transform;
  transition: background 0.15s ease, color 0.15s ease, opacity 0.2s ease;
}
.room-label-name { font-size: 13px; font-weight: 650; }
.room-label-area { font-size: 11.5px; color: var(--ink-soft); }
.room-label.is-hidden { opacity: 0; }
.room-label.is-selected { background: var(--accent); color: #fff; }
.room-label.is-selected .room-label-area { color: rgba(255, 255, 255, 0.85); }

.overlay { position: absolute; inset: 0; pointer-events: none; }
.overlay > * { pointer-events: auto; }

.top-bar {
  position: absolute;
  top: calc(16px + var(--safe-t));
  left: calc(16px + var(--safe-l));
  right: calc(16px + var(--safe-r));
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}
.top-bar > * { pointer-events: auto; }

.chip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  min-width: 48px;
  padding: 0 16px;
  border-radius: 14px;
  border: 0;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.chip-btn svg { width: 20px; height: 20px; flex: none; }
.chip-btn[aria-pressed="true"] { background: var(--accent); color: #fff; }

.title-card {
  min-height: 48px;
  padding: 7px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}
.title-card h1 { font-size: 16px; margin: 0; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title-card p { font-size: 13px; margin: 2px 0 0; color: var(--ink-soft); }

.bottom-panel {
  position: absolute;
  left: calc(16px + var(--safe-l));
  right: calc(16px + var(--safe-r));
  bottom: calc(20px + var(--safe-b));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.bottom-panel .help {
  margin: 0;
  max-width: 420px;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.86);
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
  color: var(--ink-soft);
}
.primary-btn {
  width: 100%;
  max-width: 420px;
  min-height: 58px;
  border: 0;
  border-radius: 16px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 18px;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(47, 111, 94, 0.3);
  -webkit-tap-highlight-color: transparent;
}
.primary-btn svg { width: 22px; height: 22px; }
.primary-btn:active { transform: scale(0.985); }

.room-pill {
  margin: 0 auto;
  min-height: 40px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 136px);
}
.top-spacer { width: 48px; flex: none; }

.inside-bottom {
  position: absolute;
  left: calc(16px + var(--safe-l));
  right: calc(16px + var(--safe-r));
  bottom: calc(20px + var(--safe-b));
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}
.inside-bottom > * { pointer-events: auto; }
.map-card {
  padding: 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}
.map-card canvas { display: block; cursor: pointer; touch-action: manipulation; }
.map-card .map-cap { display: block; font-size: 11.5px; color: var(--ink-soft); text-align: center; margin-top: 6px; }
.inside-actions { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }

.hint {
  position: absolute;
  left: 50%;
  top: calc(84px + var(--safe-t));
  transform: translate(-50%, -8px);
  width: max-content;
  max-width: calc(100% - 32px - var(--safe-l) - var(--safe-r));
  padding: 12px 18px;
  border-radius: 14px;
  background: rgba(31, 36, 33, 0.86);
  color: #fff;
  font-size: 15px;
  line-height: 1.4;
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none !important;
}
.hint.is-on { opacity: 1; transform: translate(-50%, 0); }

#fade { position: absolute; inset: 0; background: #f5f2ec; opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
#fade.is-on { opacity: 1; }

.center-msg {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 32px;
  text-align: center;
  font-size: 16px;
  color: var(--ink-soft);
  background: var(--bg);
}
.center-msg[hidden] { display: none; }

[hidden] { display: none !important; }

/* used only for generating the share image */
body.clean .overlay, body.clean #labels { display: none !important; }
