:root{
  --fmv-blue:#082b45;
  --fmv-orange:#e95f18;
  --cream:#f4ead8;
  --paper:#fff7ed;
  --border:#ded2c2;
  --muted:#64748b;
  --danger:#991b1b;
  --shadow:0 18px 45px rgba(8,43,69,.22);
}
*{box-sizing:border-box}
body{
  margin:0;
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  color:var(--fmv-blue);
  background:linear-gradient(135deg,#ded4c5,#f5efe4);
}
.app-shell{
  min-height:100vh;
  display:grid;
  grid-template-columns:370px minmax(0,1fr);
}
.sidebar{
  background:#fffaf2;
  border-right:1px solid var(--border);
  padding:18px;
  overflow:auto;
  max-height:100vh;
}
.brand{
  display:flex;
  gap:12px;
  align-items:center;
  margin-bottom:14px;
}
.brand-mark{
  width:54px;
  height:54px;
  border-radius:50%;
  background:var(--fmv-blue);
  color:#fff;
  border:5px solid var(--fmv-orange);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:1000;
}
h1{
  margin:0;
  font-size:19px;
  line-height:1.1;
}
.brand p{
  margin:3px 0 0;
  color:var(--muted);
  font-size:12px;
}
.notice{
  padding:12px 13px;
  border:1px solid #fed7aa;
  background:#fff7ed;
  color:#7c2d12;
  border-radius:14px;
  font-size:13px;
  line-height:1.35;
  margin:14px 0;
}
.card{
  background:#fff;
  border:1px solid #e3d8ca;
  border-radius:16px;
  padding:14px;
  margin:14px 0;
  box-shadow:0 8px 18px rgba(15,23,42,.04);
}
.card h2{
  margin:0 0 10px;
  font-size:13px;
  letter-spacing:.08em;
  text-transform:uppercase;
}
label{
  display:block;
  font-size:13px;
  font-weight:850;
  margin:10px 0 5px;
}
input,select,textarea,button,.file-button{
  width:100%;
  border:1px solid #cbd5e1;
  border-radius:11px;
  padding:10px;
  font:inherit;
  background:#fff;
}
textarea{min-height:112px;resize:vertical}
input[type=file]{background:#f8fafc}
button,.file-button{
  border:0;
  background:var(--fmv-blue);
  color:#fff;
  font-weight:900;
  cursor:pointer;
  text-align:center;
}
button.primary{background:var(--fmv-blue)}
button.orange{background:var(--fmv-orange)}
button.secondary,.file-button{
  background:#eef2f7;
  color:var(--fmv-blue);
  border:1px solid #cbd5e1;
}
.file-button input{display:none}
.button-row{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
  margin-top:10px;
}
.info,.status{
  margin-top:10px;
  padding:9px 10px;
  border:1px dashed #cbd5e1;
  border-radius:12px;
  background:#f8fafc;
  color:#334155;
  font-size:12px;
  line-height:1.35;
}
.status.error{
  color:var(--danger);
  background:#fef2f2;
  border-color:#fecaca;
}
details{
  border:1px solid #e2d7c8;
  border-radius:14px;
  padding:10px;
}
summary{
  cursor:pointer;
  font-size:13px;
  font-weight:900;
}
.workspace{
  padding:22px;
  overflow:auto;
}
.topbar{
  max-width:980px;
  margin:0 auto 12px;
  display:flex;
  justify-content:space-between;
  gap:10px;
}
.pill{
  background:#fff;
  border:1px solid #e2d7c8;
  border-radius:999px;
  padding:8px 13px;
  font-size:13px;
  font-weight:850;
  box-shadow:0 6px 18px rgba(15,23,42,.06);
}
.poster{
  position:relative;
  width:min(980px,100%);
  aspect-ratio:1/1;
  margin:auto;
  background:#f7efe3;
  border-radius:18px;
  overflow:hidden;
  box-shadow:var(--shadow);
}
.map,.poster canvas,.label-layer{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
}
.poster canvas{
  z-index:3;
  pointer-events:auto;
}
.map{
  z-index:1;
}
.label-layer{
  z-index:4;
  pointer-events:none;
}
.route-label{
  position:absolute;
  transform:translate(-50%,-50%);
  background:var(--fmv-blue);
  color:white;
  font-weight:950;
  font-size:13px;
  line-height:1;
  padding:8px 10px;
  border-radius:8px;
  box-shadow:0 5px 14px rgba(0,0,0,.28);
  white-space:nowrap;
  pointer-events:auto;
  cursor:move;
  user-select:none;
  border:1px solid rgba(255,255,255,.18);
}
.route-label.hidden{
  display:none;
}
.help{
  max-width:980px;
  margin:12px auto 0;
  color:#475569;
  font-size:13px;
  line-height:1.45;
}
.maplibregl-control-container{display:none}
@media(max-width:960px){
  .app-shell{grid-template-columns:1fr}
  .sidebar{max-height:none;border-right:0;border-bottom:1px solid var(--border)}
}

#mapScaleValue,#routeScaleValue{
  float:right;
  color:var(--muted);
  font-size:12px;
  font-weight:700;
}
#overlayCanvas.route-mode{cursor:grab}
#overlayCanvas.route-dragging{cursor:grabbing}

#overlayCanvas.map-mode{cursor:grab}
#overlayCanvas.map-dragging{cursor:grabbing}
.route-label{z-index:10}

/* V1.4 LabelFix */
.label-layer{
  pointer-events:none;
}
.route-label{
  pointer-events:auto!important;
  cursor:grab!important;
  touch-action:none;
}
.route-label.dragging{
  cursor:grabbing!important;
  outline:2px solid rgba(233,95,24,.55);
}

/* V1.6 AnchorDrag */
.anchor-handle{
  position:absolute;
  width:28px;
  height:28px;
  border-radius:50%;
  transform:translate(-50%,-50%);
  border:2px dashed rgba(255,255,255,.95);
  background:rgba(233,95,24,.18);
  box-shadow:0 0 0 2px rgba(8,43,69,.45) inset;
  pointer-events:auto;
  touch-action:none;
  cursor:grab;
  z-index:9;
}
.anchor-handle.hidden-ui{
  display:none;
}
.anchor-handle.dragging{
  cursor:grabbing;
  background:rgba(233,95,24,.35);
}


/* V1.8 Premium Look */
body{
  background:
    radial-gradient(circle at top left, rgba(255,248,235,.85), transparent 34%),
    linear-gradient(135deg,#ddd4c5,#f4ede1);
}

.notice{
  background:linear-gradient(180deg,#fff8ee,#fff2dd);
  border-color:#f0c28d;
}

.card{
  border:1px solid #e7ddcf;
  box-shadow:0 10px 24px rgba(15,23,42,.05);
}

.workspace{
  padding:24px;
}

.topbar .pill{
  background:rgba(255,255,255,.86);
  backdrop-filter: blur(6px);
}

.poster{
  background:#f4ead8;
  border:1px solid rgba(130,108,77,.16);
  border-radius:22px;
  box-shadow:
    0 26px 60px rgba(8,43,69,.18),
    inset 0 1px 0 rgba(255,255,255,.4);
}

.help{
  color:#5f6e78;
}

.route-label{
  border:1px solid rgba(255,255,255,.14);
  box-shadow:
    0 8px 20px rgba(0,0,0,.20),
    inset 0 1px 0 rgba(255,255,255,.08);
}

.anchor-handle{
  background:rgba(233,95,24,.13);
  box-shadow:
    0 0 0 2px rgba(8,43,69,.42) inset,
    0 0 0 1px rgba(255,255,255,.5);
}
