/* =========================================================
   Наше место — общая доска для двоих
   Тёплая бумага, роза, рукописные записки.
   ========================================================= */

:root {
  --cream: #fbf4ee;
  --cream-deep: #f4e7de;
  --paper: #fffaf5;
  --paper-bright: #fffdf9;
  --ink: #3b2027;
  --ink-soft: #71545a;
  --muted: #9c8081;
  --rose: #b65466;
  --rose-deep: #8b3749;
  --rose-dark: #642737;
  --blush: #f3ddd8;
  --blush-soft: #f9ece8;
  --gold: #c4a071;
  --line: rgba(59, 32, 39, 0.12);
  --line-strong: rgba(59, 32, 39, 0.2);

  --serif: "Cormorant Garamond", "Times New Roman", Georgia, serif;
  --sans: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --hand: "Caveat", "Segoe Script", "Bradley Hand", cursive;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --shadow-soft: 0 18px 45px rgba(77, 31, 40, 0.1);
  --shadow-card: 0 26px 65px rgba(77, 31, 40, 0.14);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 280px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  background:
    radial-gradient(120% 90% at 8% 0%, #fdf1ea 0%, transparent 55%),
    radial-gradient(100% 80% at 100% 100%, #f6e6dc 0%, transparent 60%),
    var(--cream);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  cursor: default;
  -webkit-user-select: none;
  user-select: none;
}

/* Текст интерфейса — только для чтения: без каретки и выделения.
   Редактируемые поля ниже это правило переопределяют. */
input,
textarea,
[contenteditable="true"] {
  cursor: text;
  -webkit-user-select: text;
  user-select: text;
}

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

button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--rose);
  outline-offset: 2px;
}

/* ---------------------------------------------------------
   Шапка
   --------------------------------------------------------- */

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: calc(14px + var(--safe-top)) 26px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 244, 238, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 10;
}

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

.brand__heart {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--rose-deep), var(--rose-dark));
  color: var(--cream);
  box-shadow: 0 10px 22px rgba(139, 55, 73, 0.28);
}

.brand__heart svg {
  width: 22px;
  height: 22px;
}

.brand__text {
  min-width: 0;
}

.brand__text h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.1;
}

.brand__text p {
  margin: 2px 0 0;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.presence {
  display: flex;
  align-items: center;
}

.presence__avatar {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  margin-left: -9px;
  border-radius: 50%;
  border: 2px solid var(--cream);
  background: var(--blush);
  color: var(--rose-dark);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  box-shadow: 0 4px 10px rgba(77, 31, 40, 0.1);
  position: relative;
  transition: transform 0.25s var(--ease);
}

.presence__avatar:first-child {
  margin-left: 0;
}

.presence__avatar.has-avatar,
.me__avatar.has-avatar {
  background-position: center;
  background-size: cover;
  color: transparent;
}

.presence__avatar::after {
  content: "";
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6f9a6f;
  border: 1.5px solid var(--cream);
}

.presence__label {
  margin-left: 10px;
  font-size: 12px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.conn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  color: var(--ink-soft);
  background: rgba(255, 253, 249, 0.6);
  transition: color 0.3s, border-color 0.3s;
}

.conn__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 0 rgba(196, 160, 113, 0.5);
  transition: background 0.3s;
}

.conn[data-state="online"] .conn__dot {
  background: #6f9a6f;
  animation: pulse 2.6s infinite;
}

.conn[data-state="offline"] {
  color: var(--rose-deep);
  border-color: rgba(139, 55, 73, 0.3);
}

.conn[data-state="offline"] .conn__dot {
  background: var(--rose-deep);
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(111, 154, 111, 0.45);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(111, 154, 111, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(111, 154, 111, 0);
  }
}

.me {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 5px 13px 5px 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 249, 0.7);
  transition: border-color 0.25s, background 0.25s, transform 0.25s var(--ease);
}

