/* 朔方文境：文創市集（/market）
   沿用前台的展牆白、墨色、石灰色與細線；跟線上預覽同一套語言 */
.mk { max-width: var(--max); margin: 40px auto 0; padding: 0 var(--gutter); }
.mk-head { margin-bottom: 32px; }
.mk-head .page-title { margin-bottom: 12px; }
.mk-head p { margin: 0; color: var(--stone); font-size: 14px; max-width: 46em; }

.mk-app { display: grid; gap: 32px; grid-template-columns: 1fr; align-items: start; }
.mk-app > * { min-width: 0; }
@media (min-width: 960px) {
  .mk-app { grid-template-columns: minmax(0, 1.1fr) minmax(320px, 1fr); }
  .mk-stagecol { position: sticky; top: 24px; }
}

.mk-stage { background: var(--panel); border: 1px solid var(--rule); }
.mk-stage canvas { display: block; width: 100%; height: auto; touch-action: none; cursor: grab; }
.mk-stage canvas.drag { cursor: grabbing; }
.mk-price { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border-bottom: 1px solid var(--ink); padding: 14px 0 8px; margin-top: 10px; }
.mk-price span { font-size: 13px; color: var(--stone); min-width: 0; }
.mk-price b { font-family: var(--serif); font-weight: 400; font-size: 24px; letter-spacing: .04em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mk-fx { margin: 6px 0 0; font-size: 12px; color: var(--stone); text-align: right; }

.mk-panel { display: flex; flex-direction: column; min-width: 0; }
.mk-sec { border-top: 1px solid var(--rule); padding: 20px 0 24px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.mk-sec h2 { font-family: var(--serif); font-weight: 400; font-size: 17px; letter-spacing: .16em; margin: 0; }
.mk-hint { margin: 0; font-size: 12.5px; color: var(--stone); line-height: 1.6; }
.mk-hint:empty { display: none; }
.mk-stagecol > .mk-hint { margin-top: 10px; }
.mk-label { font-size: 12px; color: var(--stone); letter-spacing: .06em; margin-bottom: 8px; }
.mk-opts { display: flex; flex-direction: column; gap: 14px; }
.mk-one { font-size: 14px; }

.mk-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.mk-seg button { font: inherit; font-size: 14px; letter-spacing: .04em; padding: 7px 14px; min-height: 40px; border: 1px solid var(--rule); background: transparent; color: var(--ink); cursor: pointer; }
.mk-seg button:hover { border-color: var(--ink); }
.mk-seg button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--wall); }
#mkCat button { font-size: 15px; padding: 8px 16px; }

.mk select, .mk-form select, .mk input[type=text], .mk-form input, .mk-form textarea {
  width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--rule); background: #fff; color: var(--ink); border-radius: 0;
}
.mk select:focus, .mk-form select:focus, .mk input[type=text]:focus, .mk-form input:focus, .mk-form textarea:focus { outline: none; border-color: var(--ink); }
.mk-filter:empty { display: none; }

/* 作品縮圖：用 padding 撐出正方形（手機 Safari 在可捲動的格線裡 aspect-ratio 會被壓扁） */
.mk-arts { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); grid-auto-rows: auto; align-content: start; gap: 8px; max-height: 360px; overflow-y: auto; padding: 2px; }
.mk-arts button, .mk-up { position: relative; display: block; width: 100%; height: 0; padding: 100% 0 0; border: 1px solid var(--rule); background: var(--panel); cursor: pointer; overflow: hidden; }
.mk-arts img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 600px) { .mk-arts { grid-template-columns: repeat(4, minmax(0, 1fr)); max-height: 300px; } }
.mk-arts button[aria-pressed="true"] { outline: 2px solid var(--ink); outline-offset: 1px; }
.mk-arts button.busy { opacity: .5; }
.mk-up { display: flex; align-items: center; justify-content: center; text-align: center; font-size: 13px; line-height: 1.4; padding: 6px; border-style: dashed; border-color: var(--stone); background: transparent; }
.mk-up input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.mk-up:focus-within { outline: 2px solid var(--ink); outline-offset: 1px; }
.mk-yours { font: inherit; font-size: 13px; }

