:root {
  --bg: #0e1620;
  --panel: rgba(18, 28, 40, .86);
  --line: #243448;
  --text: #e8eef5;
  --mute: #8fa2b6;
  --acc: #4fb3ff;
  --acc2: #2d7fc4;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  background: #0b121a;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 38px; height: 38px;
  background: var(--acc);
  color: #06121d;
  font-weight: 700;
  display: grid;
  place-items: center;
  border-radius: 8px;
}
.brand h1 { font-size: 17px; margin: 0; font-weight: 600; }
.brand p { margin: 2px 0 0; font-size: 12px; color: var(--mute); }

.tabs { display: flex; gap: 4px; }
.tabs button {
  background: none;
  border: 0;
  padding: 9px 16px;
  border-radius: 8px;
  color: var(--mute);
  font-weight: 600;
}
.tabs button:hover { color: var(--text); }
.tabs button.on { background: var(--line); color: var(--text); }

main { flex: 1; position: relative; min-height: 0; }
.tab { display: none; position: absolute; inset: 0; }
.tab.on { display: block; }
#stage { position: absolute; inset: 0; }
#stage canvas { display: block; }

.hint {
  position: absolute;
  left: 50%; bottom: 16px;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 12px;
  color: var(--mute);
  pointer-events: none;
  transition: opacity .6s;
}

.panel {
  position: absolute;
  top: 16px;
  width: 230px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  backdrop-filter: blur(8px);
}
.panel.left { left: 16px; }
.panel.right { right: 16px; }
.panel h2 {
  margin: 0 0 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--mute);
  font-weight: 600;
}
.panel h2:not(:first-child) { margin-top: 18px; }
#infoName { color: var(--text); font-size: 15px; text-transform: none; }

.seg {
  display: flex;
  background: #0b121a;
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 10px;
}
.seg button {
  flex: 1;
  border: 0;
  background: none;
  padding: 6px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--mute);
}
.seg button.on { background: var(--line); color: var(--text); }

