/* demo5-home.css — Transplanted demo4 hero elements for demo5
   Only styles needed for: (1) right-side scene tiles, (2) stat bars, (3) demo4 CTA buttons */

/* ── demo5 Hero: taller navy base + vertically centered columns ── */
#demo5-hero.demo3-hero {
  min-height: clamp(520px, 72vh, 780px);
  padding: 3rem 0 2rem;
  display: flex;
  align-items: center;
}

#demo5-hero .demo3-hero__bg {
  height: 120%;
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
}

#demo5-hero .demo3-hero__inner {
  width: 100%;
  display: flex;
  align-items: center;
}

#demo5-hero .demo3-hero__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  width: 100%;
}

#demo5-hero .col-md-5,
#demo5-hero .col-md-7 {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#demo5-hero .demo4-arena {
  width: 100%;
}

#demo5-hero .demo3-hero__lead {
  margin-bottom: 1.15rem;
}

#demo5-hero .demo3-hero__actions {
  margin-bottom: 1.15rem;
}

#demo5-hero .demo3-stats-wrap {
  margin-top: 0.5rem;
  padding: 0.9rem 1.15rem !important;
}

#demo5-hero .demo4-hero__stats {
  margin-top: 0.65rem !important;
  margin-bottom: 0 !important;
  max-width: 80%;
  gap: 6px;
}

/* ── CTA Buttons (demo4 style for hero) ── */
.demo4-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 15px;
  text-decoration: none !important;
  transition: transform 0.2s, box-shadow 0.2s;
  border: none;
}

.demo4-btn--primary {
  background: linear-gradient(135deg, #ff7a3d, #ff5c8a);
  color: #fff !important;
  box-shadow: 0 10px 28px rgba(255, 92, 122, 0.35);
}

.demo4-btn--primary:hover {
  transform: translateY(-3px) scale(1.02);
}

.demo4-btn--ghost {
  background: #ffffff;
  color: #1a4fd4 !important;
  border: 2px solid rgba(61, 139, 255, 0.45);
  box-shadow: 0 8px 28px rgba(26, 34, 51, 0.08);
}

.demo4-btn--ghost:hover {
  transform: translateY(-3px) scale(1.02);
}

/* ── Stat Bars (活力 / 健康) ── */
.demo4-hero__stats {
  display: grid;
  gap: 10px;
  max-width: 280px;
  margin-bottom: 1.5rem;
}

.demo4-stat {
  margin: 0;
}

.demo4-stat__label {
  font-size: 11px;
  font-weight: 700;
  color: #5a6478;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.demo4-stat__bar {
  height: 10px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  overflow: hidden;
  border: 2px solid rgba(26, 34, 51, 0.08);
  margin-top: 4px;
}

.demo4-stat__bar span,
.demo5-stat-bar__fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff7a3d, #ffb347);
  box-shadow: 0 0 12px rgba(255, 122, 61, 0.5);
  transition: width 2s cubic-bezier(0.55, 0.05, 0.85, 0.45);
}

.demo4-stat__bar--mint span,
.demo4-stat__bar--mint .demo5-stat-bar__fill {
  background: linear-gradient(90deg, #2ec49a, #5ee0b0);
  box-shadow: 0 0 12px rgba(46, 196, 154, 0.45);
}

@media (prefers-reduced-motion: reduce) {
  .demo5-stat-bar__fill {
    transition: none;
  }
}

/* ── Scene Tiles (right hero visual block) ── */
#demo5-hero .demo4-arena {
  position: relative;
  min-height: 0;
  padding-top: 0;
}

#demo5-hero .demo4-float {
  position: absolute;
  z-index: 5;
  background: #ffffff;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 800;
  color: #1a2233;
  box-shadow: 0 16px 48px rgba(26, 34, 51, 0.12);
  border: 2px solid rgba(123, 92, 255, 0.2);
  opacity: 0;
  pointer-events: none;
}

#demo5-hero .demo4-float--quest {
  top: 0;
  right: 8%;
  animation-delay: 0s;
}

#demo5-hero .demo4-float--level {
  top: 18%;
  left: 0;
  background: linear-gradient(135deg, #7b5cff, #3d8bff);
  color: #fff;
  border-color: transparent;
  animation-delay: 0.8s;
}

#demo5-hero .demo4-scene__tile--card-c {
  overflow: visible;
  z-index: 3;
}

#demo5-hero .demo4-float--badge-o2o {
  top: auto;
  left: auto;
  bottom: -8px;
  right: -8px;
  color: #ff7a3d;
  white-space: nowrap;
}

@keyframes demo5-bob {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-10px) rotate(1deg); }
}

@keyframes demo5-bob-badge {
  0%, 100% {
    transform: translate(33.333%, 33.333%) translateY(0) rotate(-1deg);
  }
  50% {
    transform: translate(33.333%, 33.333%) translateY(-10px) rotate(1deg);
  }
}

