/*
 * polish.css — UI 调整层（2026-11-06）。
 * 只做视觉/布局覆盖，最后加载；删掉 index.html 里的 <link> 即可完全回退。
 * 原文件备份：research/backup-20261106-webui-ui/
 */

/* ---------- 1. 卡图：原版物品图一律存成 850×850 方图——小型(1:2)横向压扁、大型(3:2)横向挤窄，
   游戏里再拉伸回卡框比例。所以这里按卡框拉伸（fill），既不裁切也不留空。技能图是正圆，保持 contain。 ---------- */
.native-ui .card-art{object-fit:fill!important;object-position:center}
.native-ui .is-skill .card-art{object-fit:contain!important}
.native-ui .card-art-inset{background:#1b2420}

/* ---------- 2. 桌面端：对局界面一屏放下，不再出现整页滚动 ---------- */
@media (min-width:1001px) and (min-height:640px){
  .native-ui:has([data-view=run]){overflow:hidden}
  .native-ui .run-shell{
    height:calc(100dvh - 54px);min-height:0;
    display:flex;flex-direction:column;
    padding:10px 24px 10px;
    --native-hand-h:clamp(110px,19dvh,225px);
    --native-stash-h:clamp(44px,7.5dvh,86px);
  }
  .native-ui .run-topline{flex:none;margin-bottom:4px}
  .native-ui .run-content{flex:1;min-height:0;display:flex;flex-direction:column}
  .native-ui .play-column{
    flex:1;min-height:0;
    grid-template-rows:minmax(0,1fr) auto auto;
    gap:6px 18px;
  }
  /* 商店/事件区占用剩余高度，内部按容器高度缩放 */
  .native-ui .market-panel{
    container-type:size;container-name:market;
    align-self:stretch;height:100%;
    padding:6px 20px 6px;
    display:flex;flex-direction:column;
    overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;
  }
  .native-ui .hero-panel{max-height:100%;align-self:center}
  .native-ui .market-heading{flex:none;margin-bottom:4px;min-height:32px}
  .native-ui .market-panel .offer-grid,
  .native-ui .market-panel .encounter-grid{margin-block:auto}
  /* app.js 按宽度把 --market-unit 限制在 90px；这里按容器高宽重新取值，空间够时卡牌更大 */
  .native-ui .market-panel .item-offer{
    --market-unit:clamp(42px,min(calc((100cqh - 150px) * .5),calc((100cqw - 105px) / 8.5)),128px);
  }
  .native-ui .item-offer .offer-art,
  .native-ui .item-offer .card-component{height:clamp(96px,calc(100cqh - 150px),270px)!important}
  .native-ui .encounter-grid{
    max-width:clamp(440px,calc((100cqh - 150px) * 1.157 * 3 + 60px),1040px)!important;
    width:100%;
  }
  .native-ui .encounter-info button{white-space:nowrap}
  /* 棋盘区域：压缩上下留白 */
  .native-ui .inventory-panel{padding-bottom:0}
  .native-ui .board-wrap{padding-top:14px}
  .native-ui .board{padding-bottom:36px;background-size:100% calc(100% - 27px)}
  /* 储物箱：更紧凑 */
  .native-ui .storage-panel{padding:6px 14px 4px}
  .native-ui .skills-panel{padding:6px 10px}
  .native-ui .stash-drop{padding:8px 2px 20px;background-size:100% calc(100% - 18px);background-position:center 7px}
  .native-ui .skill-list{padding-top:6px}
  .native-ui .native-chest-toggle{bottom:10px}
  .native-ui .native-chest-toggle img{height:70px}
  .native-ui .native-journal-toggle{bottom:12px}
}
/* 收起背包时把那一行真正让出来，给商店更多空间 */
.native-ui .stash-closed .storage-layout{display:none}

/* ---------- 3. 棋盘标题、提示与出售区跟随棋盘宽度，不再贴在屏幕两端 ---------- */
.native-ui .inventory-panel>.section-label,
.native-ui .inventory-panel>.board-help{
  max-width:calc(var(--native-hand-h) * 5.04 + 34px);
  margin-inline:auto;width:100%;box-sizing:border-box;
}
.native-ui .inventory-panel>.section-label{padding-inline:17px}

/* ---------- 4. 可读性：最小字号与对比度 ---------- */
.native-ui .section-label h2{font-size:13px;letter-spacing:.5px}
.native-ui .section-label small{font-size:11px;color:#d9cba3}
.native-ui .board-help{font-size:12px;color:#ead9ad}
.native-ui .board-token .card-caption strong{font-size:12px;text-shadow:0 1px 2px #000,0 0 4px #000}
.native-ui .stash-item .card-caption strong{font-size:11px;text-shadow:0 1px 2px #000}
.native-ui .offer-name{font-size:13px}
.native-ui .offer-tier{font-size:11px;color:#cbbf9b}
.native-ui .market-choice-description{font-size:13px;line-height:1.7}
.native-ui .encounter-info h3{font-size:15px}
.native-ui .encounter-type{font-size:11px}
.native-ui .sell-drop{font-size:12px;min-height:32px}
.native-ui .empty-stash{font-size:12px;opacity:.8}
.native-ui .slot-number{font-size:10px}
.native-ui .connection,.native-ui .header-links .text-button{font-size:13px}

/* ---------- 5. 交互反馈 ---------- */
.native-ui .item-offer{transition:transform .16s ease}
.native-ui .item-offer:not(.unavailable):hover{transform:translateY(-4px)}
.native-ui .item-offer:not(.unavailable):hover .card-visual{filter:drop-shadow(0 0 10px #f3d38a66) drop-shadow(0 6px 10px #000a)}
.native-ui .board-token{transition:transform .14s ease,filter .14s ease}
.native-ui .board-token:hover{transform:translateY(-3px);filter:drop-shadow(0 0 8px #f3d38a55)}
.native-ui .board-token:focus-visible,
.native-ui .item-offer:has(:focus-visible){outline:2px solid #f0d27f;outline-offset:3px}
.native-ui .encounter-offer{transition:transform .16s ease}
.native-ui .encounter-offer:hover{transform:translateY(-4px)}
.native-ui .sell-drop{transition:background .15s,border-color .15s,transform .15s}
.native-ui .is-dragging .sell-drop{border-style:dashed;border-color:#f0c27a;background:#5a2a24e6;transform:scale(1.05)}
.native-ui .native-journal-toggle:hover,.native-ui .native-chest-toggle:hover{filter:brightness(1.15)}

/* ---------- 6. 开局页：8 位英雄在常见笔记本高度（768/900）下一屏放下 ---------- */
@media (min-width:1001px){
  .native-ui .welcome{padding-top:clamp(16px,3.5dvh,42px);padding-bottom:16px}
  .native-ui .welcome h1{margin:0 0 4px}
  .native-ui .welcome-heading p{font-size:13px}
  .native-ui .welcome-layout{margin-top:clamp(12px,2.5dvh,30px)}
  .native-ui .hero-select{min-height:0}
  .native-ui .hero-select .hero-art,
  .native-ui .hero-select .hero-portrait{height:clamp(120px,calc((100dvh - 460px) / 2),220px)}
  .native-ui .hero-select .hero-sigil{font-size:clamp(44px,6dvh,60px)}
  .native-ui .welcome-bottom{margin-top:14px;padding-top:12px;font-size:12px}
  .native-ui .new-run-panel p{font-size:12px}
}

/* ---------- 7. 手机：已学技能不再被挤成一列竖排文字 ---------- */
@media (max-width:640px){
  .native-ui .storage-layout{grid-template-columns:1fr}
  .native-ui .skills-panel .section-label{flex-wrap:nowrap}
  .native-ui .skills-panel .section-label h2{white-space:nowrap}
}

@media (prefers-reduced-motion:reduce){
  .native-ui .item-offer,.native-ui .board-token,.native-ui .encounter-offer{transition:none}
  .native-ui .item-offer:hover,.native-ui .board-token:hover,.native-ui .encounter-offer:hover{transform:none}
}

/* ---------- 8. 点卡即选：去掉“购买/前往”按钮，点击卡面或地点图标直接触发 ---------- */
.native-ui .item-offer .offer-art[data-choose],
.native-ui .encounter-image[data-choose]{cursor:pointer}
.native-ui .item-offer .offer-art{position:relative;outline:none}
.native-ui .item-offer.unavailable .offer-art{cursor:help}
.native-ui .item-offer.unavailable .card-visual{filter:grayscale(.65) brightness(.75)}
.native-ui .item-offer .offer-art[data-choose]:active .card-visual{transform:scale(.97)}
.native-ui .offer-tier,.native-ui .offer-buy{display:none}
/* 价格吊牌（原版 Container_PriceTagReroll 素材） */
.native-ui .offer-price{
  position:absolute;left:50%;bottom:-34px;transform:translateX(-50%);z-index:20;
  display:flex;align-items:center;justify-content:center;gap:3px;
  min-width:74px;height:40px;padding:0 22px 3px 10px;
  background:url(assets/ui/Container_PriceTagReroll_TUI.png) center/100% 100% no-repeat;
  color:#3b2410;font:700 21px BazaarNumbers,'Microsoft YaHei',sans-serif;white-space:nowrap;
  filter:drop-shadow(0 2px 3px #000a);pointer-events:none;
}
.native-ui .offer-price .game-icon{width:20px;height:20px;flex:none}
.native-ui .offer-price b{line-height:1}
.native-ui .offer-price.is-short{color:#a3221a}
.native-ui .offer-price.is-free,.native-ui .offer-price.is-sold{font:600 13px BazaarTitle,'Microsoft YaHei',serif}
.native-ui .item-offer .offer-name{margin-top:38px}
.native-ui .item-offer:not(.unavailable):not(.sold):hover .offer-price{filter:drop-shadow(0 0 6px #ffd98a) drop-shadow(0 2px 3px #000a)}
/* 地点：图标即按钮，悬停发光；有价格时吊牌挂在图标下沿 */
.native-ui .encounter-image{transition:filter .16s ease}
.native-ui .encounter-image[data-choose]:hover{filter:brightness(1.12) drop-shadow(0 0 12px #f3d38a88)}
.native-ui .encounter-image[data-choose]:active{transform:scale(.98)}
.native-ui .encounter-image[data-choose]:focus-visible{outline:2px solid #f0d27f;outline-offset:3px}
.native-ui .encounter-offer.unavailable .encounter-image{cursor:not-allowed;filter:grayscale(.6) brightness(.75)}
.native-ui .encounter-price{bottom:auto;top:4px;left:auto;right:2px;transform:none;z-index:6}
.native-ui .encounter-info{padding-bottom:8px}
.native-ui .encounter-info h3{margin-bottom:0}
/* 野怪选项下方多了奖励和卡组两行，图标相应缩小，避免出现滚动条 */
@media (min-width:1001px) and (min-height:640px){
  .native-ui .encounter-grid:has(.monster-cards){max-width:clamp(420px,calc((100cqh - 215px) * 1.157 * 3 + 60px),1040px)!important}
}
