:root {
    --bg-dark: #0a0b0d; --bg-card: #15171a; --bg-hover: #1f2226;
    --primary: #6366f1; --primary-light: #818cf8; --accent: #f59e0b; --danger: #ef4444; --success: #10b981;
    --text: #f1f5f9; --text-dim: #94a3b8; --border: #2a2d33;
    --radius: 14px; --shadow: 0 8px 30px rgba(0,0,0,0.4);
  }
  * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
  body { margin: 0; font-family: system-ui, -apple-system, 'PingFang SC', sans-serif; background: var(--bg-dark); color: var(--text); min-height: 100vh; overflow-x: hidden; padding-bottom: 80px; }

  /* 导航栏 */
  .bottom-nav { position: fixed; bottom: 0; left: 0; width: 100%; background: var(--bg-card); border-top: 1px solid var(--border); display: flex; justify-content: space-around; padding: 8px 0 12px; z-index: 100; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .nav-item { flex: 1; text-align: center; color: var(--text-dim); font-size: 11px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; transition: 0.2s; }
  .nav-item.active { color: var(--primary-light); font-weight: bold; }
  .nav-icon { font-size: 20px; }

  /* 视图容器 */
  .view-container { display: none; padding: 16px; max-width: 900px; margin: 0 auto; animation: fadeIn 0.3s ease; }
  .view-container.active { display: block; }
  @keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

  .panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 20px; box-shadow: var(--shadow); }
  .panel-title { margin: 0 0 15px; font-size: 17px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); padding-bottom: 10px; }

  /* 画板区域 */
  .canvas-wrapper { background: #fff; border-radius: 10px; overflow: hidden; touch-action: none; margin-bottom: 12px; position: relative; }
  #drawCanvas { display: block; width: 100%; height: auto; cursor: crosshair; }
  .toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
  .tool-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-hover); color: var(--text); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; font-size: 18px; }
  .tool-btn.active { background: var(--primary); border-color: var(--primary-light); }
/* 1. 基础圆圈和阴影样式 */
.color-swatch {
    width: 32px;         /* 确保圆圈的宽度，如果html里已经定义了可以不写 */
    height: 32px;        /* 确保圆圈的高度 */
    border-radius: 50%;  /* 🌟 核心：强制变成完美正圆 */
    cursor: pointer;
    transition: all 0.2s ease; /* 丝滑过渡动画：手放上去和点击时会很软 */

    /* 🌟 核心：高级柔和阴影 (往下沉 3px，模糊半径 8px，12% 的黑色透明度) */
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);

    /* 顺便加个极浅的白色半透明边框，让颜色块在白色背景下也清晰可见 */
    border: 2px solid rgba(255, 255, 255, 0.6);
}

/* 2. 鼠标悬停（Hover）时的微动效 */
.color-swatch:hover {
    transform: scale(1.1); /* 稍微放大一点点 */
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.18); /* 悬浮时阴影变大，感觉漂浮起来了 */
}

