body {
  font-family: 'Open Sans', sans-serif;
  color: #ffffff;
  background: #000000;
}

header {
  text-align: center;
  padding: 40px 0;
}

.logo-text {
  font-size: 48px;
  color: #fff;
}

.controls {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

input, select {
  margin: 10px;
  padding: 8px;
  background: #000;
  color: #fff;
  border: 1px solid #555;
}

.card-container {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 15px;
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.food-card {
  background: #2a2a2a;
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  width: 200px;
  height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  border: 2px solid #3d3d3d;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  margin: 0 auto;
}

.food-card:hover {
  background: #333333;
  border-color: #d4a168;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.food-content {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 120px;
}

.food-info {
  width: 50%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.food-name {
  position: static;
  width: 100%;
  text-align: center;
  font-size: 1.1em;
  line-height: 1.2;
  font-family: 'Belisa Plumilla Manual', 'Arial', cursive;
  text-shadow: 1px 1px 2px #000;
  color: #d4a168;
  margin-top: 10px;
  padding: 0 5px;
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  min-height: 2.4em;
}

.food-img {
  width: 90px;
  height: 90px;
  object-fit: contain;
  image-rendering: pixelated;
  background-color: #1a1a1a;
  border-radius: 8px;
  padding: 5px;
  border: 1px solid #3d3d3d;
}

.stats {
  width: 50%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  align-content: center;
  justify-content: center;
  padding: 5px;
}

.stat {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat img {
  width: 38px;
  height: 38px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  image-rendering: pixelated;
}

.stat span {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 14px;
  color: #fff;
  text-shadow: 1px 1px 1px #000;
  font-weight: bold;
  z-index: 1;
  font-family: monospace;
}

.food-details {
  position: fixed;
  top: 100px;
  width: 360px;
  background: rgba(0,0,0,0.9);
  border: 2px solid #8b4513;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  display: none;
  transition: opacity 0.3s, left 0.3s, right 0.3s;
  opacity: 0;
  pointer-events: none;
  z-index: 1000;
}

.food-details.active {
  display: block;
  opacity: 1;
}

.stats-detail {
  margin: 15px 0;
  padding: 10px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  font-size: 1.1em;
  line-height: 1.6;
}

.stats-detail div {
  margin: 5px 0;
  display: flex;
  justify-content: space-between;
}

.food-details h2 {
  margin: 0 0 20px;
  text-align: center;
  font-family: 'Belisa Plumilla Manual', cursive;
  font-size: 1.8em;
  color: #fff;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
  padding-right: 30px;
}

.food-details h3 {
  margin: 15px 0 10px;
  color: #d4a168;
  font-size: 1.2em;
  border-bottom: 1px solid #8b4513;
  padding-bottom: 5px;
}

.food-details .recipe-list {
  margin: 15px 0;
}

.food-details .recipe {
  display: flex;
  gap: 15px;
  margin-bottom: 10px;
  padding: 5px;
  background: rgba(255,255,255,0.05);
  border-radius: 4px;
  justify-content: center;
}

.food-details .recipe-item {
  width: 48px;
  height: 48px;
  background: #000;
  border: 1px solid #8b4513;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.food-details .recipe-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.restrictions, .notes {
  margin: 10px 0;
  line-height: 1.5;
  color: #ccc;
}


@media (max-width: 1200px) {
  .card-container {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 960px) {
  .card-container {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 720px) {
  .card-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .card-container {
    grid-template-columns: repeat(1, 1fr);
  }
}

@media (max-width: 768px) {
  .food-details {
    position: fixed;
    top: 50%;
    left: 50% !important;
    right: auto !important;
    transform: translate(-50%, -50%) !important;
    max-height: 85vh;
    width: min(calc(100vw - 32px), 360px) !important;
    margin: 0;
    padding: 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    
    font-size: 14px;
    display: grid;
    grid-template-areas: 
      "title title"
      "stats recipe"
      "restrictions restrictions"
      "notes notes";
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    background: rgba(0,0,0,0.95);
  }
  
  .food-details.active {
    position: fixed;
    left: 50% !important;
    right: auto !important;
  }
  
  .food-card {
    width: calc(50% - 20px);
    min-width: 140px;
    max-width: 200px;
    height: 140px;
    margin: 10px;
    padding: 8px;
  }

  .food-img {
    width: 70px;
    height: 70px;
  }

  .stat {
    width: 32px;
    height: 32px;
  }

  .stat img {
    width: 32px;
    height: 32px;
  }

  .food-name {
    font-size: 0.9em;
    margin-top: 5px;
    min-height: 2em;
  }

  .card-container {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    padding: 10px;
  }

  .controls {
    padding: 10px;
  }

  input, select {
    margin: 5px;
    padding: 6px;
    font-size: 14px;
  }

  .food-details .recipe-item {
    width: 40px;
    height: 40px;
  }

  .food-details h2 {
    font-size: 1.3em;
    margin: 0 0 8px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #8b4513;
  }

  .food-details .stats-detail {
    grid-area: stats;
    margin: 0;
    padding: 8px;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
  }

  .food-details .stats-detail div {
    margin: 2px 0;
    font-size: 0.9em;
  }

  .food-details .recipe-list {
    grid-area: recipe;
    margin: 0;
  }

  .food-details .recipe-list h3 {
    font-size: 1em;
    margin: 0 0 4px 0;
  }

  .food-details .recipe {
    gap: 4px;
    margin-bottom: 4px;
    padding: 4px;
  }

  .food-details .recipe-item {
    width: 36px;
    height: 36px;
  }

  .food-details .restrictions {
    grid-area: restrictions;
    margin: 0;
    font-size: 0.9em;
  }

  .food-details .notes {
    grid-area: notes;
    margin: 0;
    font-size: 0.9em;
  }

  .food-details h3 {
    font-size: 1em;
    margin: 4px 0;
    padding-bottom: 2px;
  }

  .food-details::-webkit-scrollbar {
    width: 6px;
  }

  .food-details::-webkit-scrollbar-thumb {
    background: #8b4513;
    border-radius: 3px;
  }

  .food-details::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
  }

  .food-details .close-btn {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(139, 69, 19, 0.6);
    border: 1px solid #8b4513;
    color: #fff;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: all 0.2s;
  }

  @media (max-width: 768px) {
    .food-details .close-btn {
      display: flex;
    }
  }

  .logo-text {
    display: none;
  }
  
  header {
    padding: 10px 0;
  }
}

@media (max-width: 360px) {
  .food-details {
    width: calc(100vw - 24px) !important;
    padding: 10px;
    grid-template-areas: 
      "title"
      "stats"
      "recipe"
      "restrictions"
      "notes";
    grid-template-columns: 1fr;
  }

  .food-details .recipe-item {
    width: 32px;
    height: 32px;
  }
}

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

.modal-overlay.active {
  display: block;
}

.food-details .close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(139, 69, 19, 0.6);
  border: 1px solid #8b4513;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: all 0.2s;
}

.food-details .close-btn:hover {
  background: rgba(139, 69, 19, 0.8);
  transform: scale(1.1);
}

.restrictions-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.restriction-item {
  position: relative;
  width: 40px;
  height: 40px;
  background: #1a1a1a;
  border: 1px solid #3d3d3d;
  border-radius: 4px;
  overflow: hidden;
}

.restriction-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.restriction-item .donot-icon {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.8;
}

@media (max-width: 768px) {
  .restriction-item {
    width: 32px;
    height: 32px;
  }
}

.recipe-item, .restriction-item {
  position: relative;
  width: 40px;
  height: 40px;
  overflow: hidden;
}

.frame-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ingredient-img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  height: 80%;
  object-fit: contain;
}

.restriction-item .donot-icon {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.8;
}

@media (max-width: 768px) {
  .recipe-item, .restriction-item {
    width: 32px;
    height: 32px;
  }
}

.ingredients-filter {
  margin: 15px auto;
  max-width: 800px;
}

.toggle-btn {
  background: #2a2a2a;
  color: #d4a168;
  border: 1px solid #8b4513;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s;
}

.toggle-btn:hover {
  background: #3d3d3d;
}

.ingredients-container {
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  padding: 15px;
  background: rgba(0,0,0,0.3);
  border-radius: 8px;
  margin-top: 10px;
}

.ingredients-container.active {
  display: grid;
}

.ingredient-item {
  position: relative;
  width: 80px;
  height: 80px;
  background: #2a2a2a;
  border: 2px solid #3d3d3d;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ingredient-item.selected {
  border-color: #d4a168;
  background: #3d3d3d;
}

.ingredient-item img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.ingredient-item span {
  font-size: 12px;
  color: #fff;
  text-align: center;
  margin-top: 4px;
  padding: 0 4px;
}

@media (max-width: 768px) {
  .ingredients-container {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  }

  .ingredient-item {
    width: 60px;
    height: 60px;
  }

  .ingredient-item img {
    width: 30px;
    height: 30px;
  }

  .ingredient-item span {
    font-size: 10px;
  }
} 