/* dex-home.css - 图鉴的主页集成（index.html）
 * ① 图鉴入口 FAB（播放器正上方）
 * ② 主页展示层：配置进来的收集物（空中漂浮）与角色（地板跑步/原地弹跳）
 * ③ 配置模式（?arrange=1）：隐藏主页其它 UI，槽位 + 待选托盘
 * 设计语言与 landing.css 一致：3~4px 墨描边、硬阴影、胶囊标签
 */

:root {
  --dex-ink: #1d1d1d;
  --dex-miku: #39C5BB;
  --dex-yellow: #FFD93D;
}

/* ==================== ① 图鉴入口 FAB ====================
   批次四十四：并入右侧功能竖列（播放器 96 → 设置 166 → 排行榜 236 → 图鉴 306），
   水平与 56px 圆钮居中对齐（right:16 = 14 + (56-52)/2）；
   批次六十四：用户要求恢复方案 E 拍立得相纸方形造型（批次六十一曾改圆钮） */
.dex-fab {
  position: fixed;
  right: 16px;
  bottom: 306px;
  z-index: 60;
  width: 52px;
  height: 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5px 4px 3px;
  background: #fff;
  border: 3.5px solid var(--dex-ink);
  border-radius: 8px;
  box-shadow: 3px 3px 0 #66CCFF;    /* 天蓝投影（批次五十一选定） */
  transform: rotate(3deg);
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}

.dex-fab-photo {
  width: 100%;
  height: 34px;
  border: 2.5px solid var(--dex-ink);
  border-radius: 4px;
  background: #FFE28A;          /* 用户选定暖黄 */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.dex-fab-photo img {
  height: 27px;
  width: auto;
  transform: rotate(-8deg);
}

.dex-fab-cap {
  margin-top: 3px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--dex-ink);
}

.dex-fab:active {
  transform: rotate(3deg) translate(2px, 2px);
  box-shadow: 1px 1px 0 #66CCFF;
}

/* ==================== ② 主页展示层 ==================== */
.dex-home-layer {
  position: fixed;
  inset: 0;
  z-index: 1;            /* 与 .landing 同层：低于广告牌(2)与播放器(60) */
  pointer-events: none;  /* 纯展示，不挡任何点击 */
  overflow: hidden;
}

/* 空中收集物：从右往左无缝循环飘过（批次八十四：替代原地上下浮动）；
   两端都在屏外（104vw → -140px），循环接缝不可见；img 自身再叠加轻浮动 */
.dex-float {
  position: absolute;
  left: 0;
  animation: dexDrift linear infinite;
}

.dex-float img {
  display: block;
  width: 44px;
  filter: drop-shadow(2px 2px 0 rgba(29, 29, 29, 0.2));
  animation: dexFloatBob 2.8s ease-in-out infinite alternate;
}

/* 无图条目（猫の条）的占位气泡 */
.dex-float .dex-q {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.85);
  border: 3px solid var(--dex-ink);
  border-radius: 14px;
  font-size: 20px;
  font-weight: 900;
  color: #B9B5AA;
  animation: dexFloatBob 2.8s ease-in-out infinite alternate;
}

/* 5 条空中泳道：只定高度与速度相位（错峰横穿，避开标题区）；
   批次八十五：全线提速约 35% 且拉开快慢差（慢速 58s 在手机上一秒只飘 ~9px，
   看起来像原地不动——「有些模式下没从右往左飘」的根因） */
.dex-float.f1 { top: 9%;  animation-duration: 30s; animation-delay: -8s; }
.dex-float.f2 { top: 16%; animation-duration: 38s; animation-delay: -27s; }
.dex-float.f3 { top: 27%; animation-duration: 26s; animation-delay: -15s; }
.dex-float.f4 { top: 7%;  animation-duration: 34s; animation-delay: -30s; }
.dex-float.f5 { top: 24%; animation-duration: 32s; animation-delay: -21s; }

@keyframes dexDrift {
  from { transform: translateX(104vw); }
  to   { transform: translateX(-140px); }
}

@keyframes dexFloatBob {
  from { margin-top: 0; }
  to   { margin-top: -10px; }
}

/* 地板角色（脚底压着加高后的云顶一点，像走在云端；批次五十一：云地 86 → 150；
   批次八十四：PC 放大 84/80 → 120/114，bottom 126 → 104，脚踩云面线（基座顶 112）） */
.dex-char {
  position: absolute;
  bottom: 104px;
}

