:root {
  --bg-main: #0B1112;
  --bg-panel: #142022;
  --bg-card: #1B2B2D;
  --bg-card-hover: #213437;
  --border-stone: #3A4F52;

  /* The New Blue Color Scheme */
  --accent-primary: #456ba9;
  --accent-glow: #5d87cb;
  --text-accent: #86aeea;

  --text-primary: #E2E8F0;
  --text-secondary: #8A9F9F;

  --font-header: 'Cinzel', 'Georgia', serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

* {
  -ms-overflow-style: none;
  /* Internet Explorer and Edge */
  scrollbar-width: none;
  /* Firefox */
}

*::-webkit-scrollbar {
  display: none;
  /* Chrome, Safari, and Opera */
}

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-body);
  height: 100vh;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

.app-viewport {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Header Component */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background-color: var(--bg-panel);
  border-bottom: 2px solid var(--accent-primary);
}

.zone-branding {
  display: flex;
  align-items: center;
  gap: 15px;
}

.brand-logo {
  height: 40px;
  width: auto;
  object-fit: contain;
}

.zone-branding h1 {
  font-family: var(--font-header);
  color: var(--accent-primary);
  font-size: 24px;
}

.author-tag {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 1px;
}

.tribute-tablet {
  background-color: var(--bg-card);
  border: 1px solid var(--border-stone);
  border-radius: 4px;
  padding: 8px 15px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.tribute-tablet p {
  font-size: 12px;
}

/* Split Workspace */
.workspace-split {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar Component */
.app-sidebar {
  width: 35%;
  max-width: 400px;
  background-color: var(--bg-panel);
  border-right: 2px solid var(--border-stone);
  display: flex;
  flex-direction: column;
}

.filter-controls-box {
  padding: 15px;
  border-bottom: 2px solid var(--border-stone);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filter-controls-box input,
.filter-controls-box select {
  width: 100%;
  padding: 10px;
  background: var(--bg-main);
  border: 1px solid var(--border-stone);
  color: var(--text-primary);
  border-radius: 4px;
}

.filter-controls-box input:focus,
.filter-controls-box select:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.list-view {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.tree-card {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-stone);
  border-radius: 4px;
  padding: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.tree-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary);
  transform: translateX(5px);
}

.card-img-placeholder {
  width: 48px;
  height: 48px;
  background: var(--bg-main);
  margin-right: 15px;
  border: 1px solid var(--border-stone);
  border-radius: 4px;
  object-fit: contain;
  padding: 2px;
}

.card-details h4 {
  font-family: var(--font-header);
  color: var(--text-primary);
}

.tree-card:hover .card-details h4 {
  color: var(--accent-primary);
}

.wood-badge {
  font-size: 11px;
  background: var(--bg-main);
  padding: 3px 6px;
  border-radius: 4px;
  color: var(--text-secondary);
  margin-top: 4px;
  display: inline-block;
}

/* Detail Panel Component */
.app-detail-panel {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
}

.empty-state {
  text-align: center;
  margin-top: 15%;
  color: var(--text-secondary);
  opacity: 0.5;
}

.empty-state img {
  max-width: 150px;
  margin-bottom: 20px;
  filter: grayscale(100%);
}

.detail-header-ribbon {
  border-bottom: 2px solid var(--border-stone);
  padding-bottom: 10px;
  margin-bottom: 25px;
}

.detail-header-ribbon h2 {
  font-family: var(--font-header);
  color: var(--accent-primary);
  font-size: 36px;
}

#dt-extra-info {
  color: var(--text-secondary);
  font-style: italic;
  font-size: 14px;
  margin-top: 5px;
}

/* Primary View */
.primary-data-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 25px;
  margin-bottom: 30px;
}

.main-image-showcase {
  background: var(--bg-card);
  border: 1px solid var(--border-stone);
  border-radius: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  min-height: 350px;
  box-shadow: inset 0 4px 10px rgba(0, 0, 0, 0.4);
}

.main-image-showcase img {
  max-width: 100%;
  max-height: 400px;
  object-fit: contain;
}

.main-stats-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.grid-sector {
  background: var(--bg-card);
  border: 1px solid var(--border-stone);
  padding: 20px;
  border-radius: 4px;
}

.grid-sector h3 {
  font-family: var(--font-header);
  font-size: 18px;
  margin-bottom: 15px;
  color: var(--text-accent);
  border-bottom: 1px solid var(--border-stone);
  padding-bottom: 8px;
}

.tile {
  background: var(--bg-main);
  border: 1px solid var(--border-stone);
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 14px;
  border-radius: 2px;
}

.tile strong {
  color: var(--text-secondary);
  margin-right: 5px;
}

