/* v4.5.1 sidebar widening override.
   The stock style.css sets .world-sidebar to 140px which is too narrow
   for the 2-column card grid below. Widen it to 200px on desktop. */
@media (min-width: 701px) {
  .world-sidebar { width: 200px !important; }
}

/* ────────────────────────────────────────────────────────
   World Inventory — farm-game style cards
   Append to style.css or link separately.
   ──────────────────────────────────────────────────────── */

.world-inventory,
#world-inventory {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-height: 0;
}

.winv-hint {
  font-size: 10px;
  color: #64748b;
  text-align: center;
  padding: 2px 8px;
  font-style: italic;
}

/* Title row */
.winv-title {
  font-family: Georgia, serif;
  font-size: 13px;
  color: #e8c988;
  letter-spacing: 0.04em;
  padding: 4px 4px 6px;
  border-bottom: 1px solid #3a2c18;
  margin-bottom: 4px;
}
.winv-title-back {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #d4b070;
  transition: color 0.15s;
}
.winv-title-back:hover { color: #fde68a; }

/* Empty state */
.winv-empty {
  color: #64748b;
  font-size: 11px;
  padding: 16px 8px;
  text-align: center;
  font-style: italic;
}

/* Group chooser — 2 columns of tall square-ish buttons */
.winv-groups {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.winv-group {
  position: relative;
  background: linear-gradient(180deg, #1f1a11 0%, #15110a 100%);
  border: 1px solid #3a2c18;
  border-radius: 10px;
  padding: 10px 6px 8px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  box-shadow: inset 0 0 0 1px rgba(255,220,100,0.05);
}
.winv-group:hover {
  transform: translateY(-1px);
  border-color: #8a6e2a;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4), inset 0 0 0 1px rgba(255,220,100,0.1);
}
.winv-group-icon {
  font-size: 26px;
  line-height: 1;
  margin-bottom: 4px;
}
.winv-group-name {
  font-family: Georgia, serif;
  font-size: 11px;
  color: #e8c988;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}
.winv-group-count {
  font-size: 10px;
  color: #8a7050;
}
.winv-group-placed {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 9px;
  background: rgba(251,191,36,0.2);
  color: #fbbf24;
  padding: 1px 4px;
  border-radius: 4px;
  font-family: Georgia, serif;
}

/* Grid — farm-game style cards */
.winv-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
}

.winv-card {
  position: relative;
  background: linear-gradient(180deg, #1f1a11 0%, #0f0c07 100%);
  border: 1px solid #3a2c18;
  border-radius: 6px;
  padding: 3px 3px 4px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  overflow: hidden;
}
.winv-card:hover {
  transform: translateY(-2px);
  border-color: #8a6e2a;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

/* Rarity glow — subtle inner ring */
.winv-common    { box-shadow: inset 0 0 0 1px rgba(148,163,184,0.25); }
.winv-rare      { box-shadow: inset 0 0 0 1px rgba(59,130,246,0.35); }
.winv-epic      { box-shadow: inset 0 0 0 1px rgba(168,85,247,0.4); }
.winv-legendary { box-shadow: inset 0 0 0 1px rgba(245,158,11,0.5), 0 0 6px rgba(245,158,11,0.15); }

.winv-common:hover    { box-shadow: 0 4px 12px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(148,163,184,0.4); }
.winv-rare:hover      { box-shadow: 0 4px 12px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(59,130,246,0.6); }
.winv-epic:hover      { box-shadow: 0 4px 12px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(168,85,247,0.7); }
.winv-legendary:hover { box-shadow: 0 4px 14px rgba(245,158,11,0.3), inset 0 0 0 1px rgba(245,158,11,0.8); }

/* Preview area */
.winv-card-preview {
  position: relative;
  background: radial-gradient(circle at 50% 40%, rgba(255,255,255,0.05), transparent 60%);
  border-radius: 5px;
  aspect-ratio: 5/3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 2px;
}
.winv-svg {
  width: 72%;
  height: 72%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.winv-svg svg { width: 100%; height: 100%; display: block; }
.winv-icon-fallback {
  font-size: 24px;
  line-height: 1;
}

/* District badge */
.winv-badge-dist {
  font-size: 8px;
  color: #64748b;
  text-align: center;
  padding: 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Footprint size badge (e.g. 2×2, 3×2) */
.winv-badge-size {
  position: absolute;
  bottom: 3px;
  right: 3px;
  background: rgba(10,10,10,0.8);
  color: #fde68a;
  font-family: Georgia, serif;
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid rgba(251,191,36,0.3);
  letter-spacing: 0.05em;
}

/* Card labels */
.winv-card-name {
  font-family: Georgia, serif;
  font-size: 9px;
  color: #e8c988;
  text-align: center;
  line-height: 1.1;
  min-height: 1.6em;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1px;
}
.winv-card-state {
  font-size: 7px;
  color: #64748b;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 1px;
}

/* State variants */
.winv-state-placed {
  opacity: 0.75;
}
.winv-state-placed .winv-card-state {
  color: #22c55e;
}
.winv-state-placed::after {
  content: "\u2713";
  position: absolute;
  top: 4px;
  right: 5px;
  color: #22c55e;
  font-size: 12px;
  font-weight: bold;
  text-shadow: 0 0 4px rgba(34,197,94,0.6);
}
.winv-state-selected {
  border-color: #fbbf24 !important;
  box-shadow: 0 0 10px rgba(251,191,36,0.4), inset 0 0 0 1px rgba(251,191,36,0.6) !important;
}
.winv-state-selected .winv-card-state {
  color: #fbbf24;
  animation: winv-pulse 1.2s ease-in-out infinite;
}
@keyframes winv-pulse {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 1; }
}

/* Shop shortcut button (bottom) */
.winv-shop-btn {
  margin-top: 6px;
  padding: 8px;
  border: 1px dashed #8a6e2a;
  border-radius: 8px;
  text-align: center;
  color: #fbbf24;
  cursor: pointer;
  font-family: Georgia, serif;
  font-size: 12px;
  letter-spacing: 0.05em;
  transition: background 0.15s, border-color 0.15s;
}
.winv-shop-btn:hover {
  background: rgba(251,191,36,0.08);
  border-color: #fbbf24;
}

/* Compact inventory on mobile */
@media (max-width: 700px) {
  .world-inventory { gap: 4px; padding: 4px; }

  /* Groups — narrower */
  .winv-groups { gap: 4px; }
  .winv-group {
    padding: 5px 3px 4px;
    border-radius: 6px;
  }
  .winv-group-icon { font-size: 18px; margin-bottom: 1px; }
  .winv-group-name { font-size: 9px; margin-bottom: 1px; }
  .winv-group-count { font-size: 8px; }
  .winv-group-placed { font-size: 8px; top: 2px; right: 2px; padding: 0 3px; }

  /* Item cards — compact, matching group style */
  .winv-grid { gap: 4px; }
  .winv-card {
    padding: 3px 3px 4px;
    border-radius: 6px;
  }
  .winv-card-preview {
    aspect-ratio: 4/3;
    margin-bottom: 1px;
  }
  .winv-svg { width: 70%; height: 70%; }
  .winv-icon-fallback { font-size: 22px; }
  .winv-badge-size { font-size: 7px; padding: 0 3px; bottom: 1px; right: 1px; }
  .winv-card-name { font-size: 8px; min-height: 1.5em; padding: 0 1px; }
  .winv-card-state { font-size: 7px; margin-top: 1px; }
  .winv-state-placed::after { font-size: 9px; top: 2px; right: 3px; }

  /* Back title */
  .winv-title { font-size: 11px; padding: 2px 4px 4px; }

  .winv-shop-btn { padding: 5px; font-size: 11px; }
}