.dex-char img {
  display: block;
  filter: drop-shadow(2px 3px 0 rgba(29, 29, 29, 0.15));
}

/* 跑步型：从左跑到右循环（负延迟避免页面打开/截图时刻角色在屏外）；
   批次八十五：横穿时长不再按档位写死，由 js 按角色帧率算（96 ÷ fps，见
   dex-data.js「帧率对照表」），r0~r2 只保留错峰负延迟，12s 是无 runFps 的兜底 */
.dex-char.run img { height: 120px; }
.dex-char.run    { animation: dexRunAcross 12s linear infinite; }
.dex-char.run.r0 { animation-delay: -6s; }
.dex-char.run.r1 { animation-delay: -11s; }
.dex-char.run.r2 { animation-delay: -16s; }

@keyframes dexRunAcross {
  from { transform: translateX(-140px); }
  to   { transform: translateX(105vw); }
}

/* 原地型：站位展示（批次八十五：取消上下弹跳——GIF 本身有扭动/舞蹈动作，
   再弹显得抽风；预置 3 个站位，避开左下广告牌与右侧 FAB） */
.dex-char.hop img { height: 114px; }
.dex-char.hop.h0 { left: 26%; }
.dex-char.hop.h1 { left: 50%; }
.dex-char.hop.h2 { left: 72%; }

/* ==================== ③ 配置模式（body.arrange） ==================== */
/* 隐藏主页其它 UI：LOGO/开始按钮/底行/播放器 FAB/图鉴 FAB/功能 FAB/设置面板/广告牌/展示层 */
body.arrange .landing,
body.arrange .music-player,
body.arrange .ad-sign,
body.arrange .dex-fab,
body.arrange .home-fab,
body.arrange .home-settings-panel,
body.arrange .dex-home-layer,
body.arrange .link-status {
  display: none !important;
}

/* 云朵地面抬到托盘上方，当作配置模式的地板（托盘高 116px；批次四十四：砖地/山丘已随方向A移除） */
body.arrange .cloud-ground { bottom: 116px; }

.arrange-root {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;   /* 容器不挡背景，子元素各自恢复点击 */
  font-family: inherit;
}

.arrange-root[hidden] { display: none; }

.arrange-root > * { pointer-events: auto; }

/* 顶部栏：只剩 取消 / 完成 ✓ */
.ar-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}

.ar-btn {
  min-height: 44px;
  padding: 7px 18px;
  background: #fff;
  color: var(--dex-ink);
  border: 3px solid var(--dex-ink);
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--dex-ink);
  font-size: 14px;
  font-weight: 900;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.ar-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--dex-ink);
}

.ar-btn.done { background: var(--dex-yellow); }

.ar-title {
  flex: 1;
  text-align: center;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff;
  text-shadow: 2px 2px 0 rgba(29, 29, 29, 0.45);
  pointer-events: none;
}

