/* noidea — minimal monochrome UI: hairline borders, black primary, blue only for selection, muted notes.
   Light only (no dark mode). */
:root {
  --bg: #fafafa;
  --canvas: #f7f7f7;
  --dot: #dcdcdc;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --surface-3: #ececee;
  --ink: #0a0a0a;
  --ink-2: #3f3f46;
  --muted: #8b8b93;
  --line: #e7e7ea;
  --line-strong: #d4d4d8;
  --primary: #0a0a0a;
  --primary-ink: #ffffff;
  --primary-hover: #27272a;
  --select: #2f6bff;
  --select-soft: rgba(47, 107, 255, .12);
  --danger: #dc2626;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04);
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 12px rgba(0, 0, 0, .05);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, .08), 0 2px 6px rgba(0, 0, 0, .04);
  --radius: 10px;
  --radius-sm: 8px;
  --note-ink: #1c1b19;
  --yellow: #fbf0c4;
  --pink: #f9dde1;
  --green: #d9efdf;
  --blue: #d9e7fa;
  --purple: #e7e0f8;
  --orange: #f9e2cc;
  --ink-ink: #0a0a0a;
  --ink-red: #dc2626;
  --ink-orange: #ea580c;
  --ink-green: #16a34a;
  --ink-blue: #2563eb;
  --ink-violet: #7c3aed;
  --font: "Inter var", Inter, "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); letter-spacing: -.011em; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
button, input, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--select); outline-offset: 2px; }

.ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ico.filled { fill: currentColor; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
  font-size: 13px; font-weight: 500; white-space: nowrap; text-decoration: none;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.icon { width: 32px; padding: 0; }
.btn.small { height: 28px; padding: 0 10px; font-size: 12px; }
.btn.big { height: 44px; font-size: 14px; font-weight: 600; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 7%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.btn:disabled { opacity: .45; cursor: default; }

/* full-screen + language controls (both pages) */
.prefs { display: flex; align-items: center; gap: 4px; }
.btn.present.on { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.present .ico { width: 17px; height: 17px; }
@media (max-width: 760px) { .btn.present .label { display: none; } .btn.present { width: 32px; padding: 0; } }
.lang { display: inline-flex; height: 28px; padding: 2px; border-radius: 7px; background: var(--surface-2); }
.lang button { border: 0; background: transparent; border-radius: 5px; padding: 0 8px; font-size: 11px; font-weight: 600; color: var(--muted); }
.lang button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; font-size: 15px; letter-spacing: -.03em; color: var(--ink); text-decoration: none; }
.logo img { width: 22px; height: 22px; }

.glass { background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }

/* ---------- home ---------- */
/* the page grows with its content and scrolls; the header keeps its height (it never shrinks in a short window) */
body.home { height: auto; min-height: 100%; display: flex; flex-direction: column; background: var(--bg); }
.home-head {
  position: sticky; top: 0; z-index: 10; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 60px; padding: 0 24px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.who { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 13px; }
.home main { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 9vh 20px 48px; overflow-x: clip; }
.hero { width: 100%; max-width: 440px; }
.eyebrow { display: inline-block; font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 14px; letter-spacing: 0; }
.eyebrow::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #22c55e; margin-right: 8px; vertical-align: 1px; }
.hero h1 { font-size: clamp(30px, 6vw, 40px); line-height: 1.1; letter-spacing: -.045em; font-weight: 700; margin: 0 0 12px; }
.hero h1 em { font-style: normal; color: var(--muted); }
.hero p { color: var(--ink-2); margin: 0 0 28px; font-size: 15px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.join { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 8px; padding: 20px; }
.join > * { min-width: 0; width: 100%; }
.join label { font-size: 12px; font-weight: 500; color: var(--ink-2); margin-top: 4px; }
.join input, .create input, dialog input {
  height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface);
  font-size: 14px; transition: border-color .12s, box-shadow .12s;
}
.join input:focus, .create input:focus, dialog input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 8%, transparent); }
.join .pin-input { height: 60px; font: 600 28px/1 var(--mono); letter-spacing: .28em; text-align: center; }
.join .btn.big { margin-top: 8px; }
.error { color: var(--danger); min-height: 18px; margin: 0; font-size: 13px; }
.join .error { margin: 0; }
.error:empty { min-height: 0; }
.demo { position: relative; height: 150px; margin: 44px 0 0; }
.demo .note { position: absolute; min-width: 0; min-height: 0; width: 128px; height: 104px; padding: 12px; font-size: 12px; line-height: 1.45; border-radius: 8px; cursor: default; }
.demo .n1 { left: 0; top: 14px; transform: rotate(-3deg); }
.demo .n2 { left: 26%; top: 30px; transform: rotate(2deg); }
.demo .n3 { left: 52%; top: 6px; transform: rotate(-1.5deg); }
.demo .n4 { left: 76%; top: 34px; transform: rotate(3deg); }
@media (max-width: 520px) { .home .demo { display: none; } .who .user-name { display: none; } .home-head { padding: 0 16px; } }
.home footer { flex: none; text-align: center; color: var(--muted); font-size: 12px; padding: 20px 16px 28px; max-width: 640px; margin: 0 auto; }

.dash { width: 100%; max-width: 760px; }
.dash-head { margin-bottom: 20px; }
.dash-head h1 { font-size: 24px; letter-spacing: -.04em; font-weight: 700; margin: 0 0 16px; }
.create { display: flex; gap: 8px; }
.create input { flex: 1; min-width: 0; }
.create .btn { height: 40px; padding: 0 16px; }
.empty { color: var(--muted); padding: 32px; text-align: center; border: 1px dashed var(--line-strong); border-radius: var(--radius); font-size: 13px; }
.boards { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.boards:empty { display: none; }
.board-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; transition: background .12s; }
.board-row + .board-row { border-top: 1px solid var(--line); }
.board-row:hover { background: var(--surface-2); }
.board-main { flex: 1; min-width: 0; display: grid; gap: 1px; color: var(--ink); text-decoration: none; }
.board-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 550; }
.board-main .meta { font-size: 12px; color: var(--muted); }
.board-tools { display: flex; align-items: center; gap: 6px; flex: none; }
@media (max-width: 560px) { .board-row { flex-direction: column; align-items: stretch; } .board-tools { justify-content: flex-end; } }

.pin-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
  font-size: 11px; font-weight: 600; letter-spacing: .04em; white-space: nowrap; transition: border-color .12s;
}
.pin-chip b { font: 600 13px/1 var(--mono); letter-spacing: .12em; color: var(--ink); }
.pin-chip:hover { border-color: var(--line-strong); }
.pin-chip.closed b { color: var(--muted); text-decoration: line-through; }

.role-badge {
  flex: none; height: 20px; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 600; line-height: 20px;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
}
.role-badge.host { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }

/* ---------- dialogs, banners, 404 ---------- */
dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); padding: 22px; width: min(360px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(0, 0, 0, .3); }
dialog h2 { margin: 0 0 4px; font-size: 16px; font-weight: 650; letter-spacing: -.02em; }
dialog p { margin: 0 0 14px; color: var(--ink-2); font-size: 13px; }
dialog input { width: 100%; }
dialog .row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
dialog.invite { width: min(560px, calc(100vw - 32px)); text-align: center; padding: 36px 28px 24px; }
dialog.invite .row { justify-content: center; margin-top: 22px; }
.invite-lead { font-size: 14px; }
.invite-url { font: 500 clamp(16px, 3.6vw, 22px)/1.3 var(--mono); color: var(--ink) !important; margin: 0 0 10px !important; word-break: break-all; }
.invite-pin { font: 700 clamp(48px, 13vw, 88px)/1.05 var(--mono); letter-spacing: .1em; margin: 0 !important; color: var(--ink) !important; }
.invite-state { color: var(--danger) !important; min-height: 18px; margin: 8px 0 0 !important; }

