/* 开车小本本 */

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 50% -200px, #FDE3EA 0%, rgba(253, 227, 234, 0) 70%),
    var(--cream);
  padding-bottom: env(safe-area-inset-bottom);
}

/* ---------- header ---------- */
.top {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 1120px;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) 16px 4px;
}
.home {
  flex: none;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--paper);
  color: #F2C14E;
  box-shadow: var(--shadow);
  transition: transform .2s var(--ease-spring);
}
.home:active { transform: scale(.92); }
.home svg { width: 22px; height: 22px; }
.top-title { flex: 1; min-width: 0; }
.top h1 {
  margin: 0;
  font-family: var(--font);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 1.2;
}
.sub { margin: 2px 0 0; color: var(--ink-soft); font-size: 13px; }
.buddy {
  flex: none;
  width: 58px;
  height: 70px;
  margin: -6px 0 -10px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transition: transform .3s var(--ease-spring);
}
.buddy:active { transform: scale(.94); }
.buddy.is-jump { animation: buddy-jump .6s var(--ease-spring); }
@keyframes buddy-jump { 40% { transform: translateY(-14px) rotate(-6deg); } }
.buddy-say {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
  height: 0;
  text-align: right;
  position: relative;
  z-index: 5;
}
.buddy-say span {
  display: inline-block;
  margin-top: 4px;
  padding: 8px 12px;
  border-radius: 14px 4px 14px 14px;
  background: var(--paper);
  color: var(--rose-deep);
  font-size: 14px;
  box-shadow: var(--shadow);
  animation: say-in .35s var(--ease-spring);
}
@keyframes say-in { from { opacity: 0; transform: translateY(-6px) scale(.9); } }

/* ---------- filters ---------- */
.filters {
  position: sticky;
  top: 0;
  z-index: 4;
  margin-top: 10px;
  background: linear-gradient(var(--cream) 70%, rgba(255, 248, 244, 0));
  padding: 8px 0 10px;
}
.chips {
  display: flex;
  gap: 8px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  cursor: pointer;
  transition: background .2s, border-color .2s, color .2s, transform .2s var(--ease-spring);
}
.chip:active { transform: scale(.95); }
.chip .n { color: var(--ink-faint); font-size: 12px; }
.chip .h { color: var(--rose); }
.chip[aria-selected="true"] .h { color: #fff; }
.chip[aria-selected="true"] { background: var(--rose); border-color: var(--rose); color: #fff; }
.chip[aria-selected="true"] .n { color: rgba(255, 255, 255, .8); }

.play-row {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 1120px;
  margin: 2px auto 14px;
  padding: 0 16px;
}
.play-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 20px 0 16px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #F28BA5, #E7728F);
  color: #fff;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 500;
  box-shadow: 0 6px 18px rgba(231, 114, 143, .35);
  cursor: pointer;
  transition: transform .2s var(--ease-spring), opacity .2s;
}
.play-all:active { transform: scale(.96); }
.play-all:disabled { opacity: .45; box-shadow: none; cursor: default; }
.play-all svg { width: 20px; height: 20px; }
.play-hint { margin: 0; color: var(--ink-soft); font-size: 13px; }

/* ---------- cards ---------- */
.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
}
@media (min-width: 760px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .cards { grid-template-columns: repeat(3, 1fr); } }

.card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
  overflow: hidden;
  scroll-margin-top: 70px;
  animation: card-in .5s ease-out both;
}
.card[hidden] { display: none; }
@keyframes card-in { from { opacity: 0; transform: translateY(10px); } }

.card-scene { position: relative; background: #E4F1DF; aspect-ratio: 360 / 300; }
.scene-box { position: absolute; inset: 0; }
.scene-open {
  position: absolute;
  inset: 0;
  width: 100%;
  border: 0;
  background: none;
  cursor: pointer;
}
.scene-open::after {
  content: '';
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92) url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Cpath d="M14 4h6v6M10 20H4v-6M20 4l-6.5 6.5M4 20l6.5-6.5" fill="none" stroke="%23E7728F" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/%3E%3C/svg%3E') center / 16px no-repeat;
  box-shadow: 0 2px 6px rgba(120, 60, 80, .15);
  transition: transform .25s var(--ease-spring);
}
.scene-open:active::after { transform: scale(.88); }
.scene-open.corner { inset: auto 0 0 auto; width: 52px; height: 52px; }

