@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700;900&family=Space+Mono:wght@400;700&display=swap');

:root {
  --ink: #2b2724;
  --muted: #6f665d;
  --line: rgba(43, 39, 36, .12);
  --surface: rgba(252, 249, 244, .82);
  --accent: #bf6a4c;
  --shadow: 0 18px 48px rgba(56, 44, 34, .14);
  font-family: 'Noto Sans SC', system-ui, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body, #scene { width: 100%; height: 100%; margin: 0; }
body { overflow: hidden; background: #e4ddd3; }
canvas { display: block; width: 100%; height: 100%; touch-action: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 10px; }

.brand {
  position: fixed; top: 30px; left: 34px; z-index: 3;
  display: flex; align-items: center; gap: 14px; pointer-events: none;
}
.brand-mark {
  display: grid; place-items: center; width: 46px; height: 46px;
  background: var(--accent); color: #fff8f2;
  font: 700 15px 'Space Mono', monospace;
  border-radius: 14px; box-shadow: var(--shadow);
}
.brand strong { display: block; font-size: 19px; font-weight: 700; letter-spacing: 3px; }
.brand small {
  display: block; margin-top: 4px; color: var(--muted);
  font: 400 9px 'Space Mono', monospace; letter-spacing: 2px;
}

.room-note {
  position: fixed; left: 34px; bottom: 40px; z-index: 3;
  max-width: 260px; pointer-events: none;
}
.room-note span {
  display: inline-flex; align-items: center; gap: 8px;
  font: 700 9px 'Space Mono', monospace; letter-spacing: 1.6px; color: var(--accent);
}
.room-note span::before { content: ''; width: 22px; height: 1px; background: var(--accent); }
.room-note p { margin: 12px 0 0; font-size: 13px; line-height: 1.85; color: var(--muted); }

.tools { position: fixed; top: 30px; right: 32px; z-index: 4; display: flex; gap: 10px; }
.tools button, .tools a {
  width: 46px; height: 46px; display: grid; place-items: center;
  font-size: 19px; color: var(--ink); text-decoration: none; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 15px;
  backdrop-filter: blur(16px); box-shadow: var(--shadow);
  transition: transform .22s ease, background .22s ease, color .22s ease;
}
.tools button:hover, .tools a:hover { transform: translateY(-3px); background: var(--accent); color: #fff; }
.tools button.active { background: var(--ink); color: #fff; }

.hint {
  position: fixed; right: 34px; bottom: 40px; z-index: 3;
  display: flex; align-items: center; gap: 10px; pointer-events: none;
  font: 400 9px 'Space Mono', monospace; letter-spacing: 1.4px; color: var(--muted);
}
.hint i { width: 26px; height: 1px; background: var(--accent); }

#loading {
  position: fixed; inset: 0; z-index: 9; display: flex;
  flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: #e4ddd3; transition: opacity .7s ease, visibility .7s ease;
}
#loading b {
  display: grid; place-items: center; width: 68px; height: 68px;
  background: var(--accent); color: #fff8f2; border-radius: 20px;
  font: 700 19px 'Space Mono', monospace; box-shadow: var(--shadow);
  animation: pulse 1.8s ease-in-out infinite;
}
#loading span { font: 400 10px 'Space Mono', monospace; letter-spacing: 2px; color: var(--muted); }
#loading.done { opacity: 0; visibility: hidden; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(.93); } }

@media (max-width: 760px) {
  .brand { top: 20px; left: 20px; gap: 10px; }
  .brand-mark { width: 40px; height: 40px; border-radius: 12px; }
  .brand strong { font-size: 16px; letter-spacing: 2px; }
  .brand small { font-size: 7px; letter-spacing: 1.4px; }
  .tools {
    top: auto; right: 0; left: 0; bottom: 0;
    padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
    justify-content: center; gap: 14px;
    background: linear-gradient(to top, rgba(228, 221, 211, .96), rgba(228, 221, 211, 0));
  }
  .tools button, .tools a { width: 52px; height: 52px; font-size: 21px; }
  .room-note { left: 20px; bottom: 104px; max-width: 200px; }
  .room-note p { display: none; }
  .hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  #loading, #loading b, .tools button, .tools a { transition: none; animation: none; }
}

