/* Emoji Maze Game Styles */

@keyframes cell-lock-anim-keyframes {
  0% {
    transform-origin: center;
    transform-box: fill-box;
    transform: scale(1);
  }
  50% {
    transform-origin: center;
    transform-box: fill-box;
    transform: scale(1.1);
  }
  100% {
    transform-origin: center;
    transform-box: fill-box;
    transform: scale(1);
  }
}

@keyframes cell-shake-anim-keyframes {
  0% { transform: translateX(0); }
  20% { transform: translateX(-0.005em); }
  40% { transform: translateX(0.005em); }
  60% { transform: translateX(-0.005em); }
  80% { transform: translateX(0.005em); }
  100% { transform: translateX(0); }
}
.cell-shake-anim-rect {
  animation: cell-shake-anim-keyframes 0.35s cubic-bezier(.36,.07,.19,.97) both;
  z-index: 11;
  transform-box: fill-box;
  /* transform-origin will be set inline by JS */
}

/* Animate the overlay rect scaling from center */
.cell-lock-anim-rect {
  animation: cell-lock-anim-keyframes 0.3s cubic-bezier(.4,2,.6,1) forwards;
  transform-box: fill-box;
  z-index: 10;
}

/* Keep .cell-lock-anim for legacy/group use, but animation is now on rects individually */
.cell-lock-anim {
  z-index: 10;
}


.maze-svg-wrapper {
  width: 50vh;
  max-width: 800px;
  aspect-ratio: 1 / 1;
  margin: 0 auto 1.5rem auto;
  display: block;
}

.maze-svg-grid {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.emoji-maze-container {
  background-color: var(--brand-surface-alt);
  padding: 3rem;
  border-radius: 0.5rem;
  max-width: 1400px;
  width: 60vw;
  flex: 1;
  /* margin: 1.5rem auto; */
  color: var(--text-primary);
}

.maze-clues {
  display: flex;
  justify-content: flex-start;
  height: 100%;
  /* margin: auto 0; */
  gap: 0.5em;
  font-size: 1.6em;
  align-items: center;
  flex-direction: column;
}

.maze-clues-heading {
  font-size: 1.1em;
  font-weight: bold;
  margin-bottom: 0.2em;
  letter-spacing: 0.05em;
}

.maze-clues-separator {
  width: 60%;
  margin: 0.2em auto 0.5em auto;
  border: none;
  border-top: 2px solid #ffd700;
  opacity: 0.6;
}

.maze-clue-block {
  font-size: 0.8em;
  opacity: 0.2;
  padding: 0.2em 0.5em;
  width: 100%;
  /* border-radius: 0.5em; */
  transition: background 0.2s, box-shadow 0.2s;
  background: transparent;
}

.maze-clue-number {
  font-size: 0.7em;
  color: var(--text-primary);
  margin-right: 0.4em;
  font-weight: bold;
  vertical-align: middle;
}

.maze-clue-current {
  background: #d26930b0;
  font-weight: bold;
  opacity: 1;
  font-size: 2em;
}

#emoji-maze-grid {
  width: 100%;
  max-width: 1800px;
  margin: 0 auto;
  height: 100%;
  /* min-height: 300px; */
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  padding: 10px;
  /* flex-direction: row; */
}

#emoji-maze-loading {
  margin-bottom: 1rem;
  font-style: italic;
}
#emoji-maze-score {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

#emoji-maze-rules {
  margin-bottom: 1rem;
  font-style: italic;
  text-align: center;
}

#emoji-maze-lives {
  font-size: 1.5em;
  text-align: center;
  margin: 10px 0;
  letter-spacing: 4px;
  color: #FFD700;
}

#emoji-maze-lives-header {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  text-align: center;
}

.maze-grid {
  font-family: monospace;
  white-space: pre;
  background-color: var(--brand-surface);
  padding: 1rem;
  border: 1px solid var(--border-subtle);
  border-radius: 0.25rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}
.maze-grid-table {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  aspect-ratio: 1 / 1;
  width: 100%;
  max-width: 800px;
  margin: 0 auto 1.5rem auto;
  gap: 0;
  background: #222;
}

.maze-cell {
  width: 100%;
  height: 100%;
  text-align: center;
  font-size: clamp(1.2em, 4vw, 2.5em);
  box-sizing: border-box;
  border: 1px solid #222;
  background: #fff;
  padding: 0;
  margin: 0;
  transition: background 0.15s, border 0.15s;
}


.maze-cell:focus {
  outline: 2px solid #0099ff;
  z-index: 2;
}

.maze-cell:hover:not(:disabled) {
  background: #f0f6ff;
}

.black-cell {
  background: #444;
  border: 1px solid #222;
}
.solved {
  background: #c8ffc8;
  color: #222;
}
.editable {
  background: #fffbe6;
  border: 2px solid #f8c400;
}
.white-cell {
  background: #fff;
}
.maze-segments {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.maze-segment {
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  text-transform: uppercase;
  user-select: none;
}
.maze-segment.solved {
  background-color: var(--accent-success);
  color: var(--text-inverse);
}
.maze-segment.active {
  background-color: var(--accent-info);
  color: var(--text-inverse);
}
.maze-segment.locked {
  background-color: var(--border-subtle);
  color: var(--text-secondary);
}
#emoji-maze-input {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
#emoji-maze-input input[type="text"] {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid var(--border-subtle);
  border-radius: 0.25rem;
  background-color: var(--brand-surface);
  color: var(--text-primary);
}
#emoji-maze-input button {
  padding: 0.5rem 1rem;
  font-weight: 500;
  border: none;
  border-radius: 0.25rem;
  background-color: var(--button-bg);
  color: var(--button-text);
  cursor: pointer;
  transition: background-color 0.2s;
}
#emoji-maze-input button:hover {
  background-color: var(--button-hover);
}
#emoji-maze-input #theme-guess {
  background-color: var(--accent-warning);
  color: var(--text-inverse);
}
#emoji-maze-input #theme-guess:hover {
  opacity: 0.9;
}
#emoji-maze-feedback {
  min-height: 1.5rem;
  font-weight: 500;
}
#emoji-maze-feedback.success {
  color: var(--accent-success);
}
#emoji-maze-feedback.error {
  color: var(--accent-danger);
}

@keyframes flash-red {
  0% { fill: #FF0000; }
  50% { fill: #FFCCCC; }
  100% { fill: #FF0000; }
}
.flash-red {
  animation: flash-red 0.4s linear;
}

@media (max-width: 600px) {
  .emoji-maze-container {
    padding: 0.75rem;
    margin: 0.75rem;
  }
  .maze-grid {
    font-size: 0.8rem;
  }
  #emoji-maze-input {
    flex-direction: column;
  }
  #emoji-maze-input button {
    width: 100%;
  }
}