@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;0,9..144,600;0,9..144,700;1,9..144,500&family=Manrope:wght@400;500;600;700;800&family=Caveat:wght@600;700&display=swap');

:root {
  --paper: #f6f1e7;
  --paper-deep: #efe7d6;
  --panel: #fffdf9;
  --border: #e4dac3;
  --border-strong: #d8c9a3;
  --ink: #2b2420;
  --ink-soft: #57493a;
  --muted: #736552;
  --accent: #c1502e;
  --accent-hover: #a63f22;
  --accent-soft: #f0dcce;
  --teal: #2f7166;
  --gold: #b8862f;
  --danger: #b23a2e;
  --success: #3f8f5f;

  --sticky-yellow: #fbe8a6;
  --sticky-yellow-border: #e8cd74;
  --sticky-mint: #cfe8d8;
  --sticky-mint-border: #a9d3bb;
  --sticky-pink: #f4d3d0;
  --sticky-pink-border: #e3aca6;
  --sticky-blue: #cfe1ee;
  --sticky-blue-border: #a9c7dc;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(43, 36, 32, 0.08);
  --shadow-card: 0 10px 24px -12px rgba(43, 36, 32, 0.28), 0 2px 6px rgba(43, 36, 32, 0.08);
  --shadow-note: 0 6px 14px -6px rgba(43, 36, 32, 0.28), 0 2px 4px rgba(43, 36, 32, 0.12);
  --shadow-note-hover: 0 14px 24px -10px rgba(43, 36, 32, 0.34), 0 4px 8px rgba(43, 36, 32, 0.14);

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-hand: 'Caveat', cursive;
}

* { box-sizing: border-box; }

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

body {
  background:
    radial-gradient(circle at 1px 1px, rgba(43, 36, 32, 0.05) 1px, transparent 0) 0 0/22px 22px,
    var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; }

/* ---- Buttons ---- */
button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--ink-soft);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-weight: 600;
  font-size: 13.5px;
  transition: transform 0.14s ease, background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease, color 0.14s ease;
}
button:hover { background: var(--paper-deep); border-color: var(--muted); transform: translateY(-1px); }
button:active { transform: translateY(0); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff9f2;
  box-shadow: 0 6px 16px -6px rgba(193, 80, 46, 0.55);
}
button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); box-shadow: 0 8px 20px -6px rgba(193, 80, 46, 0.6); }

button.ghost { border-color: transparent; background: transparent; box-shadow: none; }
button.ghost:hover { background: rgba(43, 36, 32, 0.06); transform: none; }

input[type="text"], input:not([type]), textarea {
  font: inherit;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink);
  width: 100%;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
input[type="text"]::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ==================== Landing ==================== */
.hero {
  max-width: 680px;
  margin: 0 auto;
  padding: 72px 24px 20px;
  text-align: center;
}
.hero .brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-hand);
  font-size: 21px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 24px;
}
.hero .brand .dot {
  width: 15px;
  height: 15px;
  border-radius: 2px 2px 6px 2px;
  background: var(--sticky-yellow);
  border: 1.5px solid var(--sticky-yellow-border);
  box-shadow: var(--shadow-note);
  transform: rotate(-10deg);
  display: inline-block;
}
.hero h1 {
  font-size: 50px;
  line-height: 1.14;
  margin: 0 0 18px;
  color: var(--ink);
  text-wrap: balance;
}
.hero h1 em {
  font-style: italic;
  color: var(--accent);
}
.hero .tagline {
  color: var(--ink-soft);
  font-size: 17px;
  max-width: 460px;
  margin: 0 auto;
  line-height: 1.55;
}

.wrap {
  max-width: 620px;
  margin: 0 auto;
  padding: 28px 24px 80px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 30px;
  position: relative;
}
.card::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  width: 64px;
  height: 22px;
  background: rgba(184, 134, 47, 0.28);
  border-radius: 2px;
}

.field { margin-bottom: 20px; }
.field label {
  display: block;
  font-weight: 700;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 8px;
}
#board-name { font-size: 16px; }

.section-row { display: flex; gap: 8px; margin-bottom: 8px; }
.section-row input { background: var(--paper); }
.section-row button { flex: 0 0 auto; width: 40px; padding: 8px; color: var(--muted); }
.section-row button:hover { color: var(--danger); border-color: var(--danger); background: rgba(178, 58, 46, 0.06); }

#add-section { margin-top: 2px; color: var(--teal); }
#add-section:hover { color: var(--teal); border-color: var(--teal); background: rgba(47, 113, 102, 0.08); }

button.primary[type="submit"] {
  width: 100%;
  padding: 13px;
  font-size: 15px;
  margin-top: 6px;
}

.recent { margin-top: 28px; background: transparent; border: none; box-shadow: none; padding: 0; }
.recent::before { display: none; }
.recent h2 {
  font-family: var(--font-body);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
  margin: 0 0 10px;
}
.recent ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.recent li {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}
.recent li:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); border-color: var(--border-strong); }
.recent li a {
  display: block;
  padding: 12px 16px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}
.recent li a:hover { color: var(--accent); }

.empty-note {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  padding: 18px 0;
  font-style: italic;
}

