/* TRADING + FIND A PLAYER (js/trades.js, js/profile.js). Reuses .panel, .sell-row, .btn, .toast, .inspect-dialog. */

/* Find a player */
.profile-mine, .profile-other { display: grid; gap: 1rem; }
.profile-mine[hidden], .profile-other[hidden], .tab-count[hidden] { display: none; }
.profile-find-row { display: flex; gap: 0.6rem; }
.profile-find-input, .trade-search {
  flex: 1; min-width: 0; padding: 0.55rem 0.8rem; border: 1px solid var(--line); border-radius: 10px;
  background: rgba(0, 0, 0, 0.2); color: var(--ink); font: 700 0.95rem var(--font-body);
}
.profile-find-msg { margin: 0.5rem 0 0; min-height: 1.1em; font-size: 0.85rem; font-weight: 800; color: var(--muted); }
.profile-id { font-weight: 800; font-size: 0.78rem; color: var(--muted); overflow-wrap: anywhere; }
.profile-copy {
  margin-left: 0.3rem; padding: 0.1rem 0.5rem; border: 1px solid var(--line); border-radius: 8px;
  background: transparent; color: var(--ink); font: 800 0.72rem var(--font-body); cursor: pointer;
}
.profile-copy:hover { background: rgba(255, 255, 255, 0.12); }

/* Another player's profile */
.profile-about-read { margin: 0; padding: 0.55rem 0.7rem; border: 1px solid var(--line); border-radius: 10px; background: rgba(0, 0, 0, 0.2); white-space: pre-wrap; overflow-wrap: anywhere; }
.profile-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.4rem; }
.profile-cardlist { margin-top: 0.7rem; max-height: 28rem; overflow-y: auto; }
.profile-other .profile-find-input { width: 100%; box-sizing: border-box; }

