body {
  font-family: Arial, sans-serif;
  background: #f8f8f8;
  margin: 0;
  padding: 0;
  transition: background-color 0.3s, color 0.3s;
}

body.dark-mode {
  background: #1a1a1a;
  color: #e0e0e0;
}

.container {
  max-width: 600px;
  margin: 2rem auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  padding: 2rem;
  transition: background-color 0.3s, box-shadow 0.3s;
}

.dark-mode .container {
  background: #2d2d2d;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

h1 {
  text-align: center;
  margin-bottom: 1.5rem;
  color: #333;
}

.dark-mode h1 {
  color: #e0e0e0;
}

/* Progress Section */
#progress-section {
  margin-bottom: 2rem;
  padding: 1rem;
  background: #f0f8ff;
  border-radius: 6px;
  border-left: 4px solid #1976d2;
}

.dark-mode #progress-section {
  background: #1e3a5f;
  border-left-color: #42a5f5;
}

#progress-bar-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

#progress-bar {
  flex: 1;
  height: 20px;
  background: #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
}

.dark-mode #progress-bar {
  background: #404040;
}

#progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4caf50, #8bc34a);
  width: 0%;
  transition: width 0.5s ease;
}

#progress-text {
  font-weight: bold;
  color: #1976d2;
  min-width: 80px;
}

.dark-mode #progress-text {
  color: #42a5f5;
}

#category-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.5rem;
  font-size: 0.9em;
}

.category-stat {
  background: rgba(25, 118, 210, 0.1);
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  text-align: center;
}

.dark-mode .category-stat {
  background: rgba(66, 165, 245, 0.2);
}

/* Controls Section */
#controls-section {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #fff8e1;
  border-radius: 6px;
  border-left: 4px solid #ff9800;
}

.dark-mode #controls-section {
  background: #2d2416;
  border-left-color: #ffb74d;
}

#theme-toggle {
  background: #9c27b0;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  cursor: pointer;
  margin-bottom: 1rem;
  font-size: 0.9em;
}

#theme-toggle:hover {
  background: #7b1fa2;
}

#search-filter {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

#search-box, select {
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9em;
}

.dark-mode #search-box, .dark-mode select {
  background: #404040;
  border-color: #666;
  color: #e0e0e0;
}

#data-controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

#data-controls button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8em;
}

#export-btn {
  background: #4caf50;
  color: white;
}

#import-btn {
  background: #2196f3;
  color: white;
}

#clearBtn {
  background: #f44336;
  color: white;
}

/* Next Steps Section */
#next-steps-section {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #e8f5e8;
  border-radius: 6px;
  border-left: 4px solid #4caf50;
}

.dark-mode #next-steps-section {
  background: #1b2e1b;
  border-left-color: #66bb6a;
}

#next-steps-section h3 {
  margin: 0 0 1rem 0;
  color: #2e7d32;
}

.dark-mode #next-steps-section h3 {
  color: #66bb6a;
}

#recommendations {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.5rem;
}

.recommendation {
  background: rgba(76, 175, 80, 0.1);
  padding: 0.5rem;
  border-radius: 4px;
  border: 1px solid #4caf50;
  cursor: pointer;
  transition: background-color 0.2s;
}

.recommendation:hover {
  background: rgba(76, 175, 80, 0.2);
}

.dark-mode .recommendation {
  background: rgba(102, 187, 106, 0.2);
  border-color: #66bb6a;
}

/* Path Optimizer Section */
#path-optimizer-section {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #f3e5f5;
  border-radius: 6px;
  border-left: 4px solid #9c27b0;
}

.dark-mode #path-optimizer-section {
  background: #2d1b2f;
  border-left-color: #ba68c8;
}

#path-optimizer-section h3 {
  margin: 0 0 1rem 0;
  color: #7b1fa2;
}

.dark-mode #path-optimizer-section h3 {
  color: #ba68c8;
}

#target-chicken {
  width: 70%;
  margin-right: 0.5rem;
}

#optimize-btn {
  background: #9c27b0;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
}

#optimal-path {
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(156, 39, 176, 0.1);
  border-radius: 4px;
  display: none;
}

.dark-mode #optimal-path {
  background: rgba(186, 104, 200, 0.2);
}

#checklist {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chicken-item {
  display: flex;
  flex-direction: column;
  background: #f0f0f0;
  border-radius: 4px;
  padding: 0.5rem 1rem;
}

