/* ═══════════════════════════════════════════════════════════════
   协作白板 · 设计系统
   一套变量贯穿「落地页 / 白板 / 弹层」，避免各区块各写一套色值。
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f4f9;

  --ink: #0f1729;
  --ink-2: #334155;
  --muted: #697586;
  --faint: #98a2b3;

  --line: #e6e9f0;
  --line-strong: #d3d9e5;

  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --brand-soft: #eef2ff;
  --brand-ink: #4338ca;

  --ok: #16a34a;
  --ok-soft: #dcfce7;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;

  --r-xl: 22px;
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 9px;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05), 0 2px 6px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 8px 24px -8px rgba(16, 24, 40, 0.14), 0 2px 6px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 28px 64px -24px rgba(16, 24, 40, 0.3), 0 8px 24px -14px rgba(16, 24, 40, 0.14);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* {
  box-sizing: border-box;
}

/* 组件类里的 display 会盖掉浏览器默认的 [hidden]，必须显式兜底 */
[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input,
textarea {
  font-family: inherit;
  color: inherit;
}

code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: var(--surface-3);
  padding: 1px 5px;
  border-radius: 5px;
  color: var(--ink-2);
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ── 通用控件 ───────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.16s var(--ease), box-shadow 0.16s var(--ease),
    transform 0.16s var(--ease), color 0.16s var(--ease);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 6px 18px -8px rgba(79, 70, 229, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.btn-primary:hover {
  box-shadow: 0 10px 26px -10px rgba(79, 70, 229, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  filter: brightness(1.04);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  filter: none;
}

.btn-soft {
  background: var(--surface-3);
  color: var(--ink-2);
}

.btn-soft:hover {
  background: #e7ecf5;
  color: var(--ink);
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 12.5px;
  border-radius: var(--r-sm);
}

.btn-block {
  width: 100%;
  height: 44px;
  margin-top: 4px;
}

.link-btn {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-ink);
  padding: 2px 0;
  border-radius: 4px;
}

.link-btn:hover {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: 14px;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.text-input::placeholder {
  color: var(--faint);
}

.text-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3.5px rgba(79, 70, 229, 0.14);
}

.text-input.mono {
  font-family: var(--mono);
  font-size: 12.5px;
}

.field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 16px 0 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
}

.field-label:first-child {
  margin-top: 0;
}

.field-label .opt {
  font-weight: 500;
  color: var(--faint);
  font-size: 11px;
  background: var(--surface-3);
  padding: 1px 6px;
  border-radius: 999px;
}

.field-hint {
  margin: 8px 0 18px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  min-height: 19px;
}

.field-hint[data-state="ok"] {
  color: #15803d;
}

.field-hint[data-state="warn"] {
  color: #b45309;
}

.field-hint[data-state="err"] {
  color: #b91c1c;
}

.chip {
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}

.chip:hover {
  background: #e2e8f0;
  color: var(--ink);
}

/* ═══════════════════════════════════════════════════════════════
   落地页
   ═══════════════════════════════════════════════════════════════ */

.landing {
  position: relative;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: #fbfbfe;
}

.landing-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
}

