/* 客家歌AI创作 · 网页版
   视觉规范沿用小程序 miniprogram/app.wxss：
     底色 #f8f5ef / 强调 #ae7430 / 深色按钮 #29211b / 点缀红 #c01010
   布局为桌面 + 手机双适配 */

:root {
  --bg: #f8f5ef;
  --panel: #fff;
  --ink: #241d17;
  --ink-2: #7d746a;
  --ink-3: #a49a8d;
  --accent: #ae7430;
  --accent-soft: #fbefdf;
  --dark: #29211b;
  --red: #c01010;
  --line: #e9dec9;
  --line-2: #eee7dd;
  --radius: 12px;
  --radius-lg: 24px;
  --shadow: 0 18px 48px rgba(71, 48, 25, .07);
  --sans: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB',
          'Microsoft YaHei', 'Noto Sans SC', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ── 顶栏 ───────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(248, 245, 239, .93);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line-2);
}
.topbar-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-name { font-size: 19px; font-weight: 700; letter-spacing: .5px; }
.brand-name em { color: var(--red); font-style: normal; margin: 0 2px; }
.brand-sub { font-size: 12px; color: var(--ink-3); letter-spacing: 1px; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-2);
  font-family: inherit;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .18s, color .18s, border-color .18s;
}
.tab:hover { color: var(--ink); background: rgba(174, 116, 48, .08); }
.tab.active { background: var(--dark); color: #fff; border-color: var(--dark); }

/* ── 容器 ───────────────────────────── */
.wrap { max-width: 1140px; margin: 0 auto; padding: 32px 24px 64px; }

.view { display: none; }
.view.active { display: block; animation: fade .28s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Hero ───────────────────────────── */
.hero { padding: 12px 0 30px; max-width: 720px; }
.hero h1 {
  margin: 0 0 12px;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: .5px;
}
.hero h1 .hl { color: var(--accent); }
.hero p { margin: 0; color: var(--ink-2); font-size: 15px; }
.hero-sm { padding-bottom: 22px; }
.hero-sm h1 { font-size: 24px; }

.quota-line {
  display: inline-block;
  margin-top: 12px !important;
  padding: 5px 12px;
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #704719;
  font-size: 12.5px;
  line-height: 1.5;
}
.quota-line.exhausted {
  background: #fcebeb;
  border-color: #f0c8c8;
  color: #a32d2d;
}

.points-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.points-bar .quota-line { margin-top: 0 !important; }

.btn-signin {
  width: auto;
  padding: 6px 14px;
  font-size: 12.5px;
  border-radius: 999px;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 500;
}
.btn-signin:hover:not(:disabled) { background: #96632a; border-color: #96632a; }
.btn-signin:disabled {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-3);
  cursor: default;
}

/* ── 栅格 ───────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}
.col-main { min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.col-side { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 82px; }

/* ── 卡片 ───────────────────────────── */
.card {
  background: var(--panel);
  border: 1px solid #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 26px 28px;
}
.card-narrow { max-width: 740px; }
.card-side { padding: 22px 24px; }
.card-title { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.card-desc { margin: 0 0 16px; color: var(--ink-2); font-size: 14px; }
.card-desc strong { color: var(--ink); font-weight: 600; }

.reasons { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 14px; }
.reasons li { margin-bottom: 10px; }
.reasons li:last-child { margin-bottom: 0; }
.reasons strong { color: var(--ink); font-weight: 600; }

/* ── 表单 ───────────────────────────── */
.field { display: block; margin-bottom: 16px; }
.label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf9;
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.6;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.field textarea { resize: vertical; min-height: 96px; }
.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(174, 116, 48, .13);
}
.field input::placeholder,
.field textarea::placeholder { color: #c3b8a8; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── 按钮 ───────────────────────────── */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 13px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: transform .12s, box-shadow .18s, background .18s, border-color .18s, color .18s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--dark); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #3a2f26; }

.btn-light { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-light:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }

.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }

.btn-sm { width: auto; padding: 8px 14px; font-size: 13px; }
.btn-xs { width: auto; padding: 4px 10px; font-size: 12px; border-radius: 8px; }

/* ── 腔调 chips ─────────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  appearance: none;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: background .18s, color .18s, border-color .18s;
}
.chip:hover { border-color: var(--accent); }
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.hint { margin: 10px 0 0; color: var(--ink-3); font-size: 13px; }
.lex-note { color: var(--accent); font-size: 12.5px; }

/* ── 行内标签页 ─────────────────────── */
.tabs-inline { display: flex; gap: 8px; margin-bottom: 16px; }
.ti {
  appearance: none;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-2);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background .18s, color .18s, border-color .18s;
}
.ti.active { background: var(--accent-soft); border-color: var(--accent); color: #704719; }

.divider { height: 1px; background: var(--line-2); margin: 22px 0; }

/* ── 输出区 ─────────────────────────── */
.output { margin-top: 18px; }
.output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.output-title { font-size: 13px; font-weight: 600; color: var(--ink); }
.output-body {
  margin: 0;
  padding: 16px 18px;
  background: #fbf8f2;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.85;
  color: #4a3d31;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 420px;
  overflow-y: auto;
}

/* ── 加载中 ─────────────────────────── */
.spinner {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 14px;
  color: var(--ink-2);
  font-size: 14px;
}
.dot {
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  animation: bounce 1.1s infinite ease-in-out;
}
.dot:nth-child(2) { animation-delay: .16s; }
.dot:nth-child(3) { animation-delay: .32s; }
@keyframes bounce {
  0%, 80%, 100% { transform: scale(.6); opacity: .5; }
  40% { transform: scale(1); opacity: 1; }
}

/* ── 作品卡片 ───────────────────────── */
.works-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}
.work-card {
  background: var(--panel);
  border: 1px solid #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.work-cover {
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, #f2e6d4, #e6d3b4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8a6b3f;
  font-size: 34px;
}
.work-cover img { width: 100%; height: 100%; object-fit: cover; }
.work-body { padding: 14px 16px 16px; }
.work-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.work-meta { font-size: 12px; color: var(--ink-3); margin: 0 0 10px; }
.work-body audio { width: 100%; height: 36px; }

/* ── 封面预览 ───────────────────────── */
.cover-preview {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fbf8f2;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cover-preview canvas { display: block; width: 100%; height: auto; }
.cover-preview .ph { color: var(--ink-3); font-size: 13px; padding: 40px 16px; text-align: center; }

/* ── 关于页 ─────────────────────────── */
.about p { color: var(--ink-2); font-size: 14.5px; }
.about h3 { margin: 0 0 12px; }

/* ── 页脚 ───────────────────────────── */
.footer {
  max-width: 1140px;
  margin: 0 auto;
  padding: 28px 24px 40px;
  border-top: 1px solid var(--line-2);
  text-align: center;
}
.footer p { margin: 0; font-size: 13px; color: var(--ink-2); }
.footer-sub { margin-top: 5px !important; font-size: 12px !important; color: var(--ink-3) !important; }

/* ── Toast ──────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  z-index: 60;
  max-width: calc(100vw - 48px);
  padding: 12px 20px;
  background: var(--dark);
  color: #fff;
  font-size: 14px;
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .22);
  animation: toastIn .24s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ── 手机适配 ───────────────────────── */
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .col-side { position: static; }
}

@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .topbar-inner { padding: 12px 16px; gap: 12px; }
  .brand-sub { display: none; }
  .tabs { width: 100%; }
  .tab { flex: 1; text-align: center; padding: 8px 4px; font-size: 13px; }
  .wrap { padding: 22px 16px 48px; }
  .hero { padding: 6px 0 22px; }
  .hero h1 { font-size: 23px; }
  .hero-sm h1 { font-size: 20px; }
  .card { padding: 20px 18px; border-radius: 18px; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .works-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .work-title { font-size: 14px; }
  .footer { padding: 22px 16px 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
