:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #6b7280;
  --line: #e5e3de;
  --primary: #2f5bea;
  --primary-hover: #2449c7;
  --danger: #d1383d;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.06), 0 1px 3px rgb(0 0 0 / 0.08);
  --shadow: 0 2px 6px rgb(0 0 0 / 0.06), 0 8px 24px rgb(0 0 0 / 0.08);
  --shadow-lg: 0 6px 16px rgb(0 0 0 / 0.1), 0 20px 48px rgb(0 0 0 / 0.14);
  --radius: 12px;
  --note-yellow: #fff1a8;
  --note-pink: #ffd3e1;
  --note-blue: #cfe6ff;
  --note-green: #cdf0c0;
  --note-purple: #e3d2fb;
  --note-white: #ffffff;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.45 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
kbd {
  font: 12px ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
}
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* Buttons & inputs ------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  font-weight: 550;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: #f3f2ef; }
.btn:disabled { opacity: .6; cursor: default; }
.btn-lg { height: 42px; padding: 0 18px; font-size: 15px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger-ghost { color: var(--danger); }
.btn-danger-ghost:hover { background: #fdecec; border-color: #f5c2c3; }
.btn.confirming { background: var(--danger); border-color: var(--danger); color: #fff; }

input:not([type=file]) {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgb(47 91 234 / 0.15); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Home page -------------------------------------------------------------- */
.home-page { background: radial-gradient(circle at 1px 1px, #dcd9d2 1px, transparent 0) 0 0 / 24px 24px, var(--bg); }
.home { max-width: 880px; margin: 0 auto; padding: 32px 20px 64px; }
.home-brand { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; }
.hero { margin: 56px 0 32px; }
.hero h1 { font-size: clamp(30px, 5vw, 46px); line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 14px; max-width: 16ch; }
.hero p { font-size: 17px; color: var(--muted); max-width: 52ch; margin: 0; }
.cards { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; }
@media (max-width: 700px) { .cards { grid-template-columns: 1fr; } }
.card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}
.card h2 { margin: 0; font-size: 17px; }
.card label { display: flex; flex-direction: column; gap: 6px; }
.card label span { font-size: 13px; font-weight: 550; color: var(--muted); }
.card .btn { margin-top: auto; }
.form-error { margin: 0; color: var(--danger); font-size: 13px; }
.mine { margin-top: 36px; }
.mine h2 { font-size: 15px; margin: 0 0 10px; }
.mine ul { list-style: none; padding: 0; margin: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.mine li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.mine li:first-child { border-top: 0; }
.mine a { color: var(--text); font-weight: 550; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mine a:hover { color: var(--primary); }
.mine time { color: var(--muted); font-size: 13px; flex-shrink: 0; }

/* Board layout ----------------------------------------------------------- */
.board-page { overflow: hidden; overscroll-behavior: none; }
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: calc(56px + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 14px 0;
  background: rgb(255 255 255 / 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.tb-left, .tb-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand { display: flex; flex-shrink: 0; }
.board-title {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 3px 6px;
  border-radius: 6px;
  outline: none;
  min-width: 0;
}
.board-title[contenteditable=true] { cursor: text; }
.board-title[contenteditable=true]:hover { background: #f0efeb; }
.board-title[contenteditable=true]:focus { background: #fff; box-shadow: 0 0 0 2px var(--primary); text-overflow: clip; }
.badge {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 99px;
  background: #e9eefe;
  color: var(--primary);
  font-size: 11.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.status { font-size: 12.5px; color: #b45309; background: #fef3c7; padding: 3px 9px; border-radius: 99px; }

.people { display: flex; padding-left: 8px; }
.avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-left: -8px;
  border-radius: 50%;
  border: 2px solid #fff;
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  cursor: default;
}
.avatar.more { background: #9ca3af; }

.share-wrap { position: relative; }
.popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(380px, calc(100vw - 28px));
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.popover h3 { margin: 0 0 4px; font-size: 15px; }
.popover p { margin: 0 0 12px; color: var(--muted); }
.popover p.small { margin: 10px 0 0; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { height: 34px; font-size: 13px; }

.banner {
  position: fixed;
  top: calc(56px + env(safe-area-inset-top, 0px));
  left: 0;
  right: 0;
  z-index: 40;
  padding: 8px 16px;
  text-align: center;
  font-weight: 550;
  background: #fff4e5;
  color: #92400e;
  border-bottom: 1px solid #fcd9a8;
}

.viewport {
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  outline: none;
  background-color: var(--bg);
  background-image: radial-gradient(circle at 1px 1px, #d6d3cc 1px, transparent 0);
  background-size: 24px 24px;
}
.viewport.panning { cursor: grabbing; }
.world { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-origin: 0 0; }

/* Items ------------------------------------------------------------------ */
.item {
  position: absolute;
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  transition: box-shadow .15s;
}
.item:hover { box-shadow: var(--shadow-lg); }
.item.selected { box-shadow: 0 0 0 2px var(--primary), var(--shadow-lg); }
.item.dragging { cursor: grabbing; box-shadow: 0 0 0 2px var(--primary), 0 14px 40px rgb(0 0 0 / 0.2); }
.readonly .item { cursor: default; }

.item-body { overflow: hidden; border-radius: 10px; }
.item-meta {
  position: absolute;
  left: 2px;
  top: 100%;
  margin-top: 4px;
  max-width: 100%;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity .15s;
  pointer-events: none;
}
.item:hover .item-meta, .item.selected .item-meta { opacity: 1; }

.item-del {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  transition: opacity .15s, color .12s, background .12s;
}
.item-del:hover { color: #fff; background: var(--danger); border-color: var(--danger); }
.item-resize {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
  opacity: 0;
  background:
    linear-gradient(135deg, transparent 55%, rgb(0 0 0 / 0.35) 55%, rgb(0 0 0 / 0.35) 62%, transparent 62%, transparent 72%, rgb(0 0 0 / 0.35) 72%, rgb(0 0 0 / 0.35) 79%, transparent 79%);
  transition: opacity .15s;
}
.item:hover .item-del, .item.selected .item-del,
.item:hover .item-resize, .item.selected .item-resize { opacity: 1; }
.readonly .item-del, .readonly .item-resize { display: none; }
@media (hover: none) {
  .item.selected .item-del, .item.selected .item-resize { opacity: 1; }
}

/* Notes */
.item-note { background: var(--note-yellow); }
.item-note .item-body { padding: 14px 16px 16px; min-height: 96px; }
.note-text {
  min-height: 1.5em;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  outline: none;
}
.note-text:empty::before { content: "Double-click to write…"; color: rgb(0 0 0 / 0.35); }
.item.editing { cursor: default; }
.item.editing .note-text { cursor: text; user-select: text; -webkit-user-select: text; }
.item.editing .note-text:empty::before { content: "Type something…"; }
.c-yellow { background: var(--note-yellow); }
.c-pink { background: var(--note-pink); }
.c-blue { background: var(--note-blue); }
.c-green { background: var(--note-green); }
.c-purple { background: var(--note-purple); }
.c-white { background: var(--note-white); }

/* Links */
.link-card { display: block; color: inherit; text-decoration: none; -webkit-user-drag: none; }
.link-img { display: block; width: 100%; max-height: 220px; object-fit: cover; background: #eee; border-bottom: 1px solid var(--line); }
.link-text { padding: 12px 14px 13px; }
.link-title { font-weight: 650; font-size: 14.5px; line-height: 1.35; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.link-desc { margin-top: 4px; color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.link-host { margin-top: 8px; font-size: 12px; color: var(--primary); display: flex; align-items: center; gap: 5px; }
.link-host::before { content: "↗"; }

/* Images */
.item-image { background: #fff; }
.image-img { display: block; width: 100%; height: auto; -webkit-user-drag: none; pointer-events: none; }

/* Floating controls ------------------------------------------------------ */
.toolbar {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  max-width: calc(100vw - 24px);
}
.toolbar > button {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-weight: 550;
  cursor: pointer;
}
.toolbar > button:hover { background: #f1f0ec; }
.toolbar svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tb-sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.swatches { display: flex; gap: 4px; padding: 0 4px; }
.swatch {
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgb(0 0 0 / 0.15);
  cursor: pointer;
  transition: transform .1s;
}
.swatch:hover { transform: scale(1.12); }
.swatch[aria-checked=true] { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--text); }
.readonly .toolbar { display: none; }
@media (max-width: 560px) {
  .toolbar > button span { display: none; }
  .swatch { width: 18px; height: 18px; }
  .tb-right .btn { padding: 0 10px; }
  .people { display: none; }
  #endBtn { font-size: 12.5px; }
}

.zoom {
  position: fixed;
  right: 16px;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 45;
  display: flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.zoom button { height: 34px; min-width: 34px; padding: 0 8px; border: 0; background: transparent; cursor: pointer; font-weight: 600; }
.zoom button:hover { background: #f1f0ec; }
#zoomReset { min-width: 56px; font-size: 12.5px; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .zoom { display: none; } }

.empty-hint {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 5;
}
.empty-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 340px;
  padding: 20px 22px;
  text-align: center;
  color: var(--muted);
  background: rgb(255 255 255 / 0.8);
  border: 1px dashed #cfccc4;
  border-radius: 14px;
}
.empty-card strong { color: var(--text); font-size: 15px; }

.drop-overlay {
  position: fixed;
  inset: 8px;
  z-index: 60;
  display: grid;
  place-items: center;
  border: 3px dashed var(--primary);
  border-radius: 18px;
  background: rgb(47 91 234 / 0.08);
  pointer-events: none;
}
.drop-overlay span { padding: 10px 18px; border-radius: 99px; background: var(--primary); color: #fff; font-weight: 600; }

/* Modals, lightbox, toasts ---------------------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgb(20 20 20 / 0.35);
}
.modal-solid { background: var(--bg); }
.modal-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(420px, 100%);
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
}
.modal-card h3 { margin: 0; font-size: 18px; }
.modal-card p { margin: -4px 0 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.modal-actions .btn-lg { flex: 1; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(10 10 10 / 0.85);
  cursor: zoom-out;
}
.lightbox { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.lightbox img { max-width: 100%; max-height: calc(100% - 64px); min-height: 0; border-radius: 6px; box-shadow: var(--shadow-lg); }
.lightbox-bar { display: flex; align-items: center; gap: 12px; max-width: 100%; cursor: default; }
.lightbox-name { color: #fff; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lightbox-dl svg, .entry-dl svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 9px 14px;
  border-radius: 10px;
  background: #1f2328;
  color: #fff;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-in .18s ease-out;
  transition: opacity .3s, transform .3s;
  max-width: calc(100vw - 32px);
}
.toast.error { background: var(--danger); }
.toast.out { opacity: 0; transform: translateY(6px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* Activity panel --------------------------------------------------------- */
:root { --panel-w: 360px; }
.btn-icon { position: relative; width: 36px; padding: 0; }
.btn-icon.active { background: #eef2fe; border-color: #c9d6fb; color: var(--primary); }
.unread {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  border: 2px solid #fff;
  box-sizing: content-box;
}
.icon-btn {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
}
.icon-btn:hover { background: #f1f0ec; color: var(--text); }

.panel {
  position: fixed;
  top: calc(56px + env(safe-area-inset-top, 0px));
  right: 0;
  bottom: 0;
  z-index: 48;
  display: flex;
  flex-direction: column;
  width: var(--panel-w);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 24px rgb(0 0 0 / 0.04);
  animation: panel-in .18s ease-out;
}
@keyframes panel-in { from { transform: translateX(24px); opacity: 0; } }
.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 10px 12px 16px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 { margin: 0; font-size: 15px; }
.panel-head .small { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.feed {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 0 12px;
}
.feed-empty { margin: 32px 24px; text-align: center; color: var(--muted); }

.entry { position: relative; padding: 10px 16px; border-radius: 0; transition: background .6s; }
.entry:hover { background: #faf9f7; }
.entry.flash { animation: entry-flash 1.4s ease-out; }
@keyframes entry-flash { 0%, 30% { background: #eef2fe; } }
.entry-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.entry-who { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-who strong { color: var(--text); font-weight: 650; }
.entry-time { flex-shrink: 0; font-size: 11.5px; color: var(--muted); }
.avatar.sm { width: 24px; height: 24px; margin: 0; border: 0; font-size: 10px; flex-shrink: 0; }
.entry-text {
  margin: 4px 0 0 32px;
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: text;
}
.entry-quote {
  display: flex;
  gap: 6px;
  max-width: calc(100% - 32px);
  margin: 6px 0 0 32px;
  padding: 3px 8px;
  border: 0;
  border-left: 3px solid #c9d6fb;
  border-radius: 4px;
  background: #f4f6fd;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}
.entry-quote:hover { background: #e9eefe; }
.quote-label { color: var(--muted); flex-shrink: 0; }
.quote-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }

.post-preview {
  display: flex;
  flex-direction: column;
  width: calc(100% - 32px);
  margin: 8px 0 0 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
  text-align: left;
  cursor: pointer;
  transition: box-shadow .12s, border-color .12s;
}
.post-preview:hover { border-color: #c9c6be; box-shadow: var(--shadow-sm); }
.post-preview.is-note { border-color: rgb(0 0 0 / 0.06); }
.post-preview.gone { cursor: default; background: #fafafa; opacity: .75; }
.post-text {
  padding: 10px 12px;
  font-size: 13.5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.gone .post-text { text-decoration: line-through; color: var(--muted); padding-bottom: 2px; }
.post-removed { padding: 0 12px 8px; font-size: 11.5px; color: var(--muted); }
.post-thumb { width: 100%; max-height: 120px; object-fit: cover; background: #eee; }
.post-link { display: flex; flex-direction: column; gap: 3px; padding: 9px 12px; }
.post-title { font-weight: 600; font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-host { font-size: 12px; color: var(--primary); }
.post-image { display: block; width: 100%; max-height: 200px; object-fit: contain; background: #f4f3ef; }

.entry-action, .entry-del {
  margin: 6px 0 0 32px;
  padding: 2px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.entry-action:hover { background: #eef2fe; }
.entry-del { position: absolute; top: 8px; right: 12px; margin: 0; color: var(--danger); opacity: 0; }
.entry:hover .entry-del, .entry-del[data-confirm="1"] { opacity: 1; background: #fff; }
.entry-del:hover { background: #fdecec; }

.composer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.reply-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 4px 4px 10px;
  border-radius: 8px;
  background: #f4f6fd;
  font-size: 12.5px;
  color: var(--muted);
}
.reply-chip span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-chip strong { color: var(--text); font-weight: 600; }
.reply-chip .icon-btn { width: 22px; height: 22px; }
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.composer textarea {
  flex: 1;
  min-height: 38px;
  max-height: 160px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  resize: none;
  font: inherit;
  line-height: 1.45;
  outline: none;
}
.composer textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgb(47 91 234 / 0.15); }
.composer textarea:disabled { background: #f6f5f2; }
.composer .btn { width: 38px; height: 38px; padding: 0; flex-shrink: 0; }

/* Comment badge on board items */
.item-comments {
  position: absolute;
  top: -10px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 3px;
  height: 24px;
  min-width: 24px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  transition: opacity .15s;
}
.item-comments svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linejoin: round; }
.item-comments span:empty { display: none; }
.item-comments.has { opacity: 1; color: var(--primary); border-color: #c9d6fb; }
.item:hover .item-comments, .item.selected .item-comments { opacity: 1; }
.item-comments:hover { background: #eef2fe; }
.readonly .item-comments:not(.has) { display: none; }
.item.flash { animation: item-flash 1.2s ease-out; }
@keyframes item-flash { 0%, 40% { box-shadow: 0 0 0 4px var(--primary), var(--shadow-lg); } }
.world.animating { transition: transform .3s ease; }

/* Keep floating controls clear of the open panel on wide screens */
@media (min-width: 761px) {
  .panel-open .toolbar { left: calc((100% - var(--panel-w)) / 2); }
  .panel-open .zoom { right: calc(var(--panel-w) + 16px); }
  .panel-open .toasts { left: calc((100% - var(--panel-w)) / 2); }
  .panel-open .empty-hint { right: var(--panel-w); }
  .panel-open .banner { right: var(--panel-w); }
}
@media (max-width: 760px) {
  .panel { width: 100%; }
  .panel-open .toolbar { display: none; }
}

/* Roles ------------------------------------------------------------------ */
:root {
  --trainer: #7c3aed;
  --trainer-bg: #f1eafe;
  --coach: #0f8a5f;
  --coach-bg: #e3f6ee;
  --participant: #5b6472;
  --participant-bg: #eef0f3;
}
.role-badge, .role-tag {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: .02em;
  white-space: nowrap;
  vertical-align: 1px;
}
.role-tag.sm { padding: 0 6px; font-size: 10.5px; line-height: 16px; }
.role-trainer { background: var(--trainer-bg); color: var(--trainer); }
.role-coach { background: var(--coach-bg); color: var(--coach); }
.role-participant { background: var(--participant-bg); color: var(--participant); }

.people-wrap { position: relative; }
button.people { border: 0; background: transparent; padding: 2px 4px 2px 12px; border-radius: 99px; cursor: pointer; }
button.people:hover { background: #f1f0ec; }
.avatar { cursor: inherit; }
.avatar.ring-trainer { box-shadow: 0 0 0 2px var(--trainer); }
.avatar.ring-coach { box-shadow: 0 0 0 2px var(--coach); }
.people-pop { width: min(320px, calc(100vw - 28px)); }
.people-pop p { margin-bottom: 8px; }
.people-list { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow-y: auto; }
.people-list li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.people-list li:first-child { border-top: 0; }
.pl-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.role-select {
  height: 28px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}

.share-pop { width: min(440px, calc(100vw - 28px)); }
.share-links { display: flex; flex-direction: column; gap: 12px; }
.share-row { display: flex; flex-direction: column; gap: 6px; }
.share-row-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.share-row-head .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.slug-editor { display: flex; flex-direction: column; gap: 6px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.slug-row {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  overflow: hidden;
}
.slug-row:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgb(47 91 234 / 0.15); }
.slug-prefix {
  flex-shrink: 1;
  min-width: 0;
  max-width: 55%;
  padding: 0 2px 0 10px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.slug-row input { flex: 1; min-width: 80px; height: 34px !important; border: 0 !important; box-shadow: none !important; padding-left: 2px !important; font-size: 13px; }
.slug-row .btn { height: 28px; margin-right: 3px; }
.card .slug-row input { height: 38px !important; font-size: 14px; }
.slug-msg { min-height: 1em; color: var(--muted); }
.slug-msg.ok { color: var(--coach); }
.slug-msg.bad { color: var(--danger); }
em.opt { font-style: normal; font-weight: 400; }

.join-role { margin: 0; display: flex; align-items: center; gap: 6px; color: var(--muted); }
.account-box { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--muted); }
.people-pop .account-box { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.account-who { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.account-who b { color: var(--text); font-weight: 600; }
.btn-google { width: 100%; font-size: 13.5px; }
.link-btn { padding: 0; border: 0; background: none; color: var(--primary); font: inherit; font-weight: 550; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* Items you can't change (participants viewing others' posts) */
.item.locked { cursor: default; }
.item.locked .item-del, .item.locked .item-resize { display: none; }
.item-meta .role-tag { margin-left: 2px; }

.entry-link { color: var(--primary); overflow-wrap: anywhere; }
.entry-link:hover { text-decoration: underline; }

/* Link view toggle: bookmark preview vs compact line (per viewer) -------- */
.link-mode {
  position: absolute;
  top: -10px;
  left: 10px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  transition: opacity .15s;
}
.link-mode svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.link-mode:hover { color: var(--primary); border-color: #c9d6fb; }
.item:hover .link-mode, .item.selected .link-mode { opacity: 1; }
.view-preview .link-mode .i-preview, .view-compact .link-mode .i-compact { display: none; }

.item-link.view-compact .link-img,
.item-link.view-compact .link-desc { display: none; }
.item-link.view-compact .link-text {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 8px;
  align-items: center;
  padding: 9px 12px;
}
.item-link.view-compact .link-text::before {
  content: "";
  grid-row: span 2;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: #eef2fe url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232f5bea' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 14a5 5 0 0 0 7 0l3-3a5 5 0 0 0-7-7l-1 1M14 10a5 5 0 0 0-7 0l-3 3a5 5 0 0 0 7 7l1-1'/%3E%3C/svg%3E") center / 16px no-repeat;
}
.item-link.view-compact .link-title { -webkit-line-clamp: 1; font-size: 13.5px; }
.item-link.view-compact .link-host { margin-top: 1px; }

/* Item tool buttons: open link, download image ---------------------------- */
.item-tool {
  position: absolute;
  top: -10px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--shadow-sm);
  opacity: 0;
  transition: opacity .15s;
  -webkit-user-drag: none;
}
.item-tool svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.item-tool:hover { color: var(--primary); border-color: #c9d6fb; }
.item:hover .item-tool, .item.selected .item-tool { opacity: 1; }
.link-open { left: 40px; }
.item-dl { left: 10px; }
.entry-dl { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
.entry-dl svg { width: 13px; height: 13px; }
@media (hover: none) { .item.selected .item-tool { opacity: 1; } }
.entry-action + .entry-action { margin-left: 2px; }

/* Auto layout (per-viewer view; saved positions are untouched) ------------ */
.layout-ctl {
  position: fixed;
  top: calc(68px + env(safe-area-inset-top, 0px));
  left: 16px;
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.banner:not([hidden]) ~ .layout-ctl { top: calc(108px + env(safe-area-inset-top, 0px)); }
.layout-ctl button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
}
.layout-ctl button:hover { color: var(--text); background: #f1f0ec; }
.layout-ctl button[aria-pressed=true] { background: #eef2fe; color: var(--primary); }
.layout-ctl select {
  height: 28px;
  margin-left: 2px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.world.anim .item { transition: left .45s ease, top .45s ease, width .45s ease; }
.auto-layout .world .item { transition: left .3s ease, top .3s ease; }
.world.measuring .item { transition: none !important; }
.auto-layout .item-resize { display: none; }
.auto-layout .item { cursor: default; }

.group-label {
  position: absolute;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  pointer-events: none;
}
.group-label span {
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 99px;
  background: #e9e7e2;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  vertical-align: 3px;
}