@keyframes demo5-hero-tile-enter {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes demo5-hero-tile-rise {
  from {
    transform: translateY(5px);
  }

  to {
    transform: translateY(0);
  }
}

@keyframes demo5-hero-tile-veil-out {
  0%, 22% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

@keyframes demo5-hero-float-pop {
  0% {
    opacity: 0;
    transform: scale(0.88) translateY(0);
  }

  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes demo5-hero-float-pop-badge {
  0% {
    opacity: 0;
    transform: translate(33.333%, 33.333%) scale(0.88);
  }

  100% {
    opacity: 1;
    transform: translate(33.333%, 33.333%) scale(1);
  }
}

@keyframes demo5-hero-quest-enter {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes demo5-hero-xp-flash {
  0%, 100% {
    color: #2ec49a;
    text-shadow: none;
  }

  50% {
    color: #3ecfaa;
    text-shadow: 0 0 8px rgba(46, 196, 154, 0.45);
  }
}

#demo5-hero .demo4-arena:not(.demo5-hero-arena--inview) .demo4-scene__tile--boss {
  opacity: 0;
  transform: scale(0.96) translateY(8px);
}

#demo5-hero .demo4-scene__tile--card-a::before,
#demo5-hero .demo4-scene__tile--card-b::before,
#demo5-hero .demo4-scene__tile--card-c::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 4;
  border-radius: inherit;
  background: linear-gradient(160deg, rgba(20, 26, 38, 0.88) 0%, rgba(20, 26, 38, 0.72) 100%);
  opacity: 1;
  pointer-events: none;
}

#demo5-hero .demo4-arena:not(.demo5-hero-arena--inview) .demo4-scene__tile--card-a,
#demo5-hero .demo4-arena:not(.demo5-hero-arena--inview) .demo4-scene__tile--card-b,
#demo5-hero .demo4-arena:not(.demo5-hero-arena--inview) .demo4-scene__tile--card-c {
  opacity: 0;
  transform: translateY(5px);
}

#demo5-hero .demo4-arena:not(.demo5-hero-arena--inview) .demo4-mini-quest {
  opacity: 0;
  transform: translateY(14px);
}

#demo5-hero .demo4-arena.demo5-hero-arena--inview .demo4-scene__tile--boss {
  animation: demo5-hero-tile-enter 0.9s ease-out forwards;
}

#demo5-hero .demo4-arena.demo5-hero-arena--inview .demo4-scene__tile--card-a {
  opacity: 1;
  animation: demo5-hero-tile-rise 0.55s ease-out 0.2s forwards;
}

#demo5-hero .demo4-arena.demo5-hero-arena--inview .demo4-scene__tile--card-b {
  opacity: 1;
  animation: demo5-hero-tile-rise 0.55s ease-out 0.48s forwards;
}

#demo5-hero .demo4-arena.demo5-hero-arena--inview .demo4-scene__tile--card-c {
  opacity: 1;
  animation: demo5-hero-tile-rise 0.55s ease-out 0.76s forwards;
}

#demo5-hero .demo4-arena.demo5-hero-arena--inview .demo4-scene__tile--card-a::before {
  animation: demo5-hero-tile-veil-out 1.28s ease-out 0.2s forwards;
}

#demo5-hero .demo4-arena.demo5-hero-arena--inview .demo4-scene__tile--card-b::before {
  animation: demo5-hero-tile-veil-out 1.28s ease-out 0.48s forwards;
}

#demo5-hero .demo4-arena.demo5-hero-arena--inview .demo4-scene__tile--card-c::before {
  animation: demo5-hero-tile-veil-out 1.28s ease-out 0.76s forwards;
}

#demo5-hero .demo4-arena.demo5-hero-arena--inview .demo4-float--quest {
  animation:
    demo5-hero-float-pop 0.72s ease-out 1s forwards,
    demo5-bob 3.5s ease-in-out 1.72s infinite;
}

#demo5-hero .demo4-arena.demo5-hero-arena--inview .demo4-float--level {
  animation:
    demo5-hero-float-pop 0.72s ease-out 1.15s forwards,
    demo5-bob 3.5s ease-in-out 1.87s infinite;
}

#demo5-hero .demo4-arena.demo5-hero-arena--inview .demo4-float--badge-o2o {
  animation:
    demo5-hero-float-pop-badge 0.72s ease-out 1.3s forwards,
    demo5-bob-badge 3.5s ease-in-out 2.02s infinite;
}

#demo5-hero .demo4-arena.demo5-hero-arena--inview .demo4-mini-quest:first-child {
  animation: demo5-hero-quest-enter 0.58s ease-out 1.42s forwards;
}

#demo5-hero .demo4-arena.demo5-hero-arena--inview .demo4-mini-quest--alt {
  animation: demo5-hero-quest-enter 0.58s ease-out 1.7s forwards;
}

#demo5-hero .demo4-arena.demo5-hero-arena--inview .demo4-mini-quest:first-child .demo4-mini-quest__xp {
  animation: demo5-hero-xp-flash 0.6s ease-out 2s 1;
}

