/* 云朵字体生成器 - 页面样式
   布局：顶部品牌栏 → 预览舞台（满宽） → 底部控制台（横向面板） */

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

:root {
  --primary: #0088FF;
  --primary-dark: #0062D6;
  --bg: #F4F6FA;
  --card-bg: #FFFFFF;
  --border: #E6E9F0;
  --text: #1D1D1F;
  --text-2nd: #86868B;
  --shadow-sm: 0 2px 12px rgba(17, 24, 39, 0.05);
  --shadow-md: 0 10px 30px rgba(17, 24, 39, 0.07);
  --radius: 18px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 420px at 12% -8%, rgba(0, 136, 255, 0.10), transparent 70%),
    radial-gradient(760px 400px at 96% 0%, rgba(162, 89, 255, 0.09), transparent 70%),
    linear-gradient(rgba(0, 136, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 136, 255, 0.035) 1px, transparent 1px);
  background-size: auto, auto, 28px 28px, 28px 28px;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 1560px;
  margin: 0 auto;
  padding: 20px 24px 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ================= 顶部品牌栏 ================= */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 4px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 46px; height: 46px;
  display: grid;
  place-items: center;
  font-size: 22px;
  border-radius: 14px;
  background: linear-gradient(135deg, #4FB0FF, #0A6CFF);
  box-shadow: 0 8px 20px rgba(0, 106, 255, 0.28);
}
.brand-text h1 { font-size: 19px; font-weight: 700; letter-spacing: 0.2px; }
.brand-text p { font-size: 12px; color: var(--text-2nd); margin-top: 3px; }
.ver-badge {
  font-size: 10.5px;
  font-weight: 600;
  color: #6B7A90;
  background: rgba(120, 140, 170, 0.12);
  border-radius: 20px;
  padding: 2.5px 8px;
  margin-left: 6px;
  vertical-align: 2px;
  letter-spacing: 0;
}

.btn {
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  transition: all 0.18s;
}
.btn:active { transform: scale(0.97); }
.btn-export {
  padding: 13px 28px;
  font-size: 14px;
  color: #fff;
  border-radius: 13px;
  background: linear-gradient(135deg, #46A6FF, #0066FF);
  box-shadow: 0 8px 20px rgba(0, 102, 255, 0.30);
  letter-spacing: 0.3px;
}
.btn-export:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(0, 102, 255, 0.36);
}
.btn-export:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 8px 20px rgba(0, 102, 255, 0.18);
}

/* ================= 卡片通用 ================= */
.card {
  background: var(--card-bg);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 16px 18px;
}

.title-icon {
  width: 24px; height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  border-radius: 7px;
  background: linear-gradient(135deg, #EAF4FF, #D9EBFF);
}

/* ================= 预览舞台 ================= */
.stage {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-md);
  padding: 14px 16px 16px;
}
.stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.toolbar { display: flex; gap: 6px; }
.chip {
  border: none;
  border-radius: 9px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  background: #EFF4FB;
  color: #5B6472;
  transition: all 0.16s;
}
.chip:hover { background: #E2ECFA; color: var(--primary); }
.chip.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 136, 255, 0.28);
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text-2nd);
}
.meta b { color: var(--text); font-weight: 700; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; }
.dot.ok { background: #30D158; box-shadow: 0 0 0 3px rgba(48, 209, 88, 0.15); }
.dot.err { background: #FF383C; box-shadow: 0 0 0 3px rgba(255, 56, 60, 0.15); }

.canvas-container {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 18px;
  transition: background 0.2s;
  box-shadow: inset 0 2px 20px rgba(0, 0, 0, 0.10);
}
/* 预览底色：白字/白云场景需要深色底才看得见 */
.canvas-container.bg-blue { background: linear-gradient(160deg, #2A8FE0 0%, #1668B4 100%); }
.canvas-container.bg-white { background: #ffffff; box-shadow: none; border-color: var(--border); }
.canvas-container.bg-grid {
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #F1F4F8 25%, transparent 25%),
    linear-gradient(-45deg, #F1F4F8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #F1F4F8 75%),
    linear-gradient(-45deg, transparent 75%, #F1F4F8 75%);
  background-size: 22px 22px;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0;
  box-shadow: none;
  border-color: var(--border);
}
#previewCanvas { max-width: 100%; max-height: 420px; min-width: 0; flex-shrink: 1; }

/* ================= 底部控制台 ================= */
.panels {
  display: grid;
  grid-template-columns: 1.02fr 1fr 1.45fr;
  gap: 16px;
  align-items: stretch;
}
.panel { display: flex; flex-direction: column; }
.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 14px;
}

/* ---- 文字输入 ---- */
textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 11px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #FAFBFD;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
textarea { resize: none; flex: 1; min-height: 84px; line-height: 1.5; }
textarea:focus, select:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(0, 136, 255, 0.10); }
.hint-line { font-size: 11.5px; color: var(--text-2nd); margin-top: 8px; line-height: 1.6; }

/* ---- 字体样式 ---- */
.field-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.field-row:last-child { margin-bottom: 0; }
.field-name {
  flex-shrink: 0;
  width: 62px;
  font-size: 12.5px;
  color: var(--text-2nd);
}
.field-row select { flex: 1; padding: 8px 10px; font-size: 13px; }

/* 字体问号提示 */
.field-name { display: inline-flex; align-items: center; gap: 5px; }
.help-tip {
  position: relative;
  width: 15px; height: 15px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #C9D2DE;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.help-tip:hover { background: var(--primary); }
.help-tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%) translateY(3px);
  width: max-content;
  max-width: 210px;
  padding: 7px 10px;
  border-radius: 8px;
  background: #333A45;
  color: #fff;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.5;
  text-align: left;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  z-index: 30;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}
.help-tip::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%) translateY(3px);
  border: 4px solid transparent;
  border-top-color: #333A45;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s;
  z-index: 30;
}
.help-tip.show::after, .help-tip.show::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.style-toggles { display: flex; gap: 6px; }
.style-btn {
  width: 38px; height: 32px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  background: #FAFBFD;
  color: var(--text-2nd);
  font-size: 15px;
  font-weight: 800;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s;
}
.style-btn i { font-style: italic; }
.style-btn:hover { border-color: #C9DFFF; color: var(--primary); }
.style-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 136, 255, 0.30);
}

.ctrl-slider { display: flex; align-items: center; gap: 10px; flex: 1; }
.ctrl-val {
  min-width: 40px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  background: #EAF3FF;
  border-radius: 7px;
  padding: 3px 0;
}

/* 自定义滑杆 */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, #B9DCFF, #E4EEF9);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 17px; height: 17px;
  border-radius: 50%;
  background: #fff;
  border: 3.5px solid var(--primary);
  box-shadow: 0 2px 8px rgba(0, 102, 255, 0.35);
  cursor: pointer;
  transition: transform 0.12s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.08); }
