:root {
  --accent: #1762ff;
  --accent-dark: #0f40a6;
  --success: #23c585;
  --surface: #ffffff;
  --surface-soft: #f3f6ff;
  --text-strong: #0f1b2c;
  --card-shadow: 0 24px 60px rgba(23, 98, 255, 0.14);
  --border-color: #d5ddff;
}

* { box-sizing: border-box; }

body {
  font-family: "Segoe UI", Tahoma, sans-serif;
  font-size: 19px;
  line-height: 1.55;
  padding: 24px;
  margin: 0;
  background: linear-gradient(145deg, #061b3a, #133b73 55%, #1f5f8f);
  color: var(--text-strong);
}

h1, h2 { color: var(--text-strong); }

.container {
  width: 100%;
  max-width: 760px;
  margin: auto;
  background: var(--surface);
  padding: 32px;
  border-radius: 30px;
  box-shadow: var(--card-shadow);
}

.conversion-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
}

.conversion-header .conversion-label {
  margin: 0;
  flex: 1;
}

.city-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.city-select {
  margin-top: 0;
  flex: 1;
  width: 100%;
}

.city-zone-badge {
  background: var(--surface-soft);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 8px 14px;
  font-size: 0.95rem;
  color: var(--accent-dark);
  white-space: nowrap;
}

.city-zone-badge[hidden] {
  display: none;
}

label { display: block; margin-top: 12px; font-weight: 600; }

select, input, button {
  width: 100%;
  padding: clamp(12px, 3vw, 18px);
  margin-top: 6px;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  background: #fdfdfd;
  font-size: 1.2rem;
  min-height: 48px;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

select:focus, input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 75, 123, 0.12);
  outline: none;
}

input[type="text"], input[type="number"], textarea, select, .result {
  direction: ltr;
  text-align: left;
}


.btntout {
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1.15rem;
  font-weight: 600;
  box-shadow: 0 14px 28px rgba(23, 98, 255, 0.25);
}

.btntout:hover { background: var(--accent-dark); }

button {
  background: var(--success);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1.15rem;
  font-weight: 600;
  box-shadow: 0 12px 24px rgba(35, 197, 133, 0.25);
}

button:hover { background: #199a64; }

.reload-btn {
  margin-top: 14px;
  margin-bottom: 12px;
  width: 50px;
  height: 50px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--text-strong);
  background-color: rgb(74, 46, 150);
  box-shadow: 0 12px 24px rgba(62, 90, 230, 0.895);
}

.reload-btn:hover { background: #17233a; }

.reload-btn span { font-size: 1.4rem; color: #fff; }

.download-btn {
  background: #00a8b5;
  margin-top: 12px;
  box-shadow: 0 14px 28px rgba(0, 168, 181, 0.25);
}

.download-btn:disabled,
.btntout:disabled,
button:disabled {
  background: #c2c8d3;
  box-shadow: none;
  cursor: not-allowed;
}

.result {
  margin-top: 20px;
  padding: 18px;
  background: var(--surface-soft);
  border-left: 5px solid var(--success);
  white-space: pre-wrap;
  direction: ltr;
  text-align: left;
  border-radius: 18px;
}

.hint {
  font-size: 1rem;
  color: #334155;
  margin-top: 6px;
  direction: rtl;
  text-align: right;
}

.csv-image {
  display: none;
  margin-top: 12px;
  max-width: 100%;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 8px 20px rgba(20, 32, 56, 0.08);
}

.manual-box {
  margin-top: 25px;
  padding: 24px;
  border: 1px solid var(--border-color);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--card-shadow);
}

.live-layout {
  margin-top: 25px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.live-layout .manual-box,
.live-layout .map-box {
  margin-top: 0;
}

.map-box {
  margin-top: 32px;
  padding: 24px;
  border: 1px solid var(--border-color);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--card-shadow);
}

.dms-popup {
  direction: ltr;
  text-align: left;
  display: inline-block;
  font-family: "Segoe UI", Tahoma, sans-serif;
  font-size: 0.95rem;
}

.map-wrapper {
  position: relative;
}

#map {
  width: 100%;
  height: 380px;
  border-radius: 24px;
  margin-top: 16px;
  overflow: hidden;
  box-shadow: 0 26px 60px rgba(15, 27, 44, 0.18);
}