#demo5-hero .demo4-arena.demo5-hero-arena--inview-no-motion .demo4-scene__tile,
#demo5-hero .demo4-arena.demo5-hero-arena--inview-no-motion .demo4-float,
#demo5-hero .demo4-arena.demo5-hero-arena--inview-no-motion .demo4-mini-quest {
  opacity: 1;
  transform: none;
  filter: none;
  animation: none;
}

#demo5-hero .demo4-arena.demo5-hero-arena--inview-no-motion .demo4-scene__tile--card-a::before,
#demo5-hero .demo4-arena.demo5-hero-arena--inview-no-motion .demo4-scene__tile--card-b::before,
#demo5-hero .demo4-arena.demo5-hero-arena--inview-no-motion .demo4-scene__tile--card-c::before {
  opacity: 0;
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  #demo5-hero .demo4-arena.demo5-hero-arena--inview .demo4-scene__tile,
  #demo5-hero .demo4-arena.demo5-hero-arena--inview .demo4-float,
  #demo5-hero .demo4-arena.demo5-hero-arena--inview .demo4-mini-quest,
  #demo5-hero .demo4-arena.demo5-hero-arena--inview .demo4-mini-quest__xp {
    opacity: 1;
    transform: none;
    filter: none;
    animation: none;
  }

  #demo5-hero .demo4-arena.demo5-hero-arena--inview .demo4-scene__tile--card-a::before,
  #demo5-hero .demo4-arena.demo5-hero-arena--inview .demo4-scene__tile--card-b::before,
  #demo5-hero .demo4-arena.demo5-hero-arena--inview .demo4-scene__tile--card-c::before {
    opacity: 0;
    animation: none;
  }
}

#demo5-hero .demo4-scene {
  display: grid;
  grid-template-columns: 1.4fr 0.6fr 0.6fr;
  grid-template-rows: 1fr 1fr;
  gap: 8px;
  min-height: 200px;
}

.demo4-scene__tile {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(26, 34, 51, 0.12);
  border: 3px solid #fff;
  background: linear-gradient(145deg, #3d8bff, #7b5cff);
}

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

#demo5-hero .demo4-scene__tile--boss {
  grid-row: span 2;
  min-height: 168px;
}

.demo4-scene__tile--boss img {
  object-position: center 35%;
}

.demo4-scene__tile--card-a img {
  object-position: center center;
}

.demo4-scene__tile--card-b img {
  object-position: center 20%;
}

.demo4-scene__tile--card-c img {
  object-position: center 40%;
}

/* Fallback tile background colors */
.demo4-scene__tile--card-a { background: linear-gradient(145deg, #ff7a3d, #ffb347); }
.demo4-scene__tile--card-b { background: linear-gradient(145deg, #2ec49a, #5ee0b0); }
.demo4-scene__tile--card-c { background: linear-gradient(145deg, #7b5cff, #3d8bff); }

.demo4-scene__meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 28px 12px 10px;
  background: linear-gradient(180deg, transparent 0%, rgba(26, 34, 51, 0.72) 100%);
  pointer-events: none;
}

.demo4-scene__tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.92);
  color: #1a4fd4;
}

.demo4-scene__tag--proto {
  background: rgba(123, 92, 255, 0.92);
  color: #fff;
}

.demo4-scene__label {
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.demo4-scene__tile--boss .demo4-scene__label {
  font-size: 14px;
}

.demo4-scene__note {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.82);
  letter-spacing: 0.02em;
}

/* ── Mini Quests (tight under scene tiles) ── */
#demo5-hero .demo4-task-stack {
  position: relative;
  bottom: auto;
  left: auto;
  right: auto;
  display: grid;
  gap: 6px;
  margin-top: 8px;
  max-width: 100%;
}

#demo5-hero .demo4-mini-quest {
  padding: 10px 12px;
}

.demo4-mini-quest {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 18px;
  border: 2px solid rgba(26, 34, 51, 0.08);
  box-shadow: 0 8px 28px rgba(26, 34, 51, 0.08);
}

/* dc-glass override for mini-quest */
.demo4-mini-quest.dc-glass {
  padding: 12px 14px !important;
}

.demo4-mini-quest--alt {
  border-color: rgba(123, 92, 255, 0.25);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.95), rgba(235, 232, 255, 0.95));
}

.demo4-mini-quest__icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ff7a3d, #ffb347);
  color: #fff;
  font-size: 16px;
  flex-shrink: 0;
}

