@import url("https://fonts.googleapis.com/css2?family=Archivo:wght@400;500;700&display=swap");

:root {
  --bg: #edf6f5;
  --ink: #111827;
  --muted: #475569;
  --panel: #ffffff;
  --panel-edge: #d6ebe7;
  --accent: #0f766e;
  --accent-soft: #d3faf3;
  --danger: #9f1239;
  --shadow: 0 8px 24px rgba(15, 118, 110, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: "Archivo", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 88% 12%, rgba(15, 118, 110, 0.15), transparent 35%),
    radial-gradient(circle at 8% 90%, rgba(159, 18, 57, 0.11), transparent 30%),
    var(--bg);
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.25rem 0.5rem;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.74rem;
  color: var(--muted);
}

h1 {
  margin: 0.15rem 0 0;
  font-size: clamp(1.3rem, 2vw, 2rem);
}

h2 {
  margin: 0 0 0.65rem;
  font-size: 1rem;
}

.app-grid {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  flex: 1;
  min-height: 0;
  gap: 0.9rem;
  padding: 0.25rem 1rem 1rem;
  overflow: hidden;
}

.controls {
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 0.9rem;
  overflow: auto;
}

.panel {
  border-radius: 16px;
  border: 1px solid var(--panel-edge);
  box-shadow: var(--shadow);
  background: var(--panel);
  padding: 1rem;
}

.field {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.55rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

button,
select,
input[type="range"] {
  width: 100%;
}

.app-header button {
  width: auto;
}

button,
select {
  border-radius: 10px;
  border: 1px solid #9fc8c2;
  padding: 0.52rem 0.72rem;
  font: inherit;
}

button {
  background: var(--accent);
  border-color: var(--accent);
  color: #f8fffe;
  cursor: pointer;
}

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

.ghost-btn {
  background: transparent;
  color: var(--accent);
}

.hint {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.map-card-list {
  display: grid;
  gap: 0.6rem;
}

.map-card {
  border: 1px solid #c8e4df;
  border-radius: 12px;
  padding: 0.65rem;
  background: linear-gradient(180deg, #f6fffd 0%, #ecf8f5 100%);
}

.map-card-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.4rem;
  align-items: baseline;
}

.map-card-head strong {
  font-size: 0.93rem;
}

.rotation-value {
  color: var(--muted);
  font-size: 0.82rem;
}

.workspace {
  min-height: 0;
  height: 100%;
  border-radius: 16px;
  border: 1px solid var(--panel-edge);
  background: #f7fcfb;
  overflow: hidden;
  position: relative;
}

body.controls-collapsed .app-grid {
  grid-template-columns: 1fr;
}

body.controls-collapsed .controls {
  display: none;
}

body.controls-collapsed .workspace,
body.controls-collapsed .side-by-side-view,
body.controls-collapsed .map-canvas {
  min-height: 0;
  height: 100%;
}

.side-by-side-view {
  display: grid;
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.side-by-side-view.overlay-mode {
  display: block;
}

.side-by-side-view.overlay-mode .map-shell {
  position: absolute;
  inset: 0;
  height: 100%;
}

.side-by-side-view.overlay-mode .map-shell.overlay-base {
  z-index: 2;
}

.side-by-side-view.overlay-mode .map-shell.overlay-top {
  z-index: 3;
}

.stage-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, #ffffff, #c2d8d4);
  z-index: 6;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.2);
  pointer-events: auto;
  cursor: ew-resize;
  touch-action: none;
}

.stage-divider::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  border: 2px solid #0f766e;
  box-shadow: 0 2px 8px rgba(15, 118, 110, 0.25);
}

.side-by-side-view.split-horizontal .stage-divider {
  left: 0;
  right: 0;
  width: auto;
  height: 3px;
  cursor: ns-resize;
}

.side-by-side-view.split-horizontal .stage-divider::before {
  left: 50%;
  top: 50%;
}

.map-shell {
  position: relative;
  min-height: 0;
  border: 1px solid #b8d8d3;
  overflow: hidden;
}

.map-canvas {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.map-badge {
  position: absolute;
  left: 0.6rem;
  top: 0.6rem;
  z-index: 8;
  background: rgba(17, 24, 39, 0.72);
  color: white;
  font-size: 0.74rem;
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  letter-spacing: 0.02em;
}

@media (max-width: 980px) {
  .app-grid {
    grid-template-columns: 1fr;
  }

  .workspace,
  .side-by-side-view,
  .map-canvas {
    min-height: 0;
    height: 100%;
  }

  body.controls-collapsed .workspace,
  body.controls-collapsed .side-by-side-view,
  body.controls-collapsed .map-canvas {
    min-height: 0;
    height: 100%;
  }
}
