/* หีบแพ็กเงิน / หินดำ: the "แพ็กเงิน / หินดำ" window and its two buttons (js/cashchest.js). Obsidian + gold like the other
   money windows (ตั๋วดันเจี้ยน, ร้านหินดำ), so it reads the same on every book skin. */

/* ---- the buttons: the bag's header (beside the money chips), the market's selling tab */
.cpk-open { display: inline-flex; align-items: center; gap: 5px; margin-left: 8px; padding: 2px 12px 2px 4px; border-radius: 999px; cursor: pointer; vertical-align: middle;
  border: 1.5px solid #d9a443; background: linear-gradient(180deg, #4a3414, #22170a); box-shadow: 0 0 0 1px #2a1d0c, inset 0 1px 0 rgba(255, 230, 170, 0.25);
  color: #ffe39a !important; -webkit-text-fill-color: #ffe39a !important; font: 700 13px/1.6 var(--thai, 'Mali', sans-serif); white-space: nowrap; }
.cpk-open img { width: 26px; height: 26px; object-fit: contain; margin: -4px 0; }
.cpk-open:hover { filter: brightness(1.15); }
#ui .bookwin .eco-gold:has(.cpk-open) { display: flex; align-items: center; }
/* (the book skins restyle buttons: the bag's one keeps its gold so it reads as the thing to press) */
#ui .bookwin .eco-gold .cpk-open, #market .cpk-open { background: linear-gradient(180deg, #f0bd52, #a8701c) !important; border-color: #ffe7a6 !important;
  color: #2a1704 !important; -webkit-text-fill-color: #2a1704 !important; text-shadow: none !important; box-shadow: 0 0 0 1px #3a2408, inset 0 1px 0 rgba(255, 248, 220, 0.7), 0 2px 8px rgba(0, 0, 0, 0.4) !important; }
#ui .bookwin .eco-gold.two .cpk-open { align-self: center; }
#market .mk2-sec h4 .cpk-open { margin-left: auto; font-size: 13px; }

/* ---- the window */
#cpack { position: fixed; inset: 0; z-index: 965; display: grid; place-items: center; background: rgba(6, 4, 12, 0.62); pointer-events: auto; }
#cpack[hidden] { display: none; }
#cpack .cpk-box { position: relative; width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto; display: flex; flex-direction: column; gap: 12px;
  padding: 18px 20px 16px; border-radius: 16px; font-family: var(--thai, 'Mali', sans-serif); color: #f2ead6;
  background: radial-gradient(ellipse at 50% 0%, rgba(255, 196, 90, 0.16), transparent 60%), linear-gradient(180deg, rgba(34, 26, 18, 0.98), rgba(14, 11, 8, 0.98));
  border: 2px solid #8a6a2e; box-shadow: 0 0 0 1px #2a1d0c, inset 0 0 0 1px rgba(255, 216, 130, 0.12), 0 18px 40px rgba(0, 0, 0, 0.6); }
#cpack .close-x { position: absolute; right: 10px; top: 10px; width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid rgba(217, 164, 67, 0.8); background: #1c160e;
  color: #ffd98a; font: 700 15px/1 sans-serif; cursor: pointer; }
#cpack .cpk-head { display: flex; flex-direction: column; gap: 3px; padding-right: 40px; }
#cpack .cpk-head b { font-size: 1.25rem; color: #ffe39a; }
#cpack .cpk-head small { font-size: 0.86rem; line-height: 1.45; color: #d8ccb0; }

/* two tabs + what you have */
#cpack .cpk-tabs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#cpack .cpk-tabs button { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 4px 16px 4px 8px; border-radius: 10px; cursor: pointer;
  border: 1.5px solid #6a5226; background: #1f1810; color: #cdbf9d; font: 700 15px var(--thai, 'Mali', sans-serif); }
#cpack .cpk-tabs button img { width: 26px; height: 26px; object-fit: contain; }
#cpack .cpk-tabs button.on { border-color: #ffd27a; background: linear-gradient(180deg, #5a3f14, #2c1e0a); color: #fff1c4; box-shadow: 0 0 10px rgba(255, 196, 90, 0.35); }
#cpack .cpk-have { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; padding: 3px 12px 3px 8px; border-radius: 999px; cursor: pointer;
  border: 1px solid #6a5226; background: #15100a; font-size: 0.9rem; color: #d8ccb0; }
#cpack .cpk-have img { width: 22px; height: 22px; object-fit: contain; }
#cpack .cpk-have b { color: #ffe39a; font-size: 1.02rem; }

/* the three sizes */
#cpack .cpk-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
#cpack .cpk-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px 10px; border-radius: 14px; cursor: pointer; text-align: center;
  border: 2px solid #4a3a1c; background: linear-gradient(180deg, #241b10, #120d07); transition: transform 0.12s, border-color 0.12s; }
#cpack .cpk-card:hover { transform: translateY(-2px); border-color: #8a6a2e; }
#cpack .cpk-card.on { border-color: var(--gc, #ffd27a); background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--gc, #ffd27a) 28%, transparent), transparent 70%), linear-gradient(180deg, #2c2112, #140f08);
  box-shadow: 0 0 0 1px #000, 0 0 16px color-mix(in srgb, var(--gc, #ffd27a) 45%, transparent); }
#cpack .cpk-card.no:not(.on) { opacity: 0.62; }
#cpack .cpk-ic { width: 96px; height: 96px; display: grid; place-items: center; }
#cpack .cpk-ic img { width: 96px; height: 96px; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5)); }
#cpack .cpk-card b { font-size: 1.12rem; color: var(--gc, #ffe39a); }
#cpack .cpk-card small { font-size: 0.78rem; color: #b9ab8c; }
#cpack .cpk-card em { margin-top: 4px; padding: 1px 10px; border-radius: 999px; font-style: normal; font-size: 0.82rem; font-weight: 700; background: rgba(120, 200, 110, 0.18); color: #a8f09a; }
#cpack .cpk-card em.zero { background: rgba(255, 110, 110, 0.14); color: #ff9a9a; }
#cpack .cpk-own { position: absolute; left: 8px; top: 8px; font-style: normal; font-size: 0.72rem; padding: 0 7px; border-radius: 999px; background: #2a2010; border: 1px solid #6a5226; color: #e8d9b4; }
#cpack .cpk-i { position: absolute; right: 8px; top: 8px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  border: 1px solid #b98a3a; background: #1c160e; color: #ffd98a; font: italic 700 13px/1 Georgia, serif; }

/* how many, what it costs, the button */
#cpack .cpk-qty { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.3); border: 1px solid #3a2d16; }
#cpack .cpk-ql { font-weight: 700; color: #e8d9b4; }
#cpack .cpk-step { display: inline-flex; align-items: center; gap: 6px; }
#cpack .cpk-step button { min-width: 38px; height: 38px; padding: 0 10px; border-radius: 9px; cursor: pointer; border: 1.5px solid #8a6a2e; background: #2a1f10; color: #ffe39a; font: 700 18px var(--thai, 'Mali', sans-serif); }
#cpack .cpk-step button.cpk-max { font-size: 13px; }
#cpack .cpk-step button:disabled { opacity: 0.45; cursor: default; }
#cpack .cpk-n { width: 76px; height: 38px; border-radius: 9px; border: 1.5px solid #8a6a2e; background: #0e0a06; color: #fff3d6; text-align: center; font: 700 17px var(--thai, 'Mali', sans-serif); }
#cpack .cpk-cost { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; font-size: 0.92rem; color: #d8ccb0; }
#cpack .cpk-cost img { width: 22px; height: 22px; object-fit: contain; }
#cpack .cpk-cost b { font-size: 1.1rem; color: #ffe39a; }
#cpack .cpk-cost b.short { color: #ff8a8a; }
#cpack .cpk-cost small { margin-left: 6px; font-size: 0.78rem; color: #a99b7c; }
#cpack .cpk-go { min-height: 52px; border-radius: 12px; cursor: pointer; border: 2px solid #ffd27a; background: linear-gradient(180deg, #e3a83a, #9a6416);
  color: #2a1704; font: 800 1.12rem var(--thai, 'Mali', sans-serif); box-shadow: inset 0 1px 0 rgba(255, 245, 210, 0.6), 0 4px 12px rgba(0, 0, 0, 0.4); }
#cpack .cpk-go:not(:disabled):hover { filter: brightness(1.08); }
#cpack .cpk-go:disabled { cursor: default; filter: grayscale(0.7); opacity: 0.6; }
#cpack .cpk-why { margin: -4px 0 0; text-align: center; font-size: 0.86rem; color: #ffb08a; }

/* after packing: straight to the market */
#cpack .cpk-done { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1.5px solid #4f8a3e; background: linear-gradient(180deg, rgba(60, 110, 50, 0.3), rgba(20, 40, 18, 0.4)); }
#cpack .cpk-dic { width: 54px; height: 54px; flex: none; display: grid; place-items: center; cursor: pointer; }
#cpack .cpk-dic img { width: 54px; height: 54px; object-fit: contain; }
#cpack .cpk-dt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
#cpack .cpk-dt b { color: #c8f5b8; font-size: 0.98rem; }
#cpack .cpk-dt small { color: #d8ccb0; font-size: 0.8rem; }
#cpack .cpk-sell { margin-left: auto; flex: none; min-height: 46px; padding: 0 16px; border-radius: 11px; cursor: pointer; border: 2px solid #8fe2ff; background: linear-gradient(180deg, #2d7fb0, #154a6c);
  color: #f2fbff; font: 800 0.98rem var(--thai, 'Mali', sans-serif); }
#cpack .cpk-sell:disabled { opacity: 0.5; cursor: default; }

/* a phone */
@media (max-width: 560px) {
  #cpack .cpk-box { padding: 14px 12px 12px; gap: 10px; }
  #cpack .cpk-cards { gap: 6px; }
  #cpack .cpk-ic, #cpack .cpk-ic img { width: 64px; height: 64px; }
  #cpack .cpk-card b { font-size: 0.92rem; }
  #cpack .cpk-cost { margin-left: 0; }
  #cpack .cpk-done { flex-wrap: wrap; }
  #cpack .cpk-sell { width: 100%; }
}
