﻿:root {
  --font-hand: "Caveat", "Ma Shan Zheng", "Kaiti SC", "STKaiti", "Kaiti", "Comic Sans MS", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-sans: "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  font-family: var(--font-sans);
  color: #333;
  background-color: #d1d5db;
  /* 背景给个淡淡的桌面颜色 */
  background-image: url('https://www.transparenttextures.com/patterns/wood-pattern.png');
}

/* ---------- 工具栏 ---------- */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  color: #333;
  padding: 12px 22px;
  font-size: 14px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
}
.toolbar-right { display: flex; align-items: center; gap: 6px; }
.toolbar-left { display: flex; align-items: center; gap: 14px; }
.toolbar-left strong { font-size: 15px; }
.sync-status {
  font-size: 12px;
  color: #2e7d32;
  font-weight: normal;
  padding: 4px 10px;
  border-radius: 12px;
  background: #edf7ed;
}
.sync-status.sync-error { color: #ed6c02; background: #fff4e5; }
.toolbar button {
  background: #fff;
  color: #333;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: all .2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.toolbar button:hover { background: #f3f4f6; border-color: #9ca3af; }
.toolbar button:active { transform: scale(0.96); }
.toolbar button#btn-sync {
  background: #fdf6cd;
  border-color: #f7d23e;
  font-weight: 600;
}
.toolbar button#btn-sync:hover { background: #fced98; }
.toolbar .divider {
  display: inline-block;
  width: 1px;
  height: 20px;
  background: #d1d5db;
  margin: 0 8px;
}

.page { padding: 30px; }

/* ---------- 软木板画布 ---------- */
.canvas-wrap {
  max-width: 1440px;
  margin: 0 auto;
  background-color: #c9aa88;
  background-image: url('https://www.transparenttextures.com/patterns/cork-board.png');
  border: 12px solid #5a4634;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.4), inset 0 0 20px rgba(0,0,0,0.5);
  padding: 24px 28px 30px;
  overflow-x: auto;
  position: relative;
}

/* 顶部标题纸张 */
.canvas-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  background: #f4f0e6;
  padding: 16px 24px;
  margin: 0 auto 24px;
  border-radius: 2px;
  box-shadow: 2px 3px 6px rgba(0,0,0,0.2);
  gap: 20px;
  flex-wrap: wrap;
  position: relative;
  transform: rotate(-0.5deg);
  max-width: 96%;
}
/* 图钉 */
.canvas-header::before, .canvas-header::after {
  content: "";
  position: absolute; top: 12px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ff8a80, #d32f2f);
  box-shadow: -1px 2px 3px rgba(0,0,0,0.4), inset -1px -1px 2px rgba(0,0,0,0.3);
}
.canvas-header::before { left: 16px; }
.canvas-header::after { right: 16px; }

