/* ==========================
   BASE CONTAINER
========================== */

.tool-container {
  max-width: 700px;
  margin: auto;
  padding: 24px;
  background: #020617;
  border-radius: 18px;
  border: 1px solid #1e293b;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

/* ==========================
   TEXT (Mode / Turn)
========================== */

.tool-container p {
  margin-top: 10px;
  color: #cbd5f5;
  font-size: 14px;
}

/* ==========================
   LABELS
========================== */

label {
  display: block;
  margin-top: 18px;
  margin-bottom: 6px;
  color: #cbd5f5;
  font-size: 14px;
  font-weight: 500;
}

/* ==========================
   INPUTS
========================== */

textarea,
input {
  width: 100%;
  padding: 13px;
  border-radius: 12px;
  border: 1px solid #334155;
  background: #020617;
  color: #e2e8f0;
  font-size: 15px;
  transition: all 0.2s ease;
}

textarea::placeholder,
input::placeholder {
  color: #64748b;
}

textarea:focus,
input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.25);
  outline: none;
}

/* ==========================
   BUTTONS
========================== */

.tool-container button {
  margin-top: 14px;
  margin-right: 10px;
  padding: 10px 16px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(59,130,246,0.3);
  transition: all 0.25s ease;
}

.tool-container button:hover {
  transform: translateY(-2px);
}

.tool-container button:active {
  transform: scale(0.96);
}

/* Mode buttons (important fix) */
.button-group button {
  opacity: 0.6;
}

.button-group button.active {
  opacity: 1;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  transform: scale(1.05);
}

/* Button groups */
.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ==========================
   OUTPUT BOX
========================== */

.output {
  margin-top: 22px;
  padding: 16px;
  background: #020617;
  border-radius: 12px;
  border: 1px solid #334155;
  font-size: 16px;
  text-align: center;
  min-height: 50px;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================
   RESULT STYLES
========================== */

.result-highlight {
  color: #38bdf8;
  font-weight: 600;
  font-size: 20px;
}

/* Dice */
#diceResult {
  font-size: 22px;
  letter-spacing: 3px;
}

/* Yes/No */
.answer-yes { color: #22c55e; font-weight: 600; }
.answer-no { color: #ef4444; font-weight: 600; }
.answer-maybe { color: #f59e0b; font-weight: 600; }

/* ==========================
   LINKS
========================== */

.tool-container a {
  display: inline-block;
  margin-bottom: 15px;
  color: #38bdf8;
  text-decoration: none;
  font-size: 14px;
}

.tool-container a:hover {
  text-decoration: underline;
}

/* ==========================
   SUDOKU GRID (FIXED)
========================== */

#sudoku {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 6px;
  max-width: 420px;
  margin: 20px auto;
}

#sudoku input {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #020617;
  color: #e2e8f0;
  text-align: center;
  font-size: 16px;
}

#sudoku input:focus {
  background: #1e293b;
}

#sudoku input:disabled {
  background: #1e293b;
  font-weight: bold;
}

/* Sudoku feedback */
.sudoku-correct { background: #22c55e !important; }
.sudoku-wrong { background: #ef4444 !important; }
.sudoku-empty { background: #facc15 !important; }

/* ==========================
   SOS GRID (IMPORTANT FIXES)
========================== */

#grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  max-width: 260px;
  margin: 25px auto;
  gap: 14px; /* 🔥 more breathing space */
}

#grid button {
  width: 100%;
  aspect-ratio: 1; /* perfect squares */
  font-size: 28px;
  border-radius: 14px; /* softer look */
  border: 1px solid #334155;
  background: #1e293b;
  color: #e2e8f0;
  transition: all 0.2s ease;
}

#grid button:hover {
  background: #334155;
  transform: translateY(-2px);
}

#grid button:active {
  transform: scale(0.94);
}

/* spacing below buttons */
.button-group {
  margin-top: 10px;
}

/* WIN highlight */
.sos-win {
  background: #ef4444 !important;
  color: white;
  font-weight: bold;
  box-shadow: 0 0 10px rgba(239,68,68,0.6);
}

/* ==========================
   RESPONSIVE
========================== */

@media (max-width: 600px) {
  .tool-container {
    padding: 16px;
  }

  .tool-container button {
    width: 100%;
    margin-bottom: 10px;
  }
}

/* ==========================
   LIGHT MODE
========================== */

.light-mode .tool-container {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 25px rgba(0,0,0,0.08);
}

.light-mode textarea,
.light-mode input {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #cbd5f5;
}

.light-mode .output {
  background: #f1f5f9;
  border: 1px solid #cbd5f5;
}

.light-mode label,
.light-mode .option,
.light-mode .tool-container p {
  color: #334155;
}

#number {
  font-size: 32px;
  font-weight: bold;
  letter-spacing: 2px;
}

#history {
  font-size: 14px;
  color: #94a3b8;
}