:root {
  --sun: #ffd84d;
  --peach: #ff8f70;
  --rose: #ff5aa8;
  --sky: #5ed7ff;
  --mint: #5df2bd;
  --violet: #8072ff;
  --ink: #172052;
  --paper: rgba(255, 255, 255, 0.82);
  --glass: rgba(255, 255, 255, 0.3);
  --shadow: 0 28px 90px rgba(81, 61, 168, 0.24);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --app-height: 100vh;
  --cover-frame-min: 52vh;
  --overview-max-height: 45vh;
  --chapter-list-max-height: 26vh;
  --viewer-image-max-height: 92vh;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #fff6d8;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  -webkit-touch-callout: none;
  user-select: none;
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.app {
  position: relative;
  height: 100vh;
  height: var(--app-height);
  min-height: 100vh;
  min-height: var(--app-height);
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 14%, rgba(255, 244, 119, 0.95), transparent 30%),
    radial-gradient(circle at 80% 10%, rgba(94, 215, 255, 0.86), transparent 29%),
    radial-gradient(circle at 20% 90%, rgba(255, 90, 168, 0.42), transparent 33%),
    linear-gradient(135deg, #fff8c7 0%, #e6fbff 42%, #ffe7f4 100%);
  isolation: isolate;
}

.aurora,
.stars,
.orb {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: -2;
}

.aurora {
  background:
    conic-gradient(from 120deg at 50% 50%, rgba(255, 216, 77, 0.45), rgba(94, 215, 255, 0.5), rgba(255, 90, 168, 0.38), rgba(93, 242, 189, 0.42), rgba(255, 216, 77, 0.45));
  filter: blur(52px);
  opacity: 0.8;
  animation: auroraSpin 18s linear infinite;
  transform: scale(1.16);
}

.stars {
  z-index: -1;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.95) 0 2px, transparent 2.5px),
    radial-gradient(circle, rgba(255, 255, 255, 0.72) 0 1px, transparent 1.5px);
  background-position: 0 0, 36px 58px;
  background-size: 92px 92px, 128px 128px;
  animation: starDrift 16s linear infinite;
  mix-blend-mode: screen;
}

.orb {
  width: 38vmin;
  height: 38vmin;
  inset: auto;
  border-radius: 999px;
  background: radial-gradient(circle at 35% 30%, #fff, rgba(255, 216, 77, 0.75) 34%, rgba(255, 90, 168, 0.1) 70%);
  filter: blur(4px);
  opacity: 0.62;
}

.orb-a {
  left: -9vmin;
  bottom: 8vmin;
  animation: floatOrb 9s ease-in-out infinite;
}

.orb-b {
  right: -10vmin;
  top: 18vmin;
  background: radial-gradient(circle at 35% 30%, #fff, rgba(94, 215, 255, 0.78) 38%, rgba(128, 114, 255, 0.12) 72%);
  animation: floatOrb 11s ease-in-out infinite reverse;
}

.topbar,
.bottombar {
  position: fixed;
  left: 18px;
  right: 18px;
  left: max(18px, env(safe-area-inset-left));
  right: max(18px, env(safe-area-inset-right));
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  top: 16px;
  top: max(16px, env(safe-area-inset-top));
}

.bottombar {
  bottom: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
}

.brand,
.icon-button,
.nav-button,
.page-count {
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.48);
  box-shadow: 0 12px 38px rgba(65, 74, 147, 0.12);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.brand-mark {
  width: 24px;
  height: 24px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--sun), var(--rose) 52%, var(--sky));
  box-shadow: 0 0 24px rgba(255, 90, 168, 0.58);
  transform: rotate(12deg);
}

.top-actions {
  display: flex;
  gap: 10px;
}

.icon-button,
.nav-button {
  min-width: 72px;
  padding: 11px 15px;
  border-radius: 999px;
  font-weight: 800;
  transition: transform 0.28s var(--ease), background 0.28s var(--ease), box-shadow 0.28s var(--ease);
}

