@import url("fonts.css");

:root {
  --desk: #1b1612;
  --paper: #e8d4a8;
  --paper-2: #d8c08c;
  --ink: #120e0a;
  --ball: #071e58;
  --red: #6e1a16;
  --rust: #6a2e14;
  --mute: #2c2016;
  --cream: #fffaf0;
  --slip: #fff4d8;
  --hand: "KaiTi", "STKaiti", "Noto Serif SC", serif;
  --title: "ZCOOL XiaoWei", "Noto Serif SC", "Songti SC", "STSong", serif;
  --body: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overscroll-behavior: none; }
body {
  background:
    radial-gradient(1200px 800px at 50% -10%, #3a2c22 0%, transparent 55%),
    var(--desk);
  color: var(--ink);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}

#desk {
  min-height: 100%;
  display: flex;
  justify-content: center;
  padding: 12px 12px calc(28px + env(safe-area-inset-bottom, 0px));
  padding-left: calc(12px + env(safe-area-inset-left, 0px));
  padding-right: calc(12px + env(safe-area-inset-right, 0px));
}

#book {
  width: min(430px, 100%);
  min-height: calc(100dvh - 40px);
  position: relative;
  perspective: 1800px;
  background:
    linear-gradient(90deg, rgba(90, 50, 20, 0.18) 0 18px, transparent 28px),
    linear-gradient(rgba(255, 246, 220, 0.52), rgba(255, 246, 220, 0.52)),
    url("../assets/paper.jpg") center / cover;
  border-radius: 6px 14px 14px 6px;
  box-shadow:
    0 0 0 1px #b89a68,
    12px 18px 40px rgba(0, 0, 0, 0.45),
    inset 10px 0 12px rgba(80, 40, 10, 0.12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#book::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 24px;
  bottom: 24px;
  width: 8px;
  background: repeating-linear-gradient(
    to bottom,
    #c9b48a 0 10px,
    #6a4a2e 10px 14px,
    transparent 14px 46px
  );
  opacity: 0.7;
  pointer-events: none;
}

#hud {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 10px 28px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: rgba(232, 212, 168, 0.92);
  border-bottom: 1px dashed #b08958;
  backdrop-filter: blur(6px);
}

#hud[hidden] { display: none; }

.hud-toc {
  font-family: var(--body);
  font-size: 16px;
  font-weight: 700;
  border: 0;
  background: transparent;
  color: var(--red);
  padding: 4px 6px;
}
.hud-face {
  width: 28px;
  height: 36px;
  object-fit: cover;
  object-position: center 18%;
  border-radius: 2px;
  border: 1px solid #b08958;
  flex-shrink: 0;
}

.hud-sfx {
  margin-left: auto;
  font-family: var(--body);
  font-size: 14px;
  font-weight: 700;
  border: 1px dashed #b08958;
  background: transparent;
  color: var(--mute);
  padding: 3px 8px;
}
.hud-sfx.on { color: var(--red); border-color: var(--red); }

.meters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  font-size: 12px;
  color: var(--mute);
  flex: 1;
}
.meter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.meter img {
  width: 18px;
  height: 18px;
  object-fit: cover;
  border-radius: 50%;
}
.meter .bar {
  display: inline-block;
  width: 36px;
  height: 5px;
  background: #c4a572;
  border-radius: 3px;
  overflow: hidden;
}
.meter .bar > i {
  display: block;
  height: 100%;
  background: var(--ball);
  transition: width 420ms ease;
}
.meter.warn b { color: var(--red); }
.meter.warn .bar > i,
.bar.slave > i { background: var(--red); }
.meter.tick b { animation: lifeShake 520ms ease; }
.meter.tick .bar > i { animation: barPunch 420ms ease; }
.meter.sub {
  font-size: 11px;
  color: var(--mute);
  gap: 2px;
}
.meter.sub b { font-size: 12px; }

.day-dots {
  flex-basis: 100%;
  display: flex;
  gap: 6px;
  padding-left: 4px;
}
.day-dots span {
  flex: 1;
  height: 4px;
  background: #c4a572;
  border-radius: 2px;
}
.day-dots .done { background: var(--ball); }
.day-dots .now { background: var(--red); }

