/* =========================================================
   首页：gpt-image 整图铺满横屏 + 四个入口热区 + 功能面板
   ========================================================= */
#home { position: absolute; inset: 0; z-index: 40; overflow: hidden; background: #1b1e2c; }
body:not(.is-home) #home { display: none; }

/* 整图按 1536x1024（3:2）等比铺满，顶部对齐，保证顶栏和卡片都在屏内 */
.home-art {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: max(100vw, 150vh); height: max(66.667vw, 100vh);
}
.home-img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }

.hm-card {
  position: absolute; top: 30.8%; width: 18.9%; height: 35.8%;
  padding: 0; background: transparent; border-radius: .6em;
  transition: transform .12s ease, box-shadow .12s ease;
}
.hm-card:active { transform: scale(.97); box-shadow: 0 0 0 .15em rgba(255, 208, 138, .85), 0 0 1.4em rgba(255, 138, 61, .55); }

.hm-name {
  position: absolute; left: 9.6%; top: 3.6%; width: 13%; height: 4.2%;
  display: flex; align-items: center; padding-left: .3em;
  font-size: 1.15em; font-weight: 700; color: #FFF3DF; white-space: nowrap; overflow: hidden;
  background: linear-gradient(90deg, rgba(34, 38, 56, .98) 72%, rgba(34, 38, 56, 0));
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
}
.hm-gold {
  position: absolute; left: 52.6%; top: 2.9%; width: 7.4%; height: 3.6%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15em; font-weight: 700; color: #FFF3DF;
  background: rgba(30, 33, 48, .98); border-radius: .3em;
}
.hm-avatar {
  position: absolute; left: 2.5%; top: 3.1%; width: 6%; height: 9%;
  border-radius: 50%; overflow: hidden; display: none;
  box-shadow: 0 0 0 .12em rgba(255, 208, 138, .8);
}
.hm-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- 面板 ---------- */
.hm-mask {
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  padding: 3vh 3vw; background: rgba(6, 5, 12, .62);
}
.hm-sheet {
  width: min(92vw, 760px); max-height: 92vh;
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: 16px; border: 1px solid rgba(255, 196, 130, .32);
  background: linear-gradient(180deg, #2a1f36, #140d1c);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .5);
}
.hm-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px 10px; border-bottom: 1px solid rgba(255, 196, 130, .16); }
.hm-head b { font-size: 18px; color: #FFD08A; letter-spacing: .08em; }
.hm-head span { flex: 1; font-size: 12px; color: rgba(255, 226, 196, .62); }
.hm-x {
  width: 36px; height: 36px; border-radius: 10px; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .08); color: #FFF3DF;
}
.hm-tabs { display: flex; gap: 8px; padding: 8px 14px 0; }
.hm-tabs:empty { display: none; }
.hm-tab { min-height: 32px; padding: 0 14px; border-radius: 999px; font-size: 13px; background: rgba(255, 255, 255, .07); color: rgba(255, 226, 196, .75); }
.hm-tab.on { background: #FF8A3D; color: #2a1200; font-weight: 700; }
.hm-body { flex: 1; overflow-y: auto; padding: 10px 14px 14px; touch-action: pan-y; -webkit-overflow-scrolling: touch; }

.hm-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; font-size: 13px; color: rgba(255, 226, 196, .75); }
.hm-bar b { color: #FFD08A; }
.hm-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.hm-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: 12px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 196, 130, .12);
}
.hm-ico {
  flex: none; width: 42px; height: 42px; border-radius: 10px; border: 1.5px solid;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: rgba(0, 0, 0, .3); font-size: 24px;
}
.hm-ico img { width: 100%; height: 100%; object-fit: contain; }
.hm-ico.big { width: 72px; height: 72px; font-size: 44px; border-radius: 16px; }
.hm-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hm-meta b { font-size: 14px; color: #FFF3DF; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-meta span { font-size: 11px; }
.hm-meta em { font-style: normal; font-size: 11px; color: rgba(255, 226, 196, .55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hm-btn {
  flex: none; min-height: 36px; padding: 0 14px; border-radius: 10px;
  font-size: 13px; font-weight: 700; color: #2a1200;
  background: linear-gradient(180deg, #FFA45E, #FF8A3D); box-shadow: 0 2px 0 #C9601F;
}
.hm-btn:active { transform: translateY(1px); box-shadow: none; }
.hm-btn.ghost { background: rgba(255, 255, 255, .1); color: #FFF3DF; box-shadow: none; }
.hm-btn:disabled { opacity: .45; }
.hm-btn.big { min-height: 46px; padding: 0 26px; font-size: 16px; }
.hm-more { display: block; margin: 10px auto 0; }
.hm-sold { flex: none; font-size: 12px; font-weight: 700; color: #6BE3B0; }
.hm-sellbox { flex: none; display: flex; align-items: center; gap: 6px; }
.hm-price {
  width: 84px; height: 34px; padding: 0 8px; border-radius: 8px; font-size: 13px;
  border: 1px solid rgba(255, 196, 130, .3); background: rgba(0, 0, 0, .35); color: #FFF3DF;
  user-select: text; -webkit-user-select: text; touch-action: manipulation;
}
.hm-empty { padding: 28px 10px; text-align: center; font-size: 13px; line-height: 1.7; color: rgba(255, 226, 196, .6); }

/* 选择地图 */
.hm-maps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.hm-map {
  display: flex; flex-direction: column; gap: 6px; padding: 14px 12px 12px; border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 138, 61, .14), rgba(255, 255, 255, .03));
  border: 1px solid rgba(255, 196, 130, .22);
}
.hm-map b { font-size: 17px; color: #FFE7B8; }
.hm-map p { margin: 0; flex: 1; font-size: 12px; line-height: 1.6; color: rgba(255, 226, 196, .72); }
.hm-map-tag { align-self: flex-start; padding: 2px 8px; border-radius: 999px; font-size: 11px; background: rgba(255, 138, 61, .25); color: #FFB27A; }
.hm-map-info { font-size: 11px; color: rgba(255, 226, 196, .55); }

/* 秘籍宝库 */
.hm-gacha { display: flex; gap: 16px; align-items: stretch; }
.hm-g-show {
  flex: 1; min-height: 180px; padding: 14px; border-radius: 14px; text-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: radial-gradient(circle at 50% 40%, rgba(183, 124, 255, .35), rgba(20, 12, 30, .6) 70%);
  border: 1px solid rgba(183, 124, 255, .4); color: #E6D6FF;
}
.hm-g-show > .mp-icon { font-size: 56px; }
.hm-g-show b { font-size: 17px; }
.hm-g-show span { font-size: 12px; color: rgba(230, 214, 255, .8); }
.hm-g-show em { font-style: normal; font-size: 11px; color: #6BE3B0; }
.hm-g-show.pop { animation: hmPop .5s ease-out; }
@keyframes hmPop { 0% { transform: scale(.7); opacity: 0; } 60% { transform: scale(1.05); opacity: 1; } 100% { transform: scale(1); } }
.hm-g-side { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.hm-g-odds, .hm-g-cost { font-size: 13px; line-height: 1.6; color: rgba(255, 226, 196, .75); }
.hm-g-cost b { color: #FFD08A; }
.hm-g-tip { font-size: 11px; line-height: 1.6; color: rgba(255, 226, 196, .5); }

.hm-toast {
  position: absolute; left: 50%; top: 14%; transform: translateX(-50%); z-index: 9;
  padding: 8px 16px; border-radius: 999px; white-space: nowrap; pointer-events: none;
  font-size: 13px; color: #FFF3DF; background: rgba(12, 8, 18, .88);
  opacity: 0; transition: opacity .2s;
}
.hm-toast.show { opacity: 1; }

/* ---------- 竖屏：卡片从整图里裁出来排成 2x2，四个入口全在屏内 ---------- */
@media (orientation: portrait) {
  .home-art {
    left: 0; top: 0; transform: none; width: 100%; height: 100%;
    display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-content: center;
    padding: calc(64px + env(safe-area-inset-top, 0px)) 14px calc(24px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto; -webkit-overflow-scrolling: touch; font-size: 16px;
  }
  .home-img { position: fixed; object-fit: cover; object-position: 50% 18%; filter: blur(2px) brightness(.55); transform: scale(1.04); }
  .hm-card {
    position: relative; left: auto !important; top: auto; width: 100%; height: auto;
    aspect-ratio: 290 / 366; border-radius: 10px;
    background-image: url(images/gen/gptimg_1795555401_look.png);
    background-size: 529.1% 279.3%; background-repeat: no-repeat; background-position-y: 47.98%;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
  }
  .hm-card[data-go="realm"] { background-position-x: 17.63%; }
  .hm-card[data-go="shop"] { background-position-x: 43.53%; }
  .hm-card[data-go="market"] { background-position-x: 69.30%; }
  .hm-card[data-go="gacha"] { background-position-x: 94.82%; }
  .hm-avatar { left: 12px; top: calc(10px + env(safe-area-inset-top, 0px)); width: 40px; height: 40px; position: fixed; }
  .hm-name {
    position: fixed; left: 60px; top: calc(10px + env(safe-area-inset-top, 0px)); width: auto; height: 40px;
    padding: 0 .4em; font-size: 17px; background: none;
  }
  .hm-gold {
    position: fixed; left: auto; right: 12px; top: calc(10px + env(safe-area-inset-top, 0px));
    width: auto; min-width: 90px; height: 36px; padding: 0 14px; font-size: 17px; border-radius: 18px;
    background: rgba(30, 33, 48, .92); border: 1px solid rgba(255, 196, 130, .45);
  }
  .hm-maps { grid-template-columns: 1fr; }
  .hm-gacha { flex-direction: column; }
  .hm-sheet { width: 94vw; max-height: 90vh; }
  .hm-list { grid-template-columns: 1fr; }
  .hm-item { flex-wrap: wrap; }
}

@media (max-height: 420px) {
  .hm-sheet { max-height: 96vh; }
  .hm-head { padding: 8px 12px; }
  .hm-body { padding: 8px 12px 10px; }
  .hm-g-show { min-height: 140px; }
}


/* ---------- 清晰文字：盖住底图里发糊的小字条 ---------- */
.hm-cap {
  position: absolute; left: 2.6%; right: 2.6%; top: 84.6%; height: 13.6%;
  display: flex; align-items: center; justify-content: center; gap: .35em;
  border-radius: .35em; border: 1px solid rgba(255, 208, 138, .55);
  background: linear-gradient(180deg, #343c5c, #262c46);
  color: #FFF3DF; font-size: .95em; line-height: 1; white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .75); pointer-events: none;
  -webkit-font-smoothing: antialiased;
}
.hm-cap b { font-weight: 700; letter-spacing: .03em; }
.hm-cap i { font-style: normal; font-weight: 900; font-size: 1.2em; color: #FFD08A; }
.hm-card[data-go="gacha"] .hm-cap { background: linear-gradient(180deg, #353171, #272455); }
.hm-name, .hm-gold { text-shadow: 0 1px 2px rgba(0, 0, 0, .7); }

@media (orientation: portrait) {
  .hm-cap { font-size: 12.5px; gap: 3px; }
  .hm-cap b { letter-spacing: 0; }
  .home-img { filter: blur(5px) brightness(.45); }
  #home::before {
    content: ""; position: absolute; left: 0; right: 0; top: 0; z-index: 1; pointer-events: none;
    height: calc(60px + env(safe-area-inset-top, 0px));
    background: linear-gradient(180deg, rgba(14, 14, 24, .96) 0%, rgba(14, 14, 24, .92) 70%, rgba(14, 14, 24, 0) 100%);
  }
  .hm-avatar, .hm-name, .hm-gold { z-index: 2; }
  .hm-gold { background: rgba(30, 33, 48, .98); color: #FFE7B8; font-weight: 800; }
}

/* 首页玩家资料：只新增展示，不影响原有入口和玩法。 */
.hm-avatar { display: block; border: 2px solid #FF8A3D; background: #222638; }
.hm-avatar img { object-position: center top; }
.hm-realm {
  position: absolute; left: 9.6%; top: 8%; max-width: 20%;
  padding: .2em .65em; border: 1px solid rgba(255, 196, 130, .65);
  border-radius: 999px; background: #262c46; color: #FFD08A;
  font-size: .85em; line-height: 1.4; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; pointer-events: none;
}
@media (orientation: portrait) {
  .hm-name { height: 23px; font-size: 15px; }
  .hm-realm {
    position: fixed; left: 66px; top: calc(35px + env(safe-area-inset-top, 0px));
    max-width: calc(100vw - 190px); z-index: 2;
    padding: 1px 7px; font-size: 11px; line-height: 17px;
  }
}

/* 默认头像直接取本轮参考图的左上头像区域，保留原图像素；真实头像优先。 */
#home .hm-avatar-display {
  display: block !important;
  background-image: url('images/gen/gptimg_1795595338_look.png');
  background-repeat: no-repeat; background-size: 1666.667% 1111.111%;
  background-position: 2.66% 3.41%;
  box-shadow: 0 0 0 1px #FFD08A, 0 2px 5px rgba(0,0,0,.45);
  pointer-events: none;
}
.hm-avatar-display:not(.has-player-avatar) img { visibility: hidden; }
.hm-avatar-display.has-player-avatar { background-image: none !important; }

/* 背包铺：六种背包各有图标与品阶色 */
.hm-ico.bag-ico { font-size: 26px; background: radial-gradient(circle at 50% 35%, rgba(255,255,255,.14), rgba(0,0,0,.35)); }
.bag-ico.bag-travel { color: #E8D9C0; border-color: #A8977E; }
.bag-ico.bag-small { color: #9FE0A8; border-color: #57A866; }
.bag-ico.bag-pack { color: #8EC5FF; border-color: #4B86D6; }
.bag-ico.bag-ring { color: #D7A8FF; border-color: #9B5BE0; }
.bag-ico.bag-pouch { color: #FFC37A; border-color: #E08A2E; }
.bag-ico.bag-cave { color: #FF9A8A; border-color: #E04A3A; box-shadow: 0 0 10px rgba(255,90,70,.45); }

/* 本局职业：独立弹层，不改变首页热区。 */
#ClassSelectPanel{box-sizing:border-box;position:fixed;inset:0;margin:auto;width:min(92vw,29rem);max-height:90vh;max-height:90dvh;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;padding:1.1rem;color:#fff1d8;background:linear-gradient(150deg,#352736,#191823);border:.08rem solid #a67c54;border-radius:1rem}
#ClassSelectPanel::backdrop{background:rgba(11,8,16,.76)}
#ClassSelectPanel form{display:grid;gap:.5rem}#classTitle{margin:0 0 .35rem;color:#ffce8c;font-size:1.35rem}
#ClassSelectPanel .ClassCard{display:flex;align-items:center;gap:.7rem;padding:.65rem .85rem;background:#39303c;border:.09rem solid #665447;border-radius:.65rem;line-height:1.4;cursor:pointer}#ClassSelectPanel input{accent-color:#ff8a3d}#ClassSelectPanel .ClassCard:has(:checked){border-color:#ff8a3d;background:#51382e}#ClassSelectPanel input:checked+span{color:#ffbe81}#ClassSelectPanel small{display:block;color:#e2d4c5;font-size:.84rem}#ClassSelectPanel strong{font-size:1.05rem}#ClassSelectPanel .classActions{display:flex;gap:.65rem;margin-top:.4rem}#ClassSelectPanel .classActions button{min-height:2.8rem}#ClassConfirmBtn{flex:1}

#ClassSelectPanel .class-emblem{display:none;width:1.15em;height:1.15em;margin-inline-start:.35em;vertical-align:text-bottom;color:#ffce8c}
#ClassSelectPanel input:checked + span .class-emblem{display:inline-block}
#hmRealm[data-class-name]{overflow:visible}
#hmRealm[data-class-name]::after{content:'';position:absolute;left:calc(100% + .32rem);top:50%;transform:translateY(-50%);width:1.45rem;height:1.45rem;box-sizing:border-box;border:.08rem solid #b98b53;border-radius:50%;background:#28202b var(--class-glyph) center/72% no-repeat;pointer-events:none}
/* [STATE] 已选职业图标显示在选择项与首页境界旁。 */

/* 普通秘境试玩入口独立于原有选图按钮。 */
#homeArt .realm-quick-start {
  position: absolute; top: 70%; left: 24%; transform: translateX(-50%);
  z-index: 2; min-height: 44px; padding: 8px 22px;
  border: 1px solid #ffd08a; border-radius: 12px;
  background: linear-gradient(#ffe0a8, #ea9c50); color: #2e1a10;
  font: 700 15px/1.25 system-ui, sans-serif; cursor: pointer;
  touch-action: manipulation;
}
#homeArt .realm-quick-start:focus-visible { outline: 2px solid white; outline-offset: 3px; }
#homeArt .realm-play-status, #stage .realm-play-hint {
  position: absolute; left: 50%; top: 36%; transform: translateX(-50%);
  z-index: 3; max-width: calc(100% - 24px); width: max-content;
  margin: 0; padding: 8px 12px; border-radius: 10px;
  background: #181523ee; color: #ffe9c1;
  font: 600 13px/1.4 system-ui, sans-serif; text-align: center;
  pointer-events: none;
}
#homeArt .realm-play-status { top: 80%; left: 24%; }
body.is-home #stage .realm-play-hint { display: none; }
@media (orientation: portrait) {
  #homeArt .realm-quick-start { position: relative; top: auto; left: auto; transform: none; grid-column: 1 / -1; order: -1; }
  #homeArt .realm-play-status { top: 50%; left: 50%; }
}
