:root {
  --bg: #f8f8f6;
  --ink: #151515;
  --line: #d9d9d4;
  --card: #ffffff;
  --muted: #7a7a72;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

button {
  font: inherit;
}

#canvas {
  height: 100%;
  position: relative;
  overflow: hidden;
  cursor: crosshair;
  background-color: #fcfcfa;
  background-image:
    linear-gradient(to right, rgba(0, 0, 0, 0.055) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.055) 1px, transparent 1px);
  background-size: 32px 32px;
}

#canvas.draw-active {
  cursor: crosshair;
}

#canvas.is-pan-ready {
  cursor: grab;
}

#canvas.is-panning {
  cursor: grabbing;
}

#world {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.note {
  position: absolute;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.07);
  overflow: hidden;
  padding: 10px;
  font-size: var(--note-font-size, 14px);
}

.note:focus {
  outline: none;
}

.note.is-text-active {
  border-color: #8c8c8c;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.07);
}

.note.is-selected:not(.is-text-active) {
  border-color: #a9b6d6;
  box-shadow:
    0 0 0 2px rgba(103, 152, 255, 0.48),
    0 6px 18px rgba(0, 0, 0, 0.07);
}

.card-content {
  min-height: 14px;
  display: grid;
  gap: 2px;
  align-content: start;
}

.block {
  border-radius: 6px;
}

.block.text {
  min-height: 18px;
  outline: none;
  padding: 2px 4px;
  line-height: 1.35;
  white-space: pre-wrap;
}

.block.todo {
  display: flex;
  align-items: center;
  gap: 0.45em;
  padding: 1px 3px;
}

.block.todo input[type="checkbox"] {
  width: 1.15em;
  height: 1.15em;
  margin: 0;
  flex: 0 0 auto;
  accent-color: #1e73da;
}

.block.todo .todo-text {
  flex: 1;
  min-height: 1.2em;
  outline: none;
  line-height: 1.25;
  font-size: 0.98em;
  white-space: pre-wrap;
}

.block.todo .todo-text:empty::before {
  content: "To-do";
  color: #a6a69f;
}

.block.todo.done .todo-text {
  text-decoration: line-through;
  text-decoration-thickness: 0.06em;
  text-decoration-color: #8f8f88;
  color: #8f8f88;
}

.block a {
  color: #5f5f5f;
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.08em;
}

.slash-menu {
  position: fixed;
  z-index: 9999;
  display: grid;
  gap: 2px;
  min-width: 140px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 4px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

.slash-menu button {
  border: 0;
  text-align: left;
  background: transparent;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.slash-menu button:hover {
  background: #f2f2ef;
}

.drawing-preview {
  position: absolute;
  border: 1px dashed #222;
  background: rgba(0, 0, 0, 0.05);
  pointer-events: none;
}

.drawing-preview.selection {
  border-color: #2f6df6;
  background: rgba(47, 109, 246, 0.14);
}

.shortcut-help-trigger {
  position: fixed;
  right: 14px;
  top: 14px;
  z-index: 10000;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(17, 24, 39, 0.22);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.82);
  color: #3a3f46;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.shortcut-help-trigger:hover {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(17, 24, 39, 0.3);
  transform: translateY(-1px);
}

.shortcut-help-trigger:focus-visible {
  outline: 2px solid rgba(30, 100, 220, 0.45);
  outline-offset: 2px;
}

.shortcut-help-dialog {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(20px, 12vh, 160px) 14px 14px;
  background: rgba(14, 18, 24, 0.48);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 160ms ease, visibility 160ms ease;
}

.shortcut-help-dialog.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.shortcut-help-panel {
  width: min(460px, calc(100vw - 24px));
  max-height: min(500px, calc(100dvh - 34px));
  overflow: auto;
  border: 1px solid #d9d9d9;
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
  padding: 0;
  transform-origin: center;
  transform: scale(0.97);
  transition: transform 170ms ease;
}

.shortcut-help-dialog.is-open .shortcut-help-panel {
  transform: scale(1);
}

.shortcut-help-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  min-height: 40px;
  padding: 9px 9px;
  border-bottom: 1px solid #dddddd;
}

.shortcut-tab {
  margin: 0;
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  color: #000000;
  cursor: pointer;
  position: relative;
  transition: color 140ms ease;
}

.shortcut-tab.is-muted {
  color: #a8a8a8;
}

.shortcut-tab.is-muted:hover {
  color: #8f8f8f;
}

.shortcut-tab.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -10px;
  height: 2px;
  background: #000;
}

.shortcut-tab:focus-visible {
  outline: 2px solid rgba(30, 100, 220, 0.45);
  outline-offset: 2px;
}

.shortcut-pane.is-hidden {
  display: none;
}

.shortcut-help-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.shortcut-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border-bottom: 1px solid #e0e0e0;
}

.shortcut-row:last-child {
  border-bottom: 0;
}

.shortcut-action {
  display: flex;
  align-items: center;
  font-size: 13px;
  line-height: 1.15;
  color: #2f2f2f;
}

.shortcut-keys {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
}

.shortcut-plain {
  font-size: 12px;
  color: #7c7c7c;
  line-height: 1.2;
  align-self: center;
}

.shortcut-help-list kbd {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica,
    Arial, sans-serif;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.1;
  padding: 4px 7px;
  border: 1px solid #cccccc;
  border-radius: 8px;
  background: #f3f3f3;
  white-space: normal;
}

.shortcut-pane-feedback {
  padding: 10px 9px 11px;
  display: grid;
  gap: 8px;
}

.shortcut-pane-projects {
  padding: 12px 9px 13px;
}

.more-projects-intro {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.35;
  color: #2f2f2f;
}

.more-projects-links {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.more-projects-links li {
  font-size: 13px;
  line-height: 1.35;
  color: #2f2f2f;
}

.project-logo {
  width: 18px;
  height: 18px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #d0d0d0;
  margin-right: 6px;
  vertical-align: -4px;
}

.more-projects-links a {
  color: #5f5f5f;
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.08em;
}

.feedback-input {
  width: 100%;
  min-height: 86px;
  resize: none;
  border: 1px solid #cccccc;
  border-radius: 8px;
  background: #fafafa;
  font: inherit;
  font-size: 13px;
  line-height: 1.35;
  color: #222222;
  padding: 8px 9px;
}

.feedback-input:focus-visible {
  outline: none;
  border-color: #8f8f8f;
}

.feedback-send {
  justify-self: end;
  border: 1px solid #000;
  border-radius: 8px;
  background: #000;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  min-width: 66px;
  padding: 7px 14px;
  cursor: pointer;
  text-align: center;
}

.feedback-send:hover {
  background: #1a1a1a;
}

.feedback-send.is-sending {
  font-size: 16px;
}

@media (max-width: 680px) {
  .shortcut-help-dialog {
    padding-top: clamp(14px, 5vh, 28px);
  }

  .shortcut-help-panel {
    max-height: calc(100dvh - 28px);
  }

  .shortcut-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .shortcut-action {
    font-size: 12px;
  }

  .shortcut-help-list kbd {
    font-size: 10px;
    padding: 3px 6px;
  }
}

@media (max-height: 520px) {
  .shortcut-help-dialog {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .shortcut-help-panel {
    max-height: calc(100dvh - 20px);
  }
}
