body {
  font-family: sans-serif;
  background: #f5f5f5;
  margin: 0;
  padding: 2em;
}

#puzzle-container {
  margin: 20px auto;
  text-align: center;
}

#game-area {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 20px;
}

#left-column {
  flex: 1;
  max-width: 500px;
}

#right-column {
  flex: 1;
  max-width: 300px;
  text-align: left;
  padding-top: 50px;
}

#grid {
  display: grid;
  grid-template-columns: repeat(3, 48px);
  grid-template-rows: repeat(3, 48px);
  gap: 6px;
  margin-bottom: 1em;
}

.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e9ecef;
  border-radius: 4px;
  font-size: 1.5em;
  font-weight: bold;
}

input[type=number] {
  width: 90%;
  height: 90%;
  font-size: 1.1em;
  text-align: center;
  border: 1px solid #bbb;
  border-radius: 4px;
}

#controls {
  margin-top: 1.5em;
  display: flex;
  gap: 1em;
  justify-content: center;
}

button {
  padding: 0.7em 1.2em;
  font-size: 1em;
  font-weight: bold;
  border: none;
  border-radius: 6px;
  background: linear-gradient(to bottom, #4d90fe, #357ae8);
  color: white;
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.2);
  text-shadow: 0 -1px 0 rgba(0,0,0,0.25);
  transform: translateY(0);
  transition: all 0.2s ease;
}

button:hover {
  background: linear-gradient(to bottom, #5a9cff, #4285f4);
  box-shadow: 0 6px 8px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.3);
}

button:active {
  transform: translateY(2px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  background: linear-gradient(to top, #4d90fe, #357ae8);
}

#feedback {
  min-height: 1.5em;
  color: #b91c1c;
  font-weight: bold;
  text-align: center;
}

#target {
  text-align: center;
  font-size: 1.2em;
  margin-bottom: 0.5em;
  color: #222;
}

h1 {
  font-size: 1.6em;
  margin-bottom: 1em;
  color: #333;
  text-align: center;
  line-height: 1.4;
}

#game-title {
  max-width: 800px;
  margin: 0 auto 1em;
}

#title-target {
  font-weight: bold;
  color: #b91c1c;
}

#equation-formula {
  margin-bottom: 20px;
  padding: 12px;
  background-color: #f3f4f6;
  border-radius: 6px;
  font-size: 1.1em;
  line-height: 1.5;
  text-align: center;
  border-left: 3px solid #4d90fe;
}

#timer {
  font-size: 1.2em;
  font-weight: bold;
  margin-bottom: 15px;
  color: #333;
  padding: 8px 15px;
  background: #f7f7f7;
  border-radius: 4px;
  display: inline-block;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#time-value.warning {
  color: #f39c12;
}

#time-value.danger {
  color: #e74c3c;
  animation: pulse 1s infinite;
}

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

#celebration-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

#explosion-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: red; /* Default color, will be randomized */
    border-radius: 50%;
    animation: confetti-fall 3s ease-out forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-10vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(110vh) rotate(720deg);
        opacity: 0;
    }
}

/* Difficulty Badge Styles Removed
.difficulty-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
}

.easy-badge {
    background: #bbf7d0;
    color: #166534;
}

.medium-badge {
    background: #fef08a;
    color: #854d0e;
}

.hard-badge {
    background: #fecaca;
    color: #991b1b;
}
*/

#grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(0, 1fr));
    gap: 5px;
    margin-bottom: 1.25rem;
    aspect-ratio: 1 / 1;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
    border: 1px solid #ccc;
    padding: 5px;
    background-color: #e5e7eb; /* Light gray background for the grid */
}

.cell {
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid #ccc;
  padding: 10px;
  min-width: 60px;
  min-height: 60px;
  font-size: 20px;
  position: relative;
}

.cell-label {
  position: absolute;
  top: 5px;
  left: 5px;
  font-size: 12px;
  color: #666;
  background: white;
  padding: 2px 4px;
  border-radius: 3px;
}

#description {
  margin-bottom: 15px;
  font-size: 16px;
  color: #333;
  text-align: left;
  line-height: 1.5;
  padding: 15px;
  border-left: 2px solid #ddd;
}

.cell {
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    font-size: clamp(1.4rem, 4vw, 2em); /* Increased base size */
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    background-color: #fff; /* White background for cells */
    font-weight: 500;
}

.operator-cell {
    color: #1d4ed8; /* Blue color for operators */
    font-weight: bold;
}

.disabled-cell {
    background-color: #f3f4f6; /* Slightly off-white for disabled */
    border-color: #e5e7eb;
}

input.cell {
    font-size: inherit;
    font-weight: inherit;
    text-align: center;
    outline: none;
    width: 100%;
    height: 100%;
    padding: 0.5rem;
    box-sizing: border-box;
    border: 2px solid transparent; /* Start transparent */
    border-radius: 0.25rem;
    appearance: textfield; /* Remove spinner buttons */
    -moz-appearance: textfield; /* Firefox */
}

input.cell:focus {
    border-color: #60a5fa; /* Blue border on focus */
}

input.cell.invalid-input {
    border-color: #dc2626 !important; /* Red border for invalid */
    background-color: #fee2e2; /* Light red background */
}

input.cell.correct-input {
     border-color: #16a34a !important; /* Green border for correct */
     background-color: #dcfce7; /* Light green background */
}

/* Style for revealed inputs */
input.cell.revealed {
    background-color: #f3e8ff; /* Light purple background */
    color: #581c87; /* Darker purple text */
    border-color: #a855f7; /* Purple border */
}

/* Style for when the whole puzzle is correct */
.puzzle-correct input.cell {
    border-color: #16a34a; /* Green border for all inputs */
    background-color: #dcfce7;
} 