.dials {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0 18px;
}
.dial {
  text-align: center;
  padding: 8px 4px;
  border: 1px dashed #c4a572;
}
.dial img {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 50%;
}
.dial em {
  display: block;
  width: 68px;
  height: 68px;
  margin: 6px auto 4px;
  border-radius: 50%;
  background: conic-gradient(#8f2d24 var(--p), #d8c08c 0);
  box-shadow: inset 0 0 0 10px #e8d4a8;
}
.dial.warn em { background: conic-gradient(#8f2d24 var(--p), #d8c08c 0); }
.dial span { display: block; font-family: var(--title); font-size: 16px; }
.dial b { font-family: var(--hand); color: var(--red); font-size: 20px; font-weight: 400; }

.hub-tile.done { opacity: 0.5; }
.hub-tile.now { outline: 2px solid var(--red); }

#life-pop {
  position: fixed;
  right: 16px;
  bottom: 28px;
  z-index: 30;
  font-family: var(--title);
  font-size: 22px;
  color: var(--red);
  background: #f3e6c8;
  border: 1px solid #8f2d24;
  padding: 8px 14px;
  pointer-events: none;
  opacity: 0;
}
#life-pop.jump { animation: lifeJump 1.05s ease forwards; }
#life-pop.tear {
  background-image: url("../assets/loc_tear.jpg");
  background-size: cover;
  background-position: center;
}

.note.big { animation: inkIn 0.55s ease; }
.choice:active {
  transform: scale(0.985) translateY(1px);
  box-shadow: inset 0 2px 4px rgba(80, 40, 10, 0.22);
  filter: brightness(0.97);
}

@keyframes lifeShake {
  0%, 100% { transform: none; }
  25% { transform: translateX(-2px) rotate(-4deg); }
  75% { transform: translateX(2px) rotate(4deg); }
}
@keyframes lifeJump {
  0% { opacity: 0; transform: translateY(12px) scale(0.9); }
  18% { opacity: 1; transform: translateY(0) scale(1.06); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-10px); }
}
@keyframes inkIn {
  from { opacity: 0; filter: blur(1.5px); }
  to { opacity: 1; filter: none; }
}

.meters b { color: var(--ink); font-weight: 700; }
.meters .warn b { color: var(--red); }
.meters .life b { color: var(--ball); }

#page {
  flex: 1;
  padding: 8px 18px 28px 32px;
  overflow: auto;
  transform-origin: 0% 50%;
  min-height: 0;
}

#stage {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-style: preserve-3d;
}
#stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  background: url("../assets/fx_grain.jpg") center / 160% auto;
  opacity: 0.12;
  mix-blend-mode: multiply;
  animation: grainDrift 48s linear infinite;
}

#leaf-out {
  position: absolute;
  inset: 0;
  z-index: 6;
  padding: 8px 18px 28px 32px;
  overflow: hidden;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 246, 220, 0.52), rgba(255, 246, 220, 0.52)),
    #e8d4a8 url("../assets/paper.jpg") center / cover;
  transform-origin: 0% 50%;
  backface-visibility: hidden;
  box-shadow: 16px 0 28px rgba(28, 20, 14, 0.28);
}
#leaf-out[hidden] {
  display: none !important;
}
#leaf-out.is-cover {
  padding: 0;
  display: flex;
  flex-direction: column;
}
#leaf-out::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 26px;
  background: linear-gradient(90deg, rgba(80, 40, 10, 0.28), transparent);
  pointer-events: none;
  z-index: 2;
}

body[data-view="cover"] #page {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#book.turning #leaf-out {
  animation: leafOut 640ms cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}
#book.turning #page {
  animation: leafIn 640ms cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

@keyframes leafOut {
  0% { transform: rotateY(0deg); filter: brightness(1); opacity: 1; }
  48% { transform: rotateY(-92deg); filter: brightness(0.7); opacity: 0.85; }
  100% { transform: rotateY(-168deg); filter: brightness(0.45); opacity: 0; }
}
@keyframes leafIn {
  0% { opacity: 0.15; transform: rotateY(22deg) translateX(22px); }
  42% { opacity: 0.55; }
  100% { opacity: 1; transform: none; }
}

.sheet h1 {
  font-family: var(--title);
  font-size: 30px;
  font-weight: 400;
  margin: 0 0 10px;
  line-height: 1.3;
  color: var(--ink);
}