.drop-metrics-matrix {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.drop-metrics-matrix h3 {
  grid-column: 1 / -1;
  margin-bottom: 5px;
}

.loot-slot {
  display: flex;
  align-items: center;
  background: var(--bg-main);
  border: 1px solid var(--border-stone);
  padding: 10px;
  font-size: 14px;
  font-weight: bold;
  border-radius: 2px;
}

.loot-icon {
  width: 24px;
  height: 24px;
  margin-right: 10px;
  object-fit: contain;
}

/* Secondary View (Stages) */
.secondary-stages-view {
  background: var(--bg-panel);
  border: 1px solid var(--border-stone);
  padding: 20px;
  border-radius: 4px;
}

.secondary-stages-view h3 {
  font-family: var(--font-header);
  color: var(--text-secondary);
  margin-bottom: 15px;
  font-size: 16px;
}

.timeline-nodes {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.node-btn {
  flex: 1;
  background: var(--bg-main);
  color: var(--text-secondary);
  border: 1px solid var(--border-stone);
  padding: 10px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.node-btn:hover {
  border-color: var(--accent-primary);
}

.node-btn.active {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-glow);
}

.matrix-tray {
  display: flex;
  flex-direction: column;
  gap: 15px;
  background: var(--bg-main);
  padding: 15px;
  border: 1px solid var(--border-stone);
  border-radius: 4px;
}

.rule-group p {
  color: var(--text-primary);
  font-weight: bold;
  margin-top: 5px;
}

.tray-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.persistent-badge {
  font-size: 12px;
  color: var(--accent-glow);
  padding-top: 10px;
  border-top: 1px solid var(--border-stone);
}

.growth-requirements-section {
  padding: 20px;
}

.req-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.req-row {
  display: flex;
  gap: 12px;
  width: 100%;
}

.req-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-main);
  border: 1px solid var(--border-stone);
  padding: 12px 16px;
  border-radius: 4px;
  flex: 1;
}

.req-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.req-text {
  display: flex;
  flex-direction: column;
}

.req-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.req-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Warning Hint Box */
.growth-hint {
  margin-top: 15px;
  padding: 12px;
  background: rgba(235, 158, 48, 0.08);
  border-left: 4px solid #eb9e30;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.4;
  color: #f1b256;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* --- Collapsible Stages Section --- */
.collapsible-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding-bottom: 5px;
  transition: opacity 0.2s;
}

.collapsible-header:hover {
  opacity: 0.8;
}

.collapsible-header h3 {
  margin-bottom: 0 !important;
  /* Overrides previous spacing */
}

.toggle-icon {
  color: var(--text-secondary);
  font-size: 14px;
  transition: transform 0.3s ease;
}

/* When the .collapsed class is applied, rotate the arrow */
.collapsible-header.collapsed .toggle-icon {
  transform: rotate(-90deg);
}

.collapsible-content {
  margin-top: 15px;
  display: block;
  /* Visible by default */
}

.collapsible-content.hidden-collapse {
  display: none;
}

/* --- Learn More Section --- */
.learn-more-section {
  background: var(--bg-panel);
  border: 1px solid var(--border-stone);
  padding: 20px;
  border-radius: 4px;
  margin-top: 25px;
}

.learn-more-section h3 {
  font-family: var(--font-header);
  color: var(--text-accent);
  margin-bottom: 10px;
  font-size: 18px;
  border-bottom: 1px solid var(--border-stone);
  padding-bottom: 8px;
}

.learn-more-text {
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 15px;
  line-height: 1.5;
}

.video-container {
  position: relative;
  padding-bottom: 56.25%;
  /* Forces a perfect 16:9 Aspect Ratio */
  height: 0;
  overflow: hidden;
  border-radius: 4px;
  border: 1px solid var(--border-stone);
  background: #000;
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Mobile Menu Toggle Button (Hidden on Desktop) */
.mobile-menu-btn {
  display: none;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-stone);
  padding: 6px 12px;
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  margin-left: 15px;
  transition: all 0.2s;
}

.mobile-menu-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* =========================================
   MOBILE RESPONSIVENESS
   ========================================= */
@media (max-width: 768px) {

  /* Keep header horizontal but hide the tribute zone */
  .app-header {
    flex-direction: row;
    padding: 10px 15px;
  }

  .zone-tribute {
    display: none;
    /* Hides the tribute on mobile */
  }

  /* Stretch branding zone to push the button to the right side */
  .zone-branding {
    width: 100%;
    justify-content: space-between;
  }

  /* Show the toggle button */
  .mobile-menu-btn {
    display: inline-block;
  }

  /* Stack the main workspace vertically */
  .workspace-split {
    flex-direction: column;
  }

  /* Transform sidebar into an animated, collapsible top list */
  .app-sidebar {
    width: 100%;
    max-width: none;
    border-right: none;
    border-bottom: 2px solid var(--border-stone);

    /* Animation Properties */
    max-height: 45vh;
    opacity: 1;
    transition: max-height 0.3s ease-in-out, opacity 0.2s ease-in-out;
  }

  /* The class JavaScript will add to hide the sidebar */
  .app-sidebar.collapsed-mobile {
    max-height: 0;
    opacity: 0;
    border-bottom: none;
  }

  /* Detail panel formatting */
  .app-detail-panel {
    padding: 15px;
  }

  .detail-header-ribbon h2 {
    font-size: 28px;
    text-align: center;
  }

  /* Collapse the 2-column grids to 1 column */
  .primary-data-view {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  /* Main image container adjustment */
  .main-image-showcase {
    min-height: 250px;
  }

  /* Stack requirement rows instead of side-by-side */
  .req-row {
    flex-direction: column;
  }

  /* Ensure timeline buttons wrap neatly instead of squishing */
  .timeline-nodes {
    flex-wrap: wrap;
  }

  .node-btn {
    flex: 1 1 30%;
    /* Forces buttons to wrap to next line if needed */
    padding: 8px;
    font-size: 13px;
  }
}