/* ===== 练什么 · 样式 ===== */
:root {
  --bg: #0a0c10;
  --bg-2: #10141b;
  --card: #151a23;
  --card-2: #1b212c;
  --line: rgba(255, 255, 255, .075);
  --txt: #f1f4f9;
  --dim: #8d97a6;
  --dim-2: #5b6472;
  --acc: #ccff33;
  --acc-dim: rgba(204, 255, 51, .14);
  --danger: #ff5d5d;
  --tab-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --r: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC",
    "Helvetica Neue", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body {
  min-height: 100dvh;
  background:
    radial-gradient(900px 420px at 90% -10%, rgba(204, 255, 51, .07), transparent 60%),
    radial-gradient(700px 400px at -10% 0%, rgba(60, 130, 246, .08), transparent 55%),
    var(--bg);
  background-attachment: fixed;
}

button, input, a { font-family: inherit; }
button { cursor: pointer; border: 0; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; }
::selection { background: var(--acc); color: #0a0c10; }
input[type=search]::-webkit-search-cancel-button { display: none; }

#app {
  max-width: 680px;
  margin: 0 auto;
  min-height: 100dvh;
  padding-bottom: calc(var(--tab-h) + var(--safe-b) + 14px);
  position: relative;
}

/* ---------- 顶栏 ---------- */
.hdr {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(var(--safe-t) + 10px) 16px 10px;
  background: linear-gradient(180deg, rgba(10, 12, 16, .96) 55%, rgba(10, 12, 16, .72) 100%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.hdr-l { display: flex; align-items: center; gap: 10px; }
.logo {
  width: 34px; height: 34px;
  border-radius: 11px;
  display: grid; place-items: center;
  background: var(--acc);
  color: #0a0c10;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -.5px;
  box-shadow: 0 6px 18px rgba(204, 255, 51, .22);
}
.brand {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.2px;
  line-height: 1.15;
}
.brand small {
  display: block;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--dim-2);
  letter-spacing: .02em;
}
.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  color: var(--txt);
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line);
  transition: background .15s;
}
.icon-btn:active { background: rgba(255, 255, 255, .12); }

/* ---------- 搜索 ---------- */
.searchbar { padding: 2px 16px 12px; }
.search {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 44px;
  padding: 0 12px;
  border-radius: 13px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--dim-2);
}
.search:focus-within { border-color: rgba(204, 255, 51, .45); background: var(--card-2); }
.search input {
  flex: 1; min-width: 0;
  height: 100%;
  border: 0; outline: 0; background: transparent;
  color: var(--txt);
  font-size: 15px;
}
.search input::placeholder { color: var(--dim-2); }
.search-clear {
  display: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  color: var(--dim);
  font-size: 11px;
  line-height: 1;
  place-items: center;
}
.search.has-val .search-clear { display: grid; }

/* ---------- 分类条 ---------- */
.chiprow {
  display: flex;
  gap: 8px;
  padding: 0 16px 14px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chiprow::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 14px;
  border-radius: 11px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--dim);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: .16s;
}
.chip svg { width: 14px; height: 14px; }
.chip.on {
  background: var(--acc);
  border-color: var(--acc);
  color: #0a0c10;
  font-weight: 650;
}
.chip.on-fav { background: rgba(204, 255, 51, .16); color: var(--acc); border-color: rgba(204, 255, 51, .32); }
.chip:active { transform: scale(.96); }