.sheet h1, .sheet h2, .sheet h3, .eyebrow {
  text-shadow: 0 1px 0 var(--slip), 0 0 8px var(--slip);
}
.sheet h2, .sheet h3 { font-family: var(--title); font-weight: 400; margin: 0 0 6px; color: var(--ink); }
.eyebrow {
  font-family: var(--hand);
  color: var(--red);
  font-size: 22px;
  margin: 8px 0 4px;
}
.lede, .body-copy, .official, .init { line-height: 1.75; color: var(--ink); }
.loud {
  font-family: var(--title);
  font-size: 26px;
  color: var(--red);
  line-height: 1.4;
}
.loud.warn { color: var(--red); }
.ledger-gap { color: var(--mute); font-size: 14px; }
.note {
  font-family: var(--body);
  font-size: 18px;
  font-weight: 700;
  color: var(--ball);
  line-height: 1.75;
}
.note.big { font-size: 19px; }
.ballpoint {
  font-family: var(--body);
  color: var(--ball);
  font-size: 18px;
  font-weight: 700;
  margin-top: 28px;
}
blockquote {
  margin: 16px 0;
  padding: 8px 0 8px 14px;
  border-left: 2px solid #b08958;
  line-height: 1.8;
  color: var(--ink);
}
blockquote.special { border-left-color: var(--red); font-family: var(--hand); font-size: 22px; }
.foot-note, .care { font-size: 12px; color: var(--mute); line-height: 1.6; }
.care { margin-top: 24px; }

