@font-face {
  font-family: Heebo;
  src: url("../fonts/Heebo-VF.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --stone: #EFE9DD;      /* the studio the model stands in */
  --stone-deep: #D6CCB9;
  --ink: #1F2421;        /* controls */
  --paper: #F7F3EA;      /* text on ink */
  --brass: #C9A04E;      /* the one accent: what is switched on */
  --brass-text: #E6C987; /* the same accent as small text on the dark panels (contrast above 7:1) */
  --sage: #7C8B78;
  --glass: rgba(31, 36, 33, 0.9);
  --edge: max(14px, env(safe-area-inset-left));
  --top: max(14px, env(safe-area-inset-top));
  --bottom: max(14px, env(safe-area-inset-bottom));
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; background: var(--stone); }
body { font-family: Heebo, "Segoe UI", Arial, sans-serif; color: var(--ink); -webkit-font-smoothing: antialiased; touch-action: none; user-select: none; -webkit-user-select: none; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; cursor: grab; }
#scene:active { cursor: grabbing; }

button { font: inherit; color: inherit; border: 0; cursor: pointer; }
button:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
kbd { font: 500 11px/1 Heebo, sans-serif; opacity: 0.5; margin-inline-start: 8px; padding: 2px 5px; border: 1px solid currentColor; border-radius: 4px; }
[hidden] { display: none !important; }

/* ---- title -------------------------------------------------------------------------- */
.title { position: fixed; top: var(--top); right: var(--edge); max-width: min(46vw, 420px); pointer-events: none; transition: opacity 0.4s; }
.title h1 { margin: 0; font-size: clamp(20px, 2.4vw, 30px); font-weight: 800; line-height: 1.15; letter-spacing: -0.01em; }
.title p { margin: 4px 0 0; font-size: 15px; font-weight: 500; opacity: 0.72; }
body.inside .title { color: var(--paper); background: var(--glass); padding: 8px 16px 9px; border-radius: 12px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
body.inside .title h1 { font-size: 18px; }
body.inside .title p { font-size: 13px; margin-top: 2px; }

/* ---- view switch -------------------------------------------------------------------- */
.modes { position: fixed; top: var(--top); left: 50%; transform: translateX(-50%); display: flex; gap: 2px; padding: 4px; background: var(--glass); border-radius: 999px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.modes button { background: transparent; color: var(--paper); font-size: 15px; font-weight: 500; padding: 9px 16px; border-radius: 999px; white-space: nowrap; transition: background 0.25s, color 0.25s; }
.modes button[aria-pressed="true"] { background: var(--paper); color: var(--ink); font-weight: 700; }
.modes button:not([aria-pressed="true"]):hover { background: rgba(247, 243, 234, 0.12); }

/* ---- light and furniture ------------------------------------------------------------ */
.toggles { position: fixed; top: var(--top); left: var(--edge); display: flex; gap: 8px; }
.toggles button { background: var(--glass); color: var(--paper); font-size: 14px; font-weight: 500; padding: 9px 14px; border-radius: 12px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: background 0.25s, color 0.25s; }
.toggles button[aria-pressed="true"] { background: var(--brass); color: var(--ink); font-weight: 700; }
.toggles button:hover:not([aria-pressed="true"]) { background: rgba(31, 36, 33, 0.94); }

/* ---- styles: each one is a strip of its three real materials ------------------------- */
.styles { position: fixed; bottom: var(--bottom); left: 50%; transform: translateX(-50%); display: flex; gap: 8px; max-width: calc(100vw - 2 * var(--edge)); }
.styles button { display: flex; align-items: center; gap: 10px; background: var(--glass); color: var(--paper); font-size: 14px; font-weight: 500; padding: 7px 14px 7px 8px; border-radius: 14px; white-space: nowrap; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: background 0.25s, color 0.25s, transform 0.2s; }
.styles .chip { display: flex; width: 44px; height: 30px; border-radius: 8px; overflow: hidden; flex: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18); }
.styles .chip i { flex: 1; }
.styles button[aria-pressed="true"] { background: var(--paper); color: var(--ink); font-weight: 700; }
.styles button[aria-pressed="true"] .chip { box-shadow: inset 0 0 0 1px rgba(31, 36, 33, 0.25); }
.styles button:hover:not([aria-pressed="true"]) { transform: translateY(-2px); }

/* ---- which room am I in --------------------------------------------------------------- */
.room { position: fixed; top: calc(var(--top) + 74px); right: var(--edge); display: flex; align-items: baseline; gap: 10px; background: var(--glass); color: var(--paper); padding: 9px 16px; border-radius: 12px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.room strong { font-size: 18px; font-weight: 700; }
.room span { font-size: 14px; font-weight: 500; color: var(--brass-text); font-variant-numeric: tabular-nums; }

/* ---- what this model may claim: demo, unchecked draft, checked plan ------------------- */
.badge { position: fixed; top: calc(var(--top) + 50px); left: var(--edge); background: rgba(247, 243, 234, 0.92); color: var(--ink); font-size: 13px; font-weight: 500; padding: 6px 12px; border-radius: 999px; box-shadow: inset 0 0 0 1px rgba(31, 36, 33, 0.18); }
.badge.warn { background: var(--brass); font-weight: 700; }

/* ---- minimap -------------------------------------------------------------------------- */
.map { position: fixed; left: var(--edge); bottom: var(--bottom); width: min(250px, 36vw); aspect-ratio: 1.22; background: var(--glass); border-radius: 16px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); overflow: hidden; }
.map canvas { width: 100%; height: 100%; display: block; cursor: pointer; }

/* ---- the card: a style being applied, or a room on the tour ---------------------------- */
.card { position: fixed; left: 50%; bottom: calc(var(--bottom) + 76px); transform: translateX(-50%); min-width: min(360px, 84vw); max-width: 88vw; text-align: center; background: rgba(31, 36, 33, 0.9); color: var(--paper); padding: 18px 26px 16px; border-radius: 18px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); pointer-events: none; animation: card-in 0.38s cubic-bezier(0.2, 0.9, 0.25, 1) both; }
.card strong { display: block; font-size: clamp(26px, 4.4vw, 40px); font-weight: 800; line-height: 1.1; letter-spacing: -0.015em; }
.card span { display: block; margin-top: 4px; font-size: 14px; font-weight: 500; letter-spacing: 0.02em; color: var(--brass-text); font-variant-numeric: tabular-nums; }
.card p { margin: 10px 0 0; font-size: 15px; line-height: 1.45; opacity: 0.88; }
.card .swatches { display: flex; justify-content: center; gap: 8px; margin-top: 12px; }
.card .swatches:empty { display: none; }
.card .swatches i { width: 26px; height: 26px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.35); }
.card.out { animation: card-out 0.3s ease-in both; }
@keyframes card-in { from { opacity: 0; transform: translate(-50%, 14px) scale(0.97); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
@keyframes card-out { to { opacity: 0; transform: translate(-50%, 8px); } }

/* ---- how to move ----------------------------------------------------------------------- */
.hint { position: fixed; right: var(--edge); bottom: calc(var(--bottom) + 58px); margin: 0; max-width: 34vw; font-size: 13px; font-weight: 500; line-height: 1.5; opacity: 0.7; pointer-events: none; text-align: right; }
body.inside .hint { color: var(--paper); text-shadow: 0 1px 10px rgba(0, 0, 0, 0.6); opacity: 0.9; }
/* ---- room names floating over the model ------------------------------------------------ */
#tags { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.tag { position: absolute; left: 0; top: 0; transform-origin: 50% 100%; background: var(--glass); color: var(--paper); border-radius: 10px; padding: 5px 11px 6px; text-align: center; white-space: nowrap; pointer-events: auto; cursor: pointer; line-height: 1.15; will-change: transform; transition: opacity 0.3s, background 0.2s; }
.tag b { display: block; font-size: 14px; font-weight: 700; }
.tag small { font-size: 12px; font-weight: 500; color: var(--brass-text); font-variant-numeric: tabular-nums; }
.tag:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
.tag:hover { background: var(--ink); }
#tags.off .tag { opacity: 0; pointer-events: none; }

/* ---- touch joystick ---------------------------------------------------------------------- */
.stick { position: fixed; right: calc(var(--edge) + 6px); bottom: calc(var(--bottom) + 70px); width: 108px; height: 108px; border-radius: 50%; background: rgba(31, 36, 33, 0.5); box-shadow: inset 0 0 0 2px rgba(247, 243, 234, 0.35); touch-action: none; }
.stick i { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px; border-radius: 50%; background: var(--paper); }

.notice { position: fixed; inset: auto var(--edge) 50% var(--edge); margin: auto; max-width: 560px; background: var(--ink); color: var(--paper); padding: 18px 22px; border-radius: 14px; font-size: 15px; line-height: 1.5; white-space: pre-line; cursor: pointer; }

body.capture .modes, body.capture .toggles, body.capture .styles, body.capture .hint, body.capture .map, body.capture .stick, body.capture .title { display: none; }
body.capture .badge { top: var(--top); }

@media (max-width: 760px) {
  kbd { display: none; }
  .title { max-width: 62vw; }
  .title h1 { font-size: 19px; }
  .title p { font-size: 13px; }
  .modes { top: auto; bottom: calc(var(--bottom) + 58px); }
  .modes button { font-size: 14px; padding: 9px 13px; }
  .toggles { flex-direction: column; gap: 6px; }
  .toggles button { font-size: 13px; padding: 8px 11px; }
  .styles { left: 0; right: 0; transform: none; max-width: none; padding: 0 var(--edge); overflow-x: auto; scrollbar-width: none; touch-action: pan-x; }
  .styles::-webkit-scrollbar { display: none; }
  .styles button { font-size: 13px; padding: 6px 12px 6px 7px; }
  .styles .chip { width: 36px; height: 26px; }
  .title p { font-size: 12px; }
  .badge { top: calc(var(--top) + 124px); font-size: 12px; padding: 5px 10px; }
  .room { top: calc(var(--top) + 78px); padding: 7px 12px; }
  .room strong { font-size: 16px; }
  .map { width: 132px; bottom: calc(var(--bottom) + 112px); border-radius: 12px; }
  .card { bottom: auto; top: 27%; padding: 14px 18px 13px; }
  .tag { padding: 3px 7px 4px; border-radius: 8px; }
  .tag b { font-size: 11px; }
  .tag small { display: none; }
  .hint { display: none; }
  .stick { bottom: calc(var(--bottom) + 116px); width: 96px; height: 96px; }
}

@media (prefers-reduced-motion: reduce) {
  .card, .card.out { animation: none; }
  .styles button, .modes button, .toggles button { transition: none; }
}
