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

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #0b0d17;
  color: #e8e8e8;
  min-height: 100vh;
  line-height: 1.6;
}

/* Header */
header {
  text-align: center;
  padding: 2.5rem 1rem;
  background: linear-gradient(180deg, #1a0a00 0%, #0b0d17 100%);
  border-bottom: 2px solid #e77d3b;
}

header h1 {
  font-size: 3rem;
  color: #e77d3b;
  text-transform: uppercase;
  letter-spacing: 0.3em;
}

header .subtitle {
  font-size: 1.1rem;
  color: #b0b0b0;
  margin-top: 0.3rem;
  letter-spacing: 0.1em;
}

/* Views */
.view {
  display: none;
}

.view.active {
  display: block;
}

/* Rover Grid */
.grid-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  padding: 2rem;
  max-width: 1100px;
  margin: 0 auto;
}

.rover-tile {
  background: #1a1d2e;
  border: 1px solid #2a2d3e;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.rover-tile:hover {
  transform: translateY(-4px);
  border-color: #e77d3b;
  box-shadow: 0 8px 24px rgba(231, 125, 59, 0.15);
}

.rover-tile img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.tile-info {
  padding: 1rem 1.2rem;
}

.tile-info h3 {
  color: #e77d3b;
  font-size: 1.3rem;
  margin-bottom: 0.25rem;
}

.tile-info .tile-years {
  font-size: 0.9rem;
  color: #999;
}

.tile-info .tile-mission {
  font-size: 0.85rem;
  color: #777;
  margin-top: 0.2rem;
}

/* Detail View */
.back-button {
  display: inline-block;
  margin: 1.5rem 2rem;
  padding: 0.5rem 1.2rem;
  background: #1a1d2e;
  color: #e77d3b;
  border: 1px solid #e77d3b;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s;
}

.back-button:hover {
  background: #2a2d3e;
}

#detail-content {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 2rem 3rem;
}

.detail-header {
  margin-bottom: 2rem;
}

.detail-header h2 {
  font-size: 2.4rem;
  color: #e77d3b;
}

.detail-header .mission-name {
  font-size: 1.1rem;
  color: #999;
  margin-top: 0.2rem;
}

.status-badge {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #2a2d3e;
  color: #999;
}

.status-badge.active {
  background: #1a3a1a;
  color: #4caf50;
  border: 1px solid #4caf50;
}

/* Info Table */
.info-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2rem;
}

.info-table th,
.info-table td {
  padding: 0.6rem 1rem;
  text-align: left;
  border-bottom: 1px solid #1a1d2e;
}

.info-table th {
  color: #e77d3b;
  font-weight: 600;
  width: 140px;
}

/* Detail Sections */
.detail-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.detail-map h3,
.detail-info h3,
.detail-gallery h3 {
  color: #e77d3b;
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
  margin-top: 1.5rem;
}

.detail-map h3:first-child,
.detail-info h3:first-child {
  margin-top: 0;
}

.detail-info p {
  margin-bottom: 1rem;
}

.detail-info ul {
  padding-left: 1.5rem;
}

.detail-info li {
  margin-bottom: 0.5rem;
}

/* Mars Map */
.mars-map-container {
  position: relative;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
}

.mars-map-container img.mars-map {
  width: 100%;
  display: block;
  border-radius: 8px;
}

.map-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 2;
  text-align: center;
}

.marker-dot {
  display: block;
  width: 16px;
  height: 16px;
  background: #e77d3b;
  border: 3px solid #fff;
  border-radius: 50%;
  margin: 0 auto;
  animation: pulse 2s ease-in-out infinite;
}

.marker-label {
  display: block;
  margin-top: 4px;
  font-size: 0.7rem;
  color: #fff;
  background: rgba(0, 0, 0, 0.7);
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(231, 125, 59, 0.6);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(231, 125, 59, 0);
  }
}

/* Gallery */
.detail-gallery {
  margin-top: 1rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.gallery-grid figure {
  margin: 0;
}

.gallery-grid img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  cursor: pointer;
  transition: opacity 0.2s;
}

.gallery-grid img:hover {
  opacity: 0.8;
}

/* Lightbox */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.92);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}

.lightbox.active {
  opacity: 1;
  pointer-events: auto;
}

.lightbox img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox figcaption {
  color: #ccc;
  font-size: 0.9rem;
  margin-top: 1rem;
  text-align: center;
  max-width: 80vw;
}

.gallery-grid figcaption {
  font-size: 0.8rem;
  color: #999;
  margin-top: 0.4rem;
  padding: 0 0.2rem;
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem;
  color: #555;
  font-size: 0.8rem;
  border-top: 1px solid #1a1d2e;
  margin-top: 2rem;
}

/* Responsive */
@media (max-width: 900px) {
  .grid-container {
    grid-template-columns: repeat(2, 1fr);
  }

  .detail-body {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 550px) {
  .grid-container {
    grid-template-columns: 1fr;
  }

  header h1 {
    font-size: 2rem;
    letter-spacing: 0.15em;
  }
}
