/* Item card in the grid. */
.card {
  position: relative; display: flex; flex-direction: column; padding: 0; text-align: left; cursor: pointer;
  background: var(--card); border: 1px solid var(--card-line); border-radius: var(--radius);
  overflow: hidden; transition: transform 0.12s, border-color 0.12s;
}

/* ☆ favourite (favButton.js): top right, under the "Option" badge */
.fav-btn {
  position: absolute; top: 30px; right: 4px; z-index: 1;
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: 50%; color: #6b7280;
  transition: color 0.12s, transform 0.12s;
}
.fav-btn:hover { color: var(--gold); transform: scale(1.12); }
.fav-btn.is-on { color: var(--gold); }
.fav-btn.is-on svg { fill: currentColor; }
.card:hover { transform: translateY(-2px); border-color: var(--gold); }
.card.is-missing { opacity: 0.45; }

.card-top {
  display: flex; justify-content: space-between; align-items: center;
  height: 26px; padding: 6px 10px 0; font-size: 12px;
}
.card-top-left { display: flex; align-items: baseline; gap: 5px; }
.refine { font-weight: 700; }
.refine-num { font-size: 20px; line-height: 1; }   /* "+7" bigger than "2 ช่อง" */
.badge-option { padding: 1px 7px; border-radius: 999px; background: var(--option-bg); color: var(--option); font-size: 11px; }

.card-icon { display: flex; align-items: center; justify-content: center; height: 104px; }
.item-icon { image-rendering: pixelated; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5)); }

.slots { display: flex; gap: 4px; height: 20px; padding: 0 10px; }
.slot { width: 14px; height: 18px; border-radius: 3px; border: 1px solid #555b66; }
.slot.is-filled { background: var(--card-slot); border-color: var(--card-slot); }

.card-cat { padding: 8px 10px 0; color: var(--muted); font-size: 12px; }
.card-name { padding: 0 10px; font-weight: 600; line-height: 1.35; min-height: 38px; overflow-wrap: anywhere; }
/* cards put in the item ("Verit Card ×2") and random options ("ATK +7") —
   at most 2 lines each, full text in the popup */
.card-cards, .card-options {
  margin: -2px 10px 0; font-size: 12px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: anywhere;
}
.card-cards { color: var(--card-slot); }
.card-options { color: var(--option); margin-top: 2px; }

.card-price { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding: 6px 10px 0; }
.card-price svg { flex: none; }
.card-price strong { font-size: 16px; overflow-wrap: anywhere; }
.amount { color: var(--muted); font-size: 12px; }
/* this price vs the market (utils/market.js): on the cards only "ถูกกว่าตลาด", in the item window all three */
.market-badge { padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.market-badge.is-cheap { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.market-badge.is-dear { background: rgba(239, 68, 68, 0.16); color: #f87171; }
.market-badge.is-near { background: #2a2e36; color: var(--muted); }

.card-foot {
  display: flex; justify-content: space-between; gap: 6px;
  margin-top: auto; padding: 8px 10px; border-top: 1px solid var(--card-line);
  color: var(--muted); font-size: 12px;
}
.card-price + .card-foot { margin-top: 10px; }
.seen { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.seen.is-missing { color: var(--warn); }

/* computers: the item's text beside the card when the mouse rests on its picture
   (iconTooltip.js; the lines are .desc-line from popup.css) */
.icon-tip {
  position: fixed; z-index: 50; width: 300px; max-height: calc(100vh - 16px); overflow: hidden;
  display: flex; flex-direction: column; gap: 2px; padding: 10px 12px;
  background: #1b1e24; border: 1px solid var(--gold); border-radius: 8px;   /* gold, as the card under the mouse */
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); pointer-events: none;
}
.icon-tip[hidden] { display: none; }
.icon-tip-name { margin-bottom: 2px; font-size: 14px; }
.icon-tip .desc-line { font-size: 13px; }
/* "Option: ..." / "การ์ดที่ใส่: ..." after the item's text, coloured as on the card */
.icon-tip-head { margin: 6px 0 0; padding-top: 6px; border-top: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.icon-tip-head.is-option { color: var(--option); }
.icon-tip-head.is-card { color: var(--card-slot); }

@media (max-width: 480px) {
  .card-icon { height: 84px; }
  .card-price strong { font-size: 14px; }
  .card-foot { flex-direction: column; gap: 2px; }
}
