:root {
  color-scheme: light;
  --page: #f5f6fa;
  --surface: #fff;
  --layer: #f3f2f8;
  --layer-strong: #eeedf6;
  --line: #e2e2ed;
  --ink: #25243b;
  --muted: #626278;
  --quiet: #848399;
  --primary: #5e50df;
  --primary-hover: #5144ce;
  --accent: #edeaff;
  --accent-ink: #4935c6;
  --danger: #ae3547;
  --good: #218069;
  --canvas: #fafafe;
  --grid: #dcdbee;
  --canvas-ink: #24233b;
  --shadow: 0 16px 52px #2f235712;
  --soft-shadow: 0 5px 18px #31255710, 0 1px 4px #3125570e;
  font: 16px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #161625;
  --surface: #1e1e31;
  --layer: #29283e;
  --layer-strong: #35334b;
  --line: #393850;
  --ink: #f1eefb;
  --muted: #b7b3cb;
  --quiet: #9894ad;
  --primary: #7668f2;
  --primary-hover: #695be3;
  --accent: #363055;
  --accent-ink: #c3b6ff;
  --danger: #ff9fae;
  --good: #70d8bb;
  --canvas: #191a2a;
  --grid: #38374e;
  --canvas-ink: #efebff;
  --shadow: 0 20px 56px #0a091f49;
  --soft-shadow: 0 6px 22px #0b0b1d52;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); }
button, input, textarea, select { font: inherit; color: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
a { color: var(--accent-ink); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
h1, h2, p { margin: 0; }
svg.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
svg.icon.sm { width: 17px; height: 17px; }
svg.icon.lg { width: 28px; height: 28px; }
.masthead {
  position: relative; z-index: 5; height: 70px; padding: 0 max(22px, calc((100vw - 1210px) / 2));
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  border-bottom: 1px solid var(--line); background: var(--surface);
}
.masthead.editor-head { height: 66px; padding: 0 22px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 22px; letter-spacing: -.06em; font-weight: 830; text-decoration: none; }
.brand img { width: 34px; height: 34px; }
.head-left, .head-right { min-width: 0; display: flex; align-items: center; gap: 12px; }
.head-right { flex-shrink: 0; }
.head-divider { width: 1px; height: 25px; background: var(--line); }
.head-title { font-size: 16px; font-weight: 720; color: var(--ink); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.head-title-button { display: flex; align-items: center; gap: 7px; min-width: 0; min-height: 36px; padding: 4px 7px; border: 0; border-radius: 8px; background: transparent; text-align: left; }
.head-title-button:hover { background: var(--layer); }
.head-title-button span { overflow: hidden; text-overflow: ellipsis; }
.head-title-button .icon { color: var(--muted); }
.avatar { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-size: 14px; font-weight: 800; border: 2px solid var(--surface); }
.account-name { font-size: 14px; font-weight: 650; max-width: 150px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.account-button { display: flex; align-items: center; gap: 7px; padding: 3px 8px 3px 3px; border: 0; border-radius: 10px; background: transparent; }
.account-button:hover { background: var(--layer); }
.account-button .icon { color: var(--muted); }
.icon-button {
  border: 0; display: inline-grid; place-items: center; min-width: 40px; min-height: 40px; padding: 8px;
  border-radius: 10px; color: var(--muted); background: transparent; flex-shrink: 0;
}
.icon-button:not(:disabled):hover { background: var(--layer); color: var(--ink); }
.icon-button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.button {
  min-height: 42px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 10px; font-weight: 690;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; text-decoration: none;
  font-size: 14px; line-height: 1.35; background: var(--surface); color: var(--ink);
}
.button:not(:disabled):hover { background: var(--layer); }
.button.primary { color: white; background: var(--primary); border-color: transparent; box-shadow: 0 3px 8px #6657ed29; }
.button.primary:not(:disabled):hover { background: var(--primary-hover); }
.button.danger { background: var(--danger); color: var(--surface); border-color: transparent; }
.button.danger:not(:disabled):hover { opacity: .86; }
.boot { padding: 38px; color: var(--muted); }
.auth-page {
  min-height: calc(100dvh - 70px); display: grid; grid-template-columns: minmax(290px, 408px) minmax(380px, 660px);
  align-items: center; justify-content: center; gap: clamp(34px, 5vw, 82px); padding: 45px clamp(24px, 5vw, 95px);
}
.auth-wrap { width: 100%; align-self: center; }
.auth-wrap h1 { font-size: clamp(2.35rem, 4vw, 3.3rem); line-height: 1.02; letter-spacing: -.062em; font-weight: 820; margin-bottom: 13px; }
.auth-wrap > p { color: var(--muted); max-width: 36ch; margin-bottom: 24px; }
.auth-card {
  padding: 23px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
}
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; background: var(--layer); border-radius: 10px; gap: 3px; margin-bottom: 19px; }
.auth-tabs button { border: 0; color: var(--muted); background: transparent; padding: 8px; border-radius: 7px; font-weight: 700; font-size: 14px; }
.auth-tabs button[aria-pressed="true"] { background: var(--surface); color: var(--accent-ink); box-shadow: 0 1px 6px #21154714; }
.stack { display: grid; gap: 13px; }
.field { display: grid; gap: 6px; font-size: 14px; font-weight: 690; }
.field input, .field textarea, .field select {
  border-radius: 9px; border: 1px solid var(--line); background: var(--surface); padding: 10px 11px; width: 100%; min-width: 0; font-size: 16px; font-weight: 470;
}
.field input::placeholder { color: var(--quiet); }
.field small { color: var(--muted); font-weight: 480; font-size: 13px; }
.auth-card .primary { width: 100%; margin-top: 2px; }
.form-status { font-size: 14px; color: var(--danger); margin: 0; }
.form-status:empty { display: none; }
.auth-preview {
  border-radius: 26px; padding: 28px; min-height: 480px; display: flex; flex-direction: column; justify-content: center;
  background: radial-gradient(ellipse at 73% 4%, #7b6df84f, transparent 60%), #2b2555; color: #f4efff; overflow: hidden;
  box-shadow: var(--shadow);
}
.demo { background: #1f1b3c; border: 1px solid #a59bf540; border-radius: 16px; overflow: hidden; box-shadow: 0 22px 50px #13102770; }
.demo-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; min-height: 51px; padding: 0 16px; border-bottom: 1px solid #a59bf530; color: #efe8ff; font-size: 14px; font-weight: 650; }
.demo-users { display: flex; }
.demo-users span { min-width: 25px; height: 25px; display: grid; place-items: center; margin-left: -4px; border: 2px solid #25203e; border-radius: 50%; color: #211d39; background: #cbb8ff; font-size: 11px; }
.demo-users span + span { background: #a7f4d9; }
#demo-canvas { width: 100%; display: block; aspect-ratio: 1.58; }
.dashboard { width: min(100% - 46px, 1130px); margin: 0 auto; padding: 51px 0 70px; }
.dashboard-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.dashboard h1 { font-size: clamp(2.2rem, 4vw, 3.45rem); font-weight: 820; line-height: 1.02; letter-spacing: -.067em; }
.dashboard-top p { color: var(--muted); margin-top: 10px; }
.board-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 255px), 1fr)); gap: 16px; }
.board-card {
  display: flex; align-items: flex-start; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--soft-shadow); min-height: 112px;
}
.board-card:hover { border-color: var(--primary); }
.board-card-link { display: flex; align-items: flex-start; gap: 14px; flex: 1; align-self: stretch; min-width: 0; padding: 17px; border-radius: inherit; color: inherit; text-decoration: none; }
.board-card:has([data-card-rename]) .board-card-link { padding-right: 2px; }
.board-card [data-card-rename] { margin: 11px 8px 0 1px; }
.board-card-mark, .empty-mark {
  display: grid; place-items: center; align-self: flex-start;
  flex: none; width: 43px; height: 43px; border-radius: 12px; color: var(--accent-ink); background: var(--accent);
}
.card-info { min-width: 0; flex: 1; }
.card-info h2 { font-size: 17px; line-height: 1.28; overflow-wrap: anywhere; margin: 2px 0 7px; }
.card-info p { font-size: 14px; color: var(--muted); }
.empty-state { display: grid; justify-items: center; text-align: center; background: var(--surface); border: 1px dashed var(--line); padding: 48px 24px; border-radius: 18px; gap: 9px; grid-column: 1 / -1; }
.empty-mark { width: 54px; height: 54px; border-radius: 15px; margin-bottom: 3px; }
.empty-state h2 { font-size: 21px; }
.empty-state p { color: var(--muted); max-width: 42ch; }
.empty-state .button { margin-top: 5px; }
.load-more { margin-top: 20px; }
.error-page { width: min(100% - 40px, 500px); margin: 52px auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.error-page p { margin-block: 10px 17px; color: var(--muted); }
.editor { position: fixed; inset: 66px 0 0; background: var(--canvas); overflow: hidden; overscroll-behavior: none; }
#board-canvas { display: block; width: 100%; height: 100%; touch-action: none; outline-offset: -3px; }
#board-canvas[data-tool="pen"], #board-canvas[data-tool="line"], #board-canvas[data-tool="arrow"], #board-canvas[data-tool="axes"], #board-canvas[data-tool="rect"], #board-canvas[data-tool="ellipse"] { cursor: crosshair; }
#board-canvas[data-tool="text"] { cursor: text; }
#board-canvas[data-tool="hand"] { cursor: grab; }
#board-canvas[data-tool="erase"] { cursor: cell; }
#board-canvas[data-tool="select"] { cursor: default; }
#board-canvas.dragging { cursor: grabbing; }
.dock {
  display: flex; align-items: center; gap: 2px; position: absolute; z-index: 2;
  white-space: nowrap; border-radius: 13px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--soft-shadow); padding: 5px;
}
.tools-dock { top: 16px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 24px); overflow-x: auto; scrollbar-width: thin; }
.dock .icon-button { min-width: 37px; min-height: 37px; border-radius: 8px; color: var(--ink); }
.dock .icon-button[aria-pressed="true"] { color: var(--accent-ink); }
.dock-separator { flex: none; width: 1px; height: 26px; background: var(--line); margin: 0 4px; }
.style-dock { top: 72px; left: 50%; transform: translateX(-50%); gap: 5px; padding-inline: 8px; }
.swatch { appearance: none; height: 27px; width: 27px; border: 2px solid var(--surface); border-radius: 50%; background: var(--swatch, var(--canvas-ink)); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--primary); }
.swatch-picker { appearance: none; border: 1px solid var(--line); padding: 2px; height: 28px; width: 29px; background: var(--surface); border-radius: 7px; }
.width-control { border: 0; border-radius: 7px; padding: 5px 7px; margin-left: 1px; background: var(--layer); font-size: 14px; }
.selection-dock { bottom: 68px; left: 50%; transform: translateX(-50%); gap: 3px; padding-left: 10px; }
.selection-count { font-size: 14px; font-weight: 650; margin-right: 5px; }
.zoom-dock { left: 16px; bottom: 15px; gap: 1px; }
.zoom-dock button[data-command="zoom-value"] { min-width: 55px; font-size: 14px; font-weight: 760; }
.history-dock { bottom: 15px; left: 50%; transform: translateX(-50%); }
.board-meta { display: flex; gap: 8px; align-items: center; position: absolute; right: 18px; bottom: 16px; z-index: 1; }
.save-state { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); min-height: 43px; padding: 6px 10px; border-radius: 10px; }
.save-state[data-status="saved"] svg { color: var(--good); }
.save-state[data-status="offline"], .save-state[data-status="storage"] { color: var(--danger); }
.live-avatars { display: flex; align-items: center; margin-inline: 4px; }
.live-avatars .avatar + .avatar { margin-left: -7px; }
.mobile-label { display: none; }
.text-draft {
  position: absolute; z-index: 2; min-width: 170px; width: min(310px, calc(100% - 24px)); min-height: 40px; padding: 4px 6px;
  border: 1px dashed var(--primary); border-radius: 5px; background: var(--surface); resize: both;
}
#dialog {
  width: min(100% - 28px, 490px); border: 1px solid var(--line); border-radius: 17px; padding: 21px;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
}
#dialog::backdrop { background: #1a152b73; backdrop-filter: blur(2px); }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.dialog-heading h2 { font-size: 1.35rem; letter-spacing: -.031em; }
.dialog-heading button { margin: -5px -5px -5px 0; }
.dialog-note { margin-bottom: 14px; color: var(--muted); }
.dialog-buttons { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 7px; }
.invitation-result { display: grid; gap: 9px; margin-top: 13px; }
.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-panel { position: absolute; z-index: 8; right: 0; margin-top: 8px; min-width: 192px; padding: 5px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.menu-panel button { border: 0; padding: 9px 11px; text-align: left; width: 100%; background: transparent; border-radius: 7px; display: flex; gap: 8px; align-items: center; font-size: 14px; }
.menu-panel button:hover { background: var(--layer); }
.menu-panel .danger-text { color: var(--danger); }
.shortcuts { margin: 0; display: grid; gap: 6px; }
.shortcuts div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
kbd { background: var(--layer); border: 1px solid var(--line); border-radius: 5px; padding: 2px 7px; font: inherit; font-size: 13px; white-space: nowrap; }
.toast { position: fixed; z-index: 10; max-width: min(92vw, 470px); left: 50%; transform: translateX(-50%); bottom: 79px; border-radius: 10px; background: var(--ink); color: var(--surface); box-shadow: var(--shadow); padding: 10px 15px; font-size: 14px; text-align: center; }
@media (min-width: 801px) and (max-height: 850px) {
  .auth-page { padding-block: 26px; }
  .auth-wrap h1 { margin-bottom: 9px; }
  .auth-wrap > p { margin-bottom: 17px; }
  .auth-card { padding: 18px; }
  .auth-card .auth-tabs { margin-bottom: 12px; }
  .auth-card .stack { gap: 9px; }
  .auth-card .field { gap: 4px; }
  .auth-card .field input, .auth-card .field select { padding-block: 8px; }
  .auth-preview { min-height: 420px; }
}
@media (max-width: 800px) {
  .auth-page { grid-template-columns: minmax(0, 410px); justify-content: center; padding: 32px 20px; min-height: auto; }
  .auth-preview { display: none; }
  .masthead, .masthead.editor-head { padding-inline: 13px; gap: 7px; }
  .masthead.editor-head { height: 57px; }
  .editor { inset-block-start: 57px; }
  .head-left, .head-right { gap: 5px; }
  .head-divider, .editor-head .brand span, .editor-head .desktop-label, .account-name { display: none; }
  .editor-head .mobile-label { display: inline; }
  .editor-head .brand img { width: 29px; height: 29px; }
  .editor-head .head-title { font-size: 14px; }
  .editor-head .icon-button { min-width: 34px; padding: 6px; }
  .editor-head .button { min-height: 37px; padding: 8px; }
  .editor-head .button .invite-label { display: none; }
  .editor-head .live-avatars { display: none; }
  .tools-dock { top: 10px; }
  .style-dock { top: 63px; }
  .zoom-dock { left: 8px; bottom: 8px; }
  .history-dock { left: auto; right: 8px; bottom: 8px; transform: none; }
  .board-meta { left: 8px; right: auto; bottom: 58px; }
  .save-state { min-height: 34px; padding: 4px 7px; font-size: 13px; }
  .selection-dock { bottom: 104px; }
}
@media (max-width: 380px) {
  .dock .icon-button { min-width: 33px; min-height: 35px; padding: 6px; }
  .dock-separator { margin: 0 2px; }
  .dashboard { width: calc(100% - 30px); padding-top: 33px; }
}