/* 槽位分组标签（收集物槽 n/5、角色槽 n/3） */
.ar-label {
  position: absolute;
  z-index: 3;
  padding: 3px 12px;
  background: #fff;
  border: 2px solid var(--dex-ink);
  border-radius: 999px;
  box-shadow: 2px 2px 0 var(--dex-ink);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.ar-label.air { top: 11%; left: 4.4%; }
/* 类名用 ground-label 而非 ground：避免被 body.arrange .ground（砖块地面抬升规则）误伤 */
.ar-label.ground-label { bottom: 268px; left: 4%; }

/* 虚线槽位 */
.ar-slot {
  position: absolute;
  z-index: 3;
  border: 3px dashed rgba(29, 29, 29, 0.55);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ar-slot img {
  max-width: 86%;
  max-height: 86%;
  display: block;
}

.ar-slot .plus {
  font-size: 30px;
  font-weight: 900;
  color: rgba(29, 29, 29, 0.4);
}

/* 已放入的槽位：实线白底 */
.ar-slot.filled {
  border-style: solid;
  border-color: var(--dex-ink);
  background: #fff;
  box-shadow: 3px 3px 0 var(--dex-ink);
}

/* 有选中待放物品时，可接收的槽位高亮成初音青 */
.ar-slot.can-drop {
  border-color: var(--dex-miku);
  background: rgba(217, 244, 242, 0.65);
}

/* 移除按钮（44×44 触控目标） */
.ar-remove {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 44px;
  height: 44px;
  background: #fff;
  border: 3px solid var(--dex-ink);
  border-radius: 50%;
  font-size: 15px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--dex-ink);
}

/* 空中收集物槽：竖屏 3+2 两行错位 */
.ar-slot.air-1 { top: 15%; left: 4.4%;  width: 84px; height: 84px; }
.ar-slot.air-2 { top: 15%; left: 41.6%; width: 84px; height: 84px; }
.ar-slot.air-3 { top: 15%; left: 77.2%; width: 84px; height: 84px; }
.ar-slot.air-4 { top: 29%; left: 20%;   width: 84px; height: 84px; }
.ar-slot.air-5 { top: 29%; left: 56%;   width: 84px; height: 84px; }

/* 地板角色槽：3 个，脚踩地板线 */
.ar-slot.ground-1 { bottom: 146px; left: 4%;    width: 112px; height: 112px; }
.ar-slot.ground-2 { bottom: 146px; left: 36.5%; width: 112px; height: 112px; }
.ar-slot.ground-3 { bottom: 146px; left: 69%;   width: 112px; height: 112px; }

/* 底部待选托盘 */
.ar-tray {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 116px;
  background: #fff;
  border-top: 4px solid var(--dex-ink);
  display: flex;
  flex-direction: column;
}

.ar-tray-hint {
  padding: 5px 12px 2px;
  font-size: 10px;
  font-weight: 900;
  color: #7c7668;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.ar-tray-row {
  flex: 1;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 2px 12px 8px;
  overflow-x: auto;
}

.ar-empty {
  padding: 0 12px;
  font-size: 12px;
  font-weight: 900;
  color: #a09b8f;
  align-self: center;
}

/* 托盘里的待选物品（整个 66px 宽列都是点击目标，≥44） */
.ar-pick {
  flex: none;
  width: 66px;
  min-height: 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  cursor: pointer;
  border: none;
  background: none;
  padding: 6px 0 0;
  font-family: inherit;
}

.ar-pick .ic {
  width: 52px;
  height: 52px;
  background: var(--tbg, #EAF7F5);
  border: 3px solid var(--dex-ink);
  border-radius: 14px;
  box-shadow: 2px 2px 0 var(--dex-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
  color: #B9B5AA;
}

.ar-pick .ic img {
  max-width: 44px;
  max-height: 44px;
  display: block;
}

.ar-pick .nm {
  margin-top: 3px;
  font-size: 9px;
  font-weight: 900;
  color: var(--dex-ink);
  max-width: 66px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 选中态：青框高亮 + 微微放大 */
.ar-pick.selected .ic {
  border-color: var(--dex-miku);
  box-shadow: 3px 3px 0 var(--dex-miku);
  transform: scale(1.08);
}

/* 已放置：变暗 + 角标 */
.ar-pick.placed .ic { opacity: 0.45; }

.ar-pick .placed-tag {
  position: absolute;
  top: 0;
  right: -2px;
  z-index: 2;
  padding: 1px 6px;
  background: var(--dex-miku);
  color: #fff;
  border: 2px solid var(--dex-ink);
  border-radius: 999px;
  font-size: 8px;
  font-weight: 900;
}

/* 类型小标签：收集物 / 跑步 / 原地 */
.ar-pick .mv {
  position: absolute;
  top: 0;
  left: -2px;
  z-index: 2;
  padding: 1px 5px;
  background: var(--dex-yellow);
  border: 2px solid var(--dex-ink);
  border-radius: 999px;
  font-size: 7px;
  font-weight: 900;
  white-space: nowrap;
}

.ar-pick .mv.mv-item { background: #D9F4F2; }

/* 提示 toast（超上限/槽位类型不符等） */
.ar-toast {
  position: absolute;
  left: 50%;
  bottom: 128px;
  transform: translateX(-50%) translateY(8px);
  z-index: 9;
  padding: 8px 16px;
  background: var(--dex-yellow);
  border: 3px solid var(--dex-ink);
  border-radius: 12px;
  box-shadow: 3px 3px 0 var(--dex-ink);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.ar-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==================== 响应式 ==================== */
/* 竖屏（批次八十四）：人物比 PC 略收一档但比原来大（84 → 100），脚更踩云；
   右侧按钮列整体缩小，图鉴框不再逼近「点击开启」；
   圆钮 46px at right:10 → 中线 33；图鉴 44 宽 → right:11 对齐 */
@media (orientation: portrait) {
  .dex-fab {
    width: 44px;
    height: 54px;
    right: 11px;
    bottom: 254px;   /* 竖列竖屏档：播放器 86 → 设置 142 → 排行榜 198 → 图鉴 254（步进 56） */
    padding: 4px 3px 2px;
    border-width: 3px;
    border-radius: 7px;
    box-shadow: 3px 3px 0 #66CCFF;
  }
  .dex-fab-photo { height: 28px; border-width: 2px; }
  .dex-fab-photo img { height: 22px; }
  .dex-fab-cap { font-size: 9px; letter-spacing: 1px; margin-top: 2px; }

  .dex-char.run img { height: 100px; }
  .dex-char.hop img { height: 96px; }
  .dex-char { bottom: 114px; }
}

/* 矮横屏：展示物缩小，配置模式整体压缩（托盘 84px、槽位一行排开）；
   批次六十四：图鉴钮恢复拍立得方卡（42×50）；
   批次八十四：right:14 → 10 与 42px 圆钮竖列（right:10）左缘对齐 */
@media (max-height: 520px) {
  .dex-fab {
    width: 42px;
    height: 50px;
    right: 10px;
    bottom: 216px;   /* 竖列紧凑档：播放器 66 → 设置 116 → 排行榜 166 → 图鉴 216 */
    border-width: 3px;
    border-radius: 7px;
    padding: 4px 3px 2px;
    box-shadow: 3px 3px 0 #66CCFF;
  }
  .dex-fab-photo { height: 27px; border-width: 2px; }
  .dex-fab-photo img { height: 21px; }
  .dex-fab-cap { font-size: 9px; margin-top: 2px; }

  .dex-float img { width: 30px; }
  .dex-float .dex-q { width: 30px; height: 30px; font-size: 14px; border-width: 2px; border-radius: 10px; }
  /* 批次八十四：漂移泳道只留高度（水平由 dexDrift 全程负责） */
  .dex-float.f1 { top: 5%; }
  .dex-float.f2 { top: 8%; }
  .dex-float.f3 { top: 18%; }
  .dex-float.f4 { top: 12%; }
  .dex-float.f5 { top: 16%; }

  .dex-char.run img { height: 56px; }
  .dex-char.hop img { height: 52px; }
  .dex-char { bottom: 62px; }   /* 批次八十四：70 → 62，再往下一点压进云 */

  body.arrange .cloud-ground { bottom: 84px; }

  .ar-top { padding: 6px 10px; }
  .ar-btn { min-height: 40px; padding: 4px 14px; font-size: 12px; border-width: 2px; }
  .ar-title { font-size: 12px; }

  /* 空中 5 槽横屏排一行 */
  .ar-slot.air-1 { top: 25%; left: 5%;    width: 50px; height: 50px; }
  .ar-slot.air-2 { top: 25%; left: 26.3%; width: 50px; height: 50px; }
  .ar-slot.air-3 { top: 25%; left: 47.4%; width: 50px; height: 50px; }
  .ar-slot.air-4 { top: 25%; left: 68.6%; width: 50px; height: 50px; }
  .ar-slot.air-5 { top: 25%; left: 89.7%; width: 50px; height: 50px; }
  .ar-label.air { top: 15%; left: 5%; font-size: 9px; padding: 2px 8px; }

  .ar-slot.ground-1 { bottom: 92px; left: 18%; width: 76px; height: 76px; }
  .ar-slot.ground-2 { bottom: 92px; left: 44%; width: 76px; height: 76px; }
  .ar-slot.ground-3 { bottom: 92px; left: 70%; width: 76px; height: 76px; }
  .ar-label.ground-label { bottom: 176px; left: 18%; font-size: 9px; padding: 2px 8px; }

  .ar-slot .plus { font-size: 20px; }
  .ar-remove { width: 34px; height: 34px; font-size: 11px; top: -10px; right: -10px; border-width: 2px; }

  .ar-tray { height: 84px; }
  .ar-tray-hint { padding: 3px 10px 0; font-size: 9px; }
  .ar-tray-row { padding: 2px 10px 6px; gap: 6px; }
  .ar-pick { width: 54px; min-height: 62px; padding-top: 4px; }
  .ar-pick .ic { width: 40px; height: 40px; border-width: 2px; border-radius: 10px; font-size: 15px; }
  .ar-pick .ic img { max-width: 34px; max-height: 34px; }
  .ar-pick .nm { font-size: 8px; margin-top: 1px; max-width: 54px; }

  .ar-toast { bottom: 94px; font-size: 11px; padding: 6px 12px; }
}