.banner {
  position: fixed; top: 72px; left: 50%; transform: translateX(-50%); z-index: 40; padding: 8px 14px; border-radius: var(--radius-sm);
  background: var(--primary); color: var(--primary-ink); font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px);
}
.missing { min-height: 100%; display: grid; place-items: center; text-align: center; padding: 16px; }
.missing h1 { font-size: 20px; margin: 16px 0 6px; letter-spacing: -.03em; }
.missing p { color: var(--ink-2); margin: 0 0 20px; }

/* ---------- board: chrome ---------- */
.board-page { overflow: hidden; overscroll-behavior: none; }
.topbar {
  position: fixed; top: 10px; left: 10px; right: 10px; z-index: 30; height: 48px; flex: none; display: flex; align-items: center; gap: 8px;
  padding: 0 8px 0 12px; border-radius: 12px;
}
.title-input {
  flex: 0 1 auto; field-sizing: content; max-width: 40vw; min-width: 40px; height: 30px; padding: 0 8px; border: 1px solid transparent; border-radius: 6px;
  background: transparent; font-weight: 600; font-size: 14px; letter-spacing: -.02em; text-overflow: ellipsis;
}
.title-input:not([readonly]):hover { background: var(--surface-2); }
.title-input:focus { outline: none; border-color: var(--line-strong); background: var(--surface); }
.title-input[readonly]:focus { border-color: transparent; background: transparent; }
.title-sep { width: 1px; height: 18px; background: var(--line); flex: none; }
.spacer { flex: 1; }
.peers { display: flex; align-items: center; padding-left: 6px; }
.peer {
  width: 26px; height: 26px; margin-left: -6px; border-radius: 50%; border: 2px solid var(--surface);
  display: grid; place-items: center; font-size: 11px; font-weight: 600; color: #fff;
}
.peer.host { box-shadow: 0 0 0 1.5px var(--ink); }
.peers .more { background: var(--muted); }
.actions { display: flex; gap: 6px; align-items: center; }
@media (max-width: 760px) {
  .actions .label, .logo span, .title-sep { display: none; }
  .actions .btn:not(.pin-chip) { width: 32px; padding: 0; }
  .topbar .pin-chip > span { display: none; }
  .peers .peer:nth-child(n+4) { display: none; }
  .title-input { max-width: none; flex: 0 1 auto; min-width: 0; }
}
@media (max-width: 560px) {
  .topbar { gap: 4px; padding: 0 6px 0 10px; }
  .topbar #export, .topbar .lang { display: none; }
  .peers .peer:nth-child(n+3) { display: none; }
}

