:root {
  /* soft cream panels, warm brown text, lamp-light accent */
  --bg: #ece7df;
  --panel: rgba(255, 252, 246, 0.84);
  --panel-solid: #fffaf2;
  --text: #3a2b20;
  --muted: #6a5646;
  --accent: #c98a3c;
  --on-accent: #1f1206;
  --line: rgba(90, 62, 40, 0.42);
  --shadow: 0 6px 24px rgba(60, 40, 20, 0.16);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, "PingFang SC", "Helvetica Neue", "Noto Sans SC", sans-serif; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#scene:focus-visible { outline-offset: -4px; }
#spot-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#fade { position: fixed; inset: 0; background: #fffaf2; opacity: 0; pointer-events: none; transition: opacity .22s ease; }
#fade.on { opacity: 1; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip { position: absolute; left: 8px; top: -60px; z-index: 10; background: var(--text); color: #fff; padding: 8px 12px; border-radius: 8px; }
.skip:focus { top: 8px; }

button { font: inherit; color: var(--text); cursor: pointer; background: var(--panel); border: 1px solid var(--line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); padding: 0; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--text); outline-offset: 2px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; display: block; }

/* top bar */
.top { position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) calc(14px + env(safe-area-inset-right)) 10px calc(14px + env(safe-area-inset-left)); pointer-events: none; }
.top > * { pointer-events: auto; }
h1 { margin: 0; font-size: 22px; white-space: nowrap; }
h1 button { font-size: inherit; font-weight: 600; letter-spacing: 0.14em; font-family: Georgia, "Songti SC", serif; background: none; border-color: transparent;
  backdrop-filter: none; -webkit-backdrop-filter: none; padding: 2px 6px; min-height: 44px; border-radius: 10px; transition: transform .18s ease; }
h1 button:hover { transform: scale(1.08); }
.toggles { display: flex; gap: 8px; align-items: center; }

/* two-state pill: the lit half is the current state */
.switch { display: flex; border-radius: 999px; padding: 3px; box-shadow: var(--shadow); }
.switch .opt { display: flex; align-items: center; justify-content: center; gap: 4px; min-width: 34px; height: 38px; padding: 0 9px; border-radius: 999px; color: var(--muted);
  font-size: 13px; white-space: nowrap; transition: background .18s, color .18s; }
.switch .opt b { font-size: 15px; font-weight: 600; }
.switch .opt svg { width: 17px; height: 17px; }
.switch[aria-checked="false"] .opt:first-child, .switch[aria-checked="true"] .opt:last-child { background: var(--accent); color: var(--on-accent); }
.switch:hover, .round:hover { border-color: var(--accent); }
.round { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; box-shadow: var(--shadow); }
.round[aria-expanded="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* things: a grid of small icon tiles */
.things { position: fixed; top: calc(64px + env(safe-area-inset-top)); right: calc(14px + env(safe-area-inset-right)); width: min(280px, calc(100vw - 28px)); background: var(--panel);
  border: 1px solid var(--line); border-radius: 18px; padding: 8px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: var(--shadow); }
.things ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; max-height: 60dvh; overflow-y: auto; }
.things li button { width: 100%; min-height: 60px; display: grid; justify-items: center; gap: 2px; padding: 8px 2px 6px; border-radius: 12px; border-color: transparent; background: transparent;
  backdrop-filter: none; -webkit-backdrop-filter: none; font-size: 12px; color: var(--muted); line-height: 1.2; }
.things li button:hover { background: rgba(90, 62, 40, 0.08); color: var(--text); }
.things .emoji { font-size: 24px; line-height: 1.15; }

/* bottom: the floor plan is the menu */
.bottom { position: fixed; left: 0; right: 0; bottom: 0; display: grid; justify-items: center; gap: 6px; padding: 0 14px calc(12px + env(safe-area-inset-bottom)); pointer-events: none; }
.bottom > * { pointer-events: auto; }
.hint { margin: 0; max-width: calc(100vw - 28px); text-align: center; font-size: 13px; color: var(--text); background: var(--panel); border-radius: 999px; padding: 5px 12px; pointer-events: none; transition: opacity .6s; }
.hint.gone { opacity: 0; }
.ctl { display: flex; align-items: center; justify-content: center; gap: 8px; max-width: 100%; }
.ctl [hidden] { display: none; }
.spot-name { display: flex; align-items: center; gap: 6px; min-height: 44px; min-width: 0; padding: 0 10px 0 6px; border-radius: 999px; font-size: 13px; box-shadow: var(--shadow); }
.spot-name:hover { border-color: var(--accent); }
.spot-name .tag { background: var(--accent); color: var(--on-accent); border-radius: 999px; padding: 3px 9px; font-size: 12px; }
.spot-name .chev { width: 16px; height: 16px; transition: transform .18s; }
.spot-name[aria-expanded="false"] .chev { transform: rotate(180deg); }
.map[hidden] { display: none; }
.map { display: flex; align-items: stretch; gap: 8px; padding: 8px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: var(--shadow); }
.map button { border-radius: 6px; display: grid; place-items: center; backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(90, 62, 40, 0.07);
  font-size: 12px; line-height: 1.1; transition: background .15s; }
.map button:hover { background: rgba(217, 163, 92, 0.3); }
.map button[aria-current="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.levels { display: grid; gap: 4px; width: 44px; }
.levels button { min-height: 28px; border-radius: 8px; font-size: 12px; font-weight: 600; }
.plan { position: relative; width: min(320px, calc(100vw - 28px - 16px - 52px - 2px)); aspect-ratio: 13.1 / 7.15; align-self: center; }
.plan button { position: absolute; overflow: hidden; }
.plan .tall span { writing-mode: vertical-rl; }

dialog { background: var(--panel-solid); color: var(--text); border: 1px solid var(--line); border-radius: 18px; padding: 22px;
  width: min(420px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); overflow-y: auto; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(40, 28, 16, 0.35); }
dialog h2 { margin: 0 44px 10px 0; font-size: 20px; font-family: Georgia, "Songti SC", serif; }
dialog p { margin: 0 0 8px; }
.act { min-height: 44px; padding: 0 18px; margin: 4px 0 12px; border-radius: 999px; background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }
.act[hidden] { display: none; }
.note { color: var(--muted); font-size: 13px; }
.close { position: absolute; top: 10px; right: 10px; font-size: 22px; line-height: 1; box-shadow: none; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

@media (max-width: 480px) { h1 { font-size: 17px; } .top { padding-left: calc(8px + env(safe-area-inset-left)); padding-right: calc(8px + env(safe-area-inset-right)); } .toggles { gap: 6px; } .switch .opt { padding: 0 7px; } .ctl { gap: 6px; } }
@media (max-width: 370px) { h1 { font-size: 16px; } .plan button { font-size: 11px; } }
/* short landscape phones: keep the floor plan from covering the room */
@media (max-height: 480px) { .plan { width: min(200px, 40vw); } .hint { display: none; } }