input[type="range"]::-moz-range-thumb {
  width: 15px; height: 15px;
  border-radius: 50%;
  background: #fff;
  border: 3.5px solid var(--primary);
  cursor: pointer;
}

/* ---- 配色 ---- */
.color-cols { display: flex; flex-direction: column; gap: 12px; }
.color-block {
  display: grid;
  grid-template-columns: 176px 1fr;
  grid-template-rows: auto auto;
  column-gap: 16px;
  align-items: center;
}
.color-block .field-label { grid-column: 1; grid-row: 1; margin-bottom: 5px; }
.color-block .color-line { grid-column: 1; grid-row: 2; }
.color-block .swatches { grid-column: 2; grid-row: 1 / span 2; margin-top: 0; }

.field-label {
  display: block;
  font-size: 12px;
  color: var(--text-2nd);
}
.color-line { display: flex; gap: 8px; align-items: center; }
.color-line input[type="color"] {
  width: 46px;
  height: 34px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  padding: 2px;
  background: #fff;
  cursor: pointer;
}
.color-text {
  flex: 1;
  min-width: 0;
  padding: 8px 9px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  font-size: 12.5px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  color: var(--text);
  background: #FAFBFD;
  outline: none;
}
.color-text:focus { border-color: var(--primary); background: #fff; }

/* 常见颜色快选（7 色一行，固定尺寸） */
.swatches { display: flex; flex-wrap: wrap; gap: 7px; }
.swatch {
  width: 34px;
  height: 34px;
  border: none;
  padding: 0;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  transition: transform 0.12s;
}
.swatch:hover { transform: translateY(-2px) scale(1.06); }
.swatch.active { box-shadow: 0 0 0 2px var(--primary), inset 0 0 0 1px rgba(0, 0, 0, 0.12); }

/* 快捷配色：同心圆，外圈=云朵色，内圈=字体色 */
.palette-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
}
.palette-note { font-size: 11px; color: var(--text-2nd); }

.color-dots { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-top: 10px; justify-items: start; }
.color-dot {
  width: 100%;
  max-width: 34px;
  aspect-ratio: 1 / 1;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--cloud);
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.10), 0 2px 6px rgba(0, 0, 0, 0.10);
  cursor: pointer;
  transition: transform 0.12s;
  display: grid;
  place-items: center;
}
.color-dot::after {
  content: '';
  width: 40%; height: 40%;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.color-dot:hover { transform: scale(1.12); }

/* ================= 页脚 ================= */
.footer {
  text-align: center;
  font-size: 11.5px;
  color: #A6ADB8;
  padding-top: 2px;
}
.footer-sep { margin: 0 6px; }
.footer-mail {
  color: #4D94FF;
  text-decoration: none;
}
.footer-mail:hover { text-decoration: underline; }

/* ================= 响应式 ================= */
@media (max-width: 1180px) {
  .panels { grid-template-columns: 1fr 1fr; }
  .panel-color { grid-column: 1 / -1; }
  #previewCanvas { max-height: 320px; }
}

@media (max-width: 760px) {
  .app { padding: 14px 12px 20px; gap: 12px; }
  .topbar { flex-wrap: wrap; }
  .brand-text h1 { font-size: 17px; }
  .btn-export { width: 100%; padding: 13px; }
  .panels { grid-template-columns: 1fr; gap: 12px; }
  .panel-color { grid-column: auto; }
  #previewCanvas { max-height: 240px; }
  .canvas-container { min-height: 200px; padding: 12px; }

  /* 配色改回上下排 */
  .color-block {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    row-gap: 8px;
  }
  .color-block .field-label { grid-column: 1; grid-row: 1; }
  .color-block .color-line { grid-column: 1; grid-row: 2; }
  .color-block .swatches { grid-column: 1; grid-row: 3; }
  .field-name { width: 58px; }
}