.toolbar {
  position: fixed; left: 10px; top: 50%; transform: translateY(-50%); z-index: 30; display: flex; flex-direction: column;
  align-items: center; gap: 2px; padding: 5px; border-radius: 12px; max-height: calc(100vh - 90px); overflow-y: auto; scrollbar-width: none;
}
.tool {
  position: relative; width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 8px;
  background: transparent; color: var(--ink-2); transition: background .1s, color .1s; flex: none;
}
.tool:hover { background: var(--surface-2); color: var(--ink); }
.tool.on { background: var(--primary); color: var(--primary-ink); }
.tool .ico { width: 17px; height: 17px; }
.tool-sep { width: 18px; height: 1px; margin: 4px 0; background: var(--line); flex: none; }
.tool-swatch { width: 16px; height: 16px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.zoom-level { font: 500 10px/1 var(--mono); color: var(--muted); padding: 6px 0; border: 0; background: none; width: 34px; }
.zoom-level:hover { color: var(--ink); }
.flyout { position: fixed; z-index: 31; display: flex; gap: 4px; padding: 6px; border-radius: 10px; }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 0; padding: 0; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); transition: transform .1s; }
.swatch:hover { transform: scale(1.1); }
.swatch.on { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1), 0 0 0 2px var(--surface), 0 0 0 3.5px var(--ink); }
[data-color="yellow"] { --c: var(--yellow); } [data-color="pink"] { --c: var(--pink); } [data-color="green"] { --c: var(--green); }
[data-color="blue"] { --c: var(--blue); } [data-color="purple"] { --c: var(--purple); } [data-color="orange"] { --c: var(--orange); }
[data-ink="ink"] { --k: var(--ink-ink); } [data-ink="red"] { --k: var(--ink-red); } [data-ink="orange"] { --k: var(--ink-orange); }
[data-ink="green"] { --k: var(--ink-green); } [data-ink="blue"] { --k: var(--ink-blue); } [data-ink="violet"] { --k: var(--ink-violet); }
.swatch[data-color], .tool-swatch[data-color] { background: var(--c); }
.swatch[data-ink], .tool-swatch[data-ink] { background: var(--k); }
@media (max-width: 560px) {
  .toolbar { top: auto; bottom: 10px; left: 10px; right: 10px; transform: none; flex-direction: row; justify-content: center; overflow-x: auto; max-height: none; }
  .tool-sep { width: 1px; height: 18px; margin: 0 4px; }
  .zoom-level { display: none; }
}

.hint {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); color: var(--muted); text-align: center; pointer-events: none;
  padding: 0 24px; font-size: 13px; line-height: 1.7; max-width: 460px;
}
.hint b { color: var(--ink-2); font-weight: 600; }
.hint .big { display: block; font-size: 16px; font-weight: 600; color: var(--ink); letter-spacing: -.02em; margin-bottom: 4px; }

/* ---------- board: canvas ---------- */
.viewport {
  position: fixed; inset: 0; overflow: hidden; touch-action: none; background-color: var(--canvas);
  background-image: radial-gradient(var(--dot) 1px, transparent 1.1px);
}
.viewport[data-tool="hand"] { cursor: grab; }
.viewport.panning { cursor: grabbing; }
.viewport[data-tool="note"], .viewport[data-tool="rect"], .viewport[data-tool="ellipse"], .viewport[data-tool="line"], .viewport[data-tool="arrow"] { cursor: crosshair; }
.viewport[data-tool="text"] { cursor: text; }
.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.layer { position: absolute; left: 0; top: 0; }

