/* "Send an offer": the button on other players' cards and its two dialogs (Inventory, Search).
   Self-contained: its own tokens, so it looks the same with or without the Marketplace stylesheet. */
.gto-modal {
  --gto-accent: var(--garam-theme-ui-accent, var(--garam-theme-accent, #087cce));
  --gto-ink: #142438; --gto-muted: #617489; --gto-panel: #fff; --gto-border: #d9e6f0; --gto-raised: #f3f7fa;
}
html[data-garam-mode="dark"] body .gto-modal {
  --gto-accent: var(--garam-theme-ui-accent, #b4b6c0);
  --gto-ink: var(--garam-dark-text, #f3f4f7); --gto-muted: var(--garam-dark-muted, #a5a8b2);
  --gto-panel: var(--garam-dark-panel, #23242a); --gto-border: var(--garam-dark-border, #45464d);
  --gto-raised: var(--garam-dark-raised, #34353c);
}

/* "Send an offer" itself is one of the card details' buttons (.garam-modal-action in
   .garam-modal-panel), styled by garam_card_modal.css. */

/* Dialogs */
.gto-modal, .gto-modal * { box-sizing: border-box; }
.gto-modal { position: fixed; inset: 0; z-index: 1000006; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(9, 24, 40, .55); opacity: 0; visibility: hidden; transition: opacity .18s ease, visibility .18s; }
.gto-modal.is-open { opacity: 1; visibility: visible; }
.gto-modal.gto-picker { z-index: 1000007; }
.gto-picker .gto-dialog { width: min(920px, 100%); }
.gto-dialog { width: min(760px, 100%); max-height: min(92vh, 860px); overflow-y: auto; overscroll-behavior: contain;
  padding: clamp(16px, 2.6vw, 26px); border-radius: 22px; background: var(--gto-panel); color: var(--gto-ink);
  border: 1px solid var(--gto-border); box-shadow: 0 24px 70px rgba(9, 24, 40, .35);
  transform: translateY(10px); transition: transform .2s cubic-bezier(.23, 1, .32, 1); }
.gto-modal.is-open .gto-dialog { transform: none; }
.gto-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.gto-header h2 { margin: 0; font-size: clamp(19px, 2.3vw, 25px); font-weight: 700; letter-spacing: -.03em; color: var(--gto-ink); }
.gto-close { width: 36px; height: 36px; flex-shrink: 0; border: 0; border-radius: 10px; background: var(--gto-raised);
  color: var(--gto-ink); font-size: 24px; line-height: 1; cursor: pointer; }
.gto-close:focus-visible, .gto-link-button:focus-visible, .gto-primary:focus-visible, .gto-secondary:focus-visible,
.gto-slot:focus-visible, .gto-tile:focus-visible { outline: 2px solid var(--gto-accent); outline-offset: 2px; }

/* The owner, with links to see what they may want. */
.gto-owner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  margin: 14px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--gto-raised); }
.gto-owner-name { font-size: 13px; font-weight: 600; color: var(--gto-ink); min-width: 0; overflow-wrap: anywhere; }
.gto-owner-links { display: flex; flex-wrap: wrap; gap: 8px; }
.gto-owner-links[hidden] { display: none; }
.gto-link-button { display: inline-flex; align-items: center; gap: 5px; padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--gto-border); background: var(--gto-panel); color: var(--gto-ink); font-size: 12px; font-weight: 600;
  text-decoration: none; }
.gto-link-button:hover { border-color: var(--gto-accent); color: var(--gto-accent); }

.gto-body { display: grid; grid-template-columns: minmax(130px, 170px) minmax(0, 1fr); gap: 20px; margin-top: 18px; align-items: start; }
.gto-body h3 { margin: 0 0 10px; font-size: 13px; font-weight: 700; color: var(--gto-ink); }
.gto-body h3 small { font-weight: 700; color: var(--gto-muted); margin-left: 4px; }
.gto-want-card img { display: block; width: 100%; aspect-ratio: 188 / 279; object-fit: cover; border-radius: 12px; background: var(--gto-raised); }
.gto-want-photo { position: relative; aspect-ratio: 188 / 279; border-radius: 12px; overflow: hidden; background: var(--gto-raised); }
.gto-want-photo img { height: 100%; }
.gto-want-card .gto-tile-copy, .gto-slot .gto-tile-copy { display: block; margin: 0; color: #fff; }
.gto-want-photo .gto-tile-copy { top: 7px; left: 7px; font-size: 12px; }
.gto-slot .gto-tile-copy { max-width: calc(100% - 38px); }
.gto-want-card strong { display: block; margin-top: 8px; font-size: 13px; font-weight: 600; }
.gto-want-card span { display: block; font-size: 12px; color: var(--gto-muted); margin-top: 2px; overflow-wrap: anywhere; }

/* The offer: filled slots, then one "+" slot while there is room. */
.gto-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.gto-slot { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0;
  aspect-ratio: 188 / 279; padding: 0; border-radius: 12px; background: var(--gto-raised); border: 1px solid var(--gto-border);
  color: var(--gto-ink); font: inherit; overflow: hidden; }
button.gto-slot { cursor: pointer; border-style: dashed; border-width: 2px; color: var(--gto-accent); font-size: 32px; font-weight: 300;
  transition: background .15s, border-color .15s; }
button.gto-slot:hover { border-color: var(--gto-accent); background: var(--gto-panel); }
.gto-slot img { width: 100%; height: 100%; object-fit: cover; }
.gto-slot.is-item img { width: 70%; height: 70%; object-fit: contain; }
.gto-slot-label { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 5px 5px; font-size: 12px; font-weight: 600;
  line-height: 1.2; color: #fff; text-align: center; background: linear-gradient(transparent, rgba(9, 24, 40, .82));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gto-slot-remove { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(9, 24, 40, .72); color: #fff; font-size: 16px; line-height: 1; cursor: pointer; }
.gto-slot-remove:hover, .gto-slot-remove:focus-visible { background: #d3203a; outline: none; }

.gto-garamies { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 16px; font-size: 13px; font-weight: 600; }
.gto-garamies-field { position: relative; display: inline-flex; align-items: center; }
.gto-garamies-field input { width: 150px; min-height: 40px; padding: 8px 36px 8px 12px; border-radius: 10px; border: 1px solid var(--gto-border);
  background: var(--gto-raised); color: var(--gto-ink); font: inherit; font-weight:500; font-size: 14px; font-variant-numeric: tabular-nums; }
.gto-garamies-field input:focus-visible, .gto-filters input:focus-visible, .gto-filters select:focus-visible { outline: 2px solid var(--gto-accent); outline-offset: 1px; }
.gto-garamies-field img { position: absolute; right: 10px; width: 18px; height: 18px; pointer-events: none; }
.gto-garamies small { font-weight: 600; color: var(--gto-muted); display: inline-flex; align-items: center; gap: 4px; }
.gto-garamies small img { width: 14px; height: 14px; }

.gto-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px;
  padding-top: 16px; border-top: 1px solid var(--gto-border); }
.gto-status { margin: 0; flex: 1 1 200px; font-size: 12px; line-height: 1.5; color: var(--gto-muted); min-height: 1em; }
.gto-status.is-error { color: #c22d45; font-weight: 600; }
.gto-status.is-success { color: #14805f; font-weight: 600; }
html[data-garam-mode="dark"] body .gto-status.is-error { color: #ff8a98; }
html[data-garam-mode="dark"] body .gto-status.is-success { color: #5fd3a8; }
.gto-actions { display: flex; gap: 10px; margin-left: auto; }
.gto-primary, .gto-secondary { padding: 11px 20px; border-radius: 12px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.gto-primary { border: 0; background: var(--gto-accent); color: #fff; }
.gto-primary:hover:not(:disabled) { filter: brightness(.94); }
.gto-secondary { border: 1px solid var(--gto-border); background: var(--gto-panel); color: var(--gto-ink); }
.gto-secondary:hover:not(:disabled) { background: var(--gto-raised); }
.gto-primary:disabled, .gto-secondary:disabled { opacity: .45; cursor: default; }
.gto-primary:active:not(:disabled), .gto-secondary:active:not(:disabled) { transform: translateY(1px); }

/* The picker */
.gto-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0 10px; }
.gto-filters label { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-size: 12px; font-weight: 600; color: var(--gto-ink); }
.gto-filters label[hidden] { display: none; }
.gto-filters label.is-off { opacity: .45; }
/* The idols / groups / eras / events suggestions open above the picker. */
body.gto-open .garam-multi-autocomplete { z-index: 1000008; }
.gto-filters input, .gto-filters select { width: 100%; min-height: 40px; padding: 8px 11px; border-radius: 10px; border: 1px solid var(--gto-border);
  background: var(--gto-raised); color: var(--gto-ink); font: inherit; font-weight:500; font-size: 13px; }
.gto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; margin-top: 10px; min-height: 120px; }
.gto-tile { display: flex; flex-direction: column; min-width: 0; padding: 6px; border-radius: 13px; border: 1px solid var(--gto-border);
  background: var(--gto-panel); color: var(--gto-ink); font: inherit; text-align: left; cursor: pointer; transition: border-color .15s, transform .15s; }
.gto-tile:hover:not(:disabled) { border-color: var(--gto-accent); transform: translateY(-2px); }
.gto-tile:disabled { opacity: .4; cursor: default; }
.gto-tile-photo { display: flex; align-items: center; justify-content: center; aspect-ratio: 188 / 279; border-radius: 9px; overflow: hidden;
  background: var(--gto-raised); }
.gto-tile-photo img { width: 100%; height: 100%; object-fit: cover; }
.gto-tile-photo { position: relative; }
.gto-tile-copy { position: absolute; top: 5px; left: 5px; max-width: calc(100% - 10px); padding: 2px 6px; border-radius: 7px;
  background: rgba(20, 36, 56, .82); color: #fff; font-size: 12px; font-weight: 600; line-height: 1.3;
  font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.gto-tile.is-item .gto-tile-photo img { width: 72%; height: 72%; object-fit: contain; }
.gto-tile strong { margin-top: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gto-tile small { font-size: 12px; color: var(--gto-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gto-empty { grid-column: 1 / -1; padding: 34px 12px; text-align: center; color: var(--gto-muted); font-size: 13px;
  border: 1px dashed var(--gto-border); border-radius: 14px; }
.gto-pages { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; font-size: 13px; font-weight: 600;
  font-variant-numeric: tabular-nums; }
.gto-pages .gto-secondary { padding: 7px 15px; }

/* Desktop: one page of results is 24 = 8 columns x 3 rows. The tiles keep the shape of a card
   (they are never stretched), and the grid always keeps the height of three rows of them, so the
   dialog has the same height however many results there are. */
@media (min-width: 781px) {
  .gto-picker .gto-dialog { container-type: inline-size; }
  /* The filters fit on one row. */
  .gto-picker .gto-filters { grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); margin: 14px 0 8px; }
  .gto-picker .gto-grid { margin-top: 8px; grid-template-columns: repeat(8, minmax(0, 1fr)); align-content: start;
    min-height: calc(3 * (((100cqw - 70px) / 8 - 14px) * 279 / 188 + 51px) + 20px); }
  .gto-picker .gto-grid:has(.gto-empty) { align-content: stretch; }
  .gto-picker .gto-empty { display: flex; align-items: center; justify-content: center; }
}
/* Phones and tablets: rounder pictures. */
@media (max-width: 780px) {
  .gto-tile-photo { border-radius: 11px; }
}

body.gto-open { overflow: hidden; }
@media (max-width: 620px) {
  .gto-body { grid-template-columns: 1fr; }
  .gto-want-card { display: grid; grid-template-columns: 84px 1fr; gap: 12px; align-items: center; }
  .gto-want-card strong { margin-top: 0; }
  .gto-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gto-actions { width: 100%; }
  .gto-actions button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .gto-modal, .gto-dialog, .gto-tile { transition: none; }
}
