:root {
  --paper: #f5f1e6;
  --card: #f8f5ec;
  --ink: #2a2a2e;
  --ink-2: #5d5a55;
  --ink-3: #9a948a;
  --line: rgba(42, 42, 46, .12);
  --green: #1f9d55;
  --green-dark: #146b3a;
  --red: #d23228;
  --serif: "Iowan Old Style", "Charter", "Palatino Linotype", ui-serif, Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper) var(--paper-img, none) repeat;
  color: var(--ink); font-family: var(--sans);
  overflow: hidden; overscroll-behavior: none;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
#app { position: fixed; inset: 0; display: flex; justify-content: center; }
.screen { position: absolute; inset: 0; margin: 0 auto; max-width: 520px; display: flex; flex-direction: column; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.sketch { display: block; width: 100%; mix-blend-mode: multiply; }

/* ---------- home ---------- */
.home { padding: calc(20px + var(--safe-top)) 20px calc(20px + var(--safe-bot)); }
.home .brand { display: flex; align-items: center; justify-content: space-between; font-size: 15px; color: var(--ink-2); height: 32px; }
.home .brand b { font-weight: 600; color: var(--ink); }
.home .hello { width: 100%; aspect-ratio: 1000 / 430; margin-top: 12px; }
.home .list { margin-top: 8px; display: flex; flex-direction: column; gap: 12px; }
.tile {
  display: flex; align-items: center; gap: 16px; text-align: left; width: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px;
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 6px 18px -12px rgba(60,45,20,.35);
  opacity: 0; transform: translateY(14px);
  transition: opacity .6s ease, transform .7s cubic-bezier(.2,.8,.2,1), box-shadow .2s ease;
}
.tile.in { opacity: 1; transform: none; }
.tile:active { transform: scale(.98); }
.tile .num { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--ink); display: grid; place-items: center; font-family: var(--serif); font-size: 19px; }
.tile.done .num { background: var(--green); border-color: var(--green); color: #fff; }
.tile .meta { font-size: 13px; color: var(--ink-3); margin-bottom: 3px; }
.tile .t { font-family: var(--serif); font-size: 21px; line-height: 1.2; }
.tile.done .t { color: var(--ink-2); }
.home .mascot { flex: 1; min-height: 120px; width: 100%; margin: 8px 0; }
.home .foot { display: flex; flex-direction: column; gap: 12px; align-items: stretch; opacity: 0; transition: opacity .6s ease .1s; }
.home .foot.in { opacity: 1; }
.home .note { text-align: center; font-size: 14px; color: var(--ink-3); line-height: 1.45; }
.cta {
  height: 56px; border-radius: 28px; background: var(--ink); color: var(--paper);
  font-size: 17px; font-weight: 600; letter-spacing: .01em;
  transition: transform .15s ease, background .2s ease;
}
.cta:active { transform: scale(.97); }
.cta.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }

/* ---------- deck ---------- */
.deck { padding-top: var(--safe-top); }
.bar { display: flex; align-items: center; gap: 12px; padding: 14px 16px 10px; position: relative; z-index: 5; }
.segs { flex: 1; display: flex; gap: 4px; }
.seg { flex: 1; height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; }
.seg i { display: block; height: 100%; width: 100%; background: var(--ink); transform-origin: left; transform: scaleX(0); transition: transform .35s ease; }
.close { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; margin-right: -6px; }
.close:active { background: var(--line); }
.stage { position: relative; flex: 1; margin: 2px 12px calc(14px + var(--safe-bot)); touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.card {
  position: absolute; inset: 0; border-radius: 24px; overflow: hidden;
  background: var(--card) var(--paper-img, none) repeat;
  border: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 18px 40px -22px rgba(60,45,20,.45), 0 2px 6px -2px rgba(60,45,20,.12);
  display: flex; flex-direction: column; padding: 22px 22px 24px;
  will-change: transform; transform-origin: 50% 110%;
}
.card .topic { font-size: 13px; color: var(--ink-3); display: flex; justify-content: space-between; }
.card .draw { margin: 6px -10px 14px; flex: 1 1 auto; min-height: 0; height: 0; }
.card .body { flex: none; font-family: var(--serif); font-size: clamp(20px, 5.4vw, 23px); line-height: 1.42; letter-spacing: -.003em; }
.card .body .s { display: inline; }
.card .hint { position: absolute; right: 22px; bottom: 18px; font-size: 13px; color: var(--ink-3); display: flex; gap: 6px; align-items: center; opacity: 0; transition: opacity .5s ease 1.2s; }
.card.on .hint { opacity: 1; }
.card .hint svg { animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(5px); } }

