/* ==========================================================================
   坐会儿 · SitAwhile
   写实场景 + 玻璃拟态聊天层
   ========================================================================== */

:root {
  --ink: #0b0e12;
  --text: #f6f3ec;
  --muted: rgba(246, 243, 236, 0.6);
  --faint: rgba(246, 243, 236, 0.36);
  --line: rgba(255, 255, 255, 0.14);
  --line-soft: rgba(255, 255, 255, 0.08);
  --glass: rgba(12, 16, 21, 0.46);
  --glass-2: rgba(10, 14, 19, 0.66);
  --accent: #f0a565;
  --accent-ink: #2a1607;
  --radius: 20px;
  --dock-h: 214px;
  --font: "Inter", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: #07090c;
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
input { border: 0; outline: none; background: none; }
::selection { background: rgba(240, 165, 101, 0.35); }

#app {
  position: fixed;
  inset: 0;
  --floor: 230px;
}

/* 湖边木栈台：让椅子有地方站 ------------------------------------------------ */
.deck {
  display: none;
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--floor) + 46px);
  z-index: 1;
  pointer-events: none;
}
#app[data-scene="lake"] .deck {
  display: block;
  background-image:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.32) 0 2px, transparent 2px 104px),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.42) 0 2px, transparent 2px 23px),
    radial-gradient(120% 160% at 50% 0%, rgba(255, 214, 160, 0.16), transparent 58%),
    linear-gradient(180deg, #6a4a2e 0%, #553a24 30%, #3b2716 74%, #2a1b0f 100%);
  box-shadow: 0 -40px 70px rgba(6, 10, 9, 0.55), inset 0 2px 0 rgba(255, 226, 186, 0.28);
}
#app[data-scene="lake"] .deck::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 228, 186, 0.75) 14%, rgba(255, 228, 186, 0.75) 86%, transparent);
  opacity: 0.75;
}

/* 场景 ---------------------------------------------------------------- */
.scene { position: absolute; inset: 0; overflow: hidden; background: #0a0d11; }

.scene-photo {
  position: absolute;
  inset: -3%;
  background-size: cover;
  background-position: center 58%;
  transform: scale(1.02);
  animation: drift 46s ease-in-out infinite alternate;
  will-change: transform;
  transition: opacity 0.6s ease;
}
@keyframes drift {
  from { transform: scale(1.02) translate3d(0, 0, 0); }
  to   { transform: scale(1.075) translate3d(-1.2%, -0.8%, 0); }
}

.scene-grade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% 100%, rgba(6, 8, 11, 0.62) 0%, rgba(6, 8, 11, 0.18) 46%, transparent 70%),
    linear-gradient(180deg, rgba(6, 8, 11, 0.42) 0%, transparent 22%, transparent 66%, rgba(6, 8, 11, 0.55) 100%);
}

#app[data-scene="beach"] .scene-grade {
  background:
    radial-gradient(70% 55% at 78% 18%, rgba(255, 190, 120, 0.22), transparent 62%),
    radial-gradient(120% 80% at 50% 100%, rgba(32, 18, 8, 0.6) 0%, rgba(20, 12, 6, 0.16) 46%, transparent 70%),
    linear-gradient(180deg, rgba(20, 12, 6, 0.36) 0%, transparent 24%, transparent 64%, rgba(26, 14, 6, 0.58) 100%);
}
#app[data-scene="mountain"] .scene-grade {
  background:
    radial-gradient(70% 55% at 22% 16%, rgba(255, 226, 168, 0.2), transparent 62%),
    radial-gradient(120% 80% at 50% 100%, rgba(10, 16, 8, 0.62) 0%, rgba(10, 16, 8, 0.18) 46%, transparent 70%),
    linear-gradient(180deg, rgba(8, 14, 12, 0.4) 0%, transparent 24%, transparent 64%, rgba(6, 12, 8, 0.6) 100%);
}
#app[data-scene="snow"] .scene-grade {
  background:
    radial-gradient(70% 55% at 30% 14%, rgba(190, 210, 255, 0.24), transparent 62%),
    radial-gradient(120% 80% at 50% 100%, rgba(8, 12, 22, 0.66) 0%, rgba(10, 16, 28, 0.2) 46%, transparent 70%),
    linear-gradient(180deg, rgba(6, 8, 16, 0.4) 0%, transparent 22%, transparent 62%, rgba(6, 10, 18, 0.62) 100%);
}
#app[data-scene="lake"] .scene-grade {
  background:
    radial-gradient(70% 55% at 24% 16%, rgba(255, 214, 150, 0.2), transparent 62%),
    radial-gradient(120% 80% at 50% 100%, rgba(16, 14, 8, 0.6) 0%, rgba(16, 14, 8, 0.16) 46%, transparent 70%),
    linear-gradient(180deg, rgba(14, 12, 6, 0.36) 0%, transparent 24%, transparent 62%, rgba(12, 12, 6, 0.56) 100%);
}

.grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='140' height='140' filter='url(%23n)' opacity='0.55'/></svg>");
}
.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(130% 100% at 50% 42%, transparent 52%, rgba(3, 5, 8, 0.55) 100%);
}

.fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* 顶栏 ---------------------------------------------------------------- */
.topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 26px;
  animation: fadeDown 0.7s ease both;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
}
.brand-mark {
  width: 34px; height: 34px;
  padding: 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  color: var(--accent);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text b {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.5);
}
.brand-text i {
  font-style: normal;
  font-size: 9px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: 4px;
}

.scene-nav {
  display: flex;
  gap: 4px;
  padding: 5px;
  margin: 0 auto;
  background: rgba(12, 16, 21, 0.42);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.scene-nav::-webkit-scrollbar { display: none; }

.scene-tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 15px;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--muted);
  white-space: nowrap;
  transition: color 0.25s, background 0.25s, transform 0.25s;
}
.scene-tab svg { width: 15px; height: 15px; opacity: 0.85; }
.scene-tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.07); }
.scene-tab.active {
  color: #1a1208;
  background: linear-gradient(180deg, #fdfaf4, #e9e2d4);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}
.scene-tab.active svg { opacity: 1; }
.scene-tab .count {
  font-size: 10px;
  opacity: 0.7;
  padding-left: 2px;
}

.top-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.online {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.online b { color: var(--text); font-size: 13px; font-variant-numeric: tabular-nums; }
.dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #7fd18a;
  box-shadow: 0 0 0 0 rgba(127, 209, 138, 0.6);
  animation: pulseDot 2.4s ease-out infinite;
}
#app[data-conn="off"] .dot { background: #d18a7f; animation: none; }
@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 rgba(127, 209, 138, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(127, 209, 138, 0); }
  100% { box-shadow: 0 0 0 0 rgba(127, 209, 138, 0); }
}

.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  color: var(--muted);
  transition: color 0.2s, background 0.2s, transform 0.2s;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.13); transform: translateY(-1px); }
.icon-btn.on { color: var(--accent); border-color: rgba(240, 165, 101, 0.5); }

.me-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 42px;
  padding: 3px 16px 3px 3px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
  transition: background 0.2s, color 0.2s;
  max-width: 190px;
}
.me-chip:hover { background: rgba(255, 255, 255, 0.13); color: var(--text); }
.me-chip.seated { color: var(--text); border-color: rgba(240, 165, 101, 0.4); }
.me-ava { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; flex-shrink: 0; background: #222; }
.me-ava svg { display: block; width: 100%; height: 100%; }
.me-chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 椅子 ---------------------------------------------------------------- */
.stage { position: absolute; inset: 0; z-index: 20; pointer-events: none; }

.chair {
  position: absolute;
  transform: translateX(-50%);
  pointer-events: auto;
  transition: filter 0.3s;
}
.chair-art { width: 100%; height: 100%; }
.chair-art svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chair.occupied { cursor: default; }

.chair.empty { cursor: pointer; }
.chair.empty .chair-art { transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }
.chair.empty:hover .chair-art { transform: translateY(-5px); }
.chair.empty::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 6%;
  width: 82%;
  height: 46%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.16), transparent 72%);
  opacity: 0;
  transition: opacity 0.35s;
  pointer-events: none;
}
.chair.empty:hover::before { opacity: 1; }

