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

body {
  font-family: 'Inter', 'Google Sans', 'Segoe UI', Arial, sans-serif;
  background: #f0f1ff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

header {
  width: 100%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  padding: 18px 32px;
  display: flex;
  align-items: center;
  gap: 12px;
}

header .logo {
  font-size: 1.6rem;
  font-weight: 700;
  color: #818cf8;
  letter-spacing: -0.5px;
}

header .tagline {
  font-size: 0.95rem;
  color: #9ca3af;
}

.container {
  width: 100%;
  max-width: 560px;
  margin: 36px auto 0;
  padding: 0 16px;
}

.card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.07);
  border: 1px solid #eeeff5;
  padding: 32px 28px 28px;
}

.card h2 {
  font-size: 1.1rem;
  color: #374151;
  margin-bottom: 20px;
  font-weight: 600;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 22px;
}

.input-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-wrapper label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-wrapper input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 999px;
  font-size: 0.97rem;
  color: #1e2433;
  outline: none;
  transition: border-color 0.2s;
  background: #fafbfc;
}

.input-wrapper input:focus {
  border-color: #818cf8;
  background: #fff;
}

.mode-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.mode-label {
  font-size: 0.8rem;
  color: #9ca3af;
  white-space: nowrap;
}

.mode-select {
  flex: 1;
  padding: 7px 10px;
  border: 1.5px solid #e5e7eb;
  border-radius: 999px;
  font-size: 0.88rem;
  color: #374151;
  background: #fafbfc;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.mode-select:focus {
  border-color: #818cf8;
  background: #fff;
}

.vibe-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.vibe-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.vibe-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.vibe-btn {
  padding: 7px 16px;
  border: 1.5px solid #e5e7eb;
  border-radius: 20px;
  background: #fff;
  color: #6b7280;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}

.vibe-btn:hover {
  border-color: #818cf8;
  color: #818cf8;
  background: #eef2ff;
}

.vibe-btn.active {
  border-color: #818cf8;
  background: #818cf8;
  color: #fff;
}

.place-empty {
  font-size: 0.9rem;
  color: #9ca3af;
  font-style: italic;
  padding: 12px 0 4px;
  list-style: none;
}

.btn {
  width: 100%;
  padding: 13px;
  background: #818cf8;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  letter-spacing: 0.2px;
}

.btn:hover {
  background: #6366f1;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  background: #c7d2fe;
  cursor: not-allowed;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  width: 28px;
  height: 28px;
  margin: 14px auto 0;
  border: 3px solid #e0e7ff;
  border-top-color: #818cf8;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

#error-msg {
  margin-top: 8px;
  font-size: 0.9rem;
  color: #f43f5e;
  min-height: 20px;
  text-align: center;
}

#map-section {
  width: 100%;
  max-width: 560px;
  margin: 24px auto 0;
  padding: 0 16px;
  display: none;
}

#midpoint-info {
  background: #fff;
  border-radius: 12px 12px 0 0;
  padding: 14px 18px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.05);
  border-bottom: 1px solid #f0f1f5;
}

.midpoint-text {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

#travel-times {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.travel-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #eef2ff;
  border-radius: 20px;
  padding: 3px 10px 3px 6px;
  font-size: 0.8rem;
  color: #6b7280;
}

.travel-chip .chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #818cf8;
  flex-shrink: 0;
}

.travel-chip strong {
  color: #6366f1;
  font-weight: 600;
}

#midpoint-info .pin-icon {
  font-size: 1.3rem;
}

#midpoint-label {
  font-size: 0.93rem;
  color: #4b5563;
  font-weight: 500;
}

#map {
  width: 100%;
  height: 380px;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.08);
}

#midpoint-actions-row {
  display: none;
  width: 100%;
  max-width: 560px;
  margin: 14px auto 0;
  padding: 0 16px;
  flex-direction: row;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

#share-section {
  flex-shrink: 0;
}

#adjust-midpoint-wrap {
  flex-shrink: 0;
}

.btn-adjust {
  background: none;
  border: none;
  color: #818cf8;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s;
}

.btn-adjust:hover {
  color: #6366f1;
}

.drag-hint {
  display: none;
  margin-top: 8px;
  padding: 10px 14px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  font-size: 0.88rem;
  color: #6b7280;
  font-weight: 500;
}

#find-places-wrap {
  display: none;
  width: 100%;
  max-width: 560px;
  margin: 20px auto 0;
  padding: 0 16px;
}

