/* ============================================================ base + tokens */
:root {
  --bg: #F1ECE3;
  --canvas: #FAF6EF;
  --surface: #FFFFFF;
  --surface-2: #FBF8F3;
  --ink: #23262F;
  --ink-soft: #565D6D;
  --muted: #8B909C;
  --line: #ECE5DA;
  --line-strong: #DED4C6;
  --brand: #EF6136;
  --brand-dark: #D94B22;
  --brand-soft: #FFEDE5;
  --teal: #2E9C8D;
  --sun: #F0AA3C;
  --sky: #4C8DF6;
  --danger: #E4574C;
  --green: #3FA772;
  --dot: #DDD2C2;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(35, 38, 47, .06);
  --shadow-md: 0 8px 24px -12px rgba(35, 38, 47, .22), 0 2px 6px rgba(35, 38, 47, .05);
  --shadow-lg: 0 30px 70px -30px rgba(35, 38, 47, .35), 0 10px 24px -16px rgba(35, 38, 47, .2);
  --font-ui: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
}

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

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

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

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; }

[hidden] { display: none !important; }

::selection { background: rgba(239, 97, 54, .22); }

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

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #D9CFC0; border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #C6B9A6; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

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

/* ================================================================== app */
.app {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

/* ============================================================== topbar */
.topbar {
  position: relative;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
  padding: 0 18px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  flex: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #FF7A4D, var(--brand) 55%, var(--brand-dark));
  color: #FFF8F2;
  font-family: "Nunito", var(--font-ui);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -.4px;
  box-shadow: 0 4px 10px -4px rgba(239, 97, 54, .55);
  flex: none;
  user-select: none;
}

.brand-mark-lg {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  font-size: 26px;
}

.brand-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }

.board-title {
  width: 230px;
  max-width: 40vw;
  border: none;
  background: transparent;
  padding: 2px 6px;
  margin-left: -6px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--ink);
  text-overflow: ellipsis;
  transition: background .15s ease;
}
.board-title:hover { background: #F6F1EA; }
.board-title:focus { background: #fff; outline: 2px solid var(--brand); outline-offset: 0; }

.save-state {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  padding-left: 1px;
  white-space: nowrap;
}
.save-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  transition: background .2s;
}
.save-state.is-saving .save-dot { background: var(--sun); animation: dotPulse 1s infinite; }

.boards-btn { margin-left: 8px; color: var(--ink-soft); }

.topbar-right { display: flex; align-items: center; gap: 6px; min-width: 0; }
.topbar-divider { width: 1px; height: 22px; background: var(--line-strong); margin: 0 6px; opacity: .7; }

/* peers */
.peers { display: flex; align-items: center; gap: 6px; margin-right: 4px; min-width: 0; }
.peer-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 10px 0 4px;
  border-radius: 999px;
  background: #F7F3ED;
  border: 1px solid transparent;
  color: var(--ink);
  font: 600 12.5px var(--font-ui);
  cursor: default;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
button.peer-chip { cursor: pointer; }
button.peer-chip:hover { background: #F0EAE1; border-color: var(--line-strong); }
.peer-chip.is-self { background: transparent; padding-right: 4px; }
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--c, var(--brand));
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
  flex: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28);
}
.avatar-ghost { background: #fff; color: var(--muted); border: 1px dashed var(--line-strong); }
.peer-name { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.peer-status { font-size: 10.5px; font-weight: 500; color: var(--muted); }
.peer-status.is-typing { color: var(--brand); }
.peer-status.is-elsewhere { color: var(--sky); }
.invite-chip { border: 1px dashed var(--line-strong); background: transparent; color: var(--ink-soft); }
.invite-chip:hover { background: #F7F3ED; border-color: var(--brand); color: var(--brand); }

/* ============================================================== buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font: 600 13px var(--font-ui);
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s, transform .08s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn-icon { display: inline-flex; }

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 3px 8px -3px rgba(239, 97, 54, .55);
}
.btn-primary:hover { background: var(--brand-dark); }
.btn-soft { background: var(--brand-soft); color: #BF431F; }
.btn-soft:hover { background: #FFE2D5; }
.btn-ghost { color: var(--ink-soft); }
.btn-ghost:hover { background: #F4EFE8; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #CF453A; }
.btn-sm { height: 32px; padding: 0 10px; border-radius: 9px; font-size: 12px; }
.btn-lg { height: 46px; padding: 0 20px; border-radius: 12px; font-size: 14px; }
.btn-block { width: 100%; }

.icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-soft);
  transition: background .15s, color .15s;
  flex: none;
}
.icon-btn:hover { background: #F4EFE8; color: var(--ink); }
.icon-btn:disabled { opacity: .35; pointer-events: none; }
.icon-btn-sm { width: 28px; height: 28px; border-radius: 8px; }

/* =============================================================== stage */
.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.canvas {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background-color: var(--canvas);
  background-image: radial-gradient(circle at 1px 1px, var(--dot) 1.2px, transparent 0);
  background-size: var(--grid, 26px) var(--grid, 26px);
  background-position: var(--gx, 0) var(--gy, 0);
  touch-action: none;
  cursor: default;
}
.canvas.is-pan-ready { cursor: grab; }
body.is-panning .canvas { cursor: grabbing; }
body.is-dragging .canvas { cursor: default; }
body.tool-text .canvas { cursor: text; }
body.tool-frame .canvas { cursor: crosshair; }

.world {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  transform-origin: 0 0;
  will-change: transform;
}
.items-layer { position: absolute; top: 0; left: 0; }
.cursors { position: absolute; top: 0; left: 0; pointer-events: none; z-index: 2147483000; }

.marquee {
  position: absolute;
  border: 1.5px solid var(--brand);
  background: rgba(239, 97, 54, .07);
  border-radius: 4px;
  pointer-events: none;
  z-index: 10;
}
.marquee-create { border-style: dashed; background: rgba(239, 97, 54, .05); }

/* ================================================================ rail */
.rail {
  position: absolute;
  left: 16px;
  top: 16px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
}
.rail-btn {
  position: relative;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 11px;
  background: transparent;
  color: var(--ink-soft);
  transition: background .15s, color .15s;
}
.rail-btn:hover { background: #F5F0E9; color: var(--ink); }
.rail-btn.is-active { background: var(--brand-soft); color: var(--brand); }
.rail-btn::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  background: #23262F;
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 9px;
  border-radius: 7px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s, transform .12s;
  z-index: 80;
  box-shadow: var(--shadow-md);
}
.rail-btn:hover::after { opacity: 1; transform: translateY(-50%) translateX(0); }
.rail-sep { height: 1px; background: var(--line); margin: 4px 7px; }

/* =============================================================== items */
.item {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: var(--radius, 14px);
  background: var(--fill, #fff);
  transform-origin: 0 0;
  cursor: move;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.item-surface {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
}
.item-text {
  box-shadow: 0 1px 2px rgba(35, 38, 47, .05), 0 16px 30px -28px rgba(35, 38, 47, .45);
}
.text-body:empty::before {
  content: 'Текст…';
  color: rgba(35, 38, 47, .28);
}

.item:hover { outline: 1.5px dashed rgba(35, 38, 47, .18); outline-offset: 2px; }
.item:hover.selected, .item.selected { outline: 2px solid var(--brand); outline-offset: 2px; }
.item.peer-selected {
  outline: 2px dashed var(--peer-color, var(--sky));
  outline-offset: 4px;
}
.item.peer-editing {
  outline: 2px solid var(--peer-color, var(--sky));
  outline-offset: 3px;
  animation: peerPulse 1.6s ease-in-out infinite;
}
.item.is-locked { cursor: default; }
.item.is-locked:hover { outline: 1.5px dashed rgba(35, 38, 47, .22); }
.item.just-created { animation: pop .45s cubic-bezier(.2, .9, .3, 1.4); }
.item.editing { outline: 2px solid var(--brand) !important; outline-offset: 2px; }
.item.editing:hover { outline: 2px solid var(--brand); }

.text-body {
  width: 100%;
  height: 100%;
  padding: 14px 16px;
  overflow: auto;
  font-family: var(--font, "Nunito", sans-serif);
  font-size: var(--fs, 18px);
  color: var(--ink);
  text-align: var(--align, left);
  font-weight: var(--weight, 400);
  font-style: var(--font-style, normal);
  text-decoration: var(--decoration, none);
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  outline: none;
  cursor: inherit;
  user-select: text;
  -webkit-user-select: text;
}
.item.editing .text-body { cursor: text; }
.item.editing .text-body:empty::before { content: ''; }

/* frame */
.item-frame {
  box-shadow: 0 18px 40px -36px rgba(35, 38, 47, .55);
}
.frame-head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 14px;
  border-bottom: 1px solid rgba(35, 38, 47, .07);
  color: rgba(35, 38, 47, .72);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .01em;
}
.frame-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(239, 97, 54, .5); flex: none; }
.frame-title {
  min-width: 16px;
  padding: 2px 5px;
  margin-left: -5px;
  border-radius: 5px;
  outline: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.frame-title[contenteditable="true"] {
  background: #fff;
  box-shadow: 0 0 0 2px var(--brand);
  min-width: 80px;
}
.frame-body {
  position: absolute;
  inset: 43px 0 0;
  border-radius: 0 0 var(--radius) var(--radius);
}

/* image */
.item-image { background: transparent; box-shadow: none; }
.media-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: inherit;
  display: block;
  filter: drop-shadow(0 10px 18px rgba(35, 38, 47, .12));
  pointer-events: none;
}
.item-image:hover { outline-offset: 3px; }

/* sticker */
.item-sticker { background: transparent; box-shadow: none; }
.sticker {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  line-height: 1;
  filter: drop-shadow(0 8px 12px rgba(35, 38, 47, .14));
  user-select: none;
}
.item-sticker:hover { outline-offset: 4px; background: rgba(255, 255, 255, .2); }

/* link */
.item-link { box-shadow: var(--shadow-sm); }
.link-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 100%;
  padding: 12px 14px;
  color: inherit;
  text-decoration: none;
  border-radius: inherit;
}
.link-card:hover { background: #FCFAF7; }
.link-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-family: "Nunito", var(--font-ui);
  font-weight: 800;
  font-size: 17px;
  flex: none;
  background: #E6EEFF;
  color: #2C5AAE;
}
.link-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.link-title {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.link-host { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-arrow { color: var(--muted); flex: none; opacity: .8; }

/* audio */
.item-audio { box-shadow: var(--shadow-sm); }
.audio-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  padding: 10px 12px;
}
.audio-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.audio-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid;
  place-items: center;
  flex: none;
}
.audio-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.audio-card audio { width: 100%; height: 32px; margin-top: auto; }

/* video */
.item-video { box-shadow: var(--shadow-md); overflow: hidden; }
.item-video video { width: 100%; height: 100%; object-fit: contain; background: #10141F; display: block; }
.video-caption {
  position: absolute;
  left: 12px;
  top: 10px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(15, 20, 31, .55);
  color: rgba(255, 255, 255, .85);
  font-size: 11px;
  max-width: calc(100% - 24px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

/* pdf */
.item-pdf { box-shadow: var(--shadow-md); }
.pdf-card { display: flex; flex-direction: column; height: 100%; }
.pdf-head {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 10px 0 12px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.pdf-icon { color: var(--brand); display: flex; flex: none; }
.pdf-name {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pdf-tools { display: flex; align-items: center; gap: 2px; flex: none; }
.pdf-btn {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: var(--ink-soft);
}
.pdf-btn:hover { background: #F3EEE7; color: var(--ink); }
.pdf-page { font-size: 10.5px; color: var(--muted); min-width: 40px; text-align: center; font-variant-numeric: tabular-nums; }
.pdf-body {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: #F3EEE7;
  border-radius: 0 0 var(--radius) var(--radius);
}
.pdf-body canvas { display: block; margin: 8px auto; box-shadow: 0 3px 10px rgba(35, 38, 47, .12); background: #fff; }
.pdf-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: var(--muted);
  background: rgba(243, 238, 231, .85);
}

/* peer flags + cursors */
.peer-flag {
  position: absolute;
  top: -26px;
  left: -2px;
  z-index: 6;
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(35, 38, 47, .18);
}
.lock-flag {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 6;
  display: flex;
  padding: 4px;
  border-radius: 7px;
  background: rgba(35, 38, 47, .72);
  color: #fff;
  pointer-events: none;
  backdrop-filter: blur(4px);
}

.peer-cursor {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  pointer-events: none;
  transition: transform .09s linear;
  will-change: transform;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .2));
}
.peer-cursor svg { display: block; }
.peer-cursor-name {
  position: absolute;
  left: 16px;
  top: 16px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

/* handles */
.handles { position: absolute; inset: 0; pointer-events: none; display: none; }
.item.solo.selected .handles { display: block; }
.item.is-locked .handles { display: none; }
.handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #fff;
  border: 1.5px solid var(--brand);
  border-radius: 3px;
  pointer-events: auto;
  z-index: 7;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}
.handle-nw { left: -5px; top: -5px; cursor: nwse-resize; }
.handle-n { left: 50%; top: -5px; margin-left: -5px; cursor: ns-resize; }
.handle-ne { right: -5px; top: -5px; cursor: nesw-resize; }
.handle-e { right: -5px; top: 50%; margin-top: -5px; cursor: ew-resize; }
.handle-se { right: -5px; bottom: -5px; cursor: nwse-resize; }
.handle-s { left: 50%; bottom: -5px; margin-left: -5px; cursor: ns-resize; }
.handle-sw { left: -5px; bottom: -5px; cursor: nesw-resize; }
.handle-w { left: -5px; top: 50%; margin-top: -5px; cursor: ew-resize; }

/* ============================================================ zoombar */
.zoombar {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
}
.zoom-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--ink-soft);
}
.zoom-btn:hover { background: #F3EEE7; color: var(--ink); }
.zoom-value {
  min-width: 46px;
  height: 30px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font: 700 11.5px var(--font-ui);
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.zoom-value:hover { background: #F3EEE7; }
.zoom-divider { width: 1px; height: 18px; background: var(--line); margin: 0 3px; }

.canvas-hint {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 10;
  font-size: 11px;
  color: rgba(35, 38, 47, .45);
  background: rgba(255, 255, 255, .6);
  padding: 6px 10px;
  border-radius: 8px;
  pointer-events: none;
}

/* =========================================================== connection */
.conn-banner {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 260px);
  padding: 8px 14px;
  border-radius: 10px;
  background: #FFF6E6;
  border: 1px solid #F3DCAF;
  color: #8A5A00;
  font-size: 12px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.conn-banner.is-info { background: #EDF3FF; border-color: #C8DAFF; color: #27518F; }
.conn-banner.is-warn { background: #FFF1EC; border-color: #FFCDBB; color: #A33C1B; }
.conn-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: dotPulse 1.2s infinite; }

body.is-readonly .rail,
body.is-readonly .formatbar { display: none; }

/* ============================================================== panel */
.panel {
  position: absolute;
  top: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 35;
  width: 340px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: panelIn .2s ease;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 56px;
  padding: 0 12px 0 18px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.panel-head h2 { font-size: 14.5px; font-weight: 800; margin: 0; letter-spacing: -.01em; }
.panel-body { padding: 16px; overflow: auto; flex: 1; }
.panel-section { margin-top: 20px; }
.panel-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  display: block;
}
.panel-hint { margin-top: 14px; font-size: 11.5px; line-height: 1.55; color: var(--muted); }
.field-row { display: flex; gap: 8px; align-items: center; }
.field-row .input { flex: 1; min-width: 0; }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 16px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 14px;
  background: var(--surface-2);
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover { border-color: var(--brand); background: #FFF8F3; }
.dropzone.is-drag { border-color: var(--brand); background: var(--brand-soft); }
.dropzone-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
}
.dropzone-hint { font-size: 12.5px; color: var(--ink-soft); line-height: 1.4; }

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip {
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #fff;
  font: 600 11.5px var(--font-ui);
  color: var(--ink-soft);
  transition: .14s;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.is-active { background: var(--brand-soft); border-color: transparent; color: var(--brand); }

.emoji-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.emoji-btn {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  border-radius: 10px;
  font-size: 22px;
  line-height: 1;
  transition: background .12s, transform .12s;
}
.emoji-btn:hover { background: #F5F0E9; transform: scale(1.12); }

.asset-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.asset-thumb {
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  padding: 0;
  background: var(--surface-2);
}
.asset-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.asset-thumb:hover { border-color: var(--brand); }
.asset-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
  font-size: 12px;
  text-align: left;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.asset-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-row:hover { border-color: var(--brand); color: var(--brand); }

/* ============================================================= inputs */
.input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: #B3AB9E; }
.input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(239, 97, 54, .13);
}
.input-lg { height: 46px; font-size: 14px; border-radius: 11px; }
.field-label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--muted);
  margin-bottom: 6px;
}

/* =========================================================== formatbar */
.formatbar {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 2px;
  max-width: calc(100vw - 40px);
  padding: 6px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  overflow-x: auto;
  scrollbar-width: none;
}
.formatbar::-webkit-scrollbar { display: none; }
.fb-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: 13px;
  flex: none;
  transition: background .13s, color .13s;
}
.fb-btn:hover { background: #F4EFE8; color: var(--ink); }
.fb-btn.is-active { background: var(--brand-soft); color: var(--brand); }
.fb-btn:disabled { opacity: .35; pointer-events: none; }
.fb-letter { font-family: "Nunito", var(--font-ui); font-weight: 800; font-size: 14px; }
.fb-divider { width: 1px; height: 20px; background: var(--line); margin: 0 4px; flex: none; }
.fb-select {
  height: 32px;
  max-width: 116px;
  padding: 0 4px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  flex: none;
}
.fb-select:hover { background: #F4EFE8; }
.fb-size { width: 54px; text-align: center; }
.fb-color { position: relative; padding-bottom: 2px; flex-direction: column; gap: 0; }
.color-a { font-family: "Nunito", var(--font-ui); font-weight: 800; font-size: 14px; line-height: 1; }
.color-line { width: 14px; height: 3px; border-radius: 2px; margin-top: 2px; }
.fb-actions { display: flex; align-items: center; gap: 1px; margin-left: 2px; }
.fb-danger { color: #C9483C; }
.fb-danger:hover { background: #FCEDEA; color: #B33A2E; }
.fb-hint { font-size: 11px; color: var(--muted); padding: 0 8px; white-space: nowrap; }
.fb-caption { font-size: 11.5px; font-weight: 600; color: var(--ink-soft); }
.frame-swatch { width: 18px; height: 18px; border-radius: 5px; border: 1px solid rgba(35, 38, 47, .12); }

.palette-popover {
  position: fixed;
  z-index: 200;
  width: 208px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  animation: pop .12s ease;
}
.palette-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 9px;
}
.palette-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.swatch {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px solid rgba(35, 38, 47, .12);
  padding: 0;
  transition: transform .12s, box-shadow .12s;
}
.swatch:hover { transform: scale(1.08); }
.swatch.is-active { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand); }
.swatch-none {
  background-image: linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%),
    linear-gradient(45deg, #eee 25%, #fff 25%, #fff 75%, #eee 75%);
  background-size: 10px 10px;
  background-position: 0 0, 5px 5px;
}
.palette-custom {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
  cursor: pointer;
}
.palette-custom input { width: 24px; height: 24px; padding: 0; border: none; background: none; cursor: pointer; }

/* ================================================================ boot */
.boot {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  background: radial-gradient(1200px 600px at 30% 10%, #FFF6EC 0%, var(--canvas) 45%, #F2EADF 100%);
  opacity: 0;
  transition: opacity .3s ease;
}
.boot.is-visible { opacity: 1; }
.boot-card { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.boot-title { font-weight: 800; font-size: 18px; letter-spacing: -.02em; margin-top: 6px; }
.boot-text { font-size: 12.5px; color: var(--muted); }
.boot-dots { display: flex; gap: 5px; margin-top: 4px; }
.boot-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
  opacity: .35;
  animation: bootBounce 1.1s infinite ease-in-out;
}
.boot-dots span:nth-child(2) { animation-delay: .15s; }
.boot-dots span:nth-child(3) { animation-delay: .3s; }
.boot #boot-retry { margin-top: 10px; }

/* ================================================================ gate */
.gate {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: auto;
  background:
    radial-gradient(900px 500px at 15% 0%, #FFF7ED 0%, transparent 60%),
    radial-gradient(900px 600px at 100% 100%, #FDEBDF 0%, transparent 55%),
    linear-gradient(160deg, #FBF4EA, #F0E7DA);
  transition: opacity .3s ease;
}
.gate.is-hidden { opacity: 0; pointer-events: none; }
.gate-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.gate-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: .55;
}
.gate-blob-1 { width: 420px; height: 420px; background: #FFD9C6; left: -120px; top: -120px; }
.gate-blob-2 { width: 460px; height: 460px; background: #D8EEE7; right: -140px; bottom: -160px; }
.gate-sticker {
  position: absolute;
  font-size: 44px;
  opacity: .8;
  animation: floatSlow 7s ease-in-out infinite;
  filter: drop-shadow(0 8px 14px rgba(35, 38, 47, .12));
}
.gate-sticker-1 { left: 12%; top: 22%; transform: rotate(-12deg); }
.gate-sticker-2 { right: 14%; top: 18%; animation-delay: 1.2s; }
.gate-sticker-3 { left: 18%; bottom: 18%; animation-delay: 2s; font-size: 34px; }
.gate-sticker-4 { right: 16%; bottom: 24%; animation-delay: .6s; font-size: 38px; }

.gate-card {
  position: relative;
  width: 100%;
  max-width: 430px;
  padding: 34px;
  background: rgba(255, 255, 255, .92);
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 26px;
  box-shadow: 0 40px 90px -40px rgba(66, 50, 32, .45), 0 10px 30px -20px rgba(66, 50, 32, .25);
  backdrop-filter: blur(14px);
  animation: gateIn .4s cubic-bezier(.2, .8, .3, 1);
}
.gate-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.gate-brand-name { font-weight: 800; font-size: 13px; letter-spacing: .01em; color: var(--ink-soft); }
.gate-card h1 {
  margin: 0 0 8px;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: -.03em;
  font-weight: 800;
}
.gate-sub { margin: 0 0 22px; font-size: 13px; line-height: 1.55; color: var(--ink-soft); }
.gate-form { display: flex; flex-direction: column; }
.gate-error {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #FDECEA;
  color: #B33A2E;
  font-size: 12px;
}
.gate-form .btn { margin-top: 18px; }
.gate-foot { margin-top: 22px; font-size: 11px; color: var(--muted); text-align: center; }
.gate-colors { display: flex; gap: 10px; }
.color-choice {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: transparent;
  padding: 3px;
  transition: border-color .15s, transform .12s;
}
.color-choice span { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--c); }
.color-choice:hover { transform: scale(1.08); }
.color-choice.is-active { border-color: var(--ink); }
.gate-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 10px);
  padding: 9px 16px;
  border-radius: 10px;
  background: #23262F;
  color: #fff;
  font-size: 12.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 5000;
}
.gate-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ================================================================ modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(30, 26, 21, .38);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .16s ease;
}
.modal-overlay.is-visible { opacity: 1; }
.modal {
  position: relative;
  width: 100%;
  max-width: 540px;
  max-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 40px 100px -30px rgba(20, 15, 10, .45);
  transform: translateY(10px) scale(.985);
  transition: transform .18s cubic-bezier(.2, .8, .3, 1);
}
.modal-overlay.is-visible .modal { transform: translateY(0) scale(1); }
.modal-sm { max-width: 420px; }
.modal-lg { max-width: 760px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 22px 22px 0 24px; }
.modal-title { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.modal-desc { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
.modal-close { margin-top: -4px; margin-right: -6px; }
.modal-body { padding: 18px 24px; overflow: auto; min-height: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 4px 24px 22px; }
.modal-text { font-size: 13.5px; line-height: 1.6; color: var(--ink-soft); }
.modal-form { display: flex; flex-direction: column; }

/* share */
.share-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 8px; }
.share-row { display: flex; gap: 8px; }
.share-input { flex: 1; background: var(--surface-2); font-size: 12px; color: var(--ink-soft); }
.share-note { margin-top: 12px; font-size: 12px; line-height: 1.55; color: var(--ink-soft); }
.share-warn { color: #A33C1B; background: #FFF1EC; padding: 8px 10px; border-radius: 8px; }
.share-muted { color: var(--muted); }
.share-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 600;
}
.share-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.btn.is-done { background: var(--green); }

/* boards */
.boards { display: flex; flex-direction: column; gap: 14px; }
.boards-list { display: flex; flex-direction: column; gap: 6px; }
.board-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color .15s, background .15s;
}
.board-row:hover { border-color: var(--line-strong); background: var(--surface-2); }
.board-row.is-active { border-color: #FFD2C1; background: var(--brand-soft); }
.board-open {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 6px;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.board-icon { display: flex; color: var(--muted); flex: none; }
.board-row.is-active .board-icon { color: var(--brand); }
.board-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-tag {
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--brand);
  background: #fff;
  border-radius: 5px;
  padding: 2px 5px;
  flex: none;
}
.board-actions { display: flex; gap: 2px; opacity: .45; transition: opacity .15s; }
.board-row:hover .board-actions, .board-row:focus-within .board-actions { opacity: 1; }

/* help */
.help h3 {
  margin: 18px 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}
.help h3:first-child { margin-top: 0; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.help-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 9px; }
.help-list li { position: relative; padding-left: 15px; font-size: 12px; line-height: 1.5; color: var(--ink-soft); }
.help-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--brand);
  opacity: .6;
}
.help-list b { color: var(--ink); font-weight: 700; }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 18px; font-size: 11.5px; color: var(--ink-soft); }
kbd {
  display: inline-block;
  min-width: 20px;
  padding: 1px 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface-2);
  font-family: var(--font-ui);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-soft);
  text-align: center;
  margin-right: 3px;
}
.help-footer { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.link-btn {
  border: none;
  background: transparent;
  padding: 0;
  font: inherit;
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

/* ================================================================ toasts */
.toasts {
  position: fixed;
  right: 18px;
  top: 76px;
  z-index: 3500;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  max-width: 340px;
  padding: 10px 14px 10px 11px;
  border-radius: 11px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .2s, transform .2s;
}
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast-icon { display: flex; margin-top: 1px; color: var(--sky); flex: none; }
.toast-success .toast-icon { color: var(--green); }
.toast-warn .toast-icon { color: var(--sun); }
.toast-error .toast-icon { color: var(--danger); }

/* ============================================================ upload */
.upload-status {
  position: fixed;
  left: 20px;
  bottom: 76px;
  z-index: 2500;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px 12px;
  min-width: 220px;
  background: #23262F;
  color: #fff;
  border-radius: 11px;
  box-shadow: var(--shadow-lg);
  font-size: 12px;
}
.upload-text { max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-percent { font-variant-numeric: tabular-nums; opacity: .7; }
.upload-spinner {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .25);
  border-top-color: #fff;
  animation: spin .8s linear infinite;
  flex: none;
}
.upload-bar { position: absolute; left: 10px; right: 10px; bottom: 5px; height: 2px; background: rgba(255, 255, 255, .18); border-radius: 2px; overflow: hidden; }
.upload-bar span { display: block; height: 100%; background: var(--brand); transition: width .2s; }

/* ============================================================== empty */
.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  padding: 20px;
  z-index: 5;
}
.empty-card {
  pointer-events: auto;
  width: min(560px, 100%);
  padding: 34px 32px 26px;
  text-align: center;
  background: rgba(255, 255, 255, .82);
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 24px;
  box-shadow: 0 30px 70px -40px rgba(66, 50, 32, .35);
  backdrop-filter: blur(8px);
}
.empty-art {
  position: relative;
  height: 86px;
  margin-bottom: 8px;
}
.empty-note {
  position: absolute;
  display: grid;
  place-items: center;
  padding: 8px 12px;
  border-radius: 10px;
  font-family: "Caveat", cursive;
  font-size: 20px;
  font-weight: 600;
  color: #4A3A2A;
  box-shadow: 0 10px 22px -14px rgba(66, 50, 32, .5);
}
.note-1 { left: 24%; top: 4px; background: #FFE3C8; transform: rotate(-6deg); }
.note-2 { left: 46%; top: 26px; background: #E1F0EA; transform: rotate(4deg); font-size: 17px; }
.note-3 { right: 23%; top: 2px; background: #FFF2C9; transform: rotate(-3deg); font-size: 26px; padding: 4px 10px; }
.empty-pencil { position: absolute; right: 15%; top: 34px; font-size: 30px; transform: rotate(18deg); }
.empty-card h1 { margin: 6px 0 8px; font-size: 24px; font-weight: 800; letter-spacing: -.03em; }
.empty-card p { margin: 0 auto 20px; max-width: 360px; font-size: 13px; line-height: 1.55; color: var(--ink-soft); }
.empty-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.empty-invite {
  margin-top: 18px;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  color: var(--brand);
  padding: 6px 8px;
  border-radius: 7px;
}
.empty-invite:hover { background: var(--brand-soft); }

/* ================================================================ drag */
.drop-overlay {
  position: absolute;
  inset: 12px;
  z-index: 200;
  display: grid;
  place-items: center;
  border: 2px dashed var(--brand);
  border-radius: 20px;
  background: rgba(250, 246, 239, .86);
  pointer-events: none;
  backdrop-filter: blur(2px);
}
.drop-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 26px 34px;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}
.drop-card span { color: var(--brand); }

/* ============================================================= animations */
@keyframes pop {
  0% { transform: scale(.94); opacity: 0; }
  60% { transform: scale(1.01); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes peerPulse {
  0%, 100% { outline-color: var(--peer-color); }
  50% { outline-color: transparent; }
}
@keyframes dotPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}
@keyframes bootBounce {
  0%, 100% { transform: translateY(0); opacity: .35; }
  50% { transform: translateY(-5px); opacity: 1; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes floatSlow {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50% { transform: translateY(-12px) rotate(4deg); }
}
@keyframes panelIn {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes gateIn {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============================================================ responsive */
@media (max-width: 1100px) {
  .canvas-hint { display: none; }
  .peer-status { display: none; }
}

@media (max-width: 900px) {
  .peer-name { display: none; }
  .peer-chip { padding-right: 4px; }
  .boards-btn .btn-label { display: none; }
  .boards-btn { margin-left: 2px; }
  .share .btn-label { display: none; }
}

@media (max-width: 720px) {
  .topbar { height: 58px; padding: 0 10px; gap: 8px; }
  .brand-mark { width: 34px; height: 34px; border-radius: 10px; font-size: 15px; }
  .board-title { width: 120px; max-width: 32vw; font-size: 14px; }
  .save-state { display: none; }
  .peer-chip.is-self,
  #undo-btn,
  #redo-btn,
  .topbar-divider { display: none; }
  .topbar-right { gap: 3px; }
  .topbar-right .icon-btn { width: 32px; height: 32px; }
  #share-btn { width: 36px; padding: 0; }
  #share-btn .btn-label { display: none; }
  body.has-formatbar .zoombar { display: none; }
  .rail {
    left: 10px;
    right: 10px;
    top: auto;
    bottom: 10px;
    flex-direction: row;
    justify-content: center;
    border-radius: 14px;
    padding: 5px;
    overflow-x: auto;
  }
  .rail-btn { width: 38px; height: 38px; flex: none; }
  .rail-btn::after { display: none; }
  .rail-sep { width: 1px; height: 24px; margin: 0 4px; }
  .zoombar { bottom: 68px; right: 10px; }
  .canvas-hint { display: none; }
  .formatbar { bottom: 68px; max-width: calc(100vw - 20px); }
  .panel { left: 10px; right: 10px; top: 10px; bottom: 68px; width: auto; }
  .empty-card { padding: 24px 18px 20px; }
  .empty-card h1 { font-size: 20px; }
  .empty-art { height: 64px; }
  .empty-note { font-size: 17px; }
  .note-2 { font-size: 14px; }
  .help-grid { grid-template-columns: 1fr; }
  .keys { grid-template-columns: 1fr; }
  .conn-banner { max-width: calc(100% - 24px); font-size: 11px; text-align: center; }
  .toasts { left: 10px; right: 10px; top: 66px; align-items: stretch; }
  .toast { max-width: none; }
  .share-row { flex-direction: column; }
  .modal-overlay { padding: 10px; }
  .modal { max-height: calc(100vh - 20px); }
  .gate-card { padding: 26px 22px; border-radius: 22px; }
  .gate-card h1 { font-size: 22px; }
}
