/* ============================================================
   traditional_converter v3.0 — 科技蓝 线性布局 响应式
   布局：工具标题 → 输入框 → 按钮行 → 输出框 → 使用说明
   响应式：
     电脑  ≥ 1024px — 按钮行横排，输入/输出框等高较大
     平板  768~1023px — 按钮稍小，布局不变
     手机  < 768px — 按钮竖向2列，底部操作栏 sticky
   ============================================================ */

/* ── CSS Variables ── */
.tc-wrap {
  --tc-blue:        #1677ff;
  --tc-blue-dark:   #0958d9;
  --tc-blue-light:  #e6f0ff;
  --tc-blue-bg:     #f0f6ff;
  --tc-blue-line:   #bbd6ff;
  --tc-mars:        #7c3aed;
  --tc-mars-dark:   #6d28d9;
  --tc-mars-light:  #ede9fe;
  --tc-mars-line:   #c4b5fd;
  --tc-green:       #52c41a;
  --tc-text:        #1a2233;
  --tc-sub:         #5a6a85;
  --tc-border:      #d0dff5;
  --tc-bg:          #f7faff;
  --tc-white:       #ffffff;
  --tc-radius:      10px;
  --tc-radius-sm:   6px;
  --tc-shadow:      0 2px 12px rgba(22,119,255,.09);
  --tc-trans:       all .2s ease;

  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei',
               'Segoe UI', sans-serif;
  color: var(--tc-text);
  box-sizing: border-box;
  max-width: 900px;
  margin: 0 auto;
  padding: 16px 10px;
}

.tc-wrap *, .tc-wrap *::before, .tc-wrap *::after {
  box-sizing: inherit;
}

/* ══════════════════════════════
   ① 工具标题
   ══════════════════════════════ */
.tc-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--tc-blue-light);
}
.tc-header-icon {
  flex-shrink: 0;
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--tc-blue) 0%, var(--tc-blue-dark) 100%);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #fff;
  box-shadow: 0 3px 10px rgba(22,119,255,.30);
}
.tc-header-title {
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--tc-text);
  line-height: 1.3;
}
.tc-header-sub {
  font-size: 0.79rem;
  color: var(--tc-sub);
  margin-top: 3px;
}

/* ══════════════════════════════
   ② 输入/输出面板
   ══════════════════════════════ */
.tc-panel {
  background: var(--tc-white);
  border: 1.5px solid var(--tc-border);
  border-radius: var(--tc-radius);
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
  box-shadow: var(--tc-shadow);
  margin-bottom: 14px;
}
.tc-panel:focus-within {
  border-color: var(--tc-blue);
  box-shadow: 0 0 0 3px rgba(22,119,255,.10), var(--tc-shadow);
}
.tc-panel-label {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px 7px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--tc-sub);
  background: var(--tc-bg);
  border-bottom: 1px solid var(--tc-border);
  user-select: none;
  letter-spacing: .02em;
}
/* 字符统计右对齐 */
.tc-char-count {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 400;
  color: #99aabb;
}
/* 小圆点 */
.tc-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tc-dot-blue  { background: var(--tc-blue); }
.tc-dot-green { background: var(--tc-green); }
.tc-dot-mars  { background: var(--tc-mars); }

/* 文本域 */
.tc-panel textarea {
  display: block;
  width: 100%;
  border: none;
  outline: none;
  resize: vertical;
  padding: 13px 15px;
  font-size: 1rem;
  line-height: 1.8;
  color: var(--tc-text);
  background: transparent;
  font-family: inherit;
}
.tc-panel-input textarea {
  min-height: 160px;
}
.tc-panel-output textarea {
  min-height: 160px;
}
.tc-panel textarea::placeholder {
  color: #b8c8dc;
}

/* 输出框不可编辑时鼠标默认 */
.tc-panel-output textarea {
  cursor: default;
}

/* 输出框火星文状态 */
.tc-panel-output.mode-mars {
  border-color: var(--tc-mars-line);
}
.tc-panel-output.mode-mars:focus-within {
  border-color: var(--tc-mars);
  box-shadow: 0 0 0 3px rgba(124,58,237,.10), var(--tc-shadow);
}
.tc-panel-output.mode-mars .tc-panel-label {
  background: var(--tc-mars-light);
  color: var(--tc-mars);
  border-bottom-color: var(--tc-mars-line);
}

/* ══════════════════════════════
   ③ 操作按钮行
   ══════════════════════════════ */
.tc-action-bar {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 10px;
  margin-bottom: 14px;
}

/* 按钮分组 */
.tc-btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
/* 右侧功能按钮推到右边 */
.tc-btn-group-right {
  margin-left: auto;
}

/* 通用按钮 */
.tc-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: 22px;
  border: 1.5px solid transparent;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--tc-trans);
  white-space: nowrap;
  line-height: 1;
}
.tc-btn:active {
  transform: scale(.97);
}

/* 按钮内图标（无背景色，与按钮文字同色） */
.tc-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px; height: 15px;
  flex-shrink: 0;
  color: inherit;
}

