/* --- Global Styles --- */
body {
  font-family: "Segoe UI", sans-serif;
  background: #121212;
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
}

/* --- Grid & Cell Basics --- */
.grid {
  display: grid;
  grid-template-columns: repeat(5, 75px);
  gap: 10px;
  margin-top: 20px;
}

.cell {
  width: 75px;
  height: 75px;
  background: #2c2c2c;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px solid #444;
  transition: 0.2s;
  position: relative;
  overflow: hidden; /* Keeps rainbow gradient contained */
}

.cell:hover {
  border-color: #9b59b6;
}

.cell.selected {
  border-color: #00d4ff !important;
  box-shadow: 0 0 15px #00d4ff;
  z-index: 10;
}

.cell.disabled {
  cursor: not-allowed;
  opacity: 0.4;
  filter: grayscale(80%);
}

/* --- Solver Specifics (Best Move & Probs) --- */
.best-move {
  border: 2px solid #f1c40f !important;
  box-shadow: 0 0 15px rgba(241, 196, 15, 0.7);
  animation: pulse-best 1.5s infinite;
}

.best-label {
  position: absolute;
  top: -10px;
  background: #f1c40f;
  color: black;
  font-size: 9px;
  padding: 2px 5px;
  border-radius: 4px;
  font-weight: bold;
  z-index: 15;
}

.prob-ghost {
  font-size: 14px;
  font-weight: 900;
  text-shadow: 1px 1px 2px black;
}

@keyframes pulse-best {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.04);
  }
  100% {
    transform: scale(1);
  }
}

/* --- Simulator States --- */
.unrevealed-cell {
  opacity: 0.5;
  filter: grayscale(40%);
  border: 1px dashed rgba(255, 255, 255, 0.3) !important;
}

/* --- Color Palette & Variables --- */
:root {
  --blue: #3498db;
  --teal: #1abc9c;
  --green: #2ecc71;
  --yellow: #f1c40f;
  --orange: #e67e22;
  --purple: #9b59b6;
  --red: #ff4757;
  --light: #dfe6e9;
  --dark: #2d3436;
  --rainbow: linear-gradient(45deg, #ff4757, #e67e22, #f1c40f, #2ecc71, #1abc9c, #3498db, #9b59b6);
}

.blue {
  background: var(--blue) !important;
  color: white !important;
}
.teal {
  background: var(--teal) !important;
  color: white !important;
}
.green {
  background: var(--green) !important;
  color: white !important;
}
.yellow {
  background: var(--yellow) !important;
  color: black !important;
}
.orange {
  background: var(--orange) !important;
  color: white !important;
}
.purple {
  background: var(--purple) !important;
  color: white !important;
}
.red {
  background: var(--red) !important;
  color: white !important;
  box-shadow: 0 0 15px rgba(255, 71, 87, 0.4);
}
.light {
  background: var(--light) !important;
  color: #2d3436 !important;
}
.dark {
  background: var(--dark) !important;
  color: #dfe6e9 !important;
}

.rainbow {
  background: var(--rainbow) !important;
  background-size: 200% 200%;
  color: white !important;
  text-shadow: 1px 1px 2px black !important;
}

/* --- Counter Badges --- */
#ship-counter {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
}

#ship-counter span {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* --- Stats & Header --- */
.stats {
  text-align: center;
  background: #1e1e1e;
  padding: 15px;
  border-radius: 10px;
  min-width: 420px;
  border: 1px solid #333;
}

.big-letter {
  font-size: 28px;
  font-weight: 900;
}

/* --- Navigation System --- */
.btn-chest.active {
  background: var(--blue) !important;
  color: white !important;
}
.btn-harvest.active {
  background: var(--green) !important;
  color: white !important;
}
.btn-quest.active {
  background: var(--purple) !important;
  color: white !important;
}
.btn-trace.active {
  background: var(--teal) !important;
  color: white !important;
}

/* --- Controls & Utilities --- */
.picker-container {
  margin-top: 20px;
  text-align: center;
}
.picker {
  display: flex;
  gap: 8px;
  background: #1e1e1e;
  padding: 15px;
  border-radius: 12px;
  border: 1px solid #333;
}

.pick-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-weight: 900;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.1s;
}

.controls {
  margin-top: 20px;
  display: flex;
  gap: 10px;
}

.reset-button {
  padding: 10px 20px;
  cursor: pointer;
  background: #444;
  color: white;
  border: none;
  border-radius: 5px;
  font-weight: bold;
}

.reset-button:hover {
  background: #555;
}

.wip {
  color: #ffa502;
  margin-bottom: 5px;
}

.picker-game-over {
  color: #e74c3c;
  font-weight: bold;
  padding: 10px;
}

.picker-victory {
  color: #2ecc71;
  font-weight: bold;
  padding: 10px;
}