.orb-a {
  width: 520px;
  height: 520px;
  top: -180px;
  left: -140px;
  background: radial-gradient(circle at 30% 30%, #c7d2fe, transparent 70%);
}

.orb-b {
  width: 460px;
  height: 460px;
  top: -120px;
  right: -120px;
  background: radial-gradient(circle at 60% 40%, #e9d5ff, transparent 70%);
}

.orb-c {
  width: 520px;
  height: 420px;
  bottom: -220px;
  left: 30%;
  background: radial-gradient(circle at 50% 50%, #bae6fd, transparent 72%);
  opacity: 0.4;
}

.dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(79, 70, 229, 0.14) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(ellipse 70% 55% at 50% 30%, #000 25%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 70% 55% at 50% 30%, #000 25%, transparent 78%);
}

.landing-nav {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1160px;
  width: 100%;
  margin: 0 auto;
  padding: 22px 32px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.server-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.server-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
}

.server-pill[data-state="online"] {
  color: #15803d;
  border-color: #bbf7d0;
  background: rgba(240, 253, 244, 0.85);
}

.server-pill[data-state="online"] .dot {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.16);
}

.server-pill[data-state="offline"] {
  color: #b91c1c;
  border-color: #fecaca;
  background: rgba(254, 242, 242, 0.85);
}

.server-pill[data-state="offline"] .dot {
  background: var(--danger);
}

.landing-main {
  position: relative;
  z-index: 2;
  flex: 1;
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 40px 32px 64px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 432px;
  gap: 72px;
  align-items: center;
}

.hero {
  max-width: 560px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 22px;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.04em;
  color: var(--brand-ink);
  background: rgba(238, 242, 255, 0.9);
  border: 1px solid #dfe5ff;
  padding: 6px 12px;
  border-radius: 999px;
}

.eyebrow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.16);
}

.hero h1 {
  margin: 0 0 20px;
  font-size: clamp(36px, 4.6vw, 54px);
  line-height: 1.12;
  letter-spacing: -0.035em;
  font-weight: 720;
}

.grad {
  background: linear-gradient(100deg, #4f46e5 5%, #7c3aed 45%, #0ea5e9 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  margin: 0 0 34px;
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--ink-2);
  max-width: 470px;
}

.feature-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 18px;
}

.feature-list li {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 14px;
  align-items: start;
}

.fi {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--brand);
  box-shadow: var(--shadow-xs);
}

.fi svg {
  width: 19px;
  height: 19px;
}

.feature-list b {
  display: block;
  font-size: 13.5px;
  margin-bottom: 3px;
  letter-spacing: -0.01em;
}

.feature-list span {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
}

/* 入口卡片 */
.entry-card {
  position: relative;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--r-xl);
  padding: 22px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(14px);
}

.entry-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid var(--line);
  pointer-events: none;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--surface-3);
  border-radius: var(--r-md);
  margin-bottom: 20px;
}

.tab {
  height: 34px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  transition: background 0.18s var(--ease), color 0.18s var(--ease),
    box-shadow 0.18s var(--ease);
}

.tab:hover {
  color: var(--ink-2);
}

.tab.is-active {
  background: #fff;
  color: var(--brand-ink);
  box-shadow: var(--shadow-xs);
}

.pane {
  animation: pane-in 0.22s var(--ease);
}

@keyframes pane-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.recent {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
}

.recent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.04em;
  color: var(--faint);
  text-transform: uppercase;
}

.recent ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.recent li button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  text-align: left;
  transition: background 0.15s;
}

.recent li button:hover {
  background: var(--brand-soft);
}

.recent .r-id {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}

.recent .r-meta {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--faint);
}

.recent .r-go {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--brand);
  opacity: 0;
  transition: opacity 0.15s;
}

.recent li button:hover .r-go {
  opacity: 1;
}

.landing-foot {
  position: relative;
  z-index: 2;
  padding: 0 32px 26px;
  text-align: center;
  font-size: 11.5px;
  color: var(--faint);
}

/* ═══════════════════════════════════════════════════════════════
   应用外壳
   ═══════════════════════════════════════════════════════════════ */

.app {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
}

/* ── 顶栏 ───────────────────────────────────────────────────── */
.topbar {
  height: 60px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px 0 16px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: none;
}

.brand-link {
  text-decoration: none;
  color: inherit;
  padding: 4px 6px 4px 2px;
  margin-left: -2px;
  border-radius: 10px;
  transition: background 0.15s;
}

.brand-link:hover {
  background: var(--surface-3);
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px -4px rgba(79, 70, 229, 0.6);
}

.brand-mark svg {
  width: 18px;
  height: 18px;
}

