/* =========================================================
   练学 FitStudy · 设计系统
   ========================================================= */

:root {
  --bg: #0a0d12;
  --bg-2: #0e131a;
  --surface: #131a23;
  --surface-2: #172230;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e9eef6;
  --muted: #93a1b3;
  --dim: #6b7a8d;
  --lime: #c6f24e;
  --mint: #39d98a;
  --violet: #8f8cf9;
  --amber: #ffc857;
  --danger: #ff6b6b;
  --radius: 20px;
  --radius-sm: 12px;
  --font: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: Georgia, "Songti SC", "Times New Roman", serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1100px 520px at 12% -12%, rgba(198, 242, 78, 0.10), transparent 62%),
    radial-gradient(900px 480px at 102% -4%, rgba(143, 140, 249, 0.12), transparent 58%),
    var(--bg);
}

h1, h2, h3, p { margin: 0; }

button, input, select { font-family: inherit; font-size: inherit; color: inherit; }

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 13, 18, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 19px;
  color: #0a1206;
  background: linear-gradient(140deg, var(--lime), var(--mint));
  box-shadow: 0 8px 24px rgba(198, 242, 78, 0.24);
}

.brand-text { display: grid; line-height: 1.1; }
.brand-text strong { font-size: 16px; letter-spacing: 0.02em; }
.brand-text small { color: var(--dim); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; }

.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease;
}

.tab svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab:hover { color: var(--text); }

.tab.is-active {
  background: linear-gradient(135deg, var(--lime), var(--mint));
  color: #0a1206;
  box-shadow: 0 6px 18px rgba(198, 242, 78, 0.22);
}

/* ---------- 页面骨架 ---------- */

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 30px 24px 88px;
}

.view.is-active { animation: view-in 0.36s ease both; }

@keyframes view-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.hero { margin-bottom: 26px; }

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--lime);
  margin-bottom: 10px;
}

.hero h1 {
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.18;
  letter-spacing: -0.02em;
  font-weight: 650;
}

.hero-sub {
  margin-top: 10px;
  max-width: 62ch;
  color: var(--muted);
}

/* ---------- 卡片 ---------- */

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 42%),
    var(--surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: #0a1206;
  background: var(--lime);
}

.chip-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  border: 1px solid var(--border);
}

.hint {
  color: var(--dim);
  font-size: 12.5px;
  margin-top: 10px;
}

