/* =============================================================================
   Echoes — the daily sound-ladder game, page-specific styles
   Reuses the shared design tokens and base components (.card, .btn,
   .evaluate-input, .page-header) from styles.css. Only the chain display,
   flourish celebration, and result chips are defined here.
   ============================================================================= */

.echoes-card {
  padding: var(--space-5);
  margin-bottom: var(--space-6);
}

/* --- Loading / error states --- */
.echoes-loading__text {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin: 0;
}

.echoes-load-error p {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin: 0 0 var(--space-3);
}

/* --- Puzzle header row --- */
.echoes-meta-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-2);
  align-items: baseline;
}

.echoes-puzzle-label {
  font-weight: 600;
  margin: 0;
}

.echoes-counter {
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  margin: 0;
}

.echoes-par-meaning {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin: var(--space-2) 0 var(--space-4);
}

/* --- Start / target endpoints --- */
.echoes-endpoints {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  margin-bottom: var(--space-4);
}

.echoes-endpoint {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.echoes-endpoint__label {
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-muted);
}

.echoes-endpoint__word {
  font-weight: 700;
  font-size: var(--text-lg);
  letter-spacing: 0.06em;
}

.echoes-endpoint__respell,
.echoes-chain__respell {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.echoes-endpoint__arrow {
  color: var(--text-muted);
  font-size: var(--text-lg);
}

/* --- The chain --- */
.echoes-chain {
  list-style: none;
  margin: 0 0 var(--space-4);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.echoes-chain__item {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-md);
}

.echoes-chain__item--current {
  background: var(--accent-soft);
}

.echoes-chain__word {
  font-weight: 600;
  letter-spacing: 0.06em;
}

.echoes-chain__badge {
  font-size: var(--text-xs);
  color: var(--success);
  white-space: nowrap;
}

/* Homophone flourish celebration — reduced motion switches it off below. */
.echoes-chain__item--pop {
  animation: echoes-pop var(--transition-slow);
}

@keyframes echoes-pop {
  0% { transform: scale(0.94); }
  55% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

/* --- Input and controls --- */
.echoes-input-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.echoes-input-row {
  display: flex;
  gap: var(--space-2);
}

.echoes-input-row .evaluate-input {
  flex: 1 1 auto;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.echoes-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-3);
}

.echoes-hint-note {
  color: var(--text-muted);
  font-size: var(--text-xs);
  margin: var(--space-2) 0 0;
}

.echoes-hint-reveal {
  font-size: var(--text-sm);
  margin-top: var(--space-2);
  min-height: 1.2em;
}

.echoes-status {
  margin: var(--space-3) 0 0;
  min-height: 2.4em;
  font-size: var(--text-sm);
}

.echoes-speak {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: var(--text-base);
  padding: 0 var(--space-1);
  line-height: 1;
}

.echoes-speak:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--radius-sm);
}

/* --- Win panel --- */
.echoes-win {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.echoes-win__title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xl);
}

.echoes-win__summary {
  margin: 0 0 var(--space-3);
}

.echoes-chips {
  font-size: var(--text-lg);
  letter-spacing: 0.1em;
  overflow-wrap: anywhere;
}

.echoes-chips-key {
  color: var(--text-muted);
  font-size: var(--text-xs);
  margin: var(--space-1) 0 var(--space-3);
}

.echoes-win-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.echoes-share-feedback {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.echoes-streak {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: var(--space-3) 0;
}

.echoes-reveal summary {
  cursor: pointer;
  font-weight: 600;
}

.echoes-reveal__intro {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin: var(--space-2) 0;
}

.echoes-reveal__path {
  margin: 0;
  padding-left: var(--space-5);
  font-size: var(--text-sm);
}

.echoes-reveal__path li {
  margin-bottom: var(--space-1);
}

@media (prefers-reduced-motion: reduce) {
  .echoes-chain__item--pop {
    animation: none;
  }
}