/* shapes (host drawings) */
.shape { position: absolute; pointer-events: none; color: var(--k); }
.shape svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.shape .stroke { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.shape .head { fill: currentColor; }
.shape .hit { fill: none; stroke: transparent; stroke-width: 18; }
.shape .body { fill: transparent; }
.shape.text { padding: 2px 4px; font-weight: 600; letter-spacing: -.03em; line-height: 1.2; white-space: pre-wrap; word-break: break-word; color: var(--k); min-height: 1.4em; }
.shape.text.empty::before { content: attr(data-placeholder); opacity: .35; }
.shape textarea { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; outline: none; resize: none; padding: 2px 4px; overflow: hidden;
  background: transparent; color: inherit; font: inherit; line-height: inherit; letter-spacing: inherit; }
.editable .shape { pointer-events: auto; cursor: move; }
.editable .shape .body { pointer-events: all; }
.editable .shape.line, .editable .shape.arrow { pointer-events: none; }
.editable .shape.line .hit, .editable .shape.arrow .hit { pointer-events: stroke; cursor: move; }
.shape.selected:not(.line):not(.arrow) { outline: 1.5px solid var(--select); outline-offset: 4px; border-radius: 2px; }
.handle {
  position: absolute; width: 10px; height: 10px; border-radius: 2px; background: var(--surface); border: 1.5px solid var(--select);
  pointer-events: auto; z-index: 2; touch-action: none;
}
.handle.se { right: -10px; bottom: -10px; cursor: nwse-resize; }
.handle.pt { margin: -5px 0 0 -5px; cursor: crosshair; border-radius: 50%; }
.shape-menu { position: fixed; z-index: 32; display: flex; align-items: center; gap: 2px; padding: 5px; border-radius: 10px; }
.shape-menu .swatch { width: 18px; height: 18px; margin: 0 2px; }
.shape-menu .tool { width: 28px; height: 28px; border-radius: 6px; font: 600 11px/1 var(--mono); }
.shape-menu .tool-sep { width: 1px; height: 16px; margin: 0 4px; }

/* notes */
.note {
  position: absolute; display: flex; flex-direction: column; min-width: 200px; min-height: 120px; border-radius: 8px; color: var(--note-ink);
  background: var(--c, var(--yellow)); box-shadow: 0 0 0 1px rgba(0, 0, 0, .04), 0 1px 2px rgba(0, 0, 0, .06), 0 2px 6px rgba(0, 0, 0, .04);
  cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none; transition: box-shadow .15s;
}
.note:hover { box-shadow: 0 0 0 1px rgba(0, 0, 0, .06), 0 2px 4px rgba(0, 0, 0, .06), 0 8px 20px rgba(0, 0, 0, .07); }
.note.dragging { cursor: grabbing; box-shadow: 0 0 0 1px rgba(0, 0, 0, .06), 0 16px 36px rgba(0, 0, 0, .16); }
.note.fresh { animation: pop .18s ease-out; }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }
.note-head { display: flex; align-items: center; gap: 1px; height: 34px; padding: 0 4px 0 10px; font-size: 11px; font-weight: 500; color: rgba(28, 27, 25, .55); flex: none; }
.note-head .avatar { width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 9px; font-weight: 700; flex: none; }
.note-head .author { flex: 1; min-width: 0; margin: 0 4px 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-btn {
  height: 24px; min-width: 24px; padding: 0 4px; border: 0; border-radius: 6px; background: transparent; color: rgba(28, 27, 25, .5);
  display: inline-flex; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
  transition: background .1s, color .1s;
}
.note-btn:hover { background: rgba(0, 0, 0, .06); color: var(--note-ink); }
.note-btn .ico { width: 14px; height: 14px; }
.note-head .react { padding: 0 5px; }
.note-head .react.on.up { color: #1d4ed8; background: rgba(255, 255, 255, .6); }
.note-head .react.on.down { color: #b91c1c; background: rgba(255, 255, 255, .6); }
.note-head .n:empty { display: none; }
.note textarea {
  flex: 1; min-height: 0; width: 100%; margin-bottom: 18px; padding: 0 12px 2px; border: 0; resize: none; background: transparent; color: var(--note-ink);
  font-size: 14px; line-height: 1.5; letter-spacing: -.01em; outline: none; user-select: text; -webkit-user-select: text; touch-action: auto; cursor: text;
  scrollbar-width: thin; scrollbar-color: rgba(28, 27, 25, .2) transparent;
}
.note textarea::-webkit-scrollbar { width: 5px; }
.note textarea::-webkit-scrollbar-track { background: transparent; }
.note textarea::-webkit-scrollbar-thumb { background: rgba(28, 27, 25, .2); border-radius: 3px; }
.note textarea::placeholder { color: rgba(28, 27, 25, .32); }
.note .grip { position: absolute; right: 2px; bottom: 2px; width: 16px; height: 16px; cursor: nwse-resize; opacity: 0; touch-action: none; color: var(--note-ink); transition: opacity .12s; }
.note .grip svg { width: 100%; height: 100%; }
.note:hover .grip { opacity: .4; }
@media (hover: none) { .note .grip { opacity: .3; } }
.note .swatches { position: absolute; top: 34px; right: 6px; z-index: 3; display: flex; gap: 4px; padding: 6px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); }
.note .swatches .swatch { width: 18px; height: 18px; }
