:root {
  --bg: #e9eaec;
  --chrome: #ffffff;
  --toolbar: #f5f5f6;
  --border: #dcdde1;
  --text: #222326;
  --muted: #8a8e96;
  --card: #ffffff;
  --card-border: rgba(0, 0, 0, .06);
  --col-body: #f1f1f3;
  --hover: rgba(0, 0, 0, .05);
  --ink: #222326; --ink-muted: #8a8e96; --ink-hover: rgba(0, 0, 0, .05);
  --sel: #1f2023;
  --focus: #3d7efd;
  --accent: #ef4f45;
  --line: #3a3c40;
  --danger: #e5484d;
  --tile: #ffffff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .1), 0 1px 5px rgba(0, 0, 0, .05);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, .18);
  --font: 'Inter', 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Lora', 'Vazirmatn', Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1c1f; --chrome: #232427; --toolbar: #202124; --border: #35373c; --text: #e9e9ea; --muted: #9a9ea6;
    --card: #2a2c30; --card-border: rgba(255, 255, 255, .06); --col-body: #222327; --hover: rgba(255, 255, 255, .07);
    --ink: #e9e9ea; --ink-muted: #9a9ea6; --ink-hover: rgba(255, 255, 255, .07);
    --sel: #f2f2f2; --line: #b9bcc2; --tile: #2e3034;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 1px 5px rgba(0, 0, 0, .3); --shadow-lg: 0 10px 30px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1b1c1f; --chrome: #232427; --toolbar: #202124; --border: #35373c; --text: #e9e9ea; --muted: #9a9ea6;
  --card: #2a2c30; --card-border: rgba(255, 255, 255, .06); --col-body: #222327; --hover: rgba(255, 255, 255, .07);
    --ink: #e9e9ea; --ink-muted: #9a9ea6; --ink-hover: rgba(255, 255, 255, .07);
  --sel: #f2f2f2; --line: #b9bcc2; --tile: #2e3034;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 1px 5px rgba(0, 0, 0, .3); --shadow-lg: 0 10px 30px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); overflow: hidden; display: grid;
  grid-template-rows: auto minmax(0, 1fr); grid-template-columns: 72px minmax(0, 1fr);
  grid-template-areas: "top top" "tools main";
}
button { font: inherit; color: inherit; }
.ic { width: 18px; height: 18px; flex: none; }
.offscreen { position: fixed; left: -100px; top: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; }
.muted { color: var(--muted); font-size: 12px; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; }

