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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f7f5f2;
  color: #1a1a1a;
  min-height: 100vh;
  padding: 24px 16px 48px;
}

.container {
  max-width: 680px;
  margin: 0 auto;
}

header {
  text-align: center;
  margin-bottom: 32px;
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #111;
}

.subtitle {
  margin-top: 8px;
  color: #666;
  font-size: 0.95rem;
}

/* Upload area */
.upload-area {
  border: 2px dashed #ccc;
  border-radius: 16px;
  background: #fff;
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.upload-area:hover, .upload-area.drag-over {
  border-color: #ff6b35;
  background: #fff9f6;
}

.upload-icon { font-size: 3rem; margin-bottom: 12px; }

.upload-hint {
  font-size: 1rem;
  color: #444;
  margin-bottom: 6px;
}

.browse-link {
  color: #ff6b35;
  text-decoration: underline;
  cursor: pointer;
  font-weight: 600;
}

.upload-note {
  font-size: 0.8rem;
  color: #999;
  margin-top: 8px;
}

/* Preview */
.preview-section { margin-top: 24px; }

.preview-grid {
  display: flex;
  gap: 20px;
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  align-items: flex-start;
}

.preview-img {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
}

.location-info { flex: 1; min-width: 0; }

.info-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #999;
  margin-bottom: 4px;
  margin-top: 12px;
}

.info-label:first-child { margin-top: 0; }

.coords-display {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.85rem;
  color: #333;
}

.address-display {
  font-size: 0.88rem;
  color: #444;
  line-height: 1.4;
}

.map-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.82rem;
  color: #ff6b35;
  text-decoration: none;
  font-weight: 600;
}

.map-link:hover { text-decoration: underline; }

/* Upload area — active (processing) state */
.upload-area.processing {
  cursor: default;
  border-style: solid;
  border-color: #ff6b35;
  background: #fff9f6;
  padding: 20px;
  text-align: left;
}

.upload-state { width: 100%; }

#upload-active {
  display: flex;
  align-items: center;
  gap: 16px;
}

.upload-active-thumb {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 12px;
  flex-shrink: 0;
  background: #f0f0f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.upload-active-info {
  flex: 1;
  min-width: 0;
}

.upload-active-filename {
  font-size: 0.78rem;
  color: #888;
  margin-bottom: 8px;
  word-break: break-all;
  line-height: 1.3;
}

.upload-active-progress-bar {
  background: #f0f0f0;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.upload-active-fill {
  background: linear-gradient(90deg, #ff6b35, #ff8d57);
  height: 100%;
  width: 0%;
  border-radius: 4px;
  transition: width 0.25s ease;
}

.upload-active-fill.indeterminate {
  width: 40%;
  animation: slide 1.4s ease-in-out infinite;
}

@keyframes slide {
  0% { margin-left: -40%; }
  100% { margin-left: 100%; }
}

.upload-active-status {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.2;
}

.upload-active-substatus {
  font-size: 0.8rem;
  color: #ff6b35;
  font-weight: 600;
  margin-top: 2px;
}

/* Interrupt banner (shown if iOS reloaded the page mid-upload) */
.interrupt-banner {
  background: #fff8e1;
  border: 1px solid #ffd54f;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
  color: #6d4c00;
  font-size: 0.88rem;
  line-height: 1.4;
}

.interrupt-banner strong {
  display: block;
  margin-bottom: 4px;
  color: #4a3500;
}

.interrupt-banner p {
  margin: 0;
}

/* Error */
.error-box {
  background: #fff5f5;
  border: 1px solid #ffd0d0;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  margin-top: 24px;
  color: #c0392b;
}

.error-icon { font-size: 2rem; margin-bottom: 8px; }

/* Results */
.results-section { margin-top: 24px; }

.top-guess {
  background: #ff6b35;
  color: #fff;
  border-radius: 16px;
  padding: 28px 24px;
  margin-bottom: 16px;
}

.guess-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.8;
  margin-bottom: 8px;
}

.top-name {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.top-meta {
  font-size: 0.88rem;
  opacity: 0.85;
  margin-bottom: 16px;
}

.btn-map {
  display: inline-block;
  background: rgba(255,255,255,0.2);
  color: #fff;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s;
}

.btn-map:hover { background: rgba(255,255,255,0.35); }

.section-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #999;
  margin-bottom: 10px;
}

.places-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.place-item {
  background: #fff;
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07);
}

.place-info { flex: 1; min-width: 0; }

.place-name {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.place-type {
  font-size: 0.78rem;
  color: #888;
  margin-top: 2px;
  text-transform: capitalize;
}

.place-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.place-distance {
  font-size: 0.82rem;
  font-weight: 600;
  color: #ff6b35;
  white-space: nowrap;
}

.place-map-link {
  font-size: 0.78rem;
  color: #999;
  text-decoration: none;
  white-space: nowrap;
}

.place-map-link:hover { color: #ff6b35; text-decoration: underline; }

.hidden { display: none !important; }

/* Progress steps */
.progress-steps {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-step {
  font-size: 0.85rem;
  color: #888;
  transition: color 0.3s;
}

.progress-step.active {
  color: #ff6b35;
  font-weight: 600;
}

/* Copy coordinates button */
.coords-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.copy-btn {
  font-size: 0.72rem;
  font-weight: 600;
  color: #ff6b35;
  background: none;
  border: 1px solid #ff6b35;
  border-radius: 6px;
  padding: 2px 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.copy-btn:hover { background: #ff6b35; color: #fff; }
.copy-btn.copied { border-color: #27ae60; color: #27ae60; }
.copy-btn.copied:hover { background: #27ae60; color: #fff; }

/* Leaflet map */
.map-container {
  margin-top: 24px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

#leaflet-map {
  height: 340px;
  width: 100%;
}