/* ---------- 表单 ---------- */

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 350px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.form-card { display: grid; gap: 14px; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field { display: grid; gap: 6px; }

.field > span {
  font-size: 12.5px;
  color: var(--muted);
}

input, select {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  appearance: none;
}

select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

input:focus, select:focus {
  outline: none;
  border-color: rgba(198, 242, 78, 0.55);
  box-shadow: 0 0 0 3px rgba(198, 242, 78, 0.14);
}

input[type="date"] { color-scheme: dark; }

/* ---------- 数据卡片 ---------- */

.stats-col { display: grid; gap: 14px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.stat-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.stat { padding: 18px; display: grid; gap: 6px; align-content: start; }

.stat-label { font-size: 12.5px; color: var(--muted); }

.stat-value {
  font-size: clamp(24px, 2.6vw, 32px);
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.stat-value small {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--dim);
  margin-left: 5px;
  letter-spacing: 0;
}

.stat-note { font-size: 12px; color: var(--dim); }

.stat-accent {
  border-color: rgba(198, 242, 78, 0.34);
  background:
    linear-gradient(150deg, rgba(198, 242, 78, 0.15), rgba(57, 217, 138, 0.05) 62%),
    var(--surface);
}

.stat-accent .stat-value { color: var(--lime); }

/* ---------- 营养素 ---------- */

.macro-card { display: grid; gap: 14px; }

.macro { display: grid; gap: 7px; }

.macro-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}

.macro-head strong { color: var(--text); font-variant-numeric: tabular-nums; }

.bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.bar-lg { height: 12px; }

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--lime), var(--mint));
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.bar-protein { background: linear-gradient(90deg, #c6f24e, #9be00c); }
.bar-fat { background: linear-gradient(90deg, #ffc857, #ff9f43); }
.bar-carbs { background: linear-gradient(90deg, #8f8cf9, #6c7cf8); }

.water-row {
  display: flex;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  font-size: 13px;
  color: var(--muted);
}

.water-row strong { color: var(--text); }

/* ---------- 饮食计划 ---------- */

.meals-card { margin-top: 18px; }

.meal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.meal {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  background: var(--surface-2);
  display: grid;
  gap: 12px;
}

.meal-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.meal-name { font-size: 14px; font-weight: 600; }

.meal-time { font-size: 11.5px; color: var(--dim); margin-left: 6px; }

.meal-kcal { font-size: 12.5px; color: var(--lime); font-variant-numeric: tabular-nums; }

.meal-dish { font-size: 12px; color: var(--muted); }

.meal-items { display: grid; gap: 6px; }

.meal-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}

.meal-item span:last-child {
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.meal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.meal-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.meal-check input {
  width: 15px;
  height: 15px;
  accent-color: var(--lime);
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.18s ease, border-color 0.18s ease;
}

.btn:hover { background: rgba(255, 255, 255, 0.08); }
.btn:active { transform: translateY(1px); }

.btn-ghost { padding: 8px 13px; font-size: 12.5px; color: var(--muted); }

.btn-primary {
  border: 0;
  background: linear-gradient(135deg, var(--lime), var(--mint));
  color: #0a1206;
  box-shadow: 0 10px 26px rgba(198, 242, 78, 0.2);
}

.btn-primary:hover { filter: brightness(1.04); }

.intake { margin-top: 18px; display: grid; gap: 10px; }

.intake-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}

.intake-label strong { color: var(--text); font-variant-numeric: tabular-nums; font-size: 14px; }

/* ---------- 背单词 ---------- */

.study-card { display: grid; gap: 20px; }

.study-head { display: flex; align-items: center; gap: 14px; }

.study-count {
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.study-head .bar { flex: 1; }

.word-card {
  display: grid;
  gap: 6px;
  justify-items: center;
  text-align: center;
  padding: 26px 12px 10px;
}

.word-badge {
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--dim);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.word-main {
  font-family: var(--serif);
  font-size: clamp(38px, 7vw, 62px);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin-top: 8px;
  word-break: break-word;
}

.word-ph {
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.reveal-zone { display: grid; gap: 14px; justify-items: center; width: 100%; padding: 14px 0 4px; }

.word-meaning {
  font-size: 18px;
  font-weight: 500;
  line-height: 1.6;
}

.tip-box {
  width: min(100%, 560px);
  text-align: left;
  border: 1px solid rgba(143, 140, 249, 0.32);
  background: rgba(143, 140, 249, 0.09);
  border-radius: 14px;
  padding: 12px 15px;
  font-size: 13.5px;
  color: #d9d8ff;
}

.tip-box b { color: #fff; font-weight: 600; }

.tip-example {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.tip-example b { color: var(--text); }

.rating-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  margin-top: 6px;
}

.rate {
  display: grid;
  gap: 3px;
  padding: 12px 10px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.15s ease;
}

.rate:hover { transform: translateY(-1px); }
.rate:active { transform: translateY(0); }

.rate strong { font-size: 14px; }
.rate small { font-size: 11.5px; color: var(--dim); }

.rate-forget { border-color: rgba(255, 107, 107, 0.4); }
.rate-forget:hover { background: rgba(255, 107, 107, 0.14); }
.rate-forget strong { color: #ff9a9a; }

.rate-fuzzy { border-color: rgba(255, 200, 87, 0.4); }
.rate-fuzzy:hover { background: rgba(255, 200, 87, 0.12); }
.rate-fuzzy strong { color: var(--amber); }

.rate-know { border-color: rgba(198, 242, 78, 0.45); }
.rate-know:hover { background: rgba(198, 242, 78, 0.13); }
.rate-know strong { color: var(--lime); }

.study-done {
  display: grid;
  gap: 14px;
  justify-items: center;
  text-align: center;
  padding: 26px 10px;
}

.done-ring {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 26px;
  background: radial-gradient(circle at 32% 28%, rgba(198, 242, 78, 0.32), rgba(57, 217, 138, 0.08));
  border: 1px solid rgba(198, 242, 78, 0.4);
}

.done-stats {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 13px;
  color: var(--muted);
}

.done-stats strong { color: var(--text); font-variant-numeric: tabular-nums; }

.settings-card { margin-top: 18px; }

.settings-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.settings-row .field { min-width: 150px; flex: 0 1 200px; }
.settings-row .btn { margin-left: auto; }

.library-card { margin-top: 18px; }

.library-head { align-items: center; }

.library-tools {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.library-tools .search { width: 210px; }
.library-tools select { width: 118px; }

.word-list {
  display: grid;
  max-height: 540px;
  overflow-y: auto;
  padding-right: 6px;
}

.word-list::-webkit-scrollbar { width: 8px; }
.word-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 999px; }

.word-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
}

.word-row:last-child { border-bottom: 0; }

.word-row-main { min-width: 0; }

.word-row-title {
  display: flex;
  align-items: baseline;
  gap: 9px;
  flex-wrap: wrap;
}

.word-row-title strong { font-family: var(--serif); font-size: 16px; letter-spacing: 0.01em; }
.word-row-title .ph { font-size: 12px; color: var(--dim); }
.word-row-main p { font-size: 13px; color: var(--muted); margin-top: 2px; }

.word-row-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}

.badge-new { color: #b6c2d2; background: rgba(255, 255, 255, 0.05); }
.badge-due { color: var(--amber); border-color: rgba(255, 200, 87, 0.35); background: rgba(255, 200, 87, 0.1); }
.badge-learning { color: var(--violet); border-color: rgba(143, 140, 249, 0.35); background: rgba(143, 140, 249, 0.1); }
.badge-mastered { color: var(--lime); border-color: rgba(198, 242, 78, 0.4); background: rgba(198, 242, 78, 0.1); }

.due-text { font-size: 11.5px; color: var(--dim); white-space: nowrap; }

.load-more { width: 100%; margin-top: 12px; }

/* ---------- 训练跟练 ---------- */

.stat-text {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.25;
}

.plan-card { margin-bottom: 18px; }

.plan-settings { display: flex; gap: 12px; flex-wrap: wrap; }

.field-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
}

.field-inline select {
  width: auto;
  padding: 7px 30px 7px 10px;
  font-size: 13px;
}

.week-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.day-chip {
  display: grid;
  gap: 3px;
  padding: 11px 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.15s ease, background 0.18s ease;
}

.day-chip:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
}

.day-chip.is-today { border-color: rgba(198, 242, 78, 0.42); }

.day-chip.is-selected {
  background: rgba(198, 242, 78, 0.1);
  box-shadow: inset 0 0 0 1px rgba(198, 242, 78, 0.5);
}

.day-chip.is-rest { opacity: 0.62; }
.day-chip.is-done .day-status { color: var(--lime); }

.day-name { font-size: 11.5px; color: var(--muted); }
.day-date { font-size: 11px; color: var(--dim); }
.day-plan { font-size: 12.5px; font-weight: 600; }
.day-status { font-size: 11px; color: var(--dim); }

.day-card { display: grid; gap: 14px; }

.exercise-list { display: grid; gap: 8px; }

.exercise {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
}

.exercise.is-done {
  border-color: rgba(198, 242, 78, 0.35);
  background: rgba(198, 242, 78, 0.07);
}

.exercise input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--lime);
  cursor: pointer;
}

.exercise-name { font-size: 14px; font-weight: 600; }
.exercise-sets { font-size: 12px; color: var(--lime); margin-left: 7px; font-weight: 500; }
.exercise-cue { font-size: 12px; color: var(--dim); margin-top: 2px; }

.rest-day {
  display: grid;
  gap: 6px;
  padding: 22px 16px;
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}

.rest-timer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border: 1px solid rgba(143, 140, 249, 0.35);
  background: rgba(143, 140, 249, 0.09);
  border-radius: 14px;
}

.rest-label { font-size: 11.5px; color: var(--muted); letter-spacing: 0.06em; }
.rest-time { font-size: 27px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.15; }
.rest-actions { display: flex; gap: 8px; }

.day-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.day-actions { display: flex; gap: 8px; }
.day-foot .hint { margin: 0; }

/* ---------- 记录 ---------- */

.log-card { margin-bottom: 18px; }
.field-wide { flex: 1 1 220px; }
.records-stats { margin-bottom: 18px; }

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.chart-card { display: grid; gap: 10px; }
.chart-box svg { width: 100%; height: auto; display: block; }

.chart-line {
  fill: none;
  stroke: var(--lime);
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart-dot { fill: var(--lime); }
.chart-grid-line { stroke: rgba(255, 255, 255, 0.08); stroke-width: 1; }
.chart-axis { stroke: rgba(255, 255, 255, 0.16); stroke-width: 1; }
.chart-target { stroke: var(--violet); stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart-bar { fill: rgba(198, 242, 78, 0.32); }
.chart-bar.is-today { fill: var(--lime); }
.chart-label { fill: var(--dim); font-size: 11px; }

.history-card { margin-top: 18px; }
.table-wrap { overflow-x: auto; }

.history-table { width: 100%; border-collapse: collapse; font-size: 13px; }

.history-table th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.history-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.history-table td.note {
  white-space: normal;
  color: var(--muted);
  min-width: 120px;
}

.history-table tbody tr:last-child td { border-bottom: 0; }

.link-danger {
  border: 0;
  background: none;
  color: var(--danger);
  font-size: 12.5px;
  cursor: pointer;
  padding: 0;
}

.link-danger:hover { text-decoration: underline; }

/* ---------- 训练：周组数 / 自选 / 跟练 ---------- */

.volume-box {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  display: grid;
  gap: 10px;
}

.volume-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 12.5px;
  color: var(--muted);
}

.volume-list { display: grid; gap: 7px; }

.volume-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 56px;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

.volume-label { color: var(--text); }
.volume-value { text-align: right; font-variant-numeric: tabular-nums; }

.bar-fill.is-ok { background: linear-gradient(90deg, var(--lime), var(--mint)); }
.bar-fill.is-low { background: linear-gradient(90deg, #ffc857, #ff9f43); }
.bar-fill.is-high { background: linear-gradient(90deg, #ff8a8a, #ff6b6b); }

.exercise-group {
  margin-left: 7px;
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 7px;
  vertical-align: middle;
}

.exercise-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.exercise-actions .btn { text-decoration: none; }

.builder-card { margin-top: 18px; display: grid; gap: 12px; }
.builder-card[hidden] { display: none; }

.builder-tools { display: flex; gap: 10px; flex-wrap: wrap; }
.builder-tools select { width: auto; min-width: 128px; }
.builder-tools input { flex: 1 1 180px; }

.builder-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
}

.picked {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 6px 5px 11px;
  border-radius: 999px;
  background: rgba(198, 242, 78, 0.12);
  border: 1px solid rgba(198, 242, 78, 0.32);
  font-size: 12.5px;
}

.picked button {
  border: 0;
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  line-height: 1;
  font-size: 12px;
}

.builder-library {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

.lib-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.lib-item:hover { border-color: var(--border-strong); }
.lib-item.is-picked { border-color: rgba(198, 242, 78, 0.4); background: rgba(198, 242, 78, 0.08); }
.lib-name { font-size: 13px; font-weight: 600; }
.lib-meta { grid-column: 1; font-size: 11.5px; color: var(--dim); }
.lib-add { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--lime); font-size: 12.5px; }

.builder-actions { justify-content: flex-start; margin-top: 4px; }

.science-card { margin-top: 18px; }

.science-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }

.science-list li {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.science-list strong { font-size: 13.5px; }
.science-list span { font-size: 12.5px; color: var(--muted); }

/* ---------- 跟练覆盖层 ---------- */

.guide {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(6, 9, 13, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.guide[hidden] { display: none; }

.guide-panel {
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  display: grid;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0) 40%),
    var(--surface);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.guide-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.guide-phase { font-size: 12px; letter-spacing: 0.06em; color: var(--lime); }
.guide-body { display: grid; gap: 8px; justify-items: center; text-align: center; }
.guide-name { font-size: clamp(24px, 5vw, 34px); font-weight: 650; letter-spacing: -0.01em; }
.guide-meta { font-size: 13px; color: var(--muted); }

.guide-timer {
  font-size: clamp(44px, 12vw, 68px);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
  color: var(--lime);
  letter-spacing: -0.02em;
}

.guide-cue { font-size: 13px; color: var(--muted); max-width: 44ch; }
.guide-video { font-size: 13px; color: var(--violet); text-decoration: none; }
.guide-video:hover { text-decoration: underline; }

.guide-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.guide-progress { display: grid; gap: 6px; font-size: 12px; color: var(--muted); text-align: center; }

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- 账号 ---------- */

.account { display: flex; align-items: center; gap: 8px; }

.sync-chip {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 11.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.sync-chip[data-tone="ok"] {
  color: var(--lime);
  border-color: rgba(198, 242, 78, 0.35);
  background: rgba(198, 242, 78, 0.1);
}

.sync-chip[data-tone="busy"] { color: var(--amber); border-color: rgba(255, 200, 87, 0.32); }
.sync-chip[data-tone="fail"] { color: var(--danger); border-color: rgba(255, 107, 107, 0.35); }

.account-user { display: inline-flex; align-items: center; gap: 8px; }

.account-name {
  font-size: 13px;
  color: var(--text);
  max-width: 132px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(6, 9, 13, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.auth[hidden] { display: none; }

.auth-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0) 40%),
    var(--surface);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.auth-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.auth-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-2);
  width: fit-content;
}

.auth-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 7px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.auth-tab.is-active {
  background: linear-gradient(135deg, var(--lime), var(--mint));
  color: #0a1206;
}

.auth-form { display: grid; gap: 12px; }
.auth-error { min-height: 18px; font-size: 12.5px; color: var(--danger); }
.btn-block { width: 100%; }

/* ---------- 提示条 ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 12px);
  z-index: 60;
  padding: 11px 20px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: #101821;
  color: var(--text);
  font-size: 13px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 响应式 ---------- */

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .stat-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .library-tools .search { width: 100%; }
  .library-head { align-items: flex-start; }
  .library-tools { width: 100%; }
  .library-tools .search { flex: 1 1 160px; }
}

@media (max-width: 720px) {
  .page { padding: 22px 16px 72px; }
  .topbar-inner { padding: 10px 16px; }
  .stat-grid { grid-template-columns: 1fr; }
  .meal-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 27px; }
  .rating-row { grid-template-columns: 1fr; }
  .settings-row .btn { margin-left: 0; width: 100%; }
  .word-row { grid-template-columns: 1fr; align-items: start; }
  .word-row-meta { justify-content: flex-start; }
}

@media (max-width: 460px) {
  .stat-grid-4 { grid-template-columns: 1fr; }
  .brand-text small { display: none; }
  .tab { padding: 8px 13px; font-size: 13px; }
  .card { padding: 18px; }
  .study-card { padding: 18px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

@media (max-width: 980px) {
  .chart-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .topbar-inner { flex-wrap: wrap; }
  .tabs { width: 100%; overflow-x: auto; }
  .tab { flex: 0 0 auto; }
  .week-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .day-chip { padding: 9px 8px; }
  .builder-library { grid-template-columns: 1fr; }
  .exercise-actions { grid-column: 2; justify-content: flex-start; }
  .guide-panel { padding: 18px; }
  .guide-actions .btn { flex: 1 1 auto; }
}

@media (max-width: 600px) {
  .exercise { grid-template-columns: auto minmax(0, 1fr); }
  .exercise .btn { grid-column: 2; justify-self: start; }
  .day-foot { flex-direction: column; align-items: stretch; }
  .day-actions { justify-content: space-between; }
  .history-table { font-size: 12.5px; }
  .history-table th, .history-table td { padding: 7px 6px; }
  .history-table th:nth-child(5), .history-table td:nth-child(5) { display: none; }
}