/* cover */
.card.cover .draw { margin-top: 10px; }
.card.cover h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(34px, 9.5vw, 42px); line-height: 1.08; margin: 0 0 10px; letter-spacing: -.015em; }
.card.cover .dek { font-family: var(--serif); font-size: 19px; line-height: 1.4; color: var(--ink-2); }
.card.cover .meta { margin-top: 14px; font-size: 13px; color: var(--ink-3); padding-bottom: 22px; }

/* quiz */
.card.quiz .q { font-family: var(--serif); font-size: clamp(22px, 6vw, 25px); line-height: 1.3; margin: 18px 0 0; }
.card.quiz .opts { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
.opt {
  text-align: left; padding: 15px 18px; border-radius: 16px; border: 1.5px solid var(--line); background: rgba(255,255,255,.35);
  font-size: 17px; line-height: 1.3; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  transition: border-color .25s ease, background .25s ease, color .25s ease, opacity .3s ease, transform .15s ease;
}
.opt:active { transform: scale(.98); }
.opt.right { border-color: var(--green); background: rgba(31,157,85,.1); color: var(--green-dark); }
.opt.wrong { border-color: var(--red); background: rgba(210,50,40,.07); color: var(--red); animation: shake .4s ease; }
.answered .opt:not(.right):not(.wrong) { opacity: .45; }
@keyframes shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
.card.quiz .why { margin-top: 18px; font-family: var(--serif); font-size: 18px; line-height: 1.45; color: var(--ink-2); opacity: 0; transform: translateY(8px); transition: opacity .5s ease, transform .6s cubic-bezier(.2,.8,.2,1); }
.card.quiz.answered .why { opacity: 1; transform: none; }
.card.quiz .mark { width: 100%; flex: 1 1 auto; min-height: 0; height: 0; margin-top: 10px; transform-origin: 20% 95%; }
.hop { animation: hop .7s cubic-bezier(.3,.7,.3,1); }
.droop { animation: droop .8s ease; }
@keyframes hop { 0% { transform: none; } 18% { transform: scale(1.06, .9); } 45% { transform: translateY(-14px) scale(.96, 1.05); } 70% { transform: translateY(0) scale(1.04, .95); } 100% { transform: none; } }
@keyframes droop { 0% { transform: none; } 35% { transform: scale(1.05, .92); } 100% { transform: none; } }
.home .mascot { transform-origin: 50% 92%; cursor: pointer; animation: breathe 4.2s ease-in-out 5s infinite; }
.home .mascot.hop { animation: hop .7s cubic-bezier(.3,.7,.3,1); }
@keyframes breathe { 0%, 100% { transform: none; } 50% { transform: scale(1.015, .985); } }
.note, .dek, .body { text-wrap: pretty; }
.home .note { text-wrap: balance; }
/* between two ideas */
.between { justify-content: center; align-items: center; padding: 20px; cursor: pointer; }
.between .words { width: 100%; aspect-ratio: 1000 / 520; }
.between .dots { display: flex; gap: 10px; margin-top: 26px; }
.between .dots i { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--ink); }
.between .dots i.on { background: var(--green); border-color: var(--green); }
.between .upnext { margin-top: 26px; text-align: center; opacity: 0; animation: fadeIn .6s ease 1s both; }
.between .upnext span { display: block; font-size: 13px; color: var(--ink-3); margin-bottom: 4px; }
.between .upnext b { font-family: var(--serif); font-weight: 400; font-size: 24px; }

/* end of an idea */
.card.end .keep { font-size: 13px; color: var(--ink-3); margin-top: 18px; }
.card.end .take { width: 100%; flex: 1 1 auto; min-height: 0; height: 0; margin: 4px 0 12px; }
.card.end .src { flex: none; font-family: var(--serif); font-size: 15px; line-height: 1.5; color: var(--ink-2); border-top: 1px solid var(--line); padding-top: 14px; }
.card.end .src b { font-family: var(--sans); font-weight: 600; font-size: 12px; color: var(--ink-3); display: block; margin-bottom: 4px; }
.card.end .cta { margin-top: 18px; }

/* ---------- done ---------- */
.done { padding: calc(20px + var(--safe-top)) 20px calc(20px + var(--safe-bot)); }
.done .jelly { position: relative; flex: 1; min-height: 240px; margin: 0 -20px; }
.done .jelly canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; touch-action: none; }
.done .words { width: 100%; aspect-ratio: 1000 / 380; }
.done .stats { display: flex; justify-content: center; gap: 22px; font-size: 14px; color: var(--ink-2); margin: 4px 0 18px; opacity: 0; transition: opacity .8s ease; }
.done .stats.in { opacity: 1; }
.done .stats b { font-family: var(--serif); font-size: 26px; font-weight: 400; color: var(--ink); display: block; text-align: center; }
.done .tip { text-align: center; font-size: 13px; color: var(--ink-3); margin-bottom: 14px; min-height: 18px; }