/* ---------- 卡片网格 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 11px;
  padding: 0 16px;
}
@media (min-width: 520px) { .grid { grid-template-columns: repeat(3, 1fr); } }

.card {
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 0;
  border-radius: var(--r);
  background: var(--card);
  border: 1px solid var(--line);
  overflow: hidden;
  transition: transform .18s ease, border-color .18s;
}
.card:active { transform: scale(.975); border-color: rgba(204, 255, 51, .35); }
.thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  background: linear-gradient(160deg, #fdfdfe, #eef0f4);
  display: block;
  overflow: hidden;
}
.thumb img {
  width: 100%; height: 100%;
  object-fit: contain;
  padding: 6px;
  transition: transform .3s ease;
}
.card:active .thumb img { transform: scale(1.04); }
.fav-dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(10, 12, 16, .55);
  backdrop-filter: blur(6px);
}
.card-body { padding: 9px 10px 11px; flex: 1; display: flex; flex-direction: column; }
.card-title {
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: -.1px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-en {
  font-size: 10.5px;
  color: var(--dim-2);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-tags { display: flex; gap: 5px; margin-top: auto; padding-top: 8px; flex-wrap: wrap; }
.tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, .06);
  color: var(--dim);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tag.acc { background: var(--acc-dim); color: #c6f04a; }

.more-hint {
  text-align: center;
  color: var(--dim-2);
  font-size: 12px;
  padding: 22px 0 8px;
}

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 44px 20px; }
.empty .big { font-size: 40px; line-height: 1; opacity: .5; margin-bottom: 12px; }
.empty h3 { margin: 0 0 6px; font-size: 16px; font-weight: 650; }
.empty p { margin: 0; color: var(--dim-2); font-size: 13px; }
.empty .btn { margin-top: 20px; }

/* ---------- 通用 ---------- */
.page-title { margin: 6px 16px 2px; font-size: 24px; font-weight: 750; letter-spacing: -.6px; }
.page-sub { margin: 0 16px 16px; color: var(--dim-2); font-size: 12.5px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  padding: 0 20px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 650;
  transition: transform .15s, background .15s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--acc); color: #0a0c10; box-shadow: 0 8px 22px rgba(204, 255, 51, .18); flex: 1; }
.btn-ghost { background: rgba(255, 255, 255, .055); border: 1px solid var(--line); color: var(--txt); }
.btn-sm { height: 44px; font-size: 13.5px; border-radius: 12px; }
.btn-block { width: 100%; margin-top: 20px; }