.demo4-mini-quest--alt .demo4-mini-quest__icon {
  background: linear-gradient(135deg, #7b5cff, #3d8bff);
}

.demo4-mini-quest strong {
  display: block;
  font-size: 14px;
  color: #1a2233;
}

.demo4-mini-quest small {
  font-size: 12px;
  color: #5a6478;
}

.demo4-mini-quest__xp {
  margin-left: auto;
  font-size: 11px;
  font-weight: 800;
  color: #2ec49a;
  white-space: nowrap;
}

.demo4-mini-quest--alt .demo4-mini-quest__xp {
  color: #7b5cff;
}

/* ── RWD：手機版比照 demo3／demo4 直向堆疊 ── */
@media (max-width: 991px) {
  #demo5-hero.demo3-hero {
    min-height: auto;
    padding: 3.5rem 0 3rem;
    align-items: stretch;
    display: block;
  }

  #demo5-hero .demo3-hero__bg {
    height: 100%;
    top: 0;
    transform: none;
    /* 上淺下深：圖片在上、文字在下 */
    background:
      linear-gradient(180deg, #fafbfc 0%, #f0f3f6 46%, var(--d3-navy-mid) 46%, var(--d3-navy) 100%);
  }

  #demo5-hero .demo3-hero__inner {
    display: block;
  }

  #demo5-hero .demo3-hero__row {
    display: flex;
    flex-direction: column;
    margin-left: 0;
    margin-right: 0;
  }

  #demo5-hero .col-md-5,
  #demo5-hero .col-md-7 {
    display: block;
    width: 100%;
    max-width: 100%;
    float: none;
    padding-left: 15px;
    padding-right: 15px;
  }

  /* 手機版：右欄圖片優先（order 反轉 DOM 順序） */
  #demo5-hero .col-md-7 {
    order: 1;
  }

  #demo5-hero .col-md-5 {
    order: 2;
    margin-top: 1.75rem;
  }

  #demo5-hero .demo3-hero__eyebrow,
  #demo5-hero .demo3-hero__title,
  #demo5-hero .demo3-hero__lead {
    color: #fff;
  }

  #demo5-hero .demo3-hero__actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 1.5rem;
  }

  #demo5-hero .demo3-hero__actions .demo4-btn {
    width: 100%;
    justify-content: center;
    white-space: nowrap;
  }

  #demo5-hero .demo3-stats-wrap {
    margin-top: 0.75rem;
  }

  #demo5-hero .demo4-hero__stats {
    max-width: 100%;
    margin-top: 1rem !important;
  }

  #demo5-hero .demo4-arena {
    margin-top: 0;
    margin-bottom: 0;
    min-height: 0;
  }
}

@media (max-width: 575px) {
  #demo5-hero.demo3-hero {
    padding: 3rem 0 2.5rem;
  }

  #demo5-hero .demo4-float {
    font-size: 11px;
    padding: 8px 11px;
  }

  #demo5-hero .demo4-float--level {
    top: 12%;
    left: -2px;
  }

  #demo5-hero .demo4-float--badge-o2o {
    bottom: -6px;
    right: -6px;
    font-size: 10px;
    padding: 7px 10px;
  }

  #demo5-hero .demo4-scene {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
    min-height: 0;
  }

  #demo5-hero .demo4-scene__tile--boss {
    grid-column: span 2;
    grid-row: span 1;
    min-height: 180px;
  }

  #demo5-hero .demo4-task-stack {
    margin-top: 10px;
  }

  #demo5-hero .demo4-mini-quest {
    padding: 12px 14px;
  }
}

/* ── Health Gamification Framework (from demo4) ── */
.demo4-health-framework {
  --d4-cream: #fff8ef;
  --d4-blue-deep: #1a4fd4;
  --d4-violet: #7b5cff;
  --d4-ink: #1a2233;
  --d4-muted: #5a6478;
  --d4-card: #ffffff;
  --d4-radius-lg: 24px;
  --d4-shadow: 0 16px 48px rgba(26, 34, 51, 0.12);
  --d4-shadow-soft: 0 8px 28px rgba(26, 34, 51, 0.08);
  --d4-border: rgba(26, 34, 51, 0.08);
  padding: 4rem 0 4.5rem;
  background: linear-gradient(180deg, #fff 0%, var(--d4-cream) 100%);
}

.demo4-health-framework .demo4-section__head {
  text-align: center;
  margin-bottom: 2.5rem;
}

.demo4-health-framework .demo4-section__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--d4-violet);
  margin-bottom: 0.5rem;
}

.demo4-health-framework .demo4-section__title {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 900;
  color: var(--d4-ink);
  margin: 0 0 0.5rem;
}

.demo4-health-framework .demo4-section__desc {
  font-size: 15px;
  color: var(--d4-muted);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.6;
}

.demo4-framework__chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  list-style: none;
  margin: 0 0 1.75rem;
  padding: 0;
}

.demo4-framework__chips li {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  color: var(--d4-blue-deep);
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid rgba(61, 139, 255, 0.25);
  box-shadow: var(--d4-shadow-soft);
}

.demo4-framework__visual {
  margin: 0;
  border-radius: var(--d4-radius-lg);
  overflow: hidden;
  box-shadow: var(--d4-shadow);
  border: 2px solid var(--d4-border);
  background: var(--d4-card);
}

.demo4-framework__visual img,
.demo4-framework__visual picture {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
}

.demo4-framework__visual picture img {
  display: block;
  width: 100%;
  height: auto;
}

@media (max-width: 767px) {
  .demo4-health-framework {
    padding: 3rem 0 3.5rem;
  }

  .demo4-framework__chips li {
    font-size: 12px;
    padding: 6px 12px;
  }
}

