/* ===== 虛擬大廳 ===== */
/* 上到下：標題列、公告、場景（填滿剩下的高度）、按鈕列；公告折成兩行也不會把場景推出螢幕 */
.lobby-body {
  background: linear-gradient(#a9dcff, #eaf7ff);
  height: 100vh; height: 100dvh; overflow: hidden;   /* 舊版 Android WebView 不支援 dvh，先給 vh */
  display: flex; flex-direction: column;
}
.lobby-body > header, .lobby-body > .notice-strip, .lobby-body > .lobby-bar { flex: none; }

.lobby-top {
  position: sticky; top: 0; z-index: 30;
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; background: rgba(255,255,255,.9); backdrop-filter: blur(6px);
  border-bottom: 1.5px solid var(--line);
}
.lobby-title { font-size: 16px; color: var(--rose-900); font-weight: bold; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lobby-online { font-size: 12px; color: var(--ink-soft); background: var(--rose-50); padding: 2px 10px; border-radius: 999px; flex: none; white-space: nowrap; }
/* 小螢幕手機（寬 360 以下）：標題、人數縮小，不換行 */
@media (max-width: 360px) {
  .lobby-top { padding-left: 10px; padding-right: 10px; gap: 6px; }
  .lobby-title { font-size: 14.5px; }
  .lobby-online { font-size: 11px; padding: 2px 7px; }
}

/* 場景：一個視窗，裡面的世界可以拖曳 */
.scene {
  position: relative; margin: 0 auto; width: 100%; max-width: 560px;
  flex: 1 1 0; min-height: 0; overflow: hidden;
  touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab;
}
.world { position: absolute; left: 0; top: 0; transition: transform .6s ease; will-change: transform; }
.world.dragging { transition: none; }
.world-bg, .world-fg { position: absolute; inset: 0; }
.world-bg svg, .world-fg svg { display: block; }
.world-fg { pointer-events: none; z-index: 100000; }
.layer { position: absolute; inset: 0; }

.cloud { animation: drift 40s ease-in-out infinite alternate; }
.c2 { animation-duration: 55s; } .c3 { animation-duration: 70s; }
@keyframes drift { from { transform: translateX(-30px); } to { transform: translateX(30px); } }

.drag-hint {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 5;
  background: rgba(0,0,0,.55); color: #fff; font-size: 13px; padding: 6px 14px; border-radius: 999px;
  pointer-events: none; animation: hint-bob 1.6s ease-in-out infinite;
}

/* 共用：放在場景上的物件，用腳底當定位點 */
.thing {
  position: absolute; transform: translate(-50%, -100%) scale(calc(var(--s, .78) * var(--k, 1)));
  transform-origin: 50% 100%;
}

/* ---------- 3D 試作（?3d=1）：背景換成 WebGL，物件每一格重新投影 ---------- */
.v3d .scene { background: linear-gradient(#a9dcff, #eaf7ff 70%); }
.v3d .scene.can-walk { cursor: pointer; }
.scene canvas.gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.v3d .world { width: 100% !important; height: 100% !important; transform: none !important; transition: none; }
.v3d .world-bg, .v3d .world-fg { display: none; }
.v3d .avatar { transition: none; }
.v3d .avatar .fig { visibility: hidden; }
.v3d .avatar svg { height: 72px; }
/* 更衣室的 3D 舞台：可以拖曳轉動 */
.v3d .stage-av { animation: none; width: 170px; height: 170px; }
.stage-av .stage-gl { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.dress-grid .tile img { width: 44px; height: 60px; display: block; margin: 0 auto; }   /* 人物約 1.9 格高，對話泡泡要在頭上 */
.v3d .sign .art { opacity: 0; }   /* 器材畫成立體的；平面圖透明但還在，點得到 */   /* 3D 版畫立體小人，平面圖藏起來（保留高度給對話泡泡） */
.v3d .thing.behind { opacity: .3; }   /* 被建築物擋住 */
.b-label {
  position: absolute; transform: translate(-50%, -100%); pointer-events: none; white-space: nowrap;
  font-size: 12px; font-weight: bold; color: #3a3033; background: rgba(255, 255, 255, .92);
  padding: 3px 10px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
}
.b-label::after {
  content: ""; position: absolute; left: 50%; top: 100%; margin-left: -5px;
  border: 5px solid transparent; border-top-color: rgba(255, 255, 255, .92);
}

/* ---------- 傳送門 ---------- */
.portal { width: 58px; cursor: pointer; text-align: center; }
.portal .ring {
  width: 58px; height: 76px; border-radius: 50%; margin: 0 auto;
  background: conic-gradient(from 0deg, #ff9bb3, #ffd36b, #8fe3c8, #8fb8ff, #c79bff, #ff9bb3);
  padding: 5px; box-shadow: 0 0 18px 4px rgba(255, 170, 200, .75);
  animation: portal-glow 2.4s ease-in-out infinite;
}
.portal .ring::before {
  content: ""; display: block; width: 100%; height: 100%; border-radius: 50%;
  background:
    repeating-conic-gradient(from 0deg, rgba(255,255,255,.85) 0 12deg, rgba(255,255,255,0) 12deg 40deg),
    radial-gradient(circle, #fff 0 18%, #ffd9e4 40%, #c6a3ff 100%);
  animation: spin 3s linear infinite;
}
.portal .tag {
  display: inline-block; margin-bottom: 4px; white-space: nowrap;
  font-size: 12px; font-weight: bold; color: #fff; background: var(--rose-700);
  padding: 2px 10px; border-radius: 999px; box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.portal.far .tag { background: #2f6f9c; }
.portal.bus .ring { opacity: 0; }   /* 接駁車站：漩渦透明但點得到 */
.portal:active .ring { transform: scale(.92); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes portal-glow { 50% { box-shadow: 0 0 26px 8px rgba(255, 170, 200, .95); } }

/* ---------- 小人 ---------- */
.avatar { width: 44px; pointer-events: none; transition: left .9s ease-in-out, top .9s ease-in-out; }
.avatar svg { display: block; width: 44px; height: 60px; overflow: visible; }
.avatar .name {
  position: absolute; left: 50%; top: 100%; transform: translateX(-50%);
  font-size: 10px; white-space: nowrap; color: var(--ink);
  background: rgba(255,255,255,.85); padding: 0 6px; border-radius: 999px; margin-top: 1px;
}
.avatar.me .name { background: var(--rose-700); color: #fff; }
.avatar.walking svg { animation: hop .3s ease-in-out infinite; }
.avatar .fig { display: block; }
.avatar.flip .fig { transform: scaleX(-1); }
.avatar .bubble {
  position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%);
  background: #fff; border-radius: 10px; padding: 2px 8px; font-size: 11px; white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,.12); animation: pop .3s ease-out;
}
@keyframes hop { 50% { transform: translateY(-4px); } }
@keyframes pop { from { transform: translateX(-50%) scale(0); } }
.avatar.idle svg { animation: breathe-a 3s ease-in-out infinite; }
@keyframes breathe-a { 50% { transform: translateY(-1.5px); } }

/* ---------- 健身器材＋留言泡泡 ---------- */
.sign { width: 64px; cursor: pointer; display: flex; flex-direction: column; align-items: center; }
.sign .art { width: 56px; height: 40px; }
.sign .art svg { width: 100%; height: 100%; display: block; overflow: visible; }
.sign .msg {
  position: relative; max-width: 96px; margin-bottom: 4px;
  background: #fff; border-radius: 10px; padding: 3px 7px;
  font-size: 10px; line-height: 1.3; color: var(--ink); text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sign .msg::after {
  content: ""; position: absolute; left: 50%; bottom: -4px; margin-left: -4px;
  border: 4px solid transparent; border-bottom: 0; border-top-color: #fff;
}
.item-join .msg { border: 1.5px solid var(--rose-300); }
.sign .plus {
  display: inline-block; margin-left: 4px; background: var(--rose-700); color: #fff;
  font-size: 9px; border-radius: 999px; padding: 0 5px;
}
.sign.new { animation: plant .5s cubic-bezier(.2,1.6,.4,1); }
@keyframes plant { from { transform: translate(-50%, -160%) scale(calc(var(--s, .78) * var(--k, 1))); opacity: 0; } }
.sign:active .art { transform: translateY(2px); }

/* ---------- 底部按鈕 ---------- */
.lobby-bar {
  position: sticky; bottom: 0; z-index: 30;
  display: flex; gap: 10px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.92); backdrop-filter: blur(6px); border-top: 1.5px solid var(--line);
}
.bar-btn {
  flex: 1; font: inherit; font-size: 15px; padding: 10px; border-radius: 999px; cursor: pointer;
  border: 2px solid var(--rose-300); background: #fff; color: var(--rose-900);
}
.bar-btn.primary { background: var(--rose-700); border-color: var(--rose-700); color: #fff; }
.lobby-bar[hidden] { display: none; }
/* 大廳沒有按鈕列：聊天按鈕往下貼齊 */
body:has(.lobby-bar[hidden]) .chat { bottom: calc(14px + env(safe-area-inset-bottom)); }
/* 3D 的操作提示放上面，不跟左下的聊天按鈕疊在一起 */
.v3d .drag-hint { top: 56px; bottom: auto; white-space: nowrap; }   /* 讓開上面的「連線中…」 */

/* ---------- 底部彈出面板 ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 50; background: rgba(60, 30, 40, .35);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet-card {
  width: min(100%, 480px); background: #fff; border-radius: 22px 22px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); max-height: 88vh; max-height: 88dvh; overflow-y: auto;
  animation: slide-up .25s ease-out;
}
@keyframes slide-up { from { transform: translateY(100%); } }
.sheet-card h3 { margin: 0 0 12px; color: var(--rose-900); text-align: center; }
.avatar-preview { display: grid; place-items: center; height: 110px; background: var(--rose-50); border-radius: 16px; margin-bottom: 10px; }
.avatar-preview svg { width: 70px; height: 96px; }
.pick { margin-bottom: 10px; }
.pick label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 4px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt {
  font: inherit; font-size: 13px; cursor: pointer; border: 2px solid var(--line); background: #fff;
  border-radius: 999px; padding: 5px 12px; color: var(--ink);
}
.opt.swatch { width: 32px; height: 32px; padding: 0; border-radius: 50%; }
.opt[aria-pressed=true] { border-color: var(--rose-700); box-shadow: 0 0 0 2px var(--rose-100); }
.opt:not(.swatch)[aria-pressed=true] { background: var(--rose-700); color: #fff; }
.sign-types { margin-bottom: 10px; }
.sheet-card textarea { margin-bottom: 12px; }
.sheet-actions { display: flex; gap: 10px; }
.sheet-actions .submit { flex: 2; margin: 0; }
.ghost {
  flex: 1; font: inherit; font-size: 16px; border-radius: 999px; cursor: pointer;
  border: 2px solid var(--line); background: #fff; color: var(--ink-soft);
}

/* 看牌子 */
/* ---------- 揪團卡片（範本 B）：四段進度條、標題、人數＋時段、成員、討論＋主要按鈕、小字 ---------- */
.rc-steps { display: flex; gap: 4px; }
.rc-steps i { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.rc-steps i.on { background: var(--rose-700); }
.rc-step-names { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-soft); margin: 5px 0 12px; }
.rc-step-names .now { color: var(--rose-700); font-weight: bold; }
.rc-title { font-size: 19px; font-weight: bold; color: var(--ink); line-height: 1.35; word-break: break-word; }
.rc-meta { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-soft); margin-top: 4px; }
.rc-meta svg { width: 22px; height: 30px; flex: none; }
.rc-courses { font-size: 12.5px; color: var(--ink-soft); margin-top: 4px; }
.rc-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.rc-stats div { background: var(--rose-50); border-radius: 12px; padding: 8px 12px; font-size: 13px; color: var(--rose-900); }
.rc-stats small { display: block; font-size: 11px; color: var(--ink-soft); }
.rc-stats b { font-size: 20px; margin-right: 2px; }
.rc-slots { font-size: 13px; color: var(--ink); margin-top: 10px; line-height: 1.5; }
.rc-size { font-size: 12.5px; color: var(--rose-900); background: var(--rose-50); border-radius: 10px; padding: 7px 10px; margin-top: 8px; }
.rc-edit { font: inherit; font-size: 12px; margin-left: 4px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--rose-300); background: #fff; color: var(--rose-900); cursor: pointer; }
.rc-hint { font-size: 13px; color: var(--ink-soft); margin: 6px 0 10px; line-height: 1.5; }
#es-box .cal-blk { font-size: 9.5px; }
.rc-members { margin-top: 10px; }
.rc-members:empty { display: none; }
.rc-actions { display: flex; gap: 8px; margin-top: 14px; }
.rc-talk { flex: 1; font: inherit; font-size: 14px; padding: 10px 8px; border-radius: 999px; border: 1.5px solid var(--rose-300); background: #fff; color: var(--rose-900); cursor: pointer; }
.rc-main { flex: 2; margin: 0 !important; }
.rc-wait { flex: 2; display: grid; place-items: center; text-align: center; font-size: 13px; color: var(--ink-soft); background: var(--rose-50); border-radius: 999px; padding: 10px; }
.rc-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 12px; font-size: 11px; color: var(--ink-soft); }
.rc-foot .rm-btn { margin: 0; font-size: 12px; flex: none; }

.read-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.read-head svg { width: 40px; height: 54px; flex: none; }
.read-head b { color: var(--rose-900); }
.read-head small { display: block; color: var(--ink-soft); font-size: 12px; }
.read-text { font-size: 17px; background: #fff7ea; border: 2px solid #f1d6a8; border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; }
.read-actions { display: flex; gap: 10px; }
.read-actions .submit { margin: 0; font-size: 15px; letter-spacing: 0; }
.plus-btn {
  flex: 1; font: inherit; font-size: 15px; border-radius: 999px; cursor: pointer; padding: 12px;
  border: 2px solid var(--rose-500); background: #fff; color: var(--rose-700);
}
.plus-btn[aria-pressed=true] { background: var(--rose-100); }

/* 插牌提示 */
.place-hint {
  position: fixed; left: 50%; top: 64px; transform: translateX(-50%); z-index: 40;
  background: var(--rose-900); color: #fff; padding: 8px 16px; border-radius: 999px; font-size: 14px;
  animation: hint-bob 1.2s ease-in-out infinite;
}
@keyframes hint-bob { 50% { transform: translate(-50%, 4px); } }
.placing .scene { outline: 3px dashed var(--rose-500); outline-offset: -3px; cursor: crosshair; }

/* 傳送轉場 */
.warp {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; align-content: center;
  background: radial-gradient(circle, #fff 0, #ffd9e4 35%, #c6a3ff 100%);
  animation: warp-in .5s ease-out;
}
.warp-swirl {
  width: 160px; height: 160px; border-radius: 50%;
  background: repeating-conic-gradient(#fff 0 15deg, transparent 15deg 45deg);
  animation: spin .8s linear infinite;
}
.warp p { color: var(--rose-900); font-size: 18px; font-weight: bold; margin-top: 16px; }
@keyframes warp-in { from { opacity: 0; transform: scale(1.4); } }

@media (prefers-reduced-motion: reduce) {
  .portal .ring, .portal .ring::before, .cloud, .avatar svg, .warp-swirl { animation: none !important; }
}

/* 雙和：屋頂花園底色 */
.lobby-body.theme-blue { background: linear-gradient(#bfe3ff, #eef8ff); }
.theme-blue .portal.far .tag { background: #b3405a; }

/* ---------- 雙和公告 ---------- */
.notice-strip {
  position: sticky; top: 45px; z-index: 29; text-align: center;
  background: #fff6d6; color: #7a5a00; font-size: 12.5px; padding: 6px 12px;
  border-bottom: 1px solid #f0dc9a;
}
  position: relative; z-index: 1;
  background: #2f6f9c; color: #fff; border: 3px solid #fff; border-radius: 10px;
  font-size: 11px; line-height: 1.35; text-align: center; padding: 6px 8px;
  box-shadow: 0 4px 0 #1d4e72, 0 6px 12px rgba(0,0,0,.18);
}

/* ---------- 插牌時留資料 ---------- */
.profile-box { background: var(--rose-50); border: 1.5px dashed var(--line); border-radius: 14px; padding: 12px; margin-bottom: 12px; }
.profile-note { font-size: 12.5px; color: var(--ink-soft); margin: 0 0 10px; }
.profile-box .field { margin-bottom: 10px; }
.profile-box .field:last-child { margin-bottom: 0; }
.profile-box .invalid .opts { outline: 1.5px solid var(--rose-500); border-radius: 12px; }
.profile-saved { font-size: 13px; color: var(--ink-soft); margin: -4px 0 12px; }
.linkish { font: inherit; font-size: 13px; color: var(--rose-700); background: none; border: none; text-decoration: underline; cursor: pointer; padding: 0; }

/* 捏小人：下拉選單與身形滑桿 */
.select {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--cream); border: 1.5px solid var(--line); border-radius: 14px; padding: 9px 12px;
}
.range { width: 100%; accent-color: var(--rose-700); }
.pick label b { color: var(--rose-700); }

/* ---------- 懸吊教室：揪團 = 掛一條懸吊繩 ---------- */
.sign.strap { --s: 1; width: 40px; }
.sign.strap .art { width: 40px; height: auto; transform-origin: 50% 0; animation: sway 3.2s ease-in-out infinite alternate; }
.sign.strap .art svg { width: 40px; height: auto; }
.sign.strap .msg { position: absolute; left: 50%; bottom: 52px; transform: translateX(-50%); width: max-content; max-width: 110px; margin: 0; }
.sign.strap.new { animation: drop .6s cubic-bezier(.2,1.4,.4,1); }
@keyframes sway { from { transform: rotate(-1.5deg); } to { transform: rotate(1.5deg); } }
@keyframes drop { from { transform: translate(-50%, -140%) scale(1); opacity: 0; } }

/* ---------- 左下聊天框 ---------- */
.chat {
  position: fixed; left: max(10px, env(safe-area-inset-left)); bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 40; width: min(78vw, 320px);
  display: flex; flex-direction: column-reverse;   /* 按鈕在下、紀錄往上展開 */
}
.chat-toggle {
  align-self: flex-start; display: flex; align-items: center; gap: 6px; max-width: 100%;
  font: inherit; font-size: 13px; color: #fff; cursor: pointer;
  background: rgba(40, 30, 35, .62); backdrop-filter: blur(6px);
  border: none; border-radius: 999px; padding: 6px 12px; margin-top: 6px;
}
.chat-peek { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; opacity: .9; }
.chat-badge { background: var(--rose-500); color: #fff; font-size: 11px; border-radius: 999px; padding: 0 6px; min-width: 18px; text-align: center; }
.chat-arrow { font-size: 11px; opacity: .8; transition: transform .2s; }
.chat:not(.collapsed) .chat-arrow { transform: rotate(180deg); }

.chat-body {
  background: rgba(40, 30, 35, .55); backdrop-filter: blur(6px);
  border-radius: 16px; overflow: hidden;
  max-height: 260px; transition: max-height .25s ease, opacity .2s;
}
.chat.collapsed .chat-body { max-height: 0; opacity: 0; pointer-events: none; }

.chat-log {
  list-style: none; margin: 0; padding: 10px 12px 4px; height: 170px; overflow-y: auto;
  font-size: 13px; line-height: 1.45; color: #fff;
  -webkit-mask-image: linear-gradient(transparent, #000 18px);
          mask-image: linear-gradient(transparent, #000 18px);
}
.chat-log li { margin-bottom: 3px; word-break: break-word; }
.chat-log .t { font-size: 10px; opacity: .55; margin-right: 2px; }
.chat-log b { color: #ffd1dc; margin-right: 4px; }
.chat-log b::after { content: "："; }
.chat-log .mine b { color: #ffe08a; }
.chat-log .sys { color: #cfe8ff; font-size: 12px; }
.theme-blue .chat-log b { color: #bfe0ff; }

.chat-form { display: flex; gap: 6px; padding: 8px; border-top: 1px solid rgba(255,255,255,.12); }
.chat-form input {
  flex: 1; min-width: 0; font: inherit; font-size: 16px; color: #fff;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.2); border-radius: 999px; padding: 6px 12px; outline: none;
}
.chat-form input::placeholder { color: rgba(255,255,255,.6); }
.chat-form button {
  font: inherit; font-size: 14px; border: none; border-radius: 999px; padding: 6px 14px; cursor: pointer;
  background: var(--rose-700); color: #fff;
}
.avatar .bubble { max-width: 160px; white-space: normal; width: max-content; text-align: center; }

/* ---------- 尚未開放 ---------- */
.closed { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(255,245,247,.86); backdrop-filter: blur(4px); padding: 16px; }
.closed-card { background: #fff; border-radius: 22px; box-shadow: var(--shadow); padding: 26px 24px; text-align: center; max-width: 300px; }
.closed-ic { font-size: 42px; }
.closed-card b { display: block; font-size: 19px; color: var(--rose-900); margin: 6px 0 4px; }
.closed-card p { color: var(--ink-soft); margin: 0 0 16px; font-size: 14px; }
.closed-card .submit { display: block; text-decoration: none; text-align: center; }

/* ---------- 使用規章（淡入淡出） ---------- */
.rules {
  position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: 16px;
  background: rgba(60, 30, 40, .45); backdrop-filter: blur(5px);
  opacity: 0; transition: opacity .45s ease;
}
.rules.show { opacity: 1; }
.rules-card {
  width: min(100%, 440px); max-height: 86vh; max-height: 86dvh; display: flex; flex-direction: column;
  background: #fff; border-radius: 22px; box-shadow: 0 18px 40px rgba(0,0,0,.2); overflow: hidden;
  transform: translateY(16px) scale(.97); transition: transform .45s ease;
}
.rules.show .rules-card { transform: none; }
.rules-head { text-align: center; padding: 18px 18px 12px; background: var(--rose-50); border-bottom: 1.5px solid var(--line); }
.rules-head small { color: var(--ink-soft); font-size: 12px; letter-spacing: 1px; }
.rules-head h2 { margin: 4px 0 0; font-size: 20px; color: var(--rose-900); }
.rules-body { overflow-y: auto; padding: 14px 20px; font-size: 14px; line-height: 1.7; color: var(--ink); }
.rules-body h3 { font-size: 15px; color: var(--rose-700); margin: 14px 0 4px; }
.rules-body p { margin: 0 0 6px; }
.rules-body b { color: var(--rose-900); }
.rules-end { text-align: center; color: var(--ink-soft); font-size: 12px; margin-top: 14px !important; }
.rules-actions { display: flex; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1.5px solid var(--line); }
.rules-actions .ghost { display: grid; place-items: center; text-decoration: none; font-size: 13px; padding: 0 14px; white-space: nowrap; flex: none; }
.rules-actions .submit { flex: 2; margin: 0; font-size: 16px; letter-spacing: 0; }
.rules-actions .submit:disabled { background: #d9d0d3; box-shadow: none; }

/* 個資提醒 */
.pii-note { font-size: 12px; color: var(--ink-soft); background: var(--rose-50); border-radius: 10px; padding: 8px 10px; margin: 0 0 12px; line-height: 1.5; }
#read-card .pii-note { margin: 10px 0 0; }
.chat-form input:disabled { opacity: .6; }

/* ---------- 揪團：狀態、成員 ---------- */
.st { display: inline-block; font-size: 10px; border-radius: 999px; padding: 0 6px; margin-right: 3px; background: #eee; color: #666; vertical-align: 1px; }
.st-talk { background: #fff1d6; color: #a86a00; }
.st-confirmed { background: #ffe0ea; color: var(--rose-900); }
.st-closed { background: #ececec; color: #888; }
.members { background: var(--rose-50); border-radius: 14px; padding: 10px 12px; margin-bottom: 12px; }
.m-title { font-size: 13px; color: var(--ink-soft); }
.m-title b { color: var(--rose-700); }
.m-list { display: flex; gap: 8px; overflow-x: auto; margin-top: 6px; padding-bottom: 2px; }
.m-list .m { display: flex; flex-direction: column; align-items: center; flex: none; width: 48px; }
.m-list .m svg { width: 34px; height: 46px; }
.m-list .m small { font-size: 10px; color: var(--ink); max-width: 48px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-empty { color: var(--ink-soft); font-size: 12px; }
.read-status { flex: 1; text-align: center; color: var(--ink-soft); margin: 4px 0; font-size: 14px; }

/* ---------- 電腦版：地圖用滿整個視窗、按鈕列不拉太寬 ---------- */
@media (min-width: 760px) {
  .scene { max-width: none; }
  .lobby-bar { justify-content: center; }
  .lobby-bar .bar-btn { flex: 0 1 260px; }
  .lobby-top { padding-left: 24px; padding-right: 24px; }
  .chat { width: 360px; left: 20px; bottom: 84px; }
  .chat-log { height: 240px; }
  .chat-body { max-height: 330px; }
  .sheet { align-items: center; }
  .sheet-card { border-radius: 22px; max-width: 440px; }
  .drag-hint { bottom: 20px; }
}

.world { transform-origin: 0 0; }

/* 連線中：還沒載入真的資料前，小人和器材先不顯示 */
.connecting .layer .avatar, .connecting .layer .sign { visibility: hidden; }
.connecting .scene::after {
  content: "連線中…"; position: absolute; left: 50%; top: 16px; transform: translateX(-50%); z-index: 50;
  background: rgba(0,0,0,.55); color: #fff; font-size: 13px; padding: 6px 14px; border-radius: 999px;
}

.read-courses { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; }
.read-courses span { font-size: 12px; background: var(--rose-100); color: var(--rose-900); border-radius: 999px; padding: 2px 10px; }

/* 揪團：希望時段日曆 */
.slot-pick { margin: 0 0 12px; }
.slot-pick > label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; }
.slot-pick > label .req { color: var(--rose-500); }
.slot-pick.invalid #slot-box { outline: 1.5px solid var(--rose-500); outline-offset: 4px; border-radius: 12px; }
.slot-room { font-size: 13px; color: var(--rose-900); background: var(--rose-50); border-radius: 10px; padding: 5px 10px; margin-bottom: 8px; display: inline-block; }
#slot-box .cal-blk { font-size: 9.5px; }
.read-slots { background: var(--rose-50); border-radius: 12px; padding: 8px 12px; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 12.5px; }
.read-slots b { width: 100%; color: var(--rose-900); font-size: 13px; }
.read-slots span { color: var(--ink); }
.read-slots span:not(:last-child)::after { content: "、"; color: var(--ink-soft); }

/* ========== 捏小人：更衣室 ========== */
.sheet-card.dress { padding-top: 14px; background: linear-gradient(#fff6f8, #fff 46%); }
.dress-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.dress-top b { font-size: 17px; color: var(--rose-900); letter-spacing: 1px; }
.dice { font: inherit; font-size: 13px; border: 1.5px dashed var(--rose-300); background: #fff; color: var(--rose-700); border-radius: 12px; padding: 4px 12px; cursor: pointer; }
.dress-stage { position: relative; height: 170px; display: flex; align-items: center; justify-content: center; gap: 18px; }
.stage-spot {
  position: absolute; left: 50%; bottom: 10px; width: 150px; height: 34px; transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(217,116,138,.28), rgba(217,116,138,0) 70%); border-radius: 50%; z-index: 0;
}
.stage-av { position: relative; z-index: 1; animation: stage-bob 2.4s ease-in-out infinite; }
.stage-av svg { width: 104px; height: 142px; display: block; }
@keyframes stage-bob { 50% { transform: translateY(-4px); } }
.dr-nav {
  position: relative; z-index: 1; width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer;
  background: #fff; color: var(--rose-700); font-size: 24px; line-height: 1; box-shadow: 0 3px 10px rgba(179,64,90,.18);
}
.dr-nav:active { transform: scale(.9); }
.name-tag {
  display: block; margin: 0 auto 12px; width: 70%; text-align: center; font: inherit; font-size: 16px; color: var(--rose-900);
  border: none; border-bottom: 2px solid var(--rose-300); background: transparent; padding: 4px 6px; outline: none;
}
.name-tag:focus { border-bottom-color: var(--rose-700); }
.dress-tabs { display: flex; border-bottom: 1.5px solid var(--line); margin: 0 -4px 10px; }
.dress-tabs button {
  flex: 1; font: inherit; font-size: 12px; color: var(--ink-soft); background: none; border: none; cursor: pointer;
  padding: 6px 0 8px; border-bottom: 3px solid transparent; margin-bottom: -1.5px; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.dress-tabs button .ic { font-size: 18px; }
.dress-tabs button[aria-selected=true] { color: var(--rose-900); border-bottom-color: var(--rose-700); font-weight: bold; }
.dress-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; max-height: 210px; overflow-y: auto; padding: 2px; margin-bottom: 12px; }
.dress-grid .tile {
  border: 2px solid transparent; background: var(--rose-50); border-radius: 14px; cursor: pointer; padding: 6px 2px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.dress-grid .tile svg { width: 44px; height: 60px; }
.dress-grid .tile small { font-size: 10.5px; color: var(--ink-soft); }
.dress-grid .tile[aria-pressed=true] { border-color: var(--rose-700); background: #fff; box-shadow: 0 0 0 3px var(--rose-100); }
.dress-grid .tile[aria-pressed=true] small { color: var(--rose-900); font-weight: bold; }

/* 移除自己放的器材 */
.rm-btn { display: block; margin: 12px auto 0; font: inherit; font-size: 13px; color: var(--ink-soft); background: none; border: none; text-decoration: underline; cursor: pointer; }
@media (hover: hover) { .rm-btn:hover { color: #b3261e; } }

/* ========== 放器材：卡片式選擇、揪團三步驟 ========== */
.sign-card h3 { margin-bottom: 10px; }
.type-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.tt {
  font: inherit; cursor: pointer; background: #fff; border: 2px solid var(--line); border-radius: 16px;
  padding: 8px 4px 8px; display: flex; flex-direction: column; align-items: center; gap: 1px; color: var(--ink);
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.tt:active { transform: scale(.97); }
.tt .tt-art svg { width: 52px; height: 38px; display: block; }
.tt .tt-emoji { font-size: 28px; line-height: 38px; }
.tt b { font-size: 14px; }
.tt small { font-size: 11px; color: var(--ink-soft); }
.tt[aria-pressed=true] { border-color: var(--rose-700); box-shadow: 0 0 0 3px var(--rose-100); }
.tt[aria-pressed=true] b { color: var(--rose-900); }

.jdots { display: flex; justify-content: center; gap: 6px; margin: -2px 0 10px; }
.jdots i { width: 26px; height: 5px; border-radius: 3px; background: var(--line); transition: background .2s; }
.jdots i.on { background: var(--rose-700); }

.jstep h4 { margin: 0 0 10px; font-size: 16px; color: var(--rose-900); display: flex; align-items: baseline; gap: 8px; }
.jstep h4 small { font-size: 12px; font-weight: normal; color: var(--ink-soft); }
.jstep.invalid h4 small { color: var(--rose-700); font-weight: bold; }

.course-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.ct {
  position: relative; font: inherit; font-size: 13px; cursor: pointer; color: var(--ink);
  background: var(--rose-50); border: 2px solid transparent; border-radius: 14px; padding: 10px 4px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; transition: all .15s;
}
.ct .ci { font-size: 26px; line-height: 1; }
.ct[aria-pressed=true] { background: #fff; border-color: var(--rose-700); color: var(--rose-900); font-weight: bold; }
.ct[aria-pressed=true]::after {
  content: "✓"; position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--rose-700); color: #fff; font-size: 12px; display: grid; place-items: center;
}
.jstep.invalid .course-tiles .ct { border-color: var(--rose-300); }

.jsum { background: var(--rose-50); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; font-size: 12.5px; }
.jsum div { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.jsum div + div { margin-top: 6px; }
.jsum b { color: var(--rose-900); flex: none; margin-right: 2px; }
#text-field textarea { margin-bottom: 10px; }

/* ---------- 左上：? 和 📜 ---------- */
.top-btns { display: flex; gap: 6px; margin-right: 8px; }
.top-ic {
  width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--rose-300); background: #fff; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: bold; color: var(--rose-700); display: grid; place-items: center; padding: 0;
}
@media (hover: hover) { .top-ic:hover { background: var(--rose-50); } }
.lobby-top { justify-content: flex-start; }
.lobby-top .lobby-online { margin-left: auto; }

/* 操作說明 */
.help-tabs { display: flex; background: var(--rose-50); border-radius: 12px; padding: 4px; margin-bottom: 12px; }
.help-tabs button { flex: 1; font: inherit; font-size: 14px; border: none; background: none; border-radius: 9px; padding: 7px; cursor: pointer; color: var(--ink-soft); }
.help-tabs button[aria-selected=true] { background: #fff; color: var(--rose-900); font-weight: bold; box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.help-list { list-style: none; margin: 0 0 14px; padding: 0; }
.help-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding: 9px 2px; border-bottom: 1px dashed var(--line); font-size: 14px; }
.help-list li b { color: var(--rose-900); }
.help-list li span { color: var(--ink-soft); font-size: 13px; width: 100%; }
kbd {
  display: inline-block; min-width: 24px; text-align: center; font-family: inherit; font-size: 12px; font-weight: bold;
  background: #fff; border: 1.5px solid var(--line); border-bottom-width: 3px; border-radius: 6px; padding: 1px 6px; color: var(--ink);
}
.help-list li span kbd { min-width: 0; font-size: 11px; }

/* 鍵盤移動時不要有走路的延遲動畫 */
.avatar.kb { transition: none; }
.rules.view-only .rules-actions .ghost { display: none; }

/* 衝刺：腳步加快 */
.avatar.walking.sprint svg { animation-duration: .18s; }

/* 跳過花圃 */
.avatar .fig { transition: translate .14s ease-out; }
.avatar.leaping .fig { translate: 0 -24px; transition: translate .16s ease-out; }
.avatar.leaping svg { animation: none; }

/* ---------- 揪團：開放包班狀態、進入討論按鈕 ---------- */
.st-ready { background: #e3f6e8; color: #2f7d4f; }
.read-status small { font-size: 12px; color: var(--ink-soft); }
.talk-btn {
  width: 100%; margin-top: 10px; font: inherit; font-size: 15px; font-weight: bold; cursor: pointer;
  border: 2px dashed var(--rose-300); background: #fff; color: var(--rose-900); border-radius: 14px; padding: 10px;
}
.talk-btn small { font-weight: normal; color: var(--ink-soft); margin-left: 4px; }
@media (hover: hover) { .talk-btn:hover { background: var(--rose-50); } }

/* ---------- 揪團討論室（全螢幕） ---------- */
.talk {
  position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column;
  background: linear-gradient(#fff8f2, #fff);
}
.talk-top { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fff; }
.talk-leave { font: inherit; font-size: 14px; border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px; cursor: pointer; color: var(--ink); flex: none; }
.talk-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.talk-title b { font-size: 15px; color: var(--rose-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.talk-title small { font-size: 12px; color: var(--ink-soft); }
.talk-count { flex: none; font-size: 13px; color: var(--ink-soft); }

/* 上面：像排隊等待的小廣場，大家排排站 */
.talk-stage {
  flex: none; min-height: 150px; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: center; gap: 6px 14px;
  padding: 44px 16px 14px; position: relative;
  background:
    radial-gradient(ellipse 70% 40% at 50% 100%, rgba(255,180,200,.35), transparent 70%),
    repeating-linear-gradient(90deg, #fdeee6 0 28px, #fbe6db 28px 56px);
  border-bottom: 3px solid #f4d3c4;
}
.talk-stage .tp { position: relative; display: flex; flex-direction: column; align-items: center; width: 58px; }
.talk-stage .tp .fig svg { width: 48px; height: 66px; display: block; animation: breathe-a 3s ease-in-out infinite; }
.talk-stage .tp:nth-child(2n) .fig svg { animation-delay: -1.2s; }
.talk-stage .tp .name { font-size: 11px; background: #fff; border-radius: 999px; padding: 1px 7px; margin-top: 2px; max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.talk-stage .tp.me .name { background: var(--rose-700); color: #fff; }
.talk-stage .bubble {
  position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); z-index: 2;
  background: #fff; border-radius: 10px; padding: 3px 9px; font-size: 12px; max-width: 150px; width: max-content; text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.12); animation: pop .3s ease-out;
}
.talk-wait { color: var(--ink-soft); align-self: center; }
.talk-note { flex: none; margin: 0; padding: 6px 14px; font-size: 11.5px; color: var(--ink-soft); background: #fffaf5; text-align: center; }

/* 下面：聊天 */
.talk-log { flex: 1; overflow-y: auto; list-style: none; margin: 0; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.talk-log li { max-width: 80%; align-self: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; padding: 6px 10px; font-size: 14px; }
.talk-log li b { display: block; font-size: 11.5px; color: var(--rose-900); margin-bottom: 1px; }
.talk-log li .t { display: block; text-align: right; font-size: 10px; color: var(--ink-soft); margin-top: 2px; }
.talk-log li.mine { align-self: flex-end; background: var(--rose-100); border-color: transparent; border-radius: 14px 4px 14px 14px; }
.talk-log li.mine b { display: none; }
.talk-log li.sys { align-self: center; background: none; border: none; font-size: 12px; color: var(--ink-soft); padding: 0; }
.talk-form { flex: none; display: flex; gap: 8px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #fff; }
.talk-form input { flex: 1; min-width: 0; font: inherit; font-size: 16px; border: 1.5px solid var(--line); border-radius: 999px; padding: 9px 14px; }
.talk-form .submit { margin: 0; width: auto; padding: 0 18px; font-size: 15px; letter-spacing: 0; }
@media (min-width: 760px) {
  .talk { left: 50%; right: auto; width: 560px; transform: translateX(-50%); box-shadow: 0 0 0 100vmax rgba(60,30,40,.35); }
}

/* 請假補償說明（揪團選時段下面） */
.leave-note { margin: 10px 0 4px; padding: 8px 10px; background: #fff8e6; border-radius: 10px; font-size: 12px; line-height: 1.6; color: #7a5a1a; }
.slot-note { margin: -4px 0 10px; padding: 8px 10px; background: var(--rose-50); border-radius: 10px; font-size: 12px; line-height: 1.6; color: var(--ink-soft); }

/* 上方橫幅：淡入淡出輪播 */
/* 輪播：每則疊在同一格（grid 同一個位置），高度取最高那則，不會跳動；只切換透明度 */
.notice-strip:not([hidden]) { line-height: 1.5; min-height: calc(3em + 12px); box-sizing: border-box; display: grid; align-items: center; justify-items: center; }
.notice-strip .ns-text { grid-area: 1 / 1; transition: opacity .45s ease, visibility 0s linear 0s; }
.notice-strip .ns-text.out { opacity: 0; visibility: hidden; transition: opacity .45s ease, visibility 0s linear .45s; }

/* 複選課程：各課程人數；團主刪減課程 */
.rc-size small { display: block; margin-top: 4px; font-size: 12px; opacity: .8; line-height: 1.5; }
.ec-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.ec { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: 12px; border: 2px solid #f0d5dc; background: #fff; font: inherit; color: inherit; }
.ec[aria-pressed="true"] { border-color: #b03a5b; background: #fff3f6; }
.ec[aria-pressed="false"] span { text-decoration: line-through; opacity: .5; }
.ec small { color: #8a6a72; }

/* 上一頁（跟請假補券、包班表單一樣的「‹」） */
.top-back { flex: none; font-size: 24px; line-height: 1; color: var(--rose-700); text-decoration: none; padding: 0 4px 2px 0; margin-right: 4px; }
