@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-mark.custom-logo { background: rgba(255,255,255,.82); overflow: hidden; padding: 4px; }
.brand-mark.custom-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 10px; }

.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: 76px; height: 76px;
  overflow: hidden; padding: 6px; background: var(--accent); color: #fff8f2; border-radius: 22px;
  font: 700 19px 'Space Mono', monospace; box-shadow: var(--shadow);
  animation: pulse 1.8s ease-in-out infinite;
}
#loading b.custom-logo { background: rgba(255,255,255,.88); }
#loading b img { width: 100%; height: 100%; object-fit: contain; border-radius: 15px; }
#loading span { font: 500 11px 'Noto Sans SC', sans-serif; letter-spacing: 3px; color: var(--muted); }
#loading.done { opacity: 0; visibility: hidden; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(.93); } }


.photo-viewer[hidden] { display: none; }
.photo-viewer { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 28px; }
.viewer-backdrop { position: absolute; inset: 0; border: 0; background: rgba(24, 20, 18, .68); backdrop-filter: blur(18px) saturate(.75); cursor: zoom-out; }
.viewer-card {
  position: relative; z-index: 1; width: min(960px, 92vw); max-height: min(760px, 90vh);
  display: grid; grid-template-columns: minmax(0, 1.48fr) minmax(260px, .72fr);
  overflow: hidden; border: 1px solid rgba(255,255,255,.18); border-radius: 26px;
  background: rgba(31, 27, 25, .94); color: #f7f0e8;
  box-shadow: 0 36px 100px rgba(15, 10, 8, .48);
  animation: viewerIn .38s cubic-bezier(.2,.75,.25,1);
}
.viewer-image-wrap { position: relative; min-height: 540px; background: #171412; display: grid; place-items: center; overflow: hidden; }
.viewer-image-wrap::after { content: ''; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 80px rgba(0,0,0,.22); }
.viewer-image-wrap img { width: 100%; height: 100%; max-height: 760px; object-fit: contain; user-select: none; }
.viewer-close { position: absolute; z-index: 5; top: 18px; right: 18px; width: 42px; height: 42px; border: 1px solid rgba(255,255,255,.22); border-radius: 50%; background: rgba(25,21,19,.62); color: #fff; font-size: 25px; cursor: pointer; backdrop-filter: blur(12px); }
.viewer-index { position: absolute; z-index: 3; left: 20px; top: 20px; padding: 7px 11px; border-radius: 20px; background: rgba(24,20,18,.58); color: rgba(255,255,255,.84); font: 700 9px 'Space Mono'; letter-spacing: 1px; backdrop-filter: blur(10px); }
.viewer-nav { position: absolute; z-index: 3; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 1px solid rgba(255,255,255,.2); border-radius: 50%; background: rgba(25,21,19,.55); color: #fff; font-size: 30px; cursor: pointer; opacity: .76; transition: .2s; }
.viewer-nav:hover { opacity: 1; transform: translateY(-50%) scale(1.06); }.viewer-prev { left: 18px; }.viewer-next { right: 18px; }
.viewer-info { display: flex; flex-direction: column; justify-content: flex-end; padding: 54px 38px 42px; background: linear-gradient(155deg, #38302b, #27221f); }
.viewer-info small { color: #dc8b6d; font: 700 9px 'Space Mono'; letter-spacing: 1.4px; }
.viewer-info h2 { margin: 12px 0 18px; font-size: clamp(22px, 2.2vw, 34px); line-height: 1.25; overflow-wrap: anywhere; }
.viewer-meta { display: flex; align-items: center; gap: 10px; color: rgba(255,255,255,.48); font: 400 8px 'Space Mono'; letter-spacing: 1px; }.viewer-meta i { width: 24px; height: 1px; background: #bf6a4c; }
.viewer-info p { margin: 28px 0 0; color: rgba(255,255,255,.56); font-size: 12px; line-height: 1.8; }
body.viewer-open canvas { pointer-events: none; }
@keyframes viewerIn { from { opacity: 0; transform: translateY(26px) scale(.97); } to { opacity: 1; transform: none; } }

@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; }
  .photo-viewer { padding: 14px 14px calc(88px + env(safe-area-inset-bottom)); align-items: end; }
  .viewer-card { width: 100%; max-height: 82vh; grid-template-columns: 1fr; grid-template-rows: minmax(280px, 58vh) auto; border-radius: 22px; }
  .viewer-image-wrap { min-height: 0; }
  .viewer-info { padding: 24px 24px 28px; }
  .viewer-info h2 { margin: 8px 48px 12px 0; font-size: 22px; }
  .viewer-info p { display: none; }
  .viewer-close { top: auto; bottom: 108px; right: 22px; }
  .viewer-nav { width: 40px; height: 40px; }

}

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

