/* Divine Garden — full-bleed canvas + top HUD overlay */

.divine-garden {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  background: #1a2a1a;
}

.divine-garden.hidden {
  display: none !important;
}

#divine-garden-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.dg-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  max-height: min(42vh, 320px);
  overflow: auto;
  padding: 10px 12px 12px;
  border-radius: 0 0 16px 16px;
  pointer-events: auto;
  background: linear-gradient(180deg, rgba(20, 36, 22, 0.82), rgba(20, 36, 22, 0.55) 70%, transparent);
  border: none;
  box-shadow: none;
}

.dg-hud-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  color: #f5f5f0;
}

.dg-level {
  margin-left: auto;
  font-weight: 700;
  color: #ffd54f;
}

.dg-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}

.dg-stats > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.14);
  color: #f5f5f0;
}

.dg-stats .muted {
  color: rgba(245, 245, 240, 0.7);
  font-size: 0.72rem;
}

.dg-clocks,
.dg-status {
  margin: 3px 0;
  font-size: 0.88rem;
  color: rgba(245, 245, 240, 0.88);
}

.dg-result {
  margin: 6px 0;
  padding: 8px 10px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255, 236, 179, 0.92), rgba(255, 249, 230, 0.95));
  border: 1px solid rgba(201, 162, 39, 0.45);
  color: #3e2723;
}

.dg-result.hidden,
.dg-modal.hidden,
.hidden {
  display: none !important;
}

.dg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.dg-modal {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  background: rgba(8, 16, 10, 0.45);
}

.dg-modal-card {
  width: min(520px, 100%);
  max-height: min(78vh, 640px);
  overflow: auto;
  padding: 14px 14px 16px;
  border-radius: 16px;
  margin-bottom: 8px;
}

.dg-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.dg-modal-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.dg-modal-sub {
  margin: 0 0 10px;
  font-size: 0.88rem;
}

.dg-picker-card {
  width: min(720px, 100%);
}

.dg-picker-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 12px;
  align-items: start;
}

.dg-picker-preview-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 0;
}

#dg-picker-preview {
  width: 100%;
  height: 200px;
  border-radius: 14px;
  background: linear-gradient(180deg, #9fd4f0, #6db83a 70%, #5a9a32);
  display: block;
}

.dg-picker-preview-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dg-picker-preview-meta .dg-sp-price {
  font-weight: 700;
  color: #c9a227;
  font-size: 1.05rem;
}

.dg-picker-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 8px;
  max-height: min(52vh, 420px);
  overflow: auto;
  padding: 2px;
}

.dg-species-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 10px 8px;
  border-radius: 12px;
  border: 2px solid rgba(120, 120, 100, 0.35);
  background: rgba(255, 255, 255, 0.5);
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.dg-species-card.is-selected {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.dg-species-card.tier-1 {
  border-color: #9e9e9e;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.55), rgba(236, 239, 241, 0.65));
}
.dg-species-card.tier-2 {
  border-color: #66bb6a;
  background: linear-gradient(160deg, rgba(232, 245, 233, 0.75), rgba(255, 255, 255, 0.5));
}
.dg-species-card.tier-3 {
  border-color: #42a5f5;
  box-shadow: inset 0 0 0 1px rgba(66, 165, 245, 0.25);
  background: linear-gradient(160deg, rgba(227, 242, 253, 0.8), rgba(255, 255, 255, 0.5));
}
.dg-species-card.tier-4 {
  border-color: #ab47bc;
  box-shadow: inset 0 0 0 1px rgba(171, 71, 188, 0.3), 0 0 10px rgba(171, 71, 188, 0.15);
  background: linear-gradient(160deg, rgba(243, 229, 245, 0.85), rgba(255, 255, 255, 0.5));
}
.dg-species-card.tier-5 {
  border-color: #ffd54f;
  box-shadow: inset 0 0 0 1px rgba(255, 213, 79, 0.45), 0 0 14px rgba(255, 193, 7, 0.25);
  background: linear-gradient(160deg, rgba(255, 249, 230, 0.95), rgba(255, 236, 179, 0.55));
}

.dg-species-card:hover:not(:disabled) {
  filter: brightness(1.04);
}

.dg-species-card:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  filter: grayscale(0.35);
}

