/* ===========================================================
   群赛名人堂 — 移动端样式
   尺寸基准：--w = 屏幕宽度，所有几何均由 JS 写入
   =========================================================== */

/* 本地字体：Zpix（最像素，像素风格） */
@font-face{
  font-family: "Zpix";
  src: url("../../font/zpix.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
/* Zpix 只有常规字重；700 由浏览器合成粗体，仍指向同一字体文件 */
@font-face{
  font-family: "Zpix";
  src: url("../../font/zpix.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root{
  --w: 390px;              /* 屏宽，JS 覆盖 */
  --card-w: 312px;         /* 卡片长 = 0.8 * 屏宽 */
  --card-h: 78px;          /* 卡片高 = 长 / 4   */
  --cell: 32px;            /* 详情页方格边长 = 屏宽 / 12 */
  --ink: #ffffff;
  --ctrl-bg: rgba(16, 30, 54, .72);
  --ctrl-on: #ffd400;
  --ctrl-on-ink: #2f343d;
  --sky: #3fc3f7;
  --deep: #2b2f36;
  --grid-line: #1d2127;
}

*{ box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body{
  margin: 0; padding: 0;
  width: 100%; height: 100%;
  overflow: hidden;
  background: #eef1f5;
  color: #1b2430;
  font-family: "Zpix", "UD Kaku", "MiSans", "HarmonyOS Sans SC", "Source Han Sans SC",
               "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

button{ font-family: inherit; }

.hidden{ display: none !important; }

/* ---------------- 页面容器 ---------------- */
.page{
  position: fixed; inset: 0;
  overflow: hidden;
}
#page-detail{
  background: var(--deep);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  z-index: 40;
  transform: translate3d(100%, 0, 0);
  visibility: hidden;
  transition: transform .26s cubic-bezier(.32,.72,.3,1), visibility .26s;
}
#page-detail.open{
  transform: translate3d(0, 0, 0);
  visibility: visible;
}

/* ===========================================================
   第一层：首页
   =========================================================== */
.home-bg{
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.home-scroll{
  position: absolute; inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  z-index: 1;
}

.home-top{
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 0 10px 12px;
  display: flex;
  justify-content: flex-end;
}

/* ---------------- 通用控件外观 ---------------- */
.ctrl{
  border: none;
  background: var(--ctrl-bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.2;
  padding: 8px 14px;
  cursor: pointer;
  transition: background .08s linear, color .08s linear;
  text-align: left;
}
.ctrl.pressed,
.ctrl:active{
  background: var(--ctrl-on);
  color: var(--ctrl-on-ink);
}

/* 半胶囊：左侧半圆 + 右侧矩形；左标题 / 右冠军名 */
.capsule{
  border-radius: 999px 10px 10px 999px;
  padding: 10px 16px 10px 30px;
  font-size: 19px;
  letter-spacing: .5px;
  width: calc(var(--w) - 24px);
  max-width: calc(var(--w) - 24px);
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}
.cap-left{
  flex: 1 1 auto;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cap-right{
  flex: 0 0 auto;
  text-align: right;
  font-weight: 700;
  white-space: nowrap;
  max-width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------- 六个精灵卡片 ---------------- */
.poke-list{
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 6px 0 10px 6px;
}

.poke-card{
  position: relative;
  width: var(--card-w);
  height: var(--card-h);
  border: none;
  border-radius: 8px;
  background: var(--ctrl-bg);
  color: var(--ink);
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  transition: background .08s linear, color .08s linear;
}
.poke-card.pressed,
.poke-card:active{
  background: var(--ctrl-on);
  color: var(--ctrl-on-ink);
}
.poke-card:active .card-tri,
.poke-card.pressed .card-tri{
  /* 按下时三角形随之下沉一档，保证黄底上仍可见 */
  background: #1e9fd0;
}

/* 昵称：左上 */
.card-nick{
  position: absolute;
  left: 9px; top: 7px;
  font-size: 15px;
  font-weight: 600;
  max-width: 46%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 3;
  text-shadow: 0 1px 2px rgba(0,0,0,.35);
}

/* 性别：右上，圆底 ♂蓝 ♀红 */
.card-gender{
  position: absolute;
  right: 8px; top: 6px;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  z-index: 3;
}
.card-gender.m{ background: #4d9bff; }
.card-gender.f{ background: #ff4d4d; }
.card-gender.n{ background: #98a0ab; font-size: 11px; }

/* 属性图标：普通属性为 canvas 染色的标准色图，太晶为原色图 */
.card-types{
  position: absolute;
  left: 7px; bottom: 7px;
  display: flex;
  gap: 4px;
  z-index: 3;
}
.type-chip{
  display: inline-block;
  flex: 0 0 auto;
  object-fit: contain;
}
.card-types .type-chip{ width: 20px; height: 20px; }

/* 右下天蓝等腰直角三角形（位于道具图标下一层） */
.card-tri{
  position: absolute;
  right: 0; bottom: 0;
  width: calc(var(--card-h) * .46);
  height: calc(var(--card-h) * .46);
  background: var(--sky);
  clip-path: polygon(100% 100%, 100% 0, 0 100%);
  z-index: 1;
}

/* 道具图标：右下（压在三角形之上） */
.card-item{
  position: absolute;
  right: 7px; bottom: 6px;
  width: 24px; height: 24px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-item img{
  width: 24px; height: 24px;
  display: block;
  image-rendering: -webkit-optimize-contrast;
}

/* 精灵图：左侧贴控件中轴线，放大到 1.5 倍，超出部分由卡片裁掉 */
.card-sprite{
  position: absolute;
  left: 50%;
  top: -25%;
  height: 150%;
  width: auto;
  max-width: none;
  z-index: 2;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
  pointer-events: none;
}

/* ---------------- 首页信息区 ---------------- */
.info-area{
  padding: 6px 14px 0 14px;
}
.info-title{
  margin: 8px 0 10px 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 1px;
  /* 比赛名白描边（四邻 + 斜向） */
  text-shadow:
    -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff,
    0 -1px 0 #fff, 0 1px 0 #fff, -1px 0 0 #fff, 1px 0 0 #fff;
}
/* 举办人 / 举办时间：没有数据就整块不渲染 */
.info-meta{
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: -2px 0 12px 0;
}
.meta-item{
  background: rgba(16,30,54,.6);
  color: #fff;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 8px;
}
.info-block{
  margin-bottom: 16px;
}
.info-label{
  display: inline-block;
  background: var(--ctrl-bg);
  color: var(--ink);
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 8px;
  margin-bottom: 7px;
}
.info-body{
  background: rgba(255,255,255,.62);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.7;
  color: #223;
}
.info-body .empty{
  color: #8a929c;
}
.cmt{
  padding: 7px 0;
  border-bottom: 1px dashed rgba(0,0,0,.12);
}
.cmt:last-child{ border-bottom: none; }
.cmt-who{
  font-weight: 700;
  color: #1b2430;
  margin-right: 6px;
}
.cmt-txt{ color: #333b45; }
.foot-space{ height: 30px; }

/* 贺图：竖屏在信息下方显示；横屏/宽屏移到信息栏右侧列 */
.info-hero{
  margin-top: 4px;
}
.info-hero img{
  display: block;
  width: 100%;
  border-radius: 8px;
}

/* ---------------- 届数菜单 ---------------- */
.mask{
  position: fixed; inset: 0;
  background: rgba(10,16,26,.42);
  z-index: 60;
}
.edition-menu{
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 62px);
  right: 12px;
  width: 244px;
  max-height: 68%;
  overflow-y: auto;
  background: rgba(16,30,54,.94);
  border-radius: 10px;
  padding: 6px;
  z-index: 61;
  box-shadow: 0 8px 26px rgba(0,0,0,.32);
}
.ed-item{
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 7px;
  text-align: left;
  cursor: pointer;
}
.ed-item.on,
.ed-item:active{
  background: var(--ctrl-on);
  color: var(--ctrl-on-ink);
}
/* 圈数字占一个字宽，第二行（人名）缩进同样的量，与圈后第一个字对齐 */
.ed-cir{
  display: inline-block;
  width: 1.15em;
  flex: 0 0 auto;
}
.ed-line1{
  display: flex;
  align-items: baseline;
  font-size: 14px;
  line-height: 1.35;
}
.ed-line2{
  display: block;
  padding-left: 1.15em;
  font-size: 12px;
  opacity: .78;
  margin-top: 1px;
}
.ed-more{
  font-style: normal;
  font-size: 11px;
  opacity: .8;
}
.ed-head{
  padding: 7px 12px 8px 12px;
  margin-bottom: 4px;
  font-size: 13px;
  color: #96a8c2;
  border-bottom: 1px solid rgba(255,255,255,.14);
}
.ed-back{
  margin-top: 5px;
  border-top: 1px solid rgba(255,255,255,.14);
  color: #bcd0e8;
  font-size: 13px;
}

/* ===========================================================
   第二层：精灵详情
   =========================================================== */
.grid-bg{
  position: fixed;
  inset: -2px;
  z-index: 0;
  pointer-events: none;
  background-color: var(--deep);
  /* 网格线由 JS 生成的 SVG 平铺注入（background-image/background-size），
     图片平铺无缝，避免 repeating-linear-gradient 滚动时的接缝重叠 */
  animation: gridScroll 4s linear infinite;
}
@keyframes gridScroll{
  from{ background-position: 0 0; }
  to  { background-position:
          calc(var(--cell) * -1) calc(var(--cell) * -1); }
}

.detail-geo{
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  z-index: 1;
  pointer-events: none;
}

/* 右上角名字牌 */
.name-plate{
  position: absolute;
  background: #ffffff;
  border-radius: 12px;
  padding: 7px 13px;
  z-index: 12;
  box-shadow: 0 3px 12px rgba(0,0,0,.3);
  max-width: 46vw;
}
.np-line1{
  font-size: 17px;
  font-weight: 700;
  color: #1b2430;
  line-height: 1.25;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.np-line2{
  font-size: 13px;
  color: #3d434c;
  line-height: 1.35;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.np-species{
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 详情页性别：去掉圆底，仅色字 ♂ 蓝 / ♀ 红 */
.gender-dot{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.1em;
  flex: 0 0 auto;
  background: none;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}
.gender-dot.m{ color: #4d9bff; }
.gender-dot.f{ color: #ff4d4d; }
.gender-dot.n{ color: #9aa2ad; }

/* 静态标签：写在直角梯形外的左侧（深灰底上用浅色字） */
.stat-keys{
  position: absolute;
  z-index: 6;
  pointer-events: none;
  text-align: right;
}
.stat-key{
  font-size: 20px;
  font-weight: 700;
  color: #dfe5ec;
  letter-spacing: 1px;
  text-shadow: 0 1px 3px rgba(0,0,0,.55);
}
/* 可变化的值：梯形内部，左对齐 */
.stat-trap{
  position: absolute;
  z-index: 6;
  pointer-events: none;
}
.stat-row{
  display: flex;
  align-items: center;
  padding-right: 6px;
}
.stat-val{
  font-size: 20px;        /* 与 stat-key(特性等标签) 同字号，不加粗，权重为普通 */
  color: #1b2430;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-val .type-chip{
  width: 22px; height: 22px;
  vertical-align: -4px;
  margin-right: 3px;
}
.stat-val .type-chip.tera{
  width: 25px; height: 25px;
  vertical-align: -6px;
}

/* 精灵大图：在招式条之上、名字牌之下，避免被遮挡 */
.detail-sprite{
  position: absolute;
  z-index: 9;
  width: calc(var(--w) * .28);
  height: calc(var(--w) * .28);
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
  pointer-events: none;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,.35));
}
.detail-video{
  position: absolute;
  visibility: hidden;
  pointer-events: none;
}
/* 去绿幕后的输出画面（Canvas），放大到精灵图 1.5 倍 */
.video-out{
  position: absolute;
  z-index: 10;
  object-fit: contain;
  pointer-events: auto;
  cursor: pointer;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,.35));
  display: none;
}

/* 招式六边形：整体缩到原来的一半；两层同形 clip-path 做出细描边 */
.move-list{
  position: absolute;
  left: 36px;
  width: calc((var(--w) - 20px) / 2);
  z-index: 7;
}
.move-item{
  position: relative;
  height: calc((var(--w) - 20px) / 8);
  padding: 2px;
  background: var(--sky);
  clip-path: polygon(12% 0, 88% 0, 95% 50%, 88% 100%, 12% 100%, 5% 50%);
}
.move-inner{
  height: 100%;
  background: #101418;
  clip-path: polygon(12% 0, 88% 0, 95% 50%, 88% 100%, 12% 100%, 5% 50%);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 15%;
}
.move-icon{
  width: 20px; height: 20px;
  flex: 0 0 auto;
  object-fit: contain;
}
.move-name{
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0,0,0,.6);
}

/* 六维图：JS 按精灵图正下方定位（radar-wrap.left/width/top） */
.radar-wrap{
  position: absolute;
  left: 0;
  top: 0;
  width: auto;
  height: auto;
  z-index: 8;
}
.radar{
  display: block;
  width: 100%;
  height: auto;
}
.radar .axis{ stroke: rgba(255,255,255,.28); stroke-width: 1.2; }
.radar .web{ fill: rgba(255,255,255,.06); stroke: rgba(255,255,255,.22); stroke-width: 1.1; }
.radar .poly{
  fill: rgba(63,195,247,.28);
  stroke: var(--sky);
  stroke-width: 2.4;
  stroke-linejoin: round;
}
.radar .dot{ fill: var(--sky); }
.radar .lb{ font-size: 13px; font-weight: 700; fill: #fff; text-shadow: 2px 3px 3px rgba(0,0,0,.75); }
.radar .lb.up{ fill: #ff4d4d; }
.radar .lb.dn{ fill: #4d9bff; }
.radar .num{ font-size: 11px; fill: rgba(255,255,255,.85); text-shadow: 2px 3px 3px rgba(0,0,0,.75); }

/* 返回按钮 */
.back-btn{
  position: absolute;
  left: 10px;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  z-index: 20;
  border-radius: 999px 8px 8px 999px;
  padding: 8px 16px 8px 22px;
  font-size: 14px;
}

/* 启动遮罩 */
.boot{
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: #eef1f5;
  color: #6b7480;
  font-size: 14px;
  z-index: 90;
}
.boot.err{
  background: #fff4f4;
  color: #a33;
  padding: 24px;
  text-align: center;
  line-height: 1.8;
  white-space: pre-wrap;
}

/* ===========================================================
   桌面端宽屏适配（≥760px）
   首页：顶部胶囊横跨，左列六个缩小精灵卡片，右侧信息区
   =========================================================== */
@media (min-width: 760px) {
  .home-scroll{
    display: grid;
    grid-template-columns: minmax(0, 46%) minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 44px;
    row-gap: 8px;
    align-items: start;
    padding: 96px 5vw 48px;
  }
  .home-top{
    grid-column: 1 / -1;
    position: static;
    padding: 0 0 18px 0;
    /* 抵消 .home-scroll 的 5vw 左右内边距，胶囊贴回屏幕右缘 */
    margin: 0 -5vw;
    justify-content: flex-end;
    background: none;
  }
  .capsule{
    width: 540px;
    max-width: 78vw;
    font-size: 20px;
  }
  /* 六个精灵卡片缩小到固定尺寸，竖排左侧 */
  .poke-list{
    align-items: flex-start;
    gap: 9px;
    padding: 0;
  }
  .poke-card{
    width: 400px;
    height: 100px;
  }
  .poke-card .card-tri{
    width: 46px;
    height: 46px;
  }
  /* 信息区移到右侧列 */
  .info-area{
    padding: 2px 8px 0 0;
  }
  .info-title{ font-size: 26px; }
  .info-body{ font-size: 15px; line-height: 1.8; }
  .foot-space{ height: 20px; }

  /* 详情页：宽屏下招式框缩小到原来的 2/5（保持 4:1 比例，字号不变），
     左边界对齐到上方特性/道具等文本列（stat-trap 起点 = xLeft + 10） */
  .move-list{
    left: calc(var(--w) / 4 + 10px);
    width: calc((var(--w) - 20px) / 2 * 0.4);
  }
  .move-item{
    height: calc((var(--w) - 20px) / 8 * 0.4);
  }
}

/* ===========================================================
   触屏横屏（宽>高且屏高较小，区别于桌面宽屏）
   首页右上角胶囊：贴右缘并上移
   =========================================================== */
@media (orientation: landscape) and (max-height: 700px) {
  .home-top{
    padding: 6px 0 10px 12px;
  }
  .capsule{
    max-width: 60vw;
  }
  /* 横屏：贺图放在信息栏右侧 */
  .info-area{
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 16px;
  }
  .info-title{
    grid-column: 1 / -1;
  }
  .info-meta{
    grid-column: 1 / -1;
  }
  .info-hero{
    grid-column: 2;
    grid-row: 3 / span 5;
    margin-top: 0;
    align-self: start;
  }
  .info-hero img{
    max-height: 60vh;
    width: auto;
  }
}
