/* The shared canvas. Look borrowed from Excalidraw: white board, floating islands, Excalifont. */
@font-face{font-family:Excalifont;src:url(fonts/Excalifont-Latin.woff2) format("woff2");font-display:swap}

:root{
  --bg:#fff;--island:#fff;--text:#1b1b1f;--muted:#5c5c66;--line:#e8e8ee;
  --primary:#6965db;--primary-dark:#5b57d1;--primary-light:#e0dfff;--hover:#f1f0ff;
  --shadow:0 0 .93px rgba(0,0,0,.17),0 0 3.13px rgba(0,0,0,.08),0 7px 14px rgba(0,0,0,.05);
  --r:8px;--ui:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;--hand:Excalifont,"Comic Sans MS",cursive;
  color-scheme:light;
}
.dark{
  --bg:#121212;--island:#232329;--text:#e3e3e8;--muted:#a3a3ad;--line:#3a3a44;
  --primary:#a8a5ff;--primary-dark:#bbb8ff;--primary-light:#403e6a;--hover:#2e2d39;
  --shadow:0 0 1px rgba(0,0,0,.6),0 7px 14px rgba(0,0,0,.35);
  color-scheme:dark;
}
*{box-sizing:border-box}
[hidden]{display:none!important}
html,body{margin:0;height:100%;overflow:hidden;background:var(--bg);color:var(--text);font:14px/1.4 var(--ui);overscroll-behavior:none}
body{touch-action:none}
button,input{font:inherit;color:inherit}
.sprite{display:none}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round;flex:none}
:focus-visible{outline:2px solid var(--primary);outline-offset:2px}
kbd{font:12px var(--ui);padding:1px 6px;border-radius:4px;background:var(--hover);border:1px solid var(--line);white-space:nowrap}

