/* ==========================================================================
   Scratch 创作学习空间 · 设计系统 Warm Pastel Aurora
   暖白底 + 五色粉彩 + 有机光斑 + 胶囊圆角 + 弹性动效
   ========================================================================== */

:root {
  /* ---------- 底色 ---------- */
  --cream:        #FFFCF7;
  --surface:      #FFFFFF;
  --surface-alt:  #FBF7F0;

  /* ---------- 文字 ---------- */
  --ink:          #2E2A3B;
  --ink-soft:     #4A4459;
  --muted:        #7A7489;
  --soft:         #A8A2B8;

  /* ---------- 线条 ---------- */
  --line:         #EDE8F0;

  /* ---------- 品牌色（五色粉彩，明度对齐） ---------- */
  --coral:        #FF6B4A;
  --coral-dark:   #E85533;
  --mint:         #2FD3BF;
  --lemon:        #FFC93C;
  --sky:          #4A9EFF;
  --lilac:        #A78BFA;
  --peach:        #FFB59E;

  /* ---------- 柔底 ---------- */
  --coral-soft:   #FFE5E8;
  --mint-soft:    #D9F7F2;
  --lemon-soft:   #FFF3CC;
  --sky-soft:     #E3F0FF;
  --lilac-soft:   #EDE7FF;

  /* ---------- 圆角 ---------- */
  --r-sm:         14px;
  --r-md:         24px;
  --r-lg:         32px;
  --r-xl:         40px;
  --r-pill:       999px;

  /* ---------- 阴影（扩散型，带色彩倾向） ---------- */
  --shadow-soft:  0 12px 32px -12px rgba(46,42,59,.16);
  --shadow-card:  0 18px 44px -18px rgba(46,42,59,.22);
  --shadow-coral: 0 10px 24px -8px rgba(255,107,74,.55);

  /* ---------- 字体 ---------- */
  --sans: "Quicksand", -apple-system, BlinkMacSystemFont, "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", sans-serif;

  /* ---------- 动效 ---------- */
  --ease-spring:  cubic-bezier(.34,1.56,.64,1);
  --ease-out:     cubic-bezier(.2,.7,.3,1);
  --dur-fast:     .3s;
  --dur-base:     .5s;
  --dur-slow:     .8s;
}

/* ==========================================================================
   基础
   ========================================================================== */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--cream);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: .2px; }
p { margin: 0; }
button, input, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--sky); text-decoration: none; }

::selection { background: var(--lemon-soft); color: var(--ink); }

/* 滚动条 */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: var(--r-pill);
  border: 3px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--soft); background-clip: content-box; }

/* ==========================================================================
   背景层：Aurora Blobs（低透明度径向光斑，不用线性渐变铺屏）
   ========================================================================== */

.aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.aurora span {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .5;
  will-change: transform;
}

.aurora .b1 {
  width: 46vw; height: 46vw;
  min-width: 380px; min-height: 380px;
  top: -12%; left: -8%;
  background: radial-gradient(circle at 30% 30%, var(--peach), rgba(255,181,158,0) 68%);
  animation: drift-a var(--dur-slow) var(--ease-out) infinite alternate;
}
.aurora .b2 {
  width: 40vw; height: 40vw;
  min-width: 320px; min-height: 320px;
  top: 6%; right: -10%;
  background: radial-gradient(circle at 60% 40%, var(--mint), rgba(47,211,191,0) 70%);
  animation: drift-b 24s var(--ease-out) infinite alternate;
}
.aurora .b3 {
  width: 38vw; height: 38vw;
  min-width: 300px; min-height: 300px;
  bottom: -14%; left: 26%;
  background: radial-gradient(circle at 50% 50%, var(--lilac), rgba(167,139,250,0) 70%);
  animation: drift-c 28s var(--ease-out) infinite alternate;
}
.aurora .b4 {
  width: 26vw; height: 26vw;
  min-width: 220px; min-height: 220px;
  bottom: 8%; right: 6%;
  background: radial-gradient(circle at 50% 50%, var(--lemon), rgba(255,201,60,0) 68%);
  opacity: .35;
  animation: drift-b 20s var(--ease-out) infinite alternate-reverse;
}

