/* 滿版星空；格線只分配操作位置，讓控制之間保留間隔。 */
.sr-only,.in-room .brand span,.in-room .quiet-tag { position:absolute!important; width:1px!important; height:1px!important; padding:0!important; margin:-1px!important; overflow:hidden!important; clip:rect(0,0,0,0)!important; clip-path:inset(50%)!important; white-space:nowrap!important; border:0!important; }
body.in-room { height:100dvh; min-height:0; }
.in-room #app { position:relative; height:100%; min-height:0; }
.in-room .site-header { position:absolute; top:calc(12px + env(safe-area-inset-top,0px)); left:calc(16px + env(safe-area-inset-left,0px)); z-index:4; height:44px; max-width:none; margin:0; padding:0; }
.in-room .brand { justify-content:center; height:44px; font-size:17px; gap:0; color:#f2f3ed; text-shadow:0 1px 3px #071322,0 0 10px #071322c9; }
.in-room .room-view { display:grid; grid-template-columns:52px minmax(0,1fr) 52px; grid-template-rows:44px minmax(140px,1fr) 112px; grid-template-areas:'head head head' 'left scene right' 'settings settings settings'; column-gap:6px; row-gap:6px; width:100%; max-width:none; height:100dvh; min-height:0; margin:0; padding:env(safe-area-inset-top,0px) calc(16px + env(safe-area-inset-right,0px)) calc(8px + env(safe-area-inset-bottom,0px)) calc(16px + env(safe-area-inset-left,0px)); }
.room-toolbar { grid-area:head; position:relative; top:12px; z-index:3; display:flex; justify-content:flex-end; align-items:center; gap:12px; min-width:0; height:44px; margin:0; padding:0 4px 0 140px; }
#room-name { font-size:17px; white-space:nowrap; }
.room-population { white-space:nowrap; font-size:11px; letter-spacing:.04em; }
.room-population,#room-name,.room-switch .text-button { color:#f2f3ed; text-shadow:0 1px 3px #071322,0 0 9px #071322e0; }
body.in-room:has(#scene[data-room='dream-b']) * { text-shadow:none!important; }
.in-room .canvas-shell { position:fixed; inset:0; z-index:0; width:100vw; height:100dvh; max-width:none; min-width:0; min-height:0; margin:0; padding:0; border:0; border-radius:0; box-shadow:none; }
.in-room .scene { position:absolute; inset:0; aspect-ratio:auto; width:100%; height:100%; min-height:0; container-type:size; }
.glass-button { display:inline-grid; place-items:center; flex:0 0 44px; width:44px; height:44px; min-width:44px; min-height:44px; padding:12px; border-radius:50%; color:#d4e0ded9; border:1px solid #e6f4ff26; background:linear-gradient(145deg,#d9edff10,#b2c6ef05),#12283c8c; backdrop-filter:blur(16px) saturate(115%); -webkit-backdrop-filter:blur(16px) saturate(115%); box-shadow:inset 0 1px 0 #ffffff16,0 3px 12px #04101e18; transition:background .25s,border-color .25s,box-shadow .25s; }
.glass-button svg { width:18px; height:18px; display:block; opacity:.8; fill:none; stroke:currentColor; pointer-events:none; }
.glass-button:hover { background-color:#819eae28; border-color:#e6f4ff60; }
.glass-button[aria-pressed='true'],.glass-button[aria-expanded='true'] { background:linear-gradient(145deg,#edf5df29,#c5d6f31a),#3b526e50; border-color:#e7f3df70; color:#fff9e5; box-shadow:inset 0 1px 0 #ffffff30; }
.glass-button:disabled { opacity:.4; cursor:default; }
.glass-button:focus-visible,.timer-choice:focus-visible { outline:2px solid #f3ead4; outline-offset:2px; }
.room-controls { display:contents; }
.side-controls { position:relative; z-index:3; display:flex; flex-direction:column; justify-content:center; align-items:center; gap:4px; min-width:0; min-height:140px; }
.side-left { grid-area:left; }
.side-right { grid-area:right; }
.side-controls .control-group { display:flex; flex-direction:column; flex-wrap:nowrap; gap:4px; }
.settings-zone { grid-area:settings; position:relative; z-index:3; display:grid; grid-template-columns:minmax(0,1fr); grid-template-rows:68px 44px; height:112px; min-width:0; min-height:0; }
.settings-content { display:grid; grid-template-columns:minmax(0,1fr); place-items:center; min-width:0; min-height:0; }
.control-popover { position:static; display:flex; justify-content:center; align-items:center; width:280px; max-width:100%; min-height:0; height:60px; margin:0; padding:8px 14px; border:1px solid #e7f1ff28; border-radius:22px; background:linear-gradient(150deg,#d7edff17,#b4cbe508),#182b40b0; backdrop-filter:blur(20px); -webkit-backdrop-filter:blur(20px); box-shadow:inset 0 1px 0 #ffffff16; }
.control-popover input[type='range'] { width:100%; margin:0; accent-color:#d8e4d7; cursor:pointer; min-height:28px; }
.sound-options { width:292px; }
.icon-options { display:flex; align-items:center; justify-content:center; gap:6px; width:100%; }
.timer-panel { display:grid; grid-template-columns:minmax(0,1fr); grid-template-rows:16px 44px; gap:4px; width:min(340px,100%); height:66px; padding:0 8px; border-radius:16px; }
.timer-panel h2 { margin:0; text-align:center; font-size:12px; font-weight:400; line-height:16px; color:#d5e1de; }
.timer-options { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:6px; width:100%; }
.timer-choice { height:44px; min-height:44px; min-width:44px; padding:4px 7px; border-radius:18px; border:1px solid #dcebf335; background:#bdd8e60c; color:#dce7e4; font-size:12px; white-space:nowrap; }
.timer-choice[aria-pressed='true'] { border-color:#e7f3df90; background:#c5d6f32a; color:#fff8e6; }
.settings-footer { display:grid; grid-template-columns:52px minmax(0,1fr) 52px; align-items:center; gap:6px; min-width:0; }
.room-switch { position:static; display:flex; justify-content:center; align-items:center; margin:0; min-width:0; }
.room-switch .text-button { min-height:44px; white-space:nowrap; color:#d8e3de; font-size:12px; letter-spacing:.08em; text-decoration:none; padding:8px 6px; }
.room-feedback { position:static; display:flex; align-items:center; justify-content:center; gap:4px; min-width:0; }
.wake-controls.glass-button { position:static; justify-self:center; margin:0; padding:12px; }
body.controls-resting .wake-controls { opacity:.65; }
.orientation-dialog { width:min(360px,calc(100vw - 32px)); max-height:calc(100dvh - 32px); padding:26px 20px; color:#edf0e7; border:1px solid #d6e6ec40; border-radius:24px; background:#15283cf5; box-shadow:0 20px 70px #0005; }
.orientation-dialog::backdrop { background:#081320cc; }
.orientation-dialog h2 { font-size:18px; font-weight:400; line-height:1.7; text-align:center; margin:0 0 24px; }
.orientation-actions { display:flex; justify-content:center; gap:12px; }
.orientation-actions button { min-height:44px; }
.orientation-actions button:disabled { opacity:.4; cursor:default; }
.help-dialog { width:min(440px,calc(100vw - 32px)); max-height:calc(100dvh - 32px); overflow-y:auto; padding:22px 22px 18px; color:#edf0e7; border:1px solid #d6e6ec40; border-radius:24px; background:#15283cf5; box-shadow:0 20px 70px #0005; }
.help-dialog::backdrop { background:#081320cc; }
.help-dialog h2 { font-size:18px; font-weight:400; text-align:center; margin:0 0 6px; }
.help-list { margin:0; }
.help-list dt { margin:14px 0 0; font-size:14px; line-height:1.6; color:#fff8e6; }
.help-list dd { margin:3px 0 0; font-size:13px; line-height:1.75; color:#cfdad8; }
.help-actions { display:flex; justify-content:center; margin-top:18px; }
.help-actions button { min-height:44px; min-width:120px; }
/* 矮的橫向畫面放不下左側四顆：問號改放左下角，與右下收起鈕對稱；連線提示出現時讓位。 */
@media(max-height:380px) { .side-left { z-index:4; } .side-left #help-toggle { position:fixed; left:calc(20px + env(safe-area-inset-left,0px)); bottom:calc(8px + env(safe-area-inset-bottom,0px)); } body:has(#retry-connect:not(.hidden)) #help-toggle,body:has(#alternate-room:not(.hidden)) #help-toggle { display:none; } }
@media(max-height:340px) { .side-controls { top:6px; } }
@media(prefers-reduced-motion:reduce) { .glass-button { transition:none; } }


/* 直拿時的溫柔提示：不擋畫面、5 秒後自己消失，點一下也能關。 */
.orientation-hint { position:fixed; left:50%; top:calc(68px + env(safe-area-inset-top,0px)); transform:translateX(-50%); z-index:6; max-width:calc(100vw - 32px); padding:8px 16px; border-radius:20px; border:1px solid #e6f4ff30; background:#12283ccc; -webkit-backdrop-filter:blur(12px); backdrop-filter:blur(12px); color:#f2f3ed; font-size:13px; letter-spacing:.04em; white-space:nowrap; }

/* 語言切換：首頁右上一組，房間裡在「常見問題」裡一組。 */
.lang-switch { display:flex; gap:4px; padding:3px; border:1px solid #e6f4ff26; border-radius:20px; background:#12283c80; }
.lang-button { min-height:32px; padding:4px 12px; border:0; border-radius:16px; background:none; color:#cfd9de; font-size:13px; letter-spacing:.04em; }
.lang-button[aria-pressed='true'] { background:#e9dfc8; color:#19263c; }
.in-room .site-header .lang-switch { display:none; }
.help-language { display:flex; justify-content:center; align-items:center; gap:10px; margin-top:16px; color:#cfdad8; font-size:13px; }

/* 聲音下載、準備中：音樂按鈕輕輕一明一暗（減少動態時不閃）。 */
@keyframes sound-loading { 0%,100% { opacity:1; } 50% { opacity:.45; } }
#noise-toggle.is-loading svg { animation:sound-loading 1.2s ease-in-out infinite; }

/* 飄法選單：兩個選項，沿用定時選單的外觀。 */

/* 矮的橫向畫面右邊放不下四顆：飄法按鈕移到右下角、收起鈕左邊。 */
@media(max-height:380px) { .side-right { z-index:4; } .side-right #brightness-toggle { position:fixed; right:calc(20px + 52px + env(safe-area-inset-right,0px)); bottom:calc(8px + env(safe-area-inset-bottom,0px)); } }
/* 與問號、亮度鈕共用底部位置，避免矮螢幕的格線最小高度把收起鈕擠出畫面。 */
@media(max-height:380px) { .wake-controls.glass-button { position:fixed; right:calc(20px + env(safe-area-inset-right,0px)); bottom:calc(8px + env(safe-area-inset-bottom,0px)); } }

/* 定時、漂浮型態兩個選單：字大小不變，按鈕邊框貼近字；外框只包住標題和按鈕（使用者 11/06）。 */
.timer-panel { width:auto!important; max-width:100%; height:auto!important; padding:6px 10px 8px!important; grid-template-rows:auto auto!important; }
.timer-options { display:flex!important; justify-content:center; flex-wrap:wrap; gap:6px; width:auto!important; }
.timer-choice { height:auto!important; min-height:34px!important; min-width:0!important; padding:4px 12px!important; border-radius:17px!important; }

/* ===== 按鈕與選單的玻璃質感（使用者 11/06）=====
   夜潮：清透的淡白毛玻璃；點選中更白更亮。
   霧藍：沒點選是淺色玻璃（深藍圖示），點選中是深色玻璃（白圖示）。 */
.in-room:has(#scene[data-room='dream-a']) .glass-button { color:#f4f7ff; border:1px solid #ffffff4d; background:linear-gradient(145deg,#ffffff2e,#ffffff10),#ffffff0d; -webkit-backdrop-filter:blur(22px) saturate(160%); backdrop-filter:blur(22px) saturate(160%); box-shadow:inset 0 1px 0 #ffffff59,0 4px 14px #0510221f; }
.in-room:has(#scene[data-room='dream-a']) .glass-button[aria-pressed='true'],
.in-room:has(#scene[data-room='dream-a']) .glass-button[aria-expanded='true'] { color:#ffffff; border-color:#ffffffb0; background:linear-gradient(145deg,#ffffff5c,#ffffff2e),#ffffff1f; box-shadow:inset 0 1px 0 #ffffff8c,0 0 14px #ffffff2e; }
.in-room:has(#scene[data-room='dream-a']) .control-popover { border:1px solid #ffffff40; background:linear-gradient(150deg,#ffffff26,#ffffff0d),#ffffff08; -webkit-backdrop-filter:blur(24px) saturate(160%); backdrop-filter:blur(24px) saturate(160%); box-shadow:inset 0 1px 0 #ffffff4d; }
.in-room:has(#scene[data-room='dream-a']) .timer-choice { color:#f2f5fa; border:1px solid #ffffff40; background:#ffffff14; }
.in-room:has(#scene[data-room='dream-a']) .timer-choice[aria-pressed='true'] { color:#ffffff; border-color:#ffffffb8; background:#ffffff47; }

.in-room:has(#scene[data-room='dream-b']) .glass-button { color:#2a3a5c; border:1px solid #ffffff8f; background:linear-gradient(145deg,#ffffff70,#ffffff3a),#eef3ff2e; -webkit-backdrop-filter:blur(18px) saturate(140%); backdrop-filter:blur(18px) saturate(140%); box-shadow:inset 0 1px 0 #ffffffa6,0 3px 12px #24345a1f; }
.in-room:has(#scene[data-room='dream-b']) .glass-button svg { opacity:.9; }
.in-room:has(#scene[data-room='dream-b']) .glass-button[aria-pressed='true'],
.in-room:has(#scene[data-room='dream-b']) .glass-button[aria-expanded='true'] { color:#eef4f2; border-color:#e6f4ff40; background:linear-gradient(145deg,#d9edff10,#b2c6ef05),#12283ca6; box-shadow:inset 0 1px 0 #ffffff16,0 3px 12px #04101e24; }
.in-room:has(#scene[data-room='dream-b']) .control-popover { border:1px solid #ffffff99; background:linear-gradient(150deg,#ffffff78,#ffffff40),#eef3ff2e; -webkit-backdrop-filter:blur(20px) saturate(140%); backdrop-filter:blur(20px) saturate(140%); box-shadow:inset 0 1px 0 #ffffffb3,0 4px 16px #24345a1f; }
.in-room:has(#scene[data-room='dream-b']) .control-popover input[type='range'] { accent-color:#3b5480; }
.in-room:has(#scene[data-room='dream-b']) .timer-panel h2 { color:#2a3a5c; }
.in-room:has(#scene[data-room='dream-b']) .timer-choice { color:#24345a; border:1px solid #ffffffa6; background:#ffffff5c; }
.in-room:has(#scene[data-room='dream-b']) .timer-choice[aria-pressed='true'] { color:#f2f5f0; border-color:#e6f4ff40; background:#12283cb8; }
