* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: #0d0b12; color: #2a2118; font-family: "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif; }
.room { position: relative; width: 100%; height: 100dvh; overflow: hidden; }
.room-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; pointer-events: none; transition: opacity .6s; }
body.has-video .room-video { opacity: 1; }
body.has-video .room-bg, body.has-video .chara { display: none; }
.room-blur { display: none; }
.room-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; object-position: 50% 50%; transform: scale(1.04); animation: breathe 9s ease-in-out infinite alternate; will-change: transform; }
.l2d { display: none; }
.chara { position: absolute; left: 47%; bottom: 12%; height: 50%; width: auto; transform-origin: 50% 100%; filter: drop-shadow(0 10px 18px rgba(40,25,10,.25)); animation: charaIdle 4.5s ease-in-out infinite alternate; user-select: none; pointer-events: none; }
.chara.talking { animation: charaTalk .32s ease-in-out infinite alternate; }
@keyframes charaIdle { from { transform: translateY(0) scale(1); } to { transform: translateY(-9px) scale(1.012); } }
@keyframes charaTalk { from { transform: translateY(-2px) scale(1); } to { transform: translateY(-6px) scale(1.016); } }
.sunlight { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(46% 60% at 28% 18%, rgba(255,244,214,.55), transparent 70%), radial-gradient(34% 40% at 68% 30%, rgba(255,236,190,.25), transparent 70%); mix-blend-mode: screen; opacity: .55; animation: lightShift 14s ease-in-out infinite alternate; }
.dust { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.dust i { position: absolute; display: block; width: 3px; height: 3px; border-radius: 50%; background: rgba(255,246,220,.85); box-shadow: 0 0 6px rgba(255,240,200,.7); opacity: 0; animation: floatUp linear infinite; }
@keyframes breathe { from { transform: scale(1.008) translateY(0); } to { transform: scale(1.014) translateY(-2px); } }
@keyframes lightShift { from { opacity: .4; transform: translateX(-1%); } to { opacity: .68; transform: translateX(1%); } }
@keyframes floatUp { 0% { opacity: 0; transform: translate3d(0, 12vh, 0) scale(.7); } 15% { opacity: .7; } 85% { opacity: .5; } 100% { opacity: 0; transform: translate3d(18px, -30vh, 0) scale(1.1); } }
@media (prefers-reduced-motion: reduce) {
  .room-bg { animation: none; transform: scale(1.02); }
  .sunlight { animation: none; }
  .dust i { display: none; }
}

.vignette { position: absolute; inset: 0; background: radial-gradient(120% 90% at 55% 40%, transparent 55%, rgba(20,14,8,.28) 100%); pointer-events: none; }

.hud { position: absolute; top: max(14px, env(safe-area-inset-top)); left: 16px; right: 16px; display: flex; gap: 8px; align-items: center; pointer-events: none; }
.pill { background: rgba(255,250,242,.78); border: 1px solid rgba(90,70,45,.14); backdrop-filter: blur(8px); border-radius: 999px; padding: 7px 13px; font-size: 13px; letter-spacing: .3px; box-shadow: 0 4px 18px rgba(50,35,20,.10); }
.pill.subtle { background: rgba(255,250,242,.55); color: #6b5c49; }

.bubble { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); max-width: min(560px, 72vw); background: rgba(255,252,246,.92); border: 1px solid rgba(90,70,45,.12); border-radius: 18px 18px 18px 6px; padding: 12px 18px; font-size: clamp(14px, 1.6vw, 18px); line-height: 1.6; box-shadow: 0 12px 36px rgba(50,35,20,.16); transition: opacity .25s, transform .25s; }
.bubble.hide { opacity: 0; transform: translate(-50%, -6px); pointer-events: none; }

.dock { position: absolute; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 10px; padding: 10px 12px; background: rgba(255,250,242,.72); border: 1px solid rgba(90,70,45,.12); border-radius: 22px; backdrop-filter: blur(10px); box-shadow: 0 14px 40px rgba(50,35,20,.16); }
.dock button { appearance: none; border: 0; background: transparent; color: #4a3a28; width: 64px; padding: 8px 4px; border-radius: 14px; cursor: pointer; display: grid; gap: 3px; justify-items: center; transition: background .18s, transform .18s; }
.dock button span { font-size: 20px; line-height: 1; }
.dock button b { font-size: 11px; font-weight: 500; }
.dock button:hover { background: rgba(255,255,255,.75); transform: translateY(-2px); }
.dock button:active { transform: translateY(0); }

.mic { position: absolute; right: max(22px, env(safe-area-inset-right)); bottom: max(28px, env(safe-area-inset-bottom)); width: 58px; height: 58px; border-radius: 50%; border: 0; background: rgba(255,250,242,.85); font-size: 22px; cursor: pointer; box-shadow: 0 10px 30px rgba(50,35,20,.20); transition: transform .18s; }
.mic:hover { transform: scale(1.06); }

.panel { position: absolute; right: 18px; bottom: 96px; width: min(380px, calc(100vw - 36px)); max-height: 62dvh; overflow: auto; background: rgba(255,252,246,.95); border: 1px solid rgba(90,70,45,.14); border-radius: 18px; padding: 18px; box-shadow: 0 18px 50px rgba(50,35,20,.22); backdrop-filter: blur(14px); }
.panel .close { position: absolute; right: 10px; top: 8px; border: 0; background: transparent; font-size: 22px; cursor: pointer; color: #6b5c49; }
.panel h3 { margin: 0 0 10px; font-size: 15px; letter-spacing: .5px; }
.panel p { margin: 8px 0; color: #6b5c49; font-size: 13px; line-height: 1.7; }
.panel input { width: 100%; margin-top: 10px; padding: 10px 12px; border: 1px solid rgba(90,70,45,.2); border-radius: 12px; background: #fffdf8; font: inherit; font-size: 14px; outline: none; }
.panel input:focus { border-color: #b79b72; }
.panel .hint { font-size: 12px; color: #9a8870; }
.panel .reply { background: #f3eadc; border-radius: 12px; padding: 8px 10px; margin-top: 8px; font-size: 13px; line-height: 1.6; }

@media (max-width: 640px) {
  .room-bg { object-fit: cover; object-position: 62% 50%; }
  .chara { left: 50%; translate: -50% 0; bottom: 10%; height: 56%; }
  .bubble { top: 12%; max-width: 82vw; font-size: 15px; }
  .dock { left: 10px; right: 10px; bottom: max(12px, env(safe-area-inset-bottom)); transform: none; justify-content: space-between; gap: 0; padding: 8px 6px; }
  .dock button { width: auto; flex: 1; }
  .dock button span { font-size: 18px; }
  .dock button b { font-size: 10px; }
  .mic { right: 14px; bottom: calc(max(12px, env(safe-area-inset-bottom)) + 74px); width: 48px; height: 48px; font-size: 18px; }
  .panel { left: 10px; right: 10px; bottom: 92px; width: auto; max-height: 62dvh; }
  .hud { top: max(10px, env(safe-area-inset-top)); left: 10px; right: 10px; }
  .pill { padding: 6px 11px; font-size: 12px; }
}
@media (max-height: 520px) {
  .bubble { top: 10%; }
  .dock { bottom: 10px; }
  .mic { bottom: 14px; }
}
