/* ⚖ 交易所（js/market.js，伺服器本機改動第 109 項）：沿用 3.5 視窗外框（.lmui-ov，見 lmui.css「3.5 視窗外框」）＋分頁（.tabs）。
   標題兩邊天秤＋金線；分類鈕、搜尋列；清單｜詳細左右並排（電腦、手機橫式），手機直式（寬 < 640）只看清單、點一列詳細蓋上來；
   最下面「身上金幣、上架 N／10」。金色 #f3d48a、深金 #b7791f、暗底 #120d08 */
.mk-ov .box { max-width: 860px; }
.mk-ov .hd { padding-bottom: 2px; }
.mk-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mk-title::before, .mk-title::after { content: ""; flex: 0 1 48px; min-width: 10px; height: 2px; background: linear-gradient(90deg, rgba(242,193,78,0), #f2c14e); }
.mk-title::after { transform: scaleX(-1); }
.mk-title > span { white-space: nowrap; font: 900 21px/1.2 "Microsoft JhengHei", "PingFang TC", serif; letter-spacing: 6px; padding-left: 6px;
  background: linear-gradient(180deg, #fffbe6 0%, #ffe38f 40%, #d99a26 72%, #fff0b4 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 1px 0 #000) drop-shadow(0 0 6px rgba(255,190,60,.5)); }
.mk-logo { flex: none; width: 24px; height: 18px; fill: none; stroke: #f2c14e; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 1px 0 #000); }
.mk-logo circle { fill: #f2c14e; stroke: none; }

/* 分頁：領取上面的數字 */
.mk-ov .tabs { padding-top: 4px; }
.mk-ov .tabs button { position: relative; white-space: nowrap; padding: 7px 2px; }
.mk-badge { position: absolute; top: -7px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box; border-radius: 9px; background: linear-gradient(180deg, #ff7a59, #c0261a);
  color: #fff; font: 700 11px/18px sans-serif; box-shadow: 0 0 0 1.5px #1a0d06, 0 0 8px rgba(255,90,60,.6); }
.mk-badge[hidden] { display: none; }

/* 內容區 */
.mk-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; border: 1px solid #5a4630; border-top-color: #b7791f; background: rgba(10,7,4,.55); }
.mk-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 32px 12px; color: #a8997a; font-size: 14px; text-align: center; }
.mk-empty b { color: #e9d9b0; font-size: 16px; }
.mk-off { flex: 1 1 auto; }
.mk-off .mk-logo, .mk-pick .mk-logo { width: 54px; height: 40px; stroke-width: 1.3; opacity: .55; }
.mk-dim { color: #8d8574; font-weight: 400; }

/* 分類鈕（一排，放不下就左右滑） */
.mk-cats { flex: none; display: flex; gap: 5px; padding: 7px 8px 0; overflow-x: auto; scrollbar-width: none; }
.mk-cats::-webkit-scrollbar { display: none; }
.mk-cats button { flex: none; min-height: 30px; padding: 3px 12px; border: 1px solid #4a3f30; border-radius: 15px; background: #15120e; color: #cdb98a; font-weight: 600; font-size: 13px; line-height: 1; font-family: inherit; cursor: pointer; white-space: nowrap; }
.mk-cats button.on { border-color: #e0b04a; background: linear-gradient(180deg, #5a4210, #2e2006); color: #ffe9a8; box-shadow: 0 0 6px rgba(242,193,78,.35); }

/* 搜尋＋排序 */
.mk-bar { flex: none; display: flex; gap: 6px; padding: 6px 8px; }
.mk-q { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 4px; padding: 0 8px; border: 1px solid #5a4630; border-radius: 6px; background: #0d0a07; }
.mk-q svg { flex: none; width: 16px; height: 16px; fill: none; stroke: #a8997a; stroke-width: 2; stroke-linecap: round; }
.mk-q input { flex: 1 1 auto; min-width: 0; height: 32px; border: 0; outline: 0; background: none; color: #f1ead9; font-size: 16px; font-family: inherit; }
.mk-q input::placeholder { color: #6f6556; }
.mk-sort { flex: none; height: 34px; padding: 0 6px; border: 1px solid #5a4630; border-radius: 6px; background: #15120e; color: #f0e2bf; font-size: 16px; font-family: inherit; }

/* 清單｜詳細 */
.mk-split { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); border-top: 1px solid #3a2e20; }
.mk-ov .mk-list, .mk-ov .mk-detail { padding: 4px; gap: 3px; }
.mk-ov .mk-detail { border-left: 1px solid #5a4630; background: linear-gradient(180deg, rgba(58,44,26,.35), rgba(10,7,4,0) 60%); padding: 8px 10px; gap: 8px; }
.mk-back { display: none; }
.mk-detail > .mk-go { position: sticky; bottom: 0; margin-top: auto; box-shadow: inset 0 1px 0 rgba(255,240,190,.45), 0 -6px 10px rgba(12,8,4,.9); }   /* 詳細很長也看得到購買、上架鈕 */
.mk-full { flex: 1 1 auto; }

/* 一列 */
.mk-row { flex: none; display: flex; align-items: center; gap: 8px; width: 100%; min-height: 50px; padding: 4px 6px; box-sizing: border-box; text-align: left;
  border: 1px solid #2e271e; border-radius: 6px; background: linear-gradient(180deg, rgba(40,32,22,.85), rgba(22,17,11,.85)); color: #eee; font-family: inherit; cursor: pointer; }
button.mk-row:hover { border-color: #6b5636; }
.mk-row.on { border-color: #e0b04a; background: linear-gradient(180deg, rgba(90,66,16,.75), rgba(40,28,8,.85)); box-shadow: 0 0 8px rgba(242,193,78,.35), inset 0 0 0 1px rgba(242,193,78,.25); }
.mk-row.own { border-style: dashed; }
.mk-ic { flex: none; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border: 1px solid #4a3f30; border-radius: 6px;
  background: radial-gradient(circle at 50% 40%, #2e2416, #0b0806 75%); }
.mk-ic img { max-width: 34px; max-height: 34px; object-fit: contain; image-rendering: pixelated; }
.mk-ic.big { width: 64px; height: 64px; border-color: #b7791f; box-shadow: 0 0 12px rgba(242,193,78,.25); }
.mk-ic.big img { max-width: 52px; max-height: 52px; transform: scale(1.3); }
.mk-mid { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mk-l1 { display: flex; align-items: baseline; gap: 4px; min-width: 0; }
.mk-nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; color: #f5ecd6; }
.mk-cnt { flex: none; color: #cdb98a; font-size: 12px; }
.mk-l2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #998a6d; font-size: 12px; }
.mk-l2 em { font-style: normal; color: #9fd1ff; }
.mk-end { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.mk-end small { color: #998a6d; font-size: 11px; font-variant-numeric: tabular-nums; }
.mk-more { padding: 8px; text-align: center; color: #a8997a; font-size: 12px; }

/* 金幣數字：金色小圓幣＋數字 */
.mk-pr { display: inline-flex; align-items: center; gap: 3px; color: #fcd34d; font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mk-pr.plus { color: #8ee08a; }
.mk-pr.plus::before { content: "+"; }
.mk-coin { flex: none; display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6c8 0, #f6c945 35%, #b07d14 80%);
  box-shadow: inset 0 0 0 1px rgba(90,60,0,.6), 0 0 3px rgba(255,200,80,.5); }

/* 詳細 */
.mk-dhead { flex: none; display: flex; align-items: center; gap: 10px; }
.mk-dname { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.mk-dname .mk-nm { white-space: normal; font-size: 18px; line-height: 1.25; color: #fff3d6; text-shadow: 0 1px 0 #000; }
.mk-dname .mk-nm.c-blessed { color: #facc15; }
.mk-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.mk-tags i { font-style: normal; padding: 1px 7px; border-radius: 9px; font-size: 12px; border: 1px solid #6b5636; color: #f0e2bf; background: #1d160d; }
.mk-tags i.en { border-color: #e0b04a; color: #ffe08a; }
.mk-tags i.bl { border-color: #facc15; color: #facc15; }
.mk-tags i.at.fr { border-color: #f87171; color: #fca5a5; } .mk-tags i.at.wa { border-color: #60a5fa; color: #93c5fd; }
.mk-tags i.at.wi { border-color: #4ade80; color: #86efac; } .mk-tags i.at.ea { border-color: #d6a35c; color: #e8c08a; }
.mk-lines { flex: none; display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; padding: 7px 9px; border: 1px solid #3a2e20; border-radius: 6px; background: rgba(0,0,0,.28); font-size: 13px; }
.mk-lines > div { display: contents; }
.mk-lines span { color: #a8997a; white-space: nowrap; }
.mk-lines b { color: #eee; font-weight: 500; min-width: 0; }
.mk-deal { flex: none; display: flex; flex-direction: column; gap: 5px; padding: 8px 9px; border: 1px solid #6a4b0c; border-radius: 6px; background: linear-gradient(180deg, rgba(242,193,78,.09), rgba(242,193,78,.02)); }
.mk-deal > div { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 14px; }
.mk-deal span { color: #b9a57a; white-space: nowrap; }
.mk-deal b { color: #f1ead9; font-weight: 600; text-align: right; }
.mk-deal b small { color: #998a6d; font-weight: 400; font-size: 12px; }

/* 大按鈕（購買、上架、全部領取） */
.mk-go { flex: none; display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 44px; padding: 6px 12px; border: 1px solid #e0b04a; border-radius: 8px;
  background: linear-gradient(180deg, #8a6418 0%, #5a3e0a 55%, #3c2805 100%); color: #fff3d0; font-weight: 800; font-size: 16px; line-height: 1.1; font-family: inherit; letter-spacing: 2px; cursor: pointer;
  text-shadow: 0 1px 0 #000; box-shadow: inset 0 1px 0 rgba(255,240,190,.45), 0 2px 6px rgba(0,0,0,.5); }
.mk-go span { display: inline-flex; align-items: center; gap: 4px; letter-spacing: 0; color: #ffe08a; }
.mk-go:active { filter: brightness(1.15); }
.mk-go:disabled { border-color: #4a3f30; background: #1a1612; color: #8d8574; box-shadow: none; letter-spacing: 0; font-size: 14px; cursor: default; }
.mk-go.armed { border-color: #ffb36b; background: linear-gradient(180deg, #b0461c, #6a2408); animation: mkPulse .9s ease-in-out infinite alternate; }
.mk-go.sm { width: auto; min-height: 36px; padding: 4px 22px; font-size: 14px; }
@keyframes mkPulse { from { box-shadow: 0 0 0 rgba(255,140,60,.0); } to { box-shadow: 0 0 14px rgba(255,140,60,.75); } }

/* 出售：背包格子 */
.mk-bag { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px; }
.mk-cell { position: relative; display: flex; align-items: center; gap: 6px; min-width: 0; min-height: 46px; padding: 3px 6px 3px 3px; border: 1px solid #2e271e; border-radius: 6px;
  background: rgba(30,24,16,.85); color: #eee; font-family: inherit; text-align: left; cursor: pointer; }
.mk-cell .mk-ic { width: 38px; height: 38px; }
.mk-cell.on { border-color: #e0b04a; box-shadow: 0 0 8px rgba(242,193,78,.35); background: rgba(70,50,14,.8); }
.mk-cn { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.mk-cn.c-blessed { color: #facc15; }
.mk-cell small { position: absolute; right: 4px; bottom: 1px; color: #cdb98a; font-size: 11px; }
.mk-note { padding: 6px 4px 2px; color: #8d8574; font-size: 12px; text-align: center; }
.mk-more-lines { flex: none; }
.mk-more-lines summary { cursor: pointer; color: #b9a57a; font-size: 13px; padding: 2px 0; }
.mk-more-lines .mk-lines { margin-top: 4px; }
.mk-form { flex: none; display: flex; flex-direction: column; gap: 8px; }
.mk-f { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #e9d9b0; font-size: 14px; }
.mk-f > span:first-child { white-space: nowrap; }
.mk-step { display: flex; align-items: center; gap: 4px; }
.mk-step button { width: 34px; height: 34px; border: 1px solid #6b5636; border-radius: 6px; background: #1a1612; color: #f0e2bf; font-weight: 700; font-size: 18px; line-height: 1; font-family: inherit; cursor: pointer; }
.mk-step .mk-all { width: auto; padding: 0 10px; font-size: 13px; }
.mk-qty { width: 64px; height: 34px; box-sizing: border-box; border: 1px solid #5a4630; border-radius: 6px; background: #0d0a07; color: #fff; text-align: center; font-size: 16px; font-family: inherit; }
.mk-in { flex: 1 1 auto; max-width: 230px; display: flex; align-items: center; gap: 6px; padding: 0 10px; border: 1px solid #b7791f; border-radius: 6px; background: #0d0a07; box-shadow: inset 0 0 8px rgba(242,193,78,.12); }
.mk-in input { flex: 1 1 auto; min-width: 0; height: 38px; border: 0; outline: 0; background: none; color: #fde68a; font-weight: 700; font-size: 18px; line-height: 1; font-family: inherit; text-align: right; font-variant-numeric: tabular-nums; }
.mk-in input::placeholder { color: #6f6556; font-weight: 400; font-size: 15px; }
.mk-calc { flex: none; display: flex; flex-direction: column; gap: 4px; padding: 8px 9px; border: 1px solid #6a4b0c; border-radius: 6px; background: linear-gradient(180deg, rgba(242,193,78,.09), rgba(242,193,78,.02)); }
.mk-calc > div { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 14px; color: #b9a57a; }
.mk-calc small { margin-left: 2px; font-size: 11px; color: #8d8574; }
.mk-calc b { font-variant-numeric: tabular-nums; color: #f1ead9; }
.mk-calc b.neg { color: #f0a58a; font-weight: 600; }
.mk-calc .net { margin-top: 2px; padding-top: 5px; border-top: 1px dashed #6a4b0c; color: #f3d48a; font-weight: 700; }
.mk-calc .net .mk-pr { font-size: 18px; }
.mk-calc p { margin: 2px 0 0; color: #8d8574; font-size: 12px; text-align: center; }

/* 我的上架、領取 */
.mk-del, .mk-take { min-height: 28px; padding: 2px 12px; border: 1px solid #6b5636; border-radius: 14px; background: #1a1612; color: #f0e2bf; font-weight: 700; font-size: 13px; line-height: 1; font-family: inherit; cursor: pointer; white-space: nowrap; }
.mk-del.armed { border-color: #ff8a5c; background: #5a1c0a; color: #ffd8cf; }
.mk-take { border-color: #e0b04a; background: linear-gradient(180deg, #6a4b10, #3a2806); color: #ffe9a8; }
.mk-del:disabled, .mk-take:disabled { opacity: .5; }
.mk-row.sold { border-left: 3px solid #5fbf5a; }
.mk-row.back { border-left: 3px solid #a8997a; }
.mk-ret { color: #cdb98a; font-size: 13px; font-weight: 700; }
.mk-allbar { flex: none; padding: 6px 8px; border-top: 1px solid #3a2e20; }

/* 最下面：身上金幣、上架件數 */
.mk-ft { flex: none; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 10px 0; font-size: 14px; color: #d9c9a3; white-space: nowrap; }
.mk-ft .mk-pr { font-size: 15px; }
.mk-slots b { color: #fde68a; font-size: 16px; }
.mk-slots b.full { color: #ff9a7a; }

/* 手機直式（寬 < 640）：清單、詳細上下疊——只看清單，點了詳細整片蓋上來，「‹ 清單」回去 */
@media (max-width: 639px) {
  .mk-ov .box { max-width: none; }
  .mk-split { display: flex; flex-direction: column; position: relative; }
  .mk-split .mk-list { flex: 1 1 auto; }
  .mk-split .mk-detail { display: none; border-left: 0; background: #120d08; }
  .mk-split.show-d .mk-list { display: none; }
  .mk-body.mk-d .mk-cats, .mk-body.mk-d .mk-bar { display: none; }   /* 看詳細時分類、搜尋收起來，空間留給詳細 */
  .mk-split.show-d .mk-detail { display: flex; flex: 1 1 auto; animation: mkIn .18s ease-out; }
  .mk-back { display: block; flex: none; align-self: flex-start; min-height: 30px; padding: 2px 12px 2px 8px; border: 1px solid #6b5636; border-radius: 15px; background: #1a1612;
    color: #f0e2bf; font-weight: 700; font-size: 14px; line-height: 1; font-family: inherit; cursor: pointer; }
  .mk-bag { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .mk-title > span { font-size: 19px; letter-spacing: 4px; }
  .mk-ov .tabs button { font-size: 13px; }
}
@keyframes mkIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }

/* 手機橫式（矮）：標題、分頁、按鈕都縮一點，清單｜詳細照樣並排 */
@media (max-height: 500px) {
  .mk-title > span { font-size: 16px; letter-spacing: 4px; }
  .mk-logo { width: 18px; height: 14px; }
  .mk-ov .tabs { padding-top: 0; }
  .mk-ov .tabs button { padding: 3px 2px; font-size: 13px; }
  .mk-badge { top: -6px; height: 16px; min-width: 16px; line-height: 16px; }
  .mk-cats { padding-top: 4px; }
  .mk-cats button { min-height: 24px; padding: 1px 9px; font-size: 12px; }
  .mk-bar { padding: 4px 6px; }
  .mk-q input { height: 26px; }
  .mk-sort { height: 28px; }
  .mk-row { min-height: 40px; padding: 2px 5px; }
  .mk-ic { width: 32px; height: 32px; }
  .mk-ic img { max-width: 28px; max-height: 28px; }
  .mk-ic.big { width: 44px; height: 44px; }
  .mk-ic.big img { transform: none; max-width: 38px; max-height: 38px; }
  .mk-dname .mk-nm { font-size: 15px; }
  .mk-ov .mk-detail { padding: 5px 7px; gap: 5px; }
  .mk-lines { font-size: 12px; padding: 4px 7px; }
  .mk-deal { padding: 5px 7px; gap: 3px; }
  .mk-deal > div, .mk-calc > div { font-size: 13px; }
  .mk-go { min-height: 36px; font-size: 15px; }
  .mk-ft { padding-top: 3px; font-size: 13px; }
  .mk-empty { padding: 14px 8px; }
}
@media (prefers-reduced-motion: reduce) { .mk-go.armed, .mk-split.show-d .mk-detail { animation: none; } }

/* 電腦版面（body.pcui：電腦、手機橫式）：小視窗都是原版 257 寬（pcui.css --pc-ww），交易所要放清單｜詳細兩欄 → 自己放寬到 780；
   高度照小視窗（畫面頂端到龍頭帶上緣），太矮（手機橫式只剩 200 多）就蓋到底下面板，至少 420 或整個畫面高 */
body.pcui #market-window.pc-ov { width: min(780px, calc(var(--vw1, 1vw) * 100 - 16px)); height: max(var(--pc-oh), min(calc(var(--dvh1, 1dvh) * 100 - var(--orig-bar-h, 0px) - 12px), 420px)); }
body.pcui #market-window .box { width: 100%; max-width: 100%; height: 100%; }

/* 出售表單的輸入框不超出視窗（iPhone Safari 的 <input> 預設有固有寬度，flex 不會自己縮）：外框、輸入框都可以縮到 0、輸入框跟著外框寬 */
.mk-f { min-width: 0; }
.mk-in { min-width: 0; flex: 1 1 0; box-sizing: border-box; }
.mk-in input { width: 100%; }
.mk-step { min-width: 0; flex: none; }

/* 第 119 項（月卡）：沒月卡的出售分頁 */
.mk-nocard > b { color: #ffe9a8; }
.mk-nocard .mk-go { margin-top: 6px; }
/* 第 294 項：買幾個（能疊的） */
.mk-bq b { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.mk-bq button { min-width: 30px; height: 28px; padding: 0 6px; border: 1px solid #6b5636; border-radius: 5px; background: linear-gradient(#2a2117, #17110b); color: #ffe9a8; font: 700 14px/1 inherit; font-family: inherit; cursor: pointer; }
.mk-bq input { width: 64px; height: 28px; box-sizing: border-box; border: 1px solid #6b5636; border-radius: 5px; background: #120d08; color: #fff3d6; text-align: center; font: 700 14px/1 inherit; font-family: inherit; }