.btn-places {
  background: #fff;
  color: #818cf8;
  border: 2px solid #818cf8;
  font-weight: 600;
  transition: background 0.18s, color 0.18s;
}

.btn-places:hover {
  background: #818cf8;
  color: #fff;
}

.btn-places:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: #fff;
  color: #818cf8;
}

#places-section {
  width: 100%;
  max-width: 560px;
  margin: 20px auto 40px;
  padding: 0 16px;
  display: none;
}

.places-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 10px;
}

.places-heading {
  font-size: 1rem;
  font-weight: 600;
  color: #374151;
  margin: 0 0 12px;
  padding-left: 2px;
}

.share-wrap {
  position: relative;
  flex-shrink: 0;
}

.share-btn {
  background: none;
  border: 1.5px solid #818cf8;
  color: #818cf8;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.share-btn:hover {
  background: #818cf8;
  color: #fff;
}

.share-panel {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: #fff;
  border: 1px solid #eeeff5;
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.1);
  min-width: 180px;
  z-index: 100;
  overflow: hidden;
}

.share-panel.open {
  display: block;
}

.share-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 11px 16px;
  font-size: 0.9rem;
  color: #374151;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.13s;
  box-sizing: border-box;
  text-align: left;
}

.share-opt:hover {
  background: #eef2ff;
  color: #6366f1;
}

.share-opt + .share-opt {
  border-top: 1px solid #f5f6fa;
}

#share-native {
  display: none;
}

.copy-feedback {
  font-size: 0.78rem;
  color: #10b981;
  font-weight: 600;
  margin-top: 6px;
  display: none;
  text-align: right;
}

#places-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.place-item {
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.05);
  border: 1px solid #eeeff5;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.place-item:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.09);
  border-color: #e0e7ff;
}

.place-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.place-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.place-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  background: #f0f1f5;
}

.place-thumb-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  flex-shrink: 0;
  background: #f0f1f5;
}

.place-name-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.place-name {
  font-size: 0.97rem;
  font-weight: 600;
  color: #6366f1;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.place-name:hover {
  text-decoration: underline;
}

.place-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.place-rating {
  display: flex;
  align-items: center;
  gap: 5px;
}

.place-distance {
  font-size: 0.8rem;
  color: #9ca3af;
  font-weight: 500;
  white-space: nowrap;
}

.stars {
  color: #fbbf24;
  font-size: 0.95rem;
  letter-spacing: 1px;
}

.stars-empty {
  color: #e5e7eb;
}

.rating-num {
  font-size: 0.82rem;
  color: #6b7280;
  font-weight: 500;
}

.review-count {
  font-size: 0.78rem;
  color: #9ca3af;
}

.place-type {
  font-size: 0.8rem;
  color: #9ca3af;
  margin-top: 1px;
}

.place-price {
  font-size: 0.82rem;
  color: #059669;
  font-weight: 600;
}

.meta-sep {
  color: #d1d5db;
  font-size: 0.75rem;
  line-height: 1;
}

.no-rating {
  font-size: 0.82rem;
  color: #9ca3af;
  font-style: italic;
}

.place-link {
  font-size: 0.82rem;
  color: #6366f1;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 500;
  border: 1.5px solid #c7d2fe;
  border-radius: 999px;
  padding: 5px 10px;
  transition: background 0.15s;
}

.place-link:hover {
  background: #eef2ff;
}

.place-parking {
  font-size: 0.82rem;
  color: #059669;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 500;
  border: 1.5px solid #a7f3d0;
  border-radius: 999px;
  padding: 5px 10px;
  transition: background 0.15s;
}

.place-parking:hover {
  background: #ecfdf5;
}

.place-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.place-share-wrap {
  position: relative;
}

.place-share-btn {
  font-size: 0.82rem;
  color: #6b7280;
  background: none;
  border: 1.5px solid #e5e7eb;
  border-radius: 999px;
  padding: 5px 10px;
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
}

.place-share-btn:hover {
  border-color: #818cf8;
  color: #6366f1;
}

.place-share-panel {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  background: #fff;
  border: 1px solid #eeeff5;
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.1);
  min-width: 170px;
  z-index: 200;
  overflow: hidden;
}

.place-share-panel.open {
  display: block;
}

.pso {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  font-size: 0.88rem;
  color: #374151;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  text-align: left;
  box-sizing: border-box;
  transition: background 0.13s;
}

.pso:hover {
  background: #eef2ff;
  color: #6366f1;
}

.pso + .pso {
  border-top: 1px solid #f5f6fa;
}
