/* =====================================================================
   组件：按钮 / 卡片 / 标签 / 表单 / 弹层 / 提示
   ===================================================================== */

/* ================= 按钮 ================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  min-height: 38px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}

.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0) scale(.985); box-shadow: none; }
.btn[disabled], .btn.busy { opacity: .5; pointer-events: none; }

.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-brand);
}
:root[data-theme='dark'] .btn.primary { color: #12100A; }
.btn.primary:hover { background: var(--primary-ink); border-color: var(--primary-ink); }

.btn.accent  { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.gold    { background: var(--gold);   border-color: var(--gold);   color: #fff; }
:root[data-theme='dark'] .btn.gold { color: #12100A; }

.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.btn.ghost:hover { background: var(--surface-1); color: var(--text); box-shadow: none; }

.btn.danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 35%, transparent); }
.btn.danger:hover { background: color-mix(in srgb, var(--err) 10%, transparent); }

.btn.sm { min-height: 30px; padding: 2px var(--sp-3); font-size: 12.5px; border-radius: var(--r-xs); }
.btn.lg { min-height: 48px; padding: var(--sp-3) var(--sp-6); font-size: 15.5px; border-radius: var(--r); }
.btn.block { width: 100%; }

/* 涟漪 */
.btn .ripple {
  position: absolute;
  border-radius: 50%;
  background: currentColor;
  opacity: .28;
  transform: scale(0);
  animation: rippleOut 560ms var(--ease-out) forwards;
  pointer-events: none;
}

/* ================= 卡片 ================= */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--dur) var(--ease-out),
              transform var(--dur) var(--ease-out),
              border-color var(--dur) var(--ease-out);
}

.card.pad-sm { padding: var(--sp-4); }
.card.hover:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

.card-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.card-title {
  font-family: var(--font-zh);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

/* 朱砂小竖条 */
.card-title::before {
  content: '';
  display: inline-block;
  width: 3px; height: 13px;
  margin-right: var(--sp-2);
  vertical-align: -1px;
  border-radius: var(--r-pill);
  background: var(--primary);
}

/* ================= 标签 ================= */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1.5px var(--sp-2);
  border-radius: var(--r-xs);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.7;
  white-space: nowrap;
  background: var(--surface-1);
  color: var(--text-2);
}

.tag.male     { background: var(--male-soft);     color: var(--male); }
.tag.female   { background: var(--female-soft);   color: var(--female); }
.tag.common   { background: var(--common-soft);   color: var(--common); }
.tag.neuter   { background: var(--neuter-soft);   color: var(--neuter); }
.tag.trans    { background: var(--trans-soft);    color: var(--trans); }
.tag.intrans  { background: var(--intrans-soft);  color: var(--intrans); }
.tag.both     { background: var(--both-soft);     color: var(--both); }
.tag.primary  { background: var(--primary-soft);  color: var(--primary-ink); }
.tag.gold     { background: var(--gold-soft);     color: var(--gold); }

/* 掌握阶段 */
.tag.stage-new  { background: var(--surface-2); color: var(--text-3); }
.tag.stage-lear { background: var(--accent-soft); color: var(--accent); }
.tag.stage-young{ background: var(--male-soft); color: var(--male); }
.tag.stage-mat  { background: var(--gold-soft); color: var(--gold); }
.tag.stage-long { background: var(--primary-soft); color: var(--primary-ink); }

/* 状态点 */
.dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ================= 表单 ================= */
.input, .textarea, select.input {
  width: 100%;
  padding: var(--sp-3) var(--sp-3);
  min-height: 42px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 15px;
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
}

.textarea { min-height: 120px; line-height: 1.75; resize: vertical; }

.input:hover, .textarea:hover { border-color: var(--line-strong); }

.input:focus, .textarea:focus, select.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);
}

.input::placeholder, .textarea::placeholder { color: var(--text-3); }

.input.deva { font-family: var(--font-deva); font-size: 17px; line-height: 1.9; }

select.input {
  cursor: pointer;
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23928A7C' stroke-width='2.5'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.field { display: block; margin-bottom: var(--sp-4); }

.flabel {
  display: block;
  margin-bottom: var(--sp-2);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: .02em;
}

/* 多选筹码 */
.chip-row { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: 13.5px;
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}

.chip:hover { border-color: var(--line-strong); color: var(--text); }

.chip.on {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-ink);
  font-weight: 600;
}

.chip.on::before { content: '✓'; font-size: 11px; font-weight: 700; }

/* 开关 */
.switch {
  position: relative;
  width: 42px; height: 24px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: background var(--dur) var(--ease-out);
  flex-shrink: 0;
}

.switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease-spring);
}

.switch.on { background: var(--primary); border-color: var(--primary); }
.switch.on::after { transform: translateX(18px); }

/* ================= 空态 ================= */
.empty {
  padding: var(--sp-8) var(--sp-5);
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
}

