/* ===================================================================== */
/* TRADE (#trade-modal + final confirmation): the CoreCraftia fantasy      */
/* look - blue frame with leaf corners, wooden "Trade" sign, dark-blue     */
/* cards, framed slots and 3D Confirm / Cancel buttons. Presentation only; */
/* markup is in landing.html and behaviour in items.js.                    */
/* ===================================================================== */

body #trade-modal{
  --tr-frame: #2f93ff;
  --tr-wood: linear-gradient(180deg, #d79a58 0%, #b87438 52%, #8d5226 100%);
  --tr-grain: repeating-linear-gradient(92deg, rgba(60, 28, 6, 0) 0 22px, rgba(60, 28, 6, 0.16) 22px 24px);
  --tr-card: linear-gradient(180deg, #0c2144, #081a38);
  --tr-btn: linear-gradient(180deg, #4aa6ff 0%, #2677e6 52%, #1757bd 100%);
  --tr-green: linear-gradient(180deg, #7ddc5a 0%, #3fae2f 52%, #25801f 100%);
  --tr-red: linear-gradient(180deg, #ff6a5c 0%, #d3201a 52%, #a31410 100%);
  --tr-leaf-tl: url("data:image/svg+xml,%3Csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20viewBox=%270%200%2090%2070%27%3E%3Cg%20transform=%27translate%280%200%29%20scale%281%201%29%27%3E%3Cdefs%3E%3ClinearGradient%20id=%27g%27%20x1=%270%27%20y1=%270%27%20x2=%271%27%20y2=%271%27%3E%3Cstop%20offset=%270%27%20stop-color=%27%23a6e864%27/%3E%3Cstop%20offset=%271%27%20stop-color=%27%232f8a3a%27/%3E%3C/linearGradient%3E%3Cg%20id=%27l%27%3E%3Cpath%20d=%27M2%2012C10%200%2028%200%2038%2012%2028%2024%2010%2024%202%2012Z%27%20fill=%27url%28%23g%29%27%20stroke=%27%2316501f%27%20stroke-width=%272%27%20stroke-linejoin=%27round%27/%3E%3Cpath%20d=%27M6%2012H34%27%20stroke=%27%23d8f8ad%27%20stroke-opacity=%27.75%27%20stroke-width=%271.6%27%20stroke-linecap=%27round%27/%3E%3C/g%3E%3C/defs%3E%3Cuse%20href=%27%23l%27%20x=%272%27%20y=%2726%27%20width=%2734%27%20height=%2720%27%20transform=%27rotate%28-38%2019%2036%29%27/%3E%3Cuse%20href=%27%23l%27%20x=%2722%27%20y=%278%27%20width=%2734%27%20height=%2720%27%20transform=%27rotate%28-8%2039%2018%29%27/%3E%3Cuse%20href=%27%23l%27%20x=%2740%27%20y=%2734%27%20width=%2730%27%20height=%2718%27%20transform=%27rotate%2834%2055%2043%29%27/%3E%3C/g%3E%3C/svg%3E");
  --tr-leaf-tr: url("data:image/svg+xml,%3Csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20viewBox=%270%200%2090%2070%27%3E%3Cg%20transform=%27translate%2890%200%29%20scale%28-1%201%29%27%3E%3Cdefs%3E%3ClinearGradient%20id=%27g%27%20x1=%270%27%20y1=%270%27%20x2=%271%27%20y2=%271%27%3E%3Cstop%20offset=%270%27%20stop-color=%27%23a6e864%27/%3E%3Cstop%20offset=%271%27%20stop-color=%27%232f8a3a%27/%3E%3C/linearGradient%3E%3Cg%20id=%27l%27%3E%3Cpath%20d=%27M2%2012C10%200%2028%200%2038%2012%2028%2024%2010%2024%202%2012Z%27%20fill=%27url%28%23g%29%27%20stroke=%27%2316501f%27%20stroke-width=%272%27%20stroke-linejoin=%27round%27/%3E%3Cpath%20d=%27M6%2012H34%27%20stroke=%27%23d8f8ad%27%20stroke-opacity=%27.75%27%20stroke-width=%271.6%27%20stroke-linecap=%27round%27/%3E%3C/g%3E%3C/defs%3E%3Cuse%20href=%27%23l%27%20x=%272%27%20y=%2726%27%20width=%2734%27%20height=%2720%27%20transform=%27rotate%28-38%2019%2036%29%27/%3E%3Cuse%20href=%27%23l%27%20x=%2722%27%20y=%278%27%20width=%2734%27%20height=%2720%27%20transform=%27rotate%28-8%2039%2018%29%27/%3E%3Cuse%20href=%27%23l%27%20x=%2740%27%20y=%2734%27%20width=%2730%27%20height=%2718%27%20transform=%27rotate%2834%2055%2043%29%27/%3E%3C/g%3E%3C/svg%3E");
  --tr-leaf-bl: url("data:image/svg+xml,%3Csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20viewBox=%270%200%2090%2070%27%3E%3Cg%20transform=%27translate%280%2070%29%20scale%281%20-1%29%27%3E%3Cdefs%3E%3ClinearGradient%20id=%27g%27%20x1=%270%27%20y1=%270%27%20x2=%271%27%20y2=%271%27%3E%3Cstop%20offset=%270%27%20stop-color=%27%23a6e864%27/%3E%3Cstop%20offset=%271%27%20stop-color=%27%232f8a3a%27/%3E%3C/linearGradient%3E%3Cg%20id=%27l%27%3E%3Cpath%20d=%27M2%2012C10%200%2028%200%2038%2012%2028%2024%2010%2024%202%2012Z%27%20fill=%27url%28%23g%29%27%20stroke=%27%2316501f%27%20stroke-width=%272%27%20stroke-linejoin=%27round%27/%3E%3Cpath%20d=%27M6%2012H34%27%20stroke=%27%23d8f8ad%27%20stroke-opacity=%27.75%27%20stroke-width=%271.6%27%20stroke-linecap=%27round%27/%3E%3C/g%3E%3C/defs%3E%3Cuse%20href=%27%23l%27%20x=%272%27%20y=%2726%27%20width=%2734%27%20height=%2720%27%20transform=%27rotate%28-38%2019%2036%29%27/%3E%3Cuse%20href=%27%23l%27%20x=%2722%27%20y=%278%27%20width=%2734%27%20height=%2720%27%20transform=%27rotate%28-8%2039%2018%29%27/%3E%3Cuse%20href=%27%23l%27%20x=%2740%27%20y=%2734%27%20width=%2730%27%20height=%2718%27%20transform=%27rotate%2834%2055%2043%29%27/%3E%3C/g%3E%3C/svg%3E");
  --tr-leaf-br: url("data:image/svg+xml,%3Csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20viewBox=%270%200%2090%2070%27%3E%3Cg%20transform=%27translate%2890%2070%29%20scale%28-1%20-1%29%27%3E%3Cdefs%3E%3ClinearGradient%20id=%27g%27%20x1=%270%27%20y1=%270%27%20x2=%271%27%20y2=%271%27%3E%3Cstop%20offset=%270%27%20stop-color=%27%23a6e864%27/%3E%3Cstop%20offset=%271%27%20stop-color=%27%232f8a3a%27/%3E%3C/linearGradient%3E%3Cg%20id=%27l%27%3E%3Cpath%20d=%27M2%2012C10%200%2028%200%2038%2012%2028%2024%2010%2024%202%2012Z%27%20fill=%27url%28%23g%29%27%20stroke=%27%2316501f%27%20stroke-width=%272%27%20stroke-linejoin=%27round%27/%3E%3Cpath%20d=%27M6%2012H34%27%20stroke=%27%23d8f8ad%27%20stroke-opacity=%27.75%27%20stroke-width=%271.6%27%20stroke-linecap=%27round%27/%3E%3C/g%3E%3C/defs%3E%3Cuse%20href=%27%23l%27%20x=%272%27%20y=%2726%27%20width=%2734%27%20height=%2720%27%20transform=%27rotate%28-38%2019%2036%29%27/%3E%3Cuse%20href=%27%23l%27%20x=%2722%27%20y=%278%27%20width=%2734%27%20height=%2720%27%20transform=%27rotate%28-8%2039%2018%29%27/%3E%3Cuse%20href=%27%23l%27%20x=%2740%27%20y=%2734%27%20width=%2730%27%20height=%2718%27%20transform=%27rotate%2834%2055%2043%29%27/%3E%3C/g%3E%3C/svg%3E");
  background:
    radial-gradient(circle at 20% 0%, rgba(73, 168, 255, 0.18), transparent 28%),
    rgba(2, 10, 18, 0.74) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  font-family: Georgia, "Times New Roman", serif;
}

/* ---- frame ---- */
body #trade-modal .trade-modal-box{
  position: relative;
  overflow: visible !important;
  padding-top: 34px !important;
  margin-top: 30px !important;
  max-height: calc(100% - 30px) !important;
  border: 4px solid var(--tr-frame) !important;
  border-radius: 22px !important;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(90, 170, 255, 0.22), transparent 60%),
    linear-gradient(180deg, #123c72 0%, #0b2750 52%, #081b38 100%) !important;
  box-shadow: 0 0 0 2px #082f66, 0 18px 44px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(150, 210, 255, 0.35), inset 0 3px 0 rgba(255, 255, 255, 0.08) !important;
}
body #trade-modal .trade-modal-box::after{
  content: "";
  position: absolute;
  left: -12px;
  top: -12px;
  width: calc(100% + 24px);
  height: calc(100% + 24px);
  max-width: none;
  z-index: 30;
  pointer-events: none;
  background:
    var(--tr-leaf-tl) left top / 54px 42px no-repeat,
    var(--tr-leaf-tr) right top / 54px 42px no-repeat,
    var(--tr-leaf-bl) left bottom / 54px 42px no-repeat,
    var(--tr-leaf-br) right bottom / 54px 42px no-repeat;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.35));
}
body #trade-modal .trade-modal-header{ position: static; }
body #trade-modal .trade-modal-header::before{
  content: "Trade";
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 31;
  padding: 5px 38px 7px;
  border: 3px solid #4a2a10;
  border-radius: 12px;
  background: var(--tr-grain), var(--tr-wood);
  box-shadow: 0 4px 0 #2a1608, 0 6px 10px rgba(0, 0, 0, 0.45), inset 0 2px 0 rgba(255, 224, 170, 0.5);
  color: #fff;
  font: 900 clamp(18px, 2.4vw, 26px)/1.1 Georgia, serif;
  letter-spacing: 0.05em;
  -webkit-text-stroke: 5px #0a1c3c;
  paint-order: stroke fill;
  text-shadow: 0 3px 0 rgba(10, 28, 60, 0.9);
  pointer-events: none;
}