.icon-button.is-active,
.nav-button.primary {
  background: linear-gradient(135deg, #fff 0%, #fff2a2 28%, #ff9fc5 100%);
  box-shadow: 0 15px 42px rgba(255, 90, 168, 0.24);
}

.icon-button:hover,
.nav-button:hover {
  transform: translateY(-3px) scale(1.04);
}

.stage {
  position: relative;
  display: grid;
  height: 100vh;
  height: var(--app-height);
  min-height: 100vh;
  min-height: var(--app-height);
  padding: 82px 118px 86px;
  place-items: center;
  outline: 0;
  perspective: 1500px;
}

.slide-shell {
  position: relative;
  width: 92vw;
  max-width: 1180px;
  height: calc(100vh - 160px);
  height: calc(var(--app-height) - 160px);
  max-height: 820px;
  display: grid;
  place-items: center;
}

.slide {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: translate3d(0, 42px, -80px) rotateX(8deg) scale(0.94);
  pointer-events: none;
  transition:
    opacity 0.55s var(--ease),
    transform 0.7s var(--ease),
    filter 0.7s var(--ease);
  filter: blur(10px) saturate(0.78);
}

.slide.is-active {
  opacity: 1;
  transform: translate3d(0, 0, 0) rotateX(0) scale(1);
  pointer-events: auto;
  filter: blur(0) saturate(1.08);
  z-index: 3;
}

.slide.is-prev {
  opacity: 0;
  transform: translate3d(-34px, -18px, -120px) rotateY(12deg) scale(0.9);
}

.slide.is-next {
  opacity: 0;
  transform: translate3d(34px, 30px, -120px) rotateY(-12deg) scale(0.9);
}

.card {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 42px;
  background: var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.card::before {
  content: "";
  position: absolute;
  inset: -45%;
  background: conic-gradient(from 0deg, transparent, rgba(255, 255, 255, 0.88), transparent 25%);
  opacity: 0;
  transform: rotate(0deg);
  transition: opacity 0.35s var(--ease);
}

.slide.is-active .card::before {
  opacity: 0.42;
  animation: glint 4.5s linear infinite;
}

.image-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 0.42fr);
  gap: 0;
  padding: clamp(14px, 2vw, 24px);
}

.cover-card {
  grid-template-columns: minmax(0, 1.08fr) minmax(300px, 0.42fr);
}

.comic-frame {
  position: relative;
  align-self: stretch;
  overflow: hidden;
  border-radius: 32px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.75), rgba(255, 244, 158, 0.5));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72), 0 20px 56px rgba(43, 67, 159, 0.17);
}

.comic-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 18px 28px rgba(22, 32, 82, 0.16));
  animation: imageLift 900ms var(--ease) both;
  -webkit-user-drag: none;
  user-select: none;
}

.comic-frame.is-zoomable {
  cursor: zoom-in;
}

.image-meta,
.cover-meta {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(22px, 3vw, 44px);
}

.eyebrow {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  color: #6745c5;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.eyebrow::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rose);
  box-shadow: 0 0 0 7px rgba(255, 90, 168, 0.14);
}

.page-title {
  margin: 0;
  max-width: 900px;
  font-size: clamp(26px, 4.3vw, 58px);
  line-height: 1.18;
  letter-spacing: 0.02em;
}

.image-title {
  margin: 0;
  font-size: clamp(22px, 3vw, 42px);
  line-height: 1.16;
}

.number-badge {
  width: fit-content;
  margin-top: 22px;
  padding: 12px 18px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--ink), #5c45d7);
  color: #fff;
  font-size: clamp(18px, 2vw, 28px);
  font-weight: 900;
  box-shadow: 0 16px 34px rgba(92, 69, 215, 0.24);
}

