/* market.css — the Night Market: featured row, item cards, money math, pin bar.
   Part of The Ten Towers (E11 economy). Loaded after css/econ.css.
   See brain/plans/E11-economy.md §7.1 (Agent B, EC2). The .ec-panel / .card / .tabs shell
   comes from css/econ.css; this file only styles the Market's own parts. */

.mk-panel .card{width:min(96vw,860px)}

/* ── head: title on the left, purse on the right, close on the far right ── */
.mk-head{display:flex;align-items:flex-start;gap:12px;flex-wrap:wrap}
.mk-head>div:first-child{flex:1 1 260px;min-width:0}
.mk-head h2{margin:0 0 4px}
.mk-head .sub{margin:0;font-size:13px;opacity:.75;line-height:1.45}
.mk-purse{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.mk-purse span{font-size:13px;font-weight:600;padding:6px 10px;border-radius:12px;
  background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.1);white-space:nowrap}
.mk-purse b{font-size:16px;color:#FFD27A}
.mk-head .x{float:none;font-size:18px;line-height:1;padding:8px 10px}

/* ── featured row (§7.1) ── */
.mk-feat{margin:16px 0 6px}
.mk-feat-h{font-size:12px;letter-spacing:.08em;text-transform:uppercase;opacity:.6;margin-bottom:8px}
.mk-feat-row{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}
.mk-mini{background:linear-gradient(150deg,rgba(255,210,122,.14),rgba(255,255,255,.03));
  border:1px solid rgba(255,210,122,.28);border-radius:12px;padding:10px 8px;text-align:center;cursor:pointer}
.mk-mini:hover{border-color:#FFD27A}
.mk-mini-ic{font-size:26px;line-height:1.1}
.mk-mini-n{font-size:12px;font-weight:600;margin-top:4px;line-height:1.25}
.mk-mini-p{font-size:12px;color:#FFD27A;margin-top:2px}

/* ── slot sections in the Wardrobe tab ── */
.mk-slots{display:flex;flex-direction:column;gap:16px;margin-top:14px}
.mk-slot{font-size:12px;letter-spacing:.08em;text-transform:uppercase;opacity:.6;margin-bottom:8px}
.mk-row{display:grid;grid-template-columns:repeat(auto-fill,minmax(212px,1fr));gap:10px}

/* ── one item card ── */
.mk-item{background:linear-gradient(150deg,rgba(255,255,255,.05),rgba(255,255,255,.02));
  border:1px solid rgba(255,255,255,.09);border-radius:14px;padding:12px;display:flex;
  flex-direction:column;gap:8px}
.mk-item.own{border-color:rgba(156,235,208,.4)}
.mk-item.worn{border-color:#9CEBD0;box-shadow:0 0 0 1px rgba(156,235,208,.35) inset}
.mk-item.lock{opacity:.72}
.mk-item-top{display:flex;align-items:center;gap:8px}
.mk-ic{font-size:24px;width:32px;text-align:center;flex:0 0 auto}
.mk-item-top>div:nth-child(2){flex:1 1 auto;min-width:0}
.mk-n{font-weight:700;font-size:14px;line-height:1.25}
.mk-sub{font-size:11px;opacity:.6;margin-top:1px}
.mk-price{font-weight:700;font-size:15px;color:#FFD27A;white-space:nowrap}

/* the money math: 3rd-grade subtraction, always visible, never only on hover */
.mk-math{font-size:12px;line-height:1.45;padding:7px 9px;border-radius:10px;
  background:rgba(92,200,255,.08);border:1px solid rgba(92,200,255,.18);color:#cfe4ff}

/* the preview. With ?nogl=1 there is no 3D, so this swatch is the whole preview. */
.mk-prev{display:flex;justify-content:center;align-items:center;min-height:64px;border-radius:10px;
  background:radial-gradient(circle at 50% 40%,rgba(255,255,255,.08),rgba(0,0,0,.18))}
.mk-prev-ic{font-size:38px}
.mk-prev-3d{font-size:38px}
.mk-swatch{width:100%;height:64px;border-radius:10px}

/* the lock reason reads as a reason, not an error */
.mk-why{font-size:12px;line-height:1.4;padding:6px 9px;border-radius:10px;
  background:rgba(255,143,208,.1);border:1px solid rgba(255,143,208,.22);color:#ffc4e2}

.mk-acts{display:flex;flex-wrap:wrap;gap:6px;margin-top:2px}
.mk-b{padding:7px 12px;border-radius:11px;border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.06);color:#e7eaf3;font-weight:700;font-size:13px;cursor:pointer;
  min-height:34px}
.mk-b.go{background:#FFD27A;color:#1a1410;border-color:#FFD27A}
.mk-link{background:none;border:0;color:#9fe8ff;font-size:12px;font-weight:600;
  cursor:pointer;padding:6px 4px;text-decoration:underline;min-height:32px}

/* ── the empty state ── */
.mk-empty{margin:18px 0;padding:16px;border-radius:12px;background:rgba(255,255,255,.04);
  border:1px dashed rgba(255,255,255,.16);font-size:13px;line-height:1.5;opacity:.85}

/* ── pin bar (§7.1 "Save for this") ── */
.mk-pin{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:16px;padding:10px 12px;
  border-radius:12px;background:rgba(255,210,122,.1);border:1px solid rgba(255,210,122,.28);
  font-size:13px}
.mk-pin b{color:#FFD27A}
.mk-pin>i{flex:1 1 120px;height:8px;border-radius:99px;background:rgba(255,255,255,.12);position:relative;
  min-width:90px;overflow:hidden}
.mk-pin>i::after{content:"";position:absolute;inset:0;width:var(--p,0%);
  background:linear-gradient(90deg,#FFD27A,#FF8A3D);border-radius:99px}

/* ── 3D thumbnails (e2 mkThRender): replace the ✦ glyph once rendered; glyph stays with ?nogl=1 ── */
.mk-th{display:block;width:100%;height:100%;object-fit:contain;pointer-events:none;user-select:none}
.mk-ic.has-th{width:40px;height:40px}
.mk-mini-ic.has-th{width:56px;height:56px;margin:0 auto}
.mk-prev-ic.has-th{width:112px;height:112px}
.mk-prev:has(.has-th){min-height:116px}

/* ── phones: the 4-up featured row and the card grid both collapse (§10: 390 px, 820 px) ── */
@media (max-width:560px){
  .mk-panel .card{padding:16px}
  .mk-feat-row{grid-template-columns:repeat(2,1fr)}
  .mk-row{grid-template-columns:1fr}
  .mk-head .sub{font-size:12px}
  .mk-b{padding:9px 14px;min-height:44px}          /* 44 px tap targets, §7.6 */
  .mk-link{min-height:44px;padding:9px 6px}
}
/* phones: a bottom sheet (~60vh) instead of a full-screen panel, with no blur, so the companion in the
   lean-in camera stays visible above it (e2 mkSheetCam lifts the camera frame to match) */
@media (max-width:620px){
  .ec-panel.mk-panel{align-items:flex-end;background:linear-gradient(180deg,transparent 30%,rgba(10,15,30,.55));backdrop-filter:none;-webkit-backdrop-filter:none}
  .mk-panel .card{width:100vw;max-height:60vh;border-radius:18px 18px 0 0;padding:14px 14px calc(14px + env(safe-area-inset-bottom));
    border-bottom:0;box-shadow:0 -10px 30px rgba(0,0,0,.45)}
  .mk-prev-ic.has-th{width:96px;height:96px}
}
