body {
      font-family: Inter, sans-serif;
    }

    .tool-card {
      background: #fff;
      border: 1px solid #e5e7eb;
      border-radius: 0.75rem;
      padding: 1.5rem;
      box-shadow: 0 3px 12px rgba(0, 0, 0, .04);
    }

    .preset-btn {
      border: 1px solid #d1d5db;
      border-radius: 0.6rem;
      padding: 0.5rem 0.75rem;
      text-align: left;
      background: #fff;
      transition: all 0.15s ease;
      font-size: 0.7rem;
      line-height: 1.2;
    }

    .preset-btn span {
      font-size: 0.65rem;
      margin-top: 2px;
    }

    .preset-btn:hover {
      background: #f9fafb;
      border-color: #3b82f6;
    }

    .preset-btn.active {
      background: #eff6ff;
      border-color: #3b82f6;
    }

    @media (max-width: 640px) {
      .preset-btn {
        padding: 0.45rem 0.6rem;
        font-size: 0.75rem;
      }

      .preset-btn span {
        font-size: 0.65rem;
      }
    }

    #canvas {
      border: 1px solid #e5e7eb;
      border-radius: 0.5rem;
      max-width: 100%;
      height: auto;
      background: #fff;
    }

    .color-option {
      width: 32px;
      height: 32px;
      border-radius: 50%;
      border: 2px solid #e5e7eb;
      cursor: pointer;
      transition: all 0.15s ease;
    }

    .color-option:hover {
      transform: scale(1.1);
      border-color: #3b82f6;
    }

    .color-option.active {
      border-color: #3b82f6;
      border-width: 3px;
      transform: scale(1.15);
    }

    /* Collapsible styles */
    .collapsible-toggle {
      cursor: pointer;
      user-select: none;
    }

    .collapsible-content {
      max-height: 0;
      overflow: hidden;
      transition: max-height 0.3s ease-out;
    }

    .collapsible-content.open {
      max-height: 500px;
      transition: max-height 0.3s ease-in;
    }

    .toggle-icon {
      transition: transform 0.3s ease;
      display: inline-block;
    }

    .toggle-icon.rotated {
      transform: rotate(-180deg);
    }
/* ── Paper surface (contenteditable — input + output in one) ── */
.paper-surface {
  position: relative;
  min-height: 480px;
  max-height: 600px;
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 32px 50px 32px 60px;
  box-sizing: border-box;
  background: #fff;
  outline: none;
  overflow-y: auto;
  overflow-x: hidden;
  cursor: text;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  font-size: 32px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  scrollbar-width: thin;
  scrollbar-color: #d1d5db #f9fafb;
}
.paper-surface::-webkit-scrollbar { width: 6px; }
.paper-surface::-webkit-scrollbar-track { background: #f9fafb; border-radius: 3px; }
.paper-surface::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
.paper-surface::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* Placeholder */
.paper-surface:empty::before {
  content: attr(data-placeholder);
  color: #c0c0c0;
  pointer-events: none;
  font-family: 'Indie Flower', cursive;
  font-size: 28px;
}

/* Lined paper background — drawn via JS class toggle */
.paper-surface.lined {
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent calc(1.5em * 1px - 1px),
    #e0e0e0 calc(1.5em * 1px)
  );
}

/* Left margin red line */
.paper-surface::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50px;
  width: 1px;
  height: 100%;
  background: #ffcccc;
  pointer-events: none;
}

/* Graph paper */
.paper-surface.graph {
  background-image:
    linear-gradient(rgba(200,200,200,0.4) 1px, transparent 1px),
    linear-gradient(90deg, rgba(200,200,200,0.4) 1px, transparent 1px);
  background-size: 20px 20px;
}