.mk-range { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--stone); letter-spacing: .06em; }
.mk-range input { width: 100%; accent-color: var(--ink); }
.mk-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.mk-sw { display: flex; flex-wrap: wrap; gap: 8px; }
.mk-sw button { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--rule); padding: 0; cursor: pointer; }
.mk-sw button[aria-pressed="true"] { outline: 2px solid var(--ink); outline-offset: 2px; }

.mk-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.mk-btn { font: inherit; font-size: 15px; letter-spacing: .12em; padding: 12px 22px; border: 1px solid var(--ink); background: var(--ink); color: var(--wall); cursor: pointer; }
.mk-btn.ghost { background: transparent; color: var(--ink); }
.mk-btn.go { background: #2F6B4F; border-color: #2F6B4F; color: #fff; width: 100%; font-size: 16px; padding: 14px 22px; }
.mk-btn:disabled { opacity: .5; cursor: wait; }
.mk-out img { width: 100%; border: 1px solid var(--rule); margin-top: 8px; }

.mk-form { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.mk-form label { display: block; font-size: 13px; color: var(--stone); }
.mk-form label > input, .mk-form label > select, .mk-form label > textarea { margin-top: 6px; }
.mk-form .pair { display: grid; grid-template-columns: 9em 1fr; gap: 12px; }
.mk-form .hp { position: absolute; left: -9999px; }
.mk-form .consent { font-size: 12px; color: var(--stone); margin: 0; }
.mk-form .consent a { text-decoration: underline; text-underline-offset: 3px; }
.mk-form .form-msg { margin: 0; }

@media (max-width: 600px) {
  .mk-row, .mk-form .pair { grid-template-columns: 1fr; }
  .mk-price b { font-size: 21px; }
}

.mk-sel { position: absolute; border: 2px dashed #2F6B4F; box-shadow: 0 0 0 2px rgba(255,255,255,.7); pointer-events: none; border-radius: 4px; }
.mk-slotnote { color: #2F6B4F; }

.mk-guide { position: absolute; pointer-events: none; background: #2F6B4F; opacity: .8; }
.mk-guide.v { width: 1px; transform: translateX(-.5px); }
.mk-guide.h { height: 1px; transform: translateY(-.5px); }

/* ---------- 分頁、購物車按鈕 ---------- */
.mk-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: -8px 0 24px; flex-wrap: wrap; }
.mk-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--rule); }
.mk-tabs button { font: inherit; font-size: 15px; letter-spacing: .12em; padding: 10px 18px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--stone); cursor: pointer; margin-bottom: -1px; }
.mk-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.mk-cartbtn { font: inherit; font-size: 15px; letter-spacing: .1em; display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border: 1px solid var(--ink); background: var(--wall); color: var(--ink); cursor: pointer; }
.mk-cartbtn span { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--ink); color: var(--wall); font-size: 12px; display: inline-flex; align-items: center; justify-content: center; letter-spacing: 0; }
.mk-cartbtn.bump { animation: mkBump .45s ease; }
@keyframes mkBump { 40% { transform: scale(1.08); } }
.mk-addrow { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.mk-addrow .mk-btn.go { width: auto; flex: 1; }
.mk-qty { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--stone); }
.mk-qty input { width: 84px; font: inherit; font-size: 16px; padding: 10px; border: 1px solid var(--rule); }

/* ---------- 選物 ---------- */
.mk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 28px 20px; }
.mk-card { display: flex; flex-direction: column; gap: 8px; text-align: left; padding: 0; border: 0; background: none; cursor: pointer; font: inherit; color: var(--ink); }
.mk-cimg { position: relative; display: block; width: 100%; padding-top: 100%; background: var(--panel); overflow: hidden; }
.mk-cimg img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.mk-card:hover .mk-cimg img { transform: scale(1.03); }
.mk-cimg i { position: absolute; left: 8px; top: 8px; font-style: normal; font-size: 12px; padding: 3px 8px; background: var(--ink); color: var(--wall); }
.mk-cname { font-size: 15px; line-height: 1.5; }
.mk-cprice { font-size: 14px; color: var(--stone); }
@media (max-width: 600px) { .mk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 12px; } }

