 * { margin: 0; padding: 0; box-sizing: border-box; }

  body {
    font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    background-attachment: fixed;
    color: #fff;
    min-height: 100vh;
    padding: 24px 16px 60px;
    overflow-x: hidden;
  }

  /* ---------- 星空背景 ---------- */
  .stars, .stars::after {
    content: "";
    position: fixed;
    /* Chrome 61 不支持 inset 简写，展开写保证基线可用 */
    top: -50%; right: -50%; bottom: -50%; left: -50%;
    background-image:
      radial-gradient(2px 2px at 20% 30%, #fff, transparent),
      radial-gradient(1px 1px at 65% 15%, #dcd6ff, transparent),
      radial-gradient(2px 2px at 45% 65%, #fff, transparent),
      radial-gradient(1px 1px at 85% 45%, #c9c2ff, transparent),
      radial-gradient(1px 1px at 12% 82%, #fff, transparent),
      radial-gradient(2px 2px at 78% 88%, #e5e0ff, transparent);
    background-size: 220px 220px;
    opacity: .35;
    pointer-events: none;
    z-index: 0;
    animation: twinkle 6s ease-in-out infinite alternate;
  }
  .stars::after {
    background-size: 340px 340px;
    opacity: .45;
    animation-duration: 9s;
    animation-direction: alternate-reverse;
  }
  @keyframes twinkle {
    from { opacity: .18; transform: translateY(0); }
    to   { opacity: .5;  transform: translateY(-12px); }
  }

  .container {
    max-width: 700px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
  }

  h1 {
    text-align: center;
    font-size: 2rem;                        /* Chrome 61 基线回退 */
    font-size: clamp(1.7rem, 6vw, 2.3rem);  /* 现代浏览器按视口缩放 */
    margin: 18px 0 8px;
    letter-spacing: 2px;
    background: linear-gradient(90deg, #a18cd1, #6a11cb, #2575fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }
  .subtitle {
    text-align: center;
    color: #b3b0d1;
    margin-bottom: 28px;
    font-size: .92rem;
  }

  .card {
    background: rgba(255,255,255,.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,.25);
  }
  /* 不支持毛玻璃时加深卡片底色，保证文字可读（Chrome 61 基线回退） */
  @supports not ((backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px))) {
    .card { background: rgba(45,38,84,.72); }
  }

  label {
    display: block;
    margin-bottom: 8px;
    color: #d1cfe8;
    font-size: .95rem;
  }

  textarea, input[type="text"], select {
    width: 100%;
    padding: 14px 15px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,.2);
    background: rgba(0,0,0,.25);
    color: #fff;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
  }
  textarea { min-height: 130px; resize: vertical; line-height: 1.6; margin-bottom: 18px; }
  textarea::placeholder { color: #8b88a8; }
  textarea:focus, input[type="text"]:focus, select:focus {
    border-color: #8b7bff;
    box-shadow: 0 0 0 3px rgba(139,123,255,.18);
  }
  select {
    margin-bottom: 22px;
    background: rgba(30,25,60,.92);
    cursor: pointer;
  }
  select option { background: #1e193c; color: #fff; }

  .btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(90deg, #6a11cb, #2575fc);
    color: #fff;
    font-size: 1.05rem;
    font-family: inherit;
    cursor: pointer;
    transition: transform .2s, opacity .2s, box-shadow .2s;
    box-shadow: 0 6px 20px rgba(106,17,203,.35);
  }
  .btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(106,17,203,.45); }
  .btn:disabled { opacity: .5; cursor: not-allowed; }

  /* ---------- 加载动画 ---------- */
  .loading { text-align: center; padding: 40px 20px; display: none; }
  .loading.show { display: block; animation: fadeIn .3s ease; }
  .spinner-wrap { position: relative; width: 76px; height: 76px; margin: 0 auto 18px; }
  .spinner {
    width: 76px; height: 76px;
    border: 4px solid rgba(255,255,255,.15);
    border-top-color: #a18cd1;
    border-right-color: #2575fc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
  }
  .spinner-wrap::after {
    content: "🌙";
    position: absolute; top: 0; right: 0; bottom: 0; left: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.7rem;
    animation: breathe 2.2s ease-in-out infinite;
  }
  @keyframes spin { to { transform: rotate(360deg); } }
  @keyframes breathe { 0%,100% { opacity: .5; transform: scale(.9); } 50% { opacity: 1; transform: scale(1.1); } }
  .loading p { color: #cfc9f0; letter-spacing: 1px; }

  .result { display: none; }
  .result.show { display: block; animation: fadeIn .5s ease; }
  @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

  .story-text {
    line-height: 1.9;
    font-size: 1.03rem;
    color: #eae8f5;
    white-space: pre-wrap;
    word-break: break-word;
  }

  .img-box {
    margin-top: 20px;
    border-radius: 15px;
    overflow: hidden;
    background: rgba(0,0,0,.25);
    border: 1px solid rgba(255,255,255,.12);
    display: none;
  }
  .img-box.show { display: block; }
  .dream-img { width: 100%; display: block; }
  .img-skeleton {
    height: 200px;
    display: flex; align-items: center; justify-content: center;
    color: #9d99bd; font-size: .9rem;
    background: linear-gradient(100deg, rgba(255,255,255,.04) 30%, rgba(255,255,255,.11) 50%, rgba(255,255,255,.04) 70%);
    background-size: 220% 100%;
    animation: shimmer 1.4s infinite linear;
  }
  @keyframes shimmer { from { background-position: 180% 0; } to { background-position: -80% 0; } }
  .img-actions { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; font-size: .8rem; color: #9d99bd; }
  /* 用 margin 替代 flex gap，兼容 Chrome 61 */
  .img-actions > * + * { margin-left: 10px; }
  .img-actions a { color: #a18cd1; text-decoration: none; }
  .img-actions a:hover { text-decoration: underline; }

  /* 负边距 + 子项 margin 替代 flex gap，兼容 Chrome 61 */
  .btn-group { display: flex; margin: 20px -6px 0; flex-wrap: wrap; }
  .btn-small {
    flex: 1 1 140px;
    margin: 0 6px 12px;
    padding: 12px;
    border: 1px solid rgba(255,255,255,.3);
    border-radius: 10px;
    background: rgba(255,255,255,.1);
    color: #fff;
    cursor: pointer;
    font-size: .95rem;
    font-family: inherit;
    transition: background .2s;
  }
  .btn-small:hover { background: rgba(255,255,255,.2); }

  .error {
    color: #ffb3b3;
    background: rgba(255,80,80,.12);
    border: 1px solid rgba(255,120,120,.3);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 20px;
    font-size: .92rem;
    line-height: 1.6;
    word-break: break-word;
    display: none;
  }
  .error.show { display: block; }

  /* ---------- Toast ---------- */
  .toast {
    position: fixed;
    left: 50%;
    bottom: 40px;
    transform: translate(-50%, 20px);
    background: rgba(30,25,60,.96);
    border: 1px solid rgba(255,255,255,.2);
    color: #fff;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: .92rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s, transform .25s;
    z-index: 99;
  }
  .toast.show { opacity: 1; transform: translate(-50%, 0); }

  @media (max-width: 480px) {
    body { padding: 16px 12px 40px; }
    .card { padding: 18px; border-radius: 16px; }
  }
  /* ==================== 炫酷 Logo 样式 ==================== */

/* 1. Logo 整体容器：居中对齐，并加上梦幻的紫色呼吸发光效果 */
.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
    /* 给整个 Logo 加上一层淡淡的紫色霓虹光晕 */
    filter: drop-shadow(0 0 15px rgba(168, 85, 247, 0.5)); 
}

/* 2. 月亮图标：变大，并加上“3D 悬浮”动画 */
.logo-icon {
    /* SVG 必须给明确宽高，否则 Chrome 会按默认 300x150 渲染 */
    width: 2.2rem;
    height: 2.2rem;
    /* 未指定 fill 时 SVG 默认黑色，深色背景上看不见 */
    fill: #c084fc;
    margin-right: 12px; /* 替代 flex gap，兼容 Chrome 61 */
    display: inline-block;
    animation: float 3s ease-in-out infinite; 
}

/* 3. “绘梦”文字：变成超好看的紫蓝色渐变字 */
.logo-text {
    font-size: 2.6rem;
    font-weight: 800;
    margin: 0;
    /* 渐变色魔法：从紫色渐变到蓝色 */
    background: linear-gradient(135deg, #c084fc, #60a5fa);
    background-clip: text;              /* 标准属性 */
    -webkit-background-clip: text;      /* Chrome 61 需前缀 */
    -webkit-text-fill-color: transparent;
    letter-spacing: 2px; /* 字间距稍微拉开一点，更大气 */
}

/* 4. 副标题：稍微变淡，更有高级感 */
.logo-subtitle {
    text-align: center;
    color: rgba(255, 255, 255, 0.6); /* 半透明白色 */
    font-size: 0.95rem;
    margin-top: 8px;
    margin-bottom: 30px;
    letter-spacing: 1px;
}

/* 5. 悬浮动画定义：让月亮上下缓缓漂浮 */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-8px); /* 往上飘 8 像素 */
    }
}
