/* 香侬深夜房间 — dark cozy overlay chrome over Three.js canvas */
:root {
  --bg: #07090f;
  --ink: #eef2ff;
  --muted: #9aa3c0;
  --accent: #c9a36a;
  --accent-soft: rgba(201, 163, 106, 0.22);
  --panel: rgba(10, 12, 24, 0.55);
  --panel-strong: rgba(10, 12, 24, 0.78);
  --border: rgba(255, 255, 255, 0.1);
  --lamp: #ffb86b;
  --rain: #7ec8ff;
  --cola: #ff6b8a;
  --bed: #b8a0ff;
  --shinano: #ffd6ec;
  --radius: 14px;
  --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
}

#c {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
#c.is-dragging { cursor: grabbing; }
#c.is-hot { cursor: pointer; }

.chrome {
  position: absolute;
  z-index: 5;
  pointer-events: none;
}
.chrome button,
.chrome input,
.chrome select,
.chrome label {
  pointer-events: auto;
}

.top {
  top: calc(1rem + var(--safe-t));
  left: 1rem;
  right: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.85rem 0.55rem 0.55rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.mark {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #1a1020;
  background: radial-gradient(circle at 30% 25%, #ffe7f3, #e8a0c8 55%, #8b5a8a);
  box-shadow: 0 0 18px rgba(255, 180, 220, 0.45);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.brand-text strong {
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: 0.04em;
}
.brand-text span {
  font-size: 0.68rem;
  color: var(--muted);
}

.hint {
  margin: 0;
  max-width: 18rem;
  padding: 0.55rem 0.85rem;
  font-size: 0.78rem;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: color 0.25s, border-color 0.25s;
}
.hint.is-active {
  color: var(--ink);
  border-color: rgba(201, 163, 106, 0.45);
}

.side {
  top: 50%;
  right: 0.75rem;
  transform: translateY(-50%);
}

.hotspot-legend {
  list-style: none;
  margin: 0;
  padding: 0.65rem 0.75rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 0.72rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.hotspot-legend li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
  transition: color 0.2s, opacity 0.2s;
  opacity: 0.85;
}
.hotspot-legend li.is-on {
  color: var(--ink);
  opacity: 1;
}
.dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 8px currentColor;
}
.dot.lamp { background: var(--lamp); color: var(--lamp); }
.dot.window { background: var(--rain); color: var(--rain); }
.dot.cola { background: var(--cola); color: var(--cola); }
.dot.bed { background: var(--bed); color: var(--bed); }
.dot.shinano { background: var(--shinano); color: var(--shinano); }

.bottom {
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1rem;
  padding: 1rem 1rem calc(1rem + var(--safe-b));
  background: linear-gradient(to top, rgba(7, 9, 15, 0.92) 0%, rgba(7, 9, 15, 0.55) 55%, transparent 100%);
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel-strong);
  color: var(--ink);
  font: inherit;
  border-radius: 999px;
  padding: 0.7rem 1.15rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: transform 0.15s, background 0.2s, border-color 0.2s;
}
.btn:hover { border-color: rgba(201, 163, 106, 0.5); }
.btn:active { transform: scale(0.98); }
.btn.primary {
  background: linear-gradient(135deg, #d4b07a, #a67c52);
  color: #1a1208;
  border-color: transparent;
  font-weight: 650;
  min-width: 10.5rem;
  justify-content: center;
  box-shadow: 0 8px 28px rgba(166, 124, 82, 0.35);
}
.btn.primary[aria-pressed="true"] {
  background: linear-gradient(135deg, #6a7fb8, #44588f);
  color: var(--ink);
  box-shadow: 0 8px 28px rgba(80, 100, 160, 0.35);
}
.btn-ico { font-size: 0.75rem; }

.ctrl {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.68rem;
  color: var(--muted);
  min-width: 7rem;
}
.ctrl input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}
.ctrl select {
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-strong);
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
}

.status {
  margin: 0;
  flex: 1 1 100%;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.fallback {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(90, 60, 120, 0.35), transparent 50%),
    radial-gradient(ellipse at 70% 60%, rgba(180, 120, 60, 0.18), transparent 45%),
    linear-gradient(160deg, #0c1020, #07090f 60%);
  pointer-events: none;
}
.fallback[hidden] { display: none !important; }
.fallback-inner {
  text-align: center;
  padding: 1.5rem;
  max-width: 22rem;
}
.fallback .eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.fallback h1 {
  margin: 0 0 0.75rem;
  font-size: 1.6rem;
  font-weight: 600;
}
.fallback p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

@media (max-width: 720px) {
  .side { display: none; }
  .hint { max-width: 100%; font-size: 0.7rem; }
  .brand-text span { display: none; }
  .bottom { gap: 0.6rem; }
  .ctrl { min-width: 5.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
}