.dg-species-card strong {
  font-size: 0.9rem;
  line-height: 1.2;
}

.dg-species-card .dg-sp-price {
  font-weight: 700;
  color: #a67c00;
  font-size: 0.92rem;
}

@media (max-width: 560px) {
  .dg-picker-layout {
    grid-template-columns: 1fr;
  }
  #dg-picker-preview {
    height: 160px;
  }
}

.dg-tree-card {
  width: min(560px, 100%);
}

.dg-tree-body {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  align-items: start;
  margin-bottom: 10px;
}

#dg-tree-preview {
  width: 140px;
  height: 140px;
  border-radius: 12px;
  background: linear-gradient(180deg, #b3e5fc, #81c784);
  display: block;
}

.dg-tree-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  font-size: 0.9rem;
}

.dg-tree-stats div {
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.4);
}

.dg-tree-stats span {
  display: block;
  font-size: 0.72rem;
  opacity: 0.7;
}

.dg-tree-history {
  font-size: 0.85rem;
  margin-bottom: 10px;
  max-height: 88px;
  overflow: auto;
}

.dg-tree-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 520px) {
  .dg-tree-body {
    grid-template-columns: 1fr;
  }
  #dg-tree-preview {
    width: 100%;
    height: 160px;
  }
}

.dg-ftue {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(8, 16, 10, 0.55);
}

.dg-ftue-card {
  width: min(440px, 100%);
  max-height: 85vh;
  overflow: auto;
  padding: 16px;
  border-radius: 16px;
}

.dg-ftue-card h2 {
  margin: 0 0 8px;
}

.dg-ftue-card ul {
  margin: 8px 0;
  padding-left: 1.2rem;
}

.dg-history-card {
  width: min(520px, 100%);
}

.dg-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dg-history-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 8px 0;
}

.dg-history-stat {
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.35);
  font-size: 0.8rem;
}

.dg-history-stat strong {
  display: block;
  margin-top: 2px;
}

.dg-history-spark {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 48px;
  margin-bottom: 8px;
}

.dg-history-spark span {
  flex: 1;
  min-width: 4px;
  background: #66bb6a;
  border-radius: 3px 3px 0 0;
}

.dg-history-spark span.is-neg {
  background: #e57373;
}

.dg-history-panel-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow: auto;
}

.dg-history-item {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 4px 8px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.35);
  font-size: 0.85rem;
}

.dg-hi-pct.pos {
  color: #2e7d32;
}
.dg-hi-pct.neg {
  color: #c62828;
}
.dg-hi-meta {
  grid-column: 1 / -1;
  opacity: 0.75;
  font-size: 0.78rem;
}
.dg-hi-actions {
  grid-column: 1 / -1;
}

.dg-catchup-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0;
  max-height: 200px;
  overflow: auto;
}

.dg-catchup-row {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 4px 8px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.35);
  font-size: 0.88rem;
}

.dg-catchup-row.is-focus {
  outline: 2px solid rgba(201, 162, 39, 0.6);
}

.dg-catchup-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.dg-pulse {
  animation: dg-pulse 0.45s ease;
}

@keyframes dg-pulse {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.06);
  }
  100% {
    transform: scale(1);
  }
}

.dg-result-reveal {
  animation: dg-result-in 0.7s ease;
}

@keyframes dg-result-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.dg-hud.is-vip .dg-level {
  text-shadow: 0 0 10px rgba(255, 213, 79, 0.55);
}

.dg-hud.dg-vip-flash {
  box-shadow: inset 0 0 0 2px rgba(255, 213, 79, 0.55);
}
