.matchmaking-head, .public-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.matchmaking-head h2 { margin: 0; color: var(--navy); text-shadow: none; }
.matchmaking-head p { margin: 4px 0 0; color: #51607e; font-size: .95rem; font-weight: 800; text-shadow: none; }
.empty-state { text-align: center; padding: 16px; }

.trader-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 10px; }
.trader-tile { display: grid; justify-items: center; align-content: start; gap: 7px; width: 100%; min-height: 235px; padding: 12px 8px; color: var(--navy); text-align: center; background: linear-gradient(180deg, rgba(255,255,255,.86), rgba(226,250,255,.92)); border: 5px solid var(--navy); border-radius: 26px; box-shadow: 0 8px 0 rgba(23, 35, 69, .18); }
.trader-tile:hover { transform: translateY(-2px); box-shadow: 0 10px 0 rgba(23, 35, 69, .18), 0 16px 28px rgba(42, 35, 93, .18); }

.round-logo.trader-avatar { width: min(22vw, 128px); height: min(22vw, 128px); border-width: 6px; }
.trader-tile h3 { 
  margin: 0; 
  width: 100%; 
  color: var(--navy); 
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: clamp(.92rem, 3.6vw, 1.15rem); 
  line-height: 1.2; 
  font-weight: 900;
  text-shadow: none; 
  overflow: hidden; 
  text-overflow: ellipsis; 
  white-space: nowrap; 
}

.trader-progress { width: min(25vw, 150px); height: 25px; border-width: 3px; }
.trader-progress strong { font-size: 0.75rem; }

.trader-counts { display: grid; grid-template-columns: 1fr; gap: 5px; width: 100%; }
.trader-counts span { display: inline-flex; justify-content: center; align-items: center; min-height: 28px; padding: 4px 7px; border-radius: 999px; border: 3px solid var(--navy); color: white; font-size: .78rem; font-weight: 950; text-shadow: 0 2px 0 rgba(0,0,0,.28); }
.same-count { background: var(--purple); }
.flex-count { background: linear-gradient(180deg, #61e7a3, #28ba78); }
.flex-count.disabled { background: #a7adbf; color: #f7f9ff; opacity: .82; }
.trader-tile small { width: 100%; color: #51607e; font-size: .76rem; font-weight: 950; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 18px; background: rgba(10, 15, 37, .62); backdrop-filter: blur(4px); }
.modal-backdrop.front { z-index: 120; }
.trade-modal { width: min(760px, 100%); max-height: min(88vh, 920px); overflow: auto; padding: 16px; border: 6px solid var(--navy); border-radius: 30px; background: linear-gradient(180deg, var(--cream), #fff6bf); box-shadow: var(--shadow); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.modal-head h3 { margin: 0; }
.round-close { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 999px; color: white; background: var(--navy); font-size: 1.6rem; font-weight: 950; }
.match-player { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; }
.match-player h3 { margin: 0; font-size: 1.3rem; }
.match-player p { margin: 2px 0 0; }
.match-player.compact { grid-template-columns: auto 1fr; }
.copy-id { padding: 2px 7px; border-radius: 9px; color: var(--navy); background: #dcfbff; border: 2px solid var(--navy); font-weight: 950; }
.copy-id.large { min-height: 44px; padding: 8px 12px; font-size: 1.08rem; }
.locked-note { margin: 4px 0 8px; padding: 8px 10px; border: 3px solid rgba(23, 35, 69, .24); border-radius: 14px; background: #fff1b2; color: var(--navy); font-size: .88rem; }
.trade-section h4 { margin-bottom: 8px; }

.trade-choice { display: block; width: 100%; margin: 8px 0; padding: 10px; border: 4px solid var(--navy); border-radius: 20px; color: var(--navy); background: #ffffff; box-shadow: 0 5px 0 rgba(23,35,69,.16); text-align: left; }
.trade-choice.same { background: #f0fdf7; }
.trade-choice.flex { background: #f6f0ff; }
.trade-choice.disabled { filter: grayscale(.55); opacity: .62; }

.trade-row { display: flex; gap: 8px; width: 100%; align-items: center; justify-content: space-between; }
.trade-box { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 14px; border: 3px solid var(--navy); flex: 1; position: relative; }
.trade-box.receive { background: #dcfff2; }
.trade-box.give { background: #e7f7ff; }

.instruction-modal .prepared-message { min-height: 130px; font-size: .88rem; }
.instruction-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0 12px; }
.instruction-grid article { padding: 12px; border: 4px solid rgba(23,35,69,.22); border-radius: 18px; background: rgba(255,255,255,.70); }
.instruction-grid p { margin: 6px 0 8px; }
.compact-link { min-height: 38px; padding: 6px 10px; border-width: 3px; box-shadow: 0 4px 0 rgba(23, 35, 69, .20); }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.modal-actions > * { flex: 1 1 180px; }

@media (max-width: 700px) {
  .matchmaking-head { align-items: flex-start; }
  .trader-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 8px; }
  .trader-tile { min-height: 205px; padding: 9px 6px; border-width: 4px; }
  .round-logo.trader-avatar { width: min(34vw, 106px); height: min(34vw, 106px); }
  .trader-progress { width: min(36vw, 135px); }
  .trader-counts span { font-size: .72rem; padding: 3px 5px; }
  .modal-backdrop { padding: 8px; align-items: end; }
  .trade-modal { max-height: 92vh; border-width: 5px; border-radius: 24px 24px 18px 18px; }
  .instruction-grid { grid-template-columns: 1fr; }
  .match-player { grid-template-columns: auto 1fr; }
  .match-player .mode-badge { grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 420px) {
  .trader-tile h3 { font-size: .82rem; }
  .trader-tile small { font-size: .68rem; }
  .round-logo.trader-avatar { width: min(36vw, 94px); height: min(36vw, 94px); }
}

