/* ==========================================================================
   圆桌场景 · 三人围坐（氛围层 / 沉浸模式）
   ========================================================================== */

.scene-dock {
  flex: none;
  height: clamp(176px, 25vh, 236px);
  margin: 6px 2px 2px;
  position: relative;
}

.room[data-scene="off"] .scene-dock { display: none; }

.table-scene {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 26px;
  overflow: hidden;
  isolation: isolate;
  perspective: 820px;
  background:
    radial-gradient(120% 88% at 50% -12%, rgba(255, 209, 148, 0.11), transparent 62%),
    radial-gradient(90% 70% at 50% 118%, rgba(0, 0, 0, 0.92), transparent 72%),
    linear-gradient(180deg, #0b0b0f 0%, #07070a 54%, #030304 100%);
  border: 1px solid rgba(255, 255, 255, 0.055);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 22px 44px rgba(0, 0, 0, 0.62);
}

.table-scene__room { position: absolute; inset: 0; pointer-events: none; }

.table-scene__lamp {
  position: absolute;
  left: 50%;
  top: -16%;
  width: 58%;
  height: 66%;
  transform: translateX(-50%);
  clip-path: polygon(47.5% 0, 52.5% 0, 100% 100%, 0 100%);
  background: linear-gradient(180deg, rgba(255, 213, 156, 0.16), rgba(255, 205, 145, 0.045) 55%, transparent 86%);
  filter: blur(16px);
  opacity: 0.62;
}

.table-scene__halo {
  position: absolute;
  left: 50%;
  bottom: 2%;
  width: 86%;
  height: 52%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 186, 112, 0.10), transparent 74%);
  filter: blur(14px);
}

.table-scene__table {
  position: absolute;
  left: 50%;
  bottom: -34%;
  width: 120%;
  height: 142%;
  transform: translateX(-50%) rotateX(63deg);
  transform-origin: 50% 100%;
  border-radius: 50%;
  background:
    radial-gradient(52% 46% at 40% 28%, rgba(255, 236, 210, 0.13), transparent 66%),
    repeating-linear-gradient(96deg, rgba(255, 255, 255, 0.032) 0 1.5px, rgba(0, 0, 0, 0.05) 1.5px 6px),
    radial-gradient(72% 72% at 50% 46%, #4b3323 0%, #332114 52%, #1a100a 78%, #0d0705 100%);
  box-shadow:
    inset 0 0 0 2px rgba(255, 220, 180, 0.10),
    inset 0 34px 70px rgba(0, 0, 0, 0.58),
    0 46px 70px rgba(0, 0, 0, 0.78);
}

.table-scene__rim {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow:
    inset 0 0 0 7px rgba(255, 214, 160, 0.055),
    inset 0 0 0 9px rgba(0, 0, 0, 0.45),
    inset 0 0 60px rgba(0, 0, 0, 0.35);
}

.table-scene__grain {
  position: absolute;
  inset: 5%;
  border-radius: 50%;
  background: repeating-radial-gradient(circle at 46% 42%, rgba(255, 255, 255, 0.02) 0 2px, transparent 2px 10px);
  opacity: 0.75;
  mix-blend-mode: screen;
}

.table-scene__glint {
  position: absolute;
  left: 8%;
  top: 4%;
  width: 54%;
  height: 40%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 241, 222, 0.17), transparent 74%);
  filter: blur(11px);
  transition: transform 0.9s var(--ease);
}

.table-scene:hover .table-scene__glint { transform: translate(10%, 6%); }

/* 座位 ---------------------------------------------------------------- */

.table-scene__seats { position: absolute; inset: 0; }

.seat {
  position: absolute;
  width: 132px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: opacity 0.3s var(--ease), filter 0.3s var(--ease);
}

.seat--a { left: 23%; top: 8%; }
.seat--b { left: 77%; top: 8%; }
.seat--me { left: 50%; bottom: 2%; }

.seat__figure { position: relative; width: 50px; height: 50px; }

.seat__body {
  position: absolute;
  left: 50%;
  bottom: -9px;
  width: 44px;
  height: 16px;
  transform: translateX(-50%);
  border-radius: 18px 18px 9px 9px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--soul) 32%, #16161a), #0a0a0c);
  box-shadow: 0 7px 14px rgba(0, 0, 0, 0.62);
}