.canvas-header h1 {
  font-size: 26px;
  font-weight: bold;
  margin: 0 0 4px;
  outline: none;
  min-width: 200px;
  font-family: var(--font-hand);
  color: #111;
}
.canvas-header .sub { font-size: 14px; color: #555; outline: none; min-width: 160px; font-family: var(--font-hand); }
.meta { display: flex; gap: 14px; font-size: 13px; color: #444; flex-wrap: wrap; font-family: var(--font-hand); }
.meta .field {
  border-bottom: 2px dotted #ccc;
  padding: 0 4px 0 6px;
  min-width: 60px;
  display: inline-block;
  outline: none;
  color: #111;
  font-weight: 600;
}

[contenteditable]:empty:before { content: attr(data-placeholder); color: #aaa; font-weight: 400; }
[contenteditable]:focus { background: rgba(255,255,0,0.1); border-radius: 4px; }

/* ---------- 九宫格 ---------- */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.3fr 1fr 1fr;
  grid-template-rows: auto auto auto;
  grid-template-areas:
    "partners activities value relationship segments"
    "partners resources  value channels     segments"
    "cost     cost       cost  revenue      revenue";
  gap: 16px;
  min-width: 1080px;
}

.block {
  border: 2px dashed rgba(255,255,255,0.25);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
}

#block-partners { grid-area: partners; }
#block-activities { grid-area: activities; }
#block-resources { grid-area: resources; }
#block-value { grid-area: value; }
#block-relationship { grid-area: relationship; }
#block-channels { grid-area: channels; }
#block-segments { grid-area: segments; }
#block-cost { grid-area: cost; }
#block-revenue { grid-area: revenue; }

/* 模块标题纸条 */
.block-title {
  background: #e6dfcd;
  padding: 6px 14px;
  border-radius: 2px;
  box-shadow: 1px 2px 4px rgba(0,0,0,0.2);
  margin-bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
  align-self: flex-start;
  transform: rotate(-1deg);
}
/* 胶带 */
.block-title::before {
  content: "";
  position: absolute; top: -5px; left: 50%; transform: translateX(-50%) rotate(2deg);
  width: 30px; height: 12px;
  background: rgba(255,255,255,0.6);
  border: 1px solid rgba(255,255,255,0.4);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.block-title .icon { font-size: 15px; line-height: 1; flex: none; position: relative; z-index: 1;}
.block-title .num {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #333;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  box-shadow: inset 1px 1px 2px rgba(255,255,255,0.3);
  position: relative; z-index: 1;
}
.block-title .title-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
  position: relative; z-index: 1;
}
.block-title .cn {
  font-size: 15px;
  font-weight: 700;
  color: #222;
  white-space: nowrap;
  font-family: var(--font-hand);
}

.cards {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 50px;
  border-radius: 8px;
  transition: background .15s, outline .15s;
}
.cards.cards-row { flex-direction: row; flex-wrap: wrap; }
.cards.drag-over { background: rgba(255,255,255,0.1); outline: 2px dashed rgba(255,255,255,0.5); outline-offset: 4px; }

/* ---------- 贴纸便签 (Stickers / Post-its) ---------- */
.card {
  position: relative;
  background-color: #e6dfb3; /* 默认色彩更柔和的值 */
  background-image: linear-gradient(135deg, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 50%, rgba(0,0,0,0.02) 100%);
  border: none;
  border-radius: 2px 2px 16px 2px;
  padding: 16px 20px 14px 14px;
  font-family: var(--font-hand);
  font-size: 16px;
  line-height: 1.5;
  color: #3b3a37;
  box-shadow: 2px 5px 8px rgba(0,0,0,0.2), inset 0 -2px 10px rgba(0,0,0,0.03);
  transition: transform .2s, box-shadow .2s;
  transform: rotate(0.5deg);
}

/* 四种颜色的便签交替 */
.card:nth-child(4n+1) { background-color: #e6dfb3; transform: rotate(-1.5deg); } /* Muted Khaki */
.card:nth-child(4n+2) { background-color: #b9d3b6; transform: rotate(1.5deg); } /* Muted Mint */
.card:nth-child(4n+3) { background-color: #e2c2c6; transform: rotate(-1deg); } /* Muted Rose */
.card:nth-child(4n+4) { background-color: #b4c6d6; transform: rotate(1deg); } /* Muted Blue */

.card:hover {
  box-shadow: 4px 8px 16px rgba(0,0,0,0.25), inset 0 -2px 10px rgba(0,0,0,0.03);
  z-index: 10;
}
.cards-row .card { flex: 1 1 160px; }
.card.dragging { opacity: 0.5; box-shadow: 5px 12px 24px rgba(0,0,0,0.4); transform: scale(1.05) rotate(0deg); z-index: 20; }

/* 顶部的半透明胶带 */
.card::before {
  content: "";
  position: absolute; top: -8px; left: 50%;
  width: 44px; height: 16px;
  background: rgba(255,255,255,0.45);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  border: 1px solid rgba(255,255,255,0.6);
  pointer-events: none;
}
/* 胶带的随机旋转使用 nth-child 区分 */
.card:nth-child(even)::before { transform: translateX(-50%) rotate(3deg); }
.card:nth-child(odd)::before { transform: translateX(-50%) rotate(-3deg); }

/* 卡片右下角的卷起阴影效果 */
.card::after {
  content: "";
  position: absolute; bottom: 0; right: 0;
  width: 24px; height: 24px;
  box-shadow: -2px -2px 6px rgba(0,0,0,0.15);
  transform: skewX(-15deg) skewY(-15deg);
  z-index: -1;
  pointer-events: none;
}

.card .drag-handle {
  position: absolute; left: 4px; top: 6px;
  width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  cursor: grab;
  color: rgba(0,0,0,0.3);
  font-size: 11px;
  user-select: none;
  transition: color .2s;
}
.card:hover .drag-handle { color: rgba(0,0,0,0.6); }
.card .delete-btn {
  position: absolute; right: 4px; top: 4px;
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: rgba(0,0,0,0.4);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, background .15s;
}
.card:hover .delete-btn { opacity: .7; }
.card .delete-btn:hover { opacity: 1 !important; background: rgba(0,0,0,.08); }
.card-text {
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 20px;
}

.add-btn {
  margin-top: 10px;
  border: 2px dashed rgba(255,255,255,0.4);
  border-radius: 6px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  padding: 8px;
  background: transparent;
  cursor: pointer;
  width: 100%;
  font-family: var(--font-hand);
  transition: all .2s;
}
.add-btn:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border-color: #fff;
  transform: translateY(-1px);
}

.hint {
  max-width: 1440px;
  margin: 16px auto 0;
  font-size: 13px;
  color: rgba(0,0,0,0.6);
  text-shadow: 0 1px 0 rgba(255,255,255,0.5);
  line-height: 1.6;
  text-align: center;
  font-family: var(--font-hand);
}

/* ---------- 导出模式：隐藏交互元素 ---------- */
body.exporting .add-btn,
body.exporting .drag-handle,
body.exporting .delete-btn {
  visibility: hidden !important;
}
body.exporting .toolbar { display: none !important; }
body.exporting .page { padding: 0 !important; }
body.exporting { background: transparent !important; }