.note,
.ballpoint,
.lede,
.body-copy,
.official,
.init,
blockquote,
.quote,
.warn-line,
.foot-note,
.care,
.life-table {
  background: var(--slip);
  padding: 10px 12px;
  border-radius: 2px;
  box-shadow: 0 1px 0 rgba(60, 40, 16, 0.22);
}
blockquote {
  padding: 10px 12px 10px 14px;
}
.note.cover-buff {
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.cover-page {
  position: relative;
  flex: 1;
  min-height: 0;
  height: auto;
  margin: 0;
  overflow: hidden;
}
.cover-art {
  position: absolute;
  inset: -6%;
  width: 112%;
  height: 112%;
  object-fit: cover;
  object-position: center 12%;
  display: block;
  animation: coverDrift 28s ease-in-out infinite alternate;
}
.cover-shade {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 1;
  padding: 28px 18px calc(22px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, rgba(8, 5, 3, 0.97) 0%, rgba(8, 5, 3, 0.94) 88%, rgba(8, 5, 3, 0.72) 97%, transparent 100%);
  color: var(--cream);
}
.cover-title {
  font-family: var(--title);
  font-size: 28px;
  font-weight: 400;
  margin: 0 0 4px;
  line-height: 1.3;
  color: var(--cream);
  text-shadow: 0 1px 0 #000, 0 2px 12px rgba(0, 0, 0, 0.9);
}
.cover-shade .sub {
  font-family: var(--body);
  font-weight: 700;
  font-size: 15px;
  margin: 0 0 12px;
  color: var(--cream);
  text-shadow: 0 1px 0 #000, 0 2px 8px rgba(0, 0, 0, 0.85);
}
.cover-shade .ink-btn {
  margin-top: 8px;
  padding: 10px 14px;
}
.cover-shade .ink-btn.ghost {
  background: #1a120c;
  color: var(--cream);
  border: 1px solid #e4d2b0;
  border-style: solid;
  opacity: 1;
}
.cover-buff {
  color: var(--cream) !important;
  font-size: 14px !important;
  margin: 0 0 8px;
  text-shadow: 0 1px 0 #000;
}
.cover-shade .cal {
  margin: 6px 0 10px;
}
.cover-shade .cal span {
  color: var(--cream);
  border-color: #c4a070;
  background: rgba(0, 0, 0, 0.35);
  padding: 5px 2px;
  font-family: var(--body);
  font-weight: 700;
  font-size: 12px;
  text-shadow: 0 1px 0 #000;
}
.cover-shade .cal .now {
  color: var(--cream);
  border-color: #c45a48;
  background: rgba(143, 45, 36, 0.35);
}
.cover-shade .cal .done {
  opacity: 0.4;
}
.cover-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.cover-row .ink-btn {
  flex: 1;
  margin-top: 0;
  width: auto;
}
.cover-scraps {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 10%;
  height: 28%;
  z-index: 1;
  pointer-events: none;
}
.cover-scraps .scrap {
  position: absolute;
  width: 28%;
  height: 46%;
  object-fit: cover;
  border: 3px solid #f3e6c8;
  box-shadow: 2px 3px 0 rgba(28, 20, 14, 0.35);
  animation: coverDrift 32s ease-in-out infinite alternate;
}
.cover-scraps .s0 { left: 2%; top: 8%; transform: rotate(-8deg); }
.cover-scraps .s1 { left: 36%; top: 0; transform: rotate(4deg); }
.cover-scraps .s2 { left: 68%; top: 10%; transform: rotate(-3deg); }
.cover-scraps .s3 { left: 8%; top: 52%; transform: rotate(6deg); }
.cover-scraps .s4 { left: 40%; top: 48%; transform: rotate(-5deg); }
.cover-scraps .s5 { left: 72%; top: 54%; transform: rotate(7deg); }
.cover-peek {
  width: 100%;
  height: 72px;
  object-fit: cover;
  border: 2px solid #d4b896;
  margin: 0 0 8px;
  display: block;
}
.cover-shade .ink-btn.wide { width: 100%; }
.toc-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 8px;
  margin: 14px 0 8px;
}
.toc-card {
  text-align: left;
  padding: 0;
  border: 1px solid #c4a572;
  background: rgba(255,255,255,0.22);
  color: inherit;
  overflow: hidden;
  box-shadow: 2px 3px 0 rgba(90, 60, 20, 0.12);
}
.toc-card img {
  width: 100%;
  height: 78px;
  object-fit: cover;
  display: block;
  animation: kenBurns 20s ease-in-out infinite alternate;
}
.toc-card b {
  display: block;
  font-family: var(--title);
  font-size: 15px;
  font-weight: 400;
  padding: 6px 8px 8px;
  line-height: 1.4;
  color: var(--ink);
}
.toc-card.r0 { transform: rotate(-1.4deg); }
.toc-card.r1 { transform: rotate(1.2deg); }
.toc-card.r2 { transform: rotate(-0.6deg); }
@media (prefers-reduced-motion: reduce) {
  .toc-card.r0, .toc-card.r1, .toc-card.r2 { transform: none; }
}
.scene-art {
  width: 100%;
  height: 168px;
  object-fit: cover;
  object-position: center;
  border-radius: 4px;
  display: block;
  margin: 8px 0 12px;
  box-shadow: 0 6px 16px rgba(0,0,0,.18);
  filter: sepia(0.12) contrast(1.04);
  animation: kenBurns 22s ease-in-out infinite alternate;
}
.choice-pic {
  width: 100%;
  height: 92px;
  object-fit: cover;
  display: block;
  animation: kenBurns 18s ease-in-out infinite alternate;
}
.choice-body {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 10px 10px;
  width: 100%;
}
.hub-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}
.hub-tile {
  border: 1px solid #c4a572;
  background: rgba(255,255,255,.16);
  overflow: hidden;
  padding: 0;
  color: inherit;
  text-align: left;
  font: inherit;
}
.hub-tile img {
  width: 100%;
  height: 72px;
  object-fit: cover;
  display: block;
  animation: kenBurns 20s ease-in-out infinite alternate;
}
.hub-tile span {
  display: block;
  padding: 6px 8px 8px;
  font-size: 12px;
  line-height: 1.4;
}

.office-map {
  position: relative;
  margin: 8px 0 12px;
}
.office-map .scene-art { margin: 0; }
.hotspot {
  position: absolute;
  border: 1px dashed transparent;
  background: transparent;
  padding: 0;
}
.hotspot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.42;
  pointer-events: none;
  mix-blend-mode: multiply;
  animation: kenBurns 26s ease-in-out infinite alternate;
}
.hotspot.now {
  border-color: var(--red);
  background: rgba(143, 45, 36, 0.14);
}
.hotspot.now img {
  opacity: 0.85;
  animation: kenBurns 26s ease-in-out infinite alternate, hotPulse 1.8s ease-in-out infinite;
}
.hotspot.desk { left: 22%; top: 22%; width: 50%; height: 72%; }
.hotspot.tea { left: 0%; top: 48%; width: 22%; height: 46%; }
.hotspot.door { left: 74%; top: 12%; width: 24%; height: 40%; }
.hotspot.printer { left: 56%; top: 64%; width: 28%; height: 28%; z-index: 1; }

