/* Barn Buddy-inspired storage window, adapted to DaleBloom. */
.barn-modal {
  z-index: 32;
  padding: 18px;
  background: rgba(28, 39, 28, 0.58);
  backdrop-filter: blur(7px);
}

.barn-dialog {
  width: min(900px, 100%);
  max-height: calc(100vh - 36px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 5px solid #b9782f;
  border-radius: 26px;
  color: #583d20;
  background: linear-gradient(180deg, #fff3ce, #ffe4a8);
  box-shadow: 0 24px 80px rgba(31, 29, 17, 0.52), inset 0 0 0 3px rgba(255, 252, 225, 0.76);
}

.barn-window-head {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto 52px;
  align-items: center;
  gap: 18px;
  padding: 15px 18px 12px 22px;
  border-bottom: 3px solid rgba(190, 124, 42, 0.35);
  background:
    radial-gradient(circle at 18% 0, rgba(255, 255, 255, 0.65), transparent 27%),
    linear-gradient(180deg, #fff7dd, #ffe6b0);
}

.barn-title-group h2 {
  margin: 0;
  color: #5c3c20;
  font-family: "Trebuchet MS", Inter, sans-serif;
  font-size: clamp(1.75rem, 3.6vw, 2.55rem);
  font-weight: 950;
  letter-spacing: 0.02em;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 0 2px 0 #fff, 2px 3px 0 rgba(126, 77, 27, 0.18);
}

.barn-kicker {
  display: block;
  margin-bottom: 4px;
  color: #ad7131;
  font-size: 0.62rem;
  font-weight: 950;
  letter-spacing: 0.12em;
}

.barn-value {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border: 2px solid rgba(183, 119, 40, 0.36);
  border-radius: 12px;
  background: rgba(255, 251, 218, 0.72);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.75);
  font-size: 0.75rem;
  font-weight: 800;
}

.barn-value strong {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #4a361f;
  font-size: 0.92rem;
  white-space: nowrap;
}

.barn-coin {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border: 2px solid #a66a0d;
  border-radius: 50%;
  color: #99640d;
  background: radial-gradient(circle at 34% 26%, #fff4a3 0 12%, #ffd544 24%, #e99a12 78%);
  font-family: Georgia, serif;
  font-size: 0.78rem;
  line-height: 1;
}

.barn-close {
  width: 48px;
  height: 48px;
  border: 3px solid #1b7778;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(180deg, #6bd4d2, #28979b);
  box-shadow: inset 0 -4px 0 rgba(16, 100, 104, 0.3), 0 4px 8px rgba(55, 77, 54, 0.26);
  cursor: pointer;
  font-size: 2rem;
  font-weight: 950;
  line-height: 0.85;
}

.barn-close:hover { filter: brightness(1.07); transform: translateY(-1px); }

.barn-window-body {
  min-height: 0;
  padding: 14px 22px 10px;
  background:
    radial-gradient(circle at 88% 5%, rgba(255, 219, 113, 0.28), transparent 24%),
    linear-gradient(180deg, #fff4d1, #ffe8b8);
}

.barn-capacity-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: #80603a;
  font-size: 0.72rem;
  font-weight: 850;
}

.barn-capacity-track {
  height: 9px;
  overflow: hidden;
  margin-top: 5px;
  border: 2px solid rgba(127, 85, 34, 0.28);
  border-radius: 999px;
  background: rgba(125, 85, 38, 0.14);
}

.barn-capacity-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7fbd3f, #c6d841 70%, #f0ad2e);
  transition: width 180ms ease;
}

.barn-instructions {
  margin: 12px 0 10px;
  color: #6a4b29;
  font-size: 0.88rem;
  font-weight: 850;
  text-align: center;
}

.barn-grid {
  max-height: min(53vh, 470px);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  overflow: auto;
  padding: 3px 5px 9px 3px;
  scrollbar-color: #3aa3b2 #f1cf86;
}

.barn-item {
  min-width: 0;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 74px;
  padding: 8px;
  border: 2px solid #d8ad5b;
  border-radius: 14px;
  color: #523a22;
  background: linear-gradient(180deg, rgba(255, 251, 218, 0.96), rgba(255, 230, 164, 0.94));
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.78), 0 3px 7px rgba(107, 71, 27, 0.1);
  cursor: pointer;
  text-align: left;
}

.barn-item:hover { border-color: #b57d2e; transform: translateY(-1px); }
.barn-item.selected {
  border-color: #4b982f;
  background: linear-gradient(180deg, #eef8bb, #cfe987);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.58), 0 3px 8px rgba(63, 117, 44, 0.18);
}

.barn-item-art {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 2px solid color-mix(in srgb, var(--barn-item-color) 62%, #9c692b);
  border-radius: 12px;
  background:
    radial-gradient(circle at 31% 24%, rgba(255, 255, 255, 0.9), transparent 29%),
    color-mix(in srgb, var(--barn-item-color) 42%, #fff1bd);
  font-size: 1.7rem;
  filter: drop-shadow(0 2px 1px rgba(75, 47, 21, 0.16));
}

.barn-item-copy { min-width: 0; }
.barn-item-copy strong,
.barn-item-copy small { display: block; }
.barn-item-copy strong { overflow: hidden; font-size: 0.76rem; line-height: 1.08; text-overflow: ellipsis; white-space: nowrap; }
.barn-item-copy small { margin-top: 4px; color: #8c7048; font-size: 0.57rem; font-weight: 750; }

.barn-item-count {
  min-width: 35px;
  padding: 5px 7px;
  border-radius: 8px;
  color: #5a401f;
  background: rgba(255, 248, 202, 0.83);
  font-size: 0.88rem;
  font-weight: 950;
  text-align: center;
}

.barn-empty {
  grid-column: 1 / -1;
  min-height: 210px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  border: 2px dashed rgba(174, 116, 43, 0.44);
  border-radius: 16px;
  color: #806342;
  background: rgba(255, 248, 213, 0.55);
  text-align: center;
}

.barn-empty > span { font-size: 2.5rem; }
.barn-empty p { margin: 0; font-size: 0.75rem; font-weight: 700; }

.barn-window-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 20px 15px;
  border-top: 2px solid rgba(184, 119, 40, 0.28);
  background: linear-gradient(180deg, #ffe5a8, #f5cd78);
}

.barn-selection-summary {
  color: #76552d;
  font-size: 0.72rem;
  font-weight: 850;
}

.barn-actions { display: flex; gap: 9px; }
.barn-sell-button {
  min-height: 42px;
  padding: 7px 18px;
  border: 3px solid #4b7b23;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(180deg, #9ad13e, #5da82d);
  box-shadow: inset 0 -4px 0 rgba(50, 112, 33, 0.28), 0 3px 0 #3b6b24;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 950;
  text-shadow: 0 2px 0 rgba(49, 91, 29, 0.58);
}

.barn-sell-button.secondary {
  border-color: #b1742d;
  background: linear-gradient(180deg, #f2b84d, #d88a27);
  box-shadow: inset 0 -4px 0 rgba(148, 82, 23, 0.22), 0 3px 0 #995c24;
  text-shadow: 0 2px 0 rgba(126, 73, 23, 0.48);
}

.barn-sell-button:disabled {
  border-color: #a99a7e;
  color: #766b58;
  background: #d7cbb1;
  box-shadow: none;
  cursor: default;
  text-shadow: none;
}

@media (max-width: 760px) {
  .barn-modal { padding: 7px; }
  .barn-dialog { max-height: calc(100vh - 14px); max-height: calc(100dvh - 14px); border-width: 3px; border-radius: 17px; }
  .barn-window-head { grid-template-columns: 1fr 44px; gap: 8px; padding: 11px 10px 9px 13px; }
  .barn-value { grid-column: 1 / -1; grid-row: 2; justify-content: space-between; padding: 6px 9px; }
  .barn-close { grid-column: 2; grid-row: 1; width: 42px; height: 42px; font-size: 1.7rem; }
  .barn-window-body { padding: 10px 9px 7px; }
  .barn-instructions { margin: 9px 0 8px; font-size: 0.75rem; }
  .barn-grid { max-height: 48vh; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .barn-item { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 6px; min-height: 62px; padding: 6px; }
  .barn-item-art { width: 40px; height: 40px; font-size: 1.45rem; }
  .barn-window-foot { align-items: stretch; flex-direction: column; gap: 8px; padding: 9px; }
  .barn-selection-summary { text-align: center; }
  .barn-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .barn-sell-button { min-width: 0; padding: 7px; }
}

@media (max-width: 430px) {
  .stage-corner-tooltip { min-width: 64px; padding: 4px 7px; font-size: 0.62rem; }
  .barn-grid { grid-template-columns: 1fr; }
  .barn-item-copy strong { font-size: 0.72rem; }
}

@media (prefers-reduced-motion: reduce) {
  .stage-corner-tooltip,
  .barn-capacity-track span { transition: none; }
}
/* End barn storage window. */