.seat__avatar {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.94);
  background:
    radial-gradient(120% 120% at 32% 18%, color-mix(in srgb, var(--soul) 62%, #000), #0a0a0d 76%);
  box-shadow:
    inset 0 0 0 1.5px color-mix(in srgb, var(--soul) 58%, transparent),
    0 10px 20px rgba(0, 0, 0, 0.58);
}

.seat__pulse {
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--soul) 60%, transparent);
  opacity: 0;
}

.seat.is-online .seat__pulse { animation: seat-pulse 4.6s ease-in-out infinite; }

@keyframes seat-pulse {
  0%, 100% { opacity: 0.12; transform: scale(0.97); }
  50% { opacity: 0.42; transform: scale(1.05); }
}

.seat.is-puff .seat__pulse {
  animation: seat-ping 1.1s ease-out 2;
  opacity: 0.6;
}

@keyframes seat-ping {
  0% { opacity: 0.7; transform: scale(0.9); }
  100% { opacity: 0; transform: scale(1.35); }
}

.seat.is-offline { filter: saturate(0.42); opacity: 0.6; }

.seat__name {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  font-size: 11px;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seat.is-me .seat__name { color: rgba(255, 255, 255, 0.84); }

.seat__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex: none;
  background: #3ddc84;
  box-shadow: 0 0 7px rgba(61, 220, 132, 0.72);
}

.seat.is-offline .seat__dot { background: rgba(255, 255, 255, 0.24); box-shadow: none; }

.seat__bubble {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  max-width: 150px;
  padding: 5px 9px;
  border-radius: 12px 12px 12px 4px;
  font-size: 11px;
  line-height: 1.34;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(24, 24, 28, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transform: translate(-50%, 6px);
  transition: opacity 0.28s var(--ease), transform 0.28s var(--spring);
  pointer-events: none;
}

.seat.has-bubble .seat__bubble { opacity: 1; transform: translate(-50%, 0); }
.seat.is-puff .seat__bubble { animation: bubble-pop 0.5s var(--spring); }

@keyframes bubble-pop {
  0% { transform: translate(-50%, 8px) scale(0.9); opacity: 0; }
  60% { transform: translate(-50%, -2px) scale(1.03); opacity: 1; }
  100% { transform: translate(-50%, 0) scale(1); opacity: 1; }
}

.seat--me .seat__bubble { border-radius: 12px 12px 4px 12px; }

.seat--empty .seat__avatar {
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.26);
  font-size: 18px;
}

.seat--empty .seat__body { display: none; }
.seat--empty .seat__name { color: rgba(255, 255, 255, 0.24); }

/* 桌面中央的相簿入口 ----------------------------------------------- */

.table-scene__hub {
  position: absolute;
  left: 50%;
  top: 56%;
  transform: translate(-50%, -50%) rotate(-4deg) rotateX(24deg);
  width: 52px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(255, 238, 214, 0.18);
  background:
    linear-gradient(152deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.02) 46%),
    linear-gradient(180deg, #2a2420, #16110e);
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.62), inset 0 0 0 4px rgba(0, 0, 0, 0.28);
  color: rgba(255, 226, 190, 0.72);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.35s var(--spring), box-shadow 0.35s var(--ease);
}

.table-scene__hub:hover { transform: translate(-50%, -54%) rotate(-2deg) rotateX(24deg) scale(1.05); }
.table-scene__hub .i { width: 20px; height: 20px; opacity: 0.9; }

.table-scene__hub-count {
  position: absolute;
  right: -6px;
  bottom: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 18px;
  font-weight: 600;
  color: #1a1206;
  background: linear-gradient(180deg, #ffe0ad, #e0b478);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.table-scene__expand {
  position: absolute;
  right: 10px;
  top: 10px;
  height: 27px;
  padding: 0 11px 0 9px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.36);
  border: 1px solid rgba(255, 255, 255, 0.11);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}

