* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
  min-height: 100vh;
}

h1 {
  text-align: center;
  padding: 20px 20px 0;
  font-size: 1.5rem;
  color: #ffcb05;
  text-shadow: 2px 2px 0 #3466af;
  margin-bottom: 0;
}

.subtitle {
  text-align: center;
  color: #ccc;
  font-size: 0.95rem;
  margin: 4px 0 16px;
  padding: 0 20px;
}

.app {
  display: flex;
  gap: 24px;
  padding: 0 24px 24px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Left panel - inputs */
.input-panel {
  flex: 1;
  min-width: 320px;
  max-width: 480px;
}

.milestone {
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}

.milestone-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.milestone-arrows {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.arrow-btn {
  background: none;
  border: 1px solid #0f3460;
  color: #ffcb05;
  font-size: 0.5rem;
  cursor: pointer;
  padding: 1px 4px;
  border-radius: 3px;
  line-height: 1;
}

.arrow-btn:hover:not(:disabled) {
  background: #0f3460;
}

.arrow-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.milestone-label {
  font-weight: bold;
  font-size: 0.9rem;
  color: #ffcb05;
}

.pokemon-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pokemon-slot {
  position: relative;
  width: 100%;
  max-width: 220px;
}

.pokemon-slot input {
  width: 100%;
  padding: 6px 30px 6px 8px;
  border: 1px solid #0f3460;
  border-radius: 4px;
  background: #1a1a2e;
  color: #e0e0e0;
  font-size: 0.85rem;
  outline: none;
}

.pokemon-slot input:focus {
  border-color: #ffcb05;
}

.pokemon-slot input.has-selection {
  border-color: #4caf50;
}

.slot-sprite {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  image-rendering: pixelated;
  pointer-events: none;
}

.clear-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #e74c3c;
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 4px;
  line-height: 1;
  display: none;
}

.pokemon-slot:hover .clear-btn,
.pokemon-slot input:focus ~ .clear-btn {
  display: block;
}

.pokemon-slot:hover .slot-sprite,
.pokemon-slot input:focus ~ .slot-sprite {
  display: none;
}

.dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #16213e;
  border: 1px solid #0f3460;
  border-top: none;
  border-radius: 0 0 4px 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}

.dropdown.open {
  display: block;
}

.dropdown-divider {
  height: 1px;
  background: #0f3460;
  margin: 4px 8px;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 0.85rem;
}

.dropdown-item:hover,
.dropdown-item.highlighted {
  background: #0f3460;
}

.dropdown-item canvas {
  image-rendering: pixelated;
}

/* Right panel - preview */
.preview-panel {
  flex: 1;
  position: sticky;
  top: 20px;
  align-self: flex-start;
}

.preview-panel h2 {
  font-size: 1rem;
  margin-bottom: 12px;
  color: #ccc;
}

#journey-canvas {
  border: 2px solid #0f3460;
  border-radius: 8px;
  max-width: 100%;
  image-rendering: pixelated;
  background: #fff;
}

.download-btn {
  display: inline-block;
  margin-top: 12px;
  padding: 10px 24px;
  background: #ffcb05;
  color: #1a1a2e;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  font-size: 0.9rem;
  cursor: pointer;
}

.download-btn:hover {
  background: #e6b800;
}

.footer-credits {
  margin-top: 24px;
  font-size: 0.8rem;
  color: #888;
  line-height: 1.6;
}

.footer-credits a {
  color: #ffcb05;
  text-decoration: none;
}

.footer-credits a:hover {
  text-decoration: underline;
}

.footer-credits p {
  margin-bottom: 4px;
}

@media (max-width: 768px) {
  .app {
    flex-direction: column;
  }
  .input-panel {
    max-width: 100%;
  }
  .preview-panel {
    position: static;
  }
}
