:root {
  --ink: #27392f;
  --pine: #2f6856;
  --celadon: #b9d8cf;
  --water: #d8eee9;
  --paper: #fffaf0;
  --silk: rgba(255, 250, 239, 0.82);
  --gold: #b98b3e;
  --gold-deep: #8b6628;
  --peach: #eab7a8;
  --cinnabar: #a64a3a;
  --frost: #9fbacc;
  --shadow: 0 18px 42px rgba(57, 78, 69, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  background: #eef5f1;
  color: var(--ink);
  font-family: "Noto Serif SC", "Songti SC", "STSong", SimSun, serif;
}

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

.h5-shell {
  position: relative;
  width: min(100vw, 430px);
  min-height: 100vh;
  margin: 0 auto;
  overflow: hidden;
  background: url("assets/palace-garden-bg.png") center / cover no-repeat;
  box-shadow: 0 0 0 1px rgba(132, 113, 71, 0.1), 0 24px 80px rgba(38, 61, 54, 0.24);
  isolation: isolate;
}

.h5-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 252, 242, 0.16), rgba(216, 238, 233, 0.16)),
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.52), transparent 34%),
    linear-gradient(180deg, rgba(255, 250, 239, 0.14), rgba(39, 57, 47, 0.1));
  z-index: -1;
}

.mist-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  transform: translateX(-80%);
  animation: mistMove 9s ease-in-out infinite;
  z-index: 2;
}

.top-actions {
  position: absolute;
  top: 28px;
  right: 16px;
  z-index: 12;
  display: grid;
  gap: 10px;
}

.round-tool {
  width: 74px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid rgba(185, 139, 62, 0.56);
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.76);
  color: var(--gold-deep);
  box-shadow: 0 8px 18px rgba(82, 79, 59, 0.12);
  font-size: 12px;
  line-height: 1.2;
  backdrop-filter: blur(8px);
}

.page {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  min-height: 100vh;
  padding: 86px 22px 96px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(30px) rotateY(-8deg);
  transform-origin: 50% 50%;
  transition: opacity 520ms ease, transform 640ms cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 4;
}

.page.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0) rotateY(0);
  z-index: 5;
}

.page.fade-out {
  opacity: 0;
  transform: scale(0.985);
}

.page.flip-out-next {
  opacity: 0;
  transform: translateX(-52px) rotateY(14deg);
}

.page.flip-out-prev {
  opacity: 0;
  transform: translateX(52px) rotateY(-14deg);
}

.hero-copy {
  width: 100%;
  margin-top: 4vh;
  text-align: center;
}

.seal {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  min-height: 34px;
  margin: 0;
  border: 1px solid rgba(166, 74, 58, 0.56);
  border-radius: 7px;
  color: var(--cinnabar);
  font-size: 13px;
  line-height: 1.05;
  background: rgba(255, 250, 240, 0.5);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  margin-top: 18px;
  color: #8e6a2d;
  font-size: 58px;
  font-weight: 700;
  line-height: 1.05;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.42), 0 12px 28px rgba(119, 88, 33, 0.18);
}

.hero-line {
  display: inline-block;
  margin-top: 22px;
  padding: 10px 24px;
  border-top: 1px solid rgba(185, 139, 62, 0.38);
  border-bottom: 1px solid rgba(185, 139, 62, 0.38);
  color: #756034;
  font-size: 16px;
  background: rgba(255, 250, 239, 0.34);
}

.hero-ribbon {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(185, 139, 62, 0.26);
  border-radius: 16px;
  background: rgba(255, 250, 240, 0.54);
  backdrop-filter: blur(8px);
}

.hero-ribbon span {
  min-height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--pine);
  font-size: 13px;
  line-height: 1.25;
  text-align: center;
  background: rgba(216, 238, 233, 0.42);
}

.primary-btn {
  width: min(100%, 282px);
  min-height: 56px;
  padding: 13px 24px;
  border: 1px solid rgba(185, 139, 62, 0.62);
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(159, 186, 204, 0.34), rgba(255, 250, 240, 0.84), rgba(185, 216, 207, 0.45)),
    rgba(255, 250, 240, 0.72);
  color: #43583f;
  box-shadow: 0 12px 26px rgba(91, 100, 76, 0.2);
  font-size: 20px;
  line-height: 1.25;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.primary-btn:hover,
.primary-btn:focus-visible,
.poster-actions button:hover,
.carousel-controls button:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(91, 100, 76, 0.24);
}

.primary-btn.compact {
  min-height: 50px;
  font-size: 17px;
}

.footer-note {
  position: absolute;
  bottom: 36px;
  left: 22px;
  right: 22px;
  color: rgba(39, 57, 47, 0.74);
  font-size: 13px;
  text-align: center;
}