.cal {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 10px 0 14px;
}
.cal span {
  border: 1px dashed #c4a572;
  text-align: center;
  font-size: 12px;
  padding: 8px 4px;
  color: var(--mute);
  position: relative;
}
.cal .now {
  border-color: var(--red);
  color: var(--red);
  background: rgba(143, 45, 36, 0.08);
}
.cal .done {
  opacity: 0.45;
  text-decoration: line-through;
}
.cal .small {
  box-shadow: inset 0 -3px 0 var(--red);
}
.cal .ot {
  clip-path: polygon(0 0, 90% 0, 100% 12%, 100% 100%, 0 100%);
}
.cal .ot::before {
  content: "";
  position: absolute;
  top: 4px;
  right: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
}
.cal .small.now {
  animation: smallPulse 1.6s ease-in-out infinite;
}

body.ot-night #book {
  animation: lampFlicker 5.2s ease-in-out infinite;
}
@keyframes flicker {
  0%, 91%, 100% { filter: none; }
  93% { filter: brightness(1.07); }
  94.5% { filter: brightness(0.9); }
  96% { filter: none; }
}
@keyframes kenBurns {
  from { transform: scale(1) translate(0, 0); }
  to { transform: scale(1.07) translate(-1.4%, 1.2%); }
}
@keyframes whoDrift {
  from { transform: rotate(-1.5deg) scale(1); }
  to { transform: rotate(-1.5deg) scale(1.05) translate(-1%, 1.1%); }
}
@keyframes coverDrift {
  from { transform: scale(1) translate(0, 0); }
  to { transform: scale(1.05) translate(1.2%, -1%); }
}
@keyframes grainDrift {
  from { background-position: 18% 8%; }
  to { background-position: 82% 72%; }
}
@keyframes lampFlicker {
  0%, 88%, 100% { filter: none; }
  90% { filter: brightness(1.06); }
  92% { filter: brightness(0.93); }
  94% { filter: brightness(1.03); }
}
@keyframes paperBreath {
  0%, 100% { filter: sepia(0.04); }
  50% { filter: sepia(0.1) brightness(0.97); }
}
@keyframes hotPulse {
  0%, 100% { opacity: 0.72; }
  50% { opacity: 0.95; }
}
@keyframes dangerPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.42; }
}

.inline-art {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  object-position: center top;
  border-radius: 4px;
  display: block;
  margin: 8px 0 14px;
  box-shadow: 0 6px 16px rgba(0,0,0,.18);
  filter: sepia(0.15) contrast(1.05);
  animation: kenBurns 22s ease-in-out infinite alternate;
}
.inline-art.wide { max-height: 220px; object-fit: cover; }

.stat-card {
  border-bottom: 1px dashed #c4a572;
  padding: 10px 0 14px;
}
.stat-card header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.stat-ico {
  width: 22px;
  height: 22px;
  object-fit: cover;
  border-radius: 50%;
  flex-shrink: 0;
}
.stat-card header em { margin-left: auto; font-family: var(--hand); color: var(--red); font-size: 22px; }
.warn-line { color: var(--red); font-size: 14px; }

.who {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 12px;
  margin: 12px 0;
  overflow: hidden;
}
.who img {
  width: 118px;
  height: 148px;
  object-fit: cover;
  border: 3px solid #efe3c4;
  box-shadow: 2px 3px 0 rgba(0,0,0,.15);
  animation: whoDrift 24s ease-in-out infinite alternate;
}
.quote { font-family: var(--hand); font-size: 22px; color: var(--rust); font-weight: 700; }

