@import url('https://fonts.googleapis.com/css2?family=Gaegu:wght@400;700&family=ZCOOL+KuaiLe&family=Fredoka+One&family=Inter:wght@400;600;800&display=swap');

/* ========== 基础变量 & 全局配置 ========== */
:root {
  --bg-main: #EEF2F7;
  --panel-bg: #FFFFFF;
  --text-main: #1E293B;
  --text-light: #64748B;
  --border-color: #E2E8F0;
  --primary-color: #3B82F6;
  --primary-hover: #2563EB;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.02);
  --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.05), 0 4px 12px -2px rgba(0,0,0,0.03);
  --transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
  --color-green: #10B981;
  --color-yellow: #F59E0B;
  --color-red: #EF4444;
  --color-purple: #8B5CF6;
  --color-orange: #F97316;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ========== 左侧控制面板 ========== */
.control-panel {
  width: 380px;
  background: var(--panel-bg);
  border-right: 1px solid var(--border-color);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  overflow-y: auto;
  z-index: 100;
}

.panel-header h1 {
  font-family: 'ZCOOL KuaiLe', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #3B82F6, #10B981);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 4px;
}

.panel-header p {
  font-size: 0.78rem;
  color: var(--text-light);
}

.section-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
  margin-bottom: 10px;
}

/* 主题选择 */
.theme-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.theme-opt {
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 6px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: white;
}

.theme-opt:hover { border-color: #CBD5E1; transform: translateY(-1px); }
.theme-opt.active { border-color: var(--primary-color); background: #EFF6FF; }
.theme-opt .icon { font-size: 1.4rem; display: block; margin-bottom: 4px; }
.theme-opt .label { font-size: 0.7rem; font-weight: 700; }

/* 表单输入 */
.form-group { margin-bottom: 10px; }

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
  color: var(--text-main);
}

.input-field {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-main);
  outline: none;
  transition: var(--transition);
  font-family: inherit;
}

.input-field:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.textarea-field { resize: vertical; }

/* 任务折叠组 */
.task-group {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  overflow: hidden;
}

.task-group-header {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  background: #F8FAFC;
  user-select: none;
}

.task-group-header .badge { padding: 2px 6px; border-radius: 4px; font-size: 0.65rem; font-weight: 700; color: white; }
.badge.green { background: var(--color-green); }
.badge.yellow { background: var(--color-yellow); color: #7f5c1d; }
.badge.red { background: var(--color-red); }

.task-inputs { padding: 8px 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.task-inputs .input-field { font-size: 0.8rem; }

/* 按钮 */
.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(59,130,246,0.2);
}

.action-btn:hover { background: var(--primary-hover); transform: translateY(-1px); }

/* ========== 预览区域 ========== */
.preview-container {
  margin-left: 380px;
  flex: 1;
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
}

.gameboard-paper {
  width: 210mm;
  height: 297mm;
  background: white;
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-lg);
  padding: 10mm 8mm;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 6mm;
  position: relative;
  overflow: hidden;
}

/* ========== 主题样式 ========== */
.theme-ninja {
  --theme-bg: #FFFFFF;
  --theme-text: #1E293B;
  --theme-primary: #1E3A8A;
  --theme-accent: #E11D48;
  --theme-accent-light: #FFE4E6;
  --theme-card-bg: #F8FAFC;
  --theme-border: #475569;
  --theme-title-font: 'ZCOOL KuaiLe', sans-serif;
  --theme-hand-font: 'Gaegu', cursive;
}

.theme-space {
  --theme-bg: #0F172A;
  --theme-text: #E2E8F0;
  --theme-primary: #38BDF8;
  --theme-accent: #A78BFA;
  --theme-accent-light: #EDE9FE;
  --theme-card-bg: #1E293B;
  --theme-border: #475569;
  --theme-title-font: 'Fredoka One', cursive;
  --theme-hand-font: 'Gaegu', cursive;
}

.theme-magic {
  --theme-bg: #FFFFFF;
  --theme-text: #581C87;
  --theme-primary: #9333EA;
  --theme-accent: #EC4899;
  --theme-accent-light: #FCE7F3;
  --theme-card-bg: #FAF5FF;
  --theme-border: #7E22CE;
  --theme-title-font: 'ZCOOL KuaiLe', sans-serif;
  --theme-hand-font: 'Gaegu', cursive;
}

.theme-pirate {
  --theme-bg: #FFFBEB;
  --theme-text: #78350F;
  --theme-primary: #B45309;
  --theme-accent: #DC2626;
  --theme-accent-light: #FEE2E2;
  --theme-card-bg: #FEF3C7;
  --theme-border: #92400E;
  --theme-title-font: 'ZCOOL KuaiLe', sans-serif;
  --theme-hand-font: 'Gaegu', cursive;
}