.cover-title {
  margin: 0;
  color: transparent;
  font-size: clamp(48px, 7.2vw, 104px);
  line-height: 1.04;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, #18205b 0%, #6840d2 36%, #ff559d 68%, #ffb700 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 18px 34px rgba(255, 90, 168, 0.18));
}

.cover-subtitle {
  margin: 20px 0 0;
  color: rgba(23, 32, 82, 0.72);
  font-size: clamp(16px, 2vw, 24px);
  font-weight: 800;
}

.cover-card .comic-frame::after,
.chapter-card::after,
.intro-card::after,
.overview-card::after,
.thanks-card::after {
  content: "";
  position: absolute;
  right: -22%;
  bottom: -28%;
  width: 48%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 216, 77, 0.78), rgba(255, 90, 168, 0.16) 58%, transparent 70%);
  animation: pulseGlow 2.8s ease-in-out infinite;
}

.intro-card,
.overview-card,
.chapter-card,
.thanks-card {
  display: grid;
  align-content: center;
  padding: clamp(30px, 6vw, 78px);
}

.intro-card {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(255, 250, 198, 0.76)),
    radial-gradient(circle at 82% 18%, rgba(94, 215, 255, 0.54), transparent 36%);
}

.quote {
  position: relative;
  max-width: 880px;
  margin: 0;
  font-size: clamp(19px, 2.5vw, 34px);
  font-weight: 800;
  line-height: 1.75;
  text-indent: 2em;
  text-align: justify;
}

.quote::before {
  content: "“";
  position: absolute;
  left: -0.28em;
  top: -0.5em;
  color: rgba(255, 90, 168, 0.22);
  font-size: 7em;
  line-height: 1;
}

.quote-source {
  margin-top: 28px;
  color: rgba(23, 32, 82, 0.64);
  font-size: clamp(14px, 1.6vw, 18px);
  font-weight: 700;
  line-height: 1.7;
}

.overview-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(10px, 1.6vw, 18px);
  margin-top: 28px;
}

.overview-item {
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72), 0 18px 42px rgba(65, 74, 147, 0.11);
  animation: cardPop 700ms var(--ease) both;
}

.overview-item:nth-child(2) {
  animation-delay: 80ms;
}

.overview-item:nth-child(3) {
  animation-delay: 160ms;
}

.overview-item:nth-child(4) {
  animation-delay: 240ms;
}

.overview-item:nth-child(5) {
  animation-delay: 320ms;
}

.overview-index {
  color: #ff5aa8;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.overview-name {
  margin: 18px 0 0;
  font-size: clamp(20px, 2.4vw, 32px);
  font-weight: 900;
}

.overview-count {
  color: rgba(23, 32, 82, 0.58);
  font-weight: 800;
}

.chapter-card {
  overflow: hidden;
  background:
    radial-gradient(circle at 14% 18%, rgba(255, 255, 255, 0.86), transparent 33%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(223, 249, 255, 0.72));
}

.chapter-kicker {
  position: relative;
  z-index: 1;
  color: #6745c5;
  font-size: clamp(16px, 2vw, 22px);
  font-weight: 900;
  letter-spacing: 0.14em;
}

.chapter-title {
  position: relative;
  z-index: 1;
  margin: 14px 0 16px;
  font-size: clamp(52px, 9vw, 120px);
  line-height: 0.95;
  letter-spacing: -0.08em;
}

.chapter-desc {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0;
  color: rgba(23, 32, 82, 0.68);
  font-size: clamp(17px, 2vw, 24px);
  font-weight: 800;
  line-height: 1.6;
  text-indent: 2em;
  text-align: justify;
}

.chapter-list {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  margin-top: 30px;
}

.chapter-line {
  margin: 0;
  padding: 10px 13px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
  color: rgba(23, 32, 82, 0.72);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.55;
  text-align: justify;
  text-indent: 2em;
}