.me:hover {
  border-color: var(--line-strong);
  background: var(--paper-bright);
}

.me:active {
  transform: scale(0.98);
}

.me__avatar {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--blush), #ecc9c3);
  color: var(--rose-dark);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.me__name {
  font-size: 13px;
  font-weight: 600;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------------------------------------------------
   Раскладка
   --------------------------------------------------------- */

.layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 372px;
  gap: 22px;
  padding: 22px 26px 26px;
}

.board-panel,
.notes-panel {
  min-width: 0;
  min-height: 0;
}

.board-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.board {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 26px;
  overflow: hidden;
  touch-action: none;
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 16% 10%, rgba(182, 84, 102, 0.07), transparent 46%),
    radial-gradient(circle at 86% 92%, rgba(196, 160, 113, 0.1), transparent 52%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.85) inset,
    0 0 0 1px var(--line),
    var(--shadow-soft);
  transition: box-shadow 0.4s var(--ease);
}

.board.is-drawing {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.85) inset,
    0 0 0 1px rgba(139, 55, 73, 0.28),
    0 22px 55px rgba(77, 31, 40, 0.16);
}

#gridCanvas,
#canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#gridCanvas {
  z-index: 0;
  pointer-events: none;
}

#canvas {
  z-index: 1;
  touch-action: none;
  cursor: crosshair;
}

.board[data-tool="hand"] #canvas,
.board.is-space #canvas {
  cursor: grab;
}

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

.board[data-tool="text"] #canvas {
  cursor: text;
}

.board[data-tool="eraser"] #canvas {
  cursor: cell;
}

.board[data-tool="hand"] .text-layer,
.board.is-space .text-layer {
  pointer-events: none;
}


.board__hint {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  padding: 24px;
  text-align: center;
  font-family: var(--hand);
  font-size: clamp(20px, 2.2vw, 27px);
  line-height: 1.25;
  color: rgba(113, 84, 90, 0.65);
  pointer-events: none;
  transition: opacity 0.5s var(--ease);
}

.board__hint-heart {
  font-size: 26px;
  color: rgba(182, 84, 102, 0.5);
}

.board__hint.is-hidden {
  opacity: 0;
}

.board__hint small {
  max-width: 340px;
  font-family: var(--sans);
  font-size: 11.5px;
  line-height: 1.5;
  letter-spacing: 0.01em;
  color: rgba(113, 84, 90, 0.55);
}

.board__mode-hint {
  position: absolute;
  top: 14px;
  left: 50%;
  z-index: 4;
  padding: 7px 15px;
  border-radius: 999px;
  background: rgba(59, 32, 39, 0.9);
  color: var(--cream);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -8px);
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}

.board__mode-hint.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* масштаб */

.zoom {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 249, 0.92);
  box-shadow: 0 8px 22px rgba(77, 31, 40, 0.12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.zoom__btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1;
  transition: background 0.2s, color 0.2s;
}

.zoom__btn:hover {
  background: var(--blush-soft);
  color: var(--rose-deep);
}

.zoom__btn svg {
  width: 15px;
  height: 15px;
}

.zoom__value {
  min-width: 54px;
  height: 30px;
  padding: 0 6px;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: background 0.2s, color 0.2s;
}

.zoom__value:hover {
  background: var(--blush-soft);
  color: var(--rose-deep);
}

/* текстовые стикеры */

.text-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
}

