/* ===== 祝福工具样式 ===== */
:root {
  --bl-ratio: 3/4;
  --bl-bg: #ffffff;
  --bl-bg-img: none;
  --bl-bg-fit: cover;

  --bl-top-size: 64px;
  --bl-top-y: 80px;

  --bl-bottom-size: 72px;
  --bl-bottom-y: 640px;
}

body {
  background: #f8fafc;
}

.app-container {
  display: flex;
  height: calc(100vh - 120px);
}

/* 左右排版：参数区在左(2/3)，预览区在右(1/3) */
.app-container {
  flex-direction: row;
}

/* 参数区：占左侧 2/3 */
aside {
  flex: 0 0 66.666%;
  width: 66.666%;
  border-right: 1px solid #e2e8f0;
  background: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.aside-header {
  padding: 14px 16px;
  font-weight: 800;
  font-size: 18px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 文案控制区域：左右并列 */
.text-controls-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.group {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.group-label {
  font-size: 11px;
  font-weight: 800;
  color: #64748b;
  margin-bottom: 10px;
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ctrl-row {
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ctrl-row:last-child {
  margin-bottom: 0;
}

.ctrl-row label {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}

.ctrl-row textarea,
.ctrl-row input[type="text"],
.ctrl-row select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.ctrl-row textarea:focus,
.ctrl-row input[type="text"]:focus,
.ctrl-row select:focus {
  border-color: #2563eb;
}

.ctrl-row input[type="range"] {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  -webkit-appearance: none;
}

.ctrl-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: #2563eb;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 4px rgba(0,0,0,0.1);
  cursor: pointer;
}

.btn-gen,
.btn-sub {
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 6px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 6px;
}

.btn-gen {
  background: #0f172a;
  color: #fff;
}

.btn-gen:hover {
  background: #334155;
}

.btn-gen:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-sub {
  background: #f1f5f9;
  color: #0f172a;
  border: 1px solid #e2e8f0;
}

.btn-sub:hover {
  background: #e2e8f0;
}

.btn-danger {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

.btn-danger:hover {
  background: #fee2e2;
}

/* 预览区：占右侧 1/3 */
main {
  flex: 0 0 33.333%;
  width: 33.333%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: #f8fafc;
  overflow: auto;
}

.stage-wrap {
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.bl-stage {
  width: 100%;
  aspect-ratio: var(--bl-ratio);
  background: var(--bl-bg);
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.12);
}

.bl-bg {
  position: absolute;
  inset: 0;
  background-image: var(--bl-bg-img);
  background-size: var(--bl-bg-fit);
  background-position: center;
  background-repeat: no-repeat;
  z-index: 1;
}

.bl-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, transparent 45%, rgba(0,0,0,0.18) 100%);
  z-index: 2;
  pointer-events: none;
}

.bl-text-wrap {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
}

#topWrap {
  top: 0;
}

/* 底部文字也用 top 定位，范围好用（0=顶） */
#bottomWrap {
  top: 0;
}

.bl-text {
  font-family: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Heiti SC", "SimHei", sans-serif;
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: 1px;
  text-align: center;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 92%;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

#topText {
  font-size: var(--bl-top-size);
  transform: translateY(var(--bl-top-y));
}

#bottomText {
  font-size: var(--bl-bottom-size);
  transform: translateY(var(--bl-bottom-y));
}

/* 极简爆款效果：超粗圆润字体 + 描边在下（不遮挡文字） + 柔和阴影 */
.bl-text {
  font-family: "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: 4px; /* 字间距稍大一些 */
  text-align: center;
  -webkit-font-smoothing: antialiased;
  position: relative;
  paint-order: stroke fill;
  stroke-linejoin: round; /* 描边转角圆润 */
  -webkit-text-stroke-linejoin: round;
}

.bl-text.boom-gold {
  color: #FFD700;
  -webkit-text-stroke: 12px #E11D48; /* 减轻红色的重度，使用更明亮的玫瑰红 */
  text-shadow: 0 6px 12px rgba(0,0,0,0.25);
}

.bl-text.boom-red {
  color: #FF3B3B;
  -webkit-text-stroke: 12px #FFE68A; /* 更浅的金色边线 */
  text-shadow: 0 6px 12px rgba(0,0,0,0.25);
}

.bl-text.boom-white {
  color: #ffffff;
  -webkit-text-stroke: 12px #FF7B7B; /* 略浅的红色描边 */
  text-shadow: 0 6px 12px rgba(0,0,0,0.25);
}

.bl-bg-img-src {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.bl-text.label-white {
  background: rgba(255,255,255,0.95);
  color: #111827;
  padding: 10px 26px;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
}

.bl-text.label-red {
  background: rgba(225,29,72,0.95);
  color: #ffffff;
  padding: 10px 26px;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(225,29,72,0.22);
}

/* 加载覆盖层 */
.bl-loading {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.9);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.loader {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #0f172a;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

/* 响应式 */
@media (max-width: 1200px) {
  .stage-wrap {
    max-width: 400px;
  }

  /* 文案控制区改为上下布局 */
  .text-controls-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 968px) {
  /* 小屏幕改回上下布局 */
  .app-container {
    flex-direction: column;
    height: auto;
  }
  aside {
    flex: 0 0 auto;
    width: 100%;
    min-height: auto;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
  }
  .scroll-area {
    max-height: 50vh;
  }
  main {
    flex: 1;
    width: 100%;
    min-height: 40vh;
    padding: 15px;
  }
  .stage-wrap {
    max-width: 100%;
  }
  .bl-stage {
    max-width: 520px;
  }

  /* 文案控制区改为上下布局 */
  .text-controls-row {
    grid-template-columns: 1fr;
  }
}