:root { --ink: #18181B; --text: #3F3F46; --muted: #71717A; --line: #E4E4E7; --bg: #F4F4F5; --panel: #fff; --acc: #6D5BF6; --acc-l: #EEEBFF; --sel: #2563EB; --mono: "JetBrains Mono", ui-monospace, monospace; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; font: 13px/1.45 "Inter", system-ui, sans-serif; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; overflow: hidden; display: flex; flex-direction: column; }
.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); }
.skip { position: absolute; left: 12px; top: -60px; z-index: 300; padding: 10px 14px; background: var(--ink); color: #fff; border-radius: 8px; }
.skip:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.btn, .btn-o { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 8px; font: 600 13px "Inter", sans-serif; cursor: pointer; white-space: nowrap; }
.btn { background: var(--acc); color: #fff; border: 1px solid var(--acc); }
.btn:hover { background: #5B48E8; }
.btn-o { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-o:hover { border-color: var(--acc); }
.sm { min-height: 32px; padding: 0 10px; font-size: 12px; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 8px; background: none; color: var(--text); cursor: pointer; }
.icon-btn:hover { background: var(--bg); color: var(--ink); }
.icon-btn[aria-pressed="true"] { background: var(--acc-l); color: var(--acc); }

.top { display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 12px; background: var(--ink); color: #E4E4E7; flex: none; }
.logo { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 700; font-size: 14px; }
.lm { width: 22px; height: 22px; border-radius: 6px; background: conic-gradient(from 45deg, #F97316, #6D5BF6, #22C55E, #F97316); }
.title input { width: min(260px, 32vw); height: 34px; padding: 0 10px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #fff; font: 600 14px "Inter", sans-serif; }
.title input:hover { border-color: #3F3F46; } .title input:focus { outline: none; border-color: var(--acc); background: #27272A; }
.presence { display: flex; align-items: center; margin-left: auto; }
.presence .pav { display: grid; place-items: center; width: 30px; height: 30px; margin-left: -6px; border-radius: 50%; border: 2px solid var(--ink); color: #fff; font-weight: 700; font-size: 12px; position: relative; }
.presence .pav.me { box-shadow: 0 0 0 2px #fff; }
.presence .count { margin-left: 8px; font-size: 12px; color: #A1A1AA; }
.top .btn-o { background: #27272A; color: #fff; border-color: #3F3F46; }
.zoom { display: flex; align-items: center; gap: 2px; }
.zoom .icon-btn { color: #E4E4E7; } .zoom .icon-btn:hover { background: #27272A; color: #fff; }
.zv { min-width: 56px; height: 34px; border: 0; border-radius: 8px; background: none; color: #E4E4E7; font: 500 12px var(--mono); cursor: pointer; }
.zv:hover { background: #27272A; }

.app { flex: 1; display: grid; grid-template-columns: 52px minmax(0, 1fr) 292px; min-height: 0; }
.tools { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0; background: var(--panel); border-right: 1px solid var(--line); }
.tools button { display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 10px; background: none; color: var(--text); cursor: pointer; }
.tools button:hover { background: var(--bg); }
.tools button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.tools button:disabled { opacity: .35; cursor: default; }
.tools .sep { width: 24px; height: 1px; background: var(--line); margin: 6px 0; }
.stage { position: relative; overflow: hidden; outline: none; touch-action: none; background: #FAFAFA; }
.stage:focus-visible { box-shadow: inset 0 0 0 2px var(--acc); }
.world { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none; }
.stage.t-hand, .stage.panning { cursor: grab; } .stage.dragging-pan { cursor: grabbing; }
.stage.t-rect, .stage.t-ellipse, .stage.t-line, .stage.t-text { cursor: crosshair; }
.shape { cursor: default; }
.shape.lockedby { cursor: not-allowed; }
.hint { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); margin: 0; padding: 6px 12px; border-radius: 999px; background: rgba(24, 24, 27, .82); color: #fff; font-size: 12px; pointer-events: none; max-width: calc(100% - 24px); text-align: center; }
.cursors { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.cur { position: absolute; left: 0; top: 0; transition: transform .08s linear; }
.cur svg { width: 18px; height: 18px; display: block; }
.cur span { position: absolute; left: 14px; top: 16px; padding: 2px 7px; border-radius: 6px; color: #fff; font-size: 11px; font-weight: 600; white-space: nowrap; }

.side { display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--line); min-height: 0; }
.ptabs { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); flex: none; }
.ptabs button { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 48px; padding: 6px 0; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font: 600 11px "Inter", sans-serif; cursor: pointer; }
.ptabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--acc); }
.panel { flex: 1; overflow-y: auto; padding: 14px; }
.panel h3 { margin: 0 0 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.panel section + section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fld { display: grid; grid-template-columns: 22px 1fr; align-items: center; gap: 4px; height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: #FAFAFA; }
.fld span { color: var(--muted); font-size: 11px; font-weight: 600; }
.fld input { width: 100%; min-width: 0; border: 0; background: transparent; font: 500 12px var(--mono); color: var(--ink); }
.fld input:focus { outline: none; }
.fld:focus-within { border-color: var(--acc); background: #fff; }
.colr { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; }
.colr input[type=color] { width: 22px; height: 22px; padding: 0; border: 0; background: none; cursor: pointer; }
.colr input[type=text] { flex: 1; min-width: 0; border: 0; font: 500 12px var(--mono); color: var(--ink); }
.colr input[type=text]:focus { outline: none; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.swatches button { width: 22px; height: 22px; border-radius: 6px; border: 1px solid rgba(0, 0, 0, .1); cursor: pointer; padding: 0; }
textarea.txt { width: 100%; min-height: 64px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; font: 13px "Inter", sans-serif; resize: vertical; }
textarea.txt:focus { outline: none; border-color: var(--acc); }
.row { display: flex; gap: 4px; flex-wrap: wrap; }
.empty-p { color: var(--muted); }
.kbd { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; font-size: 12px; }
.kbd kbd { font: 500 11px var(--mono); padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: #FAFAFA; color: var(--ink); justify-self: start; }
.layers { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.layers li { display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 6px; padding: 0 4px 0 8px; border-radius: 8px; cursor: pointer; min-height: 34px; }
.layers li:hover { background: var(--bg); }
.layers li.sel { background: var(--acc-l); }
.layers li .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.layers li .icon-btn { width: 28px; height: 28px; }
.layers li .by { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 4px; color: #fff; }
.ai-log { display: grid; gap: 10px; margin-top: 12px; }
.ai-msg { padding: 10px; border-radius: 10px; background: var(--bg); font-size: 12px; }
.ai-msg.user { background: var(--ink); color: #fff; }
.ai-msg pre { margin: 8px 0 0; padding: 8px; border-radius: 8px; background: #18181B; color: #D4D4D8; font: 11px/1.5 var(--mono); overflow-x: auto; max-height: 180px; }
.ai-form { display: flex; gap: 6px; }
.ai-form input { flex: 1; min-width: 0; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; font: 13px "Inter", sans-serif; }
.ai-form input:focus { outline: none; border-color: var(--acc); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chips button { min-height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font: 500 12px "Inter", sans-serif; color: var(--text); cursor: pointer; }
.chips button:hover { border-color: var(--acc); color: var(--acc); }
.hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.hist li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.hist small { display: block; color: var(--muted); }
.toasts { position: fixed; left: 50%; bottom: 60px; transform: translateX(-50%); z-index: 300; display: grid; gap: 6px; }
.toast { padding: 8px 14px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 13px; box-shadow: 0 10px 24px rgba(0, 0, 0, .25); animation: tin .2s ease; }
@keyframes tin { from { opacity: 0; transform: translateY(6px); } }

@media (max-width: 900px) {
  .app { grid-template-columns: 52px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 44vh; }
  .side { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 600px) {
  .hide-s { display: none; }
  .top { gap: 4px; padding: 0 8px; }
  .title input { width: 30vw; }
  .presence .count { display: none; }
  .presence .pav { width: 28px; height: 28px; }
  .zoom [data-fit] { display: none; }
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) 42vh; }
  .tools { flex-direction: row; justify-content: center; flex-wrap: nowrap; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 4px 6px; }
  .tools button { width: 44px; height: 44px; flex: none; }
  .tools .sep { width: 1px; height: 24px; margin: 0 4px; }
  .icon-btn, .zv { width: 44px; height: 44px; }
  .ptabs button { min-height: 48px; }
  .btn, .btn-o, .sm { min-height: 44px; }
  .fld, .colr { height: 44px; }
  .layers li { min-height: 44px; }
  .layers li .icon-btn { width: 44px; height: 44px; }
  .chips button { min-height: 40px; }
  .ai-form input { height: 44px; }
  .swatches button { width: 32px; height: 32px; }
  .hint { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