.section-head {
  width: 100%;
  text-align: center;
}

.section-head p {
  color: var(--gold-deep);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12px;
  text-transform: uppercase;
}

.section-head h2 {
  margin-top: 5px;
  color: #7c602b;
  font-size: 32px;
  line-height: 1.15;
}

.section-head span {
  display: block;
  margin-top: 7px;
  color: rgba(39, 57, 47, 0.78);
  font-size: 14px;
  line-height: 1.45;
}

.season-gallery {
  position: relative;
  width: 100%;
  min-width: 0;
  padding: 2px 0 0;
  overflow: hidden;
}

.season-scroll {
  --season-x: 0px;
  --season-card-width: 112px;
  --season-gap: 12px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 8px 0 14px;
  scrollbar-width: none;
  touch-action: pan-y;
  user-select: none;
  cursor: grab;
  mask-image: linear-gradient(90deg, transparent 0, #000 6%, #000 94%, transparent 100%);
}

.season-scroll:active {
  cursor: grabbing;
}

.season-scroll::-webkit-scrollbar {
  display: none;
}

.season-strip {
  position: relative;
  width: max-content;
  margin: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--season-card-width);
  gap: var(--season-gap);
  padding-inline: calc((100% - var(--season-card-width)) / 2);
  justify-content: start;
  transform: translate3d(var(--season-x), 0, 0);
  transition: transform 560ms cubic-bezier(0.2, 0.86, 0.18, 1);
  will-change: transform;
}

.season-strip.no-transition {
  transition: none;
}

.season-strip.no-transition .season-item,
.season-strip.no-transition .season-card-window,
.season-strip.no-transition .season-hotspot {
  transition: none;
}

.season-strip::before {
  content: "";
  position: absolute;
  top: 24px;
  left: 42px;
  right: 42px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(185, 139, 62, 0.62), transparent);
  pointer-events: none;
}

.season-item {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 0;
  transition: none;
}

.season-item.active {
  transform: none;
}

.season-hotspot {
  position: relative;
  z-index: 2;
  width: 50px;
  min-height: 48px;
  margin-bottom: -16px;
  border: 1px solid rgba(185, 139, 62, 0.46);
  border-radius: 50%;
  background: rgba(255, 250, 240, 0.72);
  color: var(--gold-deep);
  font-size: 18px;
  box-shadow: 0 8px 18px rgba(80, 74, 53, 0.12);
  transition: none;
}

.season-hotspot.active {
  background: rgba(185, 139, 62, 0.86);
  color: #fff8e8;
  box-shadow: 0 10px 24px rgba(139, 102, 40, 0.26);
  transform: none;
}

.season-card-window {
  position: relative;
  width: var(--season-card-width);
  height: 258px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid rgba(185, 139, 62, 0.52);
  border-radius: 12px 12px 32px 32px;
  background: rgba(255, 250, 240, 0.52);
  box-shadow: 0 14px 26px rgba(63, 80, 68, 0.14);
  transition: none;
}

.season-card-window::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 16%, rgba(255, 255, 255, 0.38) 45%, transparent 70%);
  opacity: 0;
  transform: translateX(-90%);
  pointer-events: none;
}

.season-item.active .season-card-window {
  box-shadow: 0 14px 26px rgba(63, 80, 68, 0.14);
  filter: none;
  transform: none;
}

.season-item.active .season-card-window::after {
  animation: none;
  opacity: 0;
}

.season-card-image {
  width: calc(100% - 8px);
  height: calc(100% - 8px);
  display: block;
  object-fit: contain;
  object-position: center center;
  border-radius: 10px 10px 28px 28px;
  filter: drop-shadow(0 15px 18px rgba(63, 80, 68, 0.16));
  transform: translateX(var(--season-image-shift, 0));
}

.season-card-0 {
  --season-image-shift: -6px;
}

.season-card-1 {
  --season-image-shift: -2px;
}

.season-card-2 {
  --season-image-shift: 4px;
}

.season-card-3 {
  --season-image-shift: 6px;
}

