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

body {
  font-family: 'JetBrains Mono', monospace;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  background-attachment: fixed;
  min-height: 100vh;
  color: #1a1a2e;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.header {
  text-align: center;
  margin-bottom: 40px;
  padding-top: 20px;
}

.pixel-border {
  background: white;
  border: 6px solid #000;
  box-shadow: 
    0 0 0 2px white,
    0 0 0 8px #000,
    0 10px 30px rgba(0,0,0,0.3);
  padding: 30px;
  position: relative;
}

.pixel-border::before,
.pixel-border::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background: #000;
}

.pixel-border::before {
  top: -6px;
  left: -6px;
}

.pixel-border::after {
  bottom: -6px;
  right: -6px;
}

.title {
  font-family: 'Pixelify Sans', cursive;
  font-size: 3.5rem;
  font-weight: 700;
  background: linear-gradient(45deg, #667eea, #764ba2, #f093fb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
  text-shadow: 3px 3px 0 rgba(0,0,0,0.1);
}

.subtitle {
  font-size: 1.1rem;
  color: #666;
  font-weight: 400;
}

.main-content {
  background: white;
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  margin-bottom: 40px;
}

.input-section {
  margin-bottom: 40px;
}

.prompt-container {
  display: flex;
  gap: 10px;
  margin-bottom: 30px;
}

.prompt-input {
  flex: 1;
  padding: 18px 24px;
  font-size: 1.1rem;
  border: 4px solid #000;
  border-radius: 12px;
  font-family: 'JetBrains Mono', monospace;
  background: #f8f8f8;
  transition: all 0.2s;
}

.prompt-input:focus {
  outline: none;
  background: white;
  box-shadow: 0 0 0 4px #667eea;
}

.random-btn {
  padding: 18px 24px;
  font-size: 1.5rem;
  border: 4px solid #000;
  border-radius: 12px;
  background: #ffd93d;
  cursor: pointer;
  transition: all 0.2s;
}

.random-btn:hover:not(:disabled) {
  transform: scale(1.1) rotate(15deg);
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.random-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.size-controls {
  background: #f8f8f8;
  padding: 25px;
  border-radius: 12px;
  border: 3px solid #000;
  margin-bottom: 20px;
}

.size-label {
  display: block;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 15px;
  color: #333;
}

.size-value {
  color: #667eea;
  font-weight: 700;
  font-size: 1.3rem;
}

.size-slider {
  width: 100%;
  height: 8px;
  background: #ddd;
  border-radius: 10px;
  outline: none;
  margin-bottom: 20px;
  cursor: pointer;
}

.size-slider::-webkit-slider-thumb {
  appearance: none;
  width: 30px;
  height: 30px;
  background: #667eea;
  border: 4px solid #000;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
}

.size-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  background: #764ba2;
}

.size-presets {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.preset-btn {
  padding: 12px 20px;
  border: 3px solid #000;
  background: white;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
}

.preset-btn:hover:not(:disabled) {
  background: #667eea;
  color: white;
  transform: translateY(-2px);
}

.preset-btn.active {
  background: #764ba2;
  color: white;
}

.preset-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.generate-btn {
  width: 100%;
  padding: 20px;
  font-size: 1.3rem;
  font-weight: 700;
  border: 4px solid #000;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border-radius: 12px;
  cursor: pointer;
  font-family: 'Pixelify Sans', cursive;
  transition: all 0.3s;
  box-shadow: 0 4px 0 #000, 0 8px 20px rgba(0,0,0,0.2);
}

.generate-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #000, 0 12px 30px rgba(0,0,0,0.3);
}

.generate-btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #000, 0 4px 10px rgba(0,0,0,0.2);
}

.generate-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 0.5; }
}

.display-section {
  margin-top: 40px;
}

.pixel-art-container {
  text-align: center;
  background: #f8f8f8;
  padding: 30px;
  border-radius: 12px;
  border: 4px solid #000;
  margin-bottom: 20px;
}

.pixel-art {
  max-width: 100%;
  height: auto;
  border: 4px solid #000;
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
  background: white;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

.art-actions {
  margin-top: 20px;
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

.action-btn, .minecraft-btn {
  padding: 15px 30px;
  font-size: 1.1rem;
  font-weight: 600;
  border: 3px solid #000;
  border-radius: 10px;
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  transition: all 0.2s;
}

.action-btn {
  background: #4CAF50;
  color: white;
}

.nbt-btn {
  background: #2196F3;
}

.minecraft-btn {
  background: #8B4513;
  color: white;
  font-size: 1.2rem;
}

.action-btn:hover, .minecraft-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.minecraft-section {
  background: #fff8e1;
  border: 4px solid #8B4513;
  border-radius: 12px;
  padding: 30px;
  margin-top: 20px;
  animation: slideIn 0.3s ease-out;
}

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

.minecraft-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 25px;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 12px 24px;
  border: 3px solid #8B4513;
  background: white;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1rem;
}

.tab-btn:hover {
  background: #ffecb3;
}

.tab-btn.active {
  background: #8B4513;
  color: white;
}

.minecraft-content {
  background: white;
  padding: 25px;
  border-radius: 8px;
  border: 3px solid #8B4513;
}

.materials-view {
  max-height: 600px;
  overflow-y: auto;
}

.stats-box {
  background: #e3f2fd;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  border: 2px solid #2196F3;
}

.stats-box h4 {
  margin-bottom: 15px;
  color: #1976D2;
  font-size: 1.2rem;
}

.stats-box p {
  margin: 8px 0;
  font-size: 1rem;
}

.tip {
  color: #f57c00;
  font-weight: 600;
  margin-top: 15px !important;
}

.material-list {
  display: grid;
  gap: 10px;
}

.material-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 12px;
  background: #f5f5f5;
  border-radius: 6px;
  border: 2px solid #ddd;
  transition: all 0.2s;
}