.variants {
  display: flex;
  gap: 6px;
  padding: 10px 12px 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.variants:empty { display: none; }
.vtab {
  flex: none;
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--blush-2);
  color: var(--ink-soft);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.vtab.bad[aria-selected="true"] { background: var(--bad-soft); color: var(--bad); }
.vtab.good[aria-selected="true"] { background: var(--good-soft); color: var(--good); }
.vtab.neutral[aria-selected="true"] { background: var(--blush); color: var(--rose-deep); }

.steps { display: flex; gap: 4px; padding: 10px 14px 0; }
.steps i {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
  position: relative;
}
.steps i.done { background: var(--rose); opacity: .45; }
.steps i.now { background: var(--rose); }

.card-body { padding: 10px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.card-meta { display: flex; align-items: center; gap: 8px; min-height: 34px; }
.cat {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--blush-2);
  color: var(--rose-deep);
  font-size: 12.5px;
  white-space: nowrap;
}
.en {
  flex: 1;
  min-width: 0;
  color: var(--ink-faint);
  font-family: var(--font);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fav, .p-fav {
  position: relative;
  flex: none;
  width: 40px;
  height: 40px;
  margin-right: -8px;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}
.fav::before, .p-fav::before {
  content: '';
  position: absolute;
  inset: 8px;
  background: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Cpath d="M12 20.5s-7.5-4.6-9.2-9.3C1.6 7.8 4 4.5 7.4 4.5c2 0 3.6 1.1 4.6 2.7 1-1.6 2.6-2.7 4.6-2.7 3.4 0 5.8 3.3 4.6 6.7C19.5 15.9 12 20.5 12 20.5z" fill="none" stroke="%23D9A9B6" stroke-width="1.8" stroke-linejoin="round"/%3E%3C/svg%3E') center / contain no-repeat;
  transition: transform .3s var(--ease-spring);
}
.fav[aria-pressed="true"]::before, .p-fav[aria-pressed="true"]::before {
  background-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Cpath d="M12 20.5s-7.5-4.6-9.2-9.3C1.6 7.8 4 4.5 7.4 4.5c2 0 3.6 1.1 4.6 2.7 1-1.6 2.6-2.7 4.6-2.7 3.4 0 5.8 3.3 4.6 6.7C19.5 15.9 12 20.5 12 20.5z" fill="%23E7728F" stroke="%23E7728F" stroke-width="1.8" stroke-linejoin="round"/%3E%3C/svg%3E');
}
.fav.pop::before, .p-fav.pop::before { animation: heart-pop .45s var(--ease-spring); }
@keyframes heart-pop { 40% { transform: scale(1.35); } }
.burst {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  margin: -5px;
  pointer-events: none;
  color: #F28BA5;
  font-size: 11px;
  line-height: 10px;
  text-align: center;
  animation: burst .7s ease-out forwards;
}
@keyframes burst { to { transform: translate(var(--dx), var(--dy)) scale(.6); opacity: 0; } }

.card-title {
  margin: 2px 0 6px;
  font-family: var(--font);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.35;
}
.cap {
  min-height: 3.1em;
  margin: 0 0 8px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--blush-2);
  color: var(--ink);
  font-size: 15.5px;
  line-height: 1.5;
  transition: background .3s;
}
.cap b, .tip b, .p-cap b, .p-tip b, .points b, .checks b { color: var(--rose-deep); font-weight: 600; }
.card.is-bad .cap { background: #FFF1F2; }
.card.is-good .cap { background: #F0FAF4; }
.tip { margin: 0 0 6px; color: var(--ink-soft); font-size: 14.5px; line-height: 1.6; }

.more { margin-top: auto; border-top: 1px dashed var(--line); padding-top: 8px; }
.more summary {
  list-style: none;
  cursor: pointer;
  color: var(--rose);
  font-size: 14px;
  padding: 6px 0;
}
.more summary::-webkit-details-marker { display: none; }
.more summary::after { content: ' ▾'; font-size: 11px; }
.more[open] summary::after { content: ' ▴'; }
.points { margin: 4px 0 10px; padding-left: 18px; font-size: 14.5px; line-height: 1.65; }
.points li { margin: 2px 0; }
.points li::marker { color: var(--rose); }
.checks { display: grid; gap: 8px; margin-bottom: 10px; }
.check { padding: 9px 11px; border-radius: 12px; font-size: 13.5px; line-height: 1.55; }
.check .k { display: inline-block; margin-right: 6px; padding: 0 7px; border-radius: 6px; font-size: 12px; font-family: var(--font); }
.check.law { background: var(--law-soft); }
.check.law .k { background: var(--law); color: #fff; }
.check.icbc { background: #EAF5FB; }
.check.icbc .k { background: #4C9BC4; color: #fff; }
.check.coach { background: var(--butter); }
.check.coach .k { background: #E3A93B; color: #fff; }
.raw {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid var(--blush);
  border-radius: 4px 12px 12px 4px;
  background: #FFFAF7;
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.7;
  white-space: pre-line;
}
.raw::before { content: '我的笔记原文'; display: block; margin-bottom: 4px; color: var(--ink-faint); font-size: 12px; }

.empty { max-width: 420px; margin: 30px auto; padding: 0 24px; text-align: center; color: var(--ink-soft); }

.foot { max-width: 720px; margin: 40px auto 0; padding: 0 20px 40px; text-align: center; color: var(--ink-faint); font-size: 12.5px; }
.foot p { margin: 6px 0; }
.love { color: var(--rose); font-family: var(--font); font-size: 15px; }

/* ---------- the little car easter egg ---------- */
.drive-car {
  position: fixed;
  top: 6px;
  left: -80px;
  z-index: 30;
  width: 70px;
  height: 36px;
  pointer-events: none;
  background: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 70 36"%3E%3Cpath d="M8 24 Q8 14 18 13 L24 6 Q26 4 30 4 L46 4 Q50 4 52 7 L57 13 Q66 14 66 22 L66 26 L8 26Z" fill="%23F58DAA"/%3E%3Cpath d="M27 8 L45 8 L50 13 L25 13Z" fill="%23CFE3F6"/%3E%3Ccircle cx="20" cy="27" r="6" fill="%233A3034"/%3E%3Ccircle cx="54" cy="27" r="6" fill="%233A3034"/%3E%3Ccircle cx="20" cy="27" r="2.4" fill="%23fff"/%3E%3Ccircle cx="54" cy="27" r="2.4" fill="%23fff"/%3E%3Cellipse cx="36" cy="2" rx="8" ry="5" fill="%23FF977D"/%3E%3Ccircle cx="33" cy="1" r="1.6" fill="%23fff"/%3E%3C/svg%3E') center / contain no-repeat;
}
.drive-car.go { animation: car-cross 3.4s cubic-bezier(.5, 0, .5, 1) forwards; }
@keyframes car-cross {
  0% { transform: translateX(0); }
  100% { transform: translateX(calc(100vw + 160px)); }
}

/* ---------- player ---------- */
.player {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #FFF0F3 0%, #FFF8F4 60%, #FDEEE6 100%);
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  animation: player-in .35s ease-out;
}
.player[hidden] { display: none; }
@keyframes player-in { from { opacity: 0; transform: scale(.98); } }
.player-top { display: flex; align-items: center; gap: 10px; padding: 12px 12px 4px 16px; }
.bars { flex: 1; display: flex; gap: 3px; }
.bars i { flex: 1; height: 4px; border-radius: 2px; background: rgba(231, 114, 143, .18); overflow: hidden; }
.bars i b { display: block; height: 100%; width: 0; background: var(--rose); border-radius: 2px; }
.bars i.done b { width: 100%; }
.player-actions { display: flex; align-items: center; gap: 2px; }
.p-fav { margin: 0; }
.p-close {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
}
.p-close svg { width: 22px; height: 22px; }
.player-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: 0 16px;
  min-height: 0;
}
.p-cat { margin: 0; color: var(--rose); font-size: 13px; }
.p-title { margin: 2px 0 10px; font-family: var(--font); font-size: 21px; font-weight: 600; text-align: center; line-height: 1.35; }
.p-scene {
  width: 100%;
  max-height: 52vh;
  aspect-ratio: 360 / 300;
  border-radius: var(--radius);
  overflow: hidden;
  background: #E4F1DF;
  box-shadow: var(--shadow);
}
.p-scene .scene-svg { height: 100%; }
.p-variant { margin: 10px 0 0; font-family: var(--font); font-size: 13px; color: var(--ink-soft); }
.p-variant.bad { color: var(--bad); }
.p-variant.good { color: var(--good); }
.p-cap { min-height: 3em; margin: 4px 0 6px; font-size: 18px; text-align: center; line-height: 1.5; }
.p-tip { margin: 0; color: var(--ink-soft); font-size: 14px; text-align: center; line-height: 1.6; }
.player-nav { display: flex; justify-content: center; gap: 22px; padding: 10px 0 18px; }
.player-nav button {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: var(--paper);
  color: var(--rose);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.player-nav svg { width: 24px; height: 24px; }
#p-pause { background: var(--rose); color: #fff; }
#p-pause::before {
  content: '';
  width: 18px;
  height: 18px;
  background: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Crect x="6" y="5" width="4" height="14" rx="1.5" fill="%23fff"/%3E%3Crect x="14" y="5" width="4" height="14" rx="1.5" fill="%23fff"/%3E%3C/svg%3E') center / contain no-repeat;
}
.player.is-paused #p-pause::before {
  background-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Cpath d="M8 5.5v13a1 1 0 0 0 1.5.9l10.4-6.5a1 1 0 0 0 0-1.8L9.5 4.6A1 1 0 0 0 8 5.5z" fill="%23fff"/%3E%3C/svg%3E');
}

.finale {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: linear-gradient(180deg, #FFF0F3, #FFF8F4);
  animation: player-in .5s ease-out;
}
.finale[hidden] { display: none; }
.finale-art { position: relative; width: 170px; }
.finale h2 { margin: 12px 0 4px; font-family: var(--font); font-size: 26px; }
.finale p { margin: 0 0 20px; color: var(--ink-soft); font-size: 16px; }
.n-sign {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin: 0 2px;
  border: 2px solid #2E9B57;
  border-radius: 4px;
  background: #fff;
  color: #2E9B57;
  font-family: var(--font);
  font-weight: 700;
  vertical-align: -6px;
}
.finale .n-hold {
  position: absolute;
  right: -18px;
  top: 52%;
  width: 46px;
  height: 46px;
  font-size: 30px;
  transform: rotate(8deg);
  animation: n-wave 1.6s ease-in-out infinite;
}
@keyframes n-wave { 50% { transform: rotate(-6deg) translateY(-4px); } }
.finale-btns { display: flex; gap: 10px; }
.finale-btns button {
  height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--rose);
  color: #fff;
  font-family: var(--font);
  font-size: 15px;
  cursor: pointer;
}
.finale-btns .ghost { background: var(--paper); color: var(--rose); box-shadow: var(--shadow); }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i {
  position: absolute;
  top: -40px;
  width: 26px;
  animation: fall linear forwards;
}
@keyframes fall { to { transform: translateY(110vh) rotate(var(--r)); } }

/* ---------- scene bits that only exist on this page ---------- */
.arm { animation: arm-in .4s var(--ease-spring); transform-box: fill-box; transform-origin: right center; }
@keyframes arm-in { from { opacity: 0; transform: scale(.6); } }
.dash-blink { animation: sig-blink .74s steps(1) infinite; }
.ctl { cursor: pointer; }
.ctl.is-hl { animation: none; filter: drop-shadow(0 0 6px #F28BA5); }
.fog { transition: opacity .8s; }
.wiper, .wiper2 { transform-box: view-box; }
.wiper.w1 { transform-origin: 70px 146px; animation: wipe 1.2s ease-in-out infinite; }
.wiper.w2 { transform-origin: 190px 146px; animation: wipe 1.2s ease-in-out infinite; }
.wiper2.w1 { transform-origin: 54px 206px; }
.wiper2.w2 { transform-origin: 148px 206px; }
.wiper2.once { animation: wipe 1.2s ease-in-out 1; }
.wiper2.loop { animation: wipe 1.2s ease-in-out infinite; }
@keyframes wipe { 50% { transform: rotate(-112deg); } }

@media (prefers-reduced-motion: reduce) {
  .card, .player, .finale { animation: none; }
  .wiper, .wiper2, .dash-blink { animation: none; }
}
