/* Minimal, mobile-first, no external deps */
:root{
  --bg:#f6f7fb;
  --card:#ffffff;
  --text:#111827;
  --muted:#6b7280;
  --border:#e5e7eb;
  --shadow: 0 10px 30px rgba(0,0,0,.08);
  --radius: 18px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: system-ui,-apple-system,"PingFang SC","Microsoft YaHei",Segoe UI,Roboto,Helvetica,Arial;
  background:var(--bg);
  color:var(--text);
}

#app{
  max-width: 820px;
  margin: 0 auto;
  padding: 18px 16px 90px;
}

h1,h2,h3{margin:0 0 10px}
p{margin:8px 0; line-height:1.5}
small{color:var(--muted)}

.row{display:flex; gap:10px; align-items:center}
.spaceBetween{justify-content:space-between}
.gap8{gap:8px}

.card{
  background:var(--card);
  border-radius:var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  border: 1px solid rgba(229,231,235,.6);
}

.header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}

.badges{display:flex; gap:8px; flex-wrap:wrap}

.badge{
  font-size:12px;
  padding: 5px 10px;
  border-radius: 999px;
  background:#eef2ff;
  color:#3730a3;
  border:1px solid #e0e7ff;
}

.badgeMuted{
  background:#f3f4f6;
  color:#374151;
  border:1px solid #e5e7eb;
}

.progressBar{
  width:100%;
  height:10px;
  background:#e5e7eb;
  border-radius:999px;
  overflow:hidden;
}
.progressBar > div{
  height:100%;
  width:0%;
  background:#111827;
  border-radius:999px;
}

.cover{
  width:100%;
  height:150px;
  border-radius:16px;
  background: #e5e7eb;
  object-fit:cover;
  display:block;
}