.thanks-card {
  overflow: hidden;
  justify-items: center;
  text-align: center;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.92), transparent 32%),
    radial-gradient(circle at 78% 22%, rgba(94, 215, 255, 0.46), transparent 34%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(255, 241, 167, 0.78));
}

.thanks-title {
  position: relative;
  z-index: 1;
  margin: 0;
  color: transparent;
  font-size: clamp(56px, 10vw, 138px);
  line-height: 1;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, #6840d2, #ff559d 46%, #ffb700);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 22px 36px rgba(255, 90, 168, 0.22));
}

.thanks-desc {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 22px 0 4px;
  color: rgba(23, 32, 82, 0.68);
  font-size: clamp(17px, 2vw, 24px);
  font-weight: 900;
  line-height: 1.7;
  text-indent: 2em;
  text-align: justify;
}

.thanks-copyright {
  position: relative;
  z-index: 1;
  margin: 18px 0 0;
  color: rgba(23, 32, 82, 0.58);
  font-size: clamp(15px, 1.8vw, 20px);
  font-weight: 900;
  letter-spacing: 0.12em;
}

.comic-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.34fr);
  gap: clamp(12px, 1.6vw, 22px);
  padding: clamp(10px, 1.5vw, 18px);
}

.comic-card .comic-frame {
  width: 100%;
  height: 100%;
}

.comic-info {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: clamp(18px, 2.5vw, 36px);
}

.comic-info .image-title {
  font-size: clamp(22px, 2.6vw, 40px);
  line-height: 1.18;
}

.zoom-hint {
  margin: 18px 0 0;
  color: rgba(23, 32, 82, 0.54);
  font-size: 14px;
  font-weight: 800;
}

.comic-caption {
  position: absolute;
  left: clamp(20px, 3vw, 38px);
  right: clamp(20px, 3vw, 38px);
  bottom: clamp(18px, 3vw, 34px);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 16px 34px rgba(23, 32, 82, 0.12);
  backdrop-filter: blur(18px);
  pointer-events: none;
  display: none;
}

.comic-caption-title {
  overflow: hidden;
  font-size: clamp(15px, 1.7vw, 20px);
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comic-caption-number {
  flex: 0 0 auto;
  color: #ff4f9a;
  font-weight: 900;
}

.chapter-rail {
  position: fixed;
  top: 50%;
  right: max(18px, env(safe-area-inset-right));
  z-index: 19;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transform: translateY(-50%);
}

.rail-dot {
  position: relative;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 0 0 1px rgba(103, 69, 197, 0.16), 0 10px 22px rgba(65, 74, 147, 0.12);
  transition: transform 0.25s var(--ease), background 0.25s var(--ease);
}

.rail-dot.is-active {
  height: 36px;
  background: linear-gradient(180deg, var(--rose), var(--sun));
  transform: scale(1.08);
}

.rail-dot span {
  position: absolute;
  right: 22px;
  top: 50%;
  width: max-content;
  max-width: 140px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 12px 30px rgba(65, 74, 147, 0.12);
  color: rgba(23, 32, 82, 0.74);
  font-size: 12px;
  font-weight: 900;
  opacity: 0;
  transform: translate(8px, -50%);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
  pointer-events: none;
}

.rail-dot:hover span,
.rail-dot.is-active span {
  opacity: 1;
  transform: translate(0, -50%);
}

.progress-wrap {
  display: grid;
  grid-template-columns: minmax(90px, 320px) auto;
  align-items: center;
  gap: 12px;
  flex: 1;
  max-width: 460px;
}

.progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.76);
}

.progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sky), var(--violet), var(--rose), var(--sun));
  box-shadow: 0 0 18px rgba(255, 90, 168, 0.48);
  transition: width 0.45s var(--ease);
}

.page-count {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  min-width: 82px;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 900;
}

.page-count strong {
  color: #ff4f9a;
  font-size: 21px;
}