/* ---- red X ---- */
body #trade-modal .trade-close-btn{
  position: absolute !important;
  top: 8px !important;
  right: 8px !important;
  z-index: 32;
  border: 3px solid #fff !important;
  border-radius: 12px !important;
  background: var(--tr-red) !important;
  box-shadow: 0 0 0 2px #4a1210, 0 4px 8px rgba(0, 0, 0, 0.5), inset 0 3px 0 rgba(255, 255, 255, 0.4) !important;
  color: #fff !important;
  font: 900 22px/1 Georgia, serif !important;
  text-shadow: 0 2px 0 rgba(90, 8, 4, 0.9);
}
body #trade-modal .trade-close-btn:hover{ filter: brightness(1.12); }

/* ---- player cards ---- */
body #trade-modal .trade-player-card{
  border: 3px solid rgba(120, 190, 255, 0.5) !important;
  border-radius: 16px !important;
  box-shadow: inset 0 3px 10px rgba(0, 0, 0, 0.45), 0 3px 0 #061a38;
}
body #trade-modal .trade-player-role{ color: #8fd2ff; font-weight: 900; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6); }
body #trade-modal .trade-player-name{
  color: #fff;
  font-family: Georgia, serif;
  font-weight: 900;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.7);
}
body #trade-modal .trade-player-card.is-ready{ border-color: #6bdc4b !important; box-shadow: inset 0 3px 10px rgba(0, 0, 0, 0.45), 0 0 14px rgba(107, 220, 75, 0.55); }

