* {
  box-sizing: border-box;
}

:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #eef4ff;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #dbe3ef;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 35%),
    var(--bg);
  color: var(--text);
}

.app {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
  padding: 32px;
  border-radius: 28px;
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  color: white;
  box-shadow: var(--shadow);
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 1;
}

.hero p {
  max-width: 720px;
  margin: 14px 0 0;
  font-size: 1rem;
  opacity: 0.94;
}

.eyebrow {
  margin: 0 0 12px !important;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem !important;
  font-weight: 700;
}

.connection-badge {
  flex: 0 0 auto;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.28);
  font-size: 0.88rem;
  font-weight: 800;
  white-space: nowrap;
}

.connection-badge.online {
  background: rgba(22, 163, 74, 0.25);
}

.connection-badge.offline {
  background: rgba(217, 119, 6, 0.3);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.card {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.card.wide {
  grid-column: 1 / -1;
}

.card h2 {
  margin: 0 0 8px;
  font-size: 1.25rem;
}

.muted {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.5;
}

.file-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  padding: 20px;
  border: 2px dashed var(--primary);
  border-radius: 18px;
  background: var(--surface-soft);
  color: var(--primary-dark);
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: 0.2s ease;
}

.file-box:hover {
  transform: translateY(-1px);
  background: #e0ebff;
}

.file-box input {
  display: none;
}

.preview-box {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 240px;
  margin: 18px 0;
  border-radius: 18px;
  overflow: hidden;
  background: #f8fafc;
  border: 1px solid var(--border);
}

.preview-box img {
  display: none;
  width: 100%;
  height: 100%;
  max-height: 360px;
  object-fit: contain;
}

.preview-box p {
  padding: 20px;
  color: var(--muted);
  text-align: center;
}

textarea {
  width: 100%;
  min-height: 260px;
  resize: vertical;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text);
  font: inherit;
  line-height: 1.5;
  outline: none;
}

textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.btn {
  width: 100%;
  margin-top: 12px;
  border: 0;
  border-radius: 14px;
  padding: 14px 18px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: 0.2s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

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

.btn.primary {
  background: var(--primary);
  color: white;
}

.btn.primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn.secondary {
  background: #e5e7eb;
  color: var(--text);
}

.status {
  min-height: 24px;
  margin-top: 12px;
  font-size: 0.92rem;
  color: var(--muted);
}

.status.success {
  color: var(--success);
}

.status.error {
  color: var(--danger);
}

.status.warning {
  color: var(--warning);
}

.actions {
  display: grid;
  grid-template-columns: 260px 1fr;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.actions .btn {
  margin-top: 0;
}

.coords {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.coords p {
  margin: 0;
  padding: 14px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
}

#map {
  width: 100%;
  height: 380px;
  margin-top: 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  overflow: hidden;
}

@media (max-width: 760px) {
  .app {
    padding: 14px;
  }

  .hero {
    flex-direction: column;
    padding: 24px;
    border-radius: 22px;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .actions {
    grid-template-columns: 1fr;
  }

  .coords {
    grid-template-columns: 1fr;
  }

  #map {
    height: 320px;
  }
}