.empty-icon { font-size: 40px; line-height: 1; margin-bottom: var(--sp-4); opacity: .85; }
.empty-title {
  font-family: var(--font-zh);
  font-size: 17px;
  font-weight: 600;
  margin-bottom: var(--sp-2);
}
.empty-desc { color: var(--text-2); font-size: 14px; margin-bottom: var(--sp-5); max-width: 46ch; margin-inline: auto; }
.empty-actions { display: flex; gap: var(--sp-3); justify-content: center; flex-wrap: wrap; }

/* ================= 提示条 ================= */
.notice {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13.5px;
  border-left: 3px solid currentColor;
  margin-bottom: var(--sp-4);
}

.notice.err  { background: color-mix(in srgb, var(--err) 10%, transparent);  color: var(--err); }
.notice.warn { background: color-mix(in srgb, var(--warn) 12%, transparent); color: var(--warn); }
.notice.gold { background: var(--gold-soft); color: var(--gold); }

/* ================= 弹层 ================= */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: var(--sp-5);
  background: color-mix(in srgb, #14100A 55%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadeIn var(--dur) var(--ease-out) both;
}

.modal-card {
  width: 100%;
  max-width: 560px;
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-6);
  animation: modalIn var(--dur-slow) var(--ease-spring) both;
}

.modal-card.wide { max-width: 760px; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}

.modal-title { font-family: var(--font-zh); font-size: 19px; font-weight: 600; }

.dialog { max-width: 400px; text-align: center; }
.dialog p { color: var(--text-2); margin-bottom: var(--sp-5); white-space: pre-wrap; }
.dialog-actions { display: flex; gap: var(--sp-3); justify-content: center; }

/* ================= Toast ================= */
#toastWrap {
  position: fixed;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
  inset: 0;
}

#toastWrap.pos-top-center    { align-items: center; justify-content: flex-start; padding-top: calc(var(--sp-6) + env(safe-area-inset-top, 0px)); }
#toastWrap.pos-bottom-center { align-items: center; justify-content: flex-end;    padding-bottom: calc(var(--sp-7) + env(safe-area-inset-bottom, 0px)); }
#toastWrap.pos-bottom-right  { align-items: flex-end;  justify-content: flex-end;  padding: 0 var(--sp-5) var(--sp-6) 0; }

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  max-width: min(440px, 88vw);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  animation: toastIn var(--dur) var(--ease-spring) both;
}

.toast.out { animation: toastOut var(--dur-fast) var(--ease-out) both; }

.toast::before {
  content: '';
  width: 3px;
  align-self: stretch;
  border-radius: var(--r-pill);
  background: var(--accent);
  flex-shrink: 0;
}

.toast.err::before  { background: var(--err); }
.toast.warn::before { background: var(--warn); }
.toast.info::before { background: var(--text-3); }

.toast-action {
  margin-left: auto;
  color: var(--primary);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}

/* ================= 加载 ================= */
.lotus-wrap { display: grid; place-items: center; gap: var(--sp-4); padding: var(--sp-8) 0; text-align: center; }

.lotus-loader { color: var(--primary); }
.lotus-loader svg { animation: lotusBloom 2.4s var(--ease-in-out) infinite; }

.l-txt { color: var(--text-2); font-size: 14px; }
.l-sub { color: var(--text-3); font-size: 12px; font-family: var(--font-en); letter-spacing: .06em; }

.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

/* 骨架屏 */
.skeleton {
  background: linear-gradient(90deg,
    var(--surface-1) 25%, var(--surface-2) 50%, var(--surface-1) 75%);
  background-size: 200% 100%;
  border-radius: var(--r-xs);
  animation: shimmer 1.4s ease-in-out infinite;
}

.skeleton.line { height: 13px; margin-bottom: var(--sp-3); }
.skeleton.block { height: 110px; border-radius: var(--r); }

/* 进度条 */
.progress {
  height: 3px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  overflow: hidden;
}

.progress > i {
  display: block;
  height: 100%;
  border-radius: var(--r-pill);
  background: linear-gradient(to right, var(--primary), var(--accent));
  transition: width var(--dur-slow) var(--ease-out);
}

/* ================= 分隔装饰 ================= */
.rule {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: var(--sp-6) 0;
  color: var(--text-3);
  font-size: 12px;
  letter-spacing: .3em;
}

.rule::before, .rule::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--line), transparent);
}

/* ================= 泰戈尔引语 ================= */
.quote-card {
  background: linear-gradient(135deg, var(--surface), var(--surface-1));
  border-left: 2px solid var(--primary);
  text-align: center;
  padding: var(--sp-6) var(--sp-5);
}

.quote-hi {
  font-family: var(--font-deva);
  font-size: 17px;
  line-height: 2;
  color: var(--text);
  margin-bottom: var(--sp-3);
}

.quote-zh { color: var(--text-2); font-size: 14.5px; font-family: var(--font-zh); }

.quote-src {
  margin-top: var(--sp-3);
  font-size: 11.5px;
  color: var(--text-3);
  letter-spacing: .1em;
}
