:root {
  --bg: #f5f6f8;
  --card: #fff;
  --text: #1d2129;
  --muted: #86909c;
  --line: #e5e6eb;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --shadow: 0 6px 24px rgba(0, 0, 0, .08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 16px 40px;
}

.topbar { text-align: center; padding: 8px 0 18px; }

.book-name {
  display: inline-block;
  font-size: 12px;
  color: var(--brand);
  background: #e8f0ff;
  border-radius: 20px;
  padding: 3px 12px;
  letter-spacing: .5px;
}

.video-title {
  margin: 10px 0 6px;
  font-size: clamp(18px, 4vw, 26px);
  line-height: 1.35;
  font-weight: 700;
  word-break: break-all;
}

.counter { font-size: 13px; color: var(--muted); }

.player-wrap {
  position: relative;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  aspect-ratio: 16 / 9;
}

#player { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }

.play-cover {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, .42);
  color: #fff;
  font-size: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
}

.play-cover[hidden] { display: none; }

.play-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: #111;
  display: grid;
  place-items: center;
  font-size: 26px;
  padding-left: 4px;
}

.steps { display: flex; gap: 12px; margin-top: 16px; }

.step {
  flex: 1 1 0;
  min-width: 0;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .03);
  transition: border-color .15s, transform .15s;
}

.step:hover:not(:disabled) { border-color: var(--brand); transform: translateY(-1px); }
.step:disabled { opacity: .45; cursor: default; }
.step-next { text-align: right; }

.step-label { display: block; font-size: 12px; color: var(--brand); font-weight: 600; }
.step-name {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings {
  margin-top: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px 16px;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  cursor: pointer;
  font-size: 14px;
}

.switch-text { flex: 1; }
.switch-sub { color: var(--muted); font-size: 12px; }
.switch-row input { position: absolute; opacity: 0; width: 0; height: 0; }

.switch {
  flex: 0 0 auto;
  width: 46px;
  height: 26px;
  border-radius: 13px;
  background: #c9cdd4;
  position: relative;
  transition: background .2s;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  transition: transform .2s;
}

.switch-row input:checked + .switch { background: var(--brand); }
.switch-row input:checked + .switch::after { transform: translateX(20px); }

.resume-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 12px;
  padding: 12px 16px;
  background: #eef4ff;
  border: 1px solid #c7d9ff;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  transition: border-color .15s, background .15s;
}

.resume-card[hidden] { display: none; }
.resume-card:hover { background: #e3edff; border-color: var(--brand); }

.resume-icon {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
  padding-left: 2px;
}

.resume-body { flex: 1; min-width: 0; }
.resume-label { display: block; font-size: 12px; color: var(--brand); font-weight: 600; }
.resume-name {
  display: block;
  margin-top: 3px;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.resume-time { flex: 0 0 auto; font-size: 12px; color: var(--muted); }

.catalog-fab {
  position: fixed;
  left: 20px;
  bottom: 24px;
  z-index: 20;
  border: 0;
  border-radius: 26px;
  padding: 12px 22px;
  background: var(--brand);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(37, 99, 235, .35);
  transition: transform .15s, background .15s;
}

.catalog-fab:hover { transform: translateY(-2px) scale(1.03); background: var(--brand-dark); }

.drawer {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 30;
  width: min(380px, 86vw);
  background: var(--card);
  box-shadow: 6px 0 30px rgba(0, 0, 0, .12);
  transform: translateX(-105%);
  transition: transform .25s ease;
  display: flex;
  flex-direction: column;
}

.drawer.open { transform: translateX(0); }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 17px;
}

.drawer-close { border: 0; background: none; font-size: 18px; color: var(--muted); cursor: pointer; padding: 4px 8px; }

.drawer-list { overflow-y: auto; flex: 1; padding: 8px 0 24px; -webkit-overflow-scrolling: touch; }

.drawer-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  padding: 11px 20px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  cursor: pointer;
  border-left: 3px solid transparent;
}

.drawer-item:hover { background: #f2f5ff; }
.drawer-item.active { background: #e8f0ff; color: var(--brand); border-left-color: var(--brand); font-weight: 600; }

.mask {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: rgba(0, 0, 0, .35);
}

.mask[hidden] { display: none; }

@media (max-width: 600px) {
  .app { padding: 10px 10px 90px; }
  .steps { gap: 8px; }
  .step { padding: 10px; }
  .step-name { font-size: 12px; }
  .switch-sub { display: block; margin-top: 2px; }
  .catalog-fab { left: 12px; bottom: 16px; }
}
