:root {
  --blue: #1677c8;
  --dark: #1f2937;
  --muted: #64748b;
  --line: #dbe3ee;
  --soft: #f7fafc;
  --panel: #ffffff;
  --success: #0f766e;
  --danger: #b91c1c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 400;
  background: linear-gradient(180deg, #f4f8fc 0%, #ffffff 60%);
  color: var(--dark);
}

.page-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 16px 0 18px;
}

.tool-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 14px;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.06;
  margin-bottom: 8px;
  letter-spacing: -0.8px;
  font-weight: 700;
}

.tool-header p {
  max-width: 760px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
  margin-bottom: 0;
}

.output-pill {
  min-width: 155px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.output-pill span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.output-pill strong {
  display: block;
  color: var(--blue);
  font-size: 21px;
  font-weight: 400;
}

.workspace {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.055);
}

.form-panel { padding: 18px; }
.map-panel { padding: 14px; }

.panel h2 {
  font-size: 18px;
  margin-bottom: 12px;
  font-weight: 400;
}

.field {
  display: block;
  margin: 0 0 13px;
}

.field span {
  display: block;
  font-size: 13px;
  color: #334155;
  margin-bottom: 7px;
}

.field b { color: var(--danger); }

.field small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin-top: 6px;
}

input[type="file"], select, textarea {
  width: 100%;
  border: 1px solid #cfd8e3;
  border-radius: 12px;
  padding: 10px 11px;
  background: #fff;
  color: var(--dark);
  font: inherit;
  outline: none;
}

select { min-height: 42px; }
textarea { resize: vertical; }
input[type="file"] { padding: 9px 10px; }

input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(22, 119, 200, 0.12);
}

.primary-btn, .download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 43px;
  padding: 11px 14px;
  border: none;
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}

.primary-btn { width: 100%; }
.download-btn { min-height: 38px; padding: 9px 12px; white-space: nowrap; }
.primary-btn:hover, .download-btn:hover { filter: brightness(0.95); }

.note, .alert, .warning {
  border-radius: 13px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  margin-top: 12px;
}

.note { background: #eef6ff; color: #075985; border: 1px solid #bfdbfe; }
.alert { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

.success-card {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 13px;
}

.success-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.success-card h3 {
  font-size: 15px;
  font-weight: 400;
  margin-bottom: 0;
}

dl { margin: 0; }
dl div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 8px;
  border-bottom: 1px solid #edf2f7;
  padding: 6px 0;
}
dl div:last-child { border-bottom: 0; }
dt { color: var(--muted); font-size: 12px; }
dd { margin: 0; font-size: 13px; overflow-wrap: anywhere; }

.map-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin-bottom: 10px;
}

.map-head h2 { margin-bottom: 0; }
.map-head p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  margin-bottom: 0;
  text-align: right;
}

#map {
  height: clamp(430px, calc(100vh - 200px), 545px);
  min-height: 430px;
  border-radius: 13px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: #e8eef5;
}

@media (max-width: 980px) {
  .tool-header { flex-direction: column; align-items: stretch; }
  .output-pill { width: 100%; }
  .workspace { grid-template-columns: 1fr; }
  #map { height: 520px; min-height: 520px; }
  .map-head { align-items: start; flex-direction: column; }
  .map-head p { text-align: left; }
}

@media (max-width: 560px) {
  .page-shell { width: min(100% - 20px, 1180px); padding-top: 12px; }
  .form-panel, .map-panel { padding: 14px; }
  dl div { grid-template-columns: 1fr; gap: 3px; }
  .success-title { flex-direction: column; align-items: stretch; }
}