.board-text {
  position: absolute;
  left: 0;
  top: 0;
  width: 260px;
  padding: 16px 18px 17px;
  border: 1px solid rgba(59, 32, 39, 0.08);
  border-radius: 14px 14px 14px 4px;
  background: var(--sticky, #fff2cc);
  box-shadow: 0 10px 24px rgba(77, 31, 40, 0.14);
  color: var(--ink);
  font-family: var(--hand);
  font-size: 22px;
  line-height: 1.28;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  transform-origin: 0 0;
  pointer-events: auto;
  touch-action: none;
  transition: box-shadow 0.2s var(--ease);
}

.board-text:hover {
  box-shadow: 0 14px 30px rgba(77, 31, 40, 0.18);
}

.board-text.is-dragging {
  z-index: 4;
  cursor: grabbing;
  box-shadow: 0 22px 44px rgba(77, 31, 40, 0.24);
}

.board-text.is-edit-target {
  outline: 2px solid rgba(182, 84, 102, 0.45);
  outline-offset: 3px;
}

.board-text__delete {
  position: absolute;
  top: -10px;
  right: -10px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper-bright);
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1;
  box-shadow: 0 4px 10px rgba(77, 31, 40, 0.14);
  opacity: 0;
  transition: opacity 0.2s, background 0.2s, color 0.2s;
}

.board-text:hover .board-text__delete,
.board-text__delete:focus-visible {
  opacity: 1;
}

.board-text__delete:hover {
  background: var(--blush);
  color: var(--rose-dark);
}

.board__cursors {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: hidden;
  border-radius: inherit;
}

.cursor {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 6px;
  transform: translate(-6px, -6px);
  transition: left 0.09s linear, top 0.09s linear, opacity 0.4s ease;
  opacity: 1;
  will-change: left, top;
}

.cursor.is-idle {
  opacity: 0;
}

.cursor__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--rose);
  box-shadow: 0 0 0 3px rgba(182, 84, 102, 0.18);
}

.cursor__label {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--rose-deep);
  color: var(--cream);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(77, 31, 40, 0.18);
}

/* ---------------------------------------------------------
   Панель инструментов
   --------------------------------------------------------- */

.toolbar {
  flex: 0 0 auto;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  max-width: 100%;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 249, 0.82);
  box-shadow: 0 12px 30px rgba(77, 31, 40, 0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.toolbar__group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.toolbar__divider {
  width: 1px;
  height: 22px;
  background: var(--line);
}

.swatch {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: 0 0 0 2px var(--paper-bright);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.swatch:hover {
  transform: scale(1.12);
}

.swatch.is-active {
  box-shadow:
    0 0 0 2px var(--paper-bright),
    0 0 0 4px var(--swatch);
  transform: scale(1.06);
}

.size {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  transition: background 0.2s;
}

.size span {
  width: var(--dot);
  height: var(--dot);
  border-radius: 50%;
  background: var(--ink);
  transition: background 0.2s, transform 0.2s var(--ease);
}

.size:hover {
  background: var(--blush-soft);
}

.size.is-active {
  background: var(--blush);
}

.size.is-active span {
  background: var(--rose-deep);
  transform: scale(1.05);
}

.tool {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--ink-soft);
  transition: background 0.2s, color 0.2s, transform 0.2s var(--ease);
}

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

.tool:hover {
  background: var(--blush-soft);
  color: var(--rose-deep);
}

.tool:active {
  transform: scale(0.94);
}

.tool.is-active {
  background: var(--rose-deep);
  color: var(--cream);
}

.tool.is-flash {
  animation: tool-flash 0.45s var(--ease);
}

@keyframes tool-flash {
  50% {
    background: var(--blush);
    transform: scale(0.92);
  }
}

/* ---------------------------------------------------------
   Записки
   --------------------------------------------------------- */

.notes-panel {
  display: flex;
  flex-direction: column;
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(255, 250, 245, 0.78);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: hidden;
}

.notes-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 4px 14px;
  border-bottom: 1px dashed var(--line);
}

.notes-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.15;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.notes-head__count {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  color: var(--rose-deep);
  background: var(--blush);
  border-radius: 999px;
  padding: 2px 7px;
  transform: translateY(-2px);
}

.notes-head p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.notes-head__heart {
  margin-top: 4px;
  font-size: 18px;
  color: var(--rose);
  opacity: 0.55;
}

.notes {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 16px 4px 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--blush) transparent;
}

.notes::-webkit-scrollbar {
  width: 7px;
}

