[hidden] { display: none !important; }
body { font-size: 17px; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.view { max-width: 640px; margin: 0 auto; padding: calc(20px + env(safe-area-inset-top)) 16px 32px; }
.loading { color: var(--muted); text-align: center; margin-top: 30vh; }
.ui, .btn, button, input, textarea, select, .nav { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
h1 { font-size: 30px; }
h2 { font-size: 22px; margin: 28px 0 10px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 18px 16px; margin: 14px 0; }
.card h3 { font: 600 13px/1.3 system-ui, -apple-system, "Segoe UI", sans-serif; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.card .big { font-size: 20px; line-height: 1.35; margin: 0 0 10px; }
.card.hi { border-color: var(--accent); }
.dayhead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.dayhead .muted { white-space: nowrap; }
audio { width: 100%; margin: 8px 0 4px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn.small { padding: 9px 14px; font-size: 15px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: default; }
label.field { display: block; margin: 14px 0; font: 15px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--muted); }
input[type=text], input[type=email], input[type=number], input[type=date], input[type=time], textarea, select {
  display: block; width: 100%; margin-top: 6px; padding: 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); font: 17px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; }
textarea { min-height: 120px; resize: vertical; font-family: Georgia, serif; }
.choices { display: grid; gap: 10px; margin: 14px 0; }
.choice { text-align: left; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: 17px/1.35 system-ui, -apple-system, "Segoe UI", sans-serif; cursor: pointer; }
.choice.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.scale { display: flex; gap: 6px; margin: 8px 0 18px; }
.scale button { flex: 1; padding: 12px 0; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: 600 16px system-ui, sans-serif; cursor: pointer; }
.scale button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.progress { height: 4px; background: var(--line); border-radius: 2px; margin: 0 0 22px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); }
.checklist { list-style: none; padding: 0; margin: 8px 0; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 16px; }
.checklist li:last-child { border-bottom: 0; }
.checklist .tick { flex: 0 0 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 13px; }
.checklist .done .tick { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.checklist a { color: var(--ink); }
.principle { font-style: italic; border-left: 3px solid var(--accent); padding-left: 12px; margin: 14px 0 0; }
.task p:first-child { margin-top: 0; }

/* nav */
.nav { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around; background: var(--paper); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 10; }
.nav a { flex: 1; text-align: center; color: var(--muted); text-decoration: none; font-size: 12px; padding: 4px 0; }
.nav a .ico { display: block; font-size: 20px; line-height: 1.2; }
.nav a.on { color: var(--accent); font-weight: 600; }
.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font: 15px system-ui, sans-serif; z-index: 20; max-width: calc(100% - 32px); }

/* tower */
.tower { display: flex; flex-direction: column-reverse; gap: 6px; margin: 18px auto 8px; max-width: 420px; }
.floor { position: relative; padding-top: 4px; }
.floor .fname { text-align: center; font: 600 11px/1.2 system-ui, sans-serif; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); opacity: .35; margin: 2px 0 4px; }
.floor.done .fname { opacity: 1; color: var(--accent); }
.floor .stones { display: flex; flex-wrap: wrap-reverse; justify-content: center; gap: 5px; }
.stone { width: 23%; aspect-ratio: 2 / 1; position: relative; border-radius: 42% 38% 36% 44% / 48% 52% 44% 50%; border: 2px dashed var(--line); background: transparent; padding: 0; cursor: default; }
.stone:nth-child(3n+2) { border-radius: 38% 46% 40% 36% / 52% 44% 50% 46%; }
.stone:nth-child(3n) { border-radius: 46% 36% 44% 40% / 44% 50% 48% 52%; }
.stone.painted { border: 0; background-size: 100% 100%; background-repeat: no-repeat; }
.stone.now { border: 2px solid var(--accent); cursor: pointer; animation: glow 2.4s ease-in-out infinite; }
.stone .n { position: absolute; inset: 0; display: grid; place-items: center; font: 600 12px system-ui, sans-serif; color: var(--muted); }
.stone.painted .n { display: none; }
@keyframes glow { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 25%, transparent); } }
@media (prefers-reduced-motion: reduce) { .stone.now { animation: none; } }
.legend { display: flex; justify-content: center; gap: 18px; font: 14px system-ui, sans-serif; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }

/* paint */
.canvaswrap { position: relative; margin: 12px 0; touch-action: none; }
#paint { width: 100%; aspect-ratio: 2 / 1; display: block; border-radius: 12px; background: var(--soft); touch-action: none; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.swatch.on { border-color: var(--ink); }
.brushes { display: flex; gap: 8px; flex-wrap: wrap; }
.brushes button { padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: 15px system-ui, sans-serif; cursor: pointer; }
.brushes button.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kinds .choice { text-align: center; }

/* lists */
.list { list-style: none; padding: 0; margin: 10px 0; counter-reset: n; }
.list li { padding: 10px 0 10px 38px; border-bottom: 1px solid var(--line); position: relative; }
.list li::before { counter-increment: n; content: counter(n); position: absolute; left: 0; top: 11px; font: 600 13px system-ui, sans-serif; color: var(--muted); width: 28px; text-align: right; }
.list li .meta { display: block; font: 13px system-ui, sans-serif; color: var(--muted); }
.count { font: 700 40px/1 system-ui, sans-serif; }
.ifcard { background: var(--soft); border-radius: 14px; padding: 20px; font-size: 20px; line-height: 1.4; }
.ifcard b { color: var(--accent); }
.book h1 { font-size: 28px; margin-top: 40px; }
.book h2 { font-size: 22px; }
.book h2.dayno { font: 600 13px system-ui, sans-serif; letter-spacing: .1em; color: var(--muted); margin: 56px 0 0; }
.book h2.dayno + h2 { margin-top: 4px; }
.menu a { display: block; padding: 14px 4px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; font-family: system-ui, sans-serif; }
.warn { background: var(--soft); border-radius: 12px; padding: 14px 16px; font-size: 16px; }
