:root {
  color-scheme: dark;
  --bg: #0f1311;
  --panel: #171d19;
  --panel-2: #101816;
  --ink: #edf3ef;
  --muted: #9daaa3;
  --line: #334039;
  --accent: #33d17a;
  --amber: #f4b942;
  --danger: #ff715b;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

.app-shell {
  width: min(520px, calc(100% - 18px));
  margin: 0 auto;
  padding: 10px 0 18px;
}

.topbar {
  display: grid;
  gap: 18px;
  margin-bottom: 12px;
}

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

.eyebrow {
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.85rem, 8vw, 2.7rem);
  line-height: 1;
}

.status {
  width: fit-content;
  min-height: 32px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}

.status.ready {
  border-color: rgba(51, 209, 122, 0.45);
  color: var(--accent);
}

.status.warning {
  border-color: rgba(244, 185, 66, 0.55);
  color: var(--amber);
}

.calculator {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: stretch;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.input-panel {
  padding: 18px;
}

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

.mgrs-field {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.dz-elevation-field,
.drop-field,
.forecast-time-field {
  margin-top: 12px;
}

.plain-input,
.input-row {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0c100e;
  color: var(--ink);
}

.plain-input {
  width: 100%;
  min-width: 0;
  padding: 0 11px;
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  text-transform: none;
}

.time-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  gap: 8px;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  overflow: hidden;
}

.input-row input {
  width: 100%;
  min-width: 0;
  height: 52px;
  border: 0;
  padding: 0 12px;
  background: transparent;
  color: var(--ink);
  font-size: 1.85rem;
  font-weight: 900;
}

.compact-input-row input {
  height: 46px;
  font-size: 1.35rem;
}

.input-row span {
  padding: 0 12px;
  color: var(--muted);
  font-weight: 900;
}

.plain-input:focus,
.input-row input:focus {
  outline: 2px solid rgba(51, 209, 122, 0.38);
  outline-offset: -1px;
}

.control-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 14px;
}

button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid rgba(51, 209, 122, 0.7);
  border-radius: 6px;
  background: var(--accent);
  color: #07100b;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 900;
  cursor: pointer;
  text-transform: uppercase;
}

button.loading::before {
  content: "";
  width: 15px;
  height: 15px;
  margin-right: 9px;
  border: 2px solid rgba(7, 16, 11, 0.35);
  border-top-color: #07100b;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

button:hover {
  filter: brightness(1.08);
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.secondary {
  background: #0c100e;
  color: var(--accent);
}

.map-panel {
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.map-frame {
  position: relative;
}

#map {
  width: 100%;
  height: min(58vh, 360px);
  min-height: 260px;
  background: #0c100e;
}

.crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 500;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  border: 2px solid var(--accent);
  border-radius: 50%;
  filter: drop-shadow(0 0 4px rgba(7, 16, 11, 0.95)) drop-shadow(0 0 10px rgba(51, 209, 122, 0.38));
}

.crosshair::before,
.crosshair::after,
.crosshair span::before,
.crosshair span::after {
  content: "";
  position: absolute;
  background: var(--accent);
}

.crosshair::before {
  left: 50%;
  top: -10px;
  width: 2px;
  height: 12px;
  transform: translateX(-50%);
}

.crosshair::after {
  left: 50%;
  bottom: -10px;
  width: 2px;
  height: 12px;
  transform: translateX(-50%);
}

.crosshair span::before {
  left: -10px;
  top: 50%;
  width: 12px;
  height: 2px;
  transform: translateY(-50%);
}

.crosshair span::after {
  right: -10px;
  top: 50%;
  width: 12px;
  height: 2px;
  transform: translateY(-50%);
}

.crosshair span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 2px rgba(7, 16, 11, 0.82);
}

.leaflet-container {
  font: inherit;
}

.leaflet-control-attribution {
  font-size: 10px;
}

.hint {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.result-panel {
  display: grid;
  grid-template-rows: 1fr auto;
  overflow: hidden;
}

.result-main {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 190px;
  padding: 22px;
  background: var(--panel-2);
  text-align: center;
}

.result-main .label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.result-main strong {
  margin-top: 8px;
  color: var(--accent);
  font-size: clamp(4.2rem, 18vw, 6.4rem);
  line-height: 0.92;
}

.result-main span:last-child {
  margin-top: 8px;
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 900;
}

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

.metrics {
  border-top: 1px solid var(--line);
  grid-template-columns: 1fr 1fr;
}

.metrics div {
  min-width: 0;
  padding: 15px 17px;
  border-right: 0;
  border-bottom: 1px solid var(--line);
}

.metrics div:last-child {
  border-bottom: 0;
}

.metrics div:nth-last-child(2) {
  border-bottom: 0;
}

.metrics div:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.metrics span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.metrics strong {
  display: block;
  color: var(--ink);
  font-size: clamp(1rem, 2vw, 1.35rem);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.metrics strong {
  white-space: nowrap;
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 18px, 1240px);
    padding-top: 10px;
  }

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