:root {
  --bg: #fffbea;
  --card: #ffffff;
  --ink: #1d1d1f;
  --muted: #6b6b70;
  --accent: #c8102e;
  --yellow: #ffd500;
  --line: #e7e2cc;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }

/* Home */
.top { background: var(--yellow); padding: 20px 16px 16px; }
.top h1 { margin: 0; font-size: 28px; }
.top p { margin: 4px 0 0; color: #5a4a00; }
.list { max-width: 900px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card { display: block; text-decoration: none; background: var(--card); border: 2px solid var(--line); border-radius: 16px; overflow: hidden; }
.card:active { transform: scale(.98); }
.card img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; display: block; }
.card .t { padding: 12px 14px; }
.card h2 { margin: 0; font-size: 22px; }
.card span { color: var(--muted); font-size: 15px; }

/* Step viewer */
.viewer { height: 100dvh; display: flex; flex-direction: column; }
.bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--yellow); }
.bar a.home { text-decoration: none; font-size: 26px; padding: 4px 8px; }
.bar .title { font-weight: 700; font-size: 18px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar a.pdf { text-decoration: none; font-size: 14px; background: #fff; border-radius: 999px; padding: 6px 12px; font-weight: 600; }
.progress { height: 6px; background: #f1e7b5; }
.progress div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px; touch-action: pan-y pinch-zoom; }
.stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 12px; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.nav { display: flex; align-items: center; gap: 12px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
.nav button { flex: 1; font: inherit; font-size: 22px; font-weight: 700; border: 0; border-radius: 14px; padding: 16px 8px; background: var(--accent); color: #fff; cursor: pointer; }
.nav button.back { background: #fff; color: var(--ink); border: 2px solid var(--line); flex: 0 0 30%; }
.nav button:disabled { opacity: .35; }
.nav .step { min-width: 92px; text-align: center; font-weight: 800; font-size: 20px; line-height: 1.1; }
.nav .step small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }

/* Worksheet page */
.bar.sticky { position: sticky; top: 0; z-index: 1; }
.sheet { max-width: 1000px; margin: 0 auto; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); }
.sheet img { width: 100%; display: block; background: #fff; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,.08); }

/* Home sections */
.sec { max-width: 900px; margin: 0 auto; padding: 20px 16px 0; font-size: 20px; }
.sec + .list { padding-top: 10px; }
.card img.doc { object-fit: cover; object-position: top; }
