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

body {
  background: #1a1a1a;
  color: #e0e0e0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  max-width: 960px;
  margin: 0 auto;
  padding: 16px;
}

h1 {
  color: #d4af37;
  margin-bottom: 4px;
  font-size: 1.6rem;
}

#updated {
  color: #888;
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.summary {
  color: #d4af37;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 20px;
}

.summary.all-complete {
  color: #22c55e;
}

/* Milestone sections */
.milestone {
  margin-bottom: 12px;
  border: 1px solid #333;
  border-radius: 6px;
  overflow: hidden;
}

.milestone-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #252525;
  cursor: pointer;
  user-select: none;
}

.milestone-header:hover {
  background: #2a2a2a;
}

.chevron {
  font-size: 0.8rem;
  color: #888;
  transition: transform 0.15s;
  flex-shrink: 0;
}

.milestone.expanded .chevron {
  transform: rotate(90deg);
}

.milestone-label {
  font-weight: 600;
  font-size: 1.05rem;
  color: #d4af37;
  min-width: 130px;
}

.progress-bar-container {
  flex: 1;
  height: 8px;
  background: #333;
  border-radius: 4px;
  overflow: hidden;
  min-width: 80px;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}

.progress-bar-fill.complete {
  background: #22c55e;
}

.progress-bar-fill.partial {
  background: #d4af37;
}

.milestone-summary {
  font-size: 0.85rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.milestone-summary.all-met {
  color: #22c55e;
}

.milestone-summary.has-missing {
  color: #f87171;
}

.milestone-body {
  display: none;
  padding: 12px 14px;
  background: #1e1e1e;
}

.milestone.expanded .milestone-body {
  display: block;
}

.section-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  margin-bottom: 8px;
  margin-top: 12px;
}

.section-label:first-child {
  margin-top: 0;
}

/* XP summary (top of page) */
#xp-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 0.85rem;
}

.xp-summary-total {
  color: #d4af37;
  font-weight: 600;
}

.xp-book-chip {
  padding: 2px 8px;
  border-radius: 10px;
  background: #252525;
  border-left: 3px solid #555;
  color: #e0e0e0;
  font-variant-numeric: tabular-nums;
}

.xp-book-chip.rarity-Mythic { border-left-color: #ff8c00; }
.xp-book-chip.rarity-Legendary { border-left-color: #3b82f6; }
.xp-book-chip.rarity-Epic { border-left-color: #a855f7; }
.xp-book-chip.rarity-Rare { border-left-color: #3b82f6; }
.xp-book-chip.rarity-Uncommon { border-left-color: #22c55e; }
.xp-book-chip.rarity-Common { border-left-color: #9ca3af; }

/* XP row (inside milestone body) */
.xp-row {
  background: #252525;
  border-radius: 5px;
  padding: 8px 12px;
  margin-bottom: 12px;
  border-left: 3px solid #555;
  font-size: 0.85rem;
}

.xp-row.met {
  border-left-color: #22c55e;
}

.xp-row.short {
  border-left-color: #f87171;
  background: rgba(248, 113, 113, 0.08);
}

.xp-row .section-label {
  margin: 0 0 4px 0;
}

.xp-row .xp-stat {
  color: #ccc;
}

.xp-row .xp-deficit {
  margin-top: 2px;
  font-weight: 600;
}

.xp-row.met .xp-deficit {
  color: #22c55e;
}

.xp-row.short .xp-deficit {
  color: #f87171;
}

/* Resource cards grid */
.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 4px;
}

.resource-card {
  background: #252525;
  border-radius: 5px;
  padding: 8px;
  text-align: center;
  border-left: 3px solid #555;
  position: relative;
  cursor: pointer;
}

.resource-card.met {
  opacity: 0.5;
}

.resource-card.deficit {
  background: rgba(248, 113, 113, 0.08);
}

/* Rarity border colors */
.resource-card.rarity-Mythic { border-left-color: #ff4444; }
.resource-card.rarity-Legendary { border-left-color: #ff8c00; }
.resource-card.rarity-Epic { border-left-color: #a855f7; }
.resource-card.rarity-Rare { border-left-color: #3b82f6; }
.resource-card.rarity-Uncommon { border-left-color: #22c55e; }
.resource-card.rarity-Common { border-left-color: #9ca3af; }

/* Tooltip */
.tooltip {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #333;
  border: 1px solid #555;
  border-radius: 5px;
  padding: 10px 14px;
  z-index: 10;
  white-space: nowrap;
  font-size: 0.85rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}


.tooltip-row {
  color: #e0e0e0;
  padding: 2px 0;
}

.tooltip-wiki-link {
  display: block;
  color: #d4af37;
  text-decoration: none;
  margin-top: 4px;
  font-size: 0.8rem;
}

.tooltip-wiki-link:hover {
  text-decoration: underline;
}

.resource-icon {
  width: 40px;
  height: 40px;
  display: block;
  margin: 0 auto 4px;
  image-rendering: pixelated;
}

.resource-name {
  font-size: 0.72rem;
  line-height: 1.2;
  color: #ccc;
  margin-bottom: 4px;
  min-height: 2.4em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.resource-amounts {
  font-size: 0.8rem;
  font-weight: 600;
}

.resource-amounts.ok {
  color: #22c55e;
}

.resource-amounts.short {
  color: #f87171;
}

.energy-label {
  font-size: 0.7rem;
  color: #d4af37;
  margin-top: 2px;
}

@media (max-width: 500px) {
  body {
    padding: 10px;
  }

  h1 {
    font-size: 1.3rem;
  }

  .resource-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 6px;
  }

  .milestone-label {
    min-width: 0;
    font-size: 0.95rem;
  }
}
