*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-paper);
  color: var(--ink-primary);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
}

body.is-interacting,
body.is-interacting * {
  -webkit-user-select: none !important;
  user-select: none !important;
}

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
  overflow: hidden;
}

.story-ico {
  width: 19px;
  height: 19px;
  display: block;
  flex-shrink: 0;
}

.story-ico-lg {
  width: 26px;
  height: 26px;
}

/* 无限画布视口 */
.canvas-viewport {
  position: fixed;
  inset: 0;
  z-index: var(--z-canvas);
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  background-color: var(--bg-paper);
}

.pond-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.canvas-viewport.is-panning {
  cursor: grabbing;
}

.canvas-world {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  transform-origin: 0 0;
  z-index: var(--z-stickers);
}

/* 空画布引导语（落于左侧开阔池塘区，不被右侧创作框遮挡） */
.canvas-welcome {
  position: fixed;
  left: clamp(230px, 34vw, 480px);
  top: 42%;
  width: min(540px, 54vw);
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: opacity 0.35s ease;
}

.canvas-welcome.is-hidden {
  opacity: 0;
}

.welcome-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(26px, 3.3vw, 40px);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.45;
  color: var(--ink-primary);
  text-shadow:
    0 2px 24px rgba(255, 252, 244, 0.96),
    0 1px 4px rgba(255, 252, 244, 0.85);
}

[data-theme="dark"] .welcome-title {
  text-shadow:
    0 2px 24px rgba(14, 18, 26, 0.88),
    0 1px 4px rgba(14, 18, 26, 0.72);
}

.welcome-flourish {
  width: min(240px, 52vw);
  height: 20px;
}

/* 顶部悬浮手撕棉纸签状态栏 */
.top-hud {
  position: fixed;
  top: 18px;
  left: 22px;
  right: 22px;
  z-index: var(--z-hud);
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  transform: translateZ(0);
}

.hud-group {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}

.hud-pill {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 17px;
  border: none;
  background: transparent;
  color: var(--ink-primary);
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.hud-pill::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 19px 14px 21px 16px / 15px 20px 14px 19px;
  background-color: var(--paper-top);
  background-image: var(--cold-press-paper);
  border: 1.7px solid var(--pencil-line);
  box-shadow:
    inset 0 0 12px rgba(196, 168, 126, 0.2),
    0 3px 0 var(--paper-lip),
    var(--shadow-float);
}

.hud-pill:hover {
  transform: translateY(-2px) rotate(-0.8deg);
}

.hud-pill:active {
  transform: translateY(1px) scale(0.98);
}

.hud-icon-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  justify-content: center;
}

.hud-icon-btn::before {
  border-radius: 48% 52% 46% 54% / 52% 48% 54% 46%;
}

.hud-caret {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.72;
}

.canvas-name-text {
  display: inline-flex;
  align-items: center;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.canvas-name-input {
  width: 148px;
  padding: 1px 6px;
  border: 1.4px dashed var(--accent-coral);
  border-radius: 8px;
  background: var(--paper-top);
  color: var(--ink-primary);
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 700;
  outline: none;
  user-select: text;
}

[data-theme="dark"] .hud-pill::before {
  box-shadow:
    inset 0 0 12px rgba(255, 232, 194, 0.05),
    0 3px 0 var(--paper-lip),
    var(--shadow-float);
}

/* 深色模式下所有手绘 SVG 轮廓线与加号自动转为温润羊皮纸浅金色 */
[data-theme="dark"] svg [stroke="#5b4330"],
[data-theme="dark"] svg [stroke="#5B4330"] {
  stroke: #e8cfa0;
}

[data-theme="dark"] svg [stroke="#755d49"],
[data-theme="dark"] svg [stroke="#8a6c52"],
[data-theme="dark"] svg [stroke="#8b694a"],
[data-theme="dark"] svg [stroke="#7a5a3d"] {
  stroke: #c9b598;
}

[data-theme="dark"] svg [fill="#5b4330"] {
  fill: #e8cfa0;
}

[data-theme="dark"] .account-add-plus,
[data-theme="dark"] .account-pill-add {
  color: #eee5d4;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid rgba(91, 67, 48, 0.45);
  background: var(--ink-muted);
  transition: background-color 0.25s ease, box-shadow 0.25s ease;
}

.status-dot.is-online {
  background: var(--accent-mint);
  box-shadow: 0 0 0 4px rgba(108, 174, 148, 0.24);
}

.status-dot.is-busy {
  background: var(--accent-sun);
  box-shadow: 0 0 0 4px rgba(234, 180, 76, 0.28);
}

.status-dot.is-error {
  background: var(--accent-coral);
  box-shadow: 0 0 0 4px rgba(223, 119, 87, 0.24);
}