.seat-btn {
  position: absolute;
  left: 50%;
  bottom: 84%;
  transform: translate(-50%, 6px);
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(12, 16, 21, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.24);
  backdrop-filter: blur(10px);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}
.chair.empty:hover .seat-btn { opacity: 1; transform: translate(-50%, 0); }

.tag {
  position: absolute;
  left: 50%;
  bottom: 84%;
  transform: translateX(calc(-50% + var(--tag-dx, 0px)));
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  padding: 3px 9px 3px 7px;
  border-radius: 999px;
  background: rgba(10, 14, 19, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.86);
  white-space: nowrap;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}
.tag .tdot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.chair.me .tag {
  color: #fff;
  border-color: rgba(240, 165, 101, 0.6);
  background: rgba(28, 18, 8, 0.72);
  box-shadow: 0 0 0 1px rgba(240, 165, 101, 0.25), 0 8px 22px rgba(0, 0, 0, 0.35);
}
.chair.me .chair-art { filter: drop-shadow(0 0 16px rgba(240, 165, 101, 0.28)); }

.tag .typing {
  display: inline-flex;
  gap: 2px;
  margin-left: 2px;
}
.tag .typing i {
  width: 3px; height: 3px; border-radius: 50%;
  background: currentColor;
  opacity: 0.4;
  animation: typingDot 1.2s infinite;
}
.tag .typing i:nth-child(2) { animation-delay: 0.15s; }
.tag .typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingDot {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

.bubble {
  position: absolute;
  left: 50%;
  bottom: calc(84% + 28px);
  transform: translateX(-50%) translateY(6px) scale(0.96);
  width: max-content;
  max-width: 216px;
  padding: 8px 12px;
  border-radius: 14px 14px 14px 4px;
  background: rgba(250, 247, 240, 0.94);
  color: #1b1712;
  font-size: 12.5px;
  line-height: 1.5;
  letter-spacing: 0.01em;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.32);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s, transform 0.28s;
  word-break: break-word;
  z-index: 5;
}
.bubble.show { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
.bubble.emoji {
  background: none;
  box-shadow: none;
  font-size: 30px;
  padding: 0;
  line-height: 1;
  animation: floatUp 2.6s ease forwards;
}
@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(0.7); }
  18% { opacity: 1; transform: translate(-50%, -4px) scale(1.06); }
  70% { opacity: 1; transform: translate(-50%, -18px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -34px) scale(0.96); }
}

/* 坐下提示 */
.seat-hint {
  position: absolute;
  left: 50%;
  bottom: calc(var(--floor) + 194px);
  transform: translateX(-50%);
  z-index: 25;
  padding: 7px 15px;
  border-radius: 999px;
  background: rgba(12, 16, 21, 0.55);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s;
}
.seat-hint.show { opacity: 1; }
.seat-hint b { color: var(--accent); font-weight: 600; }

/* 聊天坞 -------------------------------------------------------------- */
.dock {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 30;
  width: min(1060px, calc(100vw - 32px));
  height: var(--dock-h);
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(16, 20, 26, 0.6), rgba(9, 12, 16, 0.74));
  border: 1px solid var(--line);
  backdrop-filter: blur(26px) saturate(150%);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
  overflow: hidden;
}

.dock-head {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 46px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line-soft);
  flex-shrink: 0;
}
.dock-title { display: flex; align-items: baseline; gap: 8px; flex-shrink: 0; }
.dock-title span { font-size: 13px; letter-spacing: 0.14em; }
.dock-title em {
  font-style: normal;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--faint);
}
.dock-status {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--faint);
  margin-left: 2px;
}
.presence { display: flex; align-items: center; gap: -6px; margin-left: auto; }
.presence .p {
  width: 26px; height: 26px; border-radius: 50%;
  overflow: hidden;
  margin-left: -7px;
  border: 1.5px solid rgba(12, 16, 20, 0.9);
  background: #1a1f26;
  transition: transform 0.2s;
}
.presence .p:first-child { margin-left: 0; }
.presence .p:hover { transform: translateY(-3px); z-index: 2; }
.presence .p svg { display: block; width: 100%; height: 100%; }
.presence .more {
  margin-left: 6px;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.dock-toggle {
  display: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  place-items: center;
  color: var(--muted);
}
.dock-toggle svg { width: 16px; height: 16px; transition: transform 0.3s; }
.dock.collapsed .dock-toggle svg { transform: rotate(180deg); }

.msgs {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 18px 8px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
  scroll-behavior: smooth;
  mask-image: linear-gradient(180deg, transparent 0, #000 14px);
}
.msgs::-webkit-scrollbar { width: 6px; }
.msgs::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); border-radius: 3px; }