/* Trades panel (own profile): one card per trade, real card faces on both sides */
.trade-list { display: grid; gap: 0.8rem; }
.trade-sub { margin: 0.6rem 0 0.2rem; font: 400 1rem var(--font-display); }
.trade-row {
  display: grid; gap: 0.7rem; padding: 0.8rem 0.9rem; border: 1px solid var(--line); border-radius: 14px; background: rgba(0, 0, 0, 0.22);
}
.trade-row.trade-in:not(.is-done) { border-color: rgba(255, 181, 52, 0.55); box-shadow: 0 0 0 1px rgba(255, 181, 52, 0.18) inset; }
.trade-row.is-done { opacity: 0.78; }
.trade-head { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem 0.7rem; }
.trade-line { flex: 1; min-width: 0; font-weight: 800; overflow-wrap: anywhere; }
.trade-when { color: var(--muted); font-weight: 800; white-space: nowrap; }
.trade-chip {
  padding: 0.1rem 0.6rem; border-radius: 999px; font: 800 0.72rem var(--font-body); letter-spacing: 0.03em; text-transform: uppercase;
  background: rgba(255, 255, 255, 0.12); color: var(--ink);
}
.trade-chip.is-pending { background: rgba(255, 181, 52, 0.2); color: var(--accent); }
.trade-chip.is-accepted { background: rgba(80, 200, 120, 0.22); color: #7ee2a0; }
.trade-chip.is-declined, .trade-chip.is-cancelled { background: rgba(255, 90, 90, 0.18); color: #ff9a9a; }
.trade-person { padding: 0; border: 0; background: none; color: var(--accent); font: 800 1em var(--font-body); cursor: pointer; text-decoration: underline; }
.trade-person:disabled { color: inherit; text-decoration: none; cursor: default; }
.trade-swap, .trade-preview { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 0.8rem; align-items: center; }
.trade-arrow { font-size: 1.8rem; line-height: 1; color: var(--accent); }
.trade-side { min-width: 0; padding: 0.55rem 0.65rem 0.65rem; border: 1px solid var(--line); border-radius: 12px; background: rgba(0, 0, 0, 0.2); align-self: stretch; }
.trade-side-title { margin: 0 0 0.5rem; font: 800 0.78rem var(--font-body); letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.trade-empty { margin: 0; padding: 1rem 0; width: 100%; text-align: center; font-weight: 700; font-size: 0.85rem; color: var(--muted); }
.trade-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 0.5rem; }
.trade-warn { margin-right: auto; margin: 0 auto 0 0; font-weight: 800; color: #ff9a9a; }
@media (max-width: 640px) {
  .trade-swap, .trade-preview { grid-template-columns: 1fr; }
  .trade-arrow { justify-self: center; transform: rotate(90deg); }
}

/* Card tile: the real card (js/ui.js buildCard) shrunk to fit an 84 x 130 box (220 x 341 x 0.38), with its name underneath */
.tt-row { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.tt { position: relative; width: 84px; display: flex; flex-direction: column; gap: 0.25rem; }
.tt-face {
  position: relative; width: 84px; height: 130px; border-radius: 8px; overflow: hidden;
  outline: 2px solid var(--rc, var(--line)); outline-offset: 0;
}
.tt-face .card { position: absolute; top: 0; left: 0; width: 220px; height: 341px; margin: 0; transform: scale(0.38); transform-origin: 0 0; pointer-events: none; animation: none; }
.tt-n {
  position: absolute; right: 3px; bottom: 3px; padding: 0.05rem 0.4rem; border-radius: 999px;
  font: 800 0.8rem var(--font-body); color: var(--accent-ink); background: var(--accent); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
.tt-name {
  font: 700 0.7rem/1.2 var(--font-body); color: var(--ink); text-align: center; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tt-fallback { display: grid; place-items: center; height: 100%; padding: 0.3rem; font: 700 0.7rem var(--font-body); text-align: center; background: rgba(0, 0, 0, 0.35); }
.tt.lack .tt-face { outline-color: #ff5a5a; }
.tt.lack .tt-face::after { content: ""; position: absolute; inset: 0; background: rgba(255, 60, 60, 0.28); }
.tt.lack .tt-name { color: #ff9a9a; }
.tt-remove { border-radius: 10px; cursor: pointer; }
.tt-remove:hover .tt-face, .tt-remove:focus-visible .tt-face { outline-color: #ff5a5a; }
.tt-remove:hover .tt-face::after, .tt-remove:focus-visible .tt-face::after { content: "\00d7"; position: absolute; inset: 0; display: grid; place-items: center; font: 400 2.4rem var(--font-body); color: #fff; background: rgba(0, 0, 0, 0.55); }
.tt-remove:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Request dialog */
.trade-dialog { width: min(58rem, calc(100vw - 2rem)); }
.trade-body { text-align: left; }
.trade-body .inspect-title { text-align: center; }
.trade-note { margin: 0.3rem 0 1rem; text-align: center; font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.trade-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .trade-cols { grid-template-columns: 1fr; } }
.trade-col { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.trade-col .trade-sub { margin: 0; }
.trade-search { flex: none; width: 100%; box-sizing: border-box; }
.trade-pick { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.35rem; max-height: 16rem; overflow-y: auto; overflow-x: hidden; padding: 2px 0.2rem 2px 2px; align-content: start; }
.trade-card {
  display: flex; align-items: center; gap: 0.4rem; border: 1px solid var(--line); border-left: 5px solid var(--rc, var(--line));
  border-radius: 10px; background: rgba(0, 0, 0, 0.22); color: var(--ink);
}
.trade-card:hover { background: rgba(255, 255, 255, 0.08); }
.trade-card.on { outline: 2px solid var(--accent); background: rgba(255, 181, 52, 0.14); }
.trade-card-pick {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.7rem; border: 0; background: none;
  color: inherit; text-align: left; font: inherit; cursor: pointer;
}
.trade-check {
  flex: none; display: grid; place-items: center; width: 1.2rem; height: 1.2rem; border: 2px solid var(--line); border-radius: 5px;
  font: 800 0.8rem/1 var(--font-body); color: var(--accent-ink);
}
.trade-card.on .trade-check { border-color: var(--accent); background: var(--accent); }
.trade-card-main { display: flex; flex-direction: column; min-width: 0; }
.trade-card-main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trade-card-main small { color: var(--muted); font-weight: 700; }
.trade-qty { flex: none; display: flex; align-items: center; gap: 0.35rem; padding-right: 0.5rem; }
.trade-qty b { min-width: 1.4em; text-align: center; }
.trade-step {
  width: 1.7rem; height: 1.7rem; border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, 0.08);
  color: var(--ink); font: 800 1rem/1 var(--font-body); cursor: pointer;
}
.trade-step:hover:not(:disabled) { background: rgba(255, 255, 255, 0.18); }
.trade-step:disabled { opacity: 0.35; cursor: default; }
.trade-preview { margin-top: 1rem; }
.trade-summary { margin: 1rem 0 0; text-align: center; font-weight: 800; min-height: 1.2em; overflow-wrap: anywhere; }
.trade-summary.is-bad { color: #ff9a9a; }

/* Trades panel on your profile: collapse button and "View all" */
.trades-panel .section-head { align-items: center; }
.btn.trade-mini { padding: 0.3rem 0.9rem; font-size: 0.85rem; border-width: 1.5px; }
.trades-panel .section-head .trade-mini { margin-left: auto; }
.trade-viewall { margin-top: 0.8rem; }