/* ── Quest Map + Patch Notes（scoped，不影響 hero） ── */
.demo5-quest-patch {
  --d4-orange: #ff7a3d;
  --d4-orange-glow: #ffb347;
  --d4-mint: #5ee0b0;
  --d4-mint-deep: #2ec49a;
  --d4-violet: #7b5cff;
  --d4-blue: #3d8bff;
  --d4-blue-deep: #1a4fd4;
  --d4-ink: #1a2233;
  --d4-muted: #5a6478;
  --d4-card: #ffffff;
  --d4-radius-lg: 24px;
  --d4-shadow: 0 16px 48px rgba(26, 34, 51, 0.12);
  --d4-border: rgba(26, 34, 51, 0.08);
}

.demo5-quest-patch .demo4-section {
  padding: 4.5rem 0;
}

.demo5-quest-patch .demo4-section--map {
  background: linear-gradient(180deg, #1a2233 0%, #243352 50%, #1e2a42 100%);
  color: #fff;
}

.demo5-quest-patch .demo4-section__head {
  text-align: center;
  margin-bottom: 2.5rem;
}

.demo5-quest-patch .demo4-section__head--light .demo4-section__title,
.demo5-quest-patch .demo4-section__head--light .demo4-section__desc {
  color: rgba(255, 255, 255, 0.92);
}

.demo5-quest-patch .demo4-section__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--d4-violet);
  margin-bottom: 0.5rem;
}

.demo5-quest-patch .demo4-section--map .demo4-section__label {
  color: var(--d4-mint);
}

.demo5-quest-patch .demo4-section__title {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 900;
  color: var(--d4-ink);
  margin: 0 0 0.5rem;
}

.demo5-quest-patch .demo4-section__desc {
  font-size: 15px;
  color: var(--d4-muted);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.6;
}

.demo5-patch-section__head-text {
  text-align: center;
}

.demo5-patch-section__head-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  margin: 0 auto 0.5rem;
}

.demo5-patch-section__head-copy {
  text-align: center;
}

.demo5-patch-section__head-copy .demo4-section__title {
  margin-bottom: 0;
}

.demo5-mascot--sweater-sheep {
  width: clamp(68px, 10vw, 88px);
  flex-shrink: 0;
  align-self: center;
  margin-right: -0.1rem;
}

.demo5-quest-patch .demo4-section__more {
  text-align: center;
  margin-top: 2rem;
}

.demo5-quest-patch .demo4-quest-map {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

@keyframes demo5-quest-zoom-pulse {
  0% {
    transform: scale(1);
  }

  42% {
    transform: scale(1.06);
  }

  72% {
    transform: scale(0.98);
  }

  100% {
    transform: scale(1);
  }
}

.demo5-quest-patch .demo4-quest {
  position: relative;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--d4-radius-lg);
  overflow: hidden;
  transform-origin: center center;
  transition: transform 0.25s, border-color 0.25s;
}