.swipe-tip {
  position: fixed;
  left: 50%;
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 66px);
  z-index: 18;
  width: max-content;
  max-width: calc(100vw - 28px);
  padding: 8px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.52);
  color: rgba(23, 32, 82, 0.58);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
  text-align: center;
  transform: translateX(-50%);
  animation: tipPulse 1.7s ease-in-out infinite;
  pointer-events: none;
}

.end-tip {
  position: fixed;
  left: 50%;
  bottom: 112px;
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 96px);
  z-index: 24;
  padding: 12px 18px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 236, 147, 0.88));
  box-shadow: 0 18px 42px rgba(255, 143, 112, 0.24);
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
  opacity: 0;
  transform: translate(-50%, 16px) scale(0.96);
  transition: opacity 0.28s var(--ease), transform 0.28s var(--ease);
  pointer-events: none;
  backdrop-filter: blur(16px);
}

.end-tip.is-visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.spark {
  position: fixed;
  width: 8px;
  height: 8px;
  z-index: 30;
  border-radius: 999px;
  background: var(--sun);
  box-shadow: 0 0 16px currentColor;
  pointer-events: none;
  animation: sparkFly 700ms var(--ease) forwards;
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px 16px;
  padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.18), transparent 34%),
    rgba(11, 16, 42, 0.86);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
  backdrop-filter: blur(16px);
}

.image-viewer.is-open {
  opacity: 1;
  pointer-events: auto;
}

.image-viewer img {
  max-width: 96vw;
  max-height: 92vh;
  max-height: var(--viewer-image-max-height);
  object-fit: contain;
  border-radius: 22px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.38);
  transform: scale(0.94);
  transition: transform 0.28s var(--ease);
  -webkit-user-drag: none;
  user-select: none;
}

.image-viewer.is-open img {
  transform: scale(1);
}

.viewer-close {
  position: fixed;
  top: 16px;
  right: 16px;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: 2;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font-weight: 900;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.16);
}

.viewer-tip {
  position: fixed;
  left: 50%;
  bottom: 20px;
  bottom: max(20px, env(safe-area-inset-bottom));
  color: rgba(255, 255, 255, 0.74);
  font-size: 13px;
  font-weight: 800;
  transform: translateX(-50%);
}

@keyframes auroraSpin {
  to {
    transform: scale(1.16) rotate(360deg);
  }
}

@keyframes starDrift {
  to {
    background-position: 92px 92px, 164px 186px;
  }
}

@keyframes floatOrb {
  50% {
    transform: translate3d(6vmin, -5vmin, 0) scale(1.12);
  }
}

@keyframes glint {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulseGlow {
  50% {
    transform: scale(1.16);
    opacity: 0.7;
  }
}

@keyframes imageLift {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.96);
  }
}

@keyframes cardPop {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.94);
  }
}

@keyframes tipPulse {
  50% {
    transform: translateX(-50%) translateY(-5px);
  }
}

@keyframes sparkFly {
  to {
    opacity: 0;
    transform: translate(var(--tx), var(--ty)) scale(0);
  }
}