@keyframes drift-a {
  from { transform: translate3d(0,0,0) scale(1); }
  to   { transform: translate3d(6vw, 4vh, 0) scale(1.12); }
}
@keyframes drift-b {
  from { transform: translate3d(0,0,0) scale(1.05); }
  to   { transform: translate3d(-5vw, 6vh, 0) scale(.92); }
}
@keyframes drift-c {
  from { transform: translate3d(0,0,0) scale(.95); }
  to   { transform: translate3d(4vw, -5vh, 0) scale(1.1); }
}

/* ==========================================================================
   通用容器
   ========================================================================== */

.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 28px clamp(16px, 3vw, 40px) 40px;
}

.wrap { max-width: 1280px; margin: 0 auto; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}

.card-soft {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-soft);
}

/* 有机圆角：允许不规则 border-radius */
.organic-a { border-radius: 34px 44px 30px 42px; }
.organic-b { border-radius: 42px 30px 44px 32px; }

/* 轻微错落 */
.tilt-l { transform: rotate(-1.1deg); }
.tilt-r { transform: rotate(.8deg); }

/* ==========================================================================
   文字
   ========================================================================== */

.title-xl { font-size: clamp(30px, 4.4vw, 48px); line-height: 1.18; }
.title-lg { font-size: clamp(22px, 2.6vw, 30px); line-height: 1.25; }
.title-md { font-size: 19px; }
.sub { color: var(--muted); font-size: 15px; }
.tiny { color: var(--soft); font-size: 13px; }
.ink-soft { color: var(--ink-soft); }

.gradient-text {
  background: -webkit-linear-gradient(92deg, var(--coral), var(--peach) 38%, var(--lilac) 72%, var(--sky));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ==========================================================================
   按钮
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--r-pill);
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  transition: transform var(--dur-fast) var(--ease-spring),
              box-shadow var(--dur-fast) var(--ease-out),
              background-color var(--dur-fast) var(--ease-out),
              opacity var(--dur-fast) var(--ease-out);
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--coral);
  color: #fff;
  box-shadow: var(--shadow-coral);
}
.btn-primary:hover:not(:disabled) { background: var(--coral-dark); transform: translateY(-2px) scale(1.02); }

.btn-mint { background: var(--mint); color: #10403A; box-shadow: 0 10px 24px -10px rgba(47,211,191,.6); }
.btn-mint:hover:not(:disabled) { transform: translateY(-2px) scale(1.02); }

.btn-soft {
  background: var(--surface);
  color: var(--ink-soft);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}
.btn-soft:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--peach); }

.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { color: var(--ink); background: var(--surface-alt); }

.btn-sm { padding: 8px 16px; font-size: 14px; }
.btn-lg { padding: 16px 34px; font-size: 18px; }
.btn-block { width: 100%; }

/* 图标按钮 */
.icon-btn {
  width: 46px; height: 46px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  transition: transform var(--dur-fast) var(--ease-spring), background-color var(--dur-fast) var(--ease-out);
}
.icon-btn:hover { transform: translateY(-2px) scale(1.05); }
.icon-btn svg { width: 22px; height: 22px; }

/* 麦克风主按钮 */
.mic-btn {
  width: 64px; height: 64px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--coral);
  box-shadow: var(--shadow-coral);
  transition: transform var(--dur-fast) var(--ease-spring), background-color var(--dur-fast) var(--ease-out);
}
.mic-btn svg { width: 28px; height: 28px; color: #fff; }
.mic-btn:hover { transform: scale(1.06) translateY(-2px); }
.mic-btn.recording { background: var(--coral-dark); animation: pulse 1.4s var(--ease-out) infinite; }
.mic-btn.busy { background: var(--sky); }

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,107,74,.55), var(--shadow-coral); }
  70%  { box-shadow: 0 0 0 18px rgba(255,107,74,0), var(--shadow-coral); }
  100% { box-shadow: 0 0 0 0 rgba(255,107,74,0), var(--shadow-coral); }
}