/* 3. 选中（Active）状态的超级高亮 */
.color-swatch.active {
    transform: scale(1.15); /* 保持放大状态 */
    /* 🌟 绝妙的三层复合阴影：一层白边隔开 + 一层彩色外发光 */
    box-shadow: 0 0 0 3px #fff, 0 4px 12px rgba(139, 92, 246, 0.4);
}

  /* 输入与按钮 - 核心修复区域 */
  textarea, input[type="text"], .api-input, .func-input {
    width: 100%; padding: 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-hover); color: var(--text); font-size: 15px; outline: none; resize: none; font-family: inherit;
    box-sizing: border-box; /* 确保 padding 不撑开容器 */
  }

  /* 针对长文本输入框的特定微调 */
  #prompt-input {
    min-height: 120px;
    padding-bottom: 50px !important; /* 🌟 为右下角按钮留出垂直安全空间 */
  }

  #doodle-prompt {
    padding-right: 50px !important; /* 涂鸦模式输入框为右侧按钮留空 */
  }

  .prompt-wrapper { position: relative; margin-bottom: 16px; }

  .prompt-btn-group {
    position: absolute;
    right: 10px;
    bottom: 10px; /* 🌟 锁定在右下角，不再使用 top: 10px */
    display: flex;
    gap: 6px;
    z-index: 10;
  }

  .magic-btn { background: var(--accent); color: #000; border: none; border-radius: 8px; width: 32px; height: 32px; cursor: pointer; display: flex; align-items: center; justify-content: center; }

  .action-btn, .func-start-btn { width: 100%; padding: 14px; border: none; border-radius: 10px; font-weight: bold; cursor: pointer; font-size: 16px; background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white; transition: 0.2s; }
  .action-btn:disabled, .func-start-btn:disabled { opacity: 0.6; cursor: not-allowed; }
  .func-start-btn.teaching { background: linear-gradient(135deg, #f59e0b, #f97316); }
  .func-start-btn.story { background: linear-gradient(135deg, #8b5cf6, #ec4899); }

  .upload-box { border: 2px dashed var(--border); border-radius: 10px; padding: 15px; text-align: center; background: var(--bg-hover); cursor: pointer; position: relative; min-height: 80px; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
  .upload-box img { max-height: 120px; border-radius: 8px; }
  .clear-btn { position: absolute; top: -8px; right: -8px; background: var(--danger); color: white; border: none; border-radius: 50%; width: 24px; height: 24px; font-weight: bold; cursor: pointer; z-index: 10; }

  /* 风格/尺寸选择 */
  .btn-group { margin-bottom: 16px; }
  .group-label { font-size: 14px; color: var(--text-dim); margin-bottom: 8px; font-weight: bold; }
  .btn-container { display: flex; flex-wrap: wrap; gap: 8px; }
  .opt-btn { padding: 8px 14px; background: var(--bg-hover); color: var(--text-dim); border: 1px solid var(--border); border-radius: 8px; font-size: 13px; cursor: pointer; transition: 0.2s; }
  .opt-btn.active { background: var(--primary); color: white; border-color: var(--primary-light); }
  #style-btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 10px; }
  .style-pic-btn { aspect-ratio: 1; border-radius: 10px; background-size: cover; background-position: center; border: 2px solid transparent; cursor: pointer; position: relative; overflow: hidden; }
  .style-pic-btn.active { border-color: var(--primary-light); box-shadow: 0 0 12px rgba(99,102,241,0.4); }
  .style-pic-label { position: absolute; bottom: 0; left: 0; width: 100%; padding: 4px; background: rgba(0,0,0,0.6); color: #fff; font-size: 11px; text-align: center; }

  /* 尺寸比例按钮样式 */
  .size-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
    gap: 8px; padding: 10px; min-width: 64px; height: 72px;
  }
  .shape-icon { border: 2px solid currentColor; border-radius: 3px; transition: all 0.2s ease; }
  .size-btn.active .shape-icon { background: currentColor; }

  /* ✨ 酷炫流光进度条 & 动态提示语 */
  .prog-wrap {
      height: 14px; /* 加粗一点，更有存在感 */
      background: rgba(0, 0, 0, 0.3);
      border-radius: 10px;
      margin-top: 15px;
      overflow: hidden;
      display: none;
      box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
  }

  .prog-fill {
      height: 100%;
      width: 0%;
      /* 核心：三色梦幻渐变 */
      background: linear-gradient(90deg, #8b5cf6, #ec4899, #f59e0b, #8b5cf6);
      background-size: 200% 100%;
      border-radius: 10px;
      transition: width 0.5s ease;
      /* 核心：让渐变色动起来，并且加一个发光的阴影 */
      animation: shimmer 2s infinite linear;
      box-shadow: 0 0 12px rgba(236, 72, 153, 0.7);
  }

  @keyframes shimmer {
      0% { background-position: 100% 0; }
      100% { background-position: -100% 0; }
  }

  /* 呼吸闪烁的提示文字 */
  .loading-tips {
      text-align: center;
      font-size: 13px;
      color: var(--text-dim);
      margin-top: 10px;
      font-weight: bold;
      display: none;
      animation: pulseText 1.5s infinite;
  }

  @keyframes pulseText {
      0%, 100% { opacity: 0.6; }
      50% { opacity: 1; color: #ec4899; }
  }

  #toast-container { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
  .toast { background: var(--bg-card); border: 1px solid var(--border); color: var(--text); padding: 10px 20px; border-radius: 20px; font-size: 14px; animation: toastIn 0.3s forwards; }
  .toast.error { border-left: 4px solid var(--danger); }
  .toast.success { border-left: 4px solid var(--success); }
  @keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

  /* 教学/故事卡片 */
  .step-card, .scene-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 15px; overflow: hidden; animation: fadeIn 0.5s forwards; }
  .step-header { display: flex; align-items: center; gap: 10px; padding: 12px; background: rgba(245,158,11,0.1); border-bottom: 1px solid var(--border); }
  .step-number { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #000; font-weight: bold; display: flex; align-items: center; justify-content: center; }
  .step-guide { padding: 14px; background: var(--bg-hover); }
  .step-guide-text { font-size: 14px; line-height: 1.6; color: var(--text-dim); }
  .story-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 15px; }
  .scene-img-box { aspect-ratio: 16/9; background: #000; position: relative; overflow: hidden; }
  .scene-img-box img { width: 100%; height: 100%; object-fit: cover; }
  .scene-text-box { padding: 12px; border-top: 1px solid var(--border); }
  .scene-num { position: absolute; top: -10px; left: 8px; background: var(--primary); color: white; width: 22px; height: 22px; border-radius: 50%; font-size: 12px; display: flex; align-items: center; justify-content: center; }

  /* 个人中心 & 模态框 */
  .profile-header { text-align: center; padding: 20px 0; }
  .avatar { font-size: 50px; background: var(--bg-hover); border-radius: 50%; width: 80px; height: 80px; line-height: 80px; margin: 0 auto 10px; }
  .vip-card { background: linear-gradient(135deg, #f59e0b, #ef4444); border-radius: 15px; padding: 20px; color: white; text-align: center; margin: 15px 0; box-shadow: 0 8px 20px rgba(239,68,68,0.3); }
  .modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); z-index: 200; display: none; align-items: center; justify-content: center; padding: 20px; }
  .modal-content { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 24px; width: 100%; max-width: 320px; position: relative; }
  .result-modal { background: rgba(0,0,0,0.95); z-index: 300; flex-direction: column; }
  #result-img { max-width: 100%; max-height: 75vh; border-radius: 10px; margin-bottom: 20px; }

  .job-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
  .job-prompt { font-size: 13px; color: var(--text-dim); margin-bottom: 8px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
  .grid { display: grid; gap: 8px; }
  .card-action-btn { padding: 8px; background: var(--bg-hover); color: var(--text); border: 1px solid var(--border); border-radius: 6px; font-size: 13px; cursor: pointer; flex: 1; }

  /* 个人美德/勋章相关已合并到 profile-header 或单独面板 */

  /* 闪光卡专属样式 */
  .flash-card-wrapper { background: linear-gradient(180deg, #fdf6e3, #fff8e1); border-radius: 16px; padding: 20px; text-align: center; box-shadow: 0 10px 30px rgba(245,158,11,0.2); position: relative; overflow: hidden; margin-bottom: 20px; }
  .flash-header { font-size: 18px; font-weight: bold; color: #d97706; margin-bottom: 10px; letter-spacing: 1px; font-family: 'PingFang SC', sans-serif; }
  .flash-card-wrapper img { width: 100%; max-height: 400px; object-fit: contain; border-radius: 10px; background: #fff; margin: 10px 0; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
  .flash-tag { display: inline-block; background: linear-gradient(135deg, #f59e0b, #f97316); color: #fff; padding: 6px 16px; border-radius: 20px; font-size: 15px; font-weight: bold; margin: 10px 0; box-shadow: 0 4px 10px rgba(245,158,11,0.4); }
  .flash-story { font-size: 15px; line-height: 1.6; color: #5c4b37; background: rgba(255,255,255,0.8); padding: 14px; border-radius: 8px; margin: 10px 0; font-style: italic; text-align: left; }
  .flash-footer { font-size: 11px; color: #a3a3a3; margin-top: 12px; letter-spacing: 0.5px; }

  /* 隐私勾选框 */
  .privacy-wrap { margin-top: 15px; font-size: 12px; color: #94a3b8; display: flex; align-items: center; justify-content: center; gap: 5px; }
  .privacy-wrap input { width: 14px; height: 14px; cursor: pointer; }
  .privacy-wrap a { color: var(--primary-light); text-decoration: none; }

  @media (max-width: 768px) {
    .app-container { grid-template-columns: 1fr; }
    .toolbar { justify-content: center; }
  }

  /* =========================================
   🌟 首页大厅与金刚区专属样式
   ========================================= */
  .dashboard-section { margin-bottom: 25px; }
  .dashboard-title { font-size: 15px; font-weight: bold; margin-bottom: 12px; color: var(--text-dim); display: flex; align-items: center; gap: 6px;}
  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }

  .kingkong-card {
    background: var(--bg-card); border-radius: 16px; padding: 22px 15px;
    text-align: center; border: 1px solid var(--border); cursor: pointer;
    transition: 0.2s; box-shadow: var(--shadow);
  }
  .kingkong-card:active { transform: scale(0.95); background: var(--bg-hover); }
  .kk-icon { font-size: 38px; margin-bottom: 10px; }
  .kk-title { font-size: 16px; font-weight: bold; color: var(--text); margin-bottom: 4px; }
  .kk-desc { font-size: 11px; color: var(--text-dim); }

  /* =========================================
   🔙 子页面返回头部 & 标签页切换 (AI导师用)
   ========================================= */
  .sub-page-header { display: flex; align-items: center; margin-bottom: 20px; font-size: 18px; font-weight: bold; }
  .back-btn { margin-right: 12px; cursor: pointer; font-size: 18px; color: var(--text-dim); background: var(--bg-hover); width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }

  .tab-nav { display: flex; background: var(--bg-hover); padding: 5px; border-radius: 12px; margin-bottom: 20px; }
  .tab-item { flex: 1; text-align: center; padding: 10px; font-size: 14px; border-radius: 8px; cursor: pointer; color: var(--text-dim); transition: 0.2s; }
  .tab-item.active { background: var(--bg-card); color: var(--text); font-weight: bold; border: 1px solid var(--border); box-shadow: var(--shadow); }

  /* =========================================
   ✨ 凸出的底部导航中心按钮 (闪光卡)
   ========================================= */
  .nav-center { flex: 1; display: flex; flex-direction: column; align-items: center; position: relative; margin-top: -25px; z-index: 101; cursor: pointer; }
  .center-circle { width: 55px; height: 55px; background: linear-gradient(135deg, var(--accent), var(--danger)); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 26px; box-shadow: 0 5px 15px rgba(245, 158, 11, 0.4); border: 4px solid var(--bg-dark); transition: 0.3s; }
  .nav-center:active .center-circle { transform: scale(0.9); }
  .center-text { color: var(--accent); font-size: 10px; margin-top: 4px; font-weight: bold; }

  /* ==========================================
   🛡️ 合规底部备案号样式
   ========================================== */
.icp-footer {
    text-align: center;
    padding: 20px 0 90px 0; /* 底部留出 90px 空白，防止被固定的导航栏挡住 */
    font-size: 12px;
}

.icp-footer a {
    color: #94a3b8; /* 高级的浅灰色 */
    text-decoration: none; /* 去掉默认的丑陋下划线 */
    transition: color 0.2s ease;
}

.icp-footer a:hover {
    color: #64748b; /* 鼠标点按时颜色稍微加深 */
}

