/* Baseline is Chrome 61 (the mini-tool container's oldest WebView): no flex gap, no inset, no clamp(), no aspect-ratio. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: #1c1613; }
body {
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", -apple-system, "PingFang SC", "Microsoft YaHei", serif;
  color: #2b2320;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;
  overflow: hidden;
}
#app { position: relative; height: 100%; max-width: 520px; margin: 0 auto; background: #f4ecdf; overflow: hidden; }
.screen { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: none; }
.screen.on { display: block; }
#play.on { display: flex; flex-direction: column; }

.btn {
  display: block; width: 100%; border: 0; border-radius: 6px; padding: 15px 16px;
  font: inherit; font-size: 17px; letter-spacing: 2px; cursor: pointer;
}
.btn.primary { background: #b3312a; color: #fff6ea; box-shadow: 0 3px 0 #7d1f1a; }
.btn.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 #7d1f1a; }
.btn.ghost { background: transparent; color: inherit; border: 1px solid currentColor; margin-top: 12px; opacity: .85; }

/* ---------- cover ---------- */
#cover { background: #1c1613; color: #f7efe2; }
.cover-art { position: absolute; left: 0; top: 0; width: 100%; height: 100%; background: #2a211c center top / cover no-repeat; }
.cover-shade { position: absolute; left: 0; bottom: 0; width: 100%; height: 62%; background: linear-gradient(to bottom, rgba(28,22,19,0), rgba(28,22,19,.82) 45%, #1c1613 88%); }
.cover-text { position: absolute; left: 0; bottom: 0; width: 100%; padding: 0 26px 34px; padding-bottom: calc(34px + env(safe-area-inset-bottom)); text-align: center; }
.cover-kicker { font-size: 13px; letter-spacing: 3px; opacity: .8; }
#cover h1 { font-size: 44px; letter-spacing: 6px; margin: 10px 0 8px; font-weight: 700; text-shadow: 0 2px 12px rgba(0,0,0,.5); }
.cover-chapter { font-size: 15px; letter-spacing: 2px; opacity: .85; margin-bottom: 26px; }

/* ---------- play ---------- */
.art { position: relative; flex: 0 0 40%; background: #2a211c; overflow: hidden; }
.art-layer { position: absolute; left: -3%; top: -3%; width: 106%; height: 106%; background: center / cover no-repeat; opacity: 0; transition: opacity .7s ease; }
.art-layer.on { opacity: 1; animation: drift 26s ease-in-out infinite alternate; }
@keyframes drift { from { transform: translate3d(-1.2%, 0, 0) scale(1); } to { transform: translate3d(1.2%, -1%, 0) scale(1.04); } }
.art-fade { position: absolute; left: 0; bottom: 0; width: 100%; height: 34%; background: linear-gradient(to bottom, rgba(244,236,223,0), #f4ecdf); }

.stamp {
  position: absolute; left: 50%; top: 42%; width: 132px; height: 132px; margin: -66px 0 0 -66px;
  border: 5px solid #b3312a; border-radius: 12px; color: #b3312a; background: rgba(244,236,223,.9);
  font-size: 50px; font-weight: 700; line-height: 122px; text-align: center; letter-spacing: 2px;
  opacity: 0; transform: scale(2.6) rotate(-14deg); pointer-events: none;
  box-shadow: inset 0 0 0 3px rgba(179,49,42,.25);
}
.stamp.hit { animation: stamp 1.5s cubic-bezier(.2,.9,.3,1) forwards; }
@keyframes stamp {
  0% { opacity: 0; transform: scale(2.6) rotate(-14deg); }
  14% { opacity: 1; transform: scale(.92) rotate(-9deg); }
  22% { transform: scale(1.04) rotate(-9deg); }
  30%, 78% { opacity: 1; transform: scale(1) rotate(-9deg); }
  100% { opacity: 0; transform: scale(1.06) rotate(-9deg); }
}
#play.shake { animation: shake .42s linear; }
@keyframes shake {
  0%, 100% { transform: translate3d(0,0,0); }
  15% { transform: translate3d(-7px, 3px, 0); } 30% { transform: translate3d(6px, -4px, 0); }
  45% { transform: translate3d(-5px, -2px, 0); } 60% { transform: translate3d(4px, 3px, 0); }
  80% { transform: translate3d(-2px, 1px, 0); }
}

.progress { flex: 0 0 2px; background: rgba(43,35,32,.1); }
.progress i { display: block; height: 100%; width: 0; background: #b3312a; transition: width .4s ease; }

.hud { flex: 0 0 auto; padding: 10px 18px 0; display: flex; }
.stat { flex: 1; text-align: center; position: relative; font-size: 13px; }
.stat .k { opacity: .6; letter-spacing: 2px; margin-right: 6px; }
.stat b { font-size: 20px; font-variant-numeric: tabular-nums; }
.stat.bump b { animation: bump .5s ease; color: #b3312a; }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.45); } 100% { transform: scale(1); } }
.stat b { display: inline-block; }
.float {
  position: absolute; left: 0; width: 100%; top: -6px; text-align: center; font-size: 17px; font-weight: 700; color: #b3312a;
  animation: floatUp 1.25s ease-out forwards; pointer-events: none;
}
.float.neg { color: #5c6b78; }
@keyframes floatUp { from { opacity: 0; transform: translate3d(0, 8px, 0); } 20% { opacity: 1; } to { opacity: 0; transform: translate3d(0, -30px, 0); } }

.box { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding: 16px 24px 24px; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.who { display: inline-block; min-height: 26px; font-size: 14px; letter-spacing: 2px; padding: 3px 10px; margin-bottom: 10px; color: #fff6ea; background: #3d6b5c; border-radius: 3px; visibility: hidden; }
.who.show { visibility: visible; }
.who.me { background: #b3312a; }
.text { font-size: 19px; line-height: 1.78; letter-spacing: .5px; min-height: 5.4em; white-space: pre-wrap; }
.text.narr { color: #4a3f39; }
.text.letter { font-family: "Kaiti SC", "STKaiti", "KaiTi", serif; font-size: 21px; padding: 14px 16px; background: #fbf6ec; border-left: 3px solid #b3312a; box-shadow: 0 1px 6px rgba(0,0,0,.08); min-height: 0; }
.more { position: absolute; right: 24px; bottom: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); font-size: 18px; color: #b3312a; opacity: 0; }
.more.on { opacity: 1; animation: nod 1s ease-in-out infinite; }
@keyframes nod { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(5px); } }

.choices { margin: auto -6px 0; display: none; }
.choices.on { display: block; }
.opt {
  display: block; width: 100%; text-align: left; border: 1px solid #c9b79c; border-radius: 6px; background: #fbf6ec;
  font: inherit; font-size: 17px; line-height: 1.5; color: #2b2320; padding: 13px 14px; margin-top: 10px; cursor: pointer;
  box-shadow: 0 2px 0 #d9cbb3; opacity: 0; animation: optIn .35s ease forwards;
}
.opt:nth-child(2) { animation-delay: .08s; } .opt:nth-child(3) { animation-delay: .16s; }
@keyframes optIn { from { opacity: 0; transform: translate3d(0, 10px, 0); } to { opacity: 1; transform: none; } }
.opt:active, .opt.picked { background: #b3312a; border-color: #b3312a; color: #fff6ea; box-shadow: 0 2px 0 #7d1f1a; }
.opt .sw { display: inline-block; width: 18px; height: 18px; border-radius: 50%; vertical-align: -3px; margin-right: 10px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.55), 0 0 0 1px rgba(0,0,0,.15); }
.opt small { display: block; font-size: 13px; opacity: .65; margin: 2px 0 0 28px; }
/* while options are up, the line being answered stays as a two-line reminder so the options always fit */
.box.choosing .who { display: none; }
.box.choosing .text { min-height: 0; font-size: 15px; line-height: 1.7; opacity: .7; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.box.choosing .text.letter { padding: 6px 10px; }
.box.choosing .more { display: none; }

/* ---------- end card ---------- */
#end { background: #1c1613; color: #f7efe2; padding: 28px 22px; padding-top: calc(54px + env(safe-area-inset-top)); overflow-y: auto; }
.card { background: #f4ecdf; color: #2b2320; border-radius: 10px; padding: 26px 22px 22px; text-align: center; margin-bottom: 20px; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.card-kicker { font-size: 13px; letter-spacing: 3px; opacity: .6; }
.card h2 { font-size: 36px; letter-spacing: 5px; color: #b3312a; margin: 14px 0 4px; }
.card-sub { font-size: 12px; letter-spacing: 3px; opacity: .5; }
.card-stats { display: flex; margin: 22px 0 16px; padding: 16px 0; border-top: 1px solid #dccfb9; border-bottom: 1px solid #dccfb9; }
.card-stats div { flex: 1; }
.card-stats b { display: block; font-size: 28px; font-variant-numeric: tabular-nums; }
.card-stats span { font-size: 12px; letter-spacing: 3px; opacity: .6; }
.card-line { font-size: 15px; line-height: 1.7; color: #4a3f39; }
.card-next { margin-top: 18px; padding: 14px; background: #2b2320; color: #f4ecdf; border-radius: 6px; text-align: left; }
.card-next-name { font-size: 13px; letter-spacing: 2px; color: #e2a99f; }
.card-next-tease { font-size: 15px; line-height: 1.7; margin-top: 6px; }

@media (max-height: 700px) {
  .opt { font-size: 15px; padding: 10px 12px; margin-top: 8px; }
  .box { padding-top: 12px; padding-bottom: 16px; }
}
@media (max-height: 620px) {
  .text { font-size: 17px; }
  .stamp { width: 104px; height: 104px; margin: -52px 0 0 -52px; font-size: 38px; line-height: 94px; }
}