/* ==========================================================================
   表单
   ========================================================================== */

.field { display: flex; flex-direction: column; gap: 8px; }

.input, .textarea {
  width: 100%;
  padding: 13px 18px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--line);
  background: var(--surface);
  outline: none;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.input::placeholder, .textarea::placeholder { color: var(--soft); }
.input:focus, .textarea:focus {
  border-color: var(--peach);
  box-shadow: 0 0 0 4px var(--coral-soft);
}
.textarea { resize: vertical; min-height: 120px; line-height: 1.7; }

.label { font-size: 14px; font-weight: 700; color: var(--ink-soft); }

/* ==========================================================================
   标签 / 徽标
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  font-size: 12.5px;
  font-weight: 700;
  background: var(--surface-alt);
  color: var(--ink-soft);
}
.badge-coral { background: var(--coral-soft); color: var(--coral-dark); }
.badge-mint  { background: var(--mint-soft);  color: #0E7A6D; }
.badge-lemon { background: var(--lemon-soft); color: #96650A; }
.badge-sky   { background: var(--sky-soft);   color: #1B6FC4; }
.badge-lilac { background: var(--lilac-soft); color: #6D4BD1; }

.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* ==========================================================================
   进度条
   ========================================================================== */

.progress {
  height: 12px;
  border-radius: var(--r-pill);
  background: var(--surface-alt);
  border: 1px solid var(--line);
  overflow: hidden;
}
.progress > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: var(--r-pill);
  background: var(--mint);
  box-shadow: 0 0 12px rgba(47,211,191,.6);
  transition: width var(--dur-slow) var(--ease-spring);
}

/* ==========================================================================
   顶部条
   ========================================================================== */

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-soft);
}

.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; }
.brand .logo {
  width: 40px; height: 40px;
  border-radius: 14px 18px 14px 18px;
  display: grid;
  place-items: center;
  background: var(--coral-soft);
  color: var(--coral-dark);
  font-size: 20px;
}
.brand .logo svg { width: 22px; height: 22px; }

.spacer { flex: 1; }

/* ==========================================================================
   提示条
   ========================================================================== */

.notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--r-md);
  background: var(--lemon-soft);
  color: #7A5200;
  font-size: 14.5px;
  border: 1px solid #F3E2B0;
}
.notice svg { width: 20px; height: 20px; flex: none; margin-top: 2px; }

/* ==========================================================================
   空状态
   ========================================================================== */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 46px 20px;
  text-align: center;
  color: var(--muted);
}
.empty .blob {
  width: 76px; height: 76px;
  border-radius: 50% 50% 46% 54%;
  background: var(--lilac-soft);
  display: grid;
  place-items: center;
  color: var(--lilac);
  font-size: 30px;
}

/* ==========================================================================
   Toast
   ========================================================================== */

.toast-wrap {
  position: fixed;
  z-index: 90;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  pointer-events: none;
}
.toast {
  padding: 12px 22px;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
  box-shadow: var(--shadow-card);
  animation: toast-in var(--dur-base) var(--ease-spring);
}
.toast.err { background: var(--coral-dark); }
.toast.ok { background: #0E7A6D; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(16px) scale(.94); }
  to   { opacity: 1; transform: none; }
}

/* ==========================================================================
   模态
   ========================================================================== */

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(46,42,59,.34);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 20px;
  animation: fade-in var(--dur-fast) var(--ease-out);
}
.modal {
  width: min(520px, 100%);
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  padding: 26px;
  animation: modal-in var(--dur-base) var(--ease-spring);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(20px) scale(.96); }
  to   { opacity: 1; transform: none; }
}

/* ==========================================================================
   工具类
   ========================================================================== */

.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.col { display: flex; flex-direction: column; gap: 12px; }
.wrap-gap { display: flex; flex-wrap: wrap; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }
.scroll-y { overflow-y: auto; }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