.unlock-state,
.knowledge-panel,
.title-card,
.quiz-card,
.carousel-card {
  width: 100%;
  border: 1px solid rgba(185, 139, 62, 0.34);
  border-radius: 20px;
  background: var(--silk);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.carousel-card.fade-out {
  opacity: 0.35;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.carousel-stage {
  width: 100%;
  overflow: hidden;
  border-radius: 20px;
  touch-action: pan-y;
  cursor: grab;
}

.carousel-stage:active {
  cursor: grabbing;
}

.carousel-track {
  --carousel-x: 0%;
  display: flex;
  transform: translate3d(var(--carousel-x), 0, 0);
  transition: transform 560ms cubic-bezier(0.2, 0.86, 0.18, 1);
  will-change: transform;
}

.carousel-slide {
  flex: 0 0 100%;
  display: grid;
}

.unlock-state {
  padding: 16px 18px;
  display: grid;
  gap: 6px;
  text-align: center;
}

.unlock-state strong {
  color: var(--pine);
  font-size: 22px;
}

.unlock-state span,
.knowledge-panel span,
.title-card p,
.quiz-feedback {
  color: rgba(39, 57, 47, 0.76);
  font-size: 14px;
  line-height: 1.55;
}

.carousel-card {
  min-height: 336px;
  padding: 30px 28px 24px;
  overflow: hidden;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 250, 239, 0.9), rgba(216, 238, 233, 0.68)),
    var(--carousel-card-bg) center bottom / 214px auto no-repeat;
}

.season-badge {
  width: 62px;
  height: 62px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(185, 139, 62, 0.48);
  border-radius: 50%;
  background: rgba(255, 250, 240, 0.74);
  color: var(--gold-deep);
  font-size: 28px;
}

.carousel-card h3 {
  color: var(--pine);
  text-align: center;
  font-size: 34px;
  line-height: 1.05;
}

.carousel-card p {
  margin: 12px auto 18px;
  max-width: 250px;
  color: rgba(39, 57, 47, 0.78);
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
}

.term-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 286px;
  margin-inline: auto;
}

.term-grid span {
  min-height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(185, 139, 62, 0.24);
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.74);
  color: #5a6d4f;
  font-size: 13px;
}

.carousel-controls {
  display: grid;
  width: 100%;
  grid-template-columns: 72px 1fr 72px;
  align-items: center;
  gap: 12px;
}

.carousel-controls button,
.poster-actions button {
  min-height: 40px;
  border: 1px solid rgba(185, 139, 62, 0.38);
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.7);
  color: var(--gold-deep);
  font-size: 13px;
}

.season-dots,
.page-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
}

.season-dots button,
.page-dots button {
  width: 9px;
  height: 9px;
  min-height: 9px;
  padding: 0;
  border: 1px solid rgba(99, 116, 92, 0.78);
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  transform: none;
}

.page-dots button {
  cursor: default;
  opacity: 1;
}

.carousel-controls .season-dots button {
  width: 10px;
  height: 10px;
  min-height: 10px;
  background: rgba(255, 250, 240, 0.38);
}

.season-dots button.active,
.page-dots button.active {
  background: var(--gold);
  border-color: var(--gold);
}

.object-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 10px;
}

.object-card {
  min-height: 132px;
  padding: 8px 4px 9px;
  border: 1px solid rgba(185, 139, 62, 0.24);
  border-radius: 18px;
  background: rgba(255, 250, 240, 0.66);
  color: var(--ink);
  box-shadow: 0 12px 22px rgba(77, 87, 75, 0.12);
}

.object-card.collected {
  border-color: rgba(185, 139, 62, 0.72);
  background: rgba(255, 250, 240, 0.86);
}

.medallion {
  width: 82px;
  height: 82px;
  margin: 0 auto 8px;
  overflow: hidden;
  border-radius: 50%;
  display: block;
  background: rgba(255, 250, 240, 0.7);
}

.medallion img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.object-card strong {
  display: block;
  color: var(--pine);
  font-size: 15px;
  line-height: 1.2;
}

.object-card span {
  display: block;
  margin-top: 3px;
  color: rgba(39, 57, 47, 0.72);
  font-size: 12px;
  line-height: 1.3;
}

.knowledge-panel {
  padding: 14px 16px;
  display: grid;
  gap: 4px;
}

.knowledge-panel strong {
  color: var(--gold-deep);
  font-size: 16px;
}

.quiz-card {
  padding: 22px 18px;
}

.quiz-progress {
  width: 54px;
  height: 54px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(185, 139, 62, 0.42);
  border-radius: 50%;
  color: var(--gold-deep);
  background: rgba(255, 250, 240, 0.74);
}

.quiz-card h3 {
  color: var(--pine);
  font-size: 22px;
  line-height: 1.45;
  text-align: center;
}

.answer-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.answer-list button {
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid rgba(185, 139, 62, 0.3);
  border-radius: 14px;
  background: rgba(255, 250, 240, 0.68);
  color: #3d5448;
  text-align: left;
  font-size: 15px;
  line-height: 1.35;
}

.answer-list button.selected {
  border-color: var(--gold);
  background: rgba(185, 216, 207, 0.68);
}

.answer-list button.correct {
  border-color: var(--pine);
  background: rgba(185, 216, 207, 0.88);
}

.answer-list button.wrong {
  border-color: var(--cinnabar);
  background: rgba(234, 183, 168, 0.46);
}