.theme-animal {
  --theme-bg: #F0FDF4;
  --theme-text: #166534;
  --theme-primary: #16A34A;
  --theme-accent: #EAB308;
  --theme-accent-light: #FEF9C3;
  --theme-card-bg: #F0FDF4;
  --theme-border: #15803D;
  --theme-title-font: 'ZCOOL KuaiLe', sans-serif;
  --theme-hand-font: 'Gaegu', cursive;
}

.theme-dino {
  --theme-bg: #FFF7ED;
  --theme-text: #7C2D12;
  --theme-primary: #EA580C;
  --theme-accent: #16A34A;
  --theme-accent-light: #DCFCE7;
  --theme-card-bg: #FFFBEB;
  --theme-border: #9A3412;
  --theme-title-font: 'ZCOOL KuaiLe', sans-serif;
  --theme-hand-font: 'Gaegu', cursive;
}

/* ========== 顶部标题区 ========== */
.board-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 3px solid var(--theme-primary);
}

.header-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.mascot-img {
  width: 60px;
  height: 60px;
  object-fit: contain;
}

.mascot-speech {
  font-family: var(--theme-title-font);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--theme-primary);
  background: var(--theme-accent-light);
  padding: 2px 8px;
  border-radius: 10px;
  transform: rotate(-3deg);
  white-space: nowrap;
}

.header-center {
  flex: 1;
  text-align: center;
}

.header-center h2 {
  font-family: var(--theme-title-font);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--theme-primary);
  margin-bottom: 2px;
}

.tagline {
  font-family: var(--theme-hand-font);
  font-size: 0.85rem;
  color: var(--text-light);
}

.header-right {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meta-row { display: flex; gap: 4px; }
.meta-line { font-weight: 700; color: var(--theme-primary); border-bottom: 1px dotted var(--theme-border); min-width: 40px; display: inline-block; }

/* ========== 心情打卡 ========== */
.mood-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--theme-card-bg);
  border: 2px solid var(--theme-border);
  border-radius: var(--radius-md);
}

.mood-label { font-size: 0.75rem; font-weight: 700; color: var(--theme-primary); white-space: nowrap; }

.mood-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.mood-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 0.65rem;
  color: var(--text-light);
  cursor: pointer;
}

.emoji-circle {
  font-size: 1.3rem;
  background: white;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border-color);
}

/* ========== 任务展示栏 ========== */
.board-tasks {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.task-col {
  border: 2.5px solid var(--theme-border);
  border-radius: var(--radius-md);
  padding: 8px;
  background: var(--theme-card-bg);
}

.task-col.easy { border-color: var(--color-green); }
.task-col.med { border-color: var(--color-yellow); }
.task-col.hard { border-color: var(--color-red); }

.task-col-header {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--theme-primary);
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1.5px dashed var(--theme-border);
}

.task-list-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.task-item {
  font-family: var(--theme-hand-font);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  padding: 4px 8px;
  background: white;
  border-radius: 6px;
  border-left: 3px solid var(--theme-border);
  display: flex;
  align-items: center;
  gap: 6px;
}

.task-item::before {
  content: '☐';
  font-size: 0.9rem;
  color: var(--theme-border);
}

/* ========== 游戏地图 ========== */
.board-map-container {
  position: relative;
  height: 100px;
  border: 2px solid var(--theme-border);
  border-radius: var(--radius-md);
  background: var(--theme-card-bg);
  overflow: hidden;
}

.map-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.map-path {
  fill: none;
  stroke: var(--theme-primary);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 8,4;
  opacity: 0.5;
}

.nodes-container {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 100%;
  padding: 0 10px;
}

.node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.node-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid var(--theme-primary);
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(0,0,0,0.1);
  font-size: 1rem;
  position: relative;
}

.node-circle .node-bonus {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--theme-accent);
  color: white;
  font-size: 0.55rem;
  font-weight: 900;
  padding: 1px 5px;
  border-radius: 5px;
}

.node-label {
  font-family: var(--theme-title-font);
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--theme-text);
  text-align: center;
  line-height: 1.2;
  max-width: 70px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.node-desc {
  font-family: var(--theme-hand-font);
  font-size: 0.6rem;
  color: var(--text-light);
  text-align: center;
  line-height: 1.2;
}

/* ========== 番茄钟 ========== */
.tomato-section {
  text-align: center;
  padding: 8px 12px;
  background: var(--theme-card-bg);
  border: 2px solid var(--theme-border);
  border-radius: var(--radius-md);
}

