:root {
  color-scheme: light;
  --paper: #fcfaf5;
  --canvas: #f0ede4;
  --white: #fffdf8;
  --ink: #292b22;
  --muted: #625e51;
  --quiet: #767061;
  --line: #e1dbcc;
  --olive: #424a32;
  --olive-light: #e5e9d8;
  --clay: #914e38;
  --shadow: 0 5px 16px #2c231511, 0 1px 3px #2c231516;
  --sans: system-ui, "Segoe UI", sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 14px; }
button, input, textarea { font: inherit; }
button { color: inherit; }
button, summary { cursor: pointer; }
button:disabled { opacity: .48; cursor: default; }
:focus-visible { outline: 2px solid #6b7655; outline-offset: 3px; }
button .icon, .icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2, h3, p { margin: 0; }
.masthead { height: 62px; display: flex; align-items: center; padding: 0 28px; gap: 16px; border-bottom: 1px solid var(--line); background: var(--white); position: relative; z-index: 3; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 750; letter-spacing: -.025em; white-space: nowrap; }
.brand-mark { width: 32px; height: 32px; display: grid; grid-template: 7px 7px / 8px 7px; gap: 2px; padding: 8px; border-radius: 9px; background: var(--olive); }
.brand-mark i { background: #e7d6b3; border-radius: 1px; }
.brand-mark i:first-child { grid-row: span 2; }
.brand-mark i:nth-child(2) { background: #ac795d; }
.brand-mark i:last-child { background: #bbc39b; }
.header-project { color: #99917f; display: flex; align-items: center; gap: 16px; }
.header-project span { color: var(--muted); font-weight: 600; }
.header-actions, .board-header-side, .account summary { display: flex; align-items: center; gap: 12px; }
.header-actions { margin-left: auto; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; border-radius: 8px; border: 1px solid transparent; background: transparent; padding: 0 12px; font-weight: 650; white-space: nowrap; }
.button .icon { width: 17px; height: 17px; }
.button-outline { border-color: var(--line); background: var(--white); }
.button-outline:hover, .icon-button:hover, .account summary:hover, .account-menu button:hover { background: #f0ebdf; }
.button-primary { color: #fffdf6; background: var(--olive); }
.button-primary:hover { background: #515c3c; }
.button-danger { color: #fffdf6; background: #8e4633; }
.button-danger:hover { background: #753b2b; }
.account { position: relative; }
.account summary { gap: 8px; list-style: none; padding: 4px 7px 4px 4px; border-radius: 8px; font-weight: 650; }
.account summary::-webkit-details-marker { display: none; }
.account summary::after { content: ""; height: 5px; width: 5px; border-bottom: 1px solid; border-right: 1px solid; transform: rotate(45deg); margin: 0 1px 3px; }
.account-menu { position: absolute; top: calc(100% + 8px); right: 0; padding: 5px; border: 1px solid var(--line); border-radius: 9px; background: var(--white); box-shadow: var(--shadow); }
.avatar { display: inline-grid; place-items: center; width: 27px; height: 27px; border-radius: 50%; font-size: 12px; font-weight: 750; flex: none; }
.avatar-pascal { background: #e4e9d7; color: #455036; }
.avatar-theresa { background: #f1e0d6; color: #8b4c39; }

.editor { height: calc(100dvh - 62px); display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
.board-header { display: flex; justify-content: space-between; align-items: center; padding: 21px 31px 20px; gap: 18px; border-bottom: 1px solid var(--line); }
.board-header h1, .auth h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(29px, 3.2vw, 45px); letter-spacing: -.048em; line-height: 1; }
.board-header p { color: var(--muted); display: flex; align-items: center; gap: 9px; margin-top: 9px; font-size: 12px; font-weight: 550; }
.meta-separator, .status-dot { height: 5px; width: 5px; border-radius: 50%; background: #a4a28e; }
#status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; background: #79865c; }
#status[data-status="working"] .status-dot { background: #b68b53; }
#status[data-status="error"] .status-dot { background: #af513b; }
.work-area { position: relative; display: flex; overflow: hidden; }
.viewport { position: relative; flex: 1; min-width: 0; height: 100%; isolation: isolate; overflow: hidden; touch-action: none; user-select: none; background-color: var(--canvas); background-image: radial-gradient(circle, #a397793f 1px, transparent 1.1px); outline: none; }
.viewport.panning { cursor: grabbing !important; }
.viewport[data-tool="pan"], .viewport.space-pan { cursor: grab; }
.viewport[data-tool="link"] { cursor: crosshair; }
.world { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.edges { position: absolute; top: 0; left: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
.edge-visible { stroke: #777d5d; stroke-width: 1.6; fill: none; }
.edge.active .edge-visible { stroke: #48583b; stroke-width: 3; }
.edge-hit { stroke: transparent; stroke-width: 16; fill: none; pointer-events: stroke; cursor: pointer; }
.edge-labels { z-index: 4; }
.edge-tag { cursor: pointer; pointer-events: auto; }
.edge-tag rect { fill: var(--white); stroke: #c9c5af; }
.edge-tag.active rect { fill: var(--olive-light); stroke: #6d7e55; }
.edge-label { text-anchor: middle; font-family: var(--sans); font-size: 11px; font-weight: 650; fill: #414530; }
.cards { position: absolute; top: 0; left: 0; }
.card { position: absolute; background: var(--white); border: 1px solid #fff9; box-shadow: var(--shadow); border-radius: 10px; display: flex; flex-direction: column; padding: 0; text-align: left; cursor: grab; touch-action: none; }
.card[data-type="note"] { background: #efe5d2; }
.card[data-type="color"] { background: var(--white); }
.card.selected, .card.link-source { outline: 2px solid #6d7e55; outline-offset: 2px; z-index: 2; }
.card.link-source { outline-style: dashed; }
.card.dragging { cursor: grabbing; z-index: 3; }
.viewport[data-tool="link"] .card { cursor: crosshair; }
.viewport[data-tool="pan"] .card, .viewport.space-pan .card { cursor: grab; }
.card-picture { position: relative; flex: 1; min-height: 12px; border-radius: 9px 9px 0 0; overflow: hidden; background: #d7cebb; }
.card-picture img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.card-note { flex: 1; min-height: 0; overflow: hidden; padding: 14px 14px 4px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.48; color: #494232; }
.card[data-type="note"] .card-heading { padding-top: 13px; padding-bottom: 0; }
.card[data-type="note"] .card-title { font-family: var(--serif); font-size: 20px; font-weight: 400; letter-spacing: -.02em; }
.card[data-type="note"] .card-note { padding-top: 7px; }
.card-heading { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 9px 10px 8px; }
.card-title { min-width: 0; font-size: 13px; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-description { display: block; font-size: 10px; font-weight: 550; margin-top: 1px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.caption { flex: 1; min-width: 0; }
.card-score { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); white-space: nowrap; flex: none; font-size: 10px; font-weight: 650; }
.card-score:empty { display: none; }
.card-score span { padding: 1px 3px; border-radius: 3px; background: #ece5d7; }
.card-score span[data-person="pascal"] { background: #e5e9d8; }
.card-score span[data-person="theresa"] { background: #f4e2d9; }
.resize-grip { position: absolute; right: -5px; bottom: -5px; width: 16px; height: 16px; border: 1px solid #6e7c55; background: #fffdf7; border-radius: 4px; cursor: nwse-resize; }
.resize-grip::after { content: ""; display: block; width: 7px; height: 7px; margin: 3px; border-right: 1px solid #6e7c55; border-bottom: 1px solid #6e7c55; border-radius: 1px; }
.card:not(.selected) .resize-grip { display: none; }

.tool-tray, .zoom-tray { position: absolute; display: flex; align-items: center; z-index: 4; background: var(--white); border: 1px solid #e6dfd0; box-shadow: var(--shadow); border-radius: 11px; gap: 3px; padding: 4px; }
.tool-tray { top: 17px; left: 17px; }
.zoom-tray { left: 17px; bottom: 17px; }
.toolbar-separator { height: 21px; width: 1px; margin: 0 3px; background: var(--line); }
.tool-tray button, .zoom-tray button, .icon-button { display: grid; place-items: center; padding: 0; border: 0; background: transparent; border-radius: 6px; height: 36px; width: 36px; }
.tool-tray button:hover, .zoom-tray button:hover { background: #f2ecdf; }
.tool-tray button[aria-pressed="true"] { background: var(--olive-light); color: #39432c; }
#zoom-readout { width: 52px; font-size: 12px; font-weight: 700; }
.canvas-hint { position: absolute; z-index: 4; top: 19px; right: 16px; background: #fdfaf0; padding: 9px 12px; max-width: 250px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font-size: 12px; box-shadow: var(--shadow); }
.empty-board, .drop-veil { display: grid; justify-items: center; place-content: center; text-align: center; position: absolute; inset: 0; }
.empty-board { pointer-events: none; padding: 18px; gap: 9px; }
.empty-board .button { pointer-events: auto; margin-top: 6px; }
.empty-board h2, .dialog-heading h2, dialog h2 { font-family: var(--serif); font-weight: 400; font-size: 27px; letter-spacing: -.032em; }
.empty-board p { color: var(--muted); }
.empty-icon { width: 45px; height: 45px; background: #e4e6d6; border-radius: 12px; display: grid; place-items: center; color: var(--olive); }
.empty-icon .icon { height: 23px; width: 23px; }
.drop-veil { inset: 11px; border: 2px dashed #697857; background: #ebeddded; border-radius: 12px; z-index: 5; pointer-events: none; }
.drop-veil div { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 750; color: var(--olive); }

.inspector { width: 292px; flex: 0 0 292px; height: 100%; border-left: 1px solid var(--line); background: var(--paper); display: flex; flex-direction: column; }
.inspector-top { display: flex; align-items: center; justify-content: space-between; min-height: 57px; padding: 0 16px 0 20px; border-bottom: 1px solid var(--line); }
.inspector-top h2 { font-size: 15px; font-weight: 740; }
.inspector-content { min-height: 0; overflow: auto; overscroll-behavior: contain; }
.inspector-placeholder { padding: 25px 20px; color: var(--muted); line-height: 1.6; }
.detail-section { padding: 17px 19px; border-bottom: 1px solid var(--line); }
.detail-section h3 { font-size: 13px; font-weight: 760; margin: 0 0 12px; display: flex; gap: 7px; align-items: center; }
.detail-section h3 .icon { width: 16px; height: 16px; }
.field-label { font-weight: 690; margin-bottom: 12px; font-size: 12px; display: flex; flex-direction: column; gap: 6px; }
.field-label:last-child { margin-bottom: 0; }
input:not([type="radio"]), textarea { width: 100%; min-height: 38px; padding: 8px 10px; background: #fffdf8; border: 1px solid #ded7c7; border-radius: 7px; color: var(--ink); }
textarea { min-height: 76px; resize: vertical; line-height: 1.45; }
input[type="color"] { padding: 4px; }
.rater { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 9px 0; }
.rater-name { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 650; }
.rater .avatar { width: 24px; height: 24px; font-size: 11px; }
.rater-value { color: var(--muted); font-weight: 700; font-size: 12px; }
.rating-tool { display: flex; gap: 4px; width: 100%; margin-top: 13px; }
.rating-button { flex: 1; min-width: 0; min-height: 32px; padding: 0; border: 1px solid #ddd6c5; border-radius: 6px; background: var(--white); font-size: 12px; font-weight: 730; }
.rating-button:hover { background: #ebe9d8; }
.rating-button[aria-pressed="true"] { background: var(--olive); border-color: var(--olive); color: #fffdf6; }
.rating-button[data-value="-2"], .rating-button[data-value="-1"] { border-color: #e9d4c9; }
.rating-button[data-value="-2"][aria-pressed="true"], .rating-button[data-value="-1"][aria-pressed="true"] { background: #8d503c; border-color: #8d503c; }
.hint-label { color: var(--muted); font-size: 11px; line-height: 1.4; margin-top: 8px; }
.small-link { display: block; border: 0; background: none; color: var(--olive); text-decoration: underline; text-underline-offset: 2px; font-size: 11px; padding: 6px 0 0; }
.connection-list { display: flex; flex-direction: column; gap: 6px; }
.connection-list button { width: 100%; display: flex; align-items: center; gap: 7px; min-height: 34px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--white); text-align: left; overflow-wrap: anywhere; }
.connection-list button .icon { width: 15px; height: 15px; }
.detail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; padding: 14px 19px; }
.detail-actions .button { padding: 0 6px; font-size: 12px; }
.detail-actions .remove { color: #8d503c; margin-left: auto; }

.auth { min-height: calc(100dvh - 62px); display: grid; place-items: center; padding: 32px 16px; background-color: var(--canvas); background-image: radial-gradient(circle, #a397793f 1px, transparent 1.1px); background-size: 21px 21px; }
.login { width: min(100%, 410px); padding: 30px; border: 1px solid #ded8c9; border-radius: 13px; background: var(--white); box-shadow: var(--shadow); }
.login h1 { font-size: 35px; margin-bottom: 10px; }
.login p { color: var(--muted); line-height: 1.5; }
.login fieldset { display: flex; gap: 8px; padding: 0; border: 0; margin: 20px 0 13px; }
.login legend { margin-bottom: 7px; font-weight: 700; font-size: 12px; }
.login fieldset label { flex: 1; display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 8px; padding: 7px; font-weight: 650; cursor: pointer; }
.login fieldset label:has(input:checked) { background: #f1f0e5; border-color: #9caa85; }
.login input[type="radio"] { accent-color: var(--olive); margin: 0; }
.login button { width: 100%; }
.login .form-error { color: #8d3928; font-size: 12px; margin: 4px 0 11px; }
.login .form-error:empty { display: none; }
dialog { width: min(calc(100% - 32px), 445px); border: 1px solid var(--line); border-radius: 13px; padding: 22px; background: var(--white); color: var(--ink); box-shadow: 0 14px 45px #25251b40; }
dialog::backdrop { background: #28271d55; }
dialog p { color: var(--muted); margin: 12px 0 16px; line-height: 1.5; }
.dialog-heading, .dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-actions { justify-content: flex-end; }
.help-list dt { font-weight: 750; margin-top: 16px; }
.help-list dd { color: var(--muted); margin: 4px 0 0; line-height: 1.5; }
kbd { border: 1px solid var(--line); background: var(--paper); border-radius: 3px; padding: 0 3px; }
.toast { z-index: 7; position: fixed; bottom: 18px; right: 20px; border-radius: 8px; border: 1px solid #e2dace; background: var(--white); padding: 12px 17px; box-shadow: var(--shadow); max-width: min(390px, calc(100% - 40px)); color: var(--ink); }
.toast[data-error="true"] { border-color: #bc816c; }
@media (max-width: 840px) {
  .masthead { padding-inline: 16px; gap: 9px; }
  .header-project { gap: 9px; }
  .board-header { padding-inline: 17px; }
  .inspector { position: absolute; z-index: 6; right: 0; top: 0; width: min(84vw, 292px); box-shadow: -7px 0 18px #3a311c20; }
  .canvas-hint { top: 69px; left: 17px; right: auto; }
}
@media (max-width: 540px) {
  .masthead { height: 55px; }
  .editor { height: calc(100dvh - 55px); }
  .auth { min-height: calc(100dvh - 55px); }
  .header-project, #help-button, #status, .account-name { display: none; }
  .header-actions { gap: 5px; }
  .board-header { padding-block: 14px; }
  .board-header h1 { font-size: 27px; }
  .board-header-side .button { padding: 0 7px; min-height: 33px; font-size: 11px; gap: 4px; }
  .login { padding: 23px; }
  .login h1 { font-size: 30px; }
  .tool-tray { top: 11px; left: 11px; }
  .zoom-tray { left: 11px; bottom: 11px; }
}