.dark-mode .chicken-item {
  background: #3a3a3a;
  color: #e0e0e0;
}
.chicken-item .main-content {
  display: flex;
  align-items: center;
}
.chicken-item input[type="checkbox"] {
  margin-right: 1rem;
}
.chicken-item label {
  flex: 1;
  padding: 0.2rem 0;
}
.chicken-item label:hover {
  color: #007acc;
}

.dark-mode .chicken-item label:hover {
  color: #4fc3f7;
}

.breeding-info {
  background: #e8e8e8;
  padding: 0.3rem 0.5rem;
  border-radius: 3px;
  margin-top: 0.3rem;
  border-left: 3px solid #007acc;
}

.dark-mode .breeding-info {
  background: #2a2a2a;
  color: #e0e0e0;
  border-left-color: #4fc3f7;
}
.crafting-tree {
  background: #f8f8f8;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 1rem;
  margin-top: 0.5rem;
  max-height: 400px;
  overflow-y: auto;
  font-family: 'Courier New', monospace;
  font-size: 0.8em;
  line-height: 1.4;
}

.dark-mode .crafting-tree {
  background: #2a2a2a;
  border-color: #555;
  color: #e0e0e0;
}

.tree-root {
  position: relative;
}

.tree-target {
  font-size: 1.1em;
  padding: 0.5rem;
  background: #e3f2fd;
  border-radius: 4px;
  margin-bottom: 1rem;
  text-align: center;
  border: 2px solid #1976d2;
}

.dark-mode .tree-target {
  background: #1e3a5f;
  border-color: #42a5f5;
  color: #e0e0e0;
}

.tree-branches {
  position: relative;
}

.tree-branch {
  margin: 0.5rem 0;
  position: relative;
}

.tree-branch::before {
  content: '';
  position: absolute;
  top: 0;
  left: 15px;
  width: 1px;
  height: 100%;
  background: #999;
  z-index: 1;
}

.tree-branch:last-child::before {
  height: 20px;
}

.tree-node {
  margin: 0.1rem 0;
  padding: 0.1rem 0;
  white-space: nowrap;
}

.tree-node-visual {
  position: relative;
  margin: 0.3rem 0;
  padding: 0.3rem;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 3px;
  border-left: 3px solid #ccc;
}

.dark-mode .tree-node-visual {
  background: rgba(64, 64, 64, 0.7);
  border-left-color: #666;
  color: #e0e0e0;
}

.tree-connector {
  position: absolute;
  left: -25px;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
  font-weight: bold;
}

.tree-content {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.tree-prefix {
  color: #999;
  font-weight: bold;
  white-space: pre;
}

.tree-icon {
  margin-right: 0.3rem;
  font-size: 1.1em;
}

.tree-name {
  font-weight: bold;
  margin-right: 0.5rem;
  color: #333;
}

.dark-mode .tree-name {
  color: #e0e0e0;
}

.tree-recipe {
  color: #666;
  font-style: italic;
  font-size: 0.9em;
}

.dark-mode .tree-recipe {
  color: #aaa;
}

.tree-recipe-detail {
  color: #666;
  font-style: italic;
  font-size: 0.85em;
  margin-left: 1.5rem;
  margin-top: 0.2rem;
  flex-basis: 100%;
}

.dark-mode .tree-recipe-detail {
  color: #aaa;
}

/* Type-specific styling */
.tree-found {
  border-left-color: #2e8b57;
}

.tree-found .tree-name {
  color: #2e8b57;
}

.tree-crafted {
  border-left-color: #4682b4;
}

.tree-crafted .tree-name {
  color: #4682b4;
}

.tree-bred {
  border-left-color: #8b4513;
}

.tree-bred .tree-name {
  color: #8b4513;
}

.tree-unobtainable {
  border-left-color: #cd5c5c;
}

.tree-unobtainable .tree-name {
  color: #cd5c5c;
}

.tree-circular {
  border-left-color: #ff6347;
}

.tree-circular .tree-name {
  color: #ff6347;
}
.tree-stats {
  background: #e3f2fd;
  padding: 0.3rem 0.5rem;
  border-radius: 3px;
  margin-top: 0.3rem;
  font-size: 0.75em;
  color: #1976d2;
}

.dark-mode .tree-stats {
  background: #1e3a5f;
  color: #42a5f5;
}
.show-tree-btn {
  background: #4caf50;
  color: white;
  border: none;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.7em;
  margin-left: 0.5rem;
}
.show-tree-btn:hover {
  background: #45a049;
}
#clearBtn {
  display: block;
  margin: 2rem auto 0 auto;
  padding: 0.5rem 2rem;
  background: #e74c3c;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
}
#clearBtn:hover {
  background: #c0392b;
}
@media (max-width: 600px) {
  .container {
    max-width: 98vw;
    padding: 1rem;
  }
  h1 {
    font-size: 1.3rem;
  }
}

