* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: #f3f7f4;
  color: #21303a;
}
.wrap { max-width: 980px; margin: 0 auto; padding: 24px 20px 60px; }
header h1 { font-size: 22px; margin: 0 0 4px; color: #1f6f54; }
header p { margin: 0 0 18px; color: #5a6b73; font-size: 13px; }
.card {
  background: #fff; border: 1px solid #e1eae5; border-radius: 10px;
  padding: 16px 18px; margin-bottom: 16px;
}
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #2c3e46; }
textarea, select, input[type=text] {
  width: 100%; border: 1px solid #cfd9d4; border-radius: 7px;
  padding: 8px 10px; font-size: 14px; background: #fcfefd; color: #21303a;
  font-family: inherit;
}
textarea { min-height: 640px; resize: vertical; line-height: 1.6; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.small { font-size: 12px; color: #6b7a82; }
button {
  background: #1f6f54; color: #fff; border: 0; border-radius: 7px;
  padding: 10px 20px; font-size: 14px; font-weight: 600; cursor: pointer;
  min-height: 38px;
}
button.sec { background: #e8f1ec; color: #1f6f54; }
button:hover { opacity: .92; }
button:disabled { opacity: .55; cursor: default; }
.slider-row { display: flex; align-items: center; gap: 12px; }
input[type=range] { flex: 1; }
#speedVal { width: 48px; text-align: center; font-weight: 700; color: #1f6f54; }
#status { font-size: 13px; margin: 10px 0; min-height: 18px; }
.ok { color: #1f6f54; } .err { color: #c0392b; }
#result { display: none; }
audio { width: 100%; margin-top: 8px; }
a.dl { display: inline-block; margin-top: 10px; color: #1f6f54; font-weight: 600; }
.hint { background: #f0f6f3; border-left: 3px solid #1f6f54; padding: 8px 12px; font-size: 12px; color: #46585f; border-radius: 4px; margin-top: 8px; }

/* ============ 底部二维码 ============ */
.footer-qr { text-align: center; margin: 28px 0 8px; }
.footer-qr img { display: inline-block; width: 100%; max-width: 560px; height: auto; border-radius: 8px; }
.footer-qr p { margin: 6px 0 0; }

/* ============ 头部用户区 ============ */
.header-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.user-area { flex-shrink: 0; display: flex; align-items: center; gap: 8px; padding-top: 4px; }
.user-chip { font-size: 13px; color: #2c3e46; background: #e8f1ec; border-radius: 999px; padding: 6px 14px; }
.user-chip b { color: #1f6f54; }
.user-chip button { min-height: 0; padding: 2px 10px; font-size: 12px; margin-left: 6px; }

/* ============ 登录 / 注册弹窗 ============ */
.mask {
  position: fixed; inset: 0; background: rgba(20, 35, 30, .45);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  padding: 16px;
}
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 360px;
  padding: 16px 18px 18px; box-shadow: 0 12px 40px rgba(0,0,0,.18);
  max-height: 92vh; overflow: auto;
}
.modal-tabs { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.modal-tabs .tab {
  background: #eef3f0; color: #5a6b73; min-height: 34px; padding: 6px 18px; font-size: 14px;
}
.modal-tabs .tab.active { background: #1f6f54; color: #fff; }
.modal-close { margin-left: auto; font-size: 22px; line-height: 1; color: #9aa7ad; cursor: pointer; padding: 2px 6px; }
.modal-close:hover { color: #c0392b; }
.modal-body label { margin-bottom: 10px; }
.modal-body input {
  width: 100%; border: 1px solid #cfd9d4; border-radius: 7px;
  padding: 9px 10px; font-size: 14px; background: #fcfefd; margin-top: 4px;
  font-family: inherit;
}
.modal-body button { width: 100%; margin-top: 4px; }
.form-err { color: #c0392b; font-size: 12.5px; min-height: 16px; margin: 2px 0 6px; }

/* ============ 移动端 / 微信小程序 web-view 适配 ============ */
@media (max-width: 720px) {
  .wrap { padding: 12px 10px 40px; }
  header h1 { font-size: 18px; }
  header p { font-size: 12px; margin-bottom: 10px; }
  .card { padding: 12px; margin-bottom: 12px; border-radius: 8px; }
  /* 音色选择两列并排（手机宽度够用），其余一列 */
  .grid { grid-template-columns: 1fr; gap: 12px; }
  /* 语速/句间停顿：移动端各占一行，强制上下排列 */
  .row > .slider-row { flex: 0 0 100% !important; width: 100% !important; min-width: 0 !important; }
  .slider-row { gap: 8px; }
  input[type=range] { height: 28px; }
  label { font-size: 13px; }
  /* 触摸友好：按钮更大 */
  button { min-height: 44px; padding: 10px 16px; font-size: 15px; }
  button.sec { min-height: 40px; }
  #generate { width: 100%; }
  /* 听力原文框：手机上高度约为屏幕一半，仍可上下拉伸 */
  textarea { min-height: 50vh; font-size: 15px; }
  .hint { font-size: 11.5px; line-height: 1.5; }
  audio { margin-top: 6px; }
  a.dl { font-size: 14px; }
  /* 试听按钮在小屏上保持可点 */
  .row select { min-width: 0; }
  .user-area { padding-top: 0; }
  .user-chip { font-size: 12px; padding: 4px 10px; }
  .modal { max-width: 340px; }
}