/* ---------- 視窗：商品明細、購物車 ---------- */
body.mk-lock { overflow: hidden; }
.mk-modal { position: fixed; inset: 0; z-index: 200; background: rgba(20, 18, 16, .5); display: flex; justify-content: center; align-items: flex-start; padding: 5vh 16px; overflow-y: auto; }
.mk-mbox { position: relative; background: var(--wall); width: 100%; max-width: 920px; padding: 28px; }
.mk-x { position: absolute; right: 10px; top: 8px; font-size: 28px; line-height: 1; background: none; border: 0; cursor: pointer; color: var(--ink); padding: 6px 10px; }
.mk-gview { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 28px; }
.mk-gimgs { display: flex; flex-direction: column; gap: 10px; }
.mk-gimgs img { width: 100%; background: var(--panel); }
.mk-ginfo { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.mk-ginfo h2 { font-family: var(--serif); font-weight: 400; font-size: 22px; letter-spacing: .08em; margin: 0; padding-right: 30px; }
.mk-gby { margin: 0; color: var(--stone); font-size: 14px; }
.mk-gby:empty { display: none; }
.mk-gprice { margin: 0; font-family: var(--serif); font-size: 20px; }
.mk-gdesc { white-space: pre-line; font-size: 14px; line-height: 1.9; color: var(--ink); border-top: 1px solid var(--rule); padding-top: 14px; }
.mk-gdesc:empty { display: none; }
@media (max-width: 760px) { .mk-gview { grid-template-columns: 1fr; } .mk-mbox { padding: 22px 16px; } }

.mk-drawer { justify-content: flex-end; align-items: stretch; padding: 0; }
.mk-drawer { overflow: hidden; }
.mk-drawer .mk-mbox { max-width: 520px; height: 100%; overflow-y: auto; overscroll-behavior: contain; padding: 28px 24px max(40px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
.mk-drawer .mk-mbox > * { flex-shrink: 0; }
.mk-drawer h2 { font-family: var(--serif); font-weight: 400; font-size: 22px; letter-spacing: .12em; margin: 0; }
.mk-drawer h3 { font-family: var(--serif); font-weight: 400; font-size: 16px; letter-spacing: .12em; margin: 14px 0 0; border-top: 1px solid var(--rule); padding-top: 18px; }
.mk-line { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.mk-line img { width: 64px; height: 64px; object-fit: cover; background: var(--panel); }
.mk-lname { font-size: 14px; line-height: 1.5; }
.mk-lsub { font-size: 12px; color: var(--stone); margin-top: 2px; line-height: 1.5; }
.mk-lsub:empty { display: none; }
.mk-lacts { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; font-size: 13px; }
.mk-lacts [data-q] { width: 28px; height: 28px; border: 1px solid var(--rule); background: none; cursor: pointer; font-size: 15px; }
.mk-lacts .link { background: none; border: 0; padding: 0 2px; font: inherit; font-size: 12.5px; color: var(--stone); text-decoration: underline; cursor: pointer; }
.mk-line b { font-weight: 400; font-size: 14px; white-space: nowrap; }
.mk-ship { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.mk-ship label { display: flex; gap: 8px; align-items: center; color: var(--ink); }
.mk-sum { display: flex; flex-direction: column; gap: 6px; padding: 12px 0; border-top: 1px solid var(--rule); font-size: 14px; }
.mk-sum div { display: flex; justify-content: space-between; gap: 12px; }
.mk-sum b { font-weight: 400; }
.mk-sum .mk-sumtotal { font-size: 17px; padding-top: 6px; }
.mk-sum .mk-sumtotal b { font-family: var(--serif); }

.mk-form .mk-ship label { display: flex; flex-direction: row; align-items: center; gap: 10px; font-size: 14px; color: var(--ink); }
.mk-form .mk-ship input[type=radio] { width: auto; margin: 0; flex: none; accent-color: var(--ink); }

/* 商品清單 → 個別商品 */
.mk-cartbtn { margin-left: auto; }
.mk-back { font: inherit; font-size: 15px; letter-spacing: .08em; background: none; border: 0; padding: 8px 0; color: var(--ink); cursor: pointer; }
.mk-back:hover { text-decoration: underline; text-underline-offset: 4px; }
.mk-list { display: flex; flex-direction: column; gap: 56px; }
.mk-lsec { display: flex; flex-direction: column; gap: 12px; }
.mk-lsec .mk-grid { margin-top: 8px; }
.mk-h { font-family: var(--serif); font-size: 20px; font-weight: 400; letter-spacing: .14em; margin: 0; }
a.mk-card { text-decoration: none; }
.mk-pname { font-weight: inherit; }

/* 畫質提醒：三角形驚嘆號 */
.mk-warnicon, .mk-warnmark, .mk-low { display: inline-flex; align-items: flex-end; justify-content: center; background: #D9A21B; color: #1D1B19; font-weight: 700; font-style: normal; clip-path: polygon(50% 0, 100% 100%, 0 100%); line-height: 1; }
.mk-warnicon { position: absolute; left: 12px; top: 12px; width: 34px; height: 30px; font-size: 18px; padding-bottom: 3px; pointer-events: none; }
.mk-warn { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; padding: 12px 14px; border: 1px solid #D9A21B; background: rgba(217, 162, 27, .08); }
.mk-warn p { flex: 1 1 220px; min-width: 0; margin: 0; font-size: 14px; line-height: 1.6; text-wrap: pretty; }
.mk-warnmark { flex: none; width: 24px; height: 21px; font-size: 13px; padding-bottom: 2px; }
.mk-low { position: absolute; right: 4px; top: 4px; width: 18px; height: 16px; font-size: 10px; padding-bottom: 1px; pointer-events: none; }

/* 加入購物車的通知 */
.mk-toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translate(-50%, 16px); z-index: 300; display: flex; align-items: center; gap: 14px; max-width: calc(100% - 32px); padding: 12px 12px 12px 18px; background: var(--ink); color: var(--wall); font-size: 14px; line-height: 1.5; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.mk-toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.mk-toast span { min-width: 0; }
.mk-toast button { flex: none; font: inherit; font-size: 13px; letter-spacing: .08em; padding: 7px 12px; border: 1px solid currentColor; background: none; color: inherit; cursor: pointer; }

/* 底色 */
.mk-bgrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mk-bgs { display: contents; }
.mk-bgs button.auto { width: auto; min-width: 52px; border-radius: 17px; padding: 0 12px; font: inherit; font-size: 13px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.35); background: linear-gradient(135deg, #C98B5A, #6E8FA8 55%, #3F5A44); }
.mk-bgpick { display: inline-flex; align-items: center; gap: 6px; margin-left: 4px; font-size: 13px; color: var(--stone); cursor: pointer; }
.mk-bgpick input { width: 34px; height: 34px; padding: 0; border: 1px solid var(--rule); border-radius: 50%; background: none; cursor: pointer; overflow: hidden; }
.mk-bgpick input::-webkit-color-swatch-wrapper { padding: 0; }
.mk-bgpick input::-webkit-color-swatch { border: 0; border-radius: 50%; }
.mk-bgpick[aria-pressed="true"] input { outline: 2px solid var(--ink); outline-offset: 2px; }

/* 下拉選單：箭頭往內收，不要貼邊 */
.mk select, .mk-form select {
  -webkit-appearance: none; appearance: none; padding-right: 48px; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%232a2723' stroke-width='1.4'/%3E%3C/svg%3E") no-repeat right 18px center / 12px 8px;
}
.mk select::-ms-expand, .mk-form select::-ms-expand { display: none; }

/* 外幣定價的商品：預估換算 */
.mk-cfx { font-size: 12px; color: var(--stone); }
.mk-gfx { margin-top: -6px; }

/* 吸色 */
.mk-dropbtn { font: inherit; font-size: 13px; color: var(--ink); background: none; border: 1px solid var(--rule); border-radius: 17px; height: 34px; padding: 0 12px; cursor: pointer; }
.mk-dropbtn[aria-pressed="true"] { background: var(--ink); color: var(--paper, #fff); border-color: var(--ink); }
.mk-stage { position: relative; }
.mk-dropbar { position: absolute; left: 10px; right: 10px; top: 10px; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; background: rgba(29, 27, 25, .86); color: #fff; font-size: 14px; }
.mk-dropbar button { font: inherit; font-size: 13px; color: #fff; background: none; border: 1px solid rgba(255, 255, 255, .5); padding: 4px 10px; cursor: pointer; }
.mk-stage canvas.dropper { cursor: crosshair; }
/* 手機：不需要「從預覽圖吸色」（系統調色盤已經有滴管），也避免提示條擋住預覽圖 */
@media (max-width: 899px), (pointer: coarse) { .mk-dropbtn, .mk-dropbar { display: none !important; } }
@media (max-width: 720px) { .mk { margin-top: 12px; } }