.tomato-section h3 {
  font-family: var(--theme-title-font);
  font-size: 0.9rem;
  color: var(--theme-primary);
  margin-bottom: 6px;
}

.tomato-display {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--theme-primary);
  margin-bottom: 6px;
}

.tomato-target { font-size: 1rem; color: var(--text-light); }

.tomato-progress {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tomato-cell {
  width: 28px;
  height: 28px;
  border: 2px solid var(--theme-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  background: white;
  cursor: pointer;
}

.tomato-cell.filled {
  background: var(--theme-primary);
  border-color: var(--theme-primary);
  color: white;
}

/* ========== 底部区域 ========== */
.board-footer {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 10px;
}

.footer-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rewards-ledger {
  background: var(--theme-card-bg);
  border: 3px solid var(--theme-border);
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  padding: 10px 14px;
}

.rewards-title-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 2px dashed var(--theme-border);
}

.rewards-title-wrapper h3 {
  font-family: var(--theme-title-font);
  font-size: 1rem;
  color: var(--theme-primary);
}

.kids-deco { height: 40px; object-fit: contain; }

.rewards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px 16px;
}

.reward-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--theme-hand-font);
  font-size: 0.82rem;
  font-weight: 700;
}

.reward-pt {
  font-size: 0.7rem;
  font-weight: 900;
  color: white;
  background: var(--theme-primary);
  padding: 2px 6px;
  border-radius: 5px;
  flex-shrink: 0;
}

.reward-val {
  border-bottom: 2px dotted var(--theme-border);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ledger-points {
  border: 3px solid var(--theme-primary);
  border-radius: 15px 255px 15px 225px / 225px 15px 255px 15px;
  padding: 10px;
  text-align: center;
  background: var(--theme-card-bg);
}

.ledger-points h3 {
  font-family: var(--theme-title-font);
  font-size: 0.9rem;
  color: var(--theme-primary);
  margin-bottom: 6px;
}

.points-grid-draw {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.points-box {
  aspect-ratio: 1;
  border: 2px dashed var(--theme-border);
  border-radius: 50%;
  background: white;
}

/* 周挑战 */
.weekly-challenge {
  background: var(--theme-card-bg);
  border: 2.5px solid var(--theme-border);
  border-radius: var(--radius-md);
  padding: 8px 10px;
}

.weekly-challenge h3 {
  font-family: var(--theme-title-font);
  font-size: 0.85rem;
  color: var(--theme-primary);
  margin-bottom: 6px;
}

.week-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3px;
}

.week-day {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-main);
  padding: 3px 6px;
  background: white;
  border-radius: 4px;
}

.week-day .day-label {
  font-weight: 900;
  color: var(--theme-primary);
  white-space: nowrap;
  min-width: 20px;
}

.week-day .day-check {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--border-color);
}

/* ========== 第三行：成就树 + 家长寄语 ========== */
.board-third-row {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 10px;
}

.achievement-tree {
  background: var(--theme-card-bg);
  border: 2.5px solid var(--theme-border);
  border-radius: var(--radius-md);
  padding: 8px 10px;
}

.achievement-tree h3 {
  font-family: var(--theme-title-font);
  font-size: 0.85rem;
  color: var(--theme-primary);
  margin-bottom: 6px;
}

.tree-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
}

.tree-node {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 6px;
  background: white;
  border-radius: 6px;
  border: 1.5px solid var(--theme-border);
}

.tree-node .tree-icon { font-size: 0.9rem; }

.parent-message {
  background: var(--theme-card-bg);
  border: 2.5px solid var(--theme-border);
  border-radius: var(--radius-md);
  padding: 8px 10px;
}

.parent-message h3 {
  font-family: var(--theme-title-font);
  font-size: 0.85rem;
  color: var(--theme-primary);
  margin-bottom: 6px;
}

.message-content {
  font-family: var(--theme-hand-font);
  font-size: 0.85rem;
  color: var(--text-main);
  padding: 8px;
  background: white;
  border-radius: 8px;
  border-left: 3px solid var(--theme-accent);
  line-height: 1.4;
}

.signature-line {
  margin-top: 8px;
  text-align: right;
  font-size: 0.75rem;
  color: var(--text-light);
  border-top: 1px dotted var(--theme-border);
  padding-top: 4px;
}

/* ========== 打印适配 ========== */
@media print {
  body { background: white !important; color: black !important; }
  .control-panel { display: none !important; }
  .preview-container { margin: 0 !important; padding: 0 !important; width: 100% !important; height: auto !important; }
  .gameboard-paper {
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 8mm 6mm !important;
    width: 210mm !important;
    height: auto !important;
    min-height: 297mm !important;
    page-break-after: avoid;
    page-break-before: avoid;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}
