/* app/assets/stylesheets/syllable_combo.css */

:root {
  --combo-bg: #f0f4f8;
  --tile-bg: #ffffff;
  --tile-border: #d1dce5;
  --tile-text: #334e68;
  --tile-hover-bg: #e0e8f0;
  --selected-bg: #4a90e2;
  --selected-text: #ffffff;
  --correct-bg: #5cb85c;
  --error-bg: #d9534f;
  --found-word-bg: #f7fafc;
  --header-text: #102a43;
}

.etymology-card {
  background-color: #f0f0f0;
  border: 1px solid #ccc;
  border-radius: 5px;
  padding: 15px;
  margin-top: 15px;
}

.etymology-card h3 {
  margin-top: 0;
}
.syllable-combo-container {
  max-width: 600px;
  margin: 2rem auto;
  padding: 2rem;
  background-color: var(--combo-bg);
  border-radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  box-shadow: 0 10px 20px rgba(0,0,0,0.05), 0 6px 6px rgba(0,0,0,0.1);
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  color: var(--header-text);
}

.game-header h1 {
  font-size: 2rem;
  font-weight: 700;
}

.score {
  font-size: 1.5rem;
  font-weight: 600;
}

.current-word-wrapper {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    min-height: 50px;
}

.current-word {
  flex-grow: 1;
  background-color: #fff;
  border: 2px dashed var(--tile-border);
  border-radius: 8px;
  padding: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-height: 40px;
}

.current-word .syllable-tile {
  cursor: default;
  background-color: var(--selected-bg);
  color: var(--selected-text);
  border-color: var(--selected-bg);
}

.current-word-actions {
    display: flex;
    margin-left: 1rem;
    gap: 0.5rem;
}

.button-clear, .button-submit, .button-etymology {
    border: none;
    background: #fff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.button-clear:hover, .button-submit:hover, .button-etymology:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
.button-clear { color: var(--error-bg); }
.button-submit { color: var(--correct-bg); }
.button-etymology { color: #4a90e2; }


.syllable-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.syllable-tile {
  background-color: var(--tile-bg);
  border: 1px solid var(--tile-border);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--tile-text);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.2s ease;
  user-select: none;
}

.syllable-tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.syllable-tile.selected {
  opacity: 0.5;
  pointer-events: none;
  transform: scale(0.9);
}

.found-words-container {
  margin-top: 2rem;
}

.found-words-container h2 {
  font-size: 1.2rem;
  color: var(--header-text);
  margin-bottom: 1rem;
}

#words {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.found-word {
  background-color: var(--found-word-bg);
  border: 1px solid var(--tile-border);
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-weight: 500;
  color: var(--tile-text);
}

.new-game-button {
    display: inline-block;
    margin-top: 1.5rem;
    padding: 0.75rem 1.5rem;
    background-color: var(--selected-bg);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
    transition: background-color 0.2s;
}
.new-game-button:hover {
    background-color: #3a7ac2;
}


/* Animations */
.current-word.shake {
  animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
  10%, 90% {
    transform: translate3d(-1px, 0, 0);
  }
  20%, 80% {
    transform: translate3d(2px, 0, 0);
  }
  30%, 50%, 70% {
    transform: translate3d(-4px, 0, 0);
  }
  40%, 60% {
    transform: translate3d(4px, 0, 0);
  }
}

.syllable-tile.fly-out {
  animation: fly-out 0.6s cubic-bezier(0.55, 0.085, 0.68, 0.53) forwards;
}

@keyframes fly-out {
  to {
    transform: translateY(-100px) scale(0.5);
    opacity: 0;
  }
}

.score.pop {
    animation: pop 0.3s ease-in-out;
}

@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@media (max-width: 600px) {
  .current-word-wrapper {
    flex-direction: column;
    align-items: stretch;
  }

  .current-word-actions {
    margin-left: 0;
    margin-top: 1rem;
    justify-content: center;
  }
}