.quiz-feedback {
  min-height: 24px;
  margin-top: 12px;
  text-align: center;
}

.quiz-actions {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.quiz-actions.single {
  grid-template-columns: 1fr;
}

.quiz-actions.single .primary-btn {
  width: 100%;
  max-width: none;
}

.quiz-actions button[hidden] {
  display: none;
}

.primary-btn.ghost {
  background: rgba(255, 250, 240, 0.72);
  color: var(--gold-deep);
}

.primary-btn:disabled,
.answer-list button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.scroll-unlock {
  position: relative;
  width: 100%;
  height: 330px;
  overflow: hidden;
  border: 1px solid rgba(185, 139, 62, 0.34);
  border-radius: 22px;
  background: rgba(255, 250, 240, 0.74);
  box-shadow: var(--shadow);
}

.unlock-carousel-track {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  transition: transform 720ms cubic-bezier(0.25, 0.8, 0.28, 1);
  will-change: transform;
}

.unlock-carousel-card {
  flex: 0 0 calc((100% - 16px) / 3);
  height: 100%;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(185, 139, 62, 0.48);
  border-radius: 20px;
  background: rgba(255, 250, 240, 0.86);
  box-shadow: 0 12px 24px rgba(74, 93, 82, 0.12);
}

.unlock-carousel-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: saturate(0.95);
}

.unlock-mask {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: rgba(238, 245, 241, 0.72);
  transform: translateX(var(--mask-x, 0%));
  transition: transform 900ms ease;
}

.unlock-glow {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: linear-gradient(105deg, transparent 26%, rgba(255, 255, 255, 0.54) 45%, transparent 64%);
  transform: translateX(-120%);
  animation: unlockSweep 3.6s ease-in-out infinite;
}

.unlock-list {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.unlock-list span {
  min-height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(185, 139, 62, 0.28);
  border-radius: 14px;
  background: rgba(255, 250, 240, 0.72);
  color: var(--pine);
  font-size: 13px;
  text-align: center;
}

.title-card {
  padding: 28px 22px;
  text-align: center;
}

.title-prefix {
  color: var(--gold-deep);
  font-size: 14px;
}

.title-card h3 {
  margin-top: 12px;
  color: #7c602b;
  font-size: 38px;
  line-height: 1.16;
}

.title-card [data-result-desc] {
  margin-top: 14px;
}

.score-line {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.score-line span {
  min-height: 50px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(216, 238, 233, 0.54);
  color: var(--pine);
  font-size: 14px;
}

.poster-head {
  align-self: end;
}

.poster-canvas {
  width: min(100%, 270px);
  aspect-ratio: 720 / 1120;
  border: 1px solid rgba(185, 139, 62, 0.4);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.poster-actions {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.modal {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(28, 45, 38, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms ease;
}

.modal.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: min(100%, 326px);
  padding: 24px 22px;
  border: 1px solid rgba(185, 139, 62, 0.46);
  border-radius: 20px;
  background: rgba(255, 250, 240, 0.94);
  box-shadow: 0 24px 60px rgba(26, 44, 37, 0.3);
  transform: translateY(14px) scale(0.98);
  transition: transform 300ms ease;
}

.modal.open .modal-card {
  transform: translateY(0) scale(1);
}

.modal-close {
  float: right;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(216, 238, 233, 0.72);
  color: var(--pine);
  font-size: 12px;
}

.modal-seal {
  margin-bottom: 12px;
}

.modal-card h3 {
  clear: both;
  color: #7c602b;
  font-size: 26px;
  line-height: 1.2;
}

.modal-card p:last-child {
  margin-top: 12px;
  color: rgba(39, 57, 47, 0.78);
  font-size: 15px;
  line-height: 1.7;
}

@keyframes mistMove {
  0%,
  100% {
    transform: translateX(-90%);
    opacity: 0.12;
  }
  50% {
    transform: translateX(90%);
    opacity: 0.34;
  }
}

@keyframes unlockSweep {
  0%,
  100% {
    transform: translateX(-120%);
  }
  48% {
    transform: translateX(120%);
  }
}

@media (max-height: 760px) {
  .page {
    gap: 12px;
    padding-top: 76px;
    padding-bottom: 86px;
  }

  h1 {
    font-size: 50px;
  }

  .season-strip {
    --season-card-width: 104px;
    --season-gap: 10px;
  }

  .season-card-window {
    height: 228px;
  }

  .carousel-card {
    min-height: 306px;
  }

  .scroll-unlock {
    height: 286px;
  }
}

@media (min-width: 431px) {
  .h5-shell {
    min-height: 844px;
    height: min(100vh, 932px);
  }

  .page {
    min-height: 844px;
  }
}