.material-item:hover {
  background: #e8f5e9;
  border-color: #4CAF50;
  transform: translateX(5px);
}

.material-emoji {
  font-size: 1.5rem;
}

.material-name {
  flex: 1;
  font-weight: 600;
}

.material-count {
  background: #667eea;
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 700;
}

.layers-view {
  text-align: center;
}

.layer-controls {
  margin-bottom: 20px;
}

.layer-controls h4 {
  margin-bottom: 10px;
  font-size: 1.3rem;
  color: #333;
}

.layer-desc {
  color: #666;
  margin-bottom: 15px;
  font-size: 1rem;
}

.layer-slider {
  width: 100%;
  max-width: 400px;
  height: 8px;
  background: #ddd;
  border-radius: 10px;
  outline: none;
  cursor: pointer;
  margin: 0 auto;
  display: block;
}

.layer-slider::-webkit-slider-thumb {
  appearance: none;
  width: 25px;
  height: 25px;
  background: #8B4513;
  border: 3px solid #000;
  border-radius: 50%;
  cursor: pointer;
}

.layer-canvas {
  margin: 20px auto;
  border: 3px solid #8B4513;
  background: white;
  display: block;
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

.layer-nav {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 20px;
}

.layer-nav-btn {
  padding: 12px 24px;
  border: 3px solid #000;
  background: #4CAF50;
  color: white;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.layer-nav-btn:hover:not(:disabled) {
  background: #388E3C;
  transform: translateY(-2px);
}

.layer-nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.instructions-view {
  max-height: 600px;
  overflow-y: auto;
}

.build-info {
  background: #fff3e0;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 25px;
  border: 2px solid #FF9800;
}

.build-info h4 {
  color: #E65100;
  margin-bottom: 10px;
  font-size: 1.3rem;
}

.steps-list {
  margin-bottom: 25px;
}

.step-item {
  background: #f5f5f5;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 15px;
  border-left: 5px solid #667eea;
  transition: all 0.2s;
}

.step-item:hover {
  background: #e8eaf6;
  transform: translateX(5px);
}

.step-item h5 {
  color: #667eea;
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.step-item p {
  color: #666;
  line-height: 1.6;
}

.tips-box {
  background: #e8f5e9;
  padding: 20px;
  border-radius: 8px;
  border: 2px solid #4CAF50;
}

.tips-box h4 {
  color: #2E7D32;
  margin-bottom: 15px;
  font-size: 1.2rem;
}

.tips-box ul {
  list-style: none;
  padding-left: 0;
}

.tips-box li {
  padding: 8px 0;
  padding-left: 25px;
  position: relative;
  color: #333;
}

.tips-box li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: #4CAF50;
  font-weight: bold;
  font-size: 1.2rem;
}

.history-section {
  margin-top: 40px;
}

.history-title {
  font-family: 'Pixelify Sans', cursive;
  font-size: 1.8rem;
  margin-bottom: 20px;
  color: #333;
  text-align: center;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 15px;
}

.history-item {
  background: white;
  border: 3px solid #000;
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.history-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.history-item img {
  width: 100%;
  height: auto;
  border: 2px solid #ddd;
  border-radius: 4px;
  image-rendering: pixelated;
  margin-bottom: 8px;
}

.history-prompt {
  font-size: 0.8rem;
  color: #666;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.footer {
  background: white;
  text-align: center;
  padding: 25px;
  border-radius: 12px;
  border: 3px solid #000;
  margin-top: 30px;
}

.footer p {
  font-size: 1rem;
  color: #666;
}

.footer a {
  color: #667eea;
  text-decoration: none;
  font-weight: 700;
  transition: all 0.2s;
}

.footer a:hover {
  color: #764ba2;
  text-decoration: underline;
}

@media (max-width: 768px) {
  .title {
    font-size: 2.5rem;
  }
  
  .subtitle {
    font-size: 0.9rem;
  }
  
  .main-content {
    padding: 25px;
  }
  
  .prompt-input {
    font-size: 1rem;
    padding: 15px;
  }
  
  .generate-btn {
    font-size: 1.1rem;
  }
  
  .size-presets {
    justify-content: center;
  }
  
  .minecraft-tabs {
    justify-content: center;
  }
  
  .history-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
}