.notes::-webkit-scrollbar-thumb {
  background: var(--blush);
  border-radius: 999px;
}

.notes::-webkit-scrollbar-track {
  background: transparent;
}

.note {
  position: relative;
  padding: 11px 14px 9px;
  border: 1px solid rgba(59, 32, 39, 0.09);
  border-radius: 18px 18px 18px 6px;
  background: var(--paper-bright);
  box-shadow: 0 8px 20px rgba(77, 31, 40, 0.055);
  transform: rotate(-0.3deg);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.note:nth-child(even) {
  transform: rotate(0.35deg);
  border-radius: 18px 18px 6px 18px;
}

.note:hover {
  transform: rotate(0deg);
  box-shadow: 0 14px 30px rgba(77, 31, 40, 0.1);
}

.note--new {
  animation: note-in 0.5s var(--ease) both;
}

@keyframes note-in {
  from {
    opacity: 0;
    transform: translateY(12px) rotate(0.8deg) scale(0.98);
  }
  to {
    opacity: 1;
    transform: rotate(-0.3deg) scale(1);
  }
}

.note__head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 3px;
}

.note__avatar {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  align-self: center;
  width: 22px;
  height: 22px;
  margin-right: 2px;
  border: 1px solid rgba(59, 32, 39, 0.08);
  border-radius: 50%;
  background-color: var(--blush);
  background-position: center;
  background-size: cover;
  color: var(--rose-deep);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}

.note__avatar.has-avatar {
  color: transparent;
}

.note__author {
  font-size: 12px;
  font-weight: 700;
  color: var(--rose-deep);
  letter-spacing: 0.01em;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note__time {
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.note__delete {
  margin-left: auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s, color 0.2s;
}

.note:hover .note__delete,
.note__delete:focus-visible {
  opacity: 1;
}

.note__delete:hover {
  background: var(--blush);
  color: var(--rose-dark);
}

.note__text {
  margin: 0;
  font-family: var(--hand);
  font-size: 21px;
  line-height: 1.32;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.note__foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

.note__heart {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 12px;
  border: 1px solid rgba(182, 84, 102, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--rose);
  font-size: 13px;
  font-weight: 600;
  transition: color 0.2s, background 0.2s, border-color 0.2s, transform 0.2s var(--ease),
    box-shadow 0.2s;
}

.note__heart > span[aria-hidden="true"] {
  font-size: 18px;
  line-height: 1;
  transform: translateY(0.5px);
  transition: transform 0.2s var(--ease);
}

.note__heart:hover > span[aria-hidden="true"] {
  transform: translateY(0.5px) scale(1.12);
}

.note__heart.is-liked > span[aria-hidden="true"] {
  transform: translateY(0.5px) scale(1.05);
}

.note__heart-count {
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.note__heart:hover {
  border-color: rgba(182, 84, 102, 0.55);
  background: var(--blush-soft);
  color: var(--rose-deep);
}

.note__heart:active {
  transform: scale(0.95);
}

.note__heart.is-liked {
  border-color: var(--rose);
  background: var(--rose);
  color: #fff;
  box-shadow: 0 6px 14px rgba(182, 84, 102, 0.28);
}

.note__heart.is-liked:hover {
  border-color: var(--rose-deep);
  background: var(--rose-deep);
  color: #fff;
}

.note__heart.is-bumping {
  animation: heart-bump 0.4s var(--ease);
}

.like-burst {
  position: absolute;
  left: 50%;
  top: 0;
  color: var(--rose);
  font-size: 18px;
  line-height: 1;
  pointer-events: none;
  animation: like-fly 0.7s var(--ease) forwards;
}

@keyframes like-fly {
  0% {
    opacity: 0;
    transform: translate(-50%, 0) scale(0.5);
  }
  25% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -30px) scale(1.2);
  }
}

@keyframes heart-bump {
  40% {
    transform: scale(1.18);
  }
}

.notes__divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rose);
  opacity: 0.8;
}