.skel {
  border-radius: 12px;
  background: linear-gradient(90deg, #171c25 25%, #1f2531 37%, #171c25 63%);
  background-size: 400% 100%;
  animation: skel 1.3s ease infinite;
}
@keyframes skel { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- 详情 ---------- */
.detail {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.32, .72, 0, 1);
  will-change: transform;
}
.detail.show { transform: translateY(0); }
.detail-hdr {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(var(--safe-t) + 8px) 12px 8px;
  border-bottom: 1px solid transparent;
  transition: border-color .2s, background .2s;
  flex: 0 0 auto;
}
.detail-hdr-t {
  flex: 1;
  text-align: center;
  font-size: 13px;
  color: var(--dim);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fav-btn.on { color: var(--acc); border-color: rgba(204, 255, 51, .35); background: var(--acc-dim); }

.detail-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 16px 20px;
  overscroll-behavior: contain;
}
.detail-hero {
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(160deg, #fdfdfe, #eceff4);
  aspect-ratio: 1 / 1;
  max-height: 42vh;
  margin: 4px 0 16px;
  display: grid;
  place-items: center;
}
.detail-hero img { width: 100%; height: 100%; object-fit: contain; }
.detail-title { margin: 0; font-size: 23px; font-weight: 750; letter-spacing: -.5px; line-height: 1.28; }
.detail-en { color: var(--dim-2); font-size: 12.5px; margin-top: 4px; }
.detail-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.pill {
  font-size: 11.5px;
  padding: 6px 10px;
  border-radius: 9px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--dim);
}
.pill b { color: var(--txt); font-weight: 600; }
.pill.acc { background: var(--acc-dim); border-color: rgba(204, 255, 51, .25); }
.pill.acc b { color: #d3fa5c; }

.sec { margin-top: 24px; }
.sec-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sec-h h3 { margin: 0; font-size: 14.5px; font-weight: 700; letter-spacing: -.1px; }
.seg {
  display: flex;
  padding: 2px;
  border-radius: 9px;
  background: rgba(255, 255, 255, .06);
}
.seg button {
  padding: 4px 10px;
  border-radius: 7px;
  font-size: 11.5px;
  color: var(--dim-2);
  font-weight: 600;
}
.seg button.on { background: rgba(255, 255, 255, .14); color: var(--txt); }

.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: st;
}
.steps li {
  counter-increment: st;
  position: relative;
  padding: 0 0 14px 34px;
  font-size: 14px;
  color: #dbe2ec;
  line-height: 1.62;
}
.steps li::before {
  content: counter(st);
  position: absolute;
  left: 0; top: 1px;
  width: 22px; height: 22px;
  border-radius: 7px;
  background: rgba(204, 255, 51, .1);
  color: #c6f04a;
  font-size: 11.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.steps li:last-child { padding-bottom: 0; }

.detail-ft {
  flex: 0 0 auto;
  display: flex;
  gap: 10px;
  padding: 10px 16px calc(10px + var(--safe-b));
  background: linear-gradient(180deg, transparent, rgba(10, 12, 16, .92) 45%);
  backdrop-filter: blur(10px);
}

/* ---------- 今日训练 ---------- */
.today-hero {
  margin: 0 16px 18px;
  padding: 18px 18px 16px;
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(204, 255, 51, .13), rgba(204, 255, 51, .03) 55%, transparent);
  border: 1px solid rgba(204, 255, 51, .16);
}
.today-hero .date { font-size: 12.5px; color: #b6dc55; font-weight: 600; letter-spacing: .02em; }
.today-hero .stats { display: flex; gap: 26px; margin-top: 12px; }
.stat b { display: block; font-size: 22px; font-weight: 750; letter-spacing: -.6px; line-height: 1.1; }
.stat span { font-size: 10.5px; color: var(--dim); }

.witem {
  margin: 0 16px 11px;
  border-radius: var(--r);
  background: var(--card);
  border: 1px solid var(--line);
  padding: 11px 12px 10px;
}
.witem-top { display: flex; align-items: center; gap: 10px; }
.witem-thumb {
  width: 42px; height: 42px;
  border-radius: 11px;
  background: linear-gradient(160deg, #fdfdfe, #eef0f4);
  overflow: hidden;
  flex: 0 0 auto;
}
.witem-thumb img { width: 100%; height: 100%; object-fit: contain; }
.witem-t { flex: 1; min-width: 0; }
.witem-t h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.witem-t span { font-size: 10.5px; color: var(--dim-2); }
.witem-t .last { display: block; color: #9ab84a; font-size: 10.5px; margin-top: 1px; }
.witem-x { color: var(--dim-2); width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; }
.witem-x:active { background: rgba(255, 93, 93, .12); color: var(--danger); }

.sets { margin-top: 10px; display: flex; flex-direction: column; gap: 7px; }
.setrow { display: flex; align-items: center; gap: 8px; }
.setno {
  width: 18px;
  font-size: 11px;
  color: var(--dim-2);
  text-align: center;
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}
.setin {
  flex: 1;
  min-width: 0;
  height: 37px;
  padding: 0 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line);
  color: var(--txt);
  font-size: 14px;
  text-align: center;
  outline: 0;
  font-variant-numeric: tabular-nums;
}
.setin:focus { border-color: rgba(204, 255, 51, .45); background: rgba(204, 255, 51, .05); }
.setin::placeholder { color: var(--dim-2); font-size: 12px; }
.setx { color: var(--dim-2); font-size: 12px; }
.setcheck {
  width: 37px; height: 37px;
  flex: 0 0 auto;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .05);
  color: var(--dim-2);
  display: grid;
  place-items: center;
  transition: .15s;
}
.setcheck.on { background: var(--acc); border-color: var(--acc); color: #0a0c10; }
.witem-add {
  margin-top: 9px;
  width: 100%;
  height: 33px;
  border-radius: 9px;
  border: 1px dashed rgba(255, 255, 255, .13);
  color: var(--dim);
  font-size: 12.5px;
}

/* ---------- 记录 ---------- */
.logstats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin: 0 16px 20px;
}
.lstat {
  padding: 13px 10px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  text-align: center;
}
.lstat b { display: block; font-size: 19px; font-weight: 750; letter-spacing: -.5px; }
.lstat span { font-size: 10px; color: var(--dim-2); }

.logday { margin: 0 16px 20px; }
.logday-h {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
}
.logday-h b { font-size: 13.5px; font-weight: 700; }
.logday-h span { font-size: 10.5px; color: var(--dim-2); }
.logcard {
  padding: 9px 11px;
  border-radius: 11px;
  background: var(--card);
  border: 1px solid var(--line);
  margin-bottom: 6px;
}
.logcard .row { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.logcard .row b {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.logcard .row span {
  font-size: 11px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}
.meta { display: flex; gap: 12px; align-items: center; font-size: 10.5px; color: var(--dim-2); }

/* ---------- 标签栏 ---------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: flex;
  max-width: 680px;
  margin: 0 auto;
  height: calc(var(--tab-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(10, 12, 16, .84);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--dim-2);
  font-size: 10px;
  font-weight: 600;
  position: relative;
  transition: color .16s;
}
.tab svg { width: 22px; height: 22px; }
.tab.on { color: var(--acc); }
.tab .dot {
  position: absolute;
  top: 9px;
  right: 50%;
  margin-right: -18px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--acc);
  opacity: 0;
  transform: scale(.4);
  transition: .2s;
}
.tab .dot.on { opacity: 1; transform: scale(1); }

/* ---------- 抽屉 ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 80; }
.sheet-mask {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, .55);
  opacity: 0;
  transition: opacity .28s;
  backdrop-filter: blur(2px);
}
.sheet-wrap.show .sheet-mask { opacity: 1; }
.sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-width: 680px;
  margin: 0 auto;
  max-height: 84dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 16px calc(20px + var(--safe-b));
  border-radius: 22px 22px 0 0;
  background: var(--bg-2);
  border-top: 1px solid rgba(255, 255, 255, .1);
  transform: translateY(100%);
  transition: transform .32s cubic-bezier(.32, .72, 0, 1);
  box-shadow: 0 -20px 50px rgba(0, 0, 0, .5);
}
.sheet-wrap.show .sheet { transform: translateY(0); }
.sheet-grip {
  width: 36px; height: 4px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .16);
  margin: 4px auto 14px;
}
.sheet h3 { margin: 0 0 4px; font-size: 17px; font-weight: 700; letter-spacing: -.2px; }
.sheet-sec { margin: 16px 0 0; }
.sheet-sec h4 {
  margin: 0 0 9px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--dim-2);
  letter-spacing: .04em;
}
.opts { display: flex; flex-wrap: wrap; gap: 7px; }
.opt {
  padding: 8px 13px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line);
  color: var(--dim);
  font-size: 13px;
  transition: .15s;
}
.opt.on { background: var(--acc); border-color: var(--acc); color: #0a0c10; font-weight: 650; }
.more-link {
  margin-top: 9px;
  font-size: 12px;
  color: var(--dim);
  padding: 2px 0;
}
.more-link:active { color: var(--acc); }
.listbtn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 14.5px;
}
.listbtn:last-child { border-bottom: 0; }
.listbtn span { color: var(--dim-2); font-size: 12.5px; }

/* ---------- 休息条 ---------- */
.restbar {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(var(--tab-h) + var(--safe-b) + 10px);
  z-index: 45;
  display: flex;
  justify-content: center;
  pointer-events: none;
  padding: 0 16px;
}
.restbar-in {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px 9px 16px;
  border-radius: 999px;
  background: rgba(28, 34, 44, .93);
  border: 1px solid rgba(204, 255, 51, .3);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  backdrop-filter: blur(14px);
  animation: rise .25s ease;
}
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }
.restbar b { font-size: 17px; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.restbar small { font-size: 10.5px; color: var(--dim); margin-left: 5px; }
.restbar button {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .09);
  color: var(--txt);
  font-size: 15px;
}
#rest-add { color: var(--acc); font-weight: 700; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + var(--safe-b) + 26px);
  transform: translate(-50%, 12px);
  z-index: 100;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(240, 244, 250, .95);
  color: #0a0c10;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transition: .24s;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .4);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 桌面 ---------- */
@media (min-width: 720px) {
  body { padding: 0 0 20px; }
  #app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