.btn{
  border:0;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 16px;
  width: 100%;
  cursor:pointer;
}
.btnPrimary{background:#111827; color:white}
.btnGhost{background:#eef2ff; color:#1f2937}
.btnDanger{background:#fee2e2; color:#7f1d1d}
.btn:disabled{opacity:.45; cursor:not-allowed}

.iconBtn{
  background:transparent;
  border:0;
  padding:8px;
  border-radius:12px;
  cursor:pointer;
}
.iconBtn:hover{background:rgba(0,0,0,.05)}

.footerBar{
  position: fixed;
  left:0; right:0; bottom:0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(246,247,251,.92);
  backdrop-filter: blur(10px);
  border-top:1px solid rgba(229,231,235,.9);
}
.footerInner{
  max-width: 820px;
  margin: 0 auto;
  display:flex;
  gap:10px;
}
.footerInner .btn{width:50%}

.timeline{
  margin-top: 8px;
  display:flex;
  flex-direction:column;
  gap: 10px;
}

.node{
  display:flex;
  gap:10px;
  align-items:stretch;
}

.rail{
  width: 22px;
  display:flex;
  flex-direction:column;
  align-items:center;
}
.dot{
  width: 14px; height:14px;
  border-radius:999px;
  background:#111827;
  margin-top: 12px;
}
.dot.locked{background:#9ca3af}
.dot.done{background:#16a34a}

.line{
  flex:1;
  width: 2px;
  background:#e5e7eb;
  margin-top: 8px;
}

.nodeCard{
  flex:1;
  padding: 12px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(229,231,235,.8);
  box-shadow: 0 8px 18px rgba(0,0,0,.05);
  display:flex;
  align-items:center;
  gap: 12px;
}
.nodeCard.locked{opacity:.65}
.nodeCard .thumb{
  width: 54px; height:54px;
  border-radius: 14px;
  background:#e5e7eb;
  object-fit:cover;
}
.nodeTitle{font-weight:650}
.nodeMeta{color:var(--muted); font-size:13px}

.stars{font-size:14px; letter-spacing:1px; white-space:nowrap}
.stars .empty{opacity:.25}

.taskCard{
  background:#fff;
  border:1px solid rgba(229,231,235,.85);
  border-radius: 16px;
  padding: 12px;
  margin-top: 10px;
}
.taskTop{display:flex; align-items:flex-start; justify-content:space-between; gap:10px}
.taskTitle{font-weight:650}
.taskStatus{font-size:12px; padding:5px 10px; border-radius:999px; background:#f3f4f6; border:1px solid #e5e7eb}
.taskStatus.done{background:#dcfce7; border-color:#bbf7d0; color:#14532d}

.input, .select{
  width:100%;
  padding: 12px 12px;
  border-radius: 14px;
  border:1px solid #e5e7eb;
  font-size:16px;
  outline:none;
}
.input:focus, .select:focus{border-color:#111827}

.radioGroup{display:flex; flex-direction:column; gap:8px; margin-top:8px}
.radioOpt{
  display:flex; gap:10px; align-items:center;
  border:1px solid #e5e7eb;
  padding: 10px 12px;
  border-radius: 14px;
}
.radioOpt input{transform: scale(1.1)}

.previewGrid{display:flex; gap:10px; flex-wrap:wrap; margin-top:10px}
.previewGrid img{
  width: 100%;
  max-height: 220px;
  object-fit:cover;
  border-radius: 16px;
  border:1px solid rgba(229,231,235,.8);
}

.backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(2px);
  z-index: 50;
}
.hidden{display:none !important}

/* Center Modals (Rules / Story) */
.modal{
  position: fixed;
  inset: 0;
  z-index: 80;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 16px;
}
.modalCard{
  width: 100%;
  max-width: 820px;
  max-height: 86vh;
  overflow:auto;
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 18px 60px rgba(0,0,0,.22);
  border: 1px solid rgba(229,231,235,.9);
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
}
.modalTop{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.modalTitle{font-size: 18px; font-weight: 750}
.modalSub{font-size: 13px; color: var(--muted); margin-top: 2px}
.modalClose{
  font-size: 16px;
  padding: 8px 10px;
  border-radius: 12px;
  border:1px solid rgba(229,231,235,.9);
  background:#fff;
}

/* Story flip page */
.storyPage{
  border: 1px solid rgba(229,231,235,.9);
  border-radius: 18px;
  background: #fafafa;
  padding: 14px 14px;
  min-height: 260px;
  line-height: 1.65;
  white-space: pre-wrap;
}
.storyNav{
  margin-top: 12px;
  display:flex;
  gap:10px;
  align-items:center;
}
.storyNav .btn{width: 34%}
.storyIndicator{
  flex:1;
  text-align:center;
  color: var(--muted);
  font-size: 13px;
}

.sheet{
  position: fixed;
  left: 0; right:0;
  bottom: 0;
  z-index: 60;
  background: #fff;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -16px 40px rgba(0,0,0,.20);
  max-height: 82vh;
  overflow:auto;
  padding: 12px 16px calc(18px + env(safe-area-inset-bottom));
}
.sheetHandle{
  width: 44px;
  height: 5px;
  border-radius: 999px;
  background: #e5e7eb;
  margin: 6px auto 10px;
}
.sheetClose{
  position:absolute;
  right: 10px;
  top: 8px;
  font-size: 16px;
  padding: 8px 10px;
  border-radius: 12px;
  border:1px solid rgba(229,231,235,.9);
  background:#fff;
}

.sheet .cover{height: 160px}

.hr{height:1px; background:#e5e7eb; border:0; margin:12px 0}

.kv{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
}
.kv .item{
  flex:1;
  min-width: 140px;
  background:#f9fafb;
  border:1px solid #e5e7eb;
  border-radius: 16px;
  padding: 10px 12px;
}
.kv .label{font-size:12px; color:#6b7280}
.kv .value{font-size:18px; font-weight:700; margin-top:6px}

.muted{color:var(--muted)}