.demo5-quest-patch .demo4-quest.demo5-quest--inview {
  animation: demo5-quest-zoom-pulse 0.85s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.demo5-quest-patch .demo4-quest:hover {
  animation: none;
  transform: translateY(-6px);
  border-color: rgba(94, 224, 176, 0.5);
}

@media (prefers-reduced-motion: reduce) {
  .demo5-quest-patch .demo4-quest.demo5-quest--inview {
    animation: none;
  }
}

.demo5-quest-patch .demo4-quest--boss {
  grid-column: span 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.demo5-quest-patch .demo4-quest--boss .demo4-quest__thumb {
  min-height: 220px;
}

.demo5-quest-patch .demo4-quest__pin {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
  background: var(--d4-orange);
  color: #fff;
  letter-spacing: 0.06em;
}

.demo5-quest-patch .demo4-quest__thumb {
  position: relative;
  min-height: 160px;
  background: linear-gradient(135deg, #2a3a55, #1a2233);
  overflow: hidden;
}

.demo5-quest-patch .demo4-quest__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  min-height: 160px;
  opacity: 0.92;
}

.demo5-quest-patch .demo4-quest__type {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  background: rgba(26, 34, 51, 0.8);
  color: var(--d4-mint);
}

.demo5-quest-patch .demo4-quest--cooking .demo4-quest__type { color: #ffb347; }
.demo5-quest-patch .demo4-quest--core .demo4-quest__type { color: #ff7a9e; }

.demo5-quest-patch .demo4-quest__body {
  padding: 1.25rem 1.35rem 1.5rem;
}

.demo5-quest-patch .demo4-quest--boss .demo4-quest__body {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.demo5-quest-patch .demo4-quest__stars {
  color: var(--d4-orange-glow);
  font-size: 12px;
  margin-bottom: 0.35rem;
  letter-spacing: 2px;
}

.demo5-quest-patch .demo4-quest__body h3 {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0 0 0.5rem;
  color: #fff;
}

.demo5-quest-patch .demo4-quest__body p {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.55;
  margin: 0 0 1rem;
}

.demo5-quest-patch .demo4-quest__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: calc(13px * 1.5);
  font-weight: 800;
  color: var(--d4-mint) !important;
  text-decoration: none !important;
}

.demo5-quest-patch .demo4-quest__cta:hover {
  color: #fff !important;
}

@keyframes demo5-patch-board-enter {
  from {
    opacity: 0;
    transform: translateY(16px);
    box-shadow: 0 4px 14px rgba(26, 34, 51, 0.06);
  }

  to {
    opacity: 1;
    transform: translateY(0);
    box-shadow: var(--d4-shadow);
  }
}

@keyframes demo5-patch-sidebar-enter {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes demo5-patch-sidebar-enter-mobile {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes demo5-patch-dot-flash {
  0% {
    box-shadow: 0 0 8px var(--d4-mint);
    transform: scale(1);
  }

  45% {
    box-shadow: 0 0 14px var(--d4-mint), 0 0 22px rgba(46, 196, 154, 0.45);
    transform: scale(1.35);
  }

  100% {
    box-shadow: 0 0 8px var(--d4-mint);
    transform: scale(1);
  }
}

@keyframes demo5-patch-row-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes demo5-patch-ver-pop {
  from {
    opacity: 0;
    transform: scale(0.92);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes demo5-patch-scan {
  from {
    top: -45%;
    opacity: 0;
  }

  12% {
    opacity: 1;
  }

  to {
    top: 105%;
    opacity: 0;
  }
}

.demo5-quest-patch .demo4-patch-board {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 0;
  border-radius: var(--d4-radius-lg);
  overflow: hidden;
  box-shadow: var(--d4-shadow);
  border: 2px solid var(--d4-border);
  background: var(--d4-card);
}

.demo5-quest-patch .demo4-patch-board__sidebar {
  background: linear-gradient(180deg, #1a2233, #2a3d5c);
  color: #fff;
  padding: 1.5rem 1.25rem;
  font-size: 13px;
  line-height: 1.5;
}

.demo5-quest-patch .demo4-patch-board__status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  margin-bottom: 1rem;
  font-size: 12px;
}

.demo5-quest-patch .demo4-patch-board__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--d4-mint);
  box-shadow: 0 0 8px var(--d4-mint);
  animation: demo5-pulse 2s infinite;
}

@keyframes demo5-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.demo5-quest-patch .demo4-patch-list {
  position: relative;
  overflow: hidden;
  padding: 0.5rem 0;
}

.demo5-quest-patch .demo4-patch {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--d4-border);
}

.demo5-quest-patch .demo4-patch:last-child {
  border-bottom: none;
}

.demo5-quest-patch .demo4-patch__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 0.5rem;
}

.demo5-quest-patch .demo4-patch__ver {
  font-family: "Consolas", "Courier New", monospace;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(123, 92, 255, 0.12);
  color: var(--d4-violet);
}

.demo5-quest-patch .demo4-patch__meta time {
  font-size: 12px;
  color: var(--d4-muted);
  font-weight: 600;
}

.demo5-quest-patch .demo4-patch__tag {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(46, 196, 154, 0.15);
  color: var(--d4-mint-deep);
}

.demo5-quest-patch .demo4-patch__title {
  font-size: clamp(1.725rem, 3.75vw, 1.95rem);
  font-weight: 800;
  line-height: 1.35;
  margin: 0 0 0.4rem;
  color: var(--d4-ink);
}

.demo5-quest-patch .demo4-patch__title a {
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  color: var(--d4-ink) !important;
  text-decoration: none !important;
}

.demo5-quest-patch .demo4-patch__title a:hover {
  color: var(--d4-violet) !important;
}

.demo5-quest-patch .demo4-patch__body {
  font-size: 13px;
  font-weight: 400;
  color: var(--d4-muted);
  margin: 0 0 0.5rem;
  line-height: 1.55;
}

.demo5-quest-patch .demo4-patch__link {
  font-size: 13px;
  font-weight: 700;
  color: var(--d4-blue) !important;
  text-decoration: none !important;
}

/* Patch board scroll entrance (A: board + stagger rows, B: scan line) */
.demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed:not(.demo5-patch-board--inview) {
  opacity: 0;
  transform: translateY(16px);
  box-shadow: 0 4px 14px rgba(26, 34, 51, 0.06);
}

.demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed.demo5-patch-board--inview {
  animation: demo5-patch-board-enter 0.55s ease-out forwards;
}

.demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed:not(.demo5-patch-board--inview) .demo4-patch-board__sidebar {
  opacity: 0;
  transform: translateX(-10px);
}

.demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed.demo5-patch-board--inview .demo4-patch-board__sidebar {
  animation: demo5-patch-sidebar-enter 0.45s ease-out 0.08s forwards;
}

.demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed.demo5-patch-board--inview .demo4-patch-board__dot {
  animation: demo5-patch-dot-flash 0.6s ease-out 0.15s, demo5-pulse 2s ease-in-out 0.85s infinite;
}

.demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed:not(.demo5-patch-board--inview) .demo4-patch {
  opacity: 0;
  transform: translateY(12px);
}

.demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed.demo5-patch-board--inview .demo4-patch {
  animation: demo5-patch-row-enter 0.42s ease-out forwards;
}

.demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed.demo5-patch-board--inview .demo4-patch:nth-child(1) {
  animation-delay: 0.22s;
}

.demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed.demo5-patch-board--inview .demo4-patch:nth-child(2) {
  animation-delay: 0.34s;
}

.demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed.demo5-patch-board--inview .demo4-patch:nth-child(3) {
  animation-delay: 0.46s;
}

.demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed.demo5-patch-board--inview .demo4-patch:nth-child(4) {
  animation-delay: 0.58s;
}

.demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed.demo5-patch-board--inview .demo4-patch:nth-child(5) {
  animation-delay: 0.7s;
}

.demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed.demo5-patch-board--inview .demo4-patch:nth-child(6) {
  animation-delay: 0.82s;
}

.demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed.demo5-patch-board--inview .demo4-patch:nth-child(n+7) {
  animation-delay: 0.94s;
}

.demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed:not(.demo5-patch-board--inview) .demo4-patch__ver {
  opacity: 0;
  transform: scale(0.92);
}

.demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed.demo5-patch-board--inview .demo4-patch__ver {
  animation: demo5-patch-ver-pop 0.32s ease-out forwards;
}

.demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed.demo5-patch-board--inview .demo4-patch:nth-child(1) .demo4-patch__ver {
  animation-delay: 0.28s;
}

.demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed.demo5-patch-board--inview .demo4-patch:nth-child(2) .demo4-patch__ver {
  animation-delay: 0.4s;
}

.demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed.demo5-patch-board--inview .demo4-patch:nth-child(3) .demo4-patch__ver {
  animation-delay: 0.52s;
}

.demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed.demo5-patch-board--inview .demo4-patch:nth-child(4) .demo4-patch__ver {
  animation-delay: 0.64s;
}

.demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed.demo5-patch-board--inview .demo4-patch:nth-child(5) .demo4-patch__ver {
  animation-delay: 0.76s;
}

.demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed.demo5-patch-board--inview .demo4-patch:nth-child(6) .demo4-patch__ver {
  animation-delay: 0.88s;
}

.demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed.demo5-patch-board--inview .demo4-patch:nth-child(n+7) .demo4-patch__ver {
  animation-delay: 1s;
}

.demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed.demo5-patch-board--inview .demo4-patch-list::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 42%;
  top: -45%;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(46, 196, 154, 0.04) 42%,
    rgba(46, 196, 154, 0.1) 50%,
    rgba(46, 196, 154, 0.04) 58%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 2;
  animation: demo5-patch-scan 0.85s ease-out 0.18s forwards;
}

@media (prefers-reduced-motion: reduce) {
  .demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed:not(.demo5-patch-board--inview),
  .demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed:not(.demo5-patch-board--inview) .demo4-patch-board__sidebar,
  .demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed:not(.demo5-patch-board--inview) .demo4-patch,
  .demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed:not(.demo5-patch-board--inview) .demo4-patch__ver {
    opacity: 1;
    transform: none;
  }

  .demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed.demo5-patch-board--inview,
  .demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed.demo5-patch-board--inview .demo4-patch-board__sidebar,
  .demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed.demo5-patch-board--inview .demo4-patch,
  .demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed.demo5-patch-board--inview .demo4-patch__ver,
  .demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed.demo5-patch-board--inview .demo4-patch-board__dot,
  .demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed.demo5-patch-board--inview .demo4-patch-list::after {
    animation: none;
  }
}

@media (max-width: 991px) {
  .demo5-quest-patch .demo4-quest-map {
    grid-template-columns: 1fr;
  }

  .demo5-quest-patch .demo4-quest--boss {
    grid-column: span 1;
    grid-template-columns: 1fr;
  }

  .demo5-quest-patch .demo4-patch-board {
    grid-template-columns: 1fr;
  }

  .demo5-quest-patch .demo4-patch-board__sidebar {
    padding: 1rem 1.25rem;
  }

  .demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed:not(.demo5-patch-board--inview) .demo4-patch-board__sidebar {
    transform: translateY(-8px);
  }

  .demo5-quest-patch .demo4-patch-board.demo5-patch-board--armed.demo5-patch-board--inview .demo4-patch-board__sidebar {
    animation-name: demo5-patch-sidebar-enter-mobile;
  }
}

/* ── Guild Allies（曾合作案例，與 demo4 相同；獨立 class 不影響其他區塊） ── */
.demo5-guild-section {
  --d5-guild-cream: #ffeed9;
  --d5-guild-ink: #1a2233;
  --d5-guild-muted: #5a6478;
  --d5-guild-card: #ffffff;
  --d5-guild-radius: 18px;
  --d5-guild-border: rgba(26, 34, 51, 0.08);
  --d5-guild-shadow-soft: 0 8px 28px rgba(26, 34, 51, 0.08);
  --d5-guild-orange: #ff7a3d;
  --d5-guild-violet: #7b5cff;
  padding: 4.5rem 0;
  background: var(--d5-guild-cream);
}

.demo5-guild-section__head {
  text-align: center;
  margin-bottom: 2.5rem;
}

.demo5-guild-section__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--d5-guild-violet);
  margin-bottom: 0.5rem;
}

.demo5-guild-section__title {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 900;
  color: var(--d5-guild-ink);
  margin: 0 0 0.5rem;
}

.demo5-guild-section__desc {
  font-size: 15px;
  color: var(--d5-guild-muted);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.6;
}

.demo5-guild-hall {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.25rem;
}

.demo5-ally {
  flex: 0 0 calc(16.666% - 1.25rem);
  min-width: 130px;
  max-width: 170px;
  text-align: center;
  text-decoration: none !important;
  transition: transform 0.2s;
}

.demo5-ally:hover {
  transform: translateY(-6px);
}

.demo5-ally__crest {
  width: 48px;
  height: 48px;
  margin: 0 auto 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--d5-guild-orange), var(--d5-guild-violet));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 6px 16px rgba(123, 92, 255, 0.3);
}