/* 主要转换按钮（蓝色） */
.tc-btn-primary {
  background: var(--tc-blue);
  border-color: var(--tc-blue);
  color: #fff;
  box-shadow: 0 2px 10px rgba(22,119,255,.28);
}
.tc-btn-primary .tc-btn-icon {
  background: rgba(255,255,255,.22);
  color: #fff;
}
.tc-btn-primary:hover {
  background: var(--tc-blue-dark);
  border-color: var(--tc-blue-dark);
  box-shadow: 0 4px 16px rgba(22,119,255,.35);
  transform: translateY(-1px);
}

/* 火星文按钮（复用蓝色主按钮样式） */
.tc-btn-mars {
  background: var(--tc-blue);
  border-color: var(--tc-blue);
  color: #fff;
  box-shadow: 0 2px 10px rgba(22,119,255,.28);
}
.tc-btn-mars:hover {
  background: var(--tc-blue-dark);
  border-color: var(--tc-blue-dark);
  box-shadow: 0 4px 16px rgba(22,119,255,.35);
  transform: translateY(-1px);
}

/* 复制按钮（蓝色描边） */
.tc-btn-copy {
  background: var(--tc-blue-light);
  border-color: var(--tc-blue);
  color: var(--tc-blue);
}
.tc-btn-copy:hover {
  background: var(--tc-blue);
  color: #fff;
  box-shadow: 0 2px 10px rgba(22,119,255,.25);
  transform: translateY(-1px);
}

/* 清除按钮（灰色描边） */
.tc-btn-clear {
  background: var(--tc-white);
  border-color: var(--tc-border);
  color: var(--tc-sub);
}
.tc-btn-clear:hover {
  border-color: #f5222d;
  color: #f5222d;
  background: #fff2f0;
  transform: translateY(-1px);
}

/* 提示文字 */
.tc-tip {
  font-size: 0.8rem;
  color: var(--tc-sub);
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
  flex-shrink: 0;
}
.tc-tip.show     { opacity: 1; }
.tc-tip.tc-tip-ok   { color: var(--tc-green); }
.tc-tip.tc-tip-warn { color: #faad14; }

/* ══════════════════════════════
   ⑤ 使用说明
   ══════════════════════════════ */
.tc-help {
  margin-top: 8px;
  padding: 16px 18px;
  background: var(--tc-blue-bg);
  border: 1px solid var(--tc-blue-line);
  border-radius: var(--tc-radius);
}
.tc-help h3 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--tc-blue-dark);
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.tc-help h3::before {
  content: '';
  display: inline-block;
  width: 4px; height: 14px;
  background: var(--tc-blue);
  border-radius: 2px;
  flex-shrink: 0;
}
.tc-help ul {
  margin: 0; padding: 0;
  list-style: none;
}
.tc-help ul li {
  font-size: 0.82rem;
  color: var(--tc-sub);
  line-height: 1.9;
  padding-left: 14px;
  position: relative;
}
.tc-help ul li::before {
  content: '·';
  position: absolute;
  left: 0;
  color: var(--tc-blue);
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1.7;
}
.tc-help ul li strong {
  color: var(--tc-text);
  font-weight: 600;
}

/* ════════════════════════════
   响应式 — 平板 768~1023px
   ════════════════════════════ */
@media (max-width: 1023px) {
  .tc-header-icon { width: 36px; height: 36px; font-size: 18px; }
  .tc-header-title { font-size: 1.08rem; }
  .tc-btn { padding: 8px 16px; font-size: 0.85rem; }
}

/* ════════════════════════════
   响应式 — 手机 < 768px
   ════════════════════════════ */
@media (max-width: 767px) {
  /* 手机端加内边距，避免贴边 */
  .tc-wrap {
    padding: 16px 10px;
  }
  .tc-header { margin-bottom: 14px; }
  .tc-header-title { font-size: 1rem; }
  .tc-header-sub   { font-size: 0.74rem; }

  .tc-panel-input textarea  { min-height: 120px; font-size: 0.95rem; }
  .tc-panel-output textarea { min-height: 120px; font-size: 0.95rem; }

  /* 按钮行竖向排列 */
  .tc-action-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  /* 三个转换按钮同一行，三等分 */
  .tc-btn-group {
    width: 100%;
    display: flex;
    gap: 8px;
  }
  .tc-btn-group .tc-btn {
    flex: 1;
    justify-content: center;
    padding: 9px 6px;
    font-size: 0.82rem;
  }
  /* 按钮内图标在手机端隐藏，节省空间 */
  .tc-btn-group .tc-btn-icon {
    display: none;
  }
  /* 复制+清除 并排，底部 sticky */
  .tc-btn-group-right {
    margin-left: 0;
    position: sticky;
    bottom: 0;
    background: var(--tc-white);
    padding: 8px 0 env(safe-area-inset-bottom, 8px);
    border-top: 1px solid var(--tc-border);
    z-index: 10;
    /* 取消grid，保持flex */
    display: flex !important;
  }
  .tc-btn-group-right .tc-btn {
    flex: 1;
    justify-content: center;
  }
  /* 提示隐藏（空间有限） */
  .tc-action-bar > .tc-tip { display: none; }

  .tc-help { padding: 12px 14px; }
  .tc-help ul li { font-size: 0.79rem; line-height: 1.8; }
}
