* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: #333;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  min-height: 100vh;
}

nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  gap: 1rem;
  border-bottom: solid 2px #4a90e2;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

nav a {
  display: inline-block;
  min-width: 9rem;
  padding: 0.75rem 1.5rem;
  border-radius: 25px;
  border: solid 2px #4a90e2;
  text-align: center;
  text-decoration: none;
  color: #4a90e2;
  font-weight: 600;
  transition: all 0.3s ease;
}

nav a:hover {
  background-color: #4a90e2;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
}

nav a[aria-current='page'] {
  color: white;
  background-color: #4a90e2;
  box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
}

main {
  padding: 2rem;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
}

h1 {
  font-weight: 700;
  font-size: 2.5rem;
  text-align: center;
  margin-bottom: 1rem;
  color: #2c3e50;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.instructions {
  text-align: center;
  font-size: 1.1rem;
  color: #666;
  margin-bottom: 2rem;
}

.workspace {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
  background: white;
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  min-height: 600px;
}

.icon-toolbar {
  background: #f8f9fa;
  border-radius: 15px;
  padding: 1.5rem;
  border: 2px solid #e9ecef;
  display: flex;
  flex-direction: column;
}

.icon-toolbar h3 {
  margin: 0 0 1rem 0;
  color: #2c3e50;
  font-size: 1.3rem;
  text-align: center;
}

.icon-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  align-items: stretch;
}

.icon-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 0.5rem;
  background: white;
  border-radius: 12px;
  border: 2px solid #dee2e6;
  cursor: pointer;
  transition: all 0.3s ease;
  user-select: none;
  min-height: 90px;
  text-align: center;
  width: 100%;
}

.icon-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  border-color: #4a90e2;
}

.icon-item.selected {
  border-color: #28a745;
  background-color: #f8fff9;
  box-shadow: 0 6px 20px rgba(40, 167, 69, 0.3);
}

.icon-item:active {
  transform: scale(0.95);
}

.icon-item .icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}

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

.icon-item span {
  font-size: 0.75rem;
  font-weight: 600;
  color: #666;
  text-align: center;
  line-height: 1.2;
  word-wrap: break-word;
  hyphens: auto;
  margin-top: 0.25rem;
}

.selected-icon-display {
  background: white;
  border-radius: 8px;
  padding: 1rem;
  border: 2px solid #dee2e6;
  text-align: center;
  margin-bottom: 1rem;
}

.selected-icon-display p {
  margin: 0 0 0.5rem 0;
  font-weight: 600;
  color: #2c3e50;
  font-size: 0.9rem;
}

.selected-icon-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 30px;
}

.selected-icon-preview span {
  font-size: 0.8rem;
  color: #666;
}

.btn-credits {
  padding: 0.5rem 1rem;
  border: 1px solid #17a2b8;
  border-radius: 15px;
  background: #17a2b8;
  color: white;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  align-self: center;
  width: fit-content;
}

.btn-credits:hover {
  background: #138496;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(23, 162, 184, 0.3);
}

.diagram-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.diagram-area {
  position: relative;
  background: #fafbfc;
  border: 3px dashed #dee2e6;
  border-radius: 15px;
  padding: 2rem;
  min-height: 400px;
  transition: all 0.3s ease;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.diagram-area.drag-over {
  border-color: #4a90e2;
  background-color: #f0f7ff;
  transform: scale(1.02);
}

.diagram-canvas {
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  cursor: crosshair;
}

.diagram-canvas:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.placed-icons {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.placed-icon {
  position: absolute;
  font-size: 1.5rem;
  cursor: move;
  pointer-events: all;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  width: 60px; /* Increased by 50% from 40px */
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #4a90e2;
  transition: all 0.3s ease;
  user-select: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.placed-icon img {
  width: 36px; /* Increased by 50% from 24px */
  height: 36px;
  object-fit: contain;
}

.placed-icon:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 15px rgba(74, 144, 226, 0.4);
  z-index: 10;
}

.controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 25px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1rem;
}

.btn-primary {
  background: #4a90e2;
  color: white;
}

.btn-primary:hover {
  background: #357abd;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
}

.btn-secondary {
  background: #dc3545;
  color: white;
}

.btn-secondary:hover {
  background: #c82333;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

.btn-success {
  background: #28a745;
  color: white;
}

.btn-success:hover {
  background: #218838;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.btn-info {
  background: #17a2b8;
  color: white;
}

.btn-info:hover {
  background: #138496;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(23, 162, 184, 0.4);
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
}

.modal-content {
  background-color: white;
  margin: 5% auto;
  padding: 0;
  border-radius: 15px;
  width: 90%;
  max-width: 600px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  border-bottom: 2px solid #e9ecef;
  background: linear-gradient(135deg, #4a90e2, #357abd);
  color: white;
  border-radius: 15px 15px 0 0;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.close {
  color: white;
  font-size: 2rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.close:hover {
  background-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.modal-body {
  padding: 2rem;
  line-height: 1.6;
}

.modal-body h3 {
  color: #2c3e50;
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

.credits-list {
  list-style: none;
  padding: 0;
  margin: 0 0 2rem 0;
}

.credits-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid #f0f0f0;
  color: #555;
}

.credits-list li:last-child {
  border-bottom: none;
}

.citation {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 8px;
  border-left: 4px solid #4a90e2;
  margin: 0;
  font-size: 0.9rem;
  color: #555;
}

.citation a {
  color: #4a90e2;
  text-decoration: none;
  word-break: break-all;
}

.citation a:hover {
  text-decoration: underline;
}

/* Instructions page styles */
.instructions-content {
  background: white;
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  max-width: 800px;
  margin: 0 auto;
}

.instructions-content h2 {
  color: #2c3e50;
  border-bottom: 2px solid #4a90e2;
  padding-bottom: 0.5rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.instructions-content section:first-child h2 {
  margin-top: 0;
}

.instructions-content ol, .instructions-content ul {
  line-height: 1.8;
  color: #555;
}

.instructions-content li {
  margin-bottom: 0.5rem;
}

.icon-reference {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.icon-ref-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: #f8f9fa;
  border-radius: 8px;
  font-size: 1.2rem;
}

.icon-ref-item span {
  font-size: 0.9rem;
  color: #666;
}

/* Responsive design */
@media (max-width: 768px) {
  .workspace {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1rem;
  }
  
  .icon-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }
  
  .icon-item {
    padding: 0.5rem;
    min-height: 80px;
  }
  
  .icon-item .icon {
    font-size: 1.5rem;
  }
  
  .icon-item span {
    font-size: 0.7rem;
  }
  
  h1 {
    font-size: 2rem;
  }
  
  main {
    padding: 1rem;
  }
  
  .controls {
    flex-direction: column;
    align-items: center;
  }
  
  .btn {
    width: 100%;
    max-width: 200px;
  }

  .modal-content {
    margin: 10% auto;
    width: 95%;
  }

  .modal-body {
    padding: 1.5rem;
  }
}

/* Drag and drop visual feedback */
.dragging {
  opacity: 0.5;
  transform: rotate(5deg);
}

.drop-zone-active {
  background: linear-gradient(45deg, #f0f7ff, #e3f2fd);
  border-color: #2196f3;
}