.msgs-empty {
  margin: auto;
  text-align: center;
  color: var(--faint);
  font-size: 12.5px;
  line-height: 2;
  letter-spacing: 0.06em;
}
.msgs-empty b { display: block; font-size: 22px; color: rgba(255, 255, 255, 0.22); margin-bottom: 6px; }

.msg { display: flex; gap: 9px; animation: msgIn 0.3s ease both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.msg-ava {
  width: 26px; height: 26px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: #1a1f26;
  margin-top: 1px;
}
.msg-ava svg { display: block; width: 100%; height: 100%; }
.msg-main { min-width: 0; }
.msg-name {
  font-size: 10.5px;
  color: var(--faint);
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}
.msg-name b { color: rgba(255, 255, 255, 0.72); font-weight: 500; }
.msg-text {
  font-size: 13.5px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.92);
  word-break: break-word;
  white-space: pre-wrap;
}
.msg.mine .msg-name b { color: var(--accent); }
.msg.mine .msg-text { color: #fff; }

.msg-sys {
  align-self: center;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.3);
  padding: 2px 0;
  text-align: center;
}

.composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line-soft);
  flex-shrink: 0;
}

.reacts { display: flex; gap: 2px; flex-shrink: 0; }
.react {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  font-size: 15px;
  opacity: 0.55;
  transition: opacity 0.2s, background 0.2s, transform 0.2s;
}
.react:hover { opacity: 1; background: rgba(255, 255, 255, 0.09); transform: translateY(-2px); }
.react:active { transform: scale(0.92); }

.input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: border-color 0.25s, background 0.25s;
  min-width: 0;
}
.input-wrap:focus-within { border-color: rgba(240, 165, 101, 0.45); background: rgba(255, 255, 255, 0.1); }
.input-wrap input { flex: 1; font-size: 13.5px; letter-spacing: 0.02em; color: var(--text); min-width: 0; }
.input-wrap input::placeholder { color: rgba(255, 255, 255, 0.32); }
.input-wrap.disabled { opacity: 0.55; }

.send {
  height: 40px;
  padding: 0 20px;
  border-radius: 12px;
  background: linear-gradient(180deg, #f7c489, var(--accent));
  color: #2a1607;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
  box-shadow: 0 8px 22px rgba(240, 165, 101, 0.25);
  flex-shrink: 0;
}
.send:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(240, 165, 101, 0.34); }
.send:active { transform: translateY(0) scale(0.98); }
.send:disabled { filter: grayscale(0.6) brightness(0.7); cursor: default; box-shadow: none; transform: none; }