.brand-name {
  font-weight: 680;
  letter-spacing: -0.01em;
  font-size: 14.5px;
}

.room-chip-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  padding-left: 14px;
  margin-left: 2px;
  border-left: 1px solid var(--line);
}

.room-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 8px 0 10px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: background 0.15s, border-color 0.15s;
}

.room-chip:hover {
  background: var(--brand-soft);
  border-color: #dfe5ff;
}

.room-chip-label {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  flex: none;
}

.room-chip-id {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: -0.02em;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-chip-caret {
  width: 14px;
  height: 14px;
  color: var(--faint);
}

.spacer {
  flex: 1;
}

.members-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.members {
  display: flex;
  align-items: center;
  padding-left: 6px;
}

.member-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
  border: 2px solid #fff;
  margin-left: -7px;
  box-shadow: var(--shadow-xs);
  transition: transform 0.15s var(--ease);
}

.member-avatar:hover {
  transform: translateY(-2px);
  z-index: 2;
}

.member-avatar:first-child {
  margin-left: 0;
}

.members-count {
  font-size: 11.5px;
  color: var(--faint);
  white-space: nowrap;
}

.status {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  flex: none;
}

.status .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
  flex: none;
}

.status[data-state="online"] {
  background: var(--ok-soft);
  color: #15803d;
}
.status[data-state="online"] .dot {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.16);
}

.status[data-state="syncing"] {
  background: var(--warn-soft);
  color: #b45309;
}
.status[data-state="syncing"] .dot {
  background: var(--warn);
  animation: pulse 1s ease-in-out infinite;
}

.status[data-state="offline"] {
  background: var(--danger-soft);
  color: #b91c1c;
}
.status[data-state="offline"] .dot {
  background: var(--danger);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.icon-btn.subtle {
  width: 28px;
  height: 28px;
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.icon-btn.small {
  width: 24px;
  height: 24px;
  font-size: 16px;
  line-height: 1;
}

.icon-btn.is-active {
  background: var(--brand-soft);
  color: var(--brand);
}

/* ── 弹层 ───────────────────────────────────────────────────── */
.popover {
  position: absolute;
  top: calc(100% + 10px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 16px;
  z-index: 60;
  animation: pop-in 0.18s var(--ease);
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.share-pop {
  left: 14px;
  width: 340px;
}

.share-pop h4,
.help-pop h4 {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 680;
}

.pop-hint {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}

.share-row {
  display: flex;
  gap: 8px;
}

.share-row .text-input {
  height: 36px;
  flex: 1;
  min-width: 0;
}

.share-row .btn {
  height: 36px;
  padding: 0 14px;
}

.pop-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.help-pop {
  right: 14px;
  width: 300px;
}

.kbd-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 14px;
  margin: 12px 0 0;
  align-items: center;
}

.kbd-list dt {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.kbd-list dd {
  margin: 0;
  font-size: 12px;
  color: var(--ink-2);
}

kbd {
  display: inline-block;
  min-width: 20px;
  padding: 2px 6px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  text-align: center;
  color: var(--ink-2);
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
}

/* ── 主区域 ─────────────────────────────────────────────────── */
.stage {
  flex: 1;
  min-height: 0;
  display: flex;
  position: relative;
}

.toolbar {
  width: 56px;
  flex: none;
  margin: 12px 0 12px 12px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  height: fit-content;
  z-index: 20;
}

.tool {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: background 0.14s, color 0.14s, box-shadow 0.14s;
}

.tool svg {
  width: 20px;
  height: 20px;
}

.tool:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.tool.is-active {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 6px 16px -6px rgba(79, 70, 229, 0.8);
}

.tool:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  background: none;
  box-shadow: none;
}

/* 悬浮提示：不占位、不挡点击 */
.tool[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  padding: 5px 9px;
  border-radius: 7px;
  background: rgba(15, 23, 41, 0.94);
  color: #fff;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s var(--ease), transform 0.14s var(--ease);
  z-index: 30;
}

.tool[data-tip]:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.tool-divider {
  width: 26px;
  height: 1px;
  background: var(--line);
  margin: 5px 0;
}

/* 画布 */
.canvas-wrap {
  flex: 1;
  position: relative;
  margin: 12px;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

#board {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: default;
}

#board.tool-rect,
#board.tool-ellipse,
#board.tool-text,
#board.tool-pen {
  cursor: crosshair;
}

#board.is-panning {
  cursor: grabbing;
}

.presence-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.remote-cursor {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform;
  transition: transform 0.08s linear;
}

.remote-cursor svg {
  width: 18px;
  height: 18px;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(15, 23, 41, 0.25));
}

