:root{
  --bg:#f8fafc;
  --card:#ffffff;
  --text:#111827;
  --muted:#6b7280;
  --line:#e5e7eb;
  --accent:#2563eb;
}

*{box-sizing:border-box}

html,body{
  margin:0;
  padding:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  background:var(--bg);
  color:var(--text);
}

button,input,select{
  font:inherit;
}

.appShell{
  min-height:100vh;
  display:flex;
  flex-direction:column;
}

.topbar,.readerTopbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:14px 16px;
  background:var(--card);
  border-bottom:1px solid var(--line);
}

.brand{
  display:flex;
  gap:12px;
  align-items:center;
}

.logo{
  width:38px;
  height:38px;
  border-radius:12px;
  background:linear-gradient(135deg,#2563eb,#4f46e5);
  color:#fff;
  font-weight:800;
  display:flex;
  align-items:center;
  justify-content:center;
}

.brandTitle{font-weight:800}
.brandSub{font-size:12px;color:var(--muted)}

.mainArea{
  padding:16px;
  flex:1;
}

.screen{display:block}

.card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:16px;
  padding:16px;
  box-shadow:0 2px 10px rgba(0,0,0,.04);
}

.narrow{
  max-width:540px;
  margin:0 auto;
}

.list{
  display:grid;
  gap:12px;
}

.bookCard{
  display:grid;
  grid-template-columns:110px 1fr;
  gap:12px;
  background:var(--card);
  border:1px solid var(--line);
  border-radius:16px;
  padding:12px;
}

.cover{
  width:100%;
  aspect-ratio:2/3;
  object-fit:cover;
  border-radius:12px;
  background:#e5e7eb;
  display:block;
}

.btn{
  border:1px solid var(--line);
  background:#fff;
  color:var(--text);
  border-radius:12px;
  padding:12px 16px;
  cursor:pointer;
  min-height:46px;
  font-weight:600;
}

.btn.primary{
  background:var(--accent);
  border-color:var(--accent);
  color:#fff;
}

.row{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.bookActions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:12px;
}

.openBtn{
  min-width:120px;
}

.bookOpenHit{
  cursor:pointer;
}

.toolbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin-bottom:16px;
}

.toolbarLeft,.toolbarRight{
  display:flex;
  gap:10px;
  align-items:center;
}

.pill{
  display:inline-flex;
  align-items:center;
  padding:6px 10px;
  border-radius:999px;
  background:#eef2ff;
  color:#3730a3;
  font-size:12px;
}

.notice{
  margin-top:12px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background:#fff;
}

.muted{color:var(--muted)}
.small{font-size:12px}
.mt12{margin-top:12px}
.mt16{margin-top:16px}

.sep{
  height:1px;
  background:var(--line);
  margin:16px 0;
}

label{
  display:block;
  margin-bottom:6px;
  font-weight:600;
}

input,select{
  width:100%;
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#fff;
}

.readerArea{
  max-width:860px;
  margin:16px auto 0;
  background:var(--card);
  border:1px solid var(--line);
  border-radius:16px;
  padding:24px;
  line-height:1.8;
  font-size:20px;
  white-space:pre-wrap;
}

.readerTitle{
  font-weight:800;
}

.readerMeta{
  flex:1;
  min-width:0;
}

.readerActions{
  display:flex;
  gap:8px;
}

.theme-dark{
  --bg:#0f172a;
  --card:#111827;
  --text:#f8fafc;
  --muted:#94a3b8;
  --line:#1f2937;
  --accent:#3b82f6;
}

.theme-sepia{
  --bg:#f6f1e7;
  --card:#fbf7ef;
  --text:#3b2f2f;
  --muted:#7c6f64;
  --line:#e7dcc8;
  --accent:#8b5e3c;
}

@media (max-width:700px){
  .bookCard{
    grid-template-columns:1fr;
  }

  .toolbar,.readerTopbar{
    flex-direction:column;
    align-items:stretch;
  }

  .readerArea{
    padding:16px;
    font-size:18px;
  }

  .bookActions .btn{
    width:100%;
  }

  .openBtn{
    width:100%;
  }
}