/* 海岛关卡图 · 6 段竖拼 + 橙色连通线 */
:root {
  --lv-gold-top: #fffde7;
  --lv-gold-mid: #ffd54f;
  --lv-gold-bot: #ffb300;
  --lv-red-text: #c62828;
  --lv-red-border: #b71c1c;
  --lv-lock-bg: #4a4a4a;
  --lv-lock-text: #9e9e9e;
  --lv-lock-border: #383838;
  --path-orange: #ff9800;
  --m3-shell-max: 430px;
}

html {
  height: 100%;
  overflow: hidden;
  background: #0a1018;
}

body.orchard-page {
  margin: 0 auto;
  width: min(var(--m3-shell-max), 100vw);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 12px 40px rgba(0, 0, 0, 0.35);
  min-height: 100%;
  height: 100%;
  /* 与关卡竖图海水色衔接 */
  background: linear-gradient(180deg, #4dd0e1 0%, #26c6da 40%, #00acc1 100%);
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

/* 内容保护（选关页） */
body.orchard-page,
body.orchard-page * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

body.orchard-page img,
body.orchard-page video,
body.orchard-page canvas,
body.orchard-page svg {
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}

/* 萌宠 8 段长图：页缘略偏暖紫粉，与珊瑚连通线呼应 */
body.orchard-page--pet {
  background: linear-gradient(180deg, #b39ddb 0%, #7e57c2 28%, #26c6da 72%, #00acc1 100%);
}

/* 部分 Android WebView（5+ 壳）在子页面里 flex:1 子项高度算成 0，导致选关区整块不可见 */
body.orchard-page--pet .orchard-app {
  min-height: 100vh;
  min-height: -webkit-fill-available;
}

body.orchard-page--pet .orchard-scroll {
  flex: 1 1 0%;
  min-height: 0;
  transform: translateZ(0);
}

body.orchard-page--pet .orchard-head {
  background: rgba(126, 87, 194, 0.88);
  border-bottom-color: rgba(74, 20, 140, 0.15);
}

/* 美食：暖色系渐变（无专用底图时先用配色区分） */
body.orchard-page--life {
  background: linear-gradient(180deg, #ffcc80 0%, #ffab91 40%, #26c6da 100%);
}

body.orchard-page--life .orchard-head {
  background: rgba(255, 171, 145, 0.88);
  border-bottom-color: rgba(191, 54, 12, 0.14);
}

body.orchard-page--life .orchard-title {
  color: #81d4fa;
  -webkit-text-stroke: 0;
  transform: translateX(-10px);
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.45),
    0 2px 6px rgba(2, 119, 189, 0.35);
}

.orchard-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  box-sizing: border-box;
}

.orchard-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 12px;
  background: rgba(38, 198, 218, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0, 105, 120, 0.12);
  z-index: 20;
}

.orchard-back {
  flex-shrink: 0;
  padding: 8px 12px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(145deg, #c8e6c9, #a5d6a7);
  font-size: 0.95rem;
  color: #1b5e20;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid rgba(46, 125, 50, 0.35);
  box-shadow: 0 2px 8px rgba(27, 94, 32, 0.12);
}

.orchard-title-wrap {
  flex: 1;
  text-align: center;
  padding-right: 56px;
}

.orchard-title {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #fffef8;
  -webkit-text-stroke: 1.2px #f9a825;
  text-shadow:
    0 0 0 rgba(255, 213, 79, 0.35),
    0 1px 0 #b8860b,
    0 2px 4px rgba(0, 0, 0, 0.18);
}

.orchard-scroll {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scroll-behavior: auto;
  /* 竖向 6 段图铺满中间区域，此处仅作边缘透色衔接 */
  background: transparent;
}

.orchard-track {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  font-size: 0;
  line-height: 0;
}

/* 美食：简化网格选关（先跑通第三主题流程） */
.orchard-track--life .island-btn--life {
  width: 54px;
  height: 54px;
  min-width: 54px;
  min-height: 54px;
  border-radius: 50%;
  border-width: 2px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #2e7d32, #1b5e20);
  border-color: #f1f8e9;
  color: #f1f8e9;
  font-size: clamp(0.98rem, 3.8vw, 1.12rem);
  text-shadow: none;
  box-shadow:
    0 0 0 2px rgba(27, 94, 32, 0.35),
    0 2px 8px rgba(0, 0, 0, 0.22);
  overflow: visible;
}

.orchard-track--life .island-btn--life::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -11px;
  width: 6px;
  height: 10px;
  transform: translateX(-50%);
  border-radius: 2px;
  background: #efebe9;
  border: 1px solid rgba(0, 0, 0, 0.18);
}

.orchard-track--life .island-btn--life.island-btn--lock {
  background: linear-gradient(180deg, #616161, #424242);
  color: #cfd8dc;
  border-color: #b0bec5;
}

.orchard-track--life .island-btn--life.island-btn--current {
  box-shadow:
    0 0 0 2px rgba(255, 213, 79, 0.95),
    0 4px 14px rgba(0, 0, 0, 0.28);
}

/* 仅海岛底图：必须压在 SVG 之下，否则 PNG 会盖住橙色连通线 */
.orchard-layer--bg {
  position: relative;
  z-index: 1;
  width: 100%;
}

/* 已通关路径：叠在底图之上，在圆点与按钮之下 */
.orchard-paths {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  overflow: visible;
}

/* 篮子轨迹圆点：在路径之上、关卡按钮之下 */
.orchard-trail-layer {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  z-index: 3;
  pointer-events: none;
  overflow: visible;
}

/* 关卡按钮层：与底图同高，由 JS 同步每段高度 */
.orchard-layer--ui {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 4;
  pointer-events: none;
  box-sizing: border-box;
}

.island-segment--ui {
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

.orchard-trail-dot {
  position: absolute;
  width: 15px;
  height: 15px;
  margin: 0;
  padding: 0;
  transform: translate(-50%, -50%);
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

/* 飞行中的小篮子（图3） */
.orchard-fly-layer {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 8;
  pointer-events: none;
  overflow: visible;
}

.orchard-basket-fly {
  position: absolute;
  width: min(64px, 18vw);
  height: auto;
  margin: 0;
  padding: 0;
  /* 位移由 JS 设置：果园为左右摆；萌宠页为上下起伏 + scaleX 朝向 */
  object-fit: contain;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.25));
  pointer-events: none;
}

/* 水果通关飞行动画：小猴提篮全身图，略大于原篮子图标 */
.orchard-basket-fly--fruit-clear {
  width: min(78px, 22vw);
}

/* 解锁飞行：小马略放大，透明底 PNG */
.orchard-basket-fly--pet {
  width: min(76px, 21vw);
}

.island-segment {
  position: relative;
  width: 100%;
  display: block;
  margin: 0;
  padding: 0;
  vertical-align: top;
}

.island-segment__img {
  width: 100%;
  height: auto;
  display: block;
  margin: 0;
  padding: 0;
  vertical-align: top;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.island-segment__overlay {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  box-sizing: border-box;
}

.life-car {
  position: absolute;
  z-index: 10;
  width: min(86px, 22vw);
  height: auto;
  /* 图默认车头朝上 screen-y 负向为「沿路向前」 */
  transform: translate(-50%, -50%) rotate(var(--car-deg, 0deg));
  pointer-events: none;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.26));
  opacity: 0;
}

/* 关卡字：金黄底 + 红描边 + 红加粗（盖住原图数字） */
.island-btn {
  position: absolute;
  z-index: 9;
  left: var(--ix, 50%);
  top: var(--iy, 50%);
  transform: translate(-50%, -50%);
  overflow: visible;
  min-width: 46px;
  min-height: 42px;
  padding: 6px 12px;
  border: 3px solid var(--lv-red-border);
  border-radius: 14px;
  font-size: clamp(1.05rem, 4.5vw, 1.25rem);
  font-weight: 900;
  line-height: 1.1;
  cursor: pointer;
  pointer-events: auto;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  background: linear-gradient(
    180deg,
    var(--lv-gold-top) 0%,
    var(--lv-gold-mid) 45%,
    var(--lv-gold-bot) 100%
  );
  color: var(--lv-red-text);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.island-btn--play:active:not(:disabled) {
  transform: translate(-50%, -50%) scale(0.96);
}

/* 当前可挑战关：略强调 */
.island-btn--current {
  box-shadow:
    0 0 0 2px rgba(255, 152, 0, 0.85),
    0 4px 14px rgba(0, 0, 0, 0.25);
}

/* 未解锁：暗灰 */
.island-btn--lock {
  background: linear-gradient(180deg, #616161, var(--lv-lock-bg));
  border-color: var(--lv-lock-border);
  color: var(--lv-lock-text);
  text-shadow: none;
  cursor: not-allowed;
  opacity: 0.94;
}

.island-btn--apex {
  transform: translate(-50%, -50%) scale(1.1);
  z-index: 3;
}

/* 公司品牌标识 */
.orchard-brand-logo {
  display: inline-flex;
  flex-shrink: 0;
  margin-right: 4px;
  line-height: 0;
  border-radius: 8px;
  overflow: hidden;
}
.orchard-brand-logo img {
  display: block;
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 8px;
}