.notes__divider::before,
.notes__divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(182, 84, 102, 0.35), transparent);
}

.notes-empty {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 26px 20px;
  text-align: center;
  color: var(--muted);
}

.notes-empty__heart {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 4px;
  border: 1px dashed rgba(182, 84, 102, 0.4);
  border-radius: 50%;
  color: var(--rose);
  font-size: 21px;
}

.notes-empty strong {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--ink-soft);
}

.notes-empty p {
  margin: 0;
  max-width: 230px;
  font-size: 12.5px;
  line-height: 1.5;
}

/* ---------------------------------------------------------
   Поле новой записки
   --------------------------------------------------------- */

.composer {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 7px 7px 7px 15px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper-bright);
  transition: border-color 0.25s, box-shadow 0.25s;
}

.composer:focus-within {
  border-color: rgba(182, 84, 102, 0.45);
  box-shadow: 0 0 0 4px rgba(182, 84, 102, 0.08);
}

.composer__input {
  flex: 1 1 auto;
  min-width: 0;
  max-height: 132px;
  padding: 6px 0;
  border: none;
  background: transparent;
  font-family: var(--hand);
  font-size: 21px;
  line-height: 1.3;
  color: var(--ink);
  resize: none;
  outline: none;
}

.composer__input::placeholder {
  color: rgba(156, 128, 129, 0.75);
}

.composer__send {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--rose), var(--rose-deep));
  color: var(--cream);
  box-shadow: 0 8px 18px rgba(139, 55, 73, 0.28);
  transition: transform 0.2s var(--ease), opacity 0.2s, box-shadow 0.2s;
}

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

.composer__send:hover {
  transform: translateX(1px) scale(1.04);
}

.composer__send:active {
  transform: scale(0.94);
}

.composer__send:disabled {
  opacity: 0.45;
  box-shadow: none;
  cursor: default;
}

/* ---------------------------------------------------------
   Нижние вкладки (мобильные)
   --------------------------------------------------------- */

.tabbar {
  display: none;
}

/* ---------------------------------------------------------
   Диалоги
   --------------------------------------------------------- */

.dialog {
  width: min(92vw, 420px);
  max-width: 420px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--ink);
  overflow: visible;
}

.dialog::backdrop {
  background: rgba(59, 32, 39, 0.36);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.dialog[open] .dialog__card {
  animation: dialog-in 0.35s var(--ease) both;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }
}

.dialog__card {
  position: relative;
  margin: 0;
  padding: 26px 26px 22px;
  border-radius: 26px;
  background: var(--paper-bright);
  box-shadow: var(--shadow-card), 0 0 0 1px rgba(59, 32, 39, 0.06);
  text-align: center;
}

.dialog__heart {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--blush-soft);
  color: var(--rose-deep);
  font-size: 20px;
}

.dialog__card h2 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 600;
  line-height: 1.15;
}

.dialog__card p {
  margin: 0 auto 18px;
  max-width: 310px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}

.dialog__actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.dialog__actions .btn {
  flex: 1;
}

.field {
  display: block;
  text-align: left;
}