/* 弹层 ---------------------------------------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 6, 9, 0.58);
  backdrop-filter: blur(10px);
  animation: fadeIn 0.3s ease both;
}
.modal[hidden] { display: none; }

.modal-card {
  width: min(880px, 100%);
  max-height: min(720px, calc(100vh - 48px));
  display: grid;
  grid-template-columns: 320px 1fr;
  border-radius: 26px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(22, 27, 34, 0.94), rgba(12, 15, 20, 0.97));
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.6);
  animation: modalIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
  position: relative;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(18px) scale(0.98); } to { opacity: 1; transform: none; } }

.modal-x {
  position: absolute;
  top: 14px; right: 14px;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  z-index: 3;
}
.modal-x:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }

.modal-preview {
  position: relative;
  padding: 30px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background:
    radial-gradient(90% 60% at 50% 0%, rgba(240, 165, 101, 0.14), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 60%),
    #0d1117;
  border-right: 1px solid var(--line-soft);
  overflow: hidden;
}
.modal-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/><feColorMatrix type='saturate' values='0'/></filter><rect width='120' height='120' filter='url(%23n)' opacity='0.35'/></svg>");
  opacity: 0.14;
  pointer-events: none;
}

.preview-portrait {
  width: 116px; height: 116px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  position: relative;
  z-index: 1;
}
.preview-portrait svg { display: block; width: 100%; height: 100%; }

.preview-seat { width: 150px; height: 210px; position: relative; z-index: 1; }
.preview-seat svg { width: 100%; height: 100%; display: block; }

.preview-name {
  position: relative;
  z-index: 1;
  font-size: 14px;
  letter-spacing: 0.1em;
  color: var(--text);
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-form {
  padding: 34px 34px 28px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.modal-form h1 {
  margin: 0 0 6px;
  font-size: 23px;
  font-weight: 600;
  letter-spacing: 0.08em;
}
.modal-sub {
  margin: 0 0 22px;
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.field { display: block; margin-bottom: 18px; }
.field > span, .opt > span {
  display: block;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--faint);
  margin-bottom: 8px;
}
.field input {
  width: 100%;
  height: 46px;
  padding: 0 15px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--text);
  transition: border-color 0.25s, background 0.25s;
}
.field input:focus { border-color: rgba(240, 165, 101, 0.5); background: rgba(255, 255, 255, 0.09); }
.field input::placeholder { color: rgba(255, 255, 255, 0.28); }

.opt { margin-bottom: 16px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }

.sw-hair {
  width: 44px; height: 44px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid transparent;
  padding: 0;
  transition: border-color 0.2s, transform 0.2s, background 0.2s;
}
.sw-hair svg { display: block; width: 100%; height: 100%; }
.sw-hair:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.09); }
.sw-hair.sel { border-color: var(--accent); background: rgba(240, 165, 101, 0.12); }

.sw-color {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  padding: 0;
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
}
.sw-color:hover { transform: translateY(-2px); }
.sw-color.sel { box-shadow: 0 0 0 2px #0d1117, 0 0 0 3.5px var(--accent); }

.sw-label {
  height: 32px;
  padding: 0 13px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.06em;
  transition: all 0.2s;
}
.sw-label:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }
.sw-label.sel { color: var(--accent); border-color: rgba(240, 165, 101, 0.55); background: rgba(240, 165, 101, 0.1); }

.modal-actions { display: flex; gap: 10px; margin-top: 26px; }
.ghost, .primary {
  height: 46px;
  padding: 0 20px;
  border-radius: 12px;
  font-size: 13px;
  letter-spacing: 0.08em;
  transition: all 0.2s;
}
.ghost {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--muted);
}
.ghost:hover { color: #fff; background: rgba(255, 255, 255, 0.11); }
.primary {
  flex: 1;
  background: linear-gradient(180deg, #f7c489, var(--accent));
  color: #2a1607;
  font-weight: 600;
  box-shadow: 0 10px 26px rgba(240, 165, 101, 0.26);
}
.primary:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(240, 165, 101, 0.34); }

.link {
  display: block;
  margin: 14px auto 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--faint);
  border-bottom: 1px dashed rgba(255, 255, 255, 0.18);
  padding-bottom: 2px;
}
.link:hover { color: var(--accent); border-color: rgba(240, 165, 101, 0.5); }

/* 老板键 -------------------------------------------------------------- */
.boss {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #f4f4f4;
  color: #222;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.12s ease both;
}
.boss[hidden] { display: none; }
.boss-bar {
  height: 34px;
  background: #217346;
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 14px;
  font-size: 12px;
  flex-shrink: 0;
}
.boss-bar b { font-weight: 600; letter-spacing: 0.02em; }
.boss-bar span { opacity: 0.8; }
.boss-bar .x { margin-left: auto; letter-spacing: 0.1em; opacity: 0.75; font-size: 11px; }
.boss-ribbon {
  height: 30px;
  background: #f8f8f8;
  border-bottom: 1px solid #d8d8d8;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 16px;
  font-size: 11.5px;
  color: #555;
  flex-shrink: 0;
}
.boss-ribbon i { font-style: normal; }
.boss-sheet { flex: 1; overflow: hidden; background: #fff; }
.boss-grid {
  display: grid;
  grid-template-columns: 46px repeat(8, minmax(90px, 1fr));
  font-size: 11.5px;
}
.boss-grid div {
  border-right: 1px solid #e4e4e4;
  border-bottom: 1px solid #e4e4e4;
  height: 24px;
  line-height: 24px;
  padding: 0 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.boss-grid .h {
  background: #f2f2f2;
  color: #666;
  text-align: center;
  font-size: 10.5px;
}
.boss-grid .rh {
  background: #f7f7f7;
  color: #888;
  text-align: center;
  font-size: 10.5px;
}
.boss-grid .sel { outline: 2px solid #217346; outline-offset: -2px; background: #eaf4ee; }
.boss-hint {
  position: fixed;
  right: 18px;
  bottom: 16px;
  font-size: 11px;
  color: #9aa0a6;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #e0e0e0;
  padding: 7px 12px;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}
.boss-hint b { color: #217346; }

/* Toast --------------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--dock-h) + 34px);
  transform: translate(-50%, 12px);
  z-index: 150;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(10, 14, 19, 0.86);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  white-space: nowrap;
  max-width: 88vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translate(-50%, 24px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes fadeDown { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }

/* 响应式 -------------------------------------------------------------- */
@media (max-width: 1080px) {
  .brand-text i { display: none; }
  .scene-tab { padding: 8px 12px; }
}

@media (max-width: 820px) {
  :root { --dock-h: 60px; }
  #app { --floor: 96px; }

  .topbar { padding: 10px 12px; gap: 8px; flex-wrap: wrap; }
  .brand-mark { width: 30px; height: 30px; }
  .brand-text b { font-size: 14px; letter-spacing: 0.18em; }
  .scene-nav { order: 3; width: 100%; margin: 0; justify-content: flex-start; padding: 4px; }
  .scene-tab { font-size: 12px; padding: 7px 12px; }
  .scene-tab .count { display: none; }
  .online { height: 34px; padding: 0 11px; font-size: 11px; }
  .online span:last-child { display: none; }
  .icon-btn { width: 34px; height: 34px; }
  .me-chip { height: 38px; padding-right: 10px; max-width: 130px; }
  .me-ava { width: 30px; height: 30px; }

  .dock {
    left: 0; right: 0; bottom: 0;
    width: 100%;
    transform: none;
    border-radius: 20px 20px 0 0;
    height: var(--dock-h);
    transition: height 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    animation: none;
  }
  .dock.open { height: 56vh; }
  .dock-head { height: 52px; }
  .dock-toggle { display: grid; }
  .dock.collapsed .msgs, .dock.collapsed .composer { display: none; }
  .dock.collapsed .presence { margin-left: auto; }
  .dock.collapsed .dock-status { display: none; }
  .drive { display: none; }

  .msgs { padding: 8px 12px; }
  .composer { padding: 8px 10px 10px; }
  .reacts { display: none; }
  .send { padding: 0 16px; }

  .modal { padding: 12px; }
  .modal-card { grid-template-columns: 1fr; max-height: calc(100vh - 24px); }
  .modal-preview {
    padding: 18px;
    flex-direction: row;
    gap: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }
  .preview-portrait { width: 76px; height: 76px; }
  .preview-seat { width: 78px; height: 110px; }
  .preview-name { font-size: 12px; }
  .modal-form { padding: 20px 20px 24px; }
  .modal-form h1 { font-size: 19px; }

  .seat-hint { bottom: calc(var(--floor) + 116px); font-size: 11px; }
  .toast { bottom: 84px; }
}

@media (max-height: 700px) and (min-width: 821px) {
  :root { --dock-h: 182px; }
  #app { --floor: 196px; }
  .modal-card { max-height: calc(100vh - 32px); }
  .modal-preview { padding: 18px; }
  .preview-seat { height: 160px; }
}

@media (prefers-reduced-motion: reduce) {
  .scene-photo { animation: none; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