/* ---- offer columns ---- */
body #trade-modal .trade-column{
  border: 3px solid rgba(120, 190, 255, 0.45) !important;
  border-radius: 16px !important;
  background: var(--tr-card) !important;
  box-shadow: inset 0 3px 10px rgba(0, 0, 0, 0.45), 0 3px 0 #061a38;
}
body #trade-modal .trade-column.is-ready{ border-color: #6bdc4b !important; box-shadow: inset 0 3px 10px rgba(0, 0, 0, 0.45), 0 0 14px rgba(107, 220, 75, 0.45); }
body #trade-modal .trade-column-header{ color: #fff; font-family: Georgia, serif; font-weight: 900; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6); }
body #trade-modal .trade-column-header small{ color: #8fd2ff; font-weight: 800; }
body #trade-modal .trade-ready-indicator{ border: 2px solid #fff; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.5); }
body #trade-modal #trade-status{ color: #e3f1ff; font-family: Georgia, serif; font-weight: 800; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6); }

/* ---- slots (offer grids + inventory strip) ---- */
body #trade-modal .trade-item-slot,
body #trade-modal .trade-slot{
  border: 3px solid rgba(120, 150, 200, 0.55) !important;
  border-radius: 13px !important;
  background: linear-gradient(180deg, #15264e, #0a1431) !important;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.4), 0 3px 0 #061a38 !important;
}
body #trade-modal .trade-slot.empty,
body #trade-modal .trade-slot.is-empty{
  border-style: dashed !important;
  border-color: rgba(120, 190, 255, 0.28) !important;
  background: rgba(4, 14, 32, 0.5) !important;
  box-shadow: none !important;
}
body #trade-modal .trade-inv-item:hover,
body #trade-modal .trade-slot.is-clickable:hover{ filter: brightness(1.18); }
body #trade-modal .pi-inventory-qty{
  color: #fff !important;
  font-family: Georgia, serif !important;
  font-weight: 900 !important;
  -webkit-text-stroke: 3px #0a1c3c;
  paint-order: stroke fill;
}

