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

body {
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #e8e8e8;
  min-height: 100vh;
  color: #2a2a2a;
}

.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  background: #f5f5f5;
  border-bottom: 1px solid #ddd;
  padding: 2rem 1.5rem;
  text-align: center;
}

.header-content {
  max-width: 800px;
  margin: 0 auto;
}

.title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  color: #1a1a1a;
  margin-bottom: 0.5rem;
}

.subtitle {
  font-size: 0.95rem;
  color: #666;
  font-weight: 300;
}

.main-content {
  flex: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
}

.search-form {
  margin-bottom: 1.5rem;
}

.input-wrapper {
  display: flex;
  gap: 0.75rem;
  max-width: 600px;
  margin: 0 auto;
}

.city-input {
  flex: 1;
  padding: 1rem 1.25rem;
  font-size: 1rem;
  font-family: inherit;
  border: 2px solid #ccc;
  border-radius: 12px;
  background: #fff;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.city-input:focus {
  outline: none;
  border-color: #4A90A4;
  box-shadow: 0 2px 12px rgba(74, 144, 164, 0.15);
}

.city-input::placeholder {
  color: #999;
}

.generate-btn {
  padding: 1rem 2rem;
  font-size: 1rem;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 500;
  background: linear-gradient(135deg, #4A90A4, #3a7a94);
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.generate-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(74, 144, 164, 0.3);
}

.generate-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.quick-select {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 2rem;
}

.city-chip {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-family: inherit;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #444;
}

.city-chip:hover:not(:disabled) {
  background: #f0f0f0;
  border-color: #bbb;
}

.city-chip.surprise {
  background: linear-gradient(135deg, #f8f8f8, #fff);
  border-color: #4A90A4;
  color: #4A90A4;
}

.city-chip:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4rem 2rem;
  gap: 1.5rem;
}

.building-icon {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 80px;
}

.building {
  background: #4A90A4;
  border-radius: 4px 4px 0 0;
  width: 20px;
}

.building.b1 { height: 80px; }
.building.b2 { height: 60px; }
.building.b3 { height: 45px; }

.building-icon.animate .building {
  animation: buildUp 1.5s ease-in-out infinite;
}

.building-icon.animate .b1 { animation-delay: 0s; }
.building-icon.animate .b2 { animation-delay: 0.2s; }
.building-icon.animate .b3 { animation-delay: 0.4s; }

@keyframes buildUp {
  0%, 100% { transform: scaleY(0.3); opacity: 0.5; }
  50% { transform: scaleY(1); opacity: 1; }
}

.loading-text {
  font-size: 1rem;
  color: #666;
  font-weight: 300;
}

.error-container {
  text-align: center;
  padding: 2rem;
  background: #fff5f5;
  border-radius: 12px;
  margin-bottom: 2rem;
}

.error-container p {
  color: #c53030;
  margin-bottom: 1rem;
}

.retry-btn {
  padding: 0.75rem 1.5rem;
  font-family: inherit;
  background: #c53030;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.retry-btn:hover {
  background: #9b2c2c;
}

.result-container {
  background: #fff;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  margin-bottom: 2rem;
}

.image-wrapper {
  background: #f5f5f5;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.generated-image {
  width: 100%;
  height: auto;
  display: block;
}

.city-name {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-align: center;
  color: #1a1a1a;
  margin-bottom: 1.5rem;
}

.building-facts {
  margin-bottom: 1.5rem;
}

.building-facts h3 {
  font-size: 0.9rem;
  font-weight: 500;
  color: #666;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.facts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.fact-card {
  background: #f8f8f8;
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.fact-rank {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  color: #4A90A4;
  font-weight: 500;
}

.fact-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: #1a1a1a;
  line-height: 1.3;
}

.fact-height {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.1rem;
  font-weight: 600;
  color: #333;
}

.fact-year {
  font-size: 0.8rem;
  color: #888;
}

.action-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.action-btn {
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 500;
  border: 2px solid #ddd;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #fff;
  color: #444;
}

.action-btn:hover {
  border-color: #4A90A4;
  color: #4A90A4;
}

.action-btn.download {
  background: #4A90A4;
  border-color: #4A90A4;
  color: white;
}

.action-btn.download:hover {
  background: #3a7a94;
  border-color: #3a7a94;
  color: white;
}

.history-section {
  background: #fff;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.history-header h3 {
  font-size: 1rem;
  font-weight: 500;
  color: #333;
}

.clear-btn {
  font-size: 0.85rem;
  font-family: inherit;
  color: #888;
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s;
}

.clear-btn:hover {
  color: #c53030;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 1rem;
}

.history-item {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-align: center;
  transition: transform 0.2s;
}

.history-item:hover {
  transform: scale(1.05);
}

.history-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

.history-city {
  font-size: 0.8rem;
  color: #666;
}

.footer {
  background: #f5f5f5;
  border-top: 1px solid #ddd;
  padding: 1.5rem;
  text-align: center;
}

.footer p {
  font-size: 0.85rem;
  color: #666;
}

.footer a {
  color: #4A90A4;
  text-decoration: none;
  font-weight: 500;
}

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

.footer-note {
  font-size: 0.75rem;
  margin-top: 0.5rem;
  color: #999;
}

@media (max-width: 640px) {
  .title {
    font-size: 1.5rem;
    letter-spacing: 0.1em;
  }
  
  .input-wrapper {
    flex-direction: column;
  }
  
  .generate-btn {
    width: 100%;
  }
  
  .facts-grid {
    grid-template-columns: 1fr;
  }
  
  .action-buttons {
    flex-direction: column;
  }
  
  .action-btn {
    width: 100%;
  }
  
  .history-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}