/* New Feature Styles */

/* Achievement System */
#achievements-section {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #fff3e0;
  border-radius: 6px;
  border-left: 4px solid #ff9800;
}

.dark-mode #achievements-section {
  background: #2d1f0a;
  border-left-color: #ffb74d;
}

#achievements-section h3 {
  margin: 0 0 1rem 0;
  color: #f57c00;
}

.dark-mode #achievements-section h3 {
  color: #ffb74d;
}

#achievement-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.5rem;
}

.achievement {
  display: flex;
  align-items: center;
  padding: 0.5rem;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.achievement.unlocked {
  background: rgba(76, 175, 80, 0.1);
  border: 1px solid #4caf50;
}

.achievement.locked {
  background: rgba(158, 158, 158, 0.1);
  border: 1px solid #9e9e9e;
  opacity: 0.6;
}

.dark-mode .achievement.unlocked {
  background: rgba(102, 187, 106, 0.2);
  border-color: #66bb6a;
}

.dark-mode .achievement.locked {
  background: rgba(97, 97, 97, 0.2);
  border-color: #616161;
}

.achievement-icon {
  font-size: 1.5em;
  margin-right: 0.5rem;
}

.achievement-name {
  font-weight: bold;
  margin-bottom: 0.2rem;
}

.achievement-description {
  font-size: 0.8em;
  color: #666;
}

.dark-mode .achievement-description {
  color: #aaa;
}

.achievement-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #4caf50;
  color: white;
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  max-width: 300px;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 1000;
}

.achievement-notification.show {
  transform: translateX(0);
}

.achievement-notification .achievement-icon {
  font-size: 2em;
  margin-right: 1rem;
}

.achievement-title {
  font-weight: bold;
  font-size: 1.1em;
}

.achievement-desc {
  font-size: 0.9em;
  opacity: 0.9;
}

/* Priority Queue */
#priority-queue-section {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #e8f5e8;
  border-radius: 6px;
  border-left: 4px solid #4caf50;
}

.dark-mode #priority-queue-section {
  background: #1b2e1b;
  border-left-color: #66bb6a;
}

#priority-queue-section h3 {
  margin: 0 0 0.5rem 0;
  color: #2e7d32;
}

.dark-mode #priority-queue-section h3 {
  color: #66bb6a;
}

#priority-queue-section p {
  margin: 0 0 1rem 0;
  font-size: 0.9em;
  color: #4caf50;
}

.dark-mode #priority-queue-section p {
  color: #81c784;
}

#priority-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.priority-item {
  display: flex;
  align-items: center;
  padding: 0.5rem;
  background: rgba(76, 175, 80, 0.1);
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
  border-left: 3px solid #81c784;
}

.priority-item.can-breed {
  border-left-color: #4caf50;
  background: rgba(76, 175, 80, 0.2);
}

.priority-item:hover {
  background: rgba(76, 175, 80, 0.3);
}

.dark-mode .priority-item {
  background: rgba(102, 187, 106, 0.2);
  border-left-color: #81c784;
}

.dark-mode .priority-item.can-breed {
  background: rgba(102, 187, 106, 0.3);
  border-left-color: #66bb6a;
}

.priority-rank {
  font-weight: bold;
  color: #2e7d32;
  margin-right: 0.5rem;
  min-width: 30px;
}

.dark-mode .priority-rank {
  color: #81c784;
}

.priority-content {
  flex: 1;
}

.priority-name {
  font-weight: bold;
  margin-bottom: 0.2rem;
}

.priority-recipe {
  font-size: 0.8em;
  color: #4caf50;
  margin-bottom: 0.1rem;
}

.dark-mode .priority-recipe {
  color: #81c784;
}

.priority-meta {
  font-size: 0.7em;
  color: #666;
}

.dark-mode .priority-meta {
  color: #aaa;
}