/* Canvas */
.stage{position:fixed;inset:0;overflow:hidden;background:var(--bg);outline:none}
.stage:focus-visible{box-shadow:inset 0 0 0 2px var(--primary)}
.world{position:absolute;left:0;top:0;transform-origin:0 0;--z:1}
.dark .world{filter:invert(93%) hue-rotate(180deg)}
.dark .item-image img{filter:invert(100%) hue-rotate(180deg)}
.tool-hand,.panning{cursor:grab}.panning{cursor:grabbing!important}
.tool-draw{cursor:crosshair}.tool-text{cursor:text}
.tool-eraser{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Ccircle cx='10' cy='10' r='7' fill='white' stroke='black' stroke-width='1.5'/%3E%3C/svg%3E") 10 10,cell}

.item{position:absolute;left:0;top:0;transform-origin:0 0;user-select:none;-webkit-user-select:none}
.item-text{font-family:var(--hand);line-height:1.25;white-space:pre;width:auto!important;height:auto!important}
.item-image img{display:block;width:100%;height:100%;pointer-events:none}
.item svg{display:block;width:100%;height:100%;overflow:visible;stroke:none}
.tool-select .item.mine{cursor:move}
/* Strokes are hit only on the ink, not their whole box */
.item-draw{pointer-events:none}.item-draw path{pointer-events:visiblePainted}
.tool-draw .item,.tool-draw .item *,.tool-hand .item,.tool-hand .item *,.tool-text .item:not(.item-text),.tool-text .item:not(.item-text) *{pointer-events:none}
.live-text{pointer-events:none;opacity:.85}
.live-text::after{content:"";display:inline-block;width:2px;height:1.1em;margin-left:1px;vertical-align:text-bottom;background:var(--caret,#6965db);animation:blink 1s steps(1) infinite}
@keyframes blink{50%{opacity:0}}
.live-stroke{position:absolute;left:0;top:0;width:1px;height:1px;overflow:visible;stroke:none;pointer-events:none}

/* Selection box with corner handles, kept the same size on screen at any zoom */
.sel{position:absolute;left:0;top:0;pointer-events:none;border:calc(1px / var(--z)) solid var(--primary)}
.dark .sel{border-color:#6965db}
.sel i{position:absolute;width:calc(10px / var(--z));height:calc(10px / var(--z));background:#fff;border:calc(1px / var(--z)) solid #6965db;border-radius:calc(2px / var(--z));pointer-events:auto}
.sel i[data-h=nw]{left:0;top:0;transform:translate(-50%,-50%);cursor:nwse-resize}
.sel i[data-h=ne]{right:0;top:0;transform:translate(50%,-50%);cursor:nesw-resize}
.sel i[data-h=sw]{left:0;bottom:0;transform:translate(-50%,50%);cursor:nesw-resize}
.sel i[data-h=se]{right:0;bottom:0;transform:translate(50%,50%);cursor:nwse-resize}
@media(pointer:coarse){.sel i{width:calc(18px / var(--z));height:calc(18px / var(--z))}}

.editor{position:absolute;left:0;top:0;transform-origin:0 0;margin:0;padding:0;border:0;outline:none;resize:none;overflow:hidden;
  background:transparent;font-family:var(--hand);line-height:1.25;white-space:pre;caret-color:var(--primary);min-width:1ch}

/* Other people's cursors */
.cursors{position:absolute;inset:0;pointer-events:none;overflow:hidden}
.cursor{position:absolute;left:0;top:0;will-change:transform;transition:opacity .3s}
.cursor svg{width:20px;height:20px;stroke:#fff;stroke-width:1.5;fill:var(--c);filter:drop-shadow(0 1px 1px rgba(0,0,0,.25))}
.cursor span{position:absolute;left:16px;top:18px;padding:2px 7px;border-radius:6px;background:var(--c);color:#fff;font-size:12px;white-space:nowrap;font-weight:600}
.cursor.idle{opacity:.35}

/* Floating chrome */
.layer{position:fixed;z-index:10;display:flex;gap:8px;pointer-events:none}
.layer>*{pointer-events:auto}
.top-left{left:16px;top:16px;flex-direction:column;align-items:flex-start;z-index:11}
.top-center{left:50%;top:16px;transform:translateX(-50%)}
.top-right{right:16px;top:16px;align-items:center}
.bottom-left{left:16px;bottom:16px;flex-direction:column;align-items:flex-start}
.minimap{display:block;width:200px;height:140px;cursor:pointer;touch-action:none}
.row{display:flex;gap:8px}
.zoom-val{min-width:56px;height:36px;border:0;background:transparent;cursor:pointer;font-variant-numeric:tabular-nums;border-radius:var(--r)}
.zoom-val:hover{background:var(--hover)}
.dark .minimap{filter:invert(93%) hue-rotate(180deg)}
.bottom-center{left:50%;bottom:16px;transform:translateX(-50%);flex-direction:column;align-items:center}
.island{background:var(--island);border-radius:var(--r);box-shadow:var(--shadow);border:0}

.icon-btn{position:relative;display:inline-grid;place-items:center;width:36px;height:36px;padding:0;border:0;border-radius:var(--r);background:transparent;color:var(--text);cursor:pointer}
.icon-btn:hover:not(:disabled){background:var(--hover)}
.icon-btn:disabled{opacity:.35;cursor:default}
.icon-btn[aria-pressed=true]{background:var(--primary-light);color:var(--text)}
.island.icon-btn{background:var(--island)}
.island.icon-btn:hover{background:var(--hover)}
.key{position:absolute;right:3px;bottom:1px;font-size:9px;line-height:1;color:var(--muted)}

.toolbar{display:flex;gap:2px;padding:4px}
.group{display:flex;align-items:center;padding:0}

/* Tooltips from data-tip */
[data-tip]:hover::after,[data-tip]:focus-visible::after{content:attr(data-tip);position:absolute;top:calc(100% + 8px);left:50%;transform:translateX(-50%);z-index:30;
  padding:5px 8px;border-radius:6px;background:#1b1b1f;color:#fff;font-size:12px;white-space:nowrap;pointer-events:none}
.bottom-left [data-tip]:hover::after,.bottom-left [data-tip]:focus-visible::after{top:auto;bottom:calc(100% + 8px)}
.top-left>[data-tip]:hover::after,.top-left [data-tip]:focus-visible::after{left:0;transform:none}
.top-right [data-tip]:hover::after,.top-right [data-tip]:focus-visible::after{left:auto;right:0;transform:none}

/* Menu */
.menu{display:flex;flex-direction:column;width:270px;padding:8px}
.menu-item span{white-space:nowrap}
[aria-expanded=true]::after{display:none!important}
.menu-item{display:flex;align-items:center;gap:10px;width:100%;height:36px;padding:0 10px;border:0;border-radius:6px;background:none;color:var(--text);text-decoration:none;cursor:pointer;text-align:left}
.menu-item:hover,.menu-item:focus-visible{background:var(--hover)}
.menu-item kbd{margin-left:auto}
.menu hr{width:100%;border:0;border-top:1px solid var(--line);margin:6px 0}
.menu-name{display:flex;align-items:center;gap:10px;padding:0 10px;color:var(--muted)}
.menu-name input{flex:1;min-width:0;height:32px;padding:0 8px;border:1px solid var(--line);border-radius:6px;background:var(--bg)}
.menu-name input:focus{outline:none;border-color:var(--primary)}

/* Properties panel */
.props{width:202px;padding:12px}
.props h2{margin:0 0 6px;font-size:12px;font-weight:400;color:var(--muted)}
.props>div{margin-bottom:12px}.props>div:last-child{margin-bottom:0}
.swatches,.seg{display:flex;flex-wrap:wrap;gap:4px}
.swatches{margin-bottom:12px}
.swatch{width:28px;height:28px;padding:0;border:0;border-radius:6px;background:var(--c);cursor:pointer;box-shadow:inset 0 0 0 1px rgba(0,0,0,.1)}
.swatch[aria-checked=true]{box-shadow:0 0 0 2px var(--island),0 0 0 3.5px var(--primary)}
.seg button{display:grid;place-items:center;min-width:36px;height:32px;padding:0 6px;border:0;border-radius:6px;background:var(--hover);cursor:pointer;font-size:13px}
.seg button[aria-checked=true]{background:var(--primary-light);box-shadow:inset 0 0 0 1px var(--primary)}
.seg svg{width:22px}

/* People here */
.avatars{display:flex;gap:0}
.avatar{display:grid;place-items:center;width:32px;height:32px;margin-left:-6px;padding:0;border:2px solid var(--bg);border-radius:50%;background:var(--c);color:#fff;font-weight:700;font-size:11px;cursor:pointer}
.avatar:first-child{margin-left:0}
.avatar.more{background:var(--hover);color:var(--text);font-weight:400}

.pill{display:flex;align-items:center;gap:8px;height:36px;padding:0 14px;border:0;cursor:pointer;color:var(--text)}
.pill:hover{background:var(--hover)}
.toast{padding:9px 14px;max-width:min(520px,90vw);text-align:center}
.toast.bad{color:#e03131}.dark .toast.bad{color:#ff8787}

/* Hints */
.hints{position:fixed;inset:0;z-index:5;pointer-events:none;font-family:var(--hand);color:var(--muted);font-size:18px;line-height:1.25}
.hint{position:absolute}
.hint svg{display:block;width:60px;height:50px;stroke-width:1.5}
.hint-menu{left:30px;top:62px}
.hint-tools{left:50%;top:62px;transform:translateX(-20px);text-align:left}
.hint-tools svg{margin-left:-6px}
.hint-people{right:34px;top:62px;text-align:right}.hint-people svg{margin-left:auto}
.hint-center{left:50%;top:50%;transform:translate(-50%,-50%);text-align:center;font-size:20px}
.hint-center p{margin:0 0 10px}
.hint-title{font-size:56px;color:var(--primary)!important;letter-spacing:.05em}

/* Dialogs */
dialog{border:0;border-radius:12px;padding:0;background:var(--island);color:var(--text);box-shadow:var(--shadow)}
dialog::backdrop{background:rgba(18,18,18,.35)}
#help{width:min(860px,calc(100vw - 32px));max-height:calc(100vh - 32px);padding:20px 24px}
.dlg-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
.dlg-head h2{margin:0;font:400 28px var(--hand)}
.help-cols{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:16px 28px}
.help-cols h3{margin:0 0 8px;font-size:15px;color:var(--primary-dark)}
.help-cols dl{display:grid;grid-template-columns:auto 1fr;gap:6px 12px;margin:0;font-size:13px}
.help-cols dt{color:var(--muted)}.help-cols dd{margin:0;text-align:right}
.help-note{margin:18px 0 0;color:var(--muted);font-size:13px}


.noscript{position:fixed;inset:40% 20px auto;text-align:center;font-size:16px}

@media(max-width:700px){
  .top-left{left:8px;top:8px}.top-right{right:8px;top:8px}.top-center{top:8px}
  .bottom-left{left:8px;bottom:8px}
  .minimap{position:fixed;left:8px;top:56px;width:120px;height:84px}
  .bottom-left .row>.group:first-child{display:none}
  .top-center{top:auto;bottom:8px;left:auto;right:8px;transform:none}
  .icon-btn{width:40px;height:40px}
  .props{position:fixed;left:8px;right:8px;bottom:60px;width:auto;display:flex;flex-wrap:wrap;gap:4px 16px}
  .props>div,.swatches{margin:0}
  .key{display:none}
  .hint-tools{left:auto;right:30px;top:auto;bottom:62px;transform:none;text-align:right}
  .hint-tools svg{margin-left:auto;transform:scaleY(-1)}
  .hint-people{display:none}
  .hint-center{font-size:17px;width:90vw}
  [data-tip]::after{display:none!important}
}
@media(prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