.fade-enter { animation: fadeIn .45s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
.deck .stage { animation: rise .6s cubic-bezier(.2,.8,.2,1) both; }
.deck .bar { animation: fadeIn .5s ease .15s both; }
@keyframes rise { from { opacity: 0; transform: translateY(46px) scale(.96); } to { opacity: 1; transform: none; } }

/* ---------- program: home, paths ---------- */
.home .list { flex: 1; min-height: 0; overflow-y: auto; margin: 4px -20px 0; padding: 4px 20px 24px; gap: 10px; -webkit-overflow-scrolling: touch; }
.home .list > * { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .7s cubic-bezier(.2,.8,.2,1); }
.home .list > .in { opacity: 1; transform: none; }
.brand .goal { display: flex; gap: 6px; }
.brand .goal i { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--ink-3); }
.brand .goal i.on { background: var(--green); border-color: var(--green); }
.next {
  position: relative; display: flex; flex-direction: column; gap: 4px; text-align: left; width: 100%;
  background: var(--ink); color: var(--paper); border-radius: 22px; padding: 20px 60px 20px 20px;
  box-shadow: 0 18px 36px -22px rgba(30,25,15,.7);
}
.next:active { transform: scale(.98) !important; }
.next .lab { font-size: 13px; opacity: .6; }
.next .t { font-family: var(--serif); font-size: 26px; line-height: 1.15; }
.next .meta { font-size: 13px; opacity: .6; margin-top: 4px; }
.next .go, .tile .go { position: absolute; right: 18px; top: 50%; margin-top: -10px; display: flex; }
.home .label { font-size: 13px; color: var(--ink-3); margin: 14px 2px 0; }
.home .tile { position: relative; padding-right: 48px; }
.tile .ring { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--green) calc(var(--p) * 360deg), var(--line) 0); }
.tile .ring span { width: 36px; height: 36px; border-radius: 50%; background: var(--card); display: grid; place-items: center; font-family: var(--serif); font-size: 17px; }
.tile.done .ring span { background: var(--green); color: #fff; }
.tile .txt { display: flex; flex-direction: column; gap: 3px; }
.tile .txt .t { font-family: var(--serif); font-size: 21px; line-height: 1.2; }
.tile .txt .meta { font-size: 13px; color: var(--ink-3); }
.tile .go { color: var(--ink-3); }
.home .mascot { flex: none; height: 150px; margin-top: 18px; }

.pathv { padding: calc(10px + var(--safe-top)) 20px calc(20px + var(--safe-bot)); overflow-y: auto; }
.pathv .back { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; margin-left: -10px; }
.pathv .back:active { background: var(--line); }
.pathv h1 { font-family: var(--serif); font-weight: 400; font-size: 36px; line-height: 1.1; margin: 10px 0 8px; letter-spacing: -.01em; }
.pathv .dek { font-family: var(--serif); font-size: 18px; line-height: 1.4; color: var(--ink-2); text-wrap: pretty; }
.pathv .prog { display: flex; align-items: center; gap: 12px; margin: 18px 0 10px; font-size: 13px; color: var(--ink-3); }
.pathv .prog em { font-style: normal; }
.pathv .prog span { flex: 1; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.pathv .prog i { display: block; height: 100%; background: var(--green); border-radius: 2px; transition: width .8s ease; }
.lessons { display: flex; flex-direction: column; margin-top: 6px; }
.lesson { display: flex; align-items: center; gap: 14px; text-align: left; padding: 16px 4px; border-bottom: 1px solid var(--line); animation: fadeIn .5s ease both; }
.lesson:active { background: rgba(0,0,0,.03); }
.lesson .num { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--ink-3); color: var(--ink-2); display: grid; place-items: center; font-family: var(--serif); font-size: 16px; }
.lesson.up .num { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.lesson.done .num { background: var(--green); border-color: var(--green); color: #fff; }
.lesson .txt { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.lesson .t { font-family: var(--serif); font-size: 19px; line-height: 1.25; }
.lesson.done .t { color: var(--ink-2); }
.lesson .meta { font-size: 13px; color: var(--ink-3); line-height: 1.35; }
.lesson .min { flex: none; font-size: 12px; color: var(--ink-3); }
.cta.wide { width: 100%; margin-top: 28px; }
.done .more { margin-top: 10px; height: 44px; font-size: 15px; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.brand .home-link { color: inherit; text-decoration: none; padding: 6px 0; }