.table-scene__expand:hover { color: #fff; background: rgba(255, 255, 255, 0.12); }
.table-scene__expand .i { width: 13px; height: 13px; }

/* 沉浸模式 ------------------------------------------------------------ */

.immersive {
  position: fixed;
  inset: 0;
  z-index: 42;
  background: #000;
  display: flex;
  flex-direction: column;
  animation: immersive-in 0.42s var(--ease) both;
}

@keyframes immersive-in {
  from { opacity: 0; transform: scale(0.985); }
  to { opacity: 1; transform: none; }
}

.immersive__stage { flex: 1; min-height: 0; position: relative; }

.immersive__stage .table-scene {
  border-radius: 0;
  border: 0;
  box-shadow: none;
  height: 100%;
}

.immersive .table-scene__expand { display: none; }
.immersive .table-scene__table {
  bottom: 12%;
  width: 132%;
  height: 74%;
  transform-origin: 50% 50%;
}
.immersive .table-scene__lamp { width: 44%; height: 40%; opacity: 0.45; filter: blur(24px); }
.immersive .table-scene__halo { width: 118%; height: 34%; }

.immersive .seat--a { left: 22%; top: 31%; }
.immersive .seat--b { left: 78%; top: 31%; }
.immersive .seat--me { left: 50%; bottom: 20%; }

.immersive .seat__figure { width: 66px; height: 66px; }
.immersive .seat__avatar { font-size: 22px; }
.immersive .seat__body { width: 58px; height: 20px; bottom: -11px; }
.immersive .seat__name { font-size: 12px; }
.immersive .seat { width: 168px; }
.immersive .seat__bubble { max-width: 200px; font-size: 12px; padding: 7px 11px; }
.immersive .table-scene__hub { width: 68px; height: 56px; top: 52%; }

.immersive__dock {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.6));
}

.immersive__exit {
  height: 38px;
  padding: 0 15px 0 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.09);
  cursor: pointer;
}

.immersive__exit:hover { color: #fff; background: rgba(255, 255, 255, 0.11); }
.immersive__exit .i { width: 14px; height: 14px; }

.immersive__form {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 5px 5px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.immersive__form input {
  flex: 1;
  min-width: 0;
  padding: 8px 0;
  border: 0;
  background: none;
  outline: none;
  font-size: 14px;
  color: var(--ink);
}

.immersive__form input::placeholder { color: rgba(255, 255, 255, 0.32); }

.immersive__send {
  width: 36px;
  height: 36px;
  flex: none;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #0b0803;
  background: color-mix(in srgb, var(--soul) 82%, #fff 6%);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--soul) 22%, transparent);
  cursor: pointer;
}

.immersive__send:disabled { opacity: 0.4; cursor: default; box-shadow: none; }

/* 设置里的界面分段控件 ------------------------------------------------ */

.seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.seg button {
  height: 34px;
  border: 0;
  border-radius: 10px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  background: transparent;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.seg button.is-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.11);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09);
}

@media (max-width: 620px) {
  .scene-dock { height: clamp(188px, 26vh, 232px); margin: 4px 0 2px; }
  .table-scene { border-radius: 22px; }
  .seat { width: 112px; }
  .seat--a { left: 22%; top: 7%; }
  .seat--b { left: 78%; top: 7%; }
  .seat--me { bottom: 1%; }
  .seat__figure { width: 44px; height: 44px; }
  .seat__bubble { max-width: 118px; }
  .table-scene__expand span { display: none; }
  .table-scene__expand { width: 27px; padding: 0; justify-content: center; }
  .immersive .seat--a { left: 21%; top: 30%; }
  .immersive .seat--b { left: 79%; top: 30%; }
  .immersive .seat--me { bottom: 19%; }
  .immersive .seat { width: 128px; }
  .immersive .seat__figure { width: 54px; height: 54px; }
  .immersive .seat__avatar { font-size: 19px; }
  .immersive .seat__bubble { max-width: 132px; }
}

@media (max-height: 700px) {
  .scene-dock { height: 150px; }
}

/* 点击座位时定位到该成员最近一条消息 */
.msg.is-focus .bubble {
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--soul) 58%, transparent),
    0 0 30px color-mix(in srgb, var(--soul) 20%, transparent);
}

.msg.is-focus .avatar { box-shadow: 0 0 0 2px color-mix(in srgb, var(--soul) 55%, transparent); }

@media (prefers-reduced-motion: reduce) {
  .seat.is-online .seat__pulse,
  .seat.is-puff .seat__pulse,
  .seat.is-puff .seat__bubble,
  .immersive { animation: none; }
}