/* Page container comes from style.css. */
.trading-search { display: flex; justify-content: center; margin: 12px 0 14px; }
.trading-search input { width: 100%; max-width: 360px; background: var(--bg-card); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; font-size: 14px; }

.seg { display: flex; width: max-content; max-width: 100%; margin: 0 auto;  border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--bg-panel); }
.seg span { flex: 1 1 auto; text-align: center; padding: 9px clamp(10px, 4vw, 26px); font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); cursor: pointer; }
.seg span.on { background: var(--yellow); color: #0a0a0f; }
.seg span.cy.on { background: var(--cyan); }

.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.cols.single { grid-template-columns: 1fr; }
@media (max-width: 860px) { .cols { grid-template-columns: 1fr; } }
.panel { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 12px; border-top: 3px solid var(--yellow); }
.panel.s { border-top-color: var(--cyan); }
.panel header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.panel h3 { margin: 0; font-size: 15px; letter-spacing: .1em; text-transform: uppercase; }
.panel h3 em { font-style: normal; font-size: 12px; margin-left: 8px; padding: 2px 8px; border-radius: 99px; background: var(--bg-card); color: var(--text-dim); }
.total { text-align: right; font-size: 13px; color: var(--text-dim); }
.total b { font-size: 18px; margin-left: 4px; color: var(--yellow); }
.panel.s .total b { color: var(--cyan); }
.list { padding: 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px 14px; align-items: start; min-height: 70px; }
.empty-row { grid-column: 1 / -1; color: var(--text-dim); font-size: 12px; padding: 14px; text-align: center; }

/* Same stacked-tile technique as the Deck Builder's deck view: height 0 plus
   percentage padding (card aspect + 12px per extra copy) so the copies
   peeking out below fit in the box. */
.ctile { min-width: 0; }
.stack { position: relative; height: 0; transition: transform .15s ease; }
.ctile:hover .stack { transform: translateY(-2px); }
.layer { position: absolute; left: 0; width: 100%; aspect-ratio: 63 / 88; object-fit: cover; display: block; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; transition: border-color .15s ease; }
.ctile:hover .layer { border-color: var(--yellow); }
.panel.s .ctile:hover .layer { border-color: var(--cyan); }
.cqty { display: flex; }
.qty-badge { font-size: 13px; font-weight: 800; letter-spacing: .06em; padding: 3px 9px; border-radius: 5px; }
.qty-badge.need { background: var(--yellow); color: #0a0a0f; }
.qty-badge.sell { background: var(--cyan); color: #0a0a0f; }
.cap { margin-top: 10px; display: flex; flex-direction: column; gap: 3px; }
.cname { font-size: 13px; font-weight: 700; line-height: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmeta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); }
.cmeta .rarity-icon { width: 14px; height: 14px; flex: none; }
.cprice { display: flex; align-items: center; flex-wrap: nowrap; gap: 8px; white-space: nowrap; }
.cprice img { height: 12px; width: auto; flex: none; opacity: .95; }
.cprice b { font-size: 14px; font-weight: 800; }
@media (max-width: 520px) { .cprice { flex-direction: column; align-items: flex-start; gap: 3px; } .list { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 16px 10px; padding: 10px; } }

#card-popup { position: fixed; z-index: 50; pointer-events: none; }
#card-popup img { display: block; width: 340px; max-height: 92vh; object-fit: contain; border-radius: 14px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7), 0 0 0 2px var(--yellow); }
@media (hover: none) { #card-popup { display: none !important; } }

.price-note { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 0 12px; font-size: 13px; color: var(--text-dim); }
.price-note img { height: 20px; width: auto; }