/* Enhanced Statistics */
#enhanced-stats-section {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #f3e5f5;
  border-radius: 6px;
  border-left: 4px solid #9c27b0;
}

.dark-mode #enhanced-stats-section {
  background: #2d1b2f;
  border-left-color: #ba68c8;
}

#enhanced-stats-section h3 {
  margin: 0 0 1rem 0;
  color: #7b1fa2;
}

.dark-mode #enhanced-stats-section h3 {
  color: #ba68c8;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}

.stats-card {
  background: rgba(156, 39, 176, 0.1);
  padding: 1rem;
  border-radius: 6px;
  border: 1px solid #ce93d8;
}

.dark-mode .stats-card {
  background: rgba(186, 104, 200, 0.2);
  border-color: #ba68c8;
}

.stats-card h4 {
  margin: 0 0 0.5rem 0;
  color: #7b1fa2;
}

.dark-mode .stats-card h4 {
  color: #ba68c8;
}

.category-row, .difficulty-row, .type-row {
  display: grid;
  grid-template-columns: 100px 1fr 60px;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}

.category-label, .difficulty-label, .type-label {
  font-size: 0.8em;
  font-weight: bold;
}

.mini-progress-bar {
  height: 16px;
  background: #e0e0e0;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.dark-mode .mini-progress-bar {
  background: #404040;
}

.mini-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #9c27b0, #ba68c8);
  transition: width 0.3s ease;
}

.mini-progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.7em;
  font-weight: bold;
  color: white;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
}

.category-count, .difficulty-count, .type-count {
  font-size: 0.8em;
  text-align: right;
  color: #666;
}

.dark-mode .category-count, 
.dark-mode .difficulty-count, 
.dark-mode .type-count {
  color: #aaa;
}

.missing-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0;
  border-bottom: 1px solid rgba(156, 39, 176, 0.2);
}

.missing-item:last-child {
  border-bottom: none;
}

.dark-mode .missing-item {
  border-bottom-color: rgba(186, 104, 200, 0.3);
}

.missing-name {
  font-weight: bold;
}

.missing-impact {
  font-size: 0.8em;
  color: #9c27b0;
}

.dark-mode .missing-impact {
  color: #ba68c8;
}

/* Advanced Search */
#advanced-search-section {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #e1f5fe;
  border-radius: 6px;
  border-left: 4px solid #03a9f4;
}

.dark-mode #advanced-search-section {
  background: #0d2d3d;
  border-left-color: #29b6f6;
}

#advanced-search-section h3 {
  margin: 0 0 1rem 0;
  color: #0277bd;
}

.dark-mode #advanced-search-section h3 {
  color: #29b6f6;
}

#advanced-search-controls {
  display: grid;
  grid-template-columns: 2fr 2fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

#advanced-search-input, #advanced-search-type {
  padding: 0.5rem;
  border: 1px solid #81d4fa;
  border-radius: 4px;
  font-size: 0.9em;
}

.dark-mode #advanced-search-input, 
.dark-mode #advanced-search-type {
  background: #404040;
  border-color: #29b6f6;
  color: #e0e0e0;
}

#advanced-search-btn {
  background: #03a9f4;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
}

#advanced-search-btn:hover {
  background: #0288d1;
}

#advanced-search-results {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #81d4fa;
  border-radius: 4px;
  background: rgba(3, 169, 244, 0.05);
}

.dark-mode #advanced-search-results {
  border-color: #29b6f6;
  background: rgba(41, 182, 246, 0.1);
}

.search-result {
  display: grid;
  grid-template-columns: 2fr 2fr 1fr;
  gap: 0.5rem;
  padding: 0.5rem;
  border-bottom: 1px solid rgba(3, 169, 244, 0.2);
  cursor: pointer;
  transition: background-color 0.2s;
}

.search-result:hover {
  background: rgba(3, 169, 244, 0.1);
}

.search-result:last-child {
  border-bottom: none;
}

.dark-mode .search-result {
  border-bottom-color: rgba(41, 182, 246, 0.3);
}

.dark-mode .search-result:hover {
  background: rgba(41, 182, 246, 0.2);
}

.result-chicken {
  font-weight: bold;
}

.result-relevance {
  font-size: 0.9em;
  color: #0277bd;
}

.dark-mode .result-relevance {
  color: #4fc3f7;
}

.result-type {
  font-size: 0.8em;
  color: #666;
  text-align: right;
}

.dark-mode .result-type {
  color: #aaa;
}