.remote-cursor span {
  position: absolute;
  left: 14px;
  top: 16px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  padding: 2px 7px;
  border-radius: 7px;
  white-space: nowrap;
  box-shadow: var(--shadow-xs);
}

.text-editor-wrap {
  position: absolute;
  z-index: 6;
}

#text-editor {
  border: 1.5px dashed var(--brand);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.97);
  outline: none;
  resize: none;
  overflow: hidden;
  padding: 3px 5px;
  line-height: 1.25;
  min-width: 60px;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

/* 空状态 */
.empty-state {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  z-index: 3;
}

.empty-state.is-hidden {
  opacity: 0;
  /* 只把透明度降到 0 是不够的：元素仍占据布局、内部按钮仍可命中，
     会把画布正中央一块区域变成「点不动」的死区（画笔、框选、双击都会失效）。
     visibility: hidden 让它彻底退出命中测试，同时保留淡出过渡。 */
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.97);
  /* 让淡出先走完再隐藏，避免直接消失显得生硬 */
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), visibility 0s linear 0.25s;
}

/* 父级的 pointer-events: none 管不住子级显式声明的 auto，
   所以这里把按钮单独再关一次——双保险，避免以后有人改回只调透明度。 */
.empty-state.is-hidden .empty-actions {
  pointer-events: none;
}

.empty-art {
  width: 120px;
  height: 84px;
  margin: 0 auto 6px;
}

.empty-art svg {
  width: 100%;
  height: 100%;
}

.empty-state h3 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.empty-state p {
  margin: 0 0 16px;
  font-size: 12.5px;
  color: var(--muted);
}

.empty-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  pointer-events: auto;
}

/* 画布底部控件 */
.canvas-tools {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
  z-index: 4;
}

.zoom-cluster {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 3px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
  pointer-events: auto;
}

.zoom-btn,
.zoom-value {
  height: 28px;
  min-width: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  transition: background 0.14s, color 0.14s;
}

.zoom-btn svg {
  width: 15px;
  height: 15px;
}

.zoom-btn:hover,
.zoom-value:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.zoom-value {
  min-width: 48px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 650;
}

.hint-bar {
  font-size: 11.5px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 13px;
  pointer-events: none;
  transition: opacity 0.4s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hint-bar.is-hidden {
  opacity: 0;
}

/* ── 属性面板 ───────────────────────────────────────────────── */
.inspector {
  width: 252px;
  flex: none;
  margin: 12px 12px 12px 0;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  height: fit-content;
  max-height: calc(100% - 24px);
  overflow-y: auto;
}

.inspector-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.inspector-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 680;
  letter-spacing: 0.01em;
}

.sel-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-3);
  padding: 3px 8px;
  border-radius: 999px;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sel-badge[data-state="active"] {
  color: var(--brand-ink);
  background: var(--brand-soft);
}

.inspector-empty {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--muted);
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
}

.inspector-body {
  display: grid;
  gap: 16px;
}

.group h4 {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}

.group .row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.num-field {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  transition: border-color 0.15s, background 0.15s;
}

.num-field:focus-within {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.num-field span {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--faint);
  font-family: var(--mono);
}