/* ---- inventory tabs ---- */
body #trade-modal .trade-inventory-tab{
  border: 3px solid #0b2c5e !important;
  border-radius: 14px !important;
  background: linear-gradient(180deg, #1b5fb8 0%, #123f86 52%, #0c2c62 100%) !important;
  box-shadow: 0 3px 0 #061a38, inset 0 2px 0 rgba(255, 255, 255, 0.25) !important;
  color: #fff !important;
  font-family: Georgia, serif !important;
  font-weight: 900 !important;
  text-shadow: 0 2px 0 rgba(0, 20, 60, 0.85);
}
body #trade-modal .trade-inventory-tab.is-active{
  background: var(--tr-btn) !important;
  box-shadow: 0 3px 0 #061a38, 0 0 0 2px #8fd2ff, inset 0 3px 0 rgba(255, 255, 255, 0.45) !important;
}
body #trade-modal #trade-inventory{
  border: 3px solid rgba(120, 190, 255, 0.35);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(4, 14, 32, 0.78), rgba(6, 20, 42, 0.62));
  scrollbar-color: #2f93ff rgba(0, 0, 0, 0.25);
  scrollbar-width: thin;
}

/* ---- inspector + chat ---- */
body #trade-modal .trade-item-inspector,
body #trade-modal .trade-chat-wrap{
  border: 3px solid rgba(120, 190, 255, 0.45) !important;
  border-radius: 16px !important;
  background: var(--tr-card) !important;
  box-shadow: inset 0 3px 10px rgba(0, 0, 0, 0.45), 0 3px 0 #061a38;
  font-family: Georgia, serif;
}
body #trade-modal .trade-item-inspector-content.is-empty{ color: #cfe6ff; font-weight: 800; }
body #trade-modal #trade-chat-box{ color: #e3f1ff; font-weight: 700; scrollbar-color: #2f93ff rgba(0, 0, 0, 0.25); scrollbar-width: thin; }
body #trade-modal #trade-chat-input{
  border: 3px solid #4aa8ff !important;
  border-radius: 12px !important;
  background: #06142c !important;
  color: #fff !important;
  font-family: Georgia, serif;
  font-weight: 700;
}
body #trade-modal #trade-chat-input:focus{ border-color: #ffe27a !important; outline: none; }