@media (max-width: 920px) {
  .stage {
    padding: 74px 18px 112px;
  }

  .slide-shell {
    width: 100%;
    height: calc(100vh - 180px);
    height: calc(var(--app-height) - 180px);
    max-height: 760px;
  }

  .image-card,
  .cover-card {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .cover-card {
    grid-template-rows: minmax(52vh, 1fr) auto;
    grid-template-rows: minmax(var(--cover-frame-min), 1fr) auto;
  }

  .comic-card {
    display: block;
    padding: 10px;
  }

  .comic-info {
    display: none;
  }

  .comic-caption {
    display: flex;
  }

  .comic-frame {
    min-height: 0;
    border-radius: 28px;
  }

  .image-meta,
  .cover-meta {
    align-items: center;
    padding: 12px 8px 4px;
    text-align: center;
  }

  .cover-title br {
    display: none;
  }

  .cover-title {
    font-size: clamp(34px, 11vw, 54px);
    line-height: 1.12;
    white-space: nowrap;
  }

  .cover-subtitle {
    margin-top: 8px;
    font-size: clamp(14px, 3.6vw, 18px);
  }

  .page-title {
    font-size: clamp(24px, 8vw, 42px);
    line-height: 1.24;
  }

  .overview-grid {
    grid-template-columns: 1fr;
    max-height: 45vh;
    max-height: var(--overview-max-height);
    overflow: auto;
    padding-right: 4px;
  }

  .overview-item {
    min-height: 116px;
  }

  .chapter-rail {
    top: auto;
    right: 50%;
    bottom: 128px;
    bottom: calc(max(16px, env(safe-area-inset-bottom)) + 112px);
    flex-direction: row;
    transform: translateX(50%);
  }

  .rail-dot.is-active {
    width: 34px;
    height: 12px;
  }

  .rail-dot span {
    display: none;
  }

  .bottombar {
    display: grid;
    grid-template-columns: auto 1fr auto;
  }

  .progress-wrap {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .page-count {
    display: none;
  }

  .swipe-tip {
    bottom: 70px;
    bottom: calc(max(16px, env(safe-area-inset-bottom)) + 54px);
  }

  .end-tip {
    bottom: 104px;
    bottom: calc(max(16px, env(safe-area-inset-bottom)) + 88px);
  }
}

@media (max-width: 560px) {
  .topbar {
    left: 12px;
    right: 12px;
  }

  .brand {
    padding: 9px 11px;
    letter-spacing: 0.04em;
  }

  .brand-mark {
    width: 20px;
    height: 20px;
  }

  .icon-button,
  .nav-button {
    min-width: 58px;
    padding: 10px 11px;
    font-size: 13px;
  }

  .card {
    border-radius: 30px;
  }

  .intro-card,
  .overview-card,
  .chapter-card,
  .thanks-card {
    padding: 26px 22px;
  }

  .quote {
    font-size: clamp(16px, 4.6vw, 22px);
    line-height: 1.72;
  }

  .chapter-title {
    font-size: clamp(50px, 18vw, 84px);
  }

  .thanks-title {
    font-size: clamp(46px, 16vw, 82px);
  }

  .chapter-list {
    grid-template-columns: 1fr;
    max-height: 26vh;
    max-height: var(--chapter-list-max-height);
    overflow: auto;
  }

  .image-title {
    font-size: clamp(20px, 6vw, 30px);
  }

  .number-badge {
    margin-top: 10px;
    padding: 8px 12px;
    font-size: clamp(14px, 4vw, 18px);
  }

  .comic-caption {
    left: 18px;
    right: 18px;
    bottom: 18px;
    padding: 10px 12px;
    border-radius: 18px;
  }

  .comic-caption-title {
    font-size: 13px;
  }
}

/* iOS WebKit can flicker when animated gradients, blur and 3D cards overlap. */
@supports (-webkit-touch-callout: none) {
  @media (hover: none) and (pointer: coarse) {
    .aurora,
    .stars,
    .orb,
    .swipe-tip {
      animation: none;
    }

    .aurora {
      filter: none;
      opacity: 0.25;
    }

    .stage {
      perspective: none;
    }

    .slide,
    .slide.is-active,
    .slide.is-prev,
    .slide.is-next {
      transform: none;
      filter: none;
    }

    .slide {
      transition: opacity 0.3s ease;
    }

    .slide *,
    .slide *::before,
    .slide *::after {
      animation: none !important;
    }

    .card::before {
      display: none;
    }

    .card,
    .brand,
    .icon-button,
    .nav-button,
    .page-count,
    .comic-caption,
    .end-tip,
    .image-viewer {
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
    }

    .card {
      background: rgba(255, 255, 255, 0.95);
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