.field__label {
  display: block;
  margin: 0 0 6px 4px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.field__input {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  font-size: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field__input:focus {
  outline: none;
  border-color: rgba(182, 84, 102, 0.5);
  box-shadow: 0 0 0 4px rgba(182, 84, 102, 0.09);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  transition: transform 0.2s var(--ease), background 0.2s, color 0.2s, box-shadow 0.2s;
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  background: linear-gradient(145deg, var(--rose), var(--rose-deep));
  color: var(--cream);
  box-shadow: 0 10px 22px rgba(139, 55, 73, 0.24);
}

.btn--primary:hover {
  box-shadow: 0 14px 26px rgba(139, 55, 73, 0.3);
}

.btn--ghost {
  background: var(--blush-soft);
  color: var(--ink-soft);
}

.btn--ghost:hover {
  background: var(--blush);
}

.btn--danger {
  background: var(--rose-dark);
  color: var(--cream);
  box-shadow: 0 10px 22px rgba(100, 39, 55, 0.24);
}

.dialog__card--text {
  text-align: left;
}

.dialog__card--text h2 {
  text-align: center;
}

.field__input--area {
  min-height: 112px;
  font-family: var(--hand);
  font-size: 22px;
  line-height: 1.3;
  resize: vertical;
}

.sticky-colors {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
}

.sticky-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--sticky);
  box-shadow: 0 0 0 1px var(--line);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.sticky-swatch:hover {
  transform: scale(1.1);
}

.sticky-swatch.is-active {
  box-shadow:
    0 0 0 2px var(--paper-bright),
    0 0 0 4px var(--rose);
}

.dialog__actions--text {
  flex-wrap: wrap;
}

.btn--delete {
  margin-right: auto;
  color: var(--rose-deep);
}

/* профиль: аватарка */

.avatar-edit {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 16px 0 18px;
  padding: 12px;
  border: 1px dashed rgba(182, 84, 102, 0.3);
  border-radius: 18px;
  background: rgba(249, 236, 232, 0.45);
  text-align: left;
}

.avatar-edit__preview {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  overflow: hidden;
  border: 2px solid var(--paper-bright);
  border-radius: 50%;
  background: linear-gradient(145deg, var(--blush), #ecc9c3);
  box-shadow: 0 0 0 1px var(--line), 0 8px 18px rgba(77, 31, 40, 0.12);
  color: var(--rose-dark);
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  cursor: pointer;
}

.avatar-edit__preview:hover {
  box-shadow: 0 0 0 1px rgba(182, 84, 102, 0.4), 0 10px 22px rgba(77, 31, 40, 0.16);
}

.avatar-edit__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-edit__initial {
  line-height: 1;
}

.avatar-edit__controls {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.btn--small {
  padding: 8px 14px;
  font-size: 12.5px;
}

.avatar-edit__remove {
  padding: 0;
  color: var(--muted);
  font-size: 11.5px;
  text-decoration: underline;
  cursor: pointer;
  transition: color 0.2s;
}

.avatar-edit__remove:hover {
  color: var(--rose-deep);
}

.avatar-edit__hint {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.4;
}

.is-hidden {
  display: none !important;
}

/* ---------------------------------------------------------
   Тост
   --------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  top: calc(78px + var(--safe-top));
  z-index: 60;
  max-width: min(90vw, 420px);
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(59, 32, 39, 0.94);
  color: var(--cream);
  font-size: 12.5px;
  font-weight: 500;
  text-align: center;
  box-shadow: 0 16px 34px rgba(59, 32, 39, 0.3);
  opacity: 0;
  transform: translate(-50%, -12px);
  pointer-events: none;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------------------------------------------------------
   Адаптив
   --------------------------------------------------------- */

@media (max-width: 900px) {
  body {
    height: 100vh;
    height: 100dvh;
  }

  .topbar {
    gap: 10px;
    padding: calc(9px + var(--safe-top)) 14px 9px;
  }

  .brand {
    gap: 9px;
  }

  .brand__heart {
    width: 34px;
    height: 34px;
    border-radius: 11px;
  }

  .brand__heart svg {
    width: 18px;
    height: 18px;
  }

  .brand__text h1 {
    font-size: 19px;
  }

  .brand__text p {
    display: none;
  }

  .topbar__right {
    gap: 8px;
  }

  .presence__label,
  .conn__label {
    display: none;
  }

  .presence__avatar {
    width: 27px;
    height: 27px;
    font-size: 10px;
    margin-left: -8px;
  }

  .conn {
    padding: 5px 7px;
  }

  .me {
    padding-right: 5px;
  }

  .me__name {
    display: none;
  }

  .me__avatar {
    width: 27px;
    height: 27px;
    font-size: 11px;
  }

  .layout {
    position: relative;
    display: block;
    padding: 0;
  }

  .board-panel,
  .notes-panel {
    position: absolute;
    inset: 10px 12px calc(76px + var(--safe-bottom));
  }

  body[data-view="board"] .notes-panel,
  body[data-view="notes"] .board-panel {
    display: none;
  }

  .board-panel {
    gap: 10px;
  }

  .board {
    border-radius: 22px;
  }

  .board__hint {
    font-size: 20px;
    padding: 18px;
  }

  .board__hint small {
    display: none;
  }

  .board__mode-hint {
    top: 10px;
    max-width: calc(100% - 24px);
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
  }

  .zoom {
    right: 10px;
    bottom: 10px;
    padding: 3px;
  }

  .zoom__btn {
    width: 28px;
    height: 28px;
  }

  .zoom__value {
    min-width: 48px;
    height: 28px;
  }

  .toolbar {
    gap: 4px 8px;
    padding: 7px 10px;
    border-radius: 22px;
  }

  .toolbar__colors {
    flex: 1 0 100%;
    justify-content: center;
  }

  .toolbar__divider {
    display: none;
  }

  .toolbar__sizes {
    margin-right: 6px;
  }

  .swatch {
    width: 23px;
    height: 23px;
  }

  .size {
    width: 29px;
    height: 29px;
  }

  .tool {
    width: 33px;
    height: 33px;
  }

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

  .notes-panel {
    padding: 14px 13px 12px;
    border-radius: 22px;
  }

  .notes-head {
    padding: 2px 3px 11px;
  }

  .notes-head h2 {
    font-size: 21px;
  }

  .notes-head p {
    font-size: 11.5px;
  }

  .notes {
    padding: 13px 2px 10px;
    gap: 10px;
  }

  .note__text {
    font-size: 20px;
  }

  .composer {
    padding: 6px 6px 6px 13px;
    border-radius: 18px;
  }

  .composer__input {
    font-size: 20px;
  }

  .composer__send {
    width: 38px;
    height: 38px;
  }

  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: flex;
    align-items: stretch;
    height: calc(64px + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    border-top: 1px solid var(--line);
    background: rgba(251, 244, 238, 0.9);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .tab {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    transition: color 0.2s;
  }

  .tab svg {
    width: 21px;
    height: 21px;
  }

  .tab.is-active {
    color: var(--rose-deep);
  }

  .tab.is-active::before {
    content: "";
    position: absolute;
    top: 0;
    width: 34px;
    height: 2.5px;
    border-radius: 0 0 4px 4px;
    background: var(--rose);
  }

  .tab__badge {
    position: absolute;
    top: 12px;
    left: 50%;
    margin-left: 9px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--rose);
    box-shadow: 0 0 0 2px var(--cream);
  }

  .toast {
    top: calc(60px + var(--safe-top));
  }

  .dialog__card {
    padding: 22px 20px 18px;
    border-radius: 22px;
  }

  .dialog__card h2 {
    font-size: 24px;
  }

  .dialog__actions {
    margin-top: 16px;
  }
}

@media (max-width: 380px) {
  .toolbar {
    gap: 3px 6px;
    padding: 6px 8px;
  }

  .swatch {
    width: 21px;
    height: 21px;
  }

  .swatch:nth-child(n + 7) {
    display: none;
  }

  .tool {
    width: 30px;
    height: 30px;
  }

  .size {
    width: 27px;
    height: 27px;
  }
}

@media (max-height: 620px) and (max-width: 900px) {
  .topbar {
    padding-top: calc(6px + var(--safe-top));
    padding-bottom: 6px;
  }

  .brand__heart {
    width: 30px;
    height: 30px;
  }

  .brand__text h1 {
    font-size: 17px;
  }
}

@media (hover: none) {
  .note__delete {
    opacity: 0.5;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
