/* 阿拉丁学习灯 · 共用样式 */
:root {
  --teal-900: #0a3b39;
  --teal-800: #0d4e4b;
  --teal-700: #10625e;
  --teal-600: #157570;
  --teal-500: #1f8a83;
  --teal-200: #b9dcd7;
  --teal-100: #dcefec;
  --teal-50: #eef7f5;

  --bg: #f6f2ea;
  --bg-deep: #ebe5d9;
  --surface: #ffffff;
  --surface-2: #fbf9f5;
  --ink: #1c2928;
  --ink-2: #4f5f5d;
  --ink-3: #87938f;
  --line: #e6e0d4;
  --line-2: #f0ebe2;

  --red: #d0453a;
  --red-bg: #fcebe8;
  --green: #2c9a58;
  --green-bg: #e5f4ea;
  --amber: #d4930a;
  --amber-bg: #fcf1d8;
  --grey: #8c9693;
  --grey-bg: #eef0ef;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(28, 41, 40, .05), 0 4px 16px rgba(28, 41, 40, .06);
  --shadow-lg: 0 8px 40px rgba(28, 41, 40, .18);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img { max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--teal-600); text-decoration: none; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }

/* 卡片 */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.card + .card { margin-top: 12px; }
.card-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 16px; font-weight: 600; margin: 0 0 12px;
}
.card-title .aside { font-size: 13px; font-weight: 400; color: var(--ink-3); }
.section-title {
  font-size: 15px; font-weight: 600; color: var(--ink-2);
  margin: 22px 4px 10px; display: flex; justify-content: space-between; align-items: center;
}
.section-title .aside { font-size: 13px; font-weight: 400; color: var(--ink-3); }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 15px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .08s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn-primary { background: var(--teal-700); border-color: var(--teal-700); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--teal-800); }
.btn-soft { background: var(--teal-50); border-color: var(--teal-100); color: var(--teal-700); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--teal-700); padding: 0 8px; }
.btn-red { background: var(--red); border-color: var(--red); color: #fff; }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* 状态标签 */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px; border-radius: 11px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--grey-bg); color: var(--ink-2);
}
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.amber { background: var(--amber-bg); color: #a46f00; }
.badge.teal { background: var(--teal-50); color: var(--teal-700); }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 30px; padding: 0 12px; border-radius: 15px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 13px; color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.chip.on { background: var(--teal-700); border-color: var(--teal-700); color: #fff; }
.chip .count { opacity: .7; font-size: 12px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--grey); display: inline-block; flex: none; }
.dot.on { background: #2fbf6b; box-shadow: 0 0 0 3px rgba(47, 191, 107, .18); }
.dot.pulse { animation: dotPulse 1.6s infinite; }
@keyframes dotPulse {
  0% { box-shadow: 0 0 0 0 rgba(47, 191, 107, .45); }
  70% { box-shadow: 0 0 0 7px rgba(47, 191, 107, 0); }
  100% { box-shadow: 0 0 0 0 rgba(47, 191, 107, 0); }
}

/* 分段选择 */
.seg {
  display: flex; background: var(--bg-deep); border-radius: 12px; padding: 3px; gap: 2px;
}
.seg button {
  flex: 1; border: 0; background: transparent; border-radius: 9px;
  height: 32px; font-size: 14px; color: var(--ink-2); cursor: pointer;
}
.seg button.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* 开关 */
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span {
  position: absolute; inset: 0; border-radius: 15px; background: #d6d2c9; cursor: pointer; transition: background .2s;
}
.switch span::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s;
}
.switch input:checked + span { background: var(--teal-600); }
.switch input:checked + span::after { transform: translateX(20px); }

/* 表单 */
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.input {
  width: 100%; height: 42px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface-2); outline: none;
}
.input:focus { border-color: var(--teal-500); background: #fff; }

/* 列表行 */
.row { display: flex; align-items: center; gap: 12px; }
.row .grow { flex: 1; min-width: 0; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.list-item:last-child { border-bottom: 0; padding-bottom: 0; }
.list-item:first-child { padding-top: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* 空状态 */
.empty {
  text-align: center; padding: 28px 20px; color: var(--ink-3); font-size: 14px; line-height: 1.7;
}
.empty strong { display: block; color: var(--ink-2); font-size: 15px; margin-bottom: 4px; font-weight: 600; }
.empty-icon {
  width: 44px; height: 44px; border-radius: 50%; background: var(--teal-50); margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center; color: var(--teal-600);
}

/* 提示 */
.toast-wrap {
  position: fixed; left: 50%; top: 16px; transform: translateX(-50%);
  z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
  width: min(92vw, 400px);
}
.toast {
  background: rgba(20, 34, 33, .92); color: #fff; padding: 10px 16px; border-radius: 12px;
  font-size: 14px; box-shadow: var(--shadow-lg); animation: toastIn .25s ease-out;
  max-width: 100%;
}
.toast.err { background: rgba(176, 52, 42, .95); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* 加载 */
.spinner {
  width: 16px; height: 16px; border: 2px solid var(--teal-100); border-top-color: var(--teal-600);
  border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--line-2), #f7f4ee, var(--line-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.mock-flag {
  position: fixed; right: 8px; bottom: 70px; z-index: 2000; opacity: .8; font-size: 11px; padding: 2px 8px;
  border-radius: 8px; background: #fff3c4; color: #7a5a00; border: 1px solid #f0d77a; pointer-events: none;
}