.num-field input {
  width: 100%;
  min-width: 0;
  border: none;
  background: none;
  outline: none;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
  -moz-appearance: textfield;
  appearance: textfield;
}

.num-field input::-webkit-outer-spin-button,
.num-field input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="color"] {
  width: 34px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: none;
  cursor: pointer;
  flex: none;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 3px;
}

input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 5px;
}

.swatches {
  display: flex;
  gap: 5px;
  flex: 1;
}

.swatches button {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: var(--sw);
  border: 1px solid rgba(15, 23, 41, 0.1);
  transition: transform 0.14s var(--ease), box-shadow 0.14s;
}

.swatches button:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 6px rgba(15, 23, 41, 0.18);
}

.range-field {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 0;
}

input[type="range"] {
  flex: 1;
  min-width: 0;
  accent-color: var(--brand);
  height: 20px;
}

output {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  min-width: 24px;
  text-align: right;
}

.btn-row {
  display: flex;
  gap: 6px;
}

.btn-row .btn {
  flex: 1;
}

.selection-card {
  font-size: 11.5px;
  line-height: 1.75;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 12px;
  word-break: break-all;
}

.selection-card .muted {
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

/* ── 调试面板 ───────────────────────────────────────────────── */
.debug {
  position: fixed;
  right: 276px;
  bottom: 14px;
  width: 306px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 13px;
  z-index: 70;
  font-size: 12px;
}

.debug header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
  font-size: 12.5px;
}

.debug dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 10px;
  margin: 0 0 10px;
}

.debug dt {
  color: var(--muted);
  font-size: 11px;
}

.debug dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.switch {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  padding: 7px 9px;
  border-radius: var(--r-sm);
  background: #fff7ed;
  color: #b45309;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 8px;
}

.switch input {
  accent-color: var(--danger);
}

.debug-log {
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.55;
  color: #334155;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  padding: 7px 9px;
  max-height: 132px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.debug-log .t {
  color: #94a3b8;
}
.debug-log .ok {
  color: #15803d;
}
.debug-log .warn {
  color: #b45309;
}
.debug-log .err {
  color: #b91c1c;
}

/* ── Toast ─────────────────────────────────────────────────── */
.toast-host {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  z-index: 90;
  pointer-events: none;
}

.toast {
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  background: rgba(15, 23, 41, 0.94);
  padding: 10px 17px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.24s var(--ease);
  max-width: 70vw;
  backdrop-filter: blur(6px);
}

.toast.warn {
  background: #b45309;
}
.toast.err {
  background: #b91c1c;
}
.toast.ok {
  background: #15803d;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ── 响应式 ─────────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .landing-main {
    grid-template-columns: minmax(0, 1fr);
    gap: 44px;
    padding: 24px 28px 56px;
    align-items: start;
  }
  .hero {
    max-width: 620px;
  }
  .entry-card {
    max-width: 520px;
  }
}

@media (max-width: 980px) {
  .inspector {
    display: none;
  }
  .debug {
    right: 14px;
  }
}

@media (max-width: 760px) {
  .brand-name {
    display: none;
  }
  .members-count {
    display: none;
  }
  .hint-bar {
    display: none;
  }
  .toolbar {
    width: 48px;
    margin-left: 8px;
  }
  .tool {
    width: 36px;
    height: 36px;
  }
  .canvas-wrap {
    margin: 8px;
  }
  .landing-nav {
    padding: 16px 20px;
  }
}

@media (max-width: 560px) {
  .topbar {
    gap: 8px;
    padding: 0 10px 0 12px;
  }
  .members-wrap {
    display: none;
  }
  .room-chip-wrap {
    padding-left: 8px;
  }
  .room-chip-label {
    display: none;
  }
  .room-chip-id {
    max-width: 96px;
  }
  .status {
    padding: 0 9px;
  }
  .topbar-actions {
    padding-left: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
