/* Travel — Game Styles */

/* Wide wrapper to give the map more room */
.travel-wrapper {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md);
}

.travel-header {
  max-width: 700px;
  margin: 0 auto var(--space-lg);
}

/* Endpoints (FROM → TO) */
.endpoints {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
}

.endpoint {
  text-align: center;
  flex: 1;
  max-width: 200px;
}

.endpoint-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: var(--space-xs);
}

.start-endpoint .endpoint-label { color: var(--accent-green); }
.dest-endpoint  .endpoint-label { color: var(--accent-warm); }

.endpoint-flag .flag-img {
  width: 56px;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  margin-bottom: var(--space-xs);
}

.endpoint-name {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
}

.endpoint-arrow {
  font-size: 1.6rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Route bar */
.route-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  min-height: 44px;
  font-size: 0.85rem;
  font-family: var(--font-mono);
}

.route-step {
  color: var(--text-secondary);
  white-space: nowrap;
}

.route-step.route-current {
  color: var(--accent);
  font-weight: 700;
}

.route-arrow { color: var(--text-muted); }

/* Map */
#map {
  width: 100%;
  height: 500px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #0f1923;
  cursor: default;
}

/* Map legend */
.map-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-md);
  margin: var(--space-sm) 0;
  font-size: 0.75rem;
  font-family: var(--font-mono);
}

.legend-item  { color: var(--text-muted); }
.legend-current { color: #38bdf8; }
.legend-dest    { color: #f59e0b; }
.legend-visited { color: #34d399; }

/* Text input */
.input-area {
  display: flex;
  gap: var(--space-md);
  max-width: 560px;
  margin: 0 auto var(--space-xs);
}

.answer-input {
  flex: 1;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1.05rem;
  outline: none;
  transition: border-color 0.15s;
}

.answer-input:focus { border-color: var(--accent); }

.answer-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Shake on wrong answer */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  40%       { transform: translateX( 8px); }
  60%       { transform: translateX(-5px); }
  80%       { transform: translateX( 5px); }
}

.answer-input.shake { animation: shake 0.4s ease; }

/* Feedback message */
.map-feedback {
  min-height: 1.6rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: var(--space-xs) 0;
  color: transparent;
  transition: color 0.1s;
  margin-bottom: var(--space-sm);
}

.map-feedback.error { color: var(--accent-red); }

/* Game over */
.result-detail {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: var(--space-lg);
}

.final-route {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  font-size: 0.85rem;
  font-family: var(--font-mono);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
  color: var(--text-secondary);
}

.final-step  { white-space: nowrap; }
.final-arrow { color: var(--text-muted); }

/* Fog-of-war reveal transition.
   The .is-animating class is toggled on only during a valid player move,
   so reveals fade in but the reset to fog on a new puzzle is instant. */
#map.is-animating .leaflet-overlay-pane path {
  transition: fill 0.4s ease, fill-opacity 0.45s ease;
}

/* Responsive */
@media (max-width: 640px) {
  .endpoints {
    flex-direction: column;
    gap: var(--space-md);
  }

  .endpoint-arrow { transform: rotate(90deg); }

  #map { height: 380px; }

  .input-area { flex-direction: column; }
}