.demo5-ally__logo {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 88px;
  background: var(--d5-guild-card);
  border-radius: var(--d5-guild-radius);
  padding: 14px;
  border: 2px solid var(--d5-guild-border);
  box-shadow: var(--d5-guild-shadow-soft);
  margin-bottom: 8px;
}

.demo5-ally__logo img {
  max-width: 100%;
  max-height: 60px;
  object-fit: contain;
}

.demo5-ally__name {
  font-size: 12px;
  font-weight: 700;
  color: var(--d5-guild-ink);
  line-height: 1.4;
}

.demo5-ally--empty .demo5-ally__crest {
  background: linear-gradient(135deg, #ccc, #999);
}

.demo5-ally--empty .demo5-ally__logo {
  display: none;
}

.demo5-ally--empty .demo5-ally__name {
  padding: 1.5rem 0.5rem;
  background: var(--d5-guild-card);
  border-radius: var(--d5-guild-radius);
  border: 2px dashed rgba(123, 92, 255, 0.35);
  color: var(--d5-guild-muted);
}

@media (max-width: 575px) {
  .demo5-guild-section {
    padding: 3.5rem 0;
  }

  .demo5-ally {
    flex: 0 0 calc(50% - 0.75rem);
  }
}

/* ── 裝飾角色（階段性目標 / 曾合作案例） ── */
.demo5-mascot {
  display: block;
  height: auto;
  pointer-events: none;
  user-select: none;
  flex-shrink: 0;
}

.demo5-milestones-section {
  overflow: visible;
}

.demo5-milestones__head {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0.35rem;
  text-align: center;
}

.demo5-milestones__head-text {
  text-align: center;
}

.demo5-milestones__head-text .demo3-section__title::after {
  margin-left: auto;
  margin-right: auto;
}

.demo5-mascot--part-time-boy {
  width: clamp(88px, 11vw, 118px);
  margin-bottom: 2px;
}

.demo5-guild-section__head-text {
  text-align: center;
}

.demo5-guild-section__head-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  margin: 0 auto 0.5rem;
}

