:root {
  --bg: #0f1115;
  --surface: #161a22;
  --surface-2: #1d2330;
  --border: #2a3342;
  --text: #e6e9ef;
  --muted: #8a93a3;
  --accent: #6366f1;
  --accent-2: #818cf8;
  --danger: #ef4444;
  --ok: #22c55e;
  --warn: #f59e0b;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; min-height: 100vh; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; }
p { line-height: 1.5; }
.muted { color: var(--muted); }
.btn { display: inline-block; padding: .5em 1em; border: 1px solid var(--border); border-radius: 6px; color: var(--text); background: var(--surface-2); cursor: pointer; font-size: 14px; }
.btn:hover { background: var(--surface); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.small { padding: .35em .7em; font-size: 12px; }
.btn.big { padding: .8em 1.4em; font-size: 16px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
input, textarea, select { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: .55em .7em; font-size: 14px; font-family: inherit; }
input:focus, textarea:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.landing { max-width: 960px; margin: 0 auto; padding: 4rem 1.5rem; }
.landing header { display: flex; gap: .5rem; justify-content: flex-end; }
.landing .hero { padding: 4rem 0; text-align: center; }
.landing .hero h1 { font-size: clamp(2rem, 5vw, 3.5rem); margin-bottom: 1rem; }
.landing .hero p { font-size: 1.15rem; color: var(--muted); max-width: 600px; margin: 0 auto 2rem; }
.landing .features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; margin-top: 4rem; }
.landing .features article { background: var(--surface); padding: 1.5rem; border-radius: 10px; border: 1px solid var(--border); }
.landing .features h3 { color: var(--accent-2); }
.auth { max-width: 380px; margin: 6rem auto; padding: 2rem; background: var(--surface); border-radius: 10px; border: 1px solid var(--border); }
.auth h1 { margin-bottom: 1.5rem; }
.auth form { display: flex; flex-direction: column; gap: .9rem; }
.auth label { display: flex; flex-direction: column; gap: .25rem; font-size: 13px; color: var(--muted); }
.auth .msg { min-height: 1.2em; font-size: 13px; margin: 0; }
.auth .msg.error { color: var(--danger); }
.auth .msg.ok { color: var(--ok); }
.dashboard { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }
.dashboard header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.dashboard header > div { display: flex; gap: 1rem; align-items: center; }
.dashboard .new-board { display: flex; gap: .5rem; margin-bottom: 2rem; }
.dashboard .new-board input { flex: 1; }
.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.board-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1.2rem; cursor: pointer; transition: border-color .15s, transform .15s; }
.board-card:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.board-card h3 { margin-bottom: .4rem; }
.board-card .meta { font-size: 12px; color: var(--muted); }
.board-card .actions { display: flex; gap: .5rem; margin-top: .8rem; flex-wrap: wrap; }
.board-card .actions button { font-size: 12px; padding: .25em .6em; }
.board-body { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.board-header { display: flex; align-items: center; gap: 1rem; padding: .6rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.board-header h1 { font-size: 16px; font-weight: 500; margin: 0; flex: 1; }
.status { font-size: 12px; padding: .25em .6em; border-radius: 4px; background: var(--surface-2); }
.status.connected { background: rgba(34, 197, 94, .15); color: var(--ok); }
.status.syncing { background: rgba(245, 158, 11, .15); color: var(--warn); }
.status.offline { background: rgba(239, 68, 68, .15); color: var(--danger); }
.toolbar { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: .35rem; padding: .5rem; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.35); z-index: 5; }
.toolbar hr { border: none; border-top: 1px solid var(--border); margin: .25rem 0; width: 100%; }
.tool { background: transparent; color: var(--text); border: 1px solid transparent; padding: .4em .6em; border-radius: 6px; cursor: pointer; font-size: 16px; min-width: 36px; }
.tool:hover { background: var(--surface-2); }
.tool.active { background: var(--accent); color: white; }
.tool.danger:hover { background: var(--danger); color: white; }
.tool.ai { font-size: 13px; }
#canvas-host { flex: 1; position: relative; overflow: hidden; background: #0a0c10; }
#canvas { position: absolute; inset: 0; overflow: hidden; cursor: grab; }
#canvas:focus { outline: none; }
#presence-layer { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.canvas-object { position: absolute; user-select: none; cursor: move; }
.canvas-object.selected { outline: 2px solid var(--accent); outline-offset: 2px; }
.canvas-object .object-body { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: .5rem .75rem; min-width: 80px; min-height: 30px; box-shadow: 0 4px 12px rgba(0,0,0,.4); color: var(--text); white-space: pre-wrap; word-break: break-word; }
.canvas-object[data-type="note"] .object-body { background: #fde68a; color: #1f2937; border-color: #fcd34d; }
.canvas-object[data-type="rect"] .object-body { background: transparent; border: 2px solid var(--accent); }
.canvas-object[data-type="ellipse"] .object-body { background: transparent; border: 2px solid var(--accent); border-radius: 50%; }
.canvas-object[data-type="text"] .object-body { background: transparent; border: none; box-shadow: none; }
.canvas-object[data-type="line"] { background: transparent; }
.canvas-object[data-type="group"] .object-body { background: rgba(99, 102, 241, .1); border: 2px dashed var(--accent); }
.connector { position: absolute; pointer-events: none; }
.presence-cursor { position: absolute; display: flex; align-items: center; gap: .25rem; font-size: 12px; padding: .15em .5em; border-radius: 4px; color: white; transform: translate(-2px, -2px); z-index: 6; }
.presence-cursor::before { content: ""; display: inline-block; width: 0; height: 0; border-left: 6px solid currentColor; border-top: 4px solid transparent; border-bottom: 4px solid transparent; }
.presence-cursor .name { background: rgba(0,0,0,.55); padding: .1em .4em; border-radius: 3px; }
.presence-selection { position: absolute; border: 2px solid; border-radius: 6px; pointer-events: none; }
.empty-state { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); pointer-events: none; text-align: center; padding: 1rem; }
#share-host { max-width: 800px; margin: 2rem auto; padding: 0 1.5rem; }
#share-host header { margin-bottom: 1.5rem; }
