@font-face { font-family: "Shantell Sans"; src: url("/fonts/shantell-sans.woff2") format("woff2"); font-weight: 300 800; font-display: swap; }
@font-face { font-family: "Geist"; src: url("/fonts/geist.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root { --ink: #1D1D1D; --paper: #FBFBF9; --line: #DEDED9; --hand: "Shantell Sans", "Comic Sans MS", cursive; --ui: "Geist", system-ui, sans-serif; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--paper); overscroll-behavior: none; }

#board {
  position: fixed; inset: 0; overflow: hidden; color: var(--ink); font-family: var(--hand);
  background-color: var(--paper);
  background-image: radial-gradient(#D5D5D0 1.3px, transparent 1.3px);
  background-size: 26px 26px;
  touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair;
}
#board.hand { cursor: grab; }
#board.hand.grabbing { cursor: grabbing; }
#board.erase { cursor: cell; }
#board.text { cursor: text; }
#board.note { cursor: copy; }
.edit {
  position: absolute; margin: 0; border: 0; outline: 2px dashed #A8A8A2; outline-offset: 4px; resize: none; overflow: hidden;
  font-family: var(--hand); background: transparent; pointer-events: auto; user-select: text; -webkit-user-select: text; cursor: text;
}
.edit.t { font-size: 28px; font-weight: 600; line-height: 35px; padding: 0; white-space: pre; min-width: 40px; }
.edit.n { width: 200px; min-height: 140px; padding: 14px 12px; font-size: 20px; font-weight: 500; line-height: 26px; background: #FFE98A; box-shadow: 0 4px 14px rgba(0,0,0,.14); }
#world { position: absolute; left: 0; top: 0; width: 100%; height: 100%; transform-origin: 0 0; pointer-events: none; }
#hint {
  position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%) rotate(-3deg); margin: 0;
  font-size: 34px; font-weight: 600; color: #8C8C86; white-space: nowrap; opacity: 0; transition: opacity .4s;
}
#board.empty #hint { opacity: 1; }
#ink { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.ui { cursor: default; }
#peers { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.peer {
  position: absolute; left: 0; top: 0; display: flex; align-items: flex-start; gap: 0; padding: 0; border: 0; background: none;
  font: 600 13px var(--ui); color: #fff; pointer-events: none; transition: opacity .3s; will-change: transform;
}
.peer svg { width: 18px; height: 18px; flex: 0 0 auto; filter: drop-shadow(0 1px 1.5px rgba(0,0,0,.3)); }
.peer .nm { margin: 14px 0 0 -2px; padding: 3px 8px; border-radius: 999px; background: var(--pc); white-space: nowrap; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.peer.idle { opacity: .45; }
.peer.edge { align-items: center; gap: 4px; pointer-events: auto; cursor: pointer; }
.peer.edge svg { width: 22px; height: 22px; }
.peer.edge .nm { margin: 0; }
.peer.edge.flip { flex-direction: row-reverse; }
.peer.edge:hover .nm { filter: brightness(1.15); }
.side { position: absolute; left: 20px; top: 20px; display: flex; flex-direction: column; gap: 14px; width: 236px; }
.side h2 { margin: 0 0 -4px 4px; font-weight: 800; font-size: 20px; line-height: 1; color: #6B6B66; }
.box {
  display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 15px; background: #fff; color: var(--ink);
  border: 2.5px solid var(--ink); border-radius: 255px 14px 225px 14px / 14px 225px 14px 255px;
  transform: rotate(var(--r)); text-decoration: none; cursor: pointer; transition: transform .2s cubic-bezier(.2,.7,.2,1);
}
.box.alt { border-radius: 14px 225px 14px 255px / 255px 14px 225px 14px; }
.box:hover, .box:focus-visible { transform: translateX(6px) rotate(var(--r)); }
.box .row { display: flex; align-items: center; gap: 10px; }
.box .ico { width: 36px; height: 26px; flex: 0 0 auto; }
.box .nm { font-weight: 800; font-size: 26px; line-height: 1; }
.box .arrow { margin-left: auto; font-size: 20px; font-weight: 600; color: var(--c); }
.box .kind { font-size: 16px; line-height: 1.3; color: #3A3A36; }

.intro {
  margin: 10px 0 0; padding: 14px 16px 18px; background: #FFE98A; color: var(--ink); font-size: 17px; font-weight: 500; line-height: 1.35;
  transform: rotate(1.2deg); box-shadow: 0 4px 14px rgba(0,0,0,.14); cursor: default;
}
.me {
  position: absolute; left: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 2px; padding: 12px 16px 13px;
  background: #fff; border: 2.5px solid var(--ink); border-radius: 14px 225px 14px 255px / 255px 14px 225px 14px;
}
.me h1 { margin: 0; font-weight: 800; font-size: 24px; line-height: 1.1; }
.me a { font-size: 17px; font-weight: 600; color: #1F55C8; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; padding: 4px 0; }

.status {
  position: absolute; right: 20px; bottom: 24px; display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 999px; font-family: var(--ui); font-size: 14px; color: #3A3A36;
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: #B8B8B2; }
.dot.on { background: #2F9E44; }

.bar {
  position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; padding: 8px;
  background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 6px 24px rgba(0,0,0,.1); font-family: var(--ui);
}
.tool {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border: 0; border-radius: 10px;
  background: #fff; color: var(--ink); font: 500 15px var(--ui); cursor: pointer; transition: background-color .15s;
}
.tool:hover { background: #EFEFEC; }
.tool[aria-pressed="true"] { background: var(--ink); color: #fff; }
.tool[hidden] { display: none; }
.sep { width: 1px; height: 28px; background: var(--line); margin: 0 4px; }
.sw { width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: none; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.sw span { display: block; width: 26px; height: 26px; border-radius: 50%; box-shadow: 0 0 0 3px #fff; transition: transform .15s; }
.sw:hover span { transform: scale(1.15); }
.sw[aria-pressed="true"] span { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--ink); }

.toast {
  position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); padding: 10px 16px; max-width: calc(100% - 24px);
  background: var(--ink); color: #fff; border-radius: 12px; font: 500 15px var(--ui); text-align: center;
}
.toast[hidden] { display: none; }

a:focus-visible, button:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

@media (max-width: 760px) {
  .me { left: 12px; top: 12px; bottom: auto; }
  .side { flex-direction: row; flex-wrap: wrap; gap: 8px; width: auto; left: 12px; right: 12px; top: 100px; }
  .side .box { padding: 8px 12px; transform: none; flex: 0 0 auto; }
  .side .box:hover { transform: none; }
  .side .kind, .side .ico { display: none; }
  .side .nm { font-size: 19px; }
  .side h2 { display: none; }
  .intro { flex: 1 1 100%; margin: 2px 0 0; padding: 10px 12px; font-size: 15px; transform: none; }
  .tl { display: none; }
  .bar { gap: 4px; }
  .tool { padding: 0 10px; }
  .sw { width: 34px; }
  .status { right: 12px; top: 16px; bottom: auto; padding: 7px 10px; font-size: 13px; }
  #hint { white-space: normal; width: 80%; text-align: center; font-size: 26px; }
}
@media (max-width: 380px) { .sep { flex-basis: 100%; height: 0; margin: 0; } }
@media (prefers-reduced-motion: reduce) { .box, .tool, .sw span, #hint, .peer { transition: none; } }