.demo5-guild-section__head-copy {
  text-align: center;
}

.demo5-guild-section__head-copy .demo5-guild-section__title {
  margin-bottom: 0;
}

.demo5-mascot--guard-pug-head {
  display: block;
  width: 72px;
  flex-shrink: 0;
  align-self: center;
  margin-right: -0.15rem;
}

.demo5-mascot--guard-pug-cards {
  display: none;
}

.demo5-guild-body {
  display: block;
  margin: 0 auto;
}

.demo5-guild-body .demo5-guild-hall {
  justify-content: center;
}

@media (max-width: 991px) {
  .demo5-milestones__head {
    gap: 0.15rem;
  }

  .demo5-mascot--part-time-boy {
    width: 68px;
    margin-bottom: 0;
  }

  #demo5-guild .demo5-guild-section__desc {
    font-size: 13px;
  }
}

@media (max-width: 575px) {
  .demo5-milestones__head {
    padding: 0 0.25rem;
  }

  .demo5-mascot--part-time-boy {
    width: 56px;
  }

  .demo5-mascot--guard-pug-head {
    width: 60px;
    margin-right: -0.1rem;
  }

  .demo5-mascot--sweater-sheep {
    width: 60px;
  }
}

@media (min-width: 992px) {
  .demo5-mascot--guard-pug-head {
    display: none;
  }

  .demo5-mascot--guard-pug-cards {
    display: block;
    width: 142px;
    align-self: center;
    margin-right: -0.5rem;
  }

  .demo5-guild-body {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: fit-content;
    max-width: 100%;
  }

  .demo5-guild-body .demo5-guild-hall {
    flex: 0 1 auto;
    min-width: 0;
    justify-content: flex-start;
  }

  .demo5-mascot--part-time-boy {
    margin-left: 0.15rem;
  }
}
