:root {
  --ink: #343a40; --ink2: #3c4248; --muted: #6b7178;
  --line: #d3dae0; --bg: #f2f5f7; --bg2: #e9ecf0; --accent: #343a40;
  font-family: Poppins, system-ui, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
}
body { margin: 0; background: var(--bg); }
.container { max-width: 1080px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
h1, h2.panel-title, .av-title { font-family: Prata, Georgia, serif; font-weight: 400; }
a { color: var(--ink); }

/* top navigation */
.topnav { display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .5rem 1rem; padding: .8rem 1.2rem; background: #fff;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topnav-brand { font-family: Prata, serif; color: var(--ink); letter-spacing: .12em;
  text-decoration: none; font-size: 1.05rem; display: inline-flex; align-items: center;
  gap: .55rem; }
.topnav-badge { font-family: Poppins, sans-serif; font-size: .62rem; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: .12rem .45rem;
  line-height: 1.4; }
.topnav-links { display: flex; gap: .25rem; flex-wrap: wrap; }
.topnav-links a { color: var(--muted); text-decoration: none; padding: .35rem .8rem;
  border-radius: 6px; font-size: .9rem; }
.topnav-links a:hover { background: var(--bg2); color: var(--ink); }
.topnav-links a.active { background: var(--ink); color: #fff; }

/* buttons */
button, .btn { font: 500 .95rem Poppins, sans-serif; cursor: pointer;
  border: 0; border-radius: 8px; text-decoration: none; display: inline-block; }
.btn-primary, button.btn-primary { background: var(--ink); color: #fff; padding: .75rem 1.3rem; }
.btn-primary:hover { background: #20262b; }

/* hero */
.hero { text-align: center; margin: 1.5rem 0 2rem; }
.hero h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); margin: 0 0 .6rem; }
.lede { color: var(--muted); max-width: 640px; margin: 0 auto; line-height: 1.6; }

/* home 2-block grid */
.home-grid { display: grid; grid-template-columns: 360px 1fr; gap: 1.5rem; align-items: start; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1.4rem; }
.panel-title { font-size: 1.3rem; margin: 0 0 1rem; }
.panel-note { color: var(--muted); font-size: .9rem; margin: -.6rem 0 1rem; }
@media (max-width: 820px) { .home-grid { grid-template-columns: 1fr; } }

/* uploaded rooms */
.rooms-section { margin-top: 1.2rem; }
.sub { font-size: .95rem; font-weight: 600; margin: .2rem 0 .6rem; }
.rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: .5rem; }
.room-thumb { width: 100%; padding: 0; background: #fff; border-radius: 8px;
  overflow: hidden; border: 1px solid var(--line); }
.room-thumb img { width: 100%; height: 70px; object-fit: cover; display: block; }
.room-thumb:hover { border-color: var(--ink); }
.room-thumb.active { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
.room-actions { margin-top: 1rem; }

/* staggered reconstruction list with QR */
.recon-list { display: flex; flex-direction: column; gap: 1rem; }
.recon-row { display: flex; align-items: center; gap: 1.2rem;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; }
.recon-row.flip { flex-direction: row-reverse; }
.recon-media { display: flex; align-items: center; gap: 1rem; flex: 1; min-width: 0; }
.recon-photo { width: 150px; height: 110px; object-fit: contain; background: #fff;
  border-radius: 8px; flex: 0 0 auto; }
.recon-text { min-width: 0; }
.recon-name { font-family: Prata, serif; font-size: 1.1rem; margin: 0 0 .25rem; }
.recon-dims { color: var(--muted); font-size: .85rem; margin: 0 0 .4rem; }
.recon-qr { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center;
  gap: .3rem; text-decoration: none; color: var(--muted); }
.recon-qr img { width: 104px; height: 104px; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: 4px; }
.recon-qr span { font-size: .72rem; text-align: center; line-height: 1.25; }
@media (max-width: 520px) {
  .recon-row, .recon-row.flip { flex-direction: column; text-align: center; }
  .recon-media { flex-direction: column; }
}

/* try-in-room screen (3D over photo) */
.try-page { max-width: 1080px; }
.try-layout { display: flex; gap: 1.5rem; align-items: flex-start; margin-top: 1rem; }
.try-nav { flex: 0 0 230px; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: .8rem; max-height: 82vh; overflow-y: auto; }
.try-main { flex: 1; min-width: 0; }
.nav-cat { font-size: .85rem; font-weight: 600; margin: .2rem 0 .6rem; color: var(--muted); }
.try-nav ul { list-style: none; margin: 0; padding: 0; }
.nav-row { display: flex; align-items: center; gap: .15rem; margin-bottom: .2rem; }
.nav-item { flex: 1; min-width: 0; display: flex; gap: .6rem; align-items: center;
  padding: .45rem; border-radius: 8px; text-decoration: none; color: var(--ink);
  font-size: .85rem; line-height: 1.2; }
.nav-item:hover { background: var(--bg); }
.nav-item.active { background: var(--bg2); font-weight: 600; }
.nav-item img { flex: 0 0 46px; width: 46px; height: 46px; object-fit: contain;
  background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.hint { color: var(--muted); line-height: 1.55; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: .8rem 1rem; }
.hint strong { color: var(--ink); }
.try-stage { position: relative; margin-top: 1rem; border-radius: 12px; overflow: hidden;
  background: var(--bg2); line-height: 0; }
.try-stage #room { width: 100%; height: auto; display: block; }
.try-stage model-viewer { position: absolute; inset: 0; width: 100%; height: 100%;
  background: transparent; --poster-color: transparent; will-change: transform; }
.drag-layer { position: absolute; inset: 0; z-index: 5; cursor: move; touch-action: none;
  background: rgba(52,58,64,.04); }
@media (max-width: 720px) {
  .try-layout { flex-direction: column; }
  .try-nav { flex-basis: auto; width: 100%; max-height: none; }
}

/* catalog / recommendation cards (kept for legacy routes) */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.card { border: 1px solid var(--line); border-radius: 10px; padding: 1rem; background: #fff; }
.cat-heading { text-transform: capitalize; margin: 1.5rem 0 .5rem; }
.thumb img { width: 100%; height: 160px; object-fit: contain; background: #fff; border-radius: 8px; }
.card h3 { font-weight: 600; font-size: 1rem; margin: .5rem 0 .25rem; }
.price { font-weight: 600; }
.reason { color: #444; font-size: .95rem; }
.tryon { background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: 6px;
  text-decoration: none; display: inline-block; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.setup { display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: flex-start; }
.setup-thumb { width: 260px; max-width: 100%; height: auto; object-fit: contain;
  background: #fff; border-radius: 8px; }
.setup-forms { flex: 1; min-width: 260px; }

.error { color: #a94442; }
.status { min-height: 1.4em; color: #2f7d52; }
.status.error { color: #a94442; }
.reset-btn { display: inline-block; margin: .6rem 0; background: #fff; color: var(--ink);
  border: 1px solid var(--ink); padding: .45rem .9rem; border-radius: 6px; cursor: pointer; }
.reset-btn:hover { background: var(--bg); }

/* camera try-on (mobile) */
[hidden] { display: none !important; }
.camera-body { margin: 0; background: #000; }
#camera-screen { position: fixed; inset: 0; overflow: hidden; touch-action: none; }
#cam { width: 100%; height: 100%; object-fit: cover; display: block; }
#ar-product { position: absolute; top: 0; left: 0; touch-action: none;
  user-select: none; -webkit-user-drag: none; filter: drop-shadow(0 6px 12px rgba(0,0,0,.4)); }
.cam-overlay { position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1rem; padding: 1.5rem;
  background: rgba(0,0,0,.65); color: #fff; text-align: center; }
.cam-title { font-size: 1.1rem; font-weight: 600; }
.cam-hint { position: absolute; top: env(safe-area-inset-top, 12px); left: 0; right: 0;
  margin: 12px auto; max-width: 90%; color: #fff; background: rgba(0,0,0,.5);
  padding: .5rem .8rem; border-radius: 8px; font-size: .9rem; text-align: center; }
.cam-controls { position: absolute; left: 0; right: 0;
  bottom: env(safe-area-inset-bottom, 16px); padding: 1rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; }
.cam-back { color: #fff; font-size: 1.6rem; text-decoration: none; width: 44px; }
.cam-spacer { width: 44px; }
.cam-shutter { width: 72px; height: 72px; border-radius: 50%; border: 4px solid #fff;
  background: #fff; cursor: pointer; box-shadow: 0 0 0 3px rgba(0,0,0,.3); }
.cam-shutter:active { transform: scale(.95); }
.cam-btn-primary { background: var(--ink); color: #fff; border: 0; padding: .7rem 1.4rem;
  border-radius: 8px; font-size: 1rem; text-decoration: none; cursor: pointer; }
.cam-btn { background: #fff; color: var(--ink); border: 0; padding: .6rem 1.1rem;
  border-radius: 8px; font-size: .95rem; cursor: pointer; }
.cam-link { color: #fff; text-decoration: underline; font-size: .9rem; }
.cam-result-img { max-width: 90%; max-height: 60vh; border-radius: 8px; }
.cam-result-actions { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; }
.cam-save-status { color: #fff; min-height: 1.2em; }
.cam-save-status a { color: #8fe3b5; }
.camera-link { background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: 6px;
  text-decoration: none; display: inline-block; }
