* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: rgba(0,0,0,0); }
html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", sans-serif;
  background: #fdf6e9;
  color: #3a2e22;
  -webkit-text-size-adjust: 100%;
}
.hidden { display: none !important; }
.view { min-height: 100%; }

.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  background: #c8452e; color: #fff;
  padding: 10px 12px;
  padding-top: calc(10px + constant(safe-area-inset-top));
  padding-top: calc(10px + env(safe-area-inset-top));
}
.topbar h1 { font-size: 20px; text-align: center; margin-bottom: 8px; }
.tabs { text-align: center; }
.tab {
  font-size: 17px; padding: 8px 22px; margin: 0 6px;
  border: 2px solid #fff; border-radius: 20px;
  background: transparent; color: #fff;
}
.tab.active { background: #fff; color: #c8452e; font-weight: bold; }

.bookgrid {
  padding: 110px 12px 30px;
  display: -webkit-flex; display: flex;
  -webkit-flex-wrap: wrap; flex-wrap: wrap;
}
.card {
  width: 48%; margin: 1%;
  background: #fff; border-radius: 12px;
  padding: 8px; box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
.card img { width: 100%; height: 150px; object-fit: cover; border-radius: 8px; background: #eee; }
.card-title { font-size: 15px; font-weight: bold; margin: 6px 2px 2px; line-height: 1.3; }
.card-meta { font-size: 12px; color: #8a7a66; margin: 0 2px 4px; }

.reader-top {
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: space-between; justify-content: space-between;
}
.barbtn {
  font-size: 16px; padding: 8px 12px;
  background: rgba(255,255,255,.2); color: #fff;
  border: none; border-radius: 8px;
}
.reader-title {
  font-size: 16px; font-weight: bold;
  -webkit-flex: 1; flex: 1;
  text-align: center; padding: 0 8px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.reader-page { font-size: 15px; min-width: 56px; text-align: right; }

.stage {
  position: fixed;
  top: 56px; bottom: 150px; left: 0; right: 0;
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
  background: #fff;
  overflow: hidden;
}
.stage img { max-width: 100%; max-height: 100%; }
.soundhint {
  position: absolute; bottom: 10px; left: 0; right: 0;
  text-align: center; font-size: 14px; color: #a08c72;
}

.controls {
  position: fixed; left: 0; right: 0; bottom: 76px;
  display: -webkit-flex; display: flex;
  padding: 8px;
  background: #fdf6e9;
}
.controls.second { bottom: 0; }
.bigbtn {
  -webkit-flex: 1; flex: 1;
  font-size: 18px; padding: 16px 4px; margin: 0 4px;
  border: none; border-radius: 12px;
  background: #a9764a; color: #fff;
}
.bigbtn:disabled { background: #d8cbb8; }
.playbtn { background: #c8452e; font-weight: bold; }
.widebtn {
  -webkit-flex: 1; flex: 1;
  font-size: 16px; padding: 14px 4px; margin: 0 4px;
  border: 2px solid #a9764a; border-radius: 12px;
  background: #fff; color: #6b4e2e;
}
.finishbtn { border-color: #2e7d32; color: #2e7d32; }

.loading {
  position: fixed; top: 40%; left: 0; right: 0;
  text-align: center; font-size: 18px; color: #8a7a66;
}