/* 《一针一线见蜀韵》H5 样式 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&display=swap');

:root {
  --bg-cream: #F5F0E8;
  --teal: #3A5F5E;
  --teal-dark: #2C4F54;
  --gold: #C9A962;
  --gold-light: #D4B87A;
  --pink: #E8B4A8;
  --pink-soft: #F0D4CC;
  --lotus: #D4A0A0;
  --text-dark: #3D3D3D;
  --text-gray: #6B6B6B;
  --text-light: #8C8C8C;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Noto Serif SC', 'Songti SC', 'SimSun', serif;
  background: var(--bg-cream);
  color: var(--text-dark);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

button {
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
}

.app {
  width: 100%;
  height: 100%;
  max-width: 750px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

.page {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease, visibility 0.6s;
  overflow: hidden;
}

.page.active {
  opacity: 1;
  visibility: visible;
  z-index: 1;
}

.page-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
}

.page-content {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  padding: calc(40px + var(--safe-top)) 20px calc(30px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.btn-next {
  display: block;
  margin: 16px auto 0;
  padding: 10px 32px;
  font-size: 14px;
  color: var(--teal);
  border: 1px solid var(--gold);
  border-radius: 20px;
  background: rgba(255,255,255,0.6);
  letter-spacing: 2px;
  flex-shrink: 0;
}

.btn-next:active {
  transform: scale(0.96);
  background: rgba(201,169,98,0.15);
}

.scroll-hint {
  position: absolute;
  bottom: calc(20px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  animation: bounce 2s infinite;
}

.scroll-arrow {
  display: block;
  width: 20px;
  height: 20px;
  border-right: 2px solid var(--gold);
  border-bottom: 2px solid var(--gold);
  transform: rotate(45deg);
  opacity: 0.6;
}

@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(8px); }
}

.transition-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  background: rgba(245,240,232,0.3);
}

.transition-overlay.active {
  opacity: 1;
  animation: fadeOut 0.8s forwards 0.4s;
}

.transition-svg {
  width: 100%;
  height: 100%;
}

#transitionPath {
  stroke-dasharray: 812;
  stroke-dashoffset: 812;
}

.transition-overlay.active #transitionPath {
  animation: drawLine 0.6s ease forwards;
}

@keyframes drawLine {
  to { stroke-dashoffset: 0; }
}

@keyframes fadeOut {
  to { opacity: 0; }
}

.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: rgba(58,95,94,0.92);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.page-p1 .page-content {
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
}

.p1-title {
  width: 85%;
  max-width: 320px;
  margin-top: 8%;
  animation: fadeInDown 1.2s ease;
}

.p1-subtitle {
  font-size: 13px;
  color: var(--text-gray);
  letter-spacing: 4px;
  margin-top: 12px;
  animation: fadeIn 1.5s ease 0.3s both;
}

.p1-subtitle::before,
.p1-subtitle::after {
  content: '◆';
  font-size: 6px;
  vertical-align: middle;
  margin: 0 8px;
  color: var(--gold);
}

.p1-thread-line {
  position: absolute;
  top: 28%;
  right: 18%;
  width: 2px;
  height: 0;
  background: linear-gradient(to bottom, var(--gold), transparent);
  animation: threadGrow 2s ease 0.8s forwards;
  box-shadow: 0 0 6px rgba(201,169,98,0.5);
}

@keyframes threadGrow {
  to { height: 45%; }
}

.p1-start-btn {
  position: absolute;
  bottom: calc(80px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: 90px;
  height: 90px;
  animation: fadeInUp 1s ease 0.6s both, pulse 3s ease infinite 2s;
}

.p1-start-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.05); }
}

.page-p2 .page-content {
  padding: calc(20px + var(--safe-top)) 0 calc(16px + var(--safe-bottom));
  overflow: hidden;
}

.p2-layout {
  position: relative;
}

.p2-keywords {
  position: absolute;
  inset: calc(20px + var(--safe-top)) 0 calc(60px + var(--safe-bottom)) 0;
  pointer-events: none;
  z-index: 3;
}

.keyword-tag {
  position: absolute;
  pointer-events: auto;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--teal);
  background: rgba(255,255,255,0.75);
  border: 1px solid rgba(201,169,98,0.4);
  border-radius: 4px;
  letter-spacing: 1px;
  transition: transform 0.3s, box-shadow 0.3s;
}

.keyword-tag.keyword-img {
  padding: 0;
  background: none;
  border: none;
  width: 22%;
  max-width: 88px;
}

.keyword-tag:active,
.keyword-tag.keyword-img:active {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(201,169,98,0.3);
}

.p2-hint {
  position: absolute;
  top: 58%;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 4px 14px;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--teal);
  background: rgba(255, 255, 255, 0.55);
  border: 1px dashed rgba(201, 169, 98, 0.55);
  border-radius: 20px;
  white-space: nowrap;
  pointer-events: none;
  animation: p2HintPulse 2.4s ease-in-out infinite;
}

@keyframes p2HintPulse {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; }
}

.p2-sidebar {
  position: absolute;
  right: 10px;
  bottom: calc(58px + var(--safe-bottom));
  top: auto;
  max-width: 48%;
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-end;
  gap: 8px;
  z-index: 2;
  pointer-events: none;
}

.p2-sidebar-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

.p2-title-block {
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-start;
  gap: 6px;
}

.p2-title-col {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: 17px;
  font-weight: 600;
  color: #2c4f54;
  letter-spacing: 4px;
  line-height: 1.15;
  white-space: nowrap;
}

.p2-title-col-offset {
  margin-top: 2.8em;
}

.p2-divider {
  width: 48px;
  height: 1px;
  margin: 10px 0 8px;
  background: linear-gradient(to right, transparent, #a8895a 20%, #a8895a 80%, transparent);
  position: relative;
  flex-shrink: 0;
}

.p2-divider::after {
  content: '✿';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  color: #a8895a;
  line-height: 1;
  background: var(--bg-cream);
  padding: 0 4px;
}

.p2-body {
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-start;
  gap: 5px;
}

.p2-body p {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: 9px;
  line-height: 1.5;
  letter-spacing: 1px;
  color: #5a5a5a;
  margin: 0;
  white-space: nowrap;
}

.p2-text-line {
  width: 1px;
  flex-shrink: 0;
  align-self: stretch;
  min-height: 140px;
  max-height: 36vh;
  background: linear-gradient(to bottom, transparent 5%, rgba(168,137,90,0.45) 50%, transparent 95%);
  position: relative;
}

.p2-text-line::after {
  content: '◆';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 7px;
  color: #a8895a;
  background: var(--bg-cream);
  padding: 3px 0;
}

.page-p2 .btn-next {
  position: absolute;
  bottom: calc(12px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  margin: 0;
}

.keyword-popup {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.keyword-popup.show {
  opacity: 1;
  visibility: visible;
}

.keyword-popup-inner {
  background: #fff;
  padding: 24px;
  border-radius: 12px;
  max-width: 80%;
  text-align: center;
  border: 1px solid var(--gold-light);
}

.keyword-popup-inner p {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-dark);
  margin-bottom: 16px;
}

.keyword-popup-close {
  padding: 8px 24px;
  background: var(--teal);
  color: #fff;
  border-radius: 16px;
  font-size: 13px;
}

.page-p3 .page-content {
  padding-top: calc(20px + var(--safe-top));
}

.p3-title {
  font-size: 20px;
  color: var(--teal-dark);
  text-align: center;
  letter-spacing: 3px;
  margin-bottom: 24px;
}

.p3-scroll {
  overflow-y: auto;
}

.timeline {
  position: relative;
  padding-left: 8px;
}

.timeline-line {
  position: absolute;
  left: 28%;
  top: 0;
  width: 2px;
  height: 0;
  background: linear-gradient(to bottom, var(--gold), var(--pink));
  transition: height 0.6s ease;
}

.timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 32px;
  opacity: 0.4;
  transform: translateY(10px);
  transition: opacity 0.5s, transform 0.5s;
  cursor: pointer;
}

.timeline-item.visible {
  opacity: 1;
  transform: translateY(0);
}

.timeline-img {
  width: 30%;
  flex-shrink: 0;
}

.timeline-img img {
  width: 100%;
  display: block;
  transition: transform 0.35s ease;
  transform-origin: center center;
}

.timeline-text {
  flex: 1;
  padding-top: 8px;
  transition: transform 0.35s ease;
  transform-origin: left center;
}

.timeline-item.visible:hover .timeline-img img,
.timeline-item.visible:active .timeline-img img,
.timeline-item.hovered .timeline-img img {
  transform: scale(1.06);
}

.timeline-item.visible:hover .timeline-text,
.timeline-item.visible:active .timeline-text,
.timeline-item.hovered .timeline-text {
  transform: scale(1.04);
}

.timeline-text h3 {
  font-size: 16px;
  color: var(--teal);
  margin-bottom: 8px;
}

.timeline-divider {
  width: 60px;
  height: 1px;
  background: var(--gold);
  margin-bottom: 8px;
  position: relative;
}

.timeline-divider::after {
  content: '◆';
  position: absolute;
  right: -8px;
  top: -6px;
  font-size: 8px;
  color: var(--gold);
}

.timeline-text p {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-gray);
}

.p4-title {
  font-size: 20px;
  color: var(--teal-dark);
  text-align: center;
  letter-spacing: 3px;
  margin-bottom: 16px;
}

.craft-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 14px;
  margin-bottom: 20px;
}

.craft-item {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.3s;
}

.craft-item:active {
  transform: scale(0.97);
}

.craft-img-wrap {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(201,169,98,0.2);
  background: rgba(255,255,255,0.3);
}

.craft-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  display: block;
}

.craft-sub {
  margin: 10px 0 0;
  padding: 0 4px 6px;
  text-align: center;
  font-size: 11px;
  color: var(--text-light);
  line-height: 1.4;
  white-space: nowrap;
}

.craft-features {
  list-style: none;
  margin-bottom: 8px;
}

.craft-features li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-gray);
  padding: 8px 0;
  border-bottom: 1px dashed rgba(201,169,98,0.2);
}

.craft-features li img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
}

.craft-hint {
  text-align: center;
  font-size: 11px;
  color: var(--text-light);
  margin-bottom: 8px;
}

.magnify-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(245,240,232,0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.magnify-modal.show {
  opacity: 1;
  visibility: visible;
}

.magnify-content {
  width: 90%;
  text-align: center;
}

.magnify-content img {
  width: 100%;
  border-radius: 8px;
  animation: magnifyIn 0.4s ease;
}

@keyframes magnifyIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.magnify-content p {
  margin: 12px 0;
  font-size: 14px;
  color: var(--teal);
}

.magnify-close {
  padding: 8px 32px;
  border: 1px solid var(--gold);
  border-radius: 20px;
  color: var(--teal);
  font-size: 13px;
}

.p5-title-img {
  width: 72%;
  margin: 0 auto 10px;
}

.page-p5 .page-content {
  padding-top: calc(16px + var(--safe-top));
}

.pattern-carousel-wrap {
  display: flex;
  align-items: center;
  margin: 4px -6px 8px;
  gap: 4px;
}

.pattern-arrow {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(201, 169, 98, 0.5);
  background: rgba(255, 255, 255, 0.7);
  color: var(--teal);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 0 2px;
  z-index: 2;
}

.pattern-arrow:active {
  transform: scale(0.92);
}

.pattern-arrow:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.pattern-carousel {
  flex: 1;
  overflow: hidden;
  touch-action: pan-y;
  min-width: 0;
}

.pattern-track {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  padding: 0 4px;
  transition: transform 0.4s ease;
}

.pattern-slide {
  flex-shrink: 0;
  width: 17%;
  opacity: 0.45;
  transform: scale(0.82);
  transition: all 0.4s ease;
  cursor: pointer;
}

.pattern-slide.active {
  width: 34%;
  opacity: 1;
  transform: scale(1);
}

.pattern-slide img {
  width: 100%;
  height: auto;
  max-height: 200px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.08));
}

.pattern-meaning {
  text-align: center;
  font-size: 15px;
  color: var(--teal);
  margin: 10px 0 12px;
  letter-spacing: 2px;
}

.pattern-meaning::before,
.pattern-meaning::after {
  content: '◆';
  font-size: 6px;
  margin: 0 8px;
  color: var(--gold);
}

.pattern-list {
  list-style: none;
  margin-bottom: 14px;
  padding: 0 8px;
}

.pattern-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  font-size: 13px;
  color: var(--text-gray);
  border-bottom: 1px solid rgba(201, 169, 98, 0.18);
  cursor: pointer;
  transition: color 0.3s;
}

.pattern-list li span {
  flex: 1;
}

.pattern-list li.active {
  color: var(--teal);
}

.pattern-thumb {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(201, 169, 98, 0.25);
  flex-shrink: 0;
  background: #fff;
}

.pattern-list li.active .pattern-thumb {
  border-color: var(--gold);
  box-shadow: 0 0 8px rgba(201, 169, 98, 0.45);
}

.pattern-slide.growing img {
  animation: patternGrow 0.8s ease;
}

@keyframes patternGrow {
  0% { filter: brightness(1); }
  50% { filter: brightness(1.2) drop-shadow(0 0 8px rgba(201,169,98,0.6)); }
  100% { filter: brightness(1); }
}

.page-p6 .page-content {
  display: flex;
  flex-direction: column;
  padding: calc(12px + var(--safe-top)) 12px 0;
  overflow: hidden;
  height: 100%;
}

.game-header {
  text-align: center;
  flex-shrink: 0;
  margin-top: 36px;
  padding-bottom: 8px;
}

.game-title {
  font-size: 22px;
  color: var(--teal-dark);
  letter-spacing: 5px;
}

.game-subtitle {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

.game-timer {
  position: absolute;
  top: calc(12px + var(--safe-top));
  right: 14px;
  width: 76px;
  height: 76px;
  z-index: 10;
}

.game-area {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-hoop {
  display: none;
}

#gameCanvas {
  position: relative;
  width: 82%;
  max-width: 320px;
  aspect-ratio: 1;
  z-index: 3;
  touch-action: none;
}

.game-status {
  flex-shrink: 0;
  text-align: center;
  padding: 10px 16px calc(10px + var(--safe-bottom));
  background: rgba(245, 240, 232, 0.95);
  border-top: 1px solid rgba(201, 169, 98, 0.25);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.04);
  z-index: 5;
}

.game-hint-bar {
  margin-bottom: 6px;
}

.game-hint-bar img {
  width: 100%;
  max-height: 44px;
  object-fit: contain;
  margin: 0 auto;
}

.game-step-hint {
  font-size: 13px;
  color: var(--teal);
  margin: 0 0 8px;
  letter-spacing: 1px;
}

.game-step-hint .step-num {
  display: inline-block;
  min-width: 22px;
  height: 22px;
  line-height: 22px;
  border-radius: 50%;
  background: var(--gold);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  text-align: center;
  margin: 0 2px;
  animation: stepPulse 1.2s ease infinite;
}

@keyframes stepPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 rgba(201,169,98,0); }
  50% { transform: scale(1.1); box-shadow: 0 0 8px rgba(201,169,98,0.5); }
}

.game-hint {
  display: none;
}

.game-progress-bar {
  width: 88%;
  height: 5px;
  background: rgba(201,169,98,0.15);
  border-radius: 3px;
  margin: 0 auto 8px;
  overflow: hidden;
}

.game-back {
  position: absolute;
  top: calc(10px + var(--safe-top));
  left: 10px;
  width: 52px;
  z-index: 10;
}

.game-back img {
  width: 100%;
  height: auto;
  display: block;
}

.timer-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-bg {
  fill: none;
  stroke: rgba(201,169,98,0.15);
  stroke-width: 4;
}

.timer-progress {
  fill: none;
  stroke: var(--pink);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 283;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear;
}

.timer-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
  box-sizing: border-box;
}

.timer-value-wrap {
  display: flex;
  align-items: baseline;
  justify-content: center;
  line-height: 1;
}

.timer-text span {
  font-size: 24px;
  color: var(--gold);
  font-weight: 600;
  line-height: 1;
}

.timer-text small {
  font-size: 14px;
  color: var(--gold);
  margin-left: 1px;
  line-height: 1;
}

.timer-text em {
  font-style: normal;
  font-size: 9px;
  color: var(--text-light);
  margin-top: 3px;
  line-height: 1;
  letter-spacing: 1px;
}

.game-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--pink), var(--gold));
  border-radius: 3px;
  transition: width 0.3s;
}

.game-stats {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-light);
  padding: 0 6%;
}

.game-result {
  position: absolute;
  inset: 0;
  background: rgba(245,240,232,0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.game-result.hidden {
  display: none;
}

.result-title {
  font-size: 24px;
  color: var(--teal);
  letter-spacing: 4px;
  margin-bottom: 8px;
}

.result-sub {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 24px;
}

.result-btns {
  display: flex;
  gap: 16px;
}

.btn-replay, .btn-continue {
  padding: 10px 24px;
  border-radius: 20px;
  font-size: 13px;
}

.btn-replay {
  border: 1px solid var(--gold);
  color: var(--teal);
}

.btn-continue {
  background: linear-gradient(135deg, var(--pink), var(--lotus));
  color: #fff;
}

.game-flash {
  animation: gameFlash 0.5s ease;
}

@keyframes gameFlash {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
}

.page-p7 .page-content {
  position: relative;
  padding-top: calc(12px + var(--safe-top));
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.p7-header {
  flex-shrink: 0;
  z-index: 2;
}

.p7-title-img {
  width: 90%;
  margin: 0 auto;
}

.p7-hotspots {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.p7-hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  z-index: 5;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.p7-hotspot.done {
  pointer-events: none;
}

.p7-hotspot.done .p7-light-point,
.p7-hotspot.done .p7-word {
  opacity: 0;
  transform: scale(0);
  transition: all 0.45s ease;
}

.p7-word {
  writing-mode: vertical-rl;
  font-size: 13px;
  color: var(--teal);
  letter-spacing: 3px;
  opacity: 0.85;
  pointer-events: none;
  line-height: 1;
}

.p7-light-point {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, #F5E6B8 30%, rgba(201, 169, 98, 0.55) 55%, transparent 72%);
  box-shadow: 0 0 14px rgba(255, 230, 160, 0.85), 0 0 6px rgba(201, 169, 98, 0.5);
  animation: breathe 2s ease infinite;
  flex-shrink: 0;
}

.p7-footer {
  margin-top: auto;
  text-align: center;
  padding-bottom: 16px;
  z-index: 2;
  flex-shrink: 0;
}

@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.18); opacity: 1; }
}

.p7-hint {
  font-size: 13px;
  color: var(--text-gray);
  margin-bottom: 8px;
}

.p7-hand-icon {
  font-size: 24px;
  opacity: 0.5;
  animation: bounce 2s infinite;
}

.p7-complete {
  font-size: 14px;
  color: var(--gold);
  letter-spacing: 2px;
  margin-top: 12px;
  animation: fadeIn 1s ease;
}

.p7-complete.hidden {
  display: none;
}

.p8-title-img {
  width: 80%;
  margin: 0 auto 12px;
}

.modern-carousel-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0 -8px;
}

.modern-arrow {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(201, 169, 98, 0.55);
  background: rgba(255, 255, 255, 0.75);
  color: var(--teal);
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
  padding: 0 0 2px;
  transition: transform 0.2s, background 0.2s;
}

.modern-arrow:active {
  transform: scale(0.92);
  background: rgba(201, 169, 98, 0.15);
}

.modern-arrow:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.modern-carousel {
  flex: 1;
  overflow: hidden;
  touch-action: pan-y;
  min-width: 0;
}

.modern-track {
  display: flex;
  transition: transform 0.4s ease;
}

.modern-slide {
  flex-shrink: 0;
  width: 70%;
  margin: 0 5%;
  opacity: 0.5;
  transform: scale(0.9);
  transition: all 0.4s;
}

.modern-slide.active {
  opacity: 1;
  transform: scale(1);
}

.modern-slide img {
  width: 100%;
  border-radius: 8px;
}

.modern-caption {
  text-align: center;
  margin-top: 8px;
}

.modern-caption h3 {
  font-size: 16px;
  color: var(--teal);
}

.modern-caption p {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

.modern-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
}

.modern-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(201,169,98,0.35);
  transition: all 0.3s;
}

.modern-dots span.active {
  width: 26px;
  height: 8px;
  border-radius: 4px;
  background: var(--gold);
}

.modern-nav {
  display: flex;
  justify-content: space-between;
  list-style: none;
  padding: 0 2px;
  margin-bottom: 10px;
}

.modern-nav li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--text-light);
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.3s, transform 0.3s;
  flex: 1;
}

.modern-nav li.active {
  opacity: 1;
  color: var(--teal);
  transform: scale(1.05);
}

.modern-nav li img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.modern-nav li.active img {
  width: 42px;
  height: 42px;
}

.modern-swipe-hint {
  text-align: center;
  font-size: 11px;
  color: var(--text-light);
  margin-bottom: 8px;
}

.p9-title {
  font-size: 18px;
  color: var(--teal-dark);
  text-align: center;
  letter-spacing: 2px;
  line-height: 1.6;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.p9-desc {
  font-size: 12px;
  color: var(--text-gray);
  text-align: center;
  line-height: 1.8;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.page-p9 .page-content {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding-bottom: calc(12px + var(--safe-bottom));
}

.p9-flower-wrap {
  width: 52%;
  max-width: 260px;
  margin: 0 auto;
  flex-shrink: 0;
  animation: flowerReveal 1.2s ease;
}

@keyframes flowerReveal {
  from { clip-path: inset(0 50% 0 50%); opacity: 0; }
  to { clip-path: inset(0 0 0 0); opacity: 1; }
}

.p9-flower {
  width: 100%;
}

.p9-bottom {
  margin-top: auto;
  padding-top: 28px;
  width: 100%;
}

.p9-badge-wrap {
  width: 68%;
  max-width: 280px;
  margin: 0 auto 18px;
}

.p9-badge {
  width: 100%;
  display: block;
}

.p9-btns {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: nowrap;
  padding: 0 4px;
}

.p9-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 8px 12px;
  border-radius: 12px;
  font-size: 10px;
  color: var(--text-dark);
  flex: 1;
  max-width: 110px;
  line-height: 1.4;
  transition: transform 0.2s;
}

.p9-btn:active {
  transform: scale(0.95);
}

.p9-btn img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.p9-btn-poster {
  background: linear-gradient(135deg, #F5E0DC, #F0D0CC);
}

.p9-btn-replay {
  background: linear-gradient(135deg, #D8E8D8, #C8DDD0);
}

.p9-btn-more {
  background: linear-gradient(135deg, #F0E8DC, #E8DDD0);
}

.poster-modal {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.poster-modal.show {
  opacity: 1;
  visibility: visible;
}

.poster-modal-inner {
  width: 80%;
  max-width: 360px;
  text-align: center;
}

#posterCanvas {
  width: 100%;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.poster-tip {
  color: #fff;
  font-size: 12px;
  margin: 12px 0;
}

.poster-close {
  padding: 8px 32px;
  background: #fff;
  border-radius: 20px;
  font-size: 13px;
  color: var(--teal);
}

@media (max-height: 700px) {
  .p1-title { width: 75%; margin-top: 4%; }
  .p1-start-btn { width: 72px; height: 72px; bottom: 60px; }
  .game-area { width: 78%; }
  .craft-grid { gap: 8px; }
}

@media (min-width: 751px) {
  .app {
    box-shadow: 0 0 40px rgba(0,0,0,0.1);
  }
}

.hidden {
  display: none !important;
}