.gps-btn {
  position: absolute;
  top: 20px;
  left: 20px;
  width: auto;
  min-width: 0;
  padding: 12px 22px;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  font-size: 1rem;
  box-shadow: 0 16px 32px rgba(23, 98, 255, 0.28);
  z-index: 500;
}

.gps-btn:hover {
  background: var(--accent-dark);
}

.basemap-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: auto;
  min-width: 0;
  padding: 12px 20px;
  background: #0f1b2c;
  color: #fff;
  border-radius: 999px;
  font-size: 1rem;
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 16px 32px rgba(15, 27, 44, 0.28);
  z-index: 500;
}

.basemap-btn:hover {
  background: #1d3354;
}

.manual-title { margin-top: 0; font-size: 1.25rem; }

.manual-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.manual-fields input {
  flex: 1 1 100%;
  min-width: auto;
  font-size: 1.25rem;
  min-height: 56px;
}

.manual-btn { margin-top: 14px; }

.single-result { margin-top: 18px; }

.dms-group { width: 100%; }

.dms-group label { font-size: 0.95rem; margin-bottom: 6px; display: block; }

.dms-row {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
  align-items: center;
  direction: ltr;
}

.dms-row input {
  flex: 1 1 auto;
  min-width: 80px;
  font-size: 1.2rem;
  min-height: 52px;
}

.dms-row select {
  width: auto;
  min-width: 110px;
  font-size: 1.2rem;
  min-height: 52px;
}

.hemisphere-select { flex: 1 1 100%; }

#batchSection {
  margin-top: 30px;
  padding: 26px;
  border: 1px solid var(--border-color);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--card-shadow);
}

@media (min-width: 641px) {
  .live-layout {
    flex-direction: row-reverse;
    align-items: stretch;
  }

  .live-layout .manual-box,
  .live-layout .map-box {
    flex: 1 1 0;
  }

  .conversion-header {
    flex-wrap: nowrap;
  }

  .conversion-header .conversion-label {
    flex: 0 1 auto;
    white-space: nowrap;
  }

  .city-picker {
    flex: 0 0 auto;
    min-width: 280px;
  }

  .city-select {
    width: auto;
    min-width: 220px;
  }
}

@media (max-width: 640px) {
  body {
    padding: 0;
    background: linear-gradient(180deg, #04112b, #062046);
    font-size: 24px;
    line-height: 1.85;
  }

  .container {
    max-width: 100% !important;
    border-radius: 0;
    min-height: 100vh;
    padding: 32px 0 60px;
    margin: 0 ;
    box-shadow: none;
    
  }

  h2 { font-size: 1.75rem; }
  .manual-title { font-size: 1.55rem; }

  .manual-fields {
    flex-direction: column;
    gap: 18px;
  }

  .manual-fields input {
    flex: 1 1 100%;
    min-width: auto;
  }

  .dms-row {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 8px;
  }

  .dms-row input,
  .dms-row select {
    flex: 1 1 0;
    min-width: 0;
    font-size: 1.1rem;
    min-height: 48px;
  }

  button, .btntout, .download-btn {
    font-size: 1.4rem;
    padding: clamp(16px, 5vw, 22px);
    border-radius: 18px;
  }

  .manual-box, #batchSection {
    padding: 22px;
    border-radius: 28px;
  }

  .map-box {
    padding: 20px;
    border-radius: 0;
    margin-top: 34px;
  }

  .gps-btn {
    top: 12px;
    left: 12px;
    font-size: 1.1rem;
    padding: 10px 18px;
  }

  .basemap-btn {
    top: 60px;
    right: 12px;
    font-size: 1.05rem;
    padding: 10px 18px;
  }

  #map {
    height: clamp(260px, 48vh, 420px);
    border-radius: 0;
  }

  .result {
    font-size: 1.25rem;
    border-left-width: 0;
    border-radius: 20px;
  }

  select, input {
    border-radius: 18px;
    font-size: 0.8rem;
    min-height: clamp(52px, 12vw, 68px);
  }

  .conversion-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .city-picker {
    flex-direction: column;
    align-items: stretch;
  }

  .city-zone-badge {
    width: 100%;
    text-align: center;
  }

  .hint { font-size: 1.25rem; }
}