/* ==================== Board ==================== */
.board-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}
.board-header .board-name {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  cursor: pointer;
  flex: 1 1 auto;
  min-width: 120px;
  padding: 4px 8px;
  margin: -4px -8px;
  border-radius: var(--radius-sm);
  transition: background 0.14s ease, color 0.14s ease;
}
.board-header .board-name:hover { color: var(--accent); background: var(--accent-soft); }
.board-header .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.board-name-input {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  flex: 1 1 auto;
  min-width: 120px;
  padding: 4px 8px;
  margin: -4px -8px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--accent);
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.section-add-input {
  width: 180px;
  padding: 8px 12px;
  border-style: dashed;
  border-color: var(--accent);
  background: var(--panel);
  color: var(--ink);
  font-weight: 600;
  text-align: center;
}

.conn-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #b9ad96; flex: 0 0 auto;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.03);
  transition: background 0.2s ease;
}
.conn-dot.on { background: var(--success); box-shadow: 0 0 0 3px rgba(63, 143, 95, 0.18); }
.conn-dot.off { background: var(--danger); box-shadow: 0 0 0 3px rgba(178, 58, 46, 0.18); }

.columns {
  display: flex;
  gap: 20px;
  padding: 24px;
  align-items: flex-start;
  overflow-x: auto;
}

.column {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 300px;
  flex: 0 0 300px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 128px);
  box-shadow: var(--shadow-sm);
}
.column-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 14px 12px;
  border-bottom: 2px solid var(--border-strong);
}
.column-head .title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16.5px;
  flex: 1 1 auto;
  cursor: pointer;
  padding: 3px 6px;
  margin: -3px -6px;
  border-radius: 6px;
  transition: background 0.14s ease, color 0.14s ease;
}
.column-head .title:hover { color: var(--accent); background: var(--accent-soft); }
.title-input {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16.5px;
  flex: 1 1 auto;
  padding: 3px 6px;
  margin: -3px -6px;
  border-radius: 6px;
  border: 1.5px solid var(--accent);
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.column-head .count {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: var(--paper-deep);
  border-radius: 999px;
  padding: 2px 8px;
  flex: 0 0 auto;
}

.column-body {
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  min-height: 80px;
  transition: background 0.15s ease;
  border-radius: 0 0 var(--radius) var(--radius);
}
.column-body.drag-over {
  background: repeating-linear-gradient(
    -45deg,
    rgba(193, 80, 46, 0.06),
    rgba(193, 80, 46, 0.06) 10px,
    rgba(193, 80, 46, 0.1) 10px,
    rgba(193, 80, 46, 0.1) 20px
  );
}

/* ---- Sticky notes ---- */
.note {
  background: var(--sticky-yellow);
  border: 1px solid var(--sticky-yellow-border);
  border-radius: 4px 4px 8px 8px;
  padding: 14px 14px 10px;
  box-shadow: var(--shadow-note);
  cursor: grab;
  transform: rotate(var(--tilt, -1deg));
  transition: transform 0.16s ease, box-shadow 0.16s ease;
  position: relative;
}
.note::before {
  content: '';
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%) rotate(3deg);
  width: 34px;
  height: 14px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 2px;
}
.note:hover {
  transform: rotate(var(--tilt, -1deg)) translateY(-3px) scale(1.015);
  box-shadow: var(--shadow-note-hover);
  z-index: 2;
}
.note[draggable="true"]:active { cursor: grabbing; }
.note.dragging { opacity: 0.4; }

.note.tint-mint { background: var(--sticky-mint); border-color: var(--sticky-mint-border); }
.note.tint-pink { background: var(--sticky-pink); border-color: var(--sticky-pink-border); }
.note.tint-blue { background: var(--sticky-blue); border-color: var(--sticky-blue-border); }

.note .text {
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 20px;
  font-size: 14.5px;
  line-height: 1.45;
  color: #2b2420;
}
.note textarea {
  width: 100%;
  font: inherit;
  font-size: 14.5px;
  border: 1px solid rgba(43, 36, 32, 0.25);
  border-radius: 6px;
  padding: 8px;
  resize: vertical;
  background: rgba(255, 255, 255, 0.6);
}
.note-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed rgba(43, 36, 32, 0.18);
}
.note-footer button {
  border: none;
  background: rgba(255, 255, 255, 0.55);
  padding: 3px 9px;
  font-size: 13px;
  border-radius: 7px;
  color: var(--ink-soft);
  box-shadow: none;
}
.note-footer button:hover { background: rgba(255, 255, 255, 0.9); transform: translateY(-1px); }
.note-footer .votes {
  font-weight: 800;
  min-width: 22px;
  text-align: center;
  font-size: 13.5px;
  color: var(--ink);
}
.note-footer .spacer { flex: 1 1 auto; }
.note-footer .del {
  color: var(--muted);
  background: transparent;
}
.note-footer .del:hover { color: var(--danger); background: rgba(178, 58, 46, 0.1); }

.add-note {
  margin-top: 2px;
  border-style: dashed;
  border-color: var(--border-strong);
  background: transparent;
  color: var(--muted);
  width: 100%;
  text-align: center;
}
.add-note:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

.note-add-input {
  cursor: text;
  font: inherit;
  font-size: 14.5px;
  resize: vertical;
  color: var(--ink);
}
.note-add-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-note-hover), 0 0 0 3px var(--accent-soft);
}

.column-empty {
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
  padding: 22px 8px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  font-style: italic;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .hero { padding: 44px 20px 12px; }
  .hero h1 { font-size: 38px; }
  .board-header { padding: 12px 16px; }
  .columns { flex-direction: column; padding: 16px; gap: 16px; }
  .column { width: 100%; flex: 1 1 auto; max-height: none; }
  .note { transform: none !important; }
  .note:hover { transform: translateY(-2px) !important; }
}