.floors { display: flex; flex-direction: column; gap: 4px; }
.floors button {
  text-align: left;
  background: none;
  border: 1px solid transparent;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
}
.floors button small { color: var(--mute); }
.floors button:hover { background: #162231; }
.floors button.on { background: var(--acc2); }
.floors button.on small { color: #d6ecff; }

.row {
  display: block;
  margin-top: 14px;
  font-size: 12px;
  color: var(--mute);
}
.row input { width: 100%; margin-top: 6px; accent-color: var(--acc); }

dl { margin: 0; font-size: 13px; }
dl div {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
}
dt { color: var(--mute); }
dd { margin: 0; font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button {
  background: #162231;
  border: 1px solid var(--line);
  padding: 6px 11px;
  border-radius: 16px;
  font-size: 12px;
}
.chips button:hover { border-color: var(--acc); }
.chips button.on { background: var(--acc2); border-color: var(--acc2); }

/* plans */
.sub {
  display: flex;
  gap: 6px;
  padding: 14px 20px 0;
  flex-wrap: wrap;
}
.sub button {
  background: #162231;
  border: 1px solid var(--line);
  padding: 7px 14px;
  border-radius: 16px;
  font-size: 13px;
}
.sub button.on { background: var(--acc2); border-color: var(--acc2); }
.viewer {
  position: absolute;
  inset: 58px 0 0 0;
  display: grid;
  place-items: center;
  padding: 16px 20px 20px;
}
.viewer img {
  max-width: 100%;
  max-height: 100%;
  background: #f6f8fa;
  border-radius: 10px;
  padding: 16px;
  cursor: zoom-in;
}

/* drawings */
.grid {
  height: 100%;
  overflow: auto;
  padding: 20px;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  align-content: start;
}
.card {
  background: #f6f8fa;
  border-radius: 10px;
  overflow: hidden;
  cursor: zoom-in;
  border: 2px solid transparent;
}
.card:hover { border-color: var(--acc); }
.card .im {
  height: 260px;
  display: grid;
  place-items: center;
  padding: 12px;
}
.card img { max-width: 100%; max-height: 100%; }
.card .cap {
  background: #0b121a;
  color: var(--text);
  padding: 9px 12px;
  font-size: 13px;
}

/* lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(5, 9, 14, .94);
  z-index: 20;
  display: none;
}
.lightbox.on { display: block; }
.lbwrap {
  position: absolute;
  inset: 0;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 60px 20px 20px;
}
.lbwrap img {
  background: #f6f8fa;
  max-width: none;
  width: min(1500px, 94vw);
  border-radius: 8px;
  padding: 20px;
}
.lightbox .x {
  position: absolute;
  top: 14px; right: 18px;
  z-index: 2;
  background: var(--line);
  border: 0;
  padding: 8px 16px;
  border-radius: 8px;
}

.foot {
  font-size: 11px;
  color: var(--mute);
  padding: 7px 20px;
  border-top: 1px solid var(--line);
  background: #0b121a;
}

@media (max-width: 800px) {
  .panel { width: 170px; padding: 10px; }
  .panel.right { top: auto; bottom: 50px; }
  .hint { display: none; }
}

.chips button.sw {
  width: 34px; height: 34px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--line);
}
.chips button.sw.on { border-color: #fff; }
.chips .sw[data-t=sand]  { background: linear-gradient(135deg,#e9d9bf 50%,#b4583c 50%); }
.chips .sw[data-t=white] { background: linear-gradient(135deg,#f4f4f1 50%,#3f5f8a 50%); }
.chips .sw[data-t=stone] { background: linear-gradient(135deg,#b8bcc2 50%,#d9a21b 50%); }
.chips .sw[data-t=sage]  { background: linear-gradient(135deg,#cfdcc4 50%,#7a4f35 50%); }
.chips .sw[data-t=brick] { background: linear-gradient(135deg,#c77d62 50%,#efe6d6 50%); }

.go {
  width: 100%;
  background: var(--acc);
  color: #06121d;
  border: 0;
  padding: 10px;
  border-radius: 8px;
  font-weight: 700;
}
.go:hover { background: #7cc6ff; }
.hud { display: none; position: absolute; inset: 0;
  pointer-events: none; }
.hudbox {
  position: absolute;
  left: 50%; top: 14px;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 6px 8px 6px 18px;
  pointer-events: auto;
}
.hudbox span { font-weight: 600; margin-right: 6px; }
.hudbox button {
  background: #162231;
  border: 1px solid var(--line);
  padding: 7px 13px;
  border-radius: 16px;
  font-size: 12px;
}
.hudbox button:hover { border-color: var(--acc); }
.hudtip {
  position: absolute;
  left: 50%; bottom: 16px;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 12px;
  color: var(--mute);
  text-align: center;
  max-width: 92vw;
}
.dot {
  display: none;
  position: absolute;
  left: 50%; top: 50%;
  width: 6px; height: 6px;
  margin: -3px;
  border-radius: 50%;
  background: rgba(255,255,255,.7);
  pointer-events: none;
}
body.walk .hud { display: block; }
body.walk .dot { display: block; }
body.walk .hint { display: none; }
body.walk #orbitOnly { display: none; }
body.walk #mode, body.walk .row { display: none; }
body.walk #btnWalk { display: none; }
body.walk .panel.right { display: none; }
body.walk #stage canvas { cursor: crosshair; }

.panel.right { max-height: calc(100% - 32px); overflow: auto; }
.panel h2 small { color: var(--text); text-transform: none;
  letter-spacing: 0; margin-left: 6px; font-size: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 10px;
  font-size: 11px; color: var(--mute); margin-bottom: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px;
  border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.rlist { max-height: 190px; overflow: auto; }
.rlist button, .plist button {
  display: flex; width: 100%; justify-content: space-between;
  background: none; border: 0; border-bottom: 1px solid var(--line);
  padding: 6px 4px; font-size: 12px; text-align: left; }
.rlist button:hover, .plist button:hover { background: #162231; }
.rlist button.on { background: var(--acc2); }
.rlist b, .plist b { font-weight: 600; }
.rlist span, .plist span { color: var(--mute); }
.rlist .on span { color: #d6ecff; }
.rlist p { margin: 0; font-size: 12px; color: var(--mute); }
.plist { position: absolute; right: 16px; top: 74px; bottom: 16px;
  width: 230px; overflow: auto; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; }
.plist h3 { margin: 0 0 6px; font-size: 13px; }
.viewer { right: 262px; }
@media (max-width: 800px) {
  .plist { display: none; }
  .viewer { right: 0; }
}
body.walk #roomSec { display: none; }

.go { margin-bottom: 4px; }
.mbar { display: none; }

@media (max-width: 800px) {
  body { height: 100vh; height: 100dvh; }
  .top { padding: 8px 12px; gap: 6px; }
  .logo { width: 30px; height: 30px; }
  .brand h1 { font-size: 14px; }
  .brand p, .foot { display: none; }
  .tabs { width: 100%; overflow-x: auto; }
  .tabs button { padding: 8px 10px; font-size: 13px;
    white-space: nowrap; flex: 1; }
  button { touch-action: manipulation; }

  .panel { display: none; position: absolute; left: 8px; right: 8px;
    top: auto; bottom: 58px; width: auto; max-height: 55%;
    overflow: auto; padding: 12px; z-index: 5; }
  body.pl .panel.left { display: block; }
  body.pr .panel.right { display: block; top: auto; bottom: 58px; }
  .floors { display: grid; grid-template-columns: 1fr 1fr; }
  .floors button, .chips button, .seg button, .rlist button,
  .go { min-height: 40px; }
  .chips button.sw { width: 40px; height: 40px; }
  .rlist { max-height: 160px; }

  .mbar { display: flex; gap: 8px; position: absolute; z-index: 6;
    left: 8px; right: 8px; bottom: 8px; }
  .mbar button { flex: 1; padding: 12px; border-radius: 12px;
    background: var(--panel); border: 1px solid var(--line);
    font-weight: 600; backdrop-filter: blur(8px); }
  .mbar button.on { background: var(--acc2); border-color: var(--acc2); }
  body.walk .mbar, body.walk .panel.left { display: none; }

  .hudbox { left: 8px; right: 8px; transform: none; flex-wrap: wrap;
    justify-content: center; padding: 6px 10px; gap: 6px; }
  .hudbox span { width: 100%; text-align: center; margin: 0; }
  .hudbox button { padding: 9px 12px; }
  .hudtip { display: none; }

  .sub { padding: 10px 12px 0; }
  .viewer { inset: 52px 0 0 0; padding: 8px; }
  .viewer img { padding: 6px; }
  .grid { padding: 12px; grid-template-columns: 1fr; }
  .card .im { height: 220px; }
  .lbwrap { padding: 56px 8px 8px; }
  .lbwrap img { width: 220vw; padding: 8px; }
}

#roomSec, #btnRooms { display: none !important; }
