@font-face {
  font-family: 'Star Wars';
  src: url('https://cdn.jsdelivr.net/gh/allurewebsolutions/Star-Wars-Opening-Crawl/star-wars-opening-crawl/Starjedi.ttf') format('truetype');
}

body {
  margin: 0;
  padding: 20px;
  font-family: 'Arial', sans-serif;
  background: url('background.png') no-repeat center center fixed;
  background-size: cover;
  color: #ffd700;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  background: rgba(0, 0, 0, 0.85);
  padding: 30px;
  border-radius: 15px;
  border: 1px solid rgba(255, 215, 0, 0.3);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.2);
}

h1 {
  font-family: 'Star Wars', sans-serif;
  text-align: center;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
  font-size: 3em;
  letter-spacing: 2px;
  margin-bottom: 40px;
}

h2 {
  font-family: 'Star Wars', sans-serif;
  margin: 0 0 15px 0;
  font-size: 1.4em;
  color: #ffd700;
  text-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
}

.creator-section {
  display: flex;
  gap: 40px;
  margin-top: 30px;
}

.options {
  flex: 1;
  background: rgba(0, 0, 0, 0.7);
  padding: 25px;
  border-radius: 15px;
  border: 1px solid rgba(255, 215, 0, 0.3);
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
}

.option-group {
  margin-bottom: 25px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

select {
  width: 100%;
  padding: 12px;
  background: rgba(0, 0, 0, 0.8);
  color: #ffd700;
  border: 1px solid #ffd700;
  border-radius: 8px;
  margin-bottom: 5px;
  cursor: pointer;
  transition: all 0.3s ease;
}

select:hover {
  background: rgba(255, 215, 0, 0.1);
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 8px;
  border-radius: 5px;
  transition: all 0.3s ease;
}

.checkbox-group label:hover {
  background: rgba(255, 215, 0, 0.1);
}

.preview {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 25px;
  background: rgba(0, 0, 0, 0.7);
  padding: 25px;
  border-radius: 15px;
  border: 1px solid rgba(255, 215, 0, 0.3);
}

canvas, .ai-image {
  background: rgba(0, 0, 0, 0.5);
  border-radius: 15px;
  border: 2px solid #ffd700;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.2);
}

button {
  padding: 12px 25px;
  background: linear-gradient(45deg, #ffd700, #ffa500);
  color: #000;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  font-family: 'Star Wars', sans-serif;
  font-size: 1.1em;
  letter-spacing: 1px;
  transition: all 0.3s ease;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

button:hover {
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.7);
}

.ai-button {
  background: linear-gradient(45deg, #4a90e2, #357abd);
  color: white;
}

.ai-button:hover {
  background: #357abd;
}

.ai-image {
  max-width: 400px;
  max-height: 600px; /* Added max-height to maintain proper aspect ratio */
  object-fit: contain; /* Ensures the whole image is visible */
  border-radius: 10px;
  border: 2px solid #ffd700;
}

.loading {
  opacity: 0.5;
  cursor: not-allowed;
}

#helmetGroup {
  transition: all 0.3s ease;
}

#helmetGroup.hidden {
  opacity: 0;
  height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.character-background {
  background: rgba(0, 0, 0, 0.7);
  padding: 25px;
  border-radius: 15px;
  margin-top: 25px;
  max-width: 600px;
  border: 1px solid #ffd700;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.character-background h3 {
  font-family: 'Star Wars', sans-serif;
  color: #ffd700;
  text-align: center;
  border-bottom: 2px solid #ffd700;
  padding-bottom: 15px;
  font-size: 1.6em;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.character-bio {
  margin: 15px 0;
  line-height: 1.6;
}

.character-bio strong {
  color: #ffd700;
  display: block;
  margin-top: 15px;
  font-size: 1.1em;
}

.character-bio p {
  margin: 8px 0;
  color: #fff;
}

.character-bio ul {
  margin: 8px 0;
  padding-left: 20px;
}

.character-bio li {
  margin: 5px 0;
  color: #fff;
}

/* Gallery 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.8);
}

.modal-content {
  background: rgba(0, 0, 0, 0.95);
  margin: 5% auto;
  padding: 20px;
  border: 2px solid #ffd700;
  width: 90%;
  max-width: 1200px;
  border-radius: 15px;
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 1px solid #ffd700;
}

.close {
  color: #ffd700;
  font-size: 30px;
  font-weight: bold;
  cursor: pointer;
  transition: 0.3s;
}

.close:hover {
  color: #fff;
  text-shadow: 0 0 10px #ffd700;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  padding: 20px;
  max-height: 70vh;
  overflow-y: auto;
}

.gallery-item {
  position: relative;
  border: 2px solid #ffd700;
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.3s;
}

.gallery-item:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
}

.gallery-item img {
  width: 100%;
  height: 300px;
  object-fit: cover;
}

.gallery-item .character-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.8);
  padding: 10px;
  color: #ffd700;
}

.gallery-item .delete-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 0, 0, 0.7);
  color: white;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  opacity: 0;
  transition: opacity 0.3s;
}

.gallery-item:hover .delete-btn {
  opacity: 1;
}

.save-button {
  background: linear-gradient(45deg, #32CD32, #228B22);
  color: white;
}

.gallery-button {
  background: linear-gradient(45deg, #9370DB, #663399);
  color: white;
}