/* ---- buttons ---- */
body #trade-modal #trade-chat-send,
body #trade-modal .btn-trade-primary,
body #trade-modal .btn-trade-danger,
body #trade-final-overlay .trade-final-actions button{
  border: 3px solid #0b2c5e !important;
  border-radius: 14px !important;
  background: var(--tr-btn) !important;
  box-shadow: 0 4px 0 #061a38, inset 0 3px 0 rgba(255, 255, 255, 0.4) !important;
  color: #fff !important;
  font-family: Georgia, serif !important;
  font-weight: 900 !important;
  text-shadow: 0 2px 0 rgba(0, 20, 60, 0.85);
  transition: filter 120ms ease, transform 120ms ease;
}
body #trade-modal .btn-trade-primary{
  border-color: #124a12 !important;
  background: var(--tr-green) !important;
  box-shadow: 0 4px 0 #0c3a0c, inset 0 3px 0 rgba(255, 255, 255, 0.4) !important;
  text-shadow: 0 2px 0 rgba(8, 50, 8, 0.85);
}
body #trade-modal .btn-trade-danger{
  border-color: #5a1210 !important;
  background: var(--tr-red) !important;
  box-shadow: 0 4px 0 #3a0a08, inset 0 3px 0 rgba(255, 255, 255, 0.4) !important;
  text-shadow: 0 2px 0 rgba(90, 8, 4, 0.9);
}
body #trade-modal #trade-chat-send:hover,
body #trade-modal .btn-trade-primary:hover,
body #trade-modal .btn-trade-danger:hover,
body #trade-final-overlay .trade-final-actions button:hover{ filter: brightness(1.12); transform: translateY(-1px); }
body #trade-modal button:focus-visible,
body #trade-final-overlay button:focus-visible{ outline: 3px solid #ffe27a; outline-offset: 2px; }

/* ---- final confirmation ---- */
body #trade-final-overlay{
  background: rgba(2, 10, 18, 0.74) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  font-family: Georgia, serif;
}
body #trade-final-overlay .trade-final-box{
  border: 4px solid var(--tr-frame, #2f93ff) !important;
  border-radius: 20px !important;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(90, 170, 255, 0.22), transparent 60%),
    linear-gradient(180deg, #123c72 0%, #0b2750 52%, #081b38 100%) !important;
  box-shadow: 0 0 0 2px #082f66, 0 18px 44px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(150, 210, 255, 0.35) !important;
  color: #fff;
}
body #trade-final-overlay .trade-final-col{
  border: 3px solid rgba(120, 190, 255, 0.45) !important;
  border-radius: 14px !important;
  background: linear-gradient(180deg, #0c2144, #081a38) !important;
}
body #trade-final-overlay .trade-final-title{ color: #ffd34a; font-weight: 900; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6); }
body #trade-final-overlay .trade-final-sub,
body #trade-final-overlay .trade-final-status{ color: #e3f1ff; font-weight: 800; }

@media (max-width: 720px){
  body #trade-modal .trade-modal-box::after{ left: -8px; top: -8px; width: calc(100% + 16px); height: calc(100% + 16px); background-size: 38px 30px; }
  body #trade-modal .trade-modal-header::before{ top: -18px; padding: 4px 26px 6px; -webkit-text-stroke-width: 4px; }
}
@media (prefers-reduced-motion: reduce){
  body #trade-modal button{ transition: none !important; }
}