/* ---------- header ---------- */
#topbar { grid-area: top; background: var(--chrome); border-bottom: 1px solid var(--border); z-index: 20; min-width: 0; }
.row1 { display: flex; align-items: center; gap: 4px; height: 40px; padding: 0 12px; }
.row2 { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 42px; padding: 0 12px 4px; }
#crumbs { display: flex; align-items: center; gap: 2px; min-width: 0; overflow: hidden; }
.crumb {
  display: flex; align-items: center; gap: 7px; border: 0; background: none; padding: 4px 8px; border-radius: 6px;
  cursor: pointer; white-space: nowrap; max-width: 200px; min-width: 0; font-size: 13px; font-weight: 500;
}
.crumb span { overflow: hidden; text-overflow: ellipsis; }
.crumb:hover { background: var(--hover); }
.crumb .logo { width: 18px; height: 18px; border-radius: 50%; background: var(--text); color: var(--chrome); display: grid; place-items: center; font-size: 10px; font-weight: 700; flex: none; }
.crumb .chip { width: 13px; height: 13px; border-radius: 3px; background: var(--cc, #b5bd8a); flex: none; }
.spacer { flex: 1; }
.icon-btn { width: 32px; height: 32px; border: 0; background: none; border-radius: 6px; cursor: pointer; display: grid; place-items: center; color: var(--text); }
.icon-btn .ic { width: 19px; height: 19px; }
.icon-btn:hover:not(:disabled) { background: var(--hover); }
.icon-btn:disabled { opacity: .3; cursor: default; }
#status { font-size: 11px; color: var(--muted); white-space: nowrap; }
#status.bad { color: var(--danger); font-weight: 600; }
#boardTitle {
  margin: 0; font: 700 21px/1.2 var(--serif); letter-spacing: -.01em; text-align: center; padding: 2px 10px; border-radius: 6px;
  max-width: 46vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; outline: none;
}
#boardTitle.editable { cursor: text; }
#boardTitle.editable:hover { background: var(--hover); }
#boardTitle[contenteditable] { background: var(--hover); text-overflow: clip; }
#status { grid-column: 1; }
#boardTitle { grid-column: 2; }
.row2-actions { grid-column: 3; display: flex; justify-content: flex-end; gap: 2px; }
.txt-btn { display: flex; align-items: center; gap: 5px; border: 0; background: none; padding: 5px 9px; border-radius: 6px; cursor: pointer; font-size: 12.5px; font-weight: 500; }
.txt-btn:hover { background: var(--hover); }
.txt-btn .ic { width: 15px; height: 15px; }
.txt-btn .chev { width: 12px; height: 12px; stroke-width: 2.4; }

/* ---------- left toolbar ---------- */
#toolbar {
  grid-area: tools; background: var(--toolbar); border-inline-end: 1px solid var(--border); z-index: 15;
  overflow-y: auto; overflow-x: hidden; padding: 10px 3px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  scrollbar-width: none;
}
.tb {
  display: flex; flex-direction: column; align-items: center; gap: 5px; width: 64px; padding: 6px 0 5px; border: 0; background: none;
  border-radius: 8px; cursor: pointer; font-size: 11px; color: var(--text); touch-action: none; flex: none;
}
.tb > span:last-child { line-height: 1.1; text-align: center; color: color-mix(in srgb, var(--text) 80%, transparent); }
.tb:hover { background: var(--hover); }
.tb.on { background: color-mix(in srgb, var(--focus) 16%, transparent); }
.tb.tool { cursor: grab; }
.tile {
  width: 38px; height: 31px; border-radius: 6px; background: var(--tile); box-shadow: 0 1px 2px rgba(0, 0, 0, .14);
  display: grid; place-items: center;
}
.tile .ic { width: 21px; height: 21px; }
.tile.blue { background: #4f7cf7; color: #fff; box-shadow: none; }
.tile.green { background: #3fae6a; box-shadow: none; }
.tile.art-video { background: linear-gradient(135deg, #5b8cff, #a35cf0); box-shadow: none; }
.tile.art-map { overflow: hidden; padding: 0; box-shadow: none; }
.tile.art-map svg { width: 38px; height: 31px; display: block; }
.art-line { width: 38px; height: 31px; display: grid; place-items: center; color: var(--text); }
.art-line svg { width: 30px; height: 30px; }
.art-color { width: 38px; height: 31px; position: relative; }
.art-color i { position: absolute; width: 23px; height: 20px; border-radius: 4px; }
.art-color i:first-child { left: 4px; top: 1px; background: #2fa7a0; }
.art-color i:last-child { left: 13px; top: 10px; background: #ef5f7a; box-shadow: -1px -1px 0 1px var(--toolbar); }
.tb .plain { width: 38px; height: 31px; display: grid; place-items: center; }
.tb .plain .ic { width: 23px; height: 23px; }
.tb.icon-only { padding: 8px 0; }
.tb .letter { font-size: 16px; font-weight: 700; width: 32px; height: 24px; display: grid; place-items: center; }
.tb-sep { width: 40px; height: 1px; background: var(--border); margin: 8px 0; flex: none; }
.tb-fill { flex: 1; min-height: 12px; }
.tb .dot { width: 18px; height: 18px; border-radius: 50%; background: var(--pen); border: 2px solid var(--toolbar); box-shadow: 0 0 0 1px var(--border); }
.tb.on .dot { box-shadow: 0 0 0 2px var(--focus); }
.tb .size { border-radius: 50%; background: var(--text); }
.tool-ghost {
  position: fixed; z-index: 300; pointer-events: none; width: 150px; height: 70px; border-radius: 3px; background: var(--card);
  box-shadow: var(--shadow-lg); display: grid; place-items: center; color: var(--muted); transform: translate(-50%, -50%); opacity: .95;
}
.tool-ghost .ic { width: 26px; height: 26px; }

/* ---------- canvas ---------- */
#viewport { grid-area: main; position: relative; overflow: clip; touch-action: none; user-select: none; -webkit-user-select: none; background: var(--bg); }
#viewport.space, #viewport.space * { cursor: grab !important; }
#viewport.panning, #viewport.panning * { cursor: grabbing !important; }
#viewport.connecting, #viewport.connecting *, #viewport.line-mode, #viewport.line-mode * { cursor: crosshair !important; }
#viewport.draw-mode, #viewport.draw-mode * { cursor: crosshair !important; }
#viewport.dropping { box-shadow: inset 0 0 0 3px var(--focus); }
#layer { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-origin: 0 0; }
#marquee { position: absolute; border: 1px solid var(--focus); background: color-mix(in srgb, var(--focus) 10%, transparent); pointer-events: none; z-index: 5; }
#empty { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; color: var(--muted); text-align: center; padding: 24px; white-space: pre-line; font-size: 14px; }
#dropLine { position: fixed; height: 3px; background: var(--focus); border-radius: 2px; z-index: 50; pointer-events: none; }
#zoomToast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); background: var(--chrome); border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; font-size: 11px; box-shadow: var(--shadow); z-index: 30; pointer-events: none; }

/* lines */
#links { position: absolute; overflow: visible; pointer-events: none; z-index: 0; }
#links .hit { fill: none; stroke: transparent; stroke-width: 22; pointer-events: stroke; cursor: pointer; }
#links .ln { fill: none; stroke-linecap: round; }
#links .tmp { stroke-dasharray: 6 5; }
#links .lk.sel .ln, #links .lk.sel polygon { filter: drop-shadow(0 0 1.5px var(--focus)) drop-shadow(0 0 3px var(--focus)); }
#links .lh { fill: var(--chrome); stroke: var(--focus); stroke-width: 2; pointer-events: all; cursor: move; }
#links text {
  font: 500 12px var(--font); fill: var(--text); paint-order: stroke; stroke: var(--bg); stroke-width: 5px;
  text-anchor: middle; dominant-baseline: middle; pointer-events: all; cursor: pointer;
}
#drawSvg { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; z-index: 99999; }
#drawSvg path { fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- cards ---------- */
.card { position: absolute; background: var(--card); border-radius: 2px; box-shadow: var(--shadow); color: var(--text); }
/* like Milanote: a coloured card is filled with the full colour, with dark text (white on the dark colours) */
.card[data-color] { background: var(--cc); --text: #1d1f22; --muted: rgba(29, 31, 34, .6); --hover: rgba(0, 0, 0, .07); }
.card[data-color="black"], .card[data-color="purple"], .card[data-color="blue"] { --text: #fff; --muted: rgba(255, 255, 255, .7); --hover: rgba(255, 255, 255, .12); }
/* plain cards sitting inside a coloured column keep the normal look */
.card[data-color] .card:not([data-color]) { --text: var(--ink); --muted: var(--ink-muted); --hover: var(--ink-hover); }
.card.selected { outline: 1.5px solid var(--sel); outline-offset: 0; }
.card.editing { outline: 1.5px solid var(--sel); }
.card.dragging { box-shadow: var(--shadow-lg); }
.card.flash { animation: flash 1.2s ease; }
.card.connect-target { outline: 2px dashed var(--focus); outline-offset: 3px; }
@keyframes flash { 0%, 60% { outline: 3px solid #f2c94c; outline-offset: 4px; } }
.card.in-col { position: relative; }

[data-edit] { outline: none; overflow-wrap: anywhere; min-height: 1.5em; }
[contenteditable] { user-select: text; -webkit-user-select: text; cursor: text; }
[data-ph]:empty::before { content: attr(data-ph); color: var(--muted); opacity: .8; pointer-events: none; }

.resize {
  position: absolute; right: 1px; bottom: 1px; width: 14px; height: 14px; cursor: nwse-resize; display: none; z-index: 2;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none' stroke='%23999ca3' stroke-width='1.4' stroke-linecap='round'%3E%3Cpath d='M12 4 4 12M12 8.5 8.5 12'/%3E%3C/svg%3E") center / 14px no-repeat;
}
.card.selected > .resize, .card:hover > .resize { display: block; }
/* corner arrow: drag it out to draw a line from this card */
.link-handle {
  position: absolute; right: -9px; top: -9px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233a3c40' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17 17 7M9 7h8v8'/%3E%3C/svg%3E") center / 11px no-repeat;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25); cursor: crosshair; opacity: 0; transform: scale(.7); transition: opacity .12s, transform .12s; z-index: 3;
}
.card:hover > .link-handle { opacity: 1; transform: none; }
.link-handle:hover { background-color: #e8f0ff; box-shadow: 0 0 0 2px var(--focus); }
.t-board > .link-handle { right: calc(50% - 41px); top: -4px; }
.card.locked > .resize { display: none !important; }
#lineDel {
  position: absolute; z-index: 6; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--chrome); color: var(--danger); box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer;
}
#lineDel .ic { width: 16px; height: 16px; }
#lineDel:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.icon-grid { display: grid; grid-template-columns: repeat(3, 34px); gap: 4px; }
.icon-grid.two { grid-template-columns: repeat(2, 34px); }
.icon-grid .mini { width: 34px; height: 32px; }
.icon-grid .mini .ic { width: 18px; height: 18px; }
body.is-dragging .link-handle, .card.editing > .link-handle { display: none; }

.mini { border: 0; background: var(--hover); border-radius: 5px; height: 26px; min-width: 26px; padding: 0 8px; display: inline-grid; place-items: center; cursor: pointer; font-size: 12px; flex: none; }
.mini .ic { width: 15px; height: 15px; }
.mini:hover { background: color-mix(in srgb, var(--text) 12%, transparent); }

.reacts { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 12px 10px; }
.react { border: 1px solid var(--border); background: var(--chrome); border-radius: 12px; padding: 0 7px; font-size: 13px; line-height: 22px; cursor: pointer; }
.react:hover { border-color: var(--muted); }

/* note */
.rich { padding: 13px 15px; min-height: 46px; }
.rich > :first-child { margin-top: 0; }
.rich > :last-child { margin-bottom: 0; }
.rich p, .rich div { margin: 0; }
.rich h1 { font: 700 1.45em/1.25 var(--serif); margin: .2em 0 .35em; }
.rich h2 { font-size: 1.15em; line-height: 1.3; margin: .2em 0 .3em; }
.rich ul, .rich ol { margin: .25em 0; padding-inline-start: 1.4em; }
.rich a { color: var(--focus); }
.rich blockquote { margin: .3em 0; padding-inline-start: 10px; border-inline-start: 3px solid var(--border); color: var(--muted); }
.rich code { font: .9em ui-monospace, Menlo, monospace; background: var(--hover); padding: 1px 4px; border-radius: 3px; }

/* to-do */
.todo-head { display: flex; align-items: baseline; gap: 8px; padding: 12px 14px 6px; }
.todo-title { font-weight: 600; flex: 1; }
.due { font-size: 11px; color: var(--muted); background: var(--hover); border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.due.late { color: #fff; background: var(--danger); }
.todo-bar { height: 3px; background: var(--hover); margin: 0 14px 6px; border-radius: 2px; overflow: hidden; }
.todo-bar i { display: block; height: 100%; background: #46a865; transition: width .2s; }
.todo-list { list-style: none; margin: 0; padding: 0 8px; }
.todo-list li { display: flex; gap: 8px; align-items: flex-start; padding: 2px 6px; }
.todo-text { flex: 1; min-width: 0; }
.chk { width: 15px; height: 15px; border: 1.5px solid #b8bcc3; border-radius: 3px; flex: none; margin-top: 3px; display: grid; place-items: center; cursor: pointer; color: #fff; }
.chk .ic { width: 11px; height: 11px; stroke-width: 3; }
.done .chk { background: #46a865; border-color: #46a865; }
.done .todo-text { text-decoration: line-through; color: var(--muted); }
.add-item { display: flex; gap: 6px; align-items: center; color: var(--muted); padding: 4px 14px 12px; cursor: pointer; font-size: 13px; }
.add-item .ic { width: 14px; height: 14px; }
.add-item:hover { color: var(--text); }

/* image */
.t-image .img { display: block; width: 100%; pointer-events: none; min-height: 40px; background: var(--hover); }
.caption { padding: 8px 12px; font-size: 13px; color: var(--muted); }
.card:not(.selected):not(.editing) .caption:empty { display: none; }
.credit { padding: 0 12px 9px; font-size: 11px; color: var(--muted); }
.credit a { color: var(--accent); }

/* link */
.link-thumb { position: relative; }
.link-thumb img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; pointer-events: none; background: var(--hover); }
.link-thumb.yt::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 54px; height: 38px; margin: -19px 0 0 -27px; border-radius: 10px;
  background: #f00 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 7l8 5-8 5z' fill='white'/%3E%3C/svg%3E") center / 26px no-repeat;
}
.link-row { display: flex; gap: 10px; align-items: center; padding: 10px 12px; }
.fav { width: 18px; height: 18px; border-radius: 4px; flex: none; }
.link-meta { flex: 1; min-width: 0; }
.link-title { font-weight: 600; line-height: 1.35; }
.link-host { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-input { display: flex; gap: 8px; align-items: center; padding: 12px 14px; color: var(--muted); }
.link-input .ic { width: 15px; height: 15px; }
.link-input [data-edit] { flex: 1; color: var(--text); }

.link-thumb.playing { aspect-ratio: 16 / 9; }
.link-thumb.playing::after { display: none; }
.link-thumb iframe { display: block; width: 100%; height: 100%; border: 0; }

/* video */
.t-video { overflow: hidden; }
.vwrap { position: relative; background: #000; cursor: pointer; }
.vid { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; pointer-events: none; }
.vid:fullscreen { pointer-events: auto; }
.vplay {
  position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; border: 0;
  background: rgba(20, 20, 22, .62); color: #fff; display: grid; place-items: center; cursor: pointer; backdrop-filter: blur(4px);
  transition: transform .12s, background .12s;
}
.vplay svg { width: 26px; height: 26px; margin-left: 3px; }
.vplay:hover { transform: scale(1.07); background: rgba(20, 20, 22, .8); }
.vwrap.playing .vplay { display: none; }
.vdur { position: absolute; right: 8px; bottom: 8px; background: rgba(0, 0, 0, .65); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 4px; pointer-events: none; font-variant-numeric: tabular-nums; }
.card.selected .vdur, .vwrap.playing .vdur, .vwrap:hover .vdur, #theater .vdur { display: none; }
.vctl {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 6px; padding: 18px 8px 6px; cursor: default;
  background: linear-gradient(transparent, rgba(0, 0, 0, .7)); color: #fff; opacity: 0; transition: opacity .15s; pointer-events: none;
}
.card.selected .vctl, .vwrap.playing .vctl, .vwrap:hover .vctl, #theater .vctl, .vwrap:fullscreen .vctl { opacity: 1; pointer-events: auto; }
.vbtn { border: 0; background: none; color: #fff; width: 26px; height: 26px; display: grid; place-items: center; cursor: pointer; border-radius: 4px; padding: 0; flex: none; }
.vbtn:hover { background: rgba(255, 255, 255, .18); }
.vbtn svg { width: 17px; height: 17px; }
.vtime { font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.vseek { flex: 1; min-width: 40px; accent-color: #fff; height: 4px; cursor: pointer; }
.vmeta { display: flex; align-items: center; gap: 8px; padding: 9px 12px 10px; }
.vinfo { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.vdl { display: inline-flex; align-items: center; gap: 4px; border: 0; background: var(--hover); color: var(--text); border-radius: 4px; padding: 2px 7px 2px 5px; font-size: 11.5px; font-weight: 500; cursor: pointer; }
.vdl .ic { width: 13px; height: 13px; }
.vdl:hover { background: var(--focus); color: #fff; }
.vmeta-text { flex: 1; min-width: 0; }
.vtitle { font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }

.vwrap-ph { background: #111; }
.vwrap:fullscreen { display: flex; align-items: center; justify-content: center; }
.vwrap:fullscreen .vid { width: 100vw; height: 100vh; }
.vwrap:fullscreen .vctl { padding: 30px 18px 12px; }
#theater { position: fixed; inset: 0; z-index: 380; background: rgba(12, 12, 14, .82); display: grid; place-items: center; }
.theater-box { width: min(70vw, 70vh * 1.78); max-height: 80vh; box-shadow: var(--shadow-lg); border-radius: 6px; overflow: hidden; }
.theater-box.doc { height: 88vh; max-height: none; background: #525659; }
.pdf-frame { width: 100%; height: 100%; border: 0; display: block; }
.theater-box .vwrap { width: 100%; height: 100%; max-height: 80vh; }
.theater-close { position: fixed; top: 16px; right: 18px; width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .14); color: #fff; display: grid; place-items: center; cursor: pointer; }
.theater-close .ic { width: 22px; height: 22px; transform: rotate(45deg); }
.theater-close:hover { background: rgba(255, 255, 255, .26); }

/* pdf */
.t-pdf { overflow: hidden; }
.pdf-prev { background: #fff; border-bottom: 1px solid var(--card-border); overflow: hidden; }
.pdf-prev img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; pointer-events: none; }
.pdf-ph { height: 100%; display: grid; place-content: center; justify-items: center; gap: 6px; color: #e5484d; font-weight: 700; font-size: 13px; background: #fafafa; }
.pdf-ph .ic { width: 40px; height: 40px; stroke-width: 1.3; }
.vinfo { flex-wrap: wrap; }

/* board */
.card.t-board { background: none; box-shadow: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 4px 6px; text-align: center; }
.card.t-board[data-color] { background: none; box-shadow: none; --text: var(--ink); --muted: var(--ink-muted); --hover: var(--ink-hover); }
/* Milanote-style board: a rounded colour tile, no frame; selection rings the tile only */
.card.t-board.selected { outline: none; }
.board-icon { width: 64px; height: 64px; border-radius: 14px; background: var(--cc, #8d8f94); color: #fff; display: grid; place-items: center; margin-bottom: 8px; box-shadow: 0 1px 3px rgba(0, 0, 0, .18); transition: box-shadow .12s; }
.board-icon .ic { width: 30px; height: 30px; }
.board-icon.has-icon { color: color-mix(in srgb, var(--cc, #8d8f94) 38%, #15171a); }
.board-icon .bsvg { width: 34px; height: 34px; }
.board-icon.has-pic { overflow: hidden; }
.board-icon .bpic { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; object-position: 50% 22%; } /* a tall photo shows its upper part, where faces usually are */
.board-icon .bemoji { font-size: 34px; line-height: 1; }
.board-icon .bnum { font-size: 32px; font-weight: 500; color: #fff; }
.card.t-board.selected .board-icon { box-shadow: 0 0 0 3px var(--sel), 0 2px 8px rgba(0, 0, 0, .25); }
.board-title { font-weight: 600; font-size: 13.5px; line-height: 1.3; }
.t-board .muted { font-size: 11.5px; }

/* column */
.t-column { padding: 0 0 8px; }
.col-head { padding: 12px 10px 8px; text-align: center; }
.col-title { font: 700 15px/1.3 var(--serif); }
.col-body { display: flex; flex-direction: column; gap: 8px; margin: 0 8px; }
.col-empty { margin: 0 8px; background: var(--col-body); border-radius: 2px; padding: 22px 8px; text-align: center; color: var(--muted); font-size: 12px; }
.col-body:not(:empty) + .col-empty { display: none; }
.t-column .col-body:not(:empty) { background: var(--col-body); padding: 8px; margin: 0 8px; }
.t-column[data-color] .col-body:not(:empty) { background: none; padding: 0 8px; margin: 0; }
.t-column[data-color] .col-empty { background: rgba(0, 0, 0, .08); }
.t-column.drop-target { outline: 2px dashed var(--focus); outline-offset: 2px; }

/* comment */
.cmt-list { padding: 10px 12px 0; display: flex; flex-direction: column; gap: 10px; }
.cmt { display: flex; gap: 9px; }
.av { width: 26px; height: 26px; border-radius: 50%; background: #e86fb0; color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.cmt-body { flex: 1; min-width: 0; }
.cmt-meta { font-size: 12px; }
.cmt-meta span { color: var(--muted); margin-inline-start: 6px; }
.cmt-reply { margin: 10px 12px 12px; padding: 6px 9px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }

/* table */
.tbl { border-collapse: collapse; width: 100%; table-layout: fixed; font-size: 13px; }
.tbl th { background: var(--hover); color: var(--muted); font-weight: 500; font-size: 11px; height: 22px; }
.tbl th:first-child { width: 28px; }
.tbl td { border: 1px solid var(--border); padding: 0; vertical-align: top; }
.tbl td [data-edit] { padding: 5px 7px; min-height: 30px; }
.tbl tr > :first-child { border-inline-start: 0; }

/* swatch */
.card.t-swatch { overflow: hidden; }
.sw { aspect-ratio: 150 / 122; cursor: pointer; position: relative; }
.sw-hex { position: absolute; left: 10px; top: 9px; font-size: 11px; font-weight: 600; letter-spacing: .02em; }
.sw-meta { padding: 9px 10px 11px; }
.sw-name { font-weight: 500; font-size: 12.5px; line-height: 1.3; }
.sw-name[data-ph]:empty::before { color: var(--text); opacity: 1; }

/* file */
.t-file { display: flex; align-items: center; gap: 10px; padding: 10px; }
.file-ic { width: 40px; height: 48px; border-radius: 4px; background: #4f7cf7; color: #fff; flex: none; display: grid; place-items: center; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.file-meta { flex: 1; min-width: 0; }
.file-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* sketch & drawing */
.t-sketch { overflow: hidden; background: #fff; }
.sketch-img { display: block; width: 100%; background: #fff; pointer-events: none; }
.sketch-empty { aspect-ratio: 3 / 2; display: grid; place-content: center; justify-items: center; gap: 6px; color: #9a9ea6; background: #fff; font-size: 11px; text-align: center; padding: 8px; }
.sketch-empty .ic { width: 24px; height: 24px; }
.card.t-drawing, .card.t-drawing[data-color] { background: none; box-shadow: none; }
.card.t-drawing[data-color] { --text: var(--ink); --muted: var(--ink-muted); --hover: var(--ink-hover); }
.t-drawing svg { display: block; width: 100%; height: auto; overflow: visible; }
.t-drawing path { fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- menus & popovers ---------- */
.menu, .pop { position: fixed; z-index: 200; background: var(--chrome); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-lg); }
.menu { padding: 6px; min-width: 210px; }
.mi { display: flex; width: 100%; align-items: center; gap: 10px; padding: 6px 10px; border: 0; background: none; border-radius: 5px; cursor: pointer; text-align: start; white-space: nowrap; font-size: 13px; }
.mi:hover { background: var(--hover); }
.mi .kbd { margin-inline-start: auto; color: var(--muted); font-size: 12px; padding-inline-start: 16px; }
.mi.danger { color: var(--danger); }
.mi.on { font-weight: 600; }
.mi .ic { width: 16px; height: 16px; color: var(--muted); }
.mhead { padding: 6px 10px 2px; font-size: 12px; font-weight: 600; }
.msep { height: 1px; background: var(--border); margin: 5px 4px; }
.mnote { padding: 4px 10px 2px; font-size: 11.5px; color: var(--muted); }
.mi:disabled { opacity: .4; cursor: default; }
.mi:disabled:hover { background: none; }
.colors { display: flex; flex-wrap: wrap; gap: 7px; padding: 8px 10px; max-width: 220px; }
.cdot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--chrome); box-shadow: 0 0 0 1px var(--border); cursor: pointer; padding: 0; background: var(--cc); }
.cdot[data-color="none"], .cdot[data-color=""] { background: linear-gradient(135deg, transparent 45%, var(--danger) 46% 54%, transparent 55%), var(--card); }
.cdot:hover { transform: scale(1.12); }
.cdot.on { box-shadow: 0 0 0 2px var(--focus); }

.pop { padding: 12px; width: 300px; max-height: calc(100vh - 24px); overflow: auto; }
.pop h4 { margin: 0 0 4px; font-size: 13px; }
.pop .tip { font-size: 11.5px; color: var(--muted); text-align: center; margin-top: 8px; }
.pop-sep { height: 1px; background: var(--border); margin: 12px -12px; }
.pop-input { width: 100%; height: 32px; border: 1px solid var(--border); border-radius: 6px; padding: 0 10px; font: inherit; font-size: 13px; background: var(--chrome); color: var(--text); outline: none; }
.pop-input:focus { border-color: var(--focus); }
.btn-red { display: block; width: 100%; border: 0; border-radius: 5px; background: var(--accent); color: #fff; font-weight: 600; font-size: 13px; padding: 8px 12px; cursor: pointer; }
.btn-red:hover { filter: brightness(1.05); }
.btn-outline { display: block; width: 100%; border: 1px solid var(--border); border-radius: 5px; background: none; padding: 6px 10px; cursor: pointer; font-size: 12.5px; }
.btn-outline:hover { background: var(--hover); }
.btn-dark { display: block; width: 100%; border: 0; border-radius: 5px; background: var(--text); color: var(--chrome); font-weight: 600; padding: 8px 10px; cursor: pointer; font-size: 13px; }
.upload-art { display: grid; place-items: center; height: 90px; color: var(--accent); }
.upload-art .ic { width: 52px; height: 52px; stroke-width: 1.4; }
.img-results { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; max-height: 300px; overflow: auto; }
.img-results img { width: 100%; height: 90px; object-fit: cover; border-radius: 4px; cursor: pointer; background: var(--hover); display: block; }
.img-results img:hover { outline: 2px solid var(--focus); }
.img-results .muted { grid-column: 1 / -1; text-align: center; padding: 10px; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.emoji-grid button { border: 0; background: none; font-size: 20px; padding: 3px; border-radius: 5px; cursor: pointer; }
.emoji-grid button:hover { background: var(--hover); }
.trash-list { display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow: auto; }
.trash-item { display: flex; gap: 10px; align-items: center; padding: 6px; border-radius: 6px; }
.trash-item:hover { background: var(--hover); }
.trash-thumb { width: 44px; height: 44px; border-radius: 4px; background: var(--hover); display: grid; place-items: center; flex: none; overflow: hidden; color: var(--muted); }
.trash-thumb img { width: 100%; height: 100%; object-fit: cover; }
.trash-text { flex: 1; min-width: 0; font-size: 12.5px; }
.trash-text div:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.view-pop .zoom-row { display: flex; align-items: center; gap: 8px; margin: 10px 0; }
.view-pop input[type=range] { flex: 1; accent-color: var(--text); }
.view-pop .zv { font-size: 12px; width: 40px; text-align: end; font-variant-numeric: tabular-nums; }
.check-row { display: flex; align-items: center; gap: 8px; padding: 4px 10px 6px; font-size: 12px; color: var(--muted); cursor: pointer; }
.search-pop .res-list { margin-top: 8px; display: flex; flex-direction: column; }
.res { display: flex; gap: 10px; width: 100%; text-align: start; border: 0; background: none; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.res:hover, .res.active { background: var(--hover); }
.res .ic { margin-top: 2px; color: var(--muted); }
.res-body { min-width: 0; flex: 1; }
.res-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.res mark { background: rgba(255, 210, 0, .45); color: inherit; border-radius: 2px; }
.res-empty { padding: 12px; color: var(--muted); text-align: center; font-size: 13px; }

/* ---------- overlays ---------- */
#lightbox { position: fixed; inset: 0; z-index: 400; background: rgba(0, 0, 0, .85); display: grid; place-items: center; cursor: zoom-out; }
#lightbox img { max-width: 92vw; max-height: 92vh; box-shadow: var(--shadow-lg); }
#modal { position: fixed; inset: 0; z-index: 400; background: rgba(0, 0, 0, .45); display: grid; place-items: center; padding: 16px; }
.modal-card { background: var(--chrome); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 18px 20px; width: min(540px, 100%); max-height: 85vh; overflow: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 16px; }
.modal-card table { width: 100%; border-collapse: collapse; }
.modal-card td { padding: 6px 4px; border-bottom: 1px solid var(--border); font-size: 13px; }
kbd { font: 12px ui-monospace, Menlo, monospace; background: var(--toolbar); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; white-space: nowrap; }
#toast { position: fixed; left: 50%; bottom: 50px; transform: translateX(-50%); z-index: 500; background: #222326; color: #fff; padding: 9px 15px; border-radius: 7px; box-shadow: var(--shadow-lg); font-size: 13px; max-width: calc(100vw - 32px); text-align: center; }

#sketchModal { position: fixed; inset: 0; z-index: 350; background: rgba(30, 30, 32, .72); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 20px; }
#sketchModal canvas { display: block; background: #fff; box-shadow: var(--shadow-lg); touch-action: none; cursor: crosshair; max-width: 100%; }
.sk-bar { display: flex; align-items: center; gap: 4px; background: #fff; color: #222; border-radius: 10px; padding: 5px; box-shadow: var(--shadow-lg); }
.sk-bar button { border: 0; background: none; color: #222; height: 32px; min-width: 32px; border-radius: 6px; display: grid; place-items: center; cursor: pointer; padding: 0 8px; font-size: 13px; font-weight: 500; }
.sk-bar button:hover:not(:disabled) { background: rgba(0, 0, 0, .06); }
.sk-bar button:disabled { opacity: .3; }
.sk-bar button.on { background: rgba(0, 0, 0, .09); }
.sk-bar .sw-btn span { width: 18px; height: 18px; border-radius: 3px; background: var(--pen); display: block; }
.sk-bar .sep { width: 1px; height: 22px; background: #ddd; margin: 0 4px; }
.sk-bar .save { background: var(--accent); color: #fff; }
.sk-bar .save:hover { background: var(--accent) !important; filter: brightness(1.06); }

#exitPresent { position: fixed; top: 14px; right: 14px; z-index: 60; border: 1px solid var(--border); background: var(--chrome); border-radius: 6px; padding: 5px 12px; cursor: pointer; font-size: 12px; opacity: .6; }
#exitPresent:hover { opacity: 1; }
body.presenting { grid-template-rows: 0 minmax(0, 1fr); grid-template-columns: 0 minmax(0, 1fr); }
body.presenting #topbar, body.presenting #toolbar { display: none; }
body.presenting .link-handle, body.presenting .resize { display: none !important; }

/* ---------- small screens ---------- */
@media (max-width: 720px) {
  body { grid-template-rows: auto minmax(0, 1fr) 64px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "main" "tools"; }
  #status, #helpBtn { display: none; }
  #boardTitle { font-size: 17px; }
  .txt-btn { padding: 5px 6px; }
  #toolbar { flex-direction: row; overflow-x: auto; overflow-y: hidden; border-inline-end: 0; border-top: 1px solid var(--border); padding: 4px; }
  .tb-sep { width: 1px; height: 32px; margin: 0 6px; }
  .tb-fill { display: none; }
}

/* board icon picker */
.pop.icon-pop { width: 316px; padding: 8px; }
.ip-tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.ip-tabs button { flex: 1; border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600; padding: 6px; border-radius: 6px; cursor: pointer; }
.ip-tabs button.on { background: var(--hover, rgba(127, 127, 127, .15)); color: var(--text); }
.ip-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; max-height: 260px; overflow-y: auto; align-content: start; }
.ip-grid .bi { height: 36px; border: 0; border-radius: 7px; background: none; color: var(--text); display: grid; place-items: center; cursor: pointer; padding: 0; }
.ip-grid .bi:hover { background: var(--hover, rgba(127, 127, 127, .15)); }
.ip-grid .bi.on { box-shadow: inset 0 0 0 2px var(--focus); }
.ip-grid .bi .bsvg { width: 22px; height: 22px; }
.ip-grid .be { font-size: 21px; }
.ip-search { width: 100%; box-sizing: border-box; margin-bottom: 8px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 7px; background: transparent; color: var(--text); font: inherit; outline: none; }
.ip-search:focus { border-color: var(--focus); }
.ip-none { grid-column: 1 / -1; padding: 18px 0; text-align: center; }
.ip-upload { margin-top: 8px; width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 7px; padding: 7px; background: var(--hover, rgba(127, 127, 127, .15)); color: var(--text); font: inherit; cursor: pointer; }
.ip-upload .ic { width: 16px; height: 16px; }
.ip-remove { margin-top: 8px; width: 100%; border: 0; border-radius: 7px; padding: 7px; background: var(--hover, rgba(127, 127, 127, .15)); color: var(--text); font: inherit; cursor: pointer; }

/* heading: big text straight on the board */
.card.t-heading { background: none; box-shadow: none; padding: 6px 10px; }
/* like Milanote: a coloured heading gets a filled box with dark text */
.card.t-heading[data-color] { background: var(--cc); box-shadow: var(--shadow); padding: 14px 16px; }
.t-heading[data-color] .heading-text { color: #1d1f22; }
.t-heading[data-color="black"] .heading-text, .t-heading[data-color="purple"] .heading-text, .t-heading[data-color="blue"] .heading-text { color: #fff; }
.heading-text { font-family: Lora, Georgia, serif; font-size: 30px; font-weight: 700; line-height: 1.25; min-height: 1.25em; }
.heading-text p, .heading-text h1, .heading-text h2, .heading-text blockquote { margin: 0; font: inherit; }
.heading-text ul, .heading-text ol { margin: 0; padding-inline-start: 1.2em; }
.heading-text h1 { font-size: 1.3em; }
.heading-text h2 { font-size: .75em; }
.heading-text blockquote { font-style: italic; opacity: .85; }
.heading-text code { font-size: .8em; }

/* document card */
.card.t-doc { padding: 14px 14px 10px; }
.doc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.doc-head .ic { width: 20px; height: 20px; flex: none; color: var(--muted); }
.doc-title { font-weight: 600; font-size: 15px; line-height: 1.3; flex: 1; min-width: 0; }
.doc-snip { font-size: 12.5px; line-height: 1.5; color: color-mix(in srgb, var(--text) 75%, transparent); display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 8px; white-space: pre-line; }
#docEditor { position: fixed; inset: 0; z-index: 390; background: rgba(12, 12, 14, .7); display: flex; justify-content: center; overflow-y: auto; padding: 40px 16px; }
.doc-sheet { width: min(760px, 100%); min-height: calc(100vh - 80px); background: var(--card); color: var(--text); border-radius: 6px; box-shadow: var(--shadow-lg); padding: 0 64px 64px; height: fit-content; }
.doc-bar { position: sticky; top: -40px; display: flex; align-items: center; gap: 2px; padding: 12px 0; margin-bottom: 18px; background: var(--card); border-bottom: 1px solid var(--border); z-index: 1; }
.doc-bar button { border: 0; background: none; color: var(--text); min-width: 32px; height: 30px; border-radius: 6px; cursor: pointer; font: inherit; font-size: 14px; display: grid; place-items: center; }
.doc-bar button:hover { background: var(--hover); }
.doc-bar .ic { width: 18px; height: 18px; }
.doc-bar .sp { flex: 1; }
.doc-bar [data-close] .ic { transform: rotate(45deg); width: 22px; height: 22px; }
.doc-ed-title { font-family: Lora, Georgia, serif; font-size: 32px; font-weight: 700; line-height: 1.25; outline: none; margin-bottom: 14px; }
.doc-ed-body { font-size: 16px; line-height: 1.7; outline: none; min-height: 50vh; }
@media (max-width: 640px) { .doc-sheet { padding: 0 20px 40px; } }

/* audio card */
.card.t-audio { padding: 12px; }
.aud { display: flex; gap: 12px; align-items: center; }
.aud audio { display: none; }
.aplay { width: 44px; height: 44px; border-radius: 50%; border: 0; flex: none; background: #3fae6a; color: #fff; display: grid; place-items: center; cursor: pointer; }
.aplay svg { width: 22px; height: 22px; }
.aud-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.aseek { width: 100%; accent-color: #3fae6a; margin: 2px 0; cursor: pointer; }

/* map card */
.card.t-map { padding: 0; overflow: hidden; }
.map-search { display: flex; align-items: center; gap: 8px; padding: 14px; }
.map-search .ic { width: 20px; height: 20px; color: var(--muted); flex: none; }
.map-search [data-edit] { flex: 1; min-width: 0; }
.map-frame { aspect-ratio: 4 / 3; background: #dfe8d8; }
.map-frame iframe { width: 100%; height: 100%; border: 0; display: block; pointer-events: none; }

/* a selected map can be zoomed and moved (drag the card by its caption) */
.card.t-map.selected .map-frame iframe { pointer-events: auto; }
body.is-dragging .map-frame iframe { pointer-events: none !important; }
.map-addr { font-size: 11.5px; line-height: 1.4; margin-top: 2px; }

/* swatch toolbar: the Color button is the colour itself, Display shows HEX / RGB */
.sw-chip { width: 26px; height: 22px; border-radius: 5px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18), 0 1px 2px rgba(0, 0, 0, .25); }
.hex-badge { min-width: 30px; height: 22px; padding: 0 3px; border-radius: 5px; background: var(--tile); font-size: 9.5px; font-weight: 700; letter-spacing: .02em; display: grid; place-items: center; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }

/* toolbar: tools that don't fit wait in the ••• popup */
.tb[hidden] { display: none; }
.pop.tools-pop { width: auto; padding: 8px; }
.tool-grid { display: grid; grid-template-columns: repeat(2, 64px); gap: 4px; }
.tool-grid .tb { width: 64px; }

/* template chooser on a new board (bottom right, like Milanote) */
#tplPanel {
  position: fixed; right: 18px; bottom: 18px; z-index: 60; width: 272px; padding: 14px; border-radius: 10px;
  background: var(--chrome); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
}
.tp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 15px; }
.tp-x { border: 0; background: none; color: var(--muted); width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; cursor: pointer; }
.tp-x .ic { width: 18px; height: 18px; transform: rotate(45deg); }
.tp-x:hover { background: var(--hover); color: var(--text); }
.tp-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.tp-item { display: flex; align-items: center; justify-content: space-between; border: 0; background: none; color: var(--text); font: inherit; font-size: 13.5px; text-align: start; padding: 7px 12px; border-radius: 6px; cursor: pointer; }
.tp-item:hover { background: var(--hover); }
.tp-item.on { background: color-mix(in srgb, var(--text) 10%, transparent); }
.tp-badge { font-size: 9.5px; font-weight: 700; letter-spacing: .03em; padding: 2px 5px; border-radius: 4px; background: color-mix(in srgb, var(--text) 12%, transparent); }
.tp-go { width: 100%; border: 0; border-radius: 6px; padding: 10px; background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.tp-go:hover { filter: brightness(1.06); }
.tp-keep { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 10px; font-size: 12px; color: var(--muted); cursor: pointer; }
.tp-keep input:disabled + * , .tp-keep:has(input:disabled) { opacity: .6; }
.tp-more { color: var(--muted); }
.tp-more .ic { width: 16px; height: 16px; transform: rotate(-90deg); }
.tp-back { display: flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 12.5px; padding: 2px 4px 8px; cursor: pointer; }
.tp-back .ic { width: 15px; height: 15px; }
.tp-back:hover { color: var(--text); }
.tp-scroll { max-height: min(52vh, 420px); overflow-y: auto; }
.tp-group { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 10px 12px 4px; }
.tp-group:first-child { padding-top: 2px; }
[dir="rtl"] .tp-more .ic { transform: rotate(90deg); }
.tp-search { margin: 0 0 6px; }
.tp-none { padding: 10px 12px; font-size: 12.5px; }
/* coloured label chips inside notes (used by the film storyboard) */
.rich .tag { display: inline-block; font-size: 10.5px; font-weight: 600; line-height: 1; padding: 3px 6px; border-radius: 4px; background: var(--tg); color: #fff; margin: 4px 2px 0 0; }
.rich h3 { font-size: 1em; font-weight: 700; margin: 0 0 .35em; }
/* empty image box: click or drop a picture on it */
.img-empty { aspect-ratio: 3 / 2; background: #121315; color: #8b8e94; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; cursor: pointer; font-size: 12px; transition: color .12s; }
.img-empty .ic { width: 26px; height: 26px; }
.img-empty:hover { color: #d6d8dc; }
.img-empty.fill-target { color: #fff; box-shadow: inset 0 0 0 3px var(--focus); background: color-mix(in srgb, var(--focus) 18%, #121315); }
/* image in a fixed frame (16:9 …): cropped to fill, picture can be moved inside */
.img-frame { position: relative; overflow: hidden; background: #121315; }
.img-frame .img { width: 100%; height: 100%; object-fit: cover; min-height: 0; }
.img-frame.repos { cursor: grab; box-shadow: inset 0 0 0 2px var(--focus); }
.img-frame.repos .img { outline: 2px solid var(--focus); outline-offset: -2px; }
.repos-hint { position: absolute; left: 8px; right: 8px; bottom: 8px; display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 9px; border-radius: 7px; background: rgba(0, 0, 0, .68); color: #fff; font-size: 11.5px; }
.repos-hint .ic { width: 15px; height: 15px; flex: none; }
.repos-z { border: 0; background: rgba(255, 255, 255, .14); color: #fff; width: 22px; height: 22px; border-radius: 5px; font-size: 15px; line-height: 1; cursor: pointer; flex: none; }
.repos-z:hover { background: rgba(255, 255, 255, .26); }
.repos-range { flex: 1; min-width: 40px; accent-color: #fff; cursor: pointer; }
.repos-done { border: 0; border-radius: 5px; padding: 4px 10px; background: #fff; color: #111; font: inherit; font-weight: 600; cursor: pointer; }

/* sign-in screen */
#auth { position: fixed; inset: 0; z-index: 900; background: var(--bg); display: grid; place-items: center; padding: 16px; }
.auth-box { width: min(360px, 100%); background: var(--chrome); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 28px 24px 18px; display: grid; gap: 12px; text-align: center; }
.auth-logo { width: 44px; height: 44px; margin: 0 auto; border-radius: 50%; background: var(--text); color: var(--chrome); display: grid; place-items: center; font: 700 20px var(--font); }
.auth-box h1 { margin: 0; font: 600 20px var(--font); }
.auth-box p { margin: 0; color: var(--muted); font-size: 13px; }
.auth-box input { font: inherit; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: var(--text); text-align: left; direction: ltr; }
.auth-box input:focus { outline: 2px solid var(--focus); outline-offset: -1px; }
.auth-box button[type=submit] { font: 600 14px var(--font); padding: 10px; border: 0; border-radius: 8px; background: var(--text); color: var(--chrome); cursor: pointer; }
.auth-box button[type=submit]:disabled { opacity: .6; cursor: default; }
.auth-box .auth-sent { color: var(--text); font-size: 14px; }
.auth-box .auth-err { color: var(--danger); }
.auth-alt, .auth-lang { font: 13px var(--font); border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px; }
.auth-alt:hover, .auth-lang:hover { color: var(--text); }