.dots { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 18px; }
.dot {
  border: 1px solid #b08958;
  background: transparent;
  font-family: var(--title);
  font-size: 14px;
  padding: 4px 8px;
  color: var(--ink);
}
.dot.on { background: #8f2d24; color: var(--cream); border-color: #8f2d24; }

.toc-list { display: flex; flex-direction: column; gap: 8px; margin: 18px 0; }
.toc-row {
  text-align: left;
  background: rgba(255,255,255,0.18);
  border: 1px solid #c4a572;
  padding: 10px 12px;
  font-family: var(--body);
  color: inherit;
}
.toc-row span { display: block; font-family: var(--hand); color: var(--red); font-size: 18px; }
.toc-row b { display: block; font-family: var(--title); font-size: 20px; font-weight: 400; }
.toc-row i { display: block; font-style: normal; font-size: 12px; color: var(--mute); }

.choices { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
.choice {
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: stretch;
  text-align: left;
  background: #f3e6c8;
  border: 1px solid #c4a572;
  border-left: 4px solid var(--ball);
  padding: 0;
  overflow: hidden;
  font-family: var(--body);
  color: inherit;
  box-shadow: 2px 3px 0 rgba(90, 60, 20, 0.12);
  transition: transform 90ms ease, box-shadow 90ms ease, filter 80ms ease;
}
.choice:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}
.choice em { font-family: var(--title); color: var(--red); min-width: 28px; }
.choice strong { display: block; font-size: 16px; }
.choice small { display: block; color: var(--mute); margin-top: 3px; }
.choice .mark {
  margin-left: auto;
  font-style: normal;
  font-family: var(--hand);
  color: var(--ball);
  font-size: 18px;
  white-space: nowrap;
}
.choice.off { opacity: 0.45; }

.actions { display: flex; flex-direction: column; gap: 8px; margin-top: 22px; }
.ink-btn {
  font-family: var(--body);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.08em;
  border: 1px solid #4a3224;
  background: #1a120c;
  color: var(--cream);
  padding: 12px 16px;
  -webkit-font-smoothing: auto;
  transition: transform 90ms ease, filter 80ms ease;
}
.ink-btn.ghost {
  background: transparent;
  color: var(--ink);
  border-style: dashed;
  font-weight: 700;
}
.ink-btn.tiny { font-size: 16px; opacity: 0.75; }
.ink-btn.wide, .ink-btn.primary { width: 100%; }
.ink-btn:active { transform: translateY(1px); filter: brightness(1.08); }

.ticks { list-style: none; padding: 0; margin: 16px 0 0; }
.ticks li { font-size: 14px; padding: 2px 0; animation: inkIn 0.45s ease; }
.ticks .up { color: #2f6a3a; }
.ticks .down { color: var(--red); }

.ledger-book {
  list-style: none;
  padding: 0;
  margin: 12px 0 4px;
}
.ledger-book li {
  border-bottom: 1px dashed #c4a572;
  padding: 8px 2px;
  font-size: 15px;
}

.life-table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 12px 0; color: var(--ink); }
.life-table th, .life-table td { border-bottom: 1px dashed #c4a572; padding: 6px 4px; text-align: left; }
.life-table .sub td { font-family: var(--body); color: var(--ball); font-size: 17px; font-weight: 700; border: 0; line-height: 1.7; }
.life-table tr.hit td { color: var(--red); }
.life-table tr.hit.sub td { color: var(--red); }

.slip-list { margin: 12px 0 8px; }
.slip { padding: 10px 0; border-bottom: 1px dashed #c4a572; }
.slip.sealed { opacity: 0.72; }
.slip .ink-btn { margin-top: 6px; width: auto; }
.end-card h3 { font-size: 20px; }
.end-tear {
  position: relative;
  height: 92px;
  overflow: hidden;
  margin: 6px 0 8px;
  background: #d8c08c;
  border-radius: 3px 3px 0 0;
}
.end-tear img {
  width: 100%;
  height: 168px;
  object-fit: cover;
  object-position: center 28%;
  display: block;
  filter: sepia(0.12) contrast(1.04);
  animation: kenBurns 22s ease-in-out infinite alternate;
}
.end-tear.torn img {
  height: 150px;
  object-position: center 16%;
  filter: grayscale(0.28) sepia(0.28) contrast(1.06);
  clip-path: polygon(
    0% 0%, 100% 0%, 100% 56%,
    91% 50%, 83% 66%, 73% 52%, 62% 72%,
    51% 54%, 39% 74%, 27% 56%, 15% 70%, 0% 58%
  );
}
.end-tear.torn::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 48%;
  background: linear-gradient(to bottom, transparent 0%, rgba(232, 212, 168, 0.18) 36%, #e8d4a8 86%);
  pointer-events: none;
}
.center { text-align: center; padding-top: 18vh; }
.center .actions { max-width: 240px; margin-left: auto; margin-right: auto; }

button { cursor: pointer; }
button:disabled { cursor: default; }

.month-card { position: relative; }
.stamp-mark {
  position: absolute;
  right: 28px;
  top: 86px;
  width: 72px;
  height: 72px;
  border: 4px solid var(--red);
  border-radius: 50%;
  opacity: 0.55;
  transform: rotate(-18deg);
  pointer-events: none;
  animation: stampIn 0.45s ease;
}
.stamp-mark::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 2px dashed var(--red);
  border-radius: 50%;
}

.sun-stamps {
  display: flex;
  gap: 8px;
  margin: 8px 0 12px;
}
.sun-stamps i {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid #b08958;
  background: transparent;
}
.sun-stamps i.on {
  background: var(--red);
  border-color: var(--red);
}
.sun-stamps i.pop { animation: stampPop 0.4s ease; }

.scene-art.tear-strip {
  max-height: 140px;
  object-position: center;
  margin-top: 6px;
}

.end-marks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 10px;
}
.end-mark {
  font-family: var(--body);
  font-weight: 700;
  font-size: 14px;
  color: var(--cream);
  border-bottom: 1px dashed #e4d2b0;
  text-shadow: 0 1px 0 #000;
  opacity: 1;
}

body.broke #book { animation: buzzShake 0.7s ease-in-out 2; }
body.collapse-flash #book { animation: collapseFlash 0.85s ease; }
body.life-tear #book { animation: tearJolt 0.55s ease; }
body.small-sat #book { animation: flicker 5.2s ease-in-out infinite; }
body.loan #book { animation: buzzShake 1.1s ease-in-out 1; }
body.exploded #book { animation: collapseFlash 2.4s ease-in-out infinite; }
body.deaf .choice { filter: saturate(0.7); }
body.ot-streak .cal .ot { animation: smallPulse 1.2s ease-in-out infinite; }
body.subway-loud #book { animation: buzzShake 0.45s ease-in-out 1; }
body.game-hang .meter.danger b { animation: smallPulse 1.2s ease-in-out infinite; }
body.prep #book { animation: lampFlicker 6s ease-in-out infinite; }
body.nye-month .cal .now { animation: smallPulse 1.4s ease-in-out infinite; }
body.dumped-ash .meter.warn b { animation: smallPulse 1.3s ease-in-out infinite; }
body.plan-silent .choice { filter: saturate(0.75); }
body.skip-breakfast .meter.danger b { animation: smallPulse 1.1s ease-in-out infinite; }
body.same-lunch #book { animation: paperBreath 7s ease-in-out infinite; }
body.traffic #book { animation: buzzShake 0.5s ease-in-out 1; }
body.scroll-fish .meter.danger b { animation: smallPulse 1.5s ease-in-out infinite; }
body.ceiling-lie #book { animation: paperBreath 8s ease-in-out infinite; }
body.cinema #book { animation: paperBreath 5.5s ease-in-out infinite; }
body.delivery-wind #book { animation: buzzShake 0.6s ease-in-out 1; }
body.door-wait .choice { filter: saturate(0.8); }
body.carpool #book { animation: buzzShake 0.4s ease-in-out 1; }
body.ot37 #book { animation: lampFlicker 5s ease-in-out infinite; }
body.empty-fridge #book { animation: buzzShake 0.55s ease-in-out 1; }
body.job-blank #book { animation: collapseFlash 2.8s ease-in-out infinite; }
body.corolla #book { animation: buzzShake 0.5s ease-in-out 1; }
body.noodles #book { animation: paperBreath 6.5s ease-in-out infinite; }
body.cursor-sat #book { animation: lampFlicker 4.5s ease-in-out infinite; }
body.low-san .meter.danger b { animation: smallPulse 1.05s ease-in-out infinite; }
body.four-bags .meter.warn b { animation: smallPulse 1.4s ease-in-out infinite; }
body.heavy-air .choice { filter: saturate(0.65); }
body.come-here #book { animation: flicker 7s ease-in-out infinite; }
body.signed-drive #book { animation: buzzShake 0.45s ease-in-out 1; }
body.loan-late #book { animation: buzzShake 0.7s ease-in-out 1; }
body.sat-work #book { animation: lampFlicker 5s ease-in-out infinite; }
body.badge-wear .meter.danger b { animation: smallPulse 1s ease-in-out infinite; }
body.hear-pan .choice { filter: saturate(0.7); }
body.ng #book.turning #leaf-out,
body.ng #book.turning #page { animation-duration: 880ms; }
.ending.ng-ink .body-copy { animation: inkBleed 1.15s ease; }

@keyframes smallPulse {
  0%, 100% { box-shadow: inset 0 -3px 0 var(--red); }
  50% { box-shadow: inset 0 -6px 0 var(--red), 0 0 0 1px var(--red); }
}
@keyframes stampIn {
  0% { transform: rotate(-22deg) scale(1.55); opacity: 0; }
  55% { transform: rotate(-16deg) scale(0.96); opacity: 0.7; }
  100% { transform: rotate(-18deg) scale(1); opacity: 0.55; }
}
@keyframes stampPop {
  0% { transform: scale(1.45); }
  100% { transform: scale(1); }
}
@keyframes buzzShake {
  0%, 100% { transform: none; }
  20% { transform: translateX(-3px) rotate(-0.4deg); }
  40% { transform: translateX(3px) rotate(0.4deg); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}
@keyframes collapseFlash {
  0%, 100% { filter: none; }
  18% { filter: brightness(1.35) saturate(0.4); }
  36% { filter: brightness(0.55) hue-rotate(-10deg); }
  54% { filter: brightness(1.15); }
}
@keyframes tearJolt {
  0% { transform: none; }
  18% { transform: translateY(-4px) rotate(-1deg); }
  42% { transform: translateY(2px) rotate(0.5deg); }
  100% { transform: none; }
}
@keyframes barPunch {
  0% { filter: brightness(1); }
  35% { filter: brightness(1.28); }
  100% { filter: brightness(1); }
}
@keyframes inkBleed {
  from { opacity: 0.2; filter: blur(2px); }
  to { opacity: 1; filter: none; }
}

body.sat-msg #book { animation: flicker 4.5s ease-in-out infinite; }
body.rain-bike #book { animation: buzzShake 0.5s ease-in-out 1; }
body.last-row #book { animation: flicker 6s ease-in-out infinite; }
body.clinic-wait .choice { filter: saturate(0.65); }
body.game-monday #book { animation: flicker 5s ease-in-out infinite; }
body.lib-alone .choice { filter: saturate(0.55); }
body.bank-glow .meter.warn b { animation: smallPulse 1.2s ease-in-out infinite; }
body.call-night #book { animation: flicker 7s ease-in-out infinite; }
body.ceiling-collar .meter.danger b { animation: smallPulse 1.4s ease-in-out infinite; }
body.ate-corner .meter.danger b { animation: smallPulse 1.1s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  #page.flip, .note.big, .meter .bar > i, .meter.tick b, .meter.tick .bar > i, #life-pop.jump, .choice:active, .ink-btn:active,
  body.ot-night #book, .meter.danger b,
  #book.turning #leaf-out, #book.turning #page,
  body.broke #book, body.collapse-flash #book, body.life-tear #book, body.small-sat #book,
  body.loan #book, body.exploded #book, body.last-smoke #book, body.ot-streak .cal .ot,
  body.subway-loud #book, body.prep #book, body.nye-month .cal .now,
  body.dumped-ash .meter.warn b, body.plan-silent .choice, body.skip-breakfast .meter.danger b,
  body.same-lunch #book, body.traffic #book, body.scroll-fish .meter.danger b, body.ceiling-lie #book,
  body.cinema #book, body.delivery-wind #book,
  body.door-wait .choice, body.carpool #book, body.ot37 #book, body.empty-fridge #book,
  body.job-blank #book, body.corolla #book, body.noodles #book, body.cursor-sat #book,
  body.low-san .meter.danger b, body.four-bags .meter.warn b, body.heavy-air .choice,
  body.come-here #book, body.signed-drive #book, body.loan-late #book, body.sat-work #book,
  body.badge-wear .meter.danger b, body.hear-pan .choice,
  body.sat-msg #book, body.rain-bike #book, body.last-row #book, body.clinic-wait .choice,
  body.game-monday #book, body.lib-alone .choice, body.bank-glow .meter.warn b,
  body.call-night #book, body.ceiling-collar .meter.danger b,
  body.ate-corner .meter.danger b,
  .cal .small.now, .stamp-mark, .sun-stamps i.pop, .ending.ng-ink .body-copy,
  .scene-art, .choice-pic, .cover-art, #stage::after, .hotspot img, .hotspot.now img, .ticks li,
  .toc-card img, .hub-tile img, .inline-art, .who img, .end-tear img, .cover-scraps .scrap {
    animation: none;
    transition: none;
    filter: none;
    opacity: 1;
    transform: